summaryrefslogtreecommitdiffstats
path: root/arch/arm/mm
diff options
context:
space:
mode:
authorWang Kefeng <wangkefeng.wang@huawei.com>2021-12-03 10:26:32 +0100
committerRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2021-12-17 12:34:37 +0100
commit3c341b217414d1d63718438f2b2fa588cf2b73fc (patch)
treea339e5c295aec4ff8e8c0aae2b1c825909b264be /arch/arm/mm
parentARM: 9164/1: mm: Provide set_memory_valid() (diff)
downloadlinux-3c341b217414d1d63718438f2b2fa588cf2b73fc.tar.xz
linux-3c341b217414d1d63718438f2b2fa588cf2b73fc.zip
ARM: 9165/1: mm: Provide is_write_fault()
The function will check whether the fault is caused by a write access, it will be called in die_kernel_fault() too in next patch, so put it before the function of die_kernel_fault(). Acked-by: Marco Elver <elver@google.com> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Diffstat (limited to 'arch/arm/mm')
-rw-r--r--arch/arm/mm/fault.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
index 013921a5909b..1d41e8fad4f3 100644
--- a/arch/arm/mm/fault.c
+++ b/arch/arm/mm/fault.c
@@ -99,6 +99,11 @@ void show_pte(const char *lvl, struct mm_struct *mm, unsigned long addr)
{ }
#endif /* CONFIG_MMU */
+static inline bool is_write_fault(unsigned int fsr)
+{
+ return (fsr & FSR_WRITE) && !(fsr & FSR_CM);
+}
+
static void die_kernel_fault(const char *msg, struct mm_struct *mm,
unsigned long addr, unsigned int fsr,
struct pt_regs *regs)
@@ -261,7 +266,7 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
if (user_mode(regs))
flags |= FAULT_FLAG_USER;
- if ((fsr & FSR_WRITE) && !(fsr & FSR_CM)) {
+ if (is_write_fault(fsr)) {
flags |= FAULT_FLAG_WRITE;
vm_flags = VM_WRITE;
}