diff options
author | Pekka Enberg <penberg@kernel.org> | 2020-08-25 19:42:54 +0300 |
---|---|---|
committer | Palmer Dabbelt <palmerdabbelt@google.com> | 2020-09-15 18:46:04 -0700 |
commit | 6747430197ed414be37e843064a7f365f4d1fd57 (patch) | |
tree | c375d5ab5f89bd62656e5467cde41e121c940bb4 /arch/riscv/mm | |
parent | 7a75f3d47a0b1be6eeb67d14e4003b2b91f8aa59 (diff) | |
download | linux-6747430197ed414be37e843064a7f365f4d1fd57.tar.gz linux-6747430197ed414be37e843064a7f365f4d1fd57.tar.bz2 linux-6747430197ed414be37e843064a7f365f4d1fd57.zip |
riscv/mm/fault: Move FAULT_FLAG_WRITE handling in do_page_fault()
Let's handle the translation of EXC_STORE_PAGE_FAULT to FAULT_FLAG_WRITE
once before looking up the VMA. This makes it easier to extract access
error logic in the next patch.
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
Diffstat (limited to 'arch/riscv/mm')
-rw-r--r-- | arch/riscv/mm/fault.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/riscv/mm/fault.c b/arch/riscv/mm/fault.c index 3b430fb18de3..bdc70d3d507f 100644 --- a/arch/riscv/mm/fault.c +++ b/arch/riscv/mm/fault.c @@ -208,6 +208,9 @@ asmlinkage void do_page_fault(struct pt_regs *regs) perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, addr); + if (cause == EXC_STORE_PAGE_FAULT) + flags |= FAULT_FLAG_WRITE; + retry: mmap_read_lock(mm); vma = find_vma(mm, addr); @@ -251,7 +254,6 @@ good_area: bad_area(regs, mm, code, addr); return; } - flags |= FAULT_FLAG_WRITE; break; default: panic("%s: unhandled cause %lu", __func__, cause); |