Commit 67474301 authored by Pekka Enberg's avatar Pekka Enberg Committed by Palmer Dabbelt

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: default avatarPekka Enberg <penberg@kernel.org>
Signed-off-by: default avatarPalmer Dabbelt <palmerdabbelt@google.com>
parent 7a75f3d4
...@@ -208,6 +208,9 @@ asmlinkage void do_page_fault(struct pt_regs *regs) ...@@ -208,6 +208,9 @@ asmlinkage void do_page_fault(struct pt_regs *regs)
perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, addr); perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, addr);
if (cause == EXC_STORE_PAGE_FAULT)
flags |= FAULT_FLAG_WRITE;
retry: retry:
mmap_read_lock(mm); mmap_read_lock(mm);
vma = find_vma(mm, addr); vma = find_vma(mm, addr);
...@@ -251,7 +254,6 @@ asmlinkage void do_page_fault(struct pt_regs *regs) ...@@ -251,7 +254,6 @@ asmlinkage void do_page_fault(struct pt_regs *regs)
bad_area(regs, mm, code, addr); bad_area(regs, mm, code, addr);
return; return;
} }
flags |= FAULT_FLAG_WRITE;
break; break;
default: default:
panic("%s: unhandled cause %lu", __func__, cause); panic("%s: unhandled cause %lu", __func__, cause);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment