[PATCH v2 0/5] Convert riscv to use the generic iommu page table
Vincent Chen
vincent.chen at sifive.com
Fri Jan 23 04:29:01 PST 2026
On Fri, Jan 23, 2026 at 11:05 AM Vincent Chen <vincent.chen at sifive.com> wrote:
>
> On Thu, Jan 22, 2026 at 11:31 PM Jason Gunthorpe <jgg at nvidia.com> wrote:
> >
> > On Thu, Jan 22, 2026 at 09:46:47AM +0800, Vincent Chen wrote:
> > > Hi Jason,
> > >
> > > I tested this patch set on my side with the QEMU-virt machine.
> > > I used the following QEMU command for testing:
> > >
> > > $QEMU/qemu-system-riscv64 \
> > > -M virt,aia=aplic-imsic,aia-guests=7,iommu-sys=on -m 8G -nographic \
> > > -bios $OPENSBI_IMAGE \
> > > -serial mon:stdio -serial null -nographic \
> > > -device e1000e,netdev=net0 \
> > > -netdev user,id=net0 \
> > > -cpu rv64,v=true,vlen=256,ssdbltrp=true,smdbltrp=true \
> > > -device '{"driver":"virtio-9p-device","fsdev":"share","mount_tag":"host0"}'
> > > \
> > > -fsdev local,id=share,path=share,security_model=mapped \
> > > -append 'console=ttyS0 earlycon' \
> > > -kernel $KERNEL_IMAGE \
> > > -gdb tcp::6234 \
> > > -smp 4
> > >
> > > The boot log shows that the e1000e is successfully added to IOMMU group 1:
> > >
> > > [ 0.752808] pci 0000:00:00.0: Adding to iommu group 0
> > > [ 0.753279] pci 0000:00:01.0: Adding to iommu group 1
> > > [...]
> > > [ 0.763212] e1000e 0000:00:01.0: enabling device (0000 -> 0002)
> > > [ 0.765241] e1000e 0000:00:01.0: Interrupt Throttling Rate
> > > (ints/sec) set to dynamic conservative mode
> > > [ 0.868120] e1000e 0000:00:01.0 eth0: (PCI Express:2.5GT/s:Width
> > > x1) 52:54:00:12:34:56
> > > [ 0.868740] e1000e 0000:00:01.0 eth0: Intel(R) PRO/1000 Network Connection
> > > [ 0.869087] e1000e 0000:00:01.0 eth0: MAC: 3, PHY: 8, PBA No: 000000-000
> > >
> > > In this environment, I used iperf3 to verify that the e1000e functions
> > > correctly. The result shows that the test completed successfully:
> >
> > This is great, thanks!
> >
> > Can you confirm that the iommu was set to translating for this test?
> >
> > $ cat /sys/kernel/iommu_groups/0/type
> > DMA-FQ
> > $ cat /sys/kernel/iommu_groups/1/type
> > DMA-FQ
> >
>
> Sure.
>
> # cat /sys/kernel/iommu_groups/0/type
> DMA
> # cat /sys/kernel/iommu_groups/1/type
> DMA
Hi Jason,
Please disregard my previous test report. I realized that the previous
result was incorrect because the IOMMU was actually running in "identity"
mode, so the test did not verify your page table patch. Sorry for providing the
incorrect test result.
# cat /sys/kernel/iommu_groups/0/type
identity
# cat /sys/kernel/iommu_groups/1/type
identity
This occurred because the RISC-V IOMMU driver in v6.19 does not yet
support MSI redirection. Consequently, devices using MSI fail unless the
translation mode is set to bypass (identity), meaning CONFIG_IOMMU_DMA
was not active.
To properly verify the patch with DMA translation enabled, I integrated
the MSI-related patches from Andrew Jones's RFC series to unblock the
test.
Andrew's series:
https://github.com/jones-drew/linux/commits/riscv/iommu-irqbypass-rfc-v2/
My entire source tree (Jason's patches + Andrew's MSI patches) is here:
https://github.com/VincentZWC/linux/tree/v6.19-iommu_pt_riscv-test
With this codebase, the IOMMU group type is now correctly configured as
DMA:
# cat /sys/kernel/iommu_groups/0/type
DMA
# cat /sys/kernel/iommu_groups/1/type
DMA
I re-ran the iperf3 test in this environment, and the test passed
successfully.
More information about the linux-riscv
mailing list