Skip to content

Commit 21190b7

Browse files
greentimepalmer-dabbelt
authored andcommitted
riscv: Add sfence.vma after early page table changes
This invalidates local TLB after modifying the page tables during early init as it's too early to handle suprious faults as we otherwise do. Fixes: f2c17aa ("RISC-V: Implement compile-time fixed mappings") Reported-by: Syven Wang <syven.wang@sifive.com> Signed-off-by: Syven Wang <syven.wang@sifive.com> Signed-off-by: Greentime Hu <greentime.hu@sifive.com> Reviewed-by: Anup Patel <anup@brainfault.org> [Palmer: Cleaned up the commit text] Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
1 parent 66d18db commit 21190b7

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

arch/riscv/mm/init.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,12 +226,11 @@ void __set_fixmap(enum fixed_addresses idx, phys_addr_t phys, pgprot_t prot)
226226

227227
ptep = &fixmap_pte[pte_index(addr)];
228228

229-
if (pgprot_val(prot)) {
229+
if (pgprot_val(prot))
230230
set_pte(ptep, pfn_pte(phys >> PAGE_SHIFT, prot));
231-
} else {
231+
else
232232
pte_clear(&init_mm, addr, ptep);
233-
local_flush_tlb_page(addr);
234-
}
233+
local_flush_tlb_page(addr);
235234
}
236235

237236
static pte_t *__init get_pte_virt(phys_addr_t pa)

0 commit comments

Comments
 (0)