iommu: Fix a few issues related to PRQ
Subsystems (2)
v2 cover iommu: Fix a few issues related to PRQ
We found a few issues about PRQ. So, two patches are cooked to fix them. Please have a review. Thanks!
Changes from v1:
================
- Modify subject of patch 1 to make it more accurate.
- Move get_domain_info() up to the sanity check part in patch 1.
- Remove v1 patch 2 which is not suitable.
- Add description for current patch 2.
- Add 'Fixes:' tags for all patches.
Liu Yi L (1):
iommu/vt-d: Fix sid not set issue in in intel_svm_bind_gpasid()
Liu, Yi L (1):
iommu/vt-d: Fix a bug for PDP check in prq_event_thread
drivers/iommu/intel/svm.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
Signature · 6 lines
2.7.4 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
PATCH v2 1/2 iommu/vt-d: Fix sid not set issue in intel_svm_bind_gpasid()
From: Liu Yi L <[email protected]>
Should get correct sid and set it into sdev. Because we execute 'sdev->sid != req->rid' in the loop of prq_event_thread().
--- drivers/iommu/intel/svm.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/iommu/intel/svm.c +6 -0
@@ -279,6 +279,7 @@ int intel_svm_bind_gpasid(struct iommu_domain *domain, struct device *dev,struct intel_iommu *iommu =device_to_iommu (dev,NULL ,NULL );struct intel_svm_dev *sdev =NULL ;struct dmar_domain *dmar_domain; +struct device_domain_info *info;struct intel_svm *svm =NULL ;int ret =0 ;
@@ -310,6 +311,10 @@ int intel_svm_bind_gpasid(struct iommu_domain *domain, struct device *dev,if (data->hpasid <=0 || data->hpasid >=PASID_MAX )return -EINVAL ; + info =get_domain_info (dev); +if (!info) +return -EINVAL ; + dmar_domain =to_dmar_domain (domain);mutex_lock (&pasid_mutex);
@@ -357,6 +362,7 @@ int intel_svm_bind_gpasid(struct iommu_domain *domain, struct device *dev, goto out; } sdev->dev = dev; + sdev->sid =PCI_DEVID (info->bus, info->devfn);/* Only count users if device has aux domains */ if (iommu_dev_feature_enabled (dev,IOMMU_DEV_FEAT_AUX ))
Signature · 6 lines
2.7.4 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Re: [PATCH v2 1/2] iommu/vt-d: Fix sid not set issue in intel_svm_bind_gpasid()
Quoted 8 lines · Yi Sun
From: Liu Yi L <[email protected]>
Should get correct sid and set it into sdev. Because we execute '
sdev->sid!=req->rid' in the loop ofprq_event_thread().Fixes eb8d93ea3c1d ("iommu/vt-d: Report page request faults for guest SVA")Signed-off-by Liu Yi L <[email protected]>Signed-off-by Yi Sun <[email protected]>
Best regards,
baolu
Quoted 36 lines
--- drivers/iommu/intel/svm.c | 6 ++++++ 1 file changed, 6 insertions(+)drivers/iommu/intel/svm.c +6
-0@@ -279,6 +279,7 @@ int intel_svm_bind_gpasid(struct iommu_domain *domain, struct device *dev,struct intel_iommu *iommu =device_to_iommu (dev,NULL ,NULL );struct intel_svm_dev *sdev =NULL ;struct dmar_domain *dmar_domain; +struct device_domain_info *info;struct intel_svm *svm =NULL ;int ret =0 ;@@ -310,6 +311,10 @@ int intel_svm_bind_gpasid(struct iommu_domain *domain, struct device *dev,if (data->hpasid <=0 || data->hpasid >=PASID_MAX )return -EINVAL ; + info =get_domain_info (dev); +if (!info) +return -EINVAL ; + dmar_domain =to_dmar_domain (domain);mutex_lock (&pasid_mutex);@@ -357,6 +362,7 @@ int intel_svm_bind_gpasid(struct iommu_domain *domain, struct device *dev, goto out; } sdev->dev = dev; + sdev->sid =PCI_DEVID (info->bus, info->devfn);/* Only count users if device has aux domains */ if (iommu_dev_feature_enabled (dev,IOMMU_DEV_FEAT_AUX ))
PATCH v2 2/2 iommu/vt-d: Fix a bug for PDP check in prq_event_thread
In reply to Yi SunFrom: "Liu, Yi L" <[email protected]>
In prq_event_thread(), the QI_PGRP_PDP is wrongly set by 'req->pasid_present' which should be replaced to 'req->priv_data_present'.
--- drivers/iommu/intel/svm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/intel/svm.c +1 -1
@@ -1035,7 +1035,7 @@ static irqreturn_t prq_event_thread(int irq, void *d) resp.qw0 =QI_PGRP_PASID (req->pasid) |QI_PGRP_DID (req->rid) |QI_PGRP_PASID_P (req->pasid_present) | -QI_PGRP_PDP (req->pasid_present) | +QI_PGRP_PDP (req->priv_data_present) |QI_PGRP_RESP_CODE (result) |QI_PGRP_RESP_TYPE ; resp.qw1 = QI_PGRP_IDX(req->prg_index) |
Signature · 6 lines
2.7.4 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Re: [PATCH v2 2/2] iommu/vt-d: Fix a bug for PDP check in prq_event_thread
Quoted 9 lines · Yi Sun
From: "Liu, Yi L" <[email protected]>
In
prq_event_thread(), theQI_PGRP_PDPis wrongly set by 'req->pasid_present' which should be replaced to 'req->priv_data_present'.Fixes 5b438f4ba315 ("iommu/vt-d: Support page request in scalable mode")Signed-off-by Liu, Yi L <[email protected]>Signed-off-by Yi Sun <[email protected]>
Best regards,
baolu
Quoted 18 lines
--- drivers/iommu/intel/svm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iommu/intel/svm.c +1
-1@@ -1035,7 +1035,7 @@ static irqreturn_t prq_event_thread(int irq, void *d) resp.qw0 =QI_PGRP_PASID (req->pasid) |QI_PGRP_DID (req->rid) |QI_PGRP_PASID_P (req->pasid_present) | -QI_PGRP_PDP (req->pasid_present) | +QI_PGRP_PDP (req->priv_data_present) |QI_PGRP_RESP_CODE (result) |QI_PGRP_RESP_TYPE ; resp.qw1 = QI_PGRP_IDX(req->prg_index) |
Joerg Roedel
maintainerQuoted 11 lines · Yi Sun
We found a few issues about PRQ. So, two patches are cooked to fix them. Please have a review. Thanks!
Changes from v1:
================
- Modify subject of patch 1 to make it more accurate.
- Moveget_domain_info()up to the sanity check part in patch 1.
- Remove v1 patch 2 which is not suitable.
- Add description for current patch 2.
- Add 'Fixes:' tags for all patches.
Quoted 8 lines
Liu Yi L (1):
iommu/vt-d: Fix sid not set issue in inintel_svm_bind_gpasid()Liu, Yi L (1):
iommu/vt-d: Fix a bug for PDP check inprq_event_threaddrivers/iommu/intel/svm.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
Applied for v5.10, thanks.