提交 935b534c 编写于 作者: N Nicholas Piggin 提交者: Michael Ellerman

powerpc/64s: Move and rename do_bad_slb_fault as it is not hash specific

slb.c is hash-specific SLB management, but do_bad_slb_fault deals with
segment interrupts that occur with radix MMU as well.
Signed-off-by: NNicholas Piggin <npiggin@gmail.com>
Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20211201144153.2456614-5-npiggin@gmail.com
上级 a4135cbe
...@@ -564,7 +564,7 @@ DECLARE_INTERRUPT_HANDLER(kernel_bad_stack); ...@@ -564,7 +564,7 @@ DECLARE_INTERRUPT_HANDLER(kernel_bad_stack);
/* slb.c */ /* slb.c */
DECLARE_INTERRUPT_HANDLER_RAW(do_slb_fault); DECLARE_INTERRUPT_HANDLER_RAW(do_slb_fault);
DECLARE_INTERRUPT_HANDLER(do_bad_slb_fault); DECLARE_INTERRUPT_HANDLER(do_bad_segment_interrupt);
/* hash_utils.c */ /* hash_utils.c */
DECLARE_INTERRUPT_HANDLER_RAW(do_hash_fault); DECLARE_INTERRUPT_HANDLER_RAW(do_hash_fault);
......
...@@ -1428,7 +1428,7 @@ MMU_FTR_SECTION_ELSE ...@@ -1428,7 +1428,7 @@ MMU_FTR_SECTION_ELSE
ALT_MMU_FTR_SECTION_END_IFCLR(MMU_FTR_TYPE_RADIX) ALT_MMU_FTR_SECTION_END_IFCLR(MMU_FTR_TYPE_RADIX)
std r3,RESULT(r1) std r3,RESULT(r1)
addi r3,r1,STACK_FRAME_OVERHEAD addi r3,r1,STACK_FRAME_OVERHEAD
bl do_bad_slb_fault bl do_bad_segment_interrupt
b interrupt_return_srr b interrupt_return_srr
...@@ -1508,7 +1508,7 @@ MMU_FTR_SECTION_ELSE ...@@ -1508,7 +1508,7 @@ MMU_FTR_SECTION_ELSE
ALT_MMU_FTR_SECTION_END_IFCLR(MMU_FTR_TYPE_RADIX) ALT_MMU_FTR_SECTION_END_IFCLR(MMU_FTR_TYPE_RADIX)
std r3,RESULT(r1) std r3,RESULT(r1)
addi r3,r1,STACK_FRAME_OVERHEAD addi r3,r1,STACK_FRAME_OVERHEAD
bl do_bad_slb_fault bl do_bad_segment_interrupt
b interrupt_return_srr b interrupt_return_srr
......
...@@ -868,19 +868,3 @@ DEFINE_INTERRUPT_HANDLER_RAW(do_slb_fault) ...@@ -868,19 +868,3 @@ DEFINE_INTERRUPT_HANDLER_RAW(do_slb_fault)
return err; return err;
} }
} }
DEFINE_INTERRUPT_HANDLER(do_bad_slb_fault)
{
int err = regs->result;
if (err == -EFAULT) {
if (user_mode(regs))
_exception(SIGSEGV, regs, SEGV_BNDERR, regs->dar);
else
bad_page_fault(regs, SIGSEGV);
} else if (err == -EINVAL) {
unrecoverable_exception(regs);
} else {
BUG();
}
}
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <linux/kfence.h> #include <linux/kfence.h>
#include <linux/pkeys.h> #include <linux/pkeys.h>
#include <asm/asm-prototypes.h>
#include <asm/firmware.h> #include <asm/firmware.h>
#include <asm/interrupt.h> #include <asm/interrupt.h>
#include <asm/page.h> #include <asm/page.h>
...@@ -620,4 +621,27 @@ DEFINE_INTERRUPT_HANDLER(do_bad_page_fault_segv) ...@@ -620,4 +621,27 @@ DEFINE_INTERRUPT_HANDLER(do_bad_page_fault_segv)
{ {
bad_page_fault(regs, SIGSEGV); bad_page_fault(regs, SIGSEGV);
} }
/*
* In radix, segment interrupts indicate the EA is not addressable by the
* page table geometry, so they are always sent here.
*
* In hash, this is called if do_slb_fault returns error. Typically it is
* because the EA was outside the region allowed by software.
*/
DEFINE_INTERRUPT_HANDLER(do_bad_segment_interrupt)
{
int err = regs->result;
if (err == -EFAULT) {
if (user_mode(regs))
_exception(SIGSEGV, regs, SEGV_BNDERR, regs->dar);
else
bad_page_fault(regs, SIGSEGV);
} else if (err == -EINVAL) {
unrecoverable_exception(regs);
} else {
BUG();
}
}
#endif #endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册