2020-07-01 15:29:28

by Jacob Pan

[permalink] [raw]
Subject: [PATCH v3 1/7] iommu/vt-d: Enforce PASID devTLB field mask

From: Liu Yi L <[email protected]>

Set proper masks to avoid invalid input spillover to reserved bits.

Acked-by: Lu Baolu <[email protected]>
Signed-off-by: Liu Yi L <[email protected]>
Signed-off-by: Jacob Pan <[email protected]>
---
include/linux/intel-iommu.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
index 4100bd224f5c..729386ca8122 100644
--- a/include/linux/intel-iommu.h
+++ b/include/linux/intel-iommu.h
@@ -380,8 +380,8 @@ enum {

#define QI_DEV_EIOTLB_ADDR(a) ((u64)(a) & VTD_PAGE_MASK)
#define QI_DEV_EIOTLB_SIZE (((u64)1) << 11)
-#define QI_DEV_EIOTLB_GLOB(g) ((u64)g)
-#define QI_DEV_EIOTLB_PASID(p) (((u64)p) << 32)
+#define QI_DEV_EIOTLB_GLOB(g) ((u64)(g) & 0x1)
+#define QI_DEV_EIOTLB_PASID(p) ((u64)((p) & 0xfffff) << 32)
#define QI_DEV_EIOTLB_SID(sid) ((u64)((sid) & 0xffff) << 16)
#define QI_DEV_EIOTLB_QDEP(qd) ((u64)((qd) & 0x1f) << 4)
#define QI_DEV_EIOTLB_PFSID(pfsid) (((u64)(pfsid & 0xf) << 12) | \
--
2.7.4


2020-07-02 07:20:27

by Eric Auger

[permalink] [raw]
Subject: Re: [PATCH v3 1/7] iommu/vt-d: Enforce PASID devTLB field mask

Hi,

On 7/1/20 5:33 PM, Jacob Pan wrote:
> From: Liu Yi L <[email protected]>
>
> Set proper masks to avoid invalid input spillover to reserved bits.
>
> Acked-by: Lu Baolu <[email protected]>
> Signed-off-by: Liu Yi L <[email protected]>
> Signed-off-by: Jacob Pan <[email protected]>


> ---
> include/linux/intel-iommu.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
> index 4100bd224f5c..729386ca8122 100644
> --- a/include/linux/intel-iommu.h
> +++ b/include/linux/intel-iommu.h
> @@ -380,8 +380,8 @@ enum {
>
> #define QI_DEV_EIOTLB_ADDR(a) ((u64)(a) & VTD_PAGE_MASK)
> #define QI_DEV_EIOTLB_SIZE (((u64)1) << 11)
> -#define QI_DEV_EIOTLB_GLOB(g) ((u64)g)
> -#define QI_DEV_EIOTLB_PASID(p) (((u64)p) << 32)
> +#define QI_DEV_EIOTLB_GLOB(g) ((u64)(g) & 0x1)
> +#define QI_DEV_EIOTLB_PASID(p) ((u64)((p) & 0xfffff) << 32)
> #define QI_DEV_EIOTLB_SID(sid) ((u64)((sid) & 0xffff) << 16)
> #define QI_DEV_EIOTLB_QDEP(qd) ((u64)((qd) & 0x1f) << 4)
> #define QI_DEV_EIOTLB_PFSID(pfsid) (((u64)(pfsid & 0xf) << 12) | \
>

Reviewed-by: Eric Auger <[email protected]>

Thanks

Eric