[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BN9PR11MB52766D4948FA00CB02D3F2188CBC9@BN9PR11MB5276.namprd11.prod.outlook.com>
Date: Thu, 16 Mar 2023 07:17:06 +0000
From: "Tian, Kevin" <kevin.tian@...el.com>
To: Lu Baolu <baolu.lu@...ux.intel.com>,
"iommu@...ts.linux.dev" <iommu@...ts.linux.dev>,
"dmaengine@...r.kernel.org" <dmaengine@...r.kernel.org>
CC: Joerg Roedel <joro@...tes.org>, Will Deacon <will@...nel.org>,
"Robin Murphy" <robin.murphy@....com>,
"Yu, Fenghua" <fenghua.yu@...el.com>,
"Jiang, Dave" <dave.jiang@...el.com>,
Vinod Koul <vkoul@...nel.org>,
Jacob Pan <jacob.jun.pan@...ux.intel.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v2 5/5] iommu/vt-d: Move PRI handling to IOPF feature path
> From: Lu Baolu <baolu.lu@...ux.intel.com>
> Sent: Thursday, March 9, 2023 10:57 AM
>
> @@ -4689,17 +4704,21 @@ static int intel_iommu_disable_iopf(struct device
> *dev)
> {
> struct device_domain_info *info = dev_iommu_priv_get(dev);
> struct intel_iommu *iommu = info->iommu;
> - int ret;
>
> - ret = iommu_unregister_device_fault_handler(dev);
> - if (ret)
> - return ret;
> + if (!info->pri_enabled)
> + return -EINVAL;
>
> - ret = iopf_queue_remove_device(iommu->iopf_queue, dev);
> - if (ret)
> - iommu_register_device_fault_handler(dev,
> iommu_queue_iopf, dev);
> + pci_disable_pri(to_pci_dev(dev));
> + info->pri_enabled = 0;
>
> - return ret;
> + /*
> + * With pri_enabled checked, unregistering fault handler and
> + * removing device from iopf queue should never fail.
> + */
> + iommu_unregister_device_fault_handler(dev);
> + iopf_queue_remove_device(iommu->iopf_queue, dev);
> +
> + return 0;
> }
PCIe spec says that clearing the enable bit doesn't mean in-fly
page requests are completed:
--
Enable (E) - This field, when set, indicates that the Page Request
Interface is allowed to make page requests. If this field is Clear,
the Page Request Interface is not allowed to issue page requests.
If both this field and the Stopped field are Clear, then the Page
Request Interface will not issue new page requests, but has
outstanding page requests that have been transmitted or are
queued for transmission
Powered by blists - more mailing lists