kernel/0001-iommu-arm-smmu-workaro...

99 lines
3.4 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Laura Abbott <labbott@redhat.com>
Date: Mon, 20 May 2019 22:21:02 -0400
Subject: [PATCH] iommu/arm-smmu: workaround DMA mode issues
Message-id: <20190520222102.19488-1-labbott@redhat.com>
Patchwork-id: 259215
O-Subject: [ARK INTERNAL PATCH] iommu/arm-smmu: workaround DMA mode issues
Bugzilla:
RH-Acked-by: Mark Langsdorf <mlangsdo@redhat.com>
RH-Acked-by: Mark Salter <msalter@redhat.com>
From: Mark Salter <msalter@redhat.com>
Rebased for v5.2-rc1
Bugzilla: 1652259
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=19244562
Upstream status: RHEL only.
rhel8 commit 65feb1ed0ec9a088a63a90d46c0f7563ac96ad0f
Author: Mark Salter <msalter@redhat.com>
Date: Wed Nov 21 17:15:59 2018 +0100
[iommu] iommu/arm-smmu: workaround DMA mode issues
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1624077
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=18112820
Testing: Verified iommu.passthrough=1 no longer needed on gigabyte platforms.
Upstream Status: RHEL-only
In RHEL_ALT 7.5 we carried a RHEL-only patch which forced the arm smmuv2
into bypass mode due to performance issues on CN88xx. This was intended
to be a temporary hack until the issues were resolved. Another vendor
had issues with the iommu in bypass mode so we reverted the RHEL-only
patch so that iommu is in DMA mode by default (upstream default).
It turns on that there are remaining SMMU DMA mode issues on Gigabyte
platformws with CN88xx cpus. The problem manifests itself by pcie
card drivers failing to initialize the cards when SMMU is in DMA mode.
The root cause has not been determined yet, but looks likely to be
a hw or firmware issue. This patch forces bypass mode for Gigabyte
platforms. CN88xx isn't officially supported in RHEL but we have a
lot of them being used internally for testing, so I think we want
this to support that use case in RHEL8.
Signed-off-by: Mark Salter <msalter@redhat.com>
Signed-off-by: Herton R. Krzesinski <herton@redhat.com>
Acked-by: Mark Salter <msalter@redhat.com>
Acked-by: Donald Dutile <ddutile@redhat.com>
Upstream Status: RHEL only
Signed-off-by: Laura Abbott <labbott@redhat.com>
---
drivers/iommu/iommu.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
kernel-5.8.0-0.rc5.20200714git0dc589da873b.1 * Tue Jul 14 2020 Fedora Kernel Team <kernel-team@fedoraproject.org> [5.8.0-0.rc5.20200714git0dc589da873b.1] - 0dc589da873b rebase - arm64: dts: sun50i-a64-pinephone: Add touchscreen support (Ondrej Jirman) - arm64: dts: sun50i-a64-pinephone: Enable LCD support on PinePhone (Icenowy Zheng) - drm/panel: st7703: Assert reset prior to powering down the regulators (Ondrej Jirman) - drm/panel: st7703: Enter sleep after display off (Ondrej Jirman) - drm/panel: st7703: Add support for Xingbangda XBD599 (Ondrej Jirman) - drm/panel: st7703: Move generic part of init sequence to enable callback (Ondrej Jirman) - drm/panel: st7703: Move code specific to jh057n closer together (Ondrej Jirman) - drm/panel: st7703: Prepare for supporting multiple panels (Ondrej Jirman) - drm/panel: st7703: Rename functions from jh057n prefix to st7703 (Ondrej Jirman) - drm/panel: rocktech-jh057n00900: Rename the driver to st7703 (Ondrej Jirman) - dt-bindings: panel: Add compatible for Xingbangda XBD599 panel (Ondrej Jirman) - dt-bindings: panel: Convert rocktech, jh057n00900 to yaml (Ondrej Jirman) - dt-bindings: vendor-prefixes: Add Xingbangda (Icenowy Zheng) - Revert "arm64: allwinner: dts: a64: add LCD-related device nodes for PinePhone" (Peter Robinson) - Revert "drm/sun4i: sun6i_mipi_dsi: fix horizontal timing calculation" (Peter Robinson) - Revert "drm: panel: add Xingbangda XBD599 panel" (Peter Robinson) - Revert "dt-bindings: panel: add binding for Xingbangda XBD599 panel" (Peter Robinson) - selinux: allow reading labels before policy is loaded (Jonathan Lebon) - Fixes "acpi: prefer booting with ACPI over DTS" to be RHEL only (Peter Robinson) - Update config for renamed panel driver. (Peter Robinson) - Enable SERIAL_SC16IS7XX for SPI interfaces (Peter Robinson) - Updated changelog for the release based on dcde237b9b0e (Fedora Kernel Team) Resolves: rhbz# Signed-off-by: Justin M. Forbes <jforbes@fedoraproject.org>
2020-07-14 15:52:28 +00:00
index b6858adc4f17..4c2da9f17514 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -7,6 +7,7 @@
#define pr_fmt(fmt) "iommu: " fmt
#include <linux/device.h>
+#include <linux/dmi.h>
#include <linux/kernel.h>
#include <linux/bug.h>
#include <linux/types.h>
kernel-5.8.0-0.rc0.20200610git84fc461db99b.1 * Wed Jun 10 2020 Fedora Kernel Team <kernel-team@fedoraproject.org> [5.8.0-0.rc0.20200610git84fc461db99b.1] - 84fc461db99b rebase - Fix PATCHLEVEL for merge window ("Justin M. Forbes") - PCI: tegra: Revert raw_violation_fixup for tegra124 (Nicolas Chauvet) - Change ark CONFIG_COMMON_CLK to yes, it is selected already by other options ("Justin M. Forbes") - More module filtering for Fedora ("Justin M. Forbes") - Update filters for rnbd in Fedora ("Justin M. Forbes") - Fix up module filtering for 5.8 ("Justin M. Forbes") - More Fedora config work ("Justin M. Forbes") - RTW88BE and CE have been extracted to their own modules ("Justin M. Forbes") - Set CONFIG_BLK_INLINE_ENCRYPTION_FALLBACK for Fedora ("Justin M. Forbes") - Arm64 Use Branch Target Identification for kernel ("Justin M. Forbes") - Fedora config updates ("Justin M. Forbes") - Change value of CONFIG_SECURITY_SELINUX_CHECKREQPROT_VALUE ("Justin M. Forbes") - Fix configs for Fedora ("Justin M. Forbes") - Fix update_scripts.sh unselective pattern sub (David Howells) - Updated changelog for the release based on b0c3ba31be3e ("CKI@GitLab") - Drop the static path configuration for the Sphinx docs (Jeremy Cline) - Sign off generated configuration patches (Jeremy Cline) - Use __make macro instead of make (Tom Stellard) - redhat/configs: Enable CONFIG_SMC91X and disable CONFIG_SMC911X (Prarit Bhargava) [http://bugzilla.redhat.com/1722136] Resolves: rhbz# Signed-off-by: Justin M. Forbes <jforbes@fedoraproject.org>
2020-06-10 22:01:45 +00:00
@@ -2838,3 +2839,24 @@ int iommu_sva_get_pasid(struct iommu_sva *handle)
return ops->sva_get_pasid(handle);
}
EXPORT_SYMBOL_GPL(iommu_sva_get_pasid);
+
+#ifdef CONFIG_ARM64
+static int __init iommu_quirks(void)
+{
+ const char *vendor, *name;
+
+ vendor = dmi_get_system_info(DMI_SYS_VENDOR);
+ name = dmi_get_system_info(DMI_PRODUCT_NAME);
+
+ if (vendor &&
+ (strncmp(vendor, "GIGABYTE", 8) == 0 && name &&
+ (strncmp(name, "R120", 4) == 0 ||
+ strncmp(name, "R270", 4) == 0))) {
+ pr_warn("Gigabyte %s detected, force iommu passthrough mode", name);
+ iommu_def_domain_type = IOMMU_DOMAIN_IDENTITY;
+ }
+
+ return 0;
+}
+arch_initcall(iommu_quirks);
+#endif
--
2.26.2