]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
54f267f9f40d5d96485418e37962a4156da7d017
[thirdparty/kernel/stable-queue.git] /
1 From 7f11f1c050fab9d379f8e2f23bb5af51e651b0b0 Mon Sep 17 00:00:00 2001
2 From: Sasha Levin <sashal@kernel.org>
3 Date: Fri, 30 Oct 2020 10:37:23 +0800
4 Subject: iommu/vt-d: Fix sid not set issue in intel_svm_bind_gpasid()
5
6 From: Liu Yi L <yi.l.liu@intel.com>
7
8 [ Upstream commit eea4e29ab8bef254b228d6e1e3de188087b2c7d0 ]
9
10 Should get correct sid and set it into sdev. Because we execute
11 'sdev->sid != req->rid' in the loop of prq_event_thread().
12
13 Fixes: eb8d93ea3c1d ("iommu/vt-d: Report page request faults for guest SVA")
14 Signed-off-by: Liu Yi L <yi.l.liu@intel.com>
15 Signed-off-by: Yi Sun <yi.y.sun@linux.intel.com>
16 Acked-by: Lu Baolu <baolu.lu@linux.intel.com>
17 Link: https://lore.kernel.org/r/1604025444-6954-2-git-send-email-yi.y.sun@linux.intel.com
18 Signed-off-by: Joerg Roedel <jroedel@suse.de>
19 Signed-off-by: Sasha Levin <sashal@kernel.org>
20 ---
21 drivers/iommu/intel/svm.c | 6 ++++++
22 1 file changed, 6 insertions(+)
23
24 diff --git a/drivers/iommu/intel/svm.c b/drivers/iommu/intel/svm.c
25 index 95c3164a2302f..a71fbbddaa66e 100644
26 --- a/drivers/iommu/intel/svm.c
27 +++ b/drivers/iommu/intel/svm.c
28 @@ -278,6 +278,7 @@ int intel_svm_bind_gpasid(struct iommu_domain *domain, struct device *dev,
29 struct intel_iommu *iommu = device_to_iommu(dev, NULL, NULL);
30 struct intel_svm_dev *sdev = NULL;
31 struct dmar_domain *dmar_domain;
32 + struct device_domain_info *info;
33 struct intel_svm *svm = NULL;
34 int ret = 0;
35
36 @@ -302,6 +303,10 @@ int intel_svm_bind_gpasid(struct iommu_domain *domain, struct device *dev,
37 if (data->hpasid <= 0 || data->hpasid >= PASID_MAX)
38 return -EINVAL;
39
40 + info = get_domain_info(dev);
41 + if (!info)
42 + return -EINVAL;
43 +
44 dmar_domain = to_dmar_domain(domain);
45
46 mutex_lock(&pasid_mutex);
47 @@ -349,6 +354,7 @@ int intel_svm_bind_gpasid(struct iommu_domain *domain, struct device *dev,
48 goto out;
49 }
50 sdev->dev = dev;
51 + sdev->sid = PCI_DEVID(info->bus, info->devfn);
52
53 /* Only count users if device has aux domains */
54 if (iommu_dev_feature_enabled(dev, IOMMU_DEV_FEAT_AUX))
55 --
56 2.27.0
57