From 6ad821cdedd01b4cf047b81ff9a1137a03270174 Mon Sep 17 00:00:00 2001 From: Joerg Roedel Date: Apr 14 2021 08:07:23 +0000 Subject: - iommu/vt-d: Use device numa domain if RHSA is missing (bsc#1184585). - Refresh patches.suse/iommu-vt-d-fix-ineffective-devtlb-invalidation-for-subdevices. --- diff --git a/patches.suse/iommu-vt-d-fix-ineffective-devtlb-invalidation-for-subdevices b/patches.suse/iommu-vt-d-fix-ineffective-devtlb-invalidation-for-subdevices index 17958a0..18996ac 100644 --- a/patches.suse/iommu-vt-d-fix-ineffective-devtlb-invalidation-for-subdevices +++ b/patches.suse/iommu-vt-d-fix-ineffective-devtlb-invalidation-for-subdevices @@ -26,8 +26,8 @@ Acked-by: Joerg Roedel --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c -@@ -695,12 +695,16 @@ static int domain_update_iommu_superpage - return fls(mask); +@@ -723,6 +723,8 @@ static int domain_update_device_node(str + return nid; } +static void domain_update_iotlb(struct dmar_domain *domain); @@ -35,15 +35,16 @@ Acked-by: Joerg Roedel /* Some capabilities may be different across iommus */ static void domain_update_iommu_cap(struct dmar_domain *domain) { - domain_update_iommu_coherency(domain); - domain->iommu_snooping = domain_update_iommu_snooping(NULL); - domain->iommu_superpage = domain_update_iommu_superpage(NULL); +@@ -736,6 +738,8 @@ static void domain_update_iommu_cap(stru + */ + if (domain->nid == NUMA_NO_NODE) + domain->nid = domain_update_device_node(domain); + + domain_update_iotlb(domain); } struct context_entry *iommu_context_addr(struct intel_iommu *iommu, u8 bus, -@@ -1383,17 +1387,22 @@ static void domain_update_iotlb(struct d +@@ -1418,17 +1422,22 @@ static void domain_update_iotlb(struct d assert_spin_locked(&device_domain_lock); @@ -74,7 +75,7 @@ Acked-by: Joerg Roedel } domain->has_iotlb_device = has_iotlb_device; -@@ -1475,25 +1484,37 @@ static void iommu_disable_dev_iotlb(stru +@@ -1510,25 +1519,37 @@ static void iommu_disable_dev_iotlb(stru #endif } @@ -120,4 +121,3 @@ Acked-by: Joerg Roedel } spin_unlock_irqrestore(&device_domain_lock, flags); } - diff --git a/patches.suse/iommu-vt-d-use-device-numa-domain-if-rhsa-is-missing b/patches.suse/iommu-vt-d-use-device-numa-domain-if-rhsa-is-missing new file mode 100644 index 0000000..c4fc8b4 --- /dev/null +++ b/patches.suse/iommu-vt-d-use-device-numa-domain-if-rhsa-is-missing @@ -0,0 +1,81 @@ +From: Lu Baolu +Date: Tue, 22 Sep 2020 14:08:43 +0800 +Subject: iommu/vt-d: Use device numa domain if RHSA is missing +Git-commit: d2ef0962492c3be3563e53a431c285678849b3c1 +Patch-mainline: v5.10-rc1 +References: bsc#1184585 + +If there are multiple NUMA domains but the RHSA is missing in ACPI/DMAR +table, we could default to the device NUMA domain as fall back. + +Signed-off-by: Lu Baolu +Reviewed-by: Kevin Tian +Cc: Jacob Pan +Cc: Kevin Tian +Cc: Ashok Raj +Link: https://lore.kernel.org/r/20200904010303.2961-1-baolu.lu@linux.intel.com +Link: https://lore.kernel.org/r/20200922060843.31546-2-baolu.lu@linux.intel.com +Signed-off-by: Joerg Roedel +--- + drivers/iommu/intel-iommu.c | 37 +++++++++++++++++++++++++++++++++++-- + 1 file changed, 35 insertions(+), 2 deletions(-) + +--- a/drivers/iommu/intel-iommu.c ++++ b/drivers/iommu/intel-iommu.c +@@ -695,12 +695,47 @@ static int domain_update_iommu_superpage + return fls(mask); + } + ++static int domain_update_device_node(struct dmar_domain *domain) ++{ ++ struct device_domain_info *info; ++ int nid = NUMA_NO_NODE; ++ ++ assert_spin_locked(&device_domain_lock); ++ ++ if (list_empty(&domain->devices)) ++ return NUMA_NO_NODE; ++ ++ list_for_each_entry(info, &domain->devices, link) { ++ if (!info->dev) ++ continue; ++ ++ /* ++ * There could possibly be multiple device numa nodes as devices ++ * within the same domain may sit behind different IOMMUs. There ++ * isn't perfect answer in such situation, so we select first ++ * come first served policy. ++ */ ++ nid = dev_to_node(info->dev); ++ if (nid != NUMA_NO_NODE) ++ break; ++ } ++ ++ return nid; ++} ++ + /* Some capabilities may be different across iommus */ + static void domain_update_iommu_cap(struct dmar_domain *domain) + { + domain_update_iommu_coherency(domain); + domain->iommu_snooping = domain_update_iommu_snooping(NULL); + domain->iommu_superpage = domain_update_iommu_superpage(NULL); ++ ++ /* ++ * If RHSA is missing, we should default to the device numa domain ++ * as fall back. ++ */ ++ if (domain->nid == NUMA_NO_NODE) ++ domain->nid = domain_update_device_node(domain); + } + + struct context_entry *iommu_context_addr(struct intel_iommu *iommu, u8 bus, +@@ -4943,8 +4978,6 @@ static struct iommu_domain *intel_iommu_ + intel_iommu_strict = 1; + } + +- domain_update_iommu_cap(dmar_domain); +- + domain = &dmar_domain->domain; + domain->geometry.aperture_start = 0; + domain->geometry.aperture_end = diff --git a/series.conf b/series.conf index 5e837ce..c0f3c35 100644 --- a/series.conf +++ b/series.conf @@ -16119,6 +16119,7 @@ patches.suse/ACPI-extlog-Check-for-RDMSR-failure.patch patches.suse/ACPI-button-fix-handling-lid-state-changes-when-inpu.patch patches.suse/iommu-qcom-add-missing-put_device-call-in-qcom_iommu_of_xlate + patches.suse/iommu-vt-d-use-device-numa-domain-if-rhsa-is-missing patches.suse/iommu-vt-d-gracefully-handle-dmar-units-with-no-supported-address-widths patches.suse/iomap-fix-WARN_ON_ONCE-from-unprivileged-users.patch patches.suse/iomap-Clear-page-error-before-beginning-a-write.patch