On 9/24/26 5:50 PM, Jason Gunthorpe wrote:
On Mon, Sep 07, 2026 at 11:12:06PM -0500, Mario Limonciello wrote:
+EXPORT_SYMBOL_GPL(amd_iommu_enable_perfopt);

Last time we hardwired the GPU and IOMMU drivers together it was a
huge mess to undo.

Why does the GPU driver have to request this? Why can't the iommu
driver know that this is a special device that can use this magic fast
path and then auto set it when identity is asked for?

The reason was to allow an "opt-out" path on the GPU driver.


How does the GPU driver even know it is magic special?

See patch 2/2. GPU driver looks if it's an APU and it's in identity mode. The special mode is only for the GPU in an APU. It shouldn't be applied to anything else.

+       /*
+        * Restore ATS/PRI/PASID (and thus SVA) by re-homing the device onto its
+        * identity domain with the flag cleared, so a later bind without 
PerfOpt
+        * sees a normally-capable device. See the locking note in
+        * amd_iommu_enable_perfopt().
+        */

And this is sort of a wrong thing in the driver, it shouldn't have ATS
turned on for identitiy mappings, and it certainly shouldn't have PRI
turned on until a PRI capable domain is attached.

Jason


amd_iommu_disable_perfopt() only re-applies the policy that was previously set before PerfOpt.

If you would like I'll send a follow up patch to clarify this comment.

Reply via email to