Skip to contentSkip to conversation

iommu/amd: Fix DTE_IRQ_PHYS_ADDR_MASK macro

PATCH Applied Vasant Hegde 3 participants 3 messages Jun 9, 2023 – Jun 16, 2023

Subsystems (2)
lore
Share & tools
lore

Vasant Hegde

author maintainer
#0 lore raw

PATCH 1/1 iommu/amd: Fix DTE_IRQ_PHYS_ADDR_MASK macro

Interrupt Table Root Pointer is 52 bit and table must be aligned to start on a 128-byte boundary. Hence first 6 bits are ignored.

Current code uses address mask as 45 instead of 46bit. Use GENMASK_ULL macro instead of manually generating address mask.

---
 drivers/iommu/amd/amd_iommu_types.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/amd/amd_iommu_types.h +1 -1
index 2ddbda3a4374..ae0edeb379d4 100644
@@ -283,7 +283,7 @@
 #define AMD_IOMMU_PGSIZES_V2	(PAGE_SIZE | (1ULL << 21) | (1ULL << 30))
 
 /* Bit value definition for dte irq remapping fields*/
-#define DTE_IRQ_PHYS_ADDR_MASK	(((1ULL << 45)-1) << 6)
+#define DTE_IRQ_PHYS_ADDR_MASK		GENMASK_ULL(51, 6)
 #define DTE_IRQ_REMAP_INTCTL_MASK	(0x3ULL << 60)
 #define DTE_IRQ_REMAP_INTCTL    (2ULL << 60)
 #define DTE_IRQ_REMAP_ENABLE    1ULL
Signature · 1 line
2.31.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Vasant Hegde

Interrupt Table Root Pointer is 52 bit and table must be aligned to start on a 128-byte boundary. Hence first 6 bits are ignored.

Current code uses address mask as 45 instead of 46bit. Use GENMASK_ULL macro instead of manually generating address mask.

Quoted 20 lines
---
 drivers/iommu/amd/amd_iommu_types.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/amd/amd_iommu_types.h +1 -1
index 2ddbda3a4374..ae0edeb379d4 100644
@@ -283,7 +283,7 @@
 #define AMD_IOMMU_PGSIZES_V2	(PAGE_SIZE | (1ULL << 21) | (1ULL << 30))
 
 /* Bit value definition for dte irq remapping fields*/
-#define DTE_IRQ_PHYS_ADDR_MASK	(((1ULL << 45)-1) << 6)
+#define DTE_IRQ_PHYS_ADDR_MASK		GENMASK_ULL(51, 6)
 #define DTE_IRQ_REMAP_INTCTL_MASK	(0x3ULL << 60)
 #define DTE_IRQ_REMAP_INTCTL    (2ULL << 60)
 #define DTE_IRQ_REMAP_ENABLE    1ULL
Signature · 1 line
2.31.1
maintainer Applied
#2 lore raw
In reply to Vasant Hegde
Quoted 10 lines · Vasant Hegde

Interrupt Table Root Pointer is 52 bit and table must be aligned to start on a 128-byte boundary. Hence first 6 bits are ignored.

Current code uses address mask as 45 instead of 46bit. Use GENMASK_ULL macro instead of manually generating address mask.

---
 drivers/iommu/amd/amd_iommu_types.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.