drivers/acpi/riscv/rimt.c | 7 ------- drivers/iommu/riscv/iommu.c | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-)
From: Wang Yechao <wang.yechao255@zte.com.cn>
Commit 9156585280f1 ("ACPI: RIMT: Add dependency between iommu and
devices") adds the dependency between iommu and devices on ACPI
systems. On devicetree systems, the incorrect removal order also
occurs.
It can be reproduced on the QEMU RISC-V machine if the kernel enables
IOMMU_DMA:
[ 635.081530] e1000e: EEE TX LPI TIMER: 00000000
[ 656.100306] rcu: INFO: rcu_sched self-detected stall on CPU
[ 656.101374] rcu: 5-....: (5250 ticks this GP) idle=d774/1/0x4000000000000000 softirq=5173/5185 fqs=2625
[ 656.102237] rcu: (t=5251 jiffies g=36825 q=101 ncpus=16)
[ 656.103801] CPU: 5 UID: 0 PID: 1958 Comm: reboot Tainted: G W 7.1.0-rc5 #31 PREEMPTLAZY
[ 656.104127] Tainted: [W]=WARN
[ 656.104182] Hardware name: QEMU QEMU Virtual Machine, BIOS 2.7 02/02/2022
[ 656.104339] epc : riscv_iommu_cmd_sync.constprop.0+0xb8/0x148
[ 656.105352] ra : riscv_iommu_cmd_sync.constprop.0+0xa8/0x148
[ 656.105433] epc : ffffffff807ca980 ra : ffffffff807ca970 sp : ff60000085dbf960
[ 656.105475] gp : ffffffff81e0d798 tp : ff60000084b58e00 t0 : ffffffff80021048
[ 656.105514] t1 : ff60000081b18400 t2 : 45203a6530303031 s0 : ff60000085dbf9c0
[ 656.105554] s1 : 00000098c92a567c a0 : 00000098c03986f0 a1 : ff60000085dbf970
[ 656.105594] a2 : 000024bb5cac6aee a3 : ff200000004f1000 a4 : ff6000008140a040
[ 656.105632] a5 : 0000000000000669 a6 : 0000000000000000 a7 : 00000000ffffa000
[ 656.105669] s2 : 0000000000000000 s3 : 00000098c0398308 s4 : 000000000000066a
[ 656.105706] s5 : 0000000008f0d180 s6 : 000000a8d08b8de9 s7 : 0000000000001fff
[ 656.105743] s8 : ff6000008140a040 s9 : ff6000008484cb00 s10: ff200000005cc000
[ 656.105781] s11: ff600000814652a0 t3 : 000000f000000000 t4 : 0000000000000000
[ 656.105845] t5 : 0000000000000003 t6 : ff600000841666b0 ssp : 0000000000000000
[ 656.105883] status: 0000000200000120 badaddr: 0000000000000000 cause: 8000000000000005
[ 656.106072] riscv_iommu_cmd_sync.constprop.0+0xb8/0x148
[ 656.106321] riscv_iommu_iotlb_inval+0x120/0x160
[ 656.106373] riscv_iommu_iotlb_sync+0x48/0x60
[ 656.106422] __iommu_dma_unmap+0xca/0xf8
[ 656.106470] iommu_dma_unmap_phys+0x58/0xc8
[ 656.106517] dma_unmap_phys+0x15c/0x248
[ 656.106564] dma_unmap_page_attrs+0x1e/0x30
[ 656.106915] e1000_clean_rx_ring+0x1d2/0x200 [e1000e]
[ 656.107668] e1000e_down+0x168/0x1c8 [e1000e]
[ 656.107995] e1000e_pm_freeze+0x94/0x128 [e1000e]
[ 656.108328] e1000_shutdown+0x28/0x48 [e1000e]
[ 656.108652] pci_device_shutdown+0x34/0x48
[ 656.108706] device_shutdown+0x104/0x1e8
[ 656.108752] kernel_restart+0x46/0xb8
[ 656.108797] __do_sys_reboot+0xc0/0x1c8
[ 656.108840] __riscv_sys_reboot+0x22/0x38
[ 656.108882] do_trap_ecall_u+0x236/0x3f8
[ 656.108947] handle_exception+0x15a/0x166
So move the device link into the iommu driver to fix both ACPI and
devicetree systems.
Fixes: 488ffbf18171 ("iommu/riscv: Paging domain support")
Signed-off-by: Wang Yechao <wang.yechao255@zte.com.cn>
---
drivers/acpi/riscv/rimt.c | 7 -------
drivers/iommu/riscv/iommu.c | 7 +++++++
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/acpi/riscv/rimt.c b/drivers/acpi/riscv/rimt.c
index 906282b0e63c..229c4a0d47a3 100644
--- a/drivers/acpi/riscv/rimt.c
+++ b/drivers/acpi/riscv/rimt.c
@@ -263,13 +263,6 @@ static int rimt_iommu_xlate(struct device *dev, struct acpi_rimt_node *node, u32
if (!rimt_fwnode)
return -EPROBE_DEFER;
- /*
- * EPROBE_DEFER ensures IOMMU is probed before the devices that
- * depend on them. During shutdown, however, the IOMMU may be removed
- * first, leading to issues. To avoid this, a device link is added
- * which enforces the correct removal order.
- */
- device_link_add(dev, rimt_fwnode->dev, DL_FLAG_AUTOREMOVE_CONSUMER);
return acpi_iommu_fwspec_init(dev, deviceid, rimt_fwnode);
}
diff --git a/drivers/iommu/riscv/iommu.c b/drivers/iommu/riscv/iommu.c
index a31f50bbad35..f9368e977346 100644
--- a/drivers/iommu/riscv/iommu.c
+++ b/drivers/iommu/riscv/iommu.c
@@ -1385,6 +1385,13 @@ static struct iommu_device *riscv_iommu_probe_device(struct device *dev)
dev_iommu_priv_set(dev, info);
+ /*
+ * During shutdown, however, the IOMMU may be removed first, leading
+ * to issues. To avoid this, a device link is added which enforces
+ * the correct removal order.
+ */
+ device_link_add(dev, fwspec->iommu_fwnode->dev, DL_FLAG_AUTOREMOVE_CONSUMER);
+
return &iommu->iommu;
}
--
2.43.5
On Thu, Jun 4, 2026 at 12:28 PM <wang.yechao255@zte.com.cn> wrote:
>
> From: Wang Yechao <wang.yechao255@zte.com.cn>
>
> Commit 9156585280f1 ("ACPI: RIMT: Add dependency between iommu and
> devices") adds the dependency between iommu and devices on ACPI
> systems. On devicetree systems, the incorrect removal order also
> occurs.
>
Interesting. Why is it not handled by the fw_devlink infrastructure in DT?
Thanks,
Sunil
> >
> > From: Wang Yechao <wang.yechao255@zte.com.cn>
> >
> > Commit 9156585280f1 ("ACPI: RIMT: Add dependency between iommu and
> > devices") adds the dependency between iommu and devices on ACPI
> > systems. On devicetree systems, the incorrect removal order also
> > occurs.
> >
> Interesting. Why is it not handled by the fw_devlink infrastructure in DT?
>
> Thanks,
> Sunil
Thank you. I have noticed that commit e149573b2f84 ("of: property: Add device
link support for "iommu-map"") adds support for "iommu-map" to the device link
supplier bindings, so that probing of PCI devices can be deferred until after
the IOMMU is available.
The QEMU RISC-V virt machine currently lacks the "iommu-map" property for the
PCIe bus when the iommu-pci device is used, which leads to this issue. Therefore,
I believe the correct fix is to add the "iommu-map" property for PCIe in QEMU.
Best regards,
Yechao
© 2016 - 2026 Red Hat, Inc.