Skip to content

Commit aaa5930

Browse files
changqin-tangjoergroedel
authored andcommitted
iommu/vt-d: Fix some macros that are incorrectly specified in intel-iommu
Some of the macros are incorrect with wrong bit-shifts resulting in picking the incorrect invalidation granularity. Incorrect Source-ID in extended devtlb invalidation caused device side errors. To: Joerg Roedel <joro@8bytes.org> To: David Woodhouse <dwmw2@infradead.org> Cc: iommu@lists.linux-foundation.org Cc: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org Cc: CQ Tang <cq.tang@intel.com> Cc: Ashok Raj <ashok.raj@intel.com> Fixes: 2f26e0a ("iommu/vt-d: Add basic SVM PASID support") Signed-off-by: CQ Tang <cq.tang@intel.com> Signed-off-by: Ashok Raj <ashok.raj@intel.com> Tested-by: CQ Tang <cq.tang@intel.com> Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 566cf87 commit aaa5930

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

include/linux/intel-iommu.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ static inline void dmar_writeq(void __iomem *addr, u64 val)
153153
#define DMA_TLB_GLOBAL_FLUSH (((u64)1) << 60)
154154
#define DMA_TLB_DSI_FLUSH (((u64)2) << 60)
155155
#define DMA_TLB_PSI_FLUSH (((u64)3) << 60)
156-
#define DMA_TLB_IIRG(type) ((type >> 60) & 7)
157-
#define DMA_TLB_IAIG(val) (((val) >> 57) & 7)
156+
#define DMA_TLB_IIRG(type) ((type >> 60) & 3)
157+
#define DMA_TLB_IAIG(val) (((val) >> 57) & 3)
158158
#define DMA_TLB_READ_DRAIN (((u64)1) << 49)
159159
#define DMA_TLB_WRITE_DRAIN (((u64)1) << 48)
160160
#define DMA_TLB_DID(id) (((u64)((id) & 0xffff)) << 32)
@@ -164,9 +164,9 @@ static inline void dmar_writeq(void __iomem *addr, u64 val)
164164

165165
/* INVALID_DESC */
166166
#define DMA_CCMD_INVL_GRANU_OFFSET 61
167-
#define DMA_ID_TLB_GLOBAL_FLUSH (((u64)1) << 3)
168-
#define DMA_ID_TLB_DSI_FLUSH (((u64)2) << 3)
169-
#define DMA_ID_TLB_PSI_FLUSH (((u64)3) << 3)
167+
#define DMA_ID_TLB_GLOBAL_FLUSH (((u64)1) << 4)
168+
#define DMA_ID_TLB_DSI_FLUSH (((u64)2) << 4)
169+
#define DMA_ID_TLB_PSI_FLUSH (((u64)3) << 4)
170170
#define DMA_ID_TLB_READ_DRAIN (((u64)1) << 7)
171171
#define DMA_ID_TLB_WRITE_DRAIN (((u64)1) << 6)
172172
#define DMA_ID_TLB_DID(id) (((u64)((id & 0xffff) << 16)))
@@ -316,8 +316,8 @@ enum {
316316
#define QI_DEV_EIOTLB_SIZE (((u64)1) << 11)
317317
#define QI_DEV_EIOTLB_GLOB(g) ((u64)g)
318318
#define QI_DEV_EIOTLB_PASID(p) (((u64)p) << 32)
319-
#define QI_DEV_EIOTLB_SID(sid) ((u64)((sid) & 0xffff) << 32)
320-
#define QI_DEV_EIOTLB_QDEP(qd) (((qd) & 0x1f) << 16)
319+
#define QI_DEV_EIOTLB_SID(sid) ((u64)((sid) & 0xffff) << 16)
320+
#define QI_DEV_EIOTLB_QDEP(qd) ((u64)((qd) & 0x1f) << 4)
321321
#define QI_DEV_EIOTLB_MAX_INVS 32
322322

323323
#define QI_PGRP_IDX(idx) (((u64)(idx)) << 55)

0 commit comments

Comments
 (0)