Re: [PATCH v3] iommu/amd: Make PerfOpt compulsory

From: Jason Gunthorpe

Date: Wed Sep 30 2026 - 18:50:41 EST


> [ ... 336 lines skipped ... ]
> @@ -2370,7 +2370,7 @@ static int attach_device(struct device *dev,
> if (ret)
> goto out;
>
> - if (dev_data->perfopt)
> + if (dev_data->perfopt && pdom_is_in_pt_mode(domain))
> goto skip_caps;

This should also disable PASID support since without a gcr3 table
that's broken. Set the max_pasid to zero during probe device.

The flow is weird like this because the driver still hasn't cleaned up
the identity/blocking domain flows. There is no need to track them in
lists and things because they never need invalidation..

This is much nicer if the above could be written in side
amd_iommu_identity_attach().

Also, I'm a little confused, I thought this had to be toggled on and
off so it is only set while in identity, how does the DTE influence
what happens when in this special mode? I was sort of expecting it was
ignored entirely in HW. This version seems to lock it to always on,
but still permits a blocking domain to attach.

--
Jason