[PATCH v4 01/12] iommu: Initialize default domain policy at core initcall level

From: Mikko Perttunen

Date: Tue Nov 17 2026 - 19:36:33 EST


The default domain policy is currently initialized in iommu_subsys_init,
but IOMMU drivers can register and create groups before subsys_initcall.
If the default policy is needed before iommu_subsys_init has been
executed, a warning is printed and IOMMU_DOMAIN_DMA will be used. Marek
observed this on Exynos on 32-bit ARM after a later patch in this series
removes the IDENTITY default domain override for 32-bit ARM platforms.

Fix the issue by moving the default domain policy initialization into
iommu_init, which executes at core initcall level.

Reported-by: Marek Szyprowski <m.szyprowski@xxxxxxxxxxx>
Closes: https://lore.kernel.org/r/6fb3327c-766c-433c-b49d-dc62470d7102@xxxxxxxxxxx
Signed-off-by: Mikko Perttunen <mperttunen@xxxxxxxxxx>
---
drivers/iommu/iommu.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index b486b8bbd1fc..35edc2097996 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -225,10 +225,8 @@ static const char *iommu_domain_type_str(unsigned int t)
}
}

-static int __init iommu_subsys_init(void)
+static void __init iommu_init_def_domain_type(void)
{
- struct notifier_block *nb;
-
if (!(iommu_cmd_line & IOMMU_CMD_LINE_DMA_API)) {
if (IS_ENABLED(CONFIG_IOMMU_DEFAULT_PASSTHROUGH))
iommu_set_default_passthrough(false);
@@ -254,6 +252,11 @@ static int __init iommu_subsys_init(void)
iommu_dma_strict ? "strict" : "lazy",
(iommu_cmd_line & IOMMU_CMD_LINE_STRICT) ?
" (set via kernel command line)" : "");
+}
+
+static int __init iommu_subsys_init(void)
+{
+ struct notifier_block *nb;

nb = kzalloc_objs(*nb, ARRAY_SIZE(iommu_buses));
if (!nb)
@@ -2951,6 +2954,8 @@ EXPORT_SYMBOL_GPL(report_iommu_fault);

static int __init iommu_init(void)
{
+ iommu_init_def_domain_type();
+
iommu_group_kset = kset_create_and_add("iommu_groups",
NULL, kernel_kobj);
BUG_ON(!iommu_group_kset);

--
2.56.1