summary refs log tree commit diff
path: root/drivers/iommu
diff options
context:
space:
mode:
authorNadav Amit <namit@vmware.com>2021-05-01 23:59:56 -0700
committerJoerg Roedel <jroedel@suse.de>2021-05-18 11:21:28 +0200
commita017c567915fd7a017006f8c210e2c6b30ab6fad (patch)
tree4cc7d736e16cc3a49095ed75d57ef1faf5dea0e8 /drivers/iommu
parentd6177a6556f853785867e2ec6d5b7f4906f0d809 (diff)
downloadlinux-a017c567915fd7a017006f8c210e2c6b30ab6fad.tar.gz
iommu/amd: Fix wrong parentheses on page-specific invalidations
The logic to determine the mask of page-specific invalidations was
tested in userspace. As the code was copied into the kernel, the
parentheses were mistakenly set in the wrong place, resulting in the
wrong mask.

Fix it.

Cc: Joerg Roedel <joro@8bytes.org>
Cc: Will Deacon <will@kernel.org>
Cc: Jiajun Cao <caojiajun@vmware.com>
Cc: iommu@lists.linux-foundation.org
Cc: linux-kernel@vger.kernel.org
Fixes: 268aa4548277 ("iommu/amd: Page-specific invalidations for more than one page")
Signed-off-by: Nadav Amit <namit@vmware.com>
Link: https://lore.kernel.org/r/20210502070001.1559127-2-namit@vmware.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/amd/iommu.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
index 67da96d5b3c2..3ac42bbdefc6 100644
--- a/drivers/iommu/amd/iommu.c
+++ b/drivers/iommu/amd/iommu.c
@@ -884,7 +884,7 @@ static inline u64 build_inv_address(u64 address, size_t size)
 		 * The msb-bit must be clear on the address. Just set all the
 		 * lower bits.
 		 */
-		address |= 1ull << (msb_diff - 1);
+		address |= (1ull << msb_diff) - 1;
 	}
 
 	/* Clear bits 11:0 */