summaryrefslogtreecommitdiff
path: root/drivers/iommu/intel/iommu.c
diff options
context:
space:
mode:
authorLu Baolu <baolu.lu@linux.intel.com>2021-06-10 10:01:03 +0800
committerJoerg Roedel <jroedel@suse.de>2021-06-10 09:06:13 +0200
commitd5b9e4bfe0d8848aaf428bb4bbcc270fecadef35 (patch)
tree181bb3c208b7441551b28c9193832b516034e010 /drivers/iommu/intel/iommu.c
parent4c82b88696ac57810ab923b3c5b0734646b9b69f (diff)
downloadlwn-d5b9e4bfe0d8848aaf428bb4bbcc270fecadef35.tar.gz
lwn-d5b9e4bfe0d8848aaf428bb4bbcc270fecadef35.zip
iommu/vt-d: Report prq to io-pgfault framework
Let the IO page fault requests get handled through the io-pgfault framework. Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Link: https://lore.kernel.org/r/20210520031531.712333-1-baolu.lu@linux.intel.com Link: https://lore.kernel.org/r/20210610020115.1637656-12-baolu.lu@linux.intel.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu/intel/iommu.c')
-rw-r--r--drivers/iommu/intel/iommu.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index e78773d46d7d..c45d4946f92d 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -5343,6 +5343,7 @@ static int intel_iommu_enable_sva(struct device *dev)
{
struct device_domain_info *info = get_domain_info(dev);
struct intel_iommu *iommu = info->iommu;
+ int ret;
if (!info || !iommu || dmar_disabled)
return -EINVAL;
@@ -5356,15 +5357,24 @@ static int intel_iommu_enable_sva(struct device *dev)
if (!info->pasid_enabled || !info->pri_enabled || !info->ats_enabled)
return -EINVAL;
- return iopf_queue_add_device(iommu->iopf_queue, dev);
+ ret = iopf_queue_add_device(iommu->iopf_queue, dev);
+ if (!ret)
+ ret = iommu_register_device_fault_handler(dev, iommu_queue_iopf, dev);
+
+ return ret;
}
static int intel_iommu_disable_sva(struct device *dev)
{
struct device_domain_info *info = get_domain_info(dev);
struct intel_iommu *iommu = info->iommu;
+ int ret;
+
+ ret = iommu_unregister_device_fault_handler(dev);
+ if (!ret)
+ ret = iopf_queue_remove_device(iommu->iopf_queue, dev);
- return iopf_queue_remove_device(iommu->iopf_queue, dev);
+ return ret;
}
/*