Re: [PATCH v2 05/12] iommu/vt-d: Move PRI enablement in probe path

From: Baolu Lu
Date: Tue Feb 25 2025 - 22:57:26 EST


On 2/25/25 15:37, Tian, Kevin wrote:
From: Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx>
Sent: Monday, February 24, 2025 1:16 PM

@@ -3743,6 +3743,16 @@ static struct iommu_device
*intel_iommu_probe_device(struct device *dev)
else
info->ats_enabled = 1;
}
+
+ if (info->ats_enabled && info->pri_supported) {
+ /* PASID is required in PRG Response Message. */
+ if (info->pasid_enabled
|| !pci_prg_resp_pasid_required(pdev)) {

this should be:

if (!info->pasid_enabled || pci_prg_resp_pasid_required(pdev))

Yes, fixed.



@@ -3761,6 +3771,13 @@ static void intel_iommu_release_device(struct
device *dev)
struct device_domain_info *info = dev_iommu_priv_get(dev);
struct intel_iommu *iommu = info->iommu;

+ WARN_ON(info->iopf_refcount);

call iopf_queue_remove_device() in this case?

Yes. I will make it like this,

if (WARN_ON(info->iopf_refcount))
iopf_queue_remove_device(iommu->iopf_queue, dev);

+void intel_iommu_disable_iopf(struct device *dev)
+{
+ struct device_domain_info *info = dev_iommu_priv_get(dev);
+ struct intel_iommu *iommu = info->iommu;
+
+ if (WARN_ON(!info->pri_enabled))
+ return;

also warn on !info->iopf_refcount

Yes, added.

Thanks,
baolu