Skip to contentSkip to conversation

iommu: amd: Use page mode macros in fetch_pte

PATCH Applied Jerry Snitselaar 3 participants 3 messages Apr 20, 2023 – May 22, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iommu: amd: Use page mode macros in fetch_pte

Use the page mode macros instead of magic numbers in fetch_pte.

Cc Robin Murphy <[email protected]>
Cc Will Deacon <[email protected]>
Cc Suravee Suthikulpanit <[email protected]>
Cc Joerg Roedel <[email protected]>
---
 drivers/iommu/amd/io_pgtable.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iommu/amd/io_pgtable.c +2 -2
index ace0e9b8b913..61a99d715b23 100644
@@ -310,8 +310,8 @@ static u64 *fetch_pte(struct amd_io_pgtable *pgtable,
 			return NULL;
 
 		/* Large PTE */
-		if (PM_PTE_LEVEL(*pte) == 7 ||
-		    PM_PTE_LEVEL(*pte) == 0)
+		if (PM_PTE_LEVEL(*pte) == PAGE_MODE_7_LEVEL ||
+		    PM_PTE_LEVEL(*pte) == PAGE_MODE_NONE)
 			break;
 
 		/* No level skipping support yet */
Signature · 1 line
2.38.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Jerry Snitselaar

Use the page mode macros instead of magic numbers in fetch_pte.

Cc Robin Murphy <[email protected]>
Cc Will Deacon <[email protected]>
Cc Suravee Suthikulpanit <[email protected]>
Cc Joerg Roedel <[email protected]>

Thanks for the fix.

-Vasant

Quoted 19 lines
---
 drivers/iommu/amd/io_pgtable.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iommu/amd/io_pgtable.c +2 -2
index ace0e9b8b913..61a99d715b23 100644
@@ -310,8 +310,8 @@ static u64 *fetch_pte(struct amd_io_pgtable *pgtable,
 			return NULL;
 
 		/* Large PTE */
-		if (PM_PTE_LEVEL(*pte) == 7 ||
-		    PM_PTE_LEVEL(*pte) == 0)
+		if (PM_PTE_LEVEL(*pte) == PAGE_MODE_7_LEVEL ||
+		    PM_PTE_LEVEL(*pte) == PAGE_MODE_NONE)
 			break;
 
 		/* No level skipping support yet */