iommu/vt-d: Fix PASID cache flush
PATCH 1/1 iommu/vt-d: Fix PASID cache flush
PASID cache type and shift of granularity bits are missing in the current code.
interface")
--- drivers/iommu/intel-pasid.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iommu/intel-pasid.c +2 -1
@@ -365,7 +365,8 @@ pasid_cache_invalidation_with_pasid(struct intel_iommu *iommu, {struct qi_desc desc; - desc.qw0 =QI_PC_DID (did) |QI_PC_PASID_SEL |QI_PC_PASID (pasid); + desc.qw0 =QI_PC_DID (did) |QI_PC_GRAN (QI_PC_PASID_SEL ) | +QI_PC_PASID (pasid) |QI_PC_TYPE ; desc.qw1 =0 ; desc.qw2 =0 ; desc.qw3 =0 ;
Signature · 1 line
2.7.4
Hi Jacob,
Quoted 8 lines · Jacob Pan
PASID cache type and shift of granularity bits are missing in the current code.
Fixes 6f7db75e1c46 ("iommu/vt-d: Add second level page tableinterface")
Cc Eric Auger <[email protected]>Signed-off-by Jacob Pan <[email protected]>
Thanks
Eric
Quoted 19 lines
--- drivers/iommu/intel-pasid.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/iommu/intel-pasid.c +2
-1@@ -365,7 +365,8 @@ pasid_cache_invalidation_with_pasid(struct intel_iommu *iommu, {struct qi_desc desc; - desc.qw0 =QI_PC_DID (did) |QI_PC_PASID_SEL |QI_PC_PASID (pasid); + desc.qw0 =QI_PC_DID (did) |QI_PC_GRAN (QI_PC_PASID_SEL ) | +QI_PC_PASID (pasid) |QI_PC_TYPE ; desc.qw1 =0 ; desc.qw2 =0 ; desc.qw3 =0 ;
Actually, this is not a bug. The current code has:
#define QI_PC_PASID_SEL (QI_PC_TYPE | QI_PC_GRAN(1))
Which already has the type and shift.
In my vSVA series, I redefined granu such that I can use them in the 2D table lookup.
-#define QI_PC_ALL_PASIDS (QI_PC_TYPE | QI_PC_GRAN(0))
-#define QI_PC_PASID_SEL (QI_PC_TYPE | QI_PC_GRAN(1))
+/* PASID cache invalidation granu */
+#define QI_PC_ALL_PASIDS 0
+#define QI_PC_PASID_SEL 1
Please ignore this, sorry about the confusion.
Quoted 29 lines · On Tue, 31 Mar 2020 11:28:17 +0200 Auger Eric <[email protected]> wrote:
Hi Jacob,
Quoted 8 lines · Jacob Pan
PASID cache type and shift of granularity bits are missing in the current code.
Fixes 6f7db75e1c46 ("iommu/vt-d: Add second level page tableinterface")
Cc Eric Auger <[email protected]>Signed-off-by Jacob Pan <[email protected]>Reviewed-by Eric Auger <[email protected]>Thanks
Eric
Quoted 12 lines
--- drivers/iommu/intel-pasid.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/iommu/intel-pasid.cindex22b30f10b396..57d05b0fbafc100644 ---a/drivers/iommu/intel-pasid.c
+++b/drivers/iommu/intel-pasid.cdrivers/iommu/intel-pasid.c +0
-0@@ -365,7 +365,8 @@ pasid_cache_invalidation_with_pasid(struct intel_iommu *iommu, {struct qi_desc desc;
Quoted 9 lines
Quoted 8 lines
drivers/iommu/intel-pasid.c +2
-1- desc.qw0 =QI_PC_DID (did) |QI_PC_PASID_SEL |QI_PC_PASID (pasid); + desc.qw0 =QI_PC_DID (did) |QI_PC_GRAN (QI_PC_PASID_SEL ) | +QI_PC_PASID (pasid) |QI_PC_TYPE ; desc.qw1 =0 ; desc.qw2 =0 ;desc.qw3 = 0;
[Jacob Pan]
Hi Jacob,
Quoted 14 lines · Jacob Pan
Actually, this is not a bug. The current code has:
#defineQI_PC_PASID_SEL(QI_PC_TYPE|QI_PC_GRAN(1))Which already has the type and shift.
In my vSVA series, I redefined granu such that I can use them in the 2D table lookup.
(quoted diff) +3
-2-#define QI_PC_ALL_PASIDS (QI_PC_TYPE | QI_PC_GRAN(0)) -#define QI_PC_PASID_SEL (QI_PC_TYPE | QI_PC_GRAN(1)) +/* PASID cache invalidation granu */ +#define QI_PC_ALL_PASIDS 0 +#define QI_PC_PASID_SEL 1
Quoted 1 line
Please ignore this, sorry about the confusion.
OK I missed that as well, sorry. So that's not a fix but the code will become more readable/consistent in your vSVA series.
Thanks
Eric
Quoted 45 lines
Quoted 29 lines · On Tue, 31 Mar 2020 11:28:17 +0200 Auger Eric <[email protected]> wrote:
Hi Jacob,
Quoted 8 lines · Jacob Pan
PASID cache type and shift of granularity bits are missing in the current code.
Fixes 6f7db75e1c46 ("iommu/vt-d: Add second level page tableinterface")
Cc Eric Auger <[email protected]>Signed-off-by Jacob Pan <[email protected]>Reviewed-by Eric Auger <[email protected]>Thanks
Eric
Quoted 12 lines
--- drivers/iommu/intel-pasid.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/iommu/intel-pasid.cindex22b30f10b396..57d05b0fbafc100644 ---a/drivers/iommu/intel-pasid.c
+++b/drivers/iommu/intel-pasid.cdrivers/iommu/intel-pasid.c +0
-0@@ -365,7 +365,8 @@ pasid_cache_invalidation_with_pasid(struct intel_iommu *iommu, {struct qi_desc desc;Quoted 9 lines
Quoted 8 lines
drivers/iommu/intel-pasid.c +2
-1- desc.qw0 =QI_PC_DID (did) |QI_PC_PASID_SEL |QI_PC_PASID (pasid); + desc.qw0 =QI_PC_DID (did) |QI_PC_GRAN (QI_PC_PASID_SEL ) | +QI_PC_PASID (pasid) |QI_PC_TYPE ; desc.qw1 =0 ; desc.qw2 =0 ;desc.qw3 = 0;
[Jacob Pan]