kernel/kernel-rt/debian/patches/0006-intel-iommu-allow-ignoring-Ethernet-device-RMRR-with.patch
Li Zhou 79e7b8794c kernel-rt: upgrade to 6.6.7
Update kernel source to 6.6.7 from linux-yocto upstream.
Update "debian" folder source to 6.1.27-1~bpo11+1 from debian upstream,
because kernel 6.6.7 is ported to our bullseye platform now and
the newest "debian" folder from debian upstream for bullseye platform
is for 6.1.

Add an optimization for the StarlingX debian kernel building framework:
We used to always maintain kernel with patches on "debian" folder
and they are put at kernel/kernel-std(rt)/debian/deb_patches dir.
Most of these patches are about "changelog" (debian/changelog) and
"config" (debian/config/amd64/none/config). The patches in "deb_patches"
dir increased rapidly.
Next We will put "changelog" and "config" at the dir
kernel/kernel-std(rt)/debian/source and use them to replace
debian/changelog and debian/config/amd64/none/config
after the upstream "debian" folder is extracted. This can not only
keep a clean "deb_patches" folder, but also avoid using a big patch to
remove the "changelog" file in the upstream "debian" folder before any
kernel build.

Below are changes about "deb_patches"/"patches" for kernel-rt:
(We use the patches' serial number in their name to represent them
becuase so many patches are involved here.)

(1)about "deb_patches" folder:

(1.1)Because of the optimization, all the patches about changelog
and config for 5.10 can be abandoned and they will be changed directly
in the files under "source" dir for 6.6.
Patches for 5.10 that are abandoned because they are about config:
0003/0005/0006/0007/0008/0010/0011/0016/0018/0022/0026/0028
Patches for 5.10 that are abandoned because they are about changelog:
0001/0002/0007/0013/0020/0023/0024/0025/0027/0029/0030/0032/0033/0034

The "changelog" and "config" under "source" dir for 6.6 are verified
to be aligned with those for 5.10 build.
CONFIG_FANOTIFY is enabled in "config" as a new request.

(1.2)Patch 0017 for 5.10 is abandoned because the new commit
<Use parallel XZ for source tar generation> is available in new
version "debian" folder, which does the same work.
Refer to: https://salsa.debian.org/kernel-team/linux/-/commit/
50b61a14e6dbc50b19dfe938c4679ecda50b83ee

(1.3)Below patches for 5.10 are ported to 6.6:
0004/0009/0015 (0009/0015 are merged into 0004) compose patch 0001
for 6.6;
0014 is ported to 0002 for 6.6;
0021 is ported to 0003 for 6.6;
0005/0019 (0005 is merged into 0019) compose patch 0004 for 6.6;
0012 is ported to 0005 for 6.6;
0031 is ported to 0006 for 6.6.

List the new patches for 6.6:
New patches 0001-0006 are ported from "deb_patches" for 5.10;
New patches 0007-0010 are added for building kernel 6.6.7 with
6.1.27-1~bpo11+1 "debian" folder.

(2)about "patches" folder:

(2.1)Patches for 5.10 that are abandoned because they are already in
6.6.7 include:
0017-0027/0031-0038/0041-0056/0058-0071/0073-0081/0083

(2.2)Patch 0011 for 5.10 is abandoned for new upstream commit
<scsi: smartpqi: Expose SAS address for SATA drives> in 6.6.
Refer to: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/
linux.git/commit/?id=00598b056aa6d46c7a6819efa850ec9d0d690d76
The new upstream commit has done what 0011 does.

(2.3)Patch 0039 for 5.10 is abandoned for new upstream commit
<samples/bpf: replace broken overhead microbenchmark with
fib_table_lookup> in 6.6.
Refer to: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/
linux.git/commit/?id=58e975d014e1e31bd1586be7d2be6d61bd3e3ada
0038 isn't needed any more with the new commit merged.

(2.4)Patch 0030 for 5.10 is abandoned because the related code has
been changed in 6.6 and the issue was verified to disappear.

(2.5)Patch 0010 for 5.10 is abandoned and the issue will be fixed by
setting /config/target/iscsi/cpus_allowed_list to be same with kernel
parameter "kthread_cpus". Because the new patch
<scsi: target: Add iscsi/cpus_allowed_list in configfs>
adds iscsi/cpus_allowed_list in configfs. The available CPU set of
iSCSI connection RX/TX threads is allowed_cpus & online_cpus.
This will do the same thing with patch 0010 so long as we set
cpus_allowed_list properly.
Refer to: <https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/
linux.git/commit/?id=d72d827f2f2636d8d72f0f3ebe5b661c9a24d343>
This issue will be addressed by later patches on stx framework part.

(2.6)Patch 0015-0016 are abandoned because the issue has been fixed
from the user space side by using the stable /dev/disk/by-path/...
symbolic links instead of names like /dev/sda that can change
(confirmed by M. Vefa Bicakci).

(2.7)Below patches for 5.10 are ported to 6.6:
0001-0009/0012/0028-0029/0040/0057/0082

(3)about kernel config:
(3.1) Enable CONFIG_GNSS for the ice driver.

Test plan:
 The out of tree kernel modules for 6.6 aren't ready by now.
 So many tests can't be done yet because the related test environments
 need those OOT drivers. Here list the tests which have been done with
 a test patch to remove the OOT drivers from the ISO temporarily.
 There are also 2 patches as workaround for solving 2 issues met when
 installing lab in jenkins job.
 PASS: Build linux/linux-rt OK.
 PASS: Build ISO OK.
 PASS: Install and boot up OK on a AIO-SX lab with std/rt kernel.
 PASS: The 12 hours cyclictest result for rt kernel is:
       samples:  259199998	avg:   1658	max:   5455
       99.9999th percentile: 3725	overflows: 0

Story: 2011000
Task: 49365

Signed-off-by: Li Zhou <li.zhou@windriver.com>
Change-Id: I6601fd2d7be4fc314ef2bc03b46f851eabebe3ea
(cherry picked from commit 06f53ed8e2a11676d4c8fca745c34dcaa3d889be)
Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>
2024-07-09 23:59:50 +00:00

128 lines
5.4 KiB
Diff

From f311c0cd55b9fb90696350d8545cf46381ccc805 Mon Sep 17 00:00:00 2001
From: Matt Peters <matt.peters@windriver.com>
Date: Mon, 30 May 2016 10:51:02 -0400
Subject: [PATCH] intel-iommu: allow ignoring Ethernet device RMRR with IOMMU
passthrough
Some BIOS's are reporting DMAR RMRR entries for Ethernet devices
which is causing problems when PCI passthrough is enabled. These
devices should be able to use the static identity map since the
host should not be enforcing specific address ranges when IOMMU
passthrough is enabled.
Originally-by: Matt Peters <matt.peters@windriver.com>
[PG: Added bootarg wrapper and documentation entries.]
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Nam Ninh <nam.ninh@windriver.com>
Signed-off-by: Jim Somerville <Jim.Somerville@windriver.com>
Signed-off-by: Zhang Zhiguo <zhangzhg@neusoft.com>
Signed-off-by: Dongqi Chen <chen.dq@neusoft.com>
[lz: Adapted the patch for context changes.]
Signed-off-by: Li Zhou <li.zhou@windriver.com>
[jp: fix warning: this 'else' clause does not guard]
Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>
[lz: Adapted the patch for upgrading kernel from 5.10 to 6.6.]
Signed-off-by: Li Zhou <li.zhou@windriver.com>
---
.../admin-guide/kernel-parameters.txt | 5 +++++
Documentation/arch/x86/iommu.rst | 18 +++++++++++++++
drivers/iommu/intel/iommu.c | 22 ++++++++++++++++++-
3 files changed, 44 insertions(+), 1 deletion(-)
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 44b3c3f8c..d7c13e702 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -2115,6 +2115,11 @@
bypassed by not enabling DMAR with this option. In
this case, gfx device will use physical address for
DMA.
+ eth_no_rmrr [Default Off]
+ With this option provided, the kernel will ignore
+ any specified RMRR regions specified by the BIOS
+ for PCI ethernet devices. Confirm with your hardware
+ vendor the RMRR regions are indeed invalid first.
strict [Default Off]
Deprecated, equivalent to iommu.strict=1.
sp_off [Default Off]
diff --git a/Documentation/arch/x86/iommu.rst b/Documentation/arch/x86/iommu.rst
index 42c7a6faa..edcbff38c 100644
--- a/Documentation/arch/x86/iommu.rst
+++ b/Documentation/arch/x86/iommu.rst
@@ -35,6 +35,24 @@ regions will fail. Hence BIOS uses RMRR to specify these regions along with
devices that need to access these regions. OS is expected to setup
unity mappings for these regions for these devices to access these regions.
+RMRR for other devices?
+-----------------------
+
+There are reports of BIOS out there that indicate RMRR regions for things
+like ethernet devices. As per mainline commit c875d2c1b8083 ("iommu/vt-d:
+Exclude devices using RMRRs from IOMMU API domains") such a device is
+"fundamentally incompatible" with the IOMMU API and "we must prevent such
+devices from being used by the IOMMU API." However, in the event that
+the RMRR indicated by the BIOS is assumed to be just a reporting error,
+there is an additional iommu boot arg that can be used to ignore RMRR
+settings for ethernet, i.e. "intel_iommu=on,eth_no_rmrr iommu=pt".
+Note that iommu=pt is required in order to eth_no_rmrr to have effect.
+
+If you use this setting, you should consult with your hardware vendor to
+confirm that it is just a reporting error, and that it truly is not
+actively using any DMA to/from RMRR, as otherwise system instability
+may result.
+
What is AMD IVRS?
^^^^^^^^^^^^^^^^^
diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index 4c3707384..6b185695a 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -293,6 +293,7 @@ EXPORT_SYMBOL_GPL(intel_iommu_enabled);
static int dmar_map_gfx = 1;
static int intel_iommu_superpage = 1;
+static int intel_iommu_ethrmrr = 1;
static int iommu_identity_mapping;
static int iommu_skip_te_disable;
@@ -339,6 +340,15 @@ static int __init intel_iommu_setup(char *str)
} else if (!strncmp(str, "forcedac", 8)) {
pr_warn("intel_iommu=forcedac deprecated; use iommu.forcedac instead\n");
iommu_dma_forcedac = true;
+ } else if (!strncmp(str, "eth_no_rmrr", 11)) {
+ if (!iommu_default_passthrough()) {
+ printk(KERN_WARNING
+ "Intel-IOMMU: error - eth_no_rmrr requires iommu=pt\n");
+ } else {
+ printk(KERN_INFO
+ "Intel-IOMMU: ignoring ethernet RMRR values\n");
+ intel_iommu_ethrmrr = 0;
+ }
} else if (!strncmp(str, "strict", 6)) {
pr_warn("intel_iommu=strict deprecated; use iommu.strict=1 instead\n");
iommu_set_dma_strict();
@@ -2518,8 +2528,18 @@ static bool device_rmrr_is_relaxable(struct device *dev)
pdev = to_pci_dev(dev);
if (IS_USB_DEVICE(pdev) || IS_GFX_DEVICE(pdev))
return true;
- else
+ else {
+ /* As a temporary workaround for issues seen on ProLiant DL380p,
+ * allow the operator to ignore the RMRR settings for ethernet
+ * devices. Ideally the end user should contact their vendor
+ * regarding why there are RMRR, as per mainline c875d2c1b8083
+ * ("iommu/vt-d: Exclude devices using RMRRs from IOMMU API domains")
+ * it seems that these make no sense at all.
+ */
+ if ((pdev->class >> 8) == PCI_CLASS_NETWORK_ETHERNET && !intel_iommu_ethrmrr)
+ return true;
return false;
+ }
}
/*
--
2.17.1