]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
iommupt: Flush the CPU cache after any writes to the page table
authorJason Gunthorpe <jgg@nvidia.com>
Thu, 23 Oct 2025 18:22:32 +0000 (15:22 -0300)
committerJoerg Roedel <joerg.roedel@amd.com>
Wed, 5 Nov 2025 08:47:45 +0000 (09:47 +0100)
commitefa03dab7ce4ed786b131f412440e2fd45fba11f
tree1987dc71796e0a7962fa12efb51e3959b021c61b
parentaefd967dab6469f5b827b59e50016a760dcc1fbc
iommupt: Flush the CPU cache after any writes to the page table

Flush the CPU cache for the page table memory after each set of writes to
the page table. The iommu should have visibility to the updated entries as
soon as the map/unmap/etc operations return, like normal coherent hardware
does.

The caches also have to be flushed before any gather can be submitted to
the driver.

Implement the same solution to the race as io-pgtable-arm by using a
software PTE bit to track if a table entry has been flushed or not. If
another thread is still flushing then another concurrent map operation
could return without IOMMU visibility to a required table entry. The SW
bit will tell the second thread to also flush the cache.

Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
drivers/iommu/generic_pt/iommu_pt.h