From bbd5c42171168acf23d9381fa15e46e437898809 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Tue, 18 Jul 2017 18:51:21 +0100 Subject: [PATCH] Add fix for Tegra GPU display with IOMMU --- arm-tegra-fix-gpu-iommu.patch | 95 +++++++++++++++++++++++++++++++++++ kernel.spec | 7 +++ 2 files changed, 102 insertions(+) create mode 100644 arm-tegra-fix-gpu-iommu.patch diff --git a/arm-tegra-fix-gpu-iommu.patch b/arm-tegra-fix-gpu-iommu.patch new file mode 100644 index 000000000..8d2809b46 --- /dev/null +++ b/arm-tegra-fix-gpu-iommu.patch @@ -0,0 +1,95 @@ +From patchwork Sun Jul 9 16:36:14 2017 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: ARM: tegra: Register host1x node with iommu binding on tegra124 +From: Paul Kocialkowski +X-Patchwork-Id: 9831825 +Message-Id: <20170709163614.6746-1-contact@paulk.fr> +To: linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org, + linux-kernel@vger.kernel.org +Cc: Thierry Reding , + Stephen Warren , + Mikko Perttunen , + Paul Kocialkowski , + Jonathan Hunter +Date: Sun, 9 Jul 2017 19:36:14 +0300 + +This registers the host1x node with the SMMU (as HC swgroup) to allow +the host1x code to attach to it. It avoid failing the probe sequence, +which resulted in the tegra drm driver not probing and thus nothing +being displayed on-screen. + +Signed-off-by: Paul Kocialkowski +--- + arch/arm/boot/dts/tegra124.dtsi | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm/boot/dts/tegra124.dtsi b/arch/arm/boot/dts/tegra124.dtsi +index 187a36c6d0fc..b3b89befffeb 100644 +--- a/arch/arm/boot/dts/tegra124.dtsi ++++ b/arch/arm/boot/dts/tegra124.dtsi +@@ -85,6 +85,7 @@ + clocks = <&tegra_car TEGRA124_CLK_HOST1X>; + resets = <&tegra_car 28>; + reset-names = "host1x"; ++ iommus = <&mc TEGRA_SWGROUP_HC>; + + #address-cells = <2>; + #size-cells = <2>; +From patchwork Mon Jul 10 19:33:05 2017 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: gpu: host1x: Free the IOMMU domain when there is no device to attach +From: Paul Kocialkowski +X-Patchwork-Id: 9833721 +Message-Id: <20170710193305.5987-1-contact@paulk.fr> +To: linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org, + linux-kernel@vger.kernel.org +Cc: Thierry Reding , + Stephen Warren , + Mikko Perttunen , + Paul Kocialkowski , + Jonathan Hunter +Date: Mon, 10 Jul 2017 21:33:05 +0200 + +When there is no device to attach to the IOMMU domain, as may be the +case when the device-tree does not contain the proper iommu node, it is +best to keep going without IOMMU support rather than failing. +This allows the driver to probe and function instead of taking down +all of the tegra drm driver, leading to missing display support. + +Signed-off-by: Paul Kocialkowski +Reviewed-by: Mikko Perttunen +--- + drivers/gpu/host1x/dev.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c +index ac65f52850a6..f296738d0de8 100644 +--- a/drivers/gpu/host1x/dev.c ++++ b/drivers/gpu/host1x/dev.c +@@ -186,8 +186,13 @@ static int host1x_probe(struct platform_device *pdev) + return -ENOMEM; + + err = iommu_attach_device(host->domain, &pdev->dev); +- if (err) ++ if (err == -ENODEV) { ++ iommu_domain_free(host->domain); ++ host->domain = NULL; ++ goto iommu_skip; ++ } else if (err) { + goto fail_free_domain; ++ } + + geometry = &host->domain->geometry; + +@@ -198,6 +203,7 @@ static int host1x_probe(struct platform_device *pdev) + host->iova_end = geometry->aperture_end; + } + ++iommu_skip: + err = host1x_channel_list_init(host); + if (err) { + dev_err(&pdev->dev, "failed to initialize channel list\n"); diff --git a/kernel.spec b/kernel.spec index 622ca9e1d..6cd994de3 100644 --- a/kernel.spec +++ b/kernel.spec @@ -615,6 +615,10 @@ Patch317: arm-thermal-fixes.patch # https://patchwork.kernel.org/patch/9802555/ Patch318: pinctrl-bcm2835-Avoid-warning-from-__irq_do_set_handler.patch +# https://patchwork.kernel.org/patch/9831825/ +# https://patchwork.kernel.org/patch/9833721/ +Patch319: arm-tegra-fix-gpu-iommu.patch + # 400 - IBM (ppc/s390x) patches # 500 - Temp fixes/CVEs etc @@ -2219,6 +2223,9 @@ fi # # %changelog +* Tue Jul 18 2017 Peter Robinson +- Add fix for Tegra GPU display with IOMMU + * Mon Jul 17 2017 Justin M. Forbes - 4.12.2-100 - Linux v4.12.2