Skip to content

Commit

Permalink
riscv: Add sfence.vma after early page table changes
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Syven Wang <[email protected]>
Signed-off-by: Greentime Hu <[email protected]>
Reviewed-by: Anup Patel <[email protected]>
[Palmer: Cleaned up the commit text]
Signed-off-by: Palmer Dabbelt <[email protected]>
  • Loading branch information
greentime authored and palmer-dabbelt committed Sep 19, 2020
1 parent 66d18db commit 21190b7
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions arch/riscv/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,11 @@ void __set_fixmap(enum fixed_addresses idx, phys_addr_t phys, pgprot_t prot)

ptep = &fixmap_pte[pte_index(addr)];

if (pgprot_val(prot)) {
if (pgprot_val(prot))
set_pte(ptep, pfn_pte(phys >> PAGE_SHIFT, prot));
} else {
else
pte_clear(&init_mm, addr, ptep);
local_flush_tlb_page(addr);
}
local_flush_tlb_page(addr);
}

static pte_t *__init get_pte_virt(phys_addr_t pa)
Expand Down

0 comments on commit 21190b7

Please sign in to comment.