[PATCH 5/9] iommu/vt-d: Use dmar_can_force_on() for platform optin
From: Kevin Tian
Date: Thu Jun 04 2026 - 01:10:47 EST
So the policy of requesting ACS in detect_intel_iommu() is consistent
with that in platform_optin_force_iommu().
While at it, remove no_platform_optin which is unnecessary now.
Signed-off-by: Kevin Tian <kevin.tian@xxxxxxxxx>
---
drivers/iommu/intel/iommu.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index 0fc131a34963..edf01261a41d 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -58,7 +58,6 @@ static int rwbf_quirk;
*/
static int force_on = 0;
int intel_iommu_tboot_noforce;
-static int no_platform_optin;
#define ROOT_ENTRY_NR (VTD_PAGE_SIZE/sizeof(struct root_entry))
@@ -248,7 +247,6 @@ static int __init intel_iommu_setup(char *str)
} else if (!strncmp(str, "off", 3)) {
dmar_state = DMAR_DISABLED_USER;
dmar_disabled = 1;
- no_platform_optin = 1;
pr_info("IOMMU disabled\n");
} else if (!strncmp(str, "igfx_off", 8)) {
disable_igfx_iommu = 1;
@@ -2486,20 +2484,22 @@ static bool has_external_pci(void)
static int __init platform_optin_force_iommu(void)
{
- if (no_iommu || !dmar_platform_optin() || no_platform_optin ||
- !has_external_pci())
+ if (!dmar_platform_optin() || !dmar_can_force_on(DMAR_FORCEON_PLATFORM))
return 0;
- if (dmar_disabled)
- pr_info("Intel-IOMMU force enabled due to platform opt in\n");
+ if (!has_external_pci())
+ return 0;
/*
* If Intel-IOMMU is disabled by default, we will apply identity
* map for all devices except those marked as being untrusted.
*/
- if (dmar_disabled)
+ if (dmar_is_disabled()) {
+ pr_info("Intel-IOMMU force enabled due to platform opt in\n");
iommu_set_default_passthrough(false);
+ }
+ dmar_state = DMAR_ENABLED_FORCE;
dmar_disabled = 0;
return 1;
--
2.43.0