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

From: Tian, Kevin
Date: Tue Feb 25 2025 - 02:39:05 EST


> 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))


> @@ -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?

> +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