fix nouveau on Tegra, Enable IOMMU on Exynos

This commit is contained in:
Peter Robinson 2018-04-12 08:29:41 +01:00 committed by Jeremy Cline
parent 326828aa4a
commit d251871b10
No known key found for this signature in database
GPG Key ID: 9223308FA9B246DB
8 changed files with 80 additions and 10 deletions

View File

@ -0,0 +1,64 @@
From 369971aa0101c4cfb84dacaaaa1b5cc5790c14ff Mon Sep 17 00:00:00 2001
From: Thierry Reding <treding@nvidia.com>
Date: Wed, 11 Apr 2018 10:34:17 +0200
Subject: [PATCH] drm/nouveau: tegra: Detach from ARM DMA/IOMMU mapping
Depending on the kernel configuration, early ARM architecture setup code
may have attached the GPU to a DMA/IOMMU mapping that transparently uses
the IOMMU to back the DMA API. Tegra requires special handling for IOMMU
backed buffers (a special bit in the GPU's MMU page tables indicates the
memory path to take: via the SMMU or directly to the memory controller).
Transparently backing DMA memory with an IOMMU prevents Nouveau from
properly handling such memory accesses and causes memory access faults.
As a side-note: buffers other than those allocated in instance memory
don't need to be physically contiguous from the GPU's perspective since
the GPU can map them into contiguous buffers using its own MMU. Mapping
these buffers through the IOMMU is unnecessary and will even lead to
performance degradation because of the additional translation.
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c
index 1f07999aea1d..ac7706f56f6f 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c
@@ -19,6 +19,11 @@
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
+
+#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)
+#include <asm/dma-iommu.h>
+#endif
+
#include <core/tegra.h>
#ifdef CONFIG_NOUVEAU_PLATFORM_DRIVER
#include "priv.h"
@@ -105,6 +110,20 @@ nvkm_device_tegra_probe_iommu(struct nvkm_device_tegra *tdev)
unsigned long pgsize_bitmap;
int ret;
+#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)
+ if (dev->archdata.mapping) {
+ struct dma_iommu_mapping *mapping = to_dma_iommu_mapping(dev);
+
+ arm_iommu_release_mapping(mapping);
+ arm_iommu_detach_device(dev);
+
+ if (dev->archdata.dma_coherent)
+ set_dma_ops(dev, &arm_coherent_dma_ops);
+ else
+ set_dma_ops(dev, &arm_dma_ops);
+ }
+#endif
+
if (!tdev->func->iommu_bit)
return;
--
2.16.3

View File

@ -1 +1 @@
# CONFIG_DRM_EXYNOS_IOMMU is not set
CONFIG_DRM_EXYNOS_IOMMU=y

View File

@ -1 +1 @@
# CONFIG_EXYNOS_IOMMU is not set
CONFIG_EXYNOS_IOMMU=y

View File

@ -1367,7 +1367,7 @@ CONFIG_DRM_EXYNOS_DSI=y
CONFIG_DRM_EXYNOS_FIMD=y
CONFIG_DRM_EXYNOS_G2D=y
CONFIG_DRM_EXYNOS_HDMI=y
# CONFIG_DRM_EXYNOS_IOMMU is not set
CONFIG_DRM_EXYNOS_IOMMU=y
CONFIG_DRM_EXYNOS=m
CONFIG_DRM_EXYNOS_MIC=y
CONFIG_DRM_EXYNOS_MIXER=y
@ -1677,7 +1677,7 @@ CONFIG_EXYNOS5420_MCPM=y
CONFIG_EXYNOS_ADC=m
CONFIG_EXYNOS_AUDSS_CLK_CON=m
# CONFIG_EXYNOS_IOMMU_DEBUG is not set
# CONFIG_EXYNOS_IOMMU is not set
CONFIG_EXYNOS_IOMMU=y
CONFIG_EXYNOS_THERMAL=y
# CONFIG_EZNPS_GIC is not set
# CONFIG_EZX_PCAP is not set

View File

@ -1309,7 +1309,7 @@ CONFIG_DRM_EXYNOS_DSI=y
CONFIG_DRM_EXYNOS_FIMD=y
CONFIG_DRM_EXYNOS_G2D=y
CONFIG_DRM_EXYNOS_HDMI=y
# CONFIG_DRM_EXYNOS_IOMMU is not set
CONFIG_DRM_EXYNOS_IOMMU=y
CONFIG_DRM_EXYNOS=m
CONFIG_DRM_EXYNOS_MIC=y
CONFIG_DRM_EXYNOS_MIXER=y
@ -1586,7 +1586,7 @@ CONFIG_EXYNOS5420_MCPM=y
CONFIG_EXYNOS_ADC=m
CONFIG_EXYNOS_AUDSS_CLK_CON=m
# CONFIG_EXYNOS_IOMMU_DEBUG is not set
# CONFIG_EXYNOS_IOMMU is not set
CONFIG_EXYNOS_IOMMU=y
CONFIG_EXYNOS_THERMAL=y
# CONFIG_EZNPS_GIC is not set
# CONFIG_EZX_PCAP is not set

View File

@ -1299,7 +1299,7 @@ CONFIG_DRM_EXYNOS_DSI=y
CONFIG_DRM_EXYNOS_FIMD=y
CONFIG_DRM_EXYNOS_G2D=y
CONFIG_DRM_EXYNOS_HDMI=y
# CONFIG_DRM_EXYNOS_IOMMU is not set
CONFIG_DRM_EXYNOS_IOMMU=y
CONFIG_DRM_EXYNOS=m
CONFIG_DRM_EXYNOS_MIC=y
CONFIG_DRM_EXYNOS_MIXER=y
@ -1576,7 +1576,7 @@ CONFIG_EXYNOS5420_MCPM=y
CONFIG_EXYNOS_ADC=m
CONFIG_EXYNOS_AUDSS_CLK_CON=m
# CONFIG_EXYNOS_IOMMU_DEBUG is not set
# CONFIG_EXYNOS_IOMMU is not set
CONFIG_EXYNOS_IOMMU=y
CONFIG_EXYNOS_THERMAL=y
# CONFIG_EZNPS_GIC is not set
# CONFIG_EZX_PCAP is not set

View File

@ -1357,7 +1357,7 @@ CONFIG_DRM_EXYNOS_DSI=y
CONFIG_DRM_EXYNOS_FIMD=y
CONFIG_DRM_EXYNOS_G2D=y
CONFIG_DRM_EXYNOS_HDMI=y
# CONFIG_DRM_EXYNOS_IOMMU is not set
CONFIG_DRM_EXYNOS_IOMMU=y
CONFIG_DRM_EXYNOS=m
CONFIG_DRM_EXYNOS_MIC=y
CONFIG_DRM_EXYNOS_MIXER=y
@ -1667,7 +1667,7 @@ CONFIG_EXYNOS5420_MCPM=y
CONFIG_EXYNOS_ADC=m
CONFIG_EXYNOS_AUDSS_CLK_CON=m
# CONFIG_EXYNOS_IOMMU_DEBUG is not set
# CONFIG_EXYNOS_IOMMU is not set
CONFIG_EXYNOS_IOMMU=y
CONFIG_EXYNOS_THERMAL=y
# CONFIG_EZNPS_GIC is not set
# CONFIG_EZX_PCAP is not set

View File

@ -608,6 +608,8 @@ Patch312: bcm283x-clk-audio-fixes.patch
# https://marc.info/?l=linux-kernel&m=152328880417846&w=2
Patch313: arm64-thunderx-crypto-zip-fixes.patch
Patch314: arm-tegra-fix-nouveau-crash.patch
# Enabling Patches for the RPi3+
Patch320: bcm2837-rpi-initial-support-for-the-3.patch
Patch321: bcm2837-gpio-expander.patch
@ -1886,6 +1888,10 @@ fi
#
#
%changelog
* Thu Apr 12 2018 Peter Robinson <pbrobinson@fedoraproject.org>
- Patch to fix nouveau on Tegra platforms
- Enable IOMMU on Exynos now upstream does
* Mon Apr 09 2018 Jeremy Cline <jeremy@jcline.org>
- Include the KCS IPMI BMC driver that's in F27