Skip to contentSkip to conversation

sparc32: fix page table traversal in srmmu_nocache_init()

PATCH In review Mike Rapoport 2 participants 2 messages May 23, 2020

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

PATCH 1/1 sparc32: fix page table traversal in srmmu_nocache_init()

The srmmu_nocache_init() uses __nocache_fix() macro to add an offset to page table entry to access srmmu_nocache_pool.

But since sparc32 has only three actual page table levels, pgd, p4d and pud are essentially the same thing and pgd_offset() and p4d_offset() are no-ops, the __nocache_fix() should be done only at PUD level.

Remove __nocache_fix() for p4d_offset() and pud_offset() and keep it only for PUD and lower levels.

Fixes c2bc26f7ca1f ("sparc32: use PUD rather than PGD to get PMD in srmmu_nocache_init()")
Cc David S. Miller <[email protected]>
Cc Anatoly Pugachev <[email protected]>
---
 arch/sparc/mm/srmmu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/sparc/mm/srmmu.c +2 -2
index e9f7af32da07..a8c2f2615fc6 100644
@@ -331,8 +331,8 @@ static void __init srmmu_nocache_init(void)
 
 	while (vaddr < srmmu_nocache_end) {
 		pgd = pgd_offset_k(vaddr);
-		p4d = p4d_offset(__nocache_fix(pgd), vaddr);
-		pud = pud_offset(__nocache_fix(p4d), vaddr);
+		p4d = p4d_offset(pgd, vaddr);
+		pud = pud_offset(p4d, vaddr);
 		pmd = pmd_offset(__nocache_fix(pud), vaddr);
 		pte = pte_offset_kernel(__nocache_fix(pmd), vaddr);
 
Signature · 1 line
2.26.2
#1 lore raw
Quoted 3 lines · Mike Rapoport

Remove __nocache_fix() for p4d_offset() and pud_offset() and keep it only for PUD and lower levels.

Davem - I took this directly, since it's a fix for the patch Andrew sent and I merged that way. Just so you know.

Linus