[RFC PATCH 1/7] iommu/amd: defer device attach only on a kdump boot

Ankit Soni Ankit.Soni at amd.com
Sun Oct 4 23:40:11 PDT 2026


find_dev_data() sets defer_attach whenever the IOMMU came up already
translating. Only a kdump boot can ever complete such an attach: the
core completes it from iommu_deferred_attach(), behind a static key that
is enabled only when is_kdump_kernel().

That was harmless while a pre-enabled unit surviving driver init implied
a kdump boot. A live-update handover breaks the implication, because a
unit carrying preserved devices is deliberately left translating. The
devices behind it that were not preserved had their DTEs blocked at
shutdown, so the skipped attach never replaces the blocked entry and
they come up unable to do DMA.

Restrict the deferral to kdump, which is the only case that can complete
it.

Signed-off-by: Ankit Soni <Ankit.Soni at amd.com>
---
 drivers/iommu/amd/iommu.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
index 4dc306a4b5c6..a83ce4521f7f 100644
--- a/drivers/iommu/amd/iommu.c
+++ b/drivers/iommu/amd/iommu.c
@@ -31,6 +31,7 @@
 #include <linux/irqdomain.h>
 #include <linux/percpu.h>
 #include <linux/cc_platform.h>
+#include <linux/crash_dump.h>
 #include <asm/irq_remapping.h>
 #include <asm/io_apic.h>
 #include <asm/apic.h>
@@ -500,7 +501,11 @@ static struct iommu_dev_data *find_dev_data(struct amd_iommu *iommu, u16 devid)
 		if (!dev_data)
 			return NULL;
 
-		if (translation_pre_enabled(iommu))
+		/*
+		 * Only a kdump boot can complete a deferred attach, so only a
+		 * kdump boot may start one.
+		 */
+		if (translation_pre_enabled(iommu) && is_kdump_kernel())
 			dev_data->defer_attach = true;
 	}
 
-- 
2.43.0




More information about the kexec mailing list