From 17149077e01c9f1a9171928d3ebdaaaf504577a9 Mon Sep 17 00:00:00 2001 From: Jason Gunthorpe Date: Fri, 27 Mar 2026 12:23:58 -0300 Subject: [PATCH] iommu/amd: Make CMD_INV_IOMMU_ALL_PAGES_ADDRESS match the spec The spec in Table 14 defines the "Entire Cache" case as having the low 12 bits as zero. Indeed the command format doesn't even have the low 12 bits. Since there is only one user now, fix the constant to have 0 in the low 12 bits instead of 1 and remove the masking. Signed-off-by: Jason Gunthorpe Reviewed-by: Wei Wang Tested-by: Dheeraj Kumar Srivastava Reviewed-by: Vasant Hegde Signed-off-by: Joerg Roedel --- drivers/iommu/amd/amd_iommu_types.h | 2 +- drivers/iommu/amd/iommu.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/amd/amd_iommu_types.h b/drivers/iommu/amd/amd_iommu_types.h index 96038b2e24d5..093643061597 100644 --- a/drivers/iommu/amd/amd_iommu_types.h +++ b/drivers/iommu/amd/amd_iommu_types.h @@ -217,7 +217,7 @@ #define PPR_STATUS_MASK 0xf #define PPR_STATUS_SHIFT 12 -#define CMD_INV_IOMMU_ALL_PAGES_ADDRESS 0x7fffffffffffffffULL +#define CMD_INV_IOMMU_ALL_PAGES_ADDRESS 0x7ffffffffffff000ULL /* macros and definitions for device table entries */ #define DEV_ENTRY_VALID 0x00 diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c index 703cbb84953b..15bd0f3e22cc 100644 --- a/drivers/iommu/amd/iommu.c +++ b/drivers/iommu/amd/iommu.c @@ -1288,7 +1288,7 @@ static inline u64 build_inv_address(u64 address, u64 last) * */ if (unlikely(sz_lg2 > 52)) - return (CMD_INV_IOMMU_ALL_PAGES_ADDRESS & PAGE_MASK) | + return CMD_INV_IOMMU_ALL_PAGES_ADDRESS | CMD_INV_IOMMU_PAGES_SIZE_MASK; /*