Skip to content

Commit eea4e29

Browse files
yiliu1765joergroedel
authored andcommitted
iommu/vt-d: Fix sid not set issue in intel_svm_bind_gpasid()
Should get correct sid and set it into sdev. Because we execute 'sdev->sid != req->rid' in the loop of prq_event_thread(). Fixes: eb8d93e ("iommu/vt-d: Report page request faults for guest SVA") Signed-off-by: Liu Yi L <yi.l.liu@intel.com> Signed-off-by: Yi Sun <yi.y.sun@linux.intel.com> Acked-by: Lu Baolu <baolu.lu@linux.intel.com> Link: https://lore.kernel.org/r/1604025444-6954-2-git-send-email-yi.y.sun@linux.intel.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 6097df4 commit eea4e29

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

drivers/iommu/intel/svm.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ int intel_svm_bind_gpasid(struct iommu_domain *domain, struct device *dev,
279279
struct intel_iommu *iommu = device_to_iommu(dev, NULL, NULL);
280280
struct intel_svm_dev *sdev = NULL;
281281
struct dmar_domain *dmar_domain;
282+
struct device_domain_info *info;
282283
struct intel_svm *svm = NULL;
283284
int ret = 0;
284285

@@ -310,6 +311,10 @@ int intel_svm_bind_gpasid(struct iommu_domain *domain, struct device *dev,
310311
if (data->hpasid <= 0 || data->hpasid >= PASID_MAX)
311312
return -EINVAL;
312313

314+
info = get_domain_info(dev);
315+
if (!info)
316+
return -EINVAL;
317+
313318
dmar_domain = to_dmar_domain(domain);
314319

315320
mutex_lock(&pasid_mutex);
@@ -357,6 +362,7 @@ int intel_svm_bind_gpasid(struct iommu_domain *domain, struct device *dev,
357362
goto out;
358363
}
359364
sdev->dev = dev;
365+
sdev->sid = PCI_DEVID(info->bus, info->devfn);
360366

361367
/* Only count users if device has aux domains */
362368
if (iommu_dev_feature_enabled(dev, IOMMU_DEV_FEAT_AUX))

0 commit comments

Comments
 (0)