Skip to content

Commit 47dd902

Browse files
Dylan-Jhongpalmer-dabbelt
authored andcommitted
RISC-V: mm: Support huge page in vmalloc_fault()
Since RISC-V supports ioremap() with huge page (pud/pmd) mapping, However, vmalloc_fault() assumes that the vmalloc range is limited to pte mappings. To complete the vmalloc_fault() function by adding huge page support. Fixes: 310f541 ("riscv: Enable HAVE_ARCH_HUGE_VMAP for 64BIT") Cc: [email protected] Signed-off-by: Dylan Jhong <[email protected]> Reviewed-by: Alexandre Ghiti <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 9b7fef2 commit 47dd902

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

arch/riscv/mm/fault.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ static inline void vmalloc_fault(struct pt_regs *regs, int code, unsigned long a
143143
no_context(regs, addr);
144144
return;
145145
}
146+
if (pud_leaf(*pud_k))
147+
goto flush_tlb;
146148

147149
/*
148150
* Since the vmalloc area is global, it is unnecessary
@@ -153,6 +155,8 @@ static inline void vmalloc_fault(struct pt_regs *regs, int code, unsigned long a
153155
no_context(regs, addr);
154156
return;
155157
}
158+
if (pmd_leaf(*pmd_k))
159+
goto flush_tlb;
156160

157161
/*
158162
* Make sure the actual PTE exists as well to
@@ -172,6 +176,7 @@ static inline void vmalloc_fault(struct pt_regs *regs, int code, unsigned long a
172176
* ordering constraint, not a cache flush; it is
173177
* necessary even after writing invalid entries.
174178
*/
179+
flush_tlb:
175180
local_flush_tlb_page(addr);
176181
}
177182

0 commit comments

Comments
 (0)