[PATCH v2 0/5] Convert riscv to use the generic iommu page table
Jason Gunthorpe
jgg at nvidia.com
Fri Jan 30 16:27:28 PST 2026
On Thu, Jan 29, 2026 at 11:21:53AM +0000, Robin Murphy wrote:
> The driver does not advertise IOMMU_CAP_DEFERRED_FLUSH, as the existing
> pagetable code has never implemented the conditional TLB maintenance
> optimisation that makes it meaningful. Mind you, I don't see any reference
> to iommu_iotlb_gather_queued() in generic_pt either, so I have no idea how
> that's trying to do it :/
Well, correct me if I've got it wrong..
DMA-FQ always does flush all, so the goal is to eliminate redundant
flushes from within the page table logic itself.
DMA-FQ requires two functionalites from the page table:
1) use gather->freelist to avoid a HW UAF (iommupt always does this)
2) avoid internal calls to iommu_iotlb_sync()
When the gather reaches __iommu_dma_unmap() it discards any iova range
inside it, queues the freelist, and queues a flush all. So any flush
implied by the gather is removed by the core code.
iommu_iotlb_gather_queued() should be used in the page table to
supress any internal flushes.
iommupt doesn't have any calls because it doesn't have any internal
flushes. It calls iommu_iotlb_gather_add_range() which blindly updates
the iova and never flushes.
The one call to iommu_iotlb_sync() is only for the para-virtualization
optimization of narrowing invalidations. It would be nonsensical for a
driver to enable this optimization and offer IOMMU_CAP_DEFERRED_FLUSH.
But it is a good point that riscv pagetable may not have supported it
before, but it does now, so we should probably add
IOMMU_CAP_DEFERRED_FLUSH. I'll send a patch next cycle.
Jason
More information about the linux-riscv
mailing list