Skip to contentSkip to conversation

FAILED: patch "[PATCH] iommu/vt-d: Force requesting ACS when tboot is enabled" failed to apply to 5.10-stable tree

PATCH New [email protected] 2 participants 3 messages Sep 3 – Sep 9

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x 607432b2618b61df81134be0ef2562b8300c1216
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026090351-finlike-grumbling-0d17@gregkh' --subject-prefix 'PATCH 5.10.y' 'HEAD^..'

Possible dependencies:

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 607432b2618b61df81134be0ef2562b8300c1216 Mon Sep 17 00:00:00 2001
From: Kevin Tian <[email protected]>
Date: Wed, 5 Aug 2026 07:43:00 +0800
Subject: [PATCH] iommu/vt-d: Force requesting ACS when tboot is enabled

Currently the conditions of requesting ACS in detect_intel_iommu() don't include tboot, leading to a possible misconfiguration with ACS disabled (e.g. due to user opts) while iommu is later forced on by tboot_force_iommu().

Fix it by checking tboot in detect_intel_iommu().

Fixes 5d990b627537 ("PCI: add pci_request_acs")
drivers/iommu/intel/dmar.c +13 -2
index 767ec092accd..e32685402f74 100644
@@ -915,6 +915,18 @@ dmar_validate_one_drhd(struct acpi_dmar_header *entry, void *arg)
 	return 0;
 }
 
+static bool dmar_required(void)
+{
+	/* tboot supersedes any user/platform opt */
+	if (!intel_iommu_tboot_noforce && tboot_enabled())
+		return true;
+
+	if (!no_iommu && (!dmar_disabled || dmar_platform_optin()))
+		return true;
+
+	return false;
+}
+
 void __init detect_intel_iommu(void)
 {
 	int ret;
@@ -928,8 +940,7 @@ void __init detect_intel_iommu(void)
 	if (!ret)
 		ret = dmar_walk_dmar_table((struct acpi_table_dmar *)dmar_tbl,
 					   &validate_drhd_cb);
-	if (!ret && !no_iommu && !iommu_detected &&
-	    (!dmar_disabled || dmar_platform_optin())) {
+	if (!ret && !iommu_detected && dmar_required()) {
 		iommu_detected = 1;
 		/* Make sure ACS will be enabled */
 		pci_request_acs();
drivers/iommu/intel/iommu.c +1 -1
index 1a1f27a51063..4d03d9a517de 100644
@@ -57,7 +57,7 @@ static int rwbf_quirk;
  * (used when kernel is launched w/ TXT)
  */
 static int force_on = 0;
-static int intel_iommu_tboot_noforce;
+int intel_iommu_tboot_noforce;
 static int no_platform_optin;
 
 #define ROOT_ENTRY_NR (VTD_PAGE_SIZE/sizeof(struct root_entry))
drivers/iommu/intel/iommu.h +2 -0
index 775f1c4ae346..2cee36138d6e 100644
@@ -1354,6 +1354,7 @@ static inline bool ecmd_has_pmu_essential(struct intel_iommu *iommu)
 
 extern int dmar_disabled;
 extern int intel_iommu_enabled;
+extern int intel_iommu_tboot_noforce;
 #else
 static inline int iommu_calculate_agaw(struct intel_iommu *iommu)
 {
@@ -1366,6 +1367,7 @@ static inline int iommu_calculate_max_sagaw(struct intel_iommu *iommu)
 #define dmar_disabled	(1)
 #define intel_iommu_enabled (0)
 #define intel_iommu_sm (0)
+#define intel_iommu_tboot_noforce (0)
 #endif
 
 static inline const char *decode_prq_descriptor(char *str, size_t size,
maintainer
#1 lore raw

PATCH 1/2 iommu/vt-d: Move include/linux/intel-iommu.h under iommu

From: Lu Baolu <[email protected]>

[ Upstream commit 2585a2790e7fdb3dadfe309c9220bbc03704f84f ]

This header file is private to the Intel IOMMU driver. Move it to the driver folder.

Adapt the dependency to Linux 5.10 for 607432b2618b ("iommu/vt-d:
Force requesting ACS when tboot is enabled").

Omit the cap_audit.c, perf.c and private trace.h changes because these files do not exist here. Preserve the 5.10 includes in iommu.c and retain a forwarding include/linux/intel-iommu.h for the existing tboot, KVM, graphics and trace users. Keep its MAINTAINERS entry as well.

Prepare the existing detect_intel_iommu() for the target's helper insertion by giving it the upstream void return type and calling it from pci_iommu_alloc() after the other IOMMU probes. Remove its table entry and preserve IOMMU_FINISH_IF_DETECTED early exits with return. Guard the direct call with CONFIG_DMAR_TABLE; no new function or stub is needed, and the other IOMMUs retain the table infrastructure.

Move the retained intel_iommu_gfx_mapped declaration ahead of the shared enable flags and provide the disabled intel_iommu_sm constant expected by the target's header hunk. No functions are added.

[ sashal: Reduced backport -- upstream 2585a2790e7fd touches 11 file(s), this
backport carries 10. Not backported here:
drivers/iommu/intel/cap_audit.c
drivers/iommu/intel/perf.c
drivers/iommu/intel/trace.h
MAINTAINERS
This note is generated from the file lists only; see the resolution record for the reasoning. ]

Stable-dep-of: 607432b2618b ("iommu/vt-d: Force requesting ACS when tboot is enabled")

---
 arch/x86/kernel/pci-dma.c           |   5 +-
 drivers/iommu/intel/debugfs.c       |   2 +-
 drivers/iommu/intel/dmar.c          |   8 +-
 drivers/iommu/intel/iommu.c         |   2 +-
 drivers/iommu/intel/iommu.h         | 820 ++++++++++++++++++++++++++++
 drivers/iommu/intel/irq_remapping.c |   2 +-
 drivers/iommu/intel/pasid.c         |   2 +-
 drivers/iommu/intel/svm.c           |   2 +-
 include/linux/dmar.h                |   2 +-
 include/linux/intel-iommu.h         | 819 +--------------------------
 10 files changed, 834 insertions(+), 830 deletions(-)
 create mode 100644 drivers/iommu/intel/iommu.h
arch/x86/kernel/pci-dma.c +4 -1
index de234e7a8962e..7a2e9d4c6b841 100644
@@ -49,9 +49,12 @@ void __init pci_iommu_alloc(void)
 			if (p->early_init)
 				p->early_init();
 			if (p->flags & IOMMU_FINISH_IF_DETECTED)
-				break;
+				return;
 		}
 	}
+#ifdef CONFIG_DMAR_TABLE
+	detect_intel_iommu();
+#endif
 }
 
 /*
drivers/iommu/intel/debugfs.c +1 -1
index efea7f02abd91..c35d794e65bae 100644
@@ -10,11 +10,11 @@
 
 #include <linux/debugfs.h>
 #include <linux/dmar.h>
-#include <linux/intel-iommu.h>
 #include <linux/pci.h>
 
 #include <asm/irq_remapping.h>
 
+#include "iommu.h"
 #include "pasid.h"
 
 struct tbl_walk {
drivers/iommu/intel/dmar.c +2 -6
index 9b6aa97be7b51..8e9b5a0b6202e 100644
@@ -19,7 +19,6 @@
 #include <linux/pci.h>
 #include <linux/dmar.h>
 #include <linux/iova.h>
-#include <linux/intel-iommu.h>
 #include <linux/timer.h>
 #include <linux/irq.h>
 #include <linux/interrupt.h>
@@ -30,8 +29,8 @@
 #include <linux/numa.h>
 #include <linux/limits.h>
 #include <asm/irq_remapping.h>
-#include <asm/iommu_table.h>
 
+#include "iommu.h"
 #include "../irq_remapping.h"
 
 typedef int (*dmar_res_handler_t)(struct acpi_dmar_header *, void *);
@@ -908,7 +907,7 @@ dmar_validate_one_drhd(struct acpi_dmar_header *entry, void *arg)
 	return 0;
 }
 
-int __init detect_intel_iommu(void)
+void __init detect_intel_iommu(void)
 {
 	int ret;
 	struct dmar_res_callback validate_drhd_cb = {
@@ -941,8 +940,6 @@ int __init detect_intel_iommu(void)
 		dmar_tbl = NULL;
 	}
 	up_write(&dmar_global_lock);
-
-	return ret ? ret : 1;
 }
 
 static void unmap_iommu(struct intel_iommu *iommu)
@@ -2062,7 +2059,6 @@ static int __init dmar_free_unused_resources(void)
 }
 
 late_initcall(dmar_free_unused_resources);
-IOMMU_INIT_POST(detect_intel_iommu);
 
 /*
  * DMAR Hotplug Support
drivers/iommu/intel/iommu.c +1 -1
index a4c538d7522e1..b9a01ef44e0a3 100644
@@ -31,7 +31,6 @@
 #include <linux/io.h>
 #include <linux/iova.h>
 #include <linux/iommu.h>
-#include <linux/intel-iommu.h>
 #include <linux/syscore_ops.h>
 #include <linux/tboot.h>
 #include <linux/dmi.h>
@@ -47,6 +46,7 @@
 #include <asm/iommu.h>
 #include <trace/events/intel_iommu.h>
 
+#include "iommu.h"
 #include "../irq_remapping.h"
 #include "pasid.h"
 
drivers/iommu/intel/iommu.h new file +820 -0

820 lines not on this page · raw message

drivers/iommu/intel/irq_remapping.c +1 -1
index b853888774e65..fd377e25dd83c 100644
@@ -10,7 +10,6 @@
 #include <linux/hpet.h>
 #include <linux/pci.h>
 #include <linux/irq.h>
-#include <linux/intel-iommu.h>
 #include <linux/acpi.h>
 #include <linux/irqdomain.h>
 #include <linux/crash_dump.h>
@@ -22,6 +21,7 @@
 #include <asm/pci-direct.h>
 #include <asm/msidef.h>
 
+#include "iommu.h"
 #include "../irq_remapping.h"
 
 enum irq_mode {
drivers/iommu/intel/pasid.c +1 -1
index 49fbe1759de67..eab2ca92b3f85 100644
@@ -12,13 +12,13 @@
 #include <linux/bitops.h>
 #include <linux/cpufeature.h>
 #include <linux/dmar.h>
-#include <linux/intel-iommu.h>
 #include <linux/iommu.h>
 #include <linux/memory.h>
 #include <linux/pci.h>
 #include <linux/pci-ats.h>
 #include <linux/spinlock.h>
 
+#include "iommu.h"
 #include "pasid.h"
 
 /*
drivers/iommu/intel/svm.c +1 -1
index f2f8f92738def..b011476c44dbe 100644
@@ -5,7 +5,6 @@
  * Authors: David Woodhouse <[email protected]>
  */
 
-#include <linux/intel-iommu.h>
 #include <linux/mmu_notifier.h>
 #include <linux/sched.h>
 #include <linux/sched/mm.h>
@@ -21,6 +20,7 @@
 #include <asm/page.h>
 #include <asm/fpu/api.h>
 
+#include "iommu.h"
 #include "pasid.h"
 
 static irqreturn_t prq_event_thread(int irq, void *d);
include/linux/dmar.h +1 -1
index 65565820328ab..8513953b8b874 100644
@@ -121,7 +121,7 @@ extern int dmar_remove_dev_scope(struct dmar_pci_notify_info *info,
 				 u16 segment, struct dmar_dev_scope *devices,
 				 int count);
 /* Intel IOMMU detection */
-extern int detect_intel_iommu(void);
+void detect_intel_iommu(void);
 extern int enable_drhd_fault_handling(void);
 extern int dmar_device_add(acpi_handle handle);
 extern int dmar_device_remove(acpi_handle handle);
include/linux/intel-iommu.h +2 -817

820 lines not on this page · raw message

Signature · 1 line
2.53.0
maintainer
#2 lore raw

PATCH 2/2 iommu/vt-d: Force requesting ACS when tboot is enabled

From: Kevin Tian <[email protected]>

[ Upstream commit 607432b2618b61df81134be0ef2562b8300c1216 ]

Currently the conditions of requesting ACS in detect_intel_iommu() don't include tboot, leading to a possible misconfiguration with ACS disabled (e.g. due to user opts) while iommu is later forced on by tboot_force_iommu().

Fix it by checking tboot in detect_intel_iommu().

Fixes 5d990b627537 ("PCI: add pci_request_acs")
---
 drivers/iommu/intel/dmar.c  | 15 +++++++++++++--
 drivers/iommu/intel/iommu.c |  2 +-
 drivers/iommu/intel/iommu.h |  2 ++
 3 files changed, 16 insertions(+), 3 deletions(-)
drivers/iommu/intel/dmar.c +13 -2
index 8e9b5a0b6202e..ab7c03ce5166d 100644
@@ -907,6 +907,18 @@ dmar_validate_one_drhd(struct acpi_dmar_header *entry, void *arg)
 	return 0;
 }
 
+static bool dmar_required(void)
+{
+	/* tboot supersedes any user/platform opt */
+	if (!intel_iommu_tboot_noforce && tboot_enabled())
+		return true;
+
+	if (!no_iommu && (!dmar_disabled || dmar_platform_optin()))
+		return true;
+
+	return false;
+}
+
 void __init detect_intel_iommu(void)
 {
 	int ret;
@@ -920,8 +932,7 @@ void __init detect_intel_iommu(void)
 	if (!ret)
 		ret = dmar_walk_dmar_table((struct acpi_table_dmar *)dmar_tbl,
 					   &validate_drhd_cb);
-	if (!ret && !no_iommu && !iommu_detected &&
-	    (!dmar_disabled || dmar_platform_optin())) {
+	if (!ret && !iommu_detected && dmar_required()) {
 		iommu_detected = 1;
 		/* Make sure ACS will be enabled */
 		pci_request_acs();
drivers/iommu/intel/iommu.c +1 -1
index b9a01ef44e0a3..045b47cd7a972 100644
@@ -179,7 +179,7 @@ static int rwbf_quirk;
  * (used when kernel is launched w/ TXT)
  */
 static int force_on = 0;
-static int intel_iommu_tboot_noforce;
+int intel_iommu_tboot_noforce;
 static int no_platform_optin;
 
 #define ROOT_ENTRY_NR (VTD_PAGE_SIZE/sizeof(struct root_entry))
drivers/iommu/intel/iommu.h +2 -0
index a5efdb0c6657c..6db0b8b1e33c2 100644
@@ -803,6 +803,7 @@ extern int intel_iommu_gfx_mapped;
 
 extern int dmar_disabled;
 extern int intel_iommu_enabled;
+extern int intel_iommu_tboot_noforce;
 #else
 static inline int iommu_calculate_agaw(struct intel_iommu *iommu)
 {
@@ -815,6 +816,7 @@ static inline int iommu_calculate_max_sagaw(struct intel_iommu *iommu)
 #define dmar_disabled	(1)
 #define intel_iommu_enabled (0)
 #define intel_iommu_sm (0)
+#define intel_iommu_tboot_noforce (0)
 #endif
 
 #endif
Signature · 1 line
2.53.0