Skip to content

Commit 1efd17e

Browse files
LuBaoluwilldeacon
authored andcommitted
iommu/vt-d: Fix misuse of ALIGN in qi_flush_piotlb()
Use IS_ALIGNED() instead. Otherwise, an unaligned address will be ignored. Fixes: 33cd6e6 ("iommu/vt-d: Flush PASID-based iotlb for iova over first level") Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Link: https://lore.kernel.org/r/20201231005323.2178523-1-baolu.lu@linux.intel.com Signed-off-by: Will Deacon <will@kernel.org>
1 parent b34f10c commit 1efd17e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/iommu/intel/dmar.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,8 +1461,8 @@ void qi_flush_piotlb(struct intel_iommu *iommu, u16 did, u32 pasid, u64 addr,
14611461
int mask = ilog2(__roundup_pow_of_two(npages));
14621462
unsigned long align = (1ULL << (VTD_PAGE_SHIFT + mask));
14631463

1464-
if (WARN_ON_ONCE(!ALIGN(addr, align)))
1465-
addr &= ~(align - 1);
1464+
if (WARN_ON_ONCE(!IS_ALIGNED(addr, align)))
1465+
addr = ALIGN_DOWN(addr, align);
14661466

14671467
desc.qw0 = QI_EIOTLB_PASID(pasid) |
14681468
QI_EIOTLB_DID(did) |

0 commit comments

Comments
 (0)