iommu/vt-d: Remove unnecessary checks in iopf disabling path

iommu_unregister_device_fault_handler() and iopf_queue_remove_device()
are called after device has stopped issuing new page falut requests and
all outstanding page requests have been drained. They should never fail.
Trigger a warning if it happens unfortunately.

Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Link: https://lore.kernel.org/r/20230324120234.313643-7-baolu.lu@linux.intel.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
This commit is contained in:
Lu Baolu 2023-04-13 12:06:34 +08:00 committed by Joerg Roedel
parent fbcde5bb92
commit 7b8aa998d6
1 changed files with 8 additions and 9 deletions

View File

@ -4707,7 +4707,6 @@ static int intel_iommu_disable_iopf(struct device *dev)
{ {
struct device_domain_info *info = dev_iommu_priv_get(dev); struct device_domain_info *info = dev_iommu_priv_get(dev);
struct intel_iommu *iommu = info->iommu; struct intel_iommu *iommu = info->iommu;
int ret;
if (!info->pri_enabled) if (!info->pri_enabled)
return -EINVAL; return -EINVAL;
@ -4723,15 +4722,15 @@ static int intel_iommu_disable_iopf(struct device *dev)
pci_disable_pri(to_pci_dev(dev)); pci_disable_pri(to_pci_dev(dev));
info->pri_enabled = 0; info->pri_enabled = 0;
ret = iommu_unregister_device_fault_handler(dev); /*
if (ret) * With PRI disabled and outstanding PRQs drained, unregistering
return ret; * fault handler and removing device from iopf queue should never
* fail.
*/
WARN_ON(iommu_unregister_device_fault_handler(dev));
WARN_ON(iopf_queue_remove_device(iommu->iopf_queue, dev));
ret = iopf_queue_remove_device(iommu->iopf_queue, dev); return 0;
if (ret)
iommu_register_device_fault_handler(dev, iommu_queue_iopf, dev);
return ret;
} }
static int static int