Lines Matching refs:esr

47 	int	(*fn)(unsigned long far, unsigned long esr,
57 static inline const struct fault_info *esr_to_fault_info(unsigned long esr) in esr_to_fault_info() argument
59 return fault_info + (esr & ESR_ELx_FSC); in esr_to_fault_info()
62 static inline const struct fault_info *esr_to_debug_fault_info(unsigned long esr) in esr_to_debug_fault_info() argument
64 return debug_fault_info + DBG_ESR_EVT(esr); in esr_to_debug_fault_info()
67 static void data_abort_decode(unsigned long esr) in data_abort_decode() argument
69 unsigned long iss2 = ESR_ELx_ISS2(esr); in data_abort_decode()
73 if (esr & ESR_ELx_ISV) { in data_abort_decode()
75 1U << ((esr & ESR_ELx_SAS) >> ESR_ELx_SAS_SHIFT)); in data_abort_decode()
77 (esr & ESR_ELx_SSE) >> ESR_ELx_SSE_SHIFT, in data_abort_decode()
78 (esr & ESR_ELx_SRT_MASK) >> ESR_ELx_SRT_SHIFT); in data_abort_decode()
80 (esr & ESR_ELx_SF) >> ESR_ELx_SF_SHIFT, in data_abort_decode()
81 (esr & ESR_ELx_AR) >> ESR_ELx_AR_SHIFT); in data_abort_decode()
84 esr & ESR_ELx_ISS_MASK, iss2); in data_abort_decode()
88 (esr & ESR_ELx_CM) >> ESR_ELx_CM_SHIFT, in data_abort_decode()
89 (esr & ESR_ELx_WNR) >> ESR_ELx_WNR_SHIFT, in data_abort_decode()
100 static void mem_abort_decode(unsigned long esr) in mem_abort_decode() argument
104 pr_alert(" ESR = 0x%016lx\n", esr); in mem_abort_decode()
106 ESR_ELx_EC(esr), esr_get_class_string(esr), in mem_abort_decode()
107 (esr & ESR_ELx_IL) ? 32 : 16); in mem_abort_decode()
109 (esr & ESR_ELx_SET_MASK) >> ESR_ELx_SET_SHIFT, in mem_abort_decode()
110 (esr & ESR_ELx_FnV) >> ESR_ELx_FnV_SHIFT); in mem_abort_decode()
112 (esr & ESR_ELx_EA) >> ESR_ELx_EA_SHIFT, in mem_abort_decode()
113 (esr & ESR_ELx_S1PTW) >> ESR_ELx_S1PTW_SHIFT); in mem_abort_decode()
114 pr_alert(" FSC = 0x%02lx: %s\n", (esr & ESR_ELx_FSC), in mem_abort_decode()
115 esr_to_fault_info(esr)->name); in mem_abort_decode()
117 if (esr_is_data_abort(esr)) in mem_abort_decode()
118 data_abort_decode(esr); in mem_abort_decode()
247 static bool is_el1_instruction_abort(unsigned long esr) in is_el1_instruction_abort() argument
249 return ESR_ELx_EC(esr) == ESR_ELx_EC_IABT_CUR; in is_el1_instruction_abort()
252 static bool is_el1_data_abort(unsigned long esr) in is_el1_data_abort() argument
254 return ESR_ELx_EC(esr) == ESR_ELx_EC_DABT_CUR; in is_el1_data_abort()
257 static inline bool is_el1_permission_fault(unsigned long addr, unsigned long esr, in is_el1_permission_fault() argument
260 unsigned long fsc_type = esr & ESR_ELx_FSC_TYPE; in is_el1_permission_fault()
262 if (!is_el1_data_abort(esr) && !is_el1_instruction_abort(esr)) in is_el1_permission_fault()
276 unsigned long esr, in is_spurious_el1_translation_fault() argument
282 if (!is_el1_data_abort(esr) || in is_spurious_el1_translation_fault()
283 (esr & ESR_ELx_FSC_TYPE) != ESR_ELx_FSC_FAULT) in is_spurious_el1_translation_fault()
308 unsigned long esr, struct pt_regs *regs) in die_kernel_fault() argument
317 mem_abort_decode(esr); in die_kernel_fault()
320 die("Oops", regs, esr); in die_kernel_fault()
326 static void report_tag_fault(unsigned long addr, unsigned long esr, in report_tag_fault() argument
333 bool is_write = !!(esr & ESR_ELx_WNR); in report_tag_fault()
338 static inline void report_tag_fault(unsigned long addr, unsigned long esr, in report_tag_fault() argument
342 static void do_tag_recovery(unsigned long addr, unsigned long esr, in do_tag_recovery() argument
346 report_tag_fault(addr, esr, regs); in do_tag_recovery()
358 static bool is_el1_mte_sync_tag_check_fault(unsigned long esr) in is_el1_mte_sync_tag_check_fault() argument
360 unsigned long fsc = esr & ESR_ELx_FSC; in is_el1_mte_sync_tag_check_fault()
362 if (!is_el1_data_abort(esr)) in is_el1_mte_sync_tag_check_fault()
371 static bool is_translation_fault(unsigned long esr) in is_translation_fault() argument
373 return (esr & ESR_ELx_FSC_TYPE) == ESR_ELx_FSC_FAULT; in is_translation_fault()
376 static void __do_kernel_fault(unsigned long addr, unsigned long esr, in __do_kernel_fault() argument
385 if (!is_el1_instruction_abort(esr) && fixup_exception(regs)) in __do_kernel_fault()
388 if (WARN_RATELIMIT(is_spurious_el1_translation_fault(addr, esr, regs), in __do_kernel_fault()
392 if (is_el1_mte_sync_tag_check_fault(esr)) { in __do_kernel_fault()
393 do_tag_recovery(addr, esr, regs); in __do_kernel_fault()
398 if (is_el1_permission_fault(addr, esr, regs)) { in __do_kernel_fault()
399 if (esr & ESR_ELx_WNR) in __do_kernel_fault()
401 else if (is_el1_instruction_abort(esr)) in __do_kernel_fault()
408 if (is_translation_fault(esr) && in __do_kernel_fault()
409 kfence_handle_page_fault(addr, esr & ESR_ELx_WNR, regs)) in __do_kernel_fault()
418 die_kernel_fault(msg, addr, esr, regs); in __do_kernel_fault()
421 static void set_thread_esr(unsigned long address, unsigned long esr) in set_thread_esr() argument
438 switch (ESR_ELx_EC(esr)) { in set_thread_esr()
449 esr &= ESR_ELx_EC_MASK | ESR_ELx_IL | in set_thread_esr()
451 esr |= ESR_ELx_FSC_FAULT; in set_thread_esr()
459 esr &= ESR_ELx_EC_MASK | ESR_ELx_IL; in set_thread_esr()
460 esr |= ESR_ELx_FSC_FAULT; in set_thread_esr()
469 WARN(1, "ESR 0x%lx is not DABT or IABT from EL0\n", esr); in set_thread_esr()
470 esr = 0; in set_thread_esr()
475 current->thread.fault_code = esr; in set_thread_esr()
478 static void do_bad_area(unsigned long far, unsigned long esr, in do_bad_area() argument
488 const struct fault_info *inf = esr_to_fault_info(esr); in do_bad_area()
490 set_thread_esr(addr, esr); in do_bad_area()
493 __do_kernel_fault(addr, esr, regs); in do_bad_area()
516 static bool is_el0_instruction_abort(unsigned long esr) in is_el0_instruction_abort() argument
518 return ESR_ELx_EC(esr) == ESR_ELx_EC_IABT_LOW; in is_el0_instruction_abort()
525 static bool is_write_abort(unsigned long esr) in is_write_abort() argument
527 return (esr & ESR_ELx_WNR) && !(esr & ESR_ELx_CM); in is_write_abort()
530 static int __kprobes do_page_fault(unsigned long far, unsigned long esr, in do_page_fault() argument
541 if (kprobe_page_fault(regs, esr)) in do_page_fault()
560 if (is_el0_instruction_abort(esr)) { in do_page_fault()
564 } else if (is_write_abort(esr)) { in do_page_fault()
578 if (is_ttbr0_addr(addr) && is_el1_permission_fault(addr, esr, regs)) { in do_page_fault()
579 if (is_el1_instruction_abort(esr)) in do_page_fault()
581 addr, esr, regs); in do_page_fault()
585 addr, esr, regs); in do_page_fault()
670 inf = esr_to_fault_info(esr); in do_page_fault()
671 set_thread_esr(addr, esr); in do_page_fault()
699 __do_kernel_fault(addr, esr, regs); in do_page_fault()
704 unsigned long esr, in do_translation_fault() argument
710 return do_page_fault(far, esr, regs); in do_translation_fault()
712 do_bad_area(far, esr, regs); in do_translation_fault()
716 static int do_alignment_fault(unsigned long far, unsigned long esr, in do_alignment_fault() argument
722 do_bad_area(far, esr, regs); in do_alignment_fault()
726 static int do_bad(unsigned long far, unsigned long esr, struct pt_regs *regs) in do_bad() argument
731 static int do_sea(unsigned long far, unsigned long esr, struct pt_regs *regs) in do_sea() argument
736 inf = esr_to_fault_info(esr); in do_sea()
746 if (esr & ESR_ELx_FnV) { in do_sea()
756 arm64_notify_die(inf->name, regs, inf->sig, inf->code, siaddr, esr); in do_sea()
761 static int do_tag_check_fault(unsigned long far, unsigned long esr, in do_tag_check_fault() argument
770 do_bad_area(far, esr, regs); in do_tag_check_fault()
841 void do_mem_abort(unsigned long far, unsigned long esr, struct pt_regs *regs) in do_mem_abort() argument
843 const struct fault_info *inf = esr_to_fault_info(esr); in do_mem_abort()
846 if (!inf->fn(far, esr, regs)) in do_mem_abort()
850 die_kernel_fault(inf->name, addr, esr, regs); in do_mem_abort()
857 arm64_notify_die(inf->name, regs, inf->sig, inf->code, addr, esr); in do_mem_abort()
861 void do_sp_pc_abort(unsigned long addr, unsigned long esr, struct pt_regs *regs) in do_sp_pc_abort() argument
864 addr, esr); in do_sp_pc_abort()
918 void do_debug_exception(unsigned long addr_if_watchpoint, unsigned long esr, in do_debug_exception() argument
921 const struct fault_info *inf = esr_to_debug_fault_info(esr); in do_debug_exception()
929 if (inf->fn(addr_if_watchpoint, esr, regs)) { in do_debug_exception()
930 arm64_notify_die(inf->name, regs, inf->sig, inf->code, pc, esr); in do_debug_exception()