From: Jason Gunthorpe Date: Fri, 27 Mar 2026 15:23:58 +0000 (-0300) Subject: iommu/amd: Make CMD_INV_IOMMU_ALL_PAGES_ADDRESS match the spec X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=17149077e01c9f1a9171928d3ebdaaaf504577a9;p=thirdparty%2Fkernel%2Flinux.git 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 --- diff --git a/drivers/iommu/amd/amd_iommu_types.h b/drivers/iommu/amd/amd_iommu_types.h index 96038b2e24d58..0936430615979 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 703cbb84953b5..15bd0f3e22ccd 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; /*