Re: [PATCH v4 02/21] iommufd: Add iommufd_sw_map_msi()
From: Andrew Jones
Date: Fri Aug 21 2026 - 11:19:05 EST
On Fri, Aug 21, 2026 at 11:31:55AM -0300, Jason Gunthorpe wrote:
> On Fri, Aug 21, 2026 at 04:23:22PM +0200, Andrew Jones wrote:
> > > But RISC-V IOMMU is also not involved in interrupt translation. Beyond
> > > it could remap the PAs which represent the CPUs, but you are not using
> > > it that way since it is statically setup.
> > >
> > > So I'm not sure why the iommu gets an IR? Isn't it the same as ARM
> > > where the IMSIC itself just has a wack of PAs it needs to access so it
> > > calls iommu_dma_prepare_msi() to do it?
> >
> > Right, this series is only remapping IMSIC PAs, not using the IOMMU MSI
> > table. The MSI table must be disabled when second-stage translation is
> > Bare, so it cannot be used for the host mappings here. It will be needed
> > for guest interrupt files (the irqbypass series I'm also working on),
> > where this IR irqdomain can then intercept irq_set_vcpu_affinity().
> > Also, keeping the MSI setup in this IR irqdomain avoids putting IOMMU
> > mapping knowledge in the IMSIC driver.
>
> It's ok for the IMSIC driver to call iommu_dma_prepare_msi(), that's
> the architecutre of this at least.
>
> Until you get to adding something more complicated, eg irqbypass, I'd
> suggest keeping this series simple.
>
> I guess I would wonder why the IOMMU needs to be involved in changing
> the mapping down the road, why not just reprogram the MSI-X address?
>
For guest interrupts the MSI-X address is a guest IMSIC address.
Reprogramming it handles a guest reroute, but not vcpu migration (the
guest address stays the same while its host backing moves between
guest interrupt files and MRIFs). The IOMMU driver updates that mapping
through "the hypervisor to IOMMU driver interface", a.k.a. the IRQ
domain's irq_set_vcpu_affinity() callback. That mapping cannot be
prepared ahead of time because only the hypervisor knows the target,
and it may change later.
Since I know I'll need an IRQ domain in the IOMMU driver for
irq_set_vcpu_affinity(), I'd prefer to keep it in this series too.
Thanks,
drew