Skip to content

Commit c3c7579

Browse files
committed
Merge tag 'powerpc-5.12-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Pull powerpc fixes from Michael Ellerman: "Some more powerpc fixes for 5.12: - Fix wrong instruction encoding for lis in ppc_function_entry(), which could potentially lead to missed kprobes. - Fix SET_FULL_REGS on 32-bit and 64e, which prevented ptrace of non-volatile GPRs immediately after exec. - Clean up a missed SRR specifier in the recent interrupt rework. - Don't treat unrecoverable_exception() as an interrupt handler, it's called from other handlers so shouldn't do the interrupt entry/exit accounting itself. - Fix build errors caused by missing declarations for [en/dis]able_kernel_vsx(). Thanks to Christophe Leroy, Daniel Axtens, Geert Uytterhoeven, Jiri Olsa, Naveen N. Rao, and Nicholas Piggin" * tag 'powerpc-5.12-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: powerpc/traps: unrecoverable_exception() is not an interrupt handler powerpc: Fix missing declaration of [en/dis]able_kernel_vsx() powerpc/64s/exception: Clean up a missed SRR specifier powerpc: Fix inverted SET_FULL_REGS bitop powerpc/64s: Use symbolic macros for function entry encoding powerpc/64s: Fix instruction encoding for lis in ppc_function_entry()
2 parents 9d0c8e7 + 0b73688 commit c3c7579

File tree

7 files changed

+20
-9
lines changed

7 files changed

+20
-9
lines changed

arch/powerpc/include/asm/code-patching.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,10 @@ void __patch_exception(int exc, unsigned long addr);
7373
#endif
7474

7575
#define OP_RT_RA_MASK 0xffff0000UL
76-
#define LIS_R2 0x3c020000UL
77-
#define ADDIS_R2_R12 0x3c4c0000UL
78-
#define ADDI_R2_R2 0x38420000UL
76+
#define LIS_R2 (PPC_INST_ADDIS | __PPC_RT(R2))
77+
#define ADDIS_R2_R12 (PPC_INST_ADDIS | __PPC_RT(R2) | __PPC_RA(R12))
78+
#define ADDI_R2_R2 (PPC_INST_ADDI | __PPC_RT(R2) | __PPC_RA(R2))
79+
7980

8081
static inline unsigned long ppc_function_entry(void *func)
8182
{

arch/powerpc/include/asm/interrupt.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,6 @@ DECLARE_INTERRUPT_HANDLER(altivec_assist_exception);
410410
DECLARE_INTERRUPT_HANDLER(CacheLockingException);
411411
DECLARE_INTERRUPT_HANDLER(SPEFloatingPointException);
412412
DECLARE_INTERRUPT_HANDLER(SPEFloatingPointRoundException);
413-
DECLARE_INTERRUPT_HANDLER(unrecoverable_exception);
414413
DECLARE_INTERRUPT_HANDLER(WatchdogException);
415414
DECLARE_INTERRUPT_HANDLER(kernel_bad_stack);
416415

@@ -437,6 +436,8 @@ DECLARE_INTERRUPT_HANDLER_NMI(hmi_exception_realmode);
437436

438437
DECLARE_INTERRUPT_HANDLER_ASYNC(TAUException);
439438

439+
void unrecoverable_exception(struct pt_regs *regs);
440+
440441
void replay_system_reset(void);
441442
void replay_soft_interrupts(void);
442443

arch/powerpc/include/asm/ptrace.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ static inline void regs_set_return_value(struct pt_regs *regs, unsigned long rc)
195195
#define TRAP_FLAGS_MASK 0x11
196196
#define TRAP(regs) ((regs)->trap & ~TRAP_FLAGS_MASK)
197197
#define FULL_REGS(regs) (((regs)->trap & 1) == 0)
198-
#define SET_FULL_REGS(regs) ((regs)->trap |= 1)
198+
#define SET_FULL_REGS(regs) ((regs)->trap &= ~1)
199199
#endif
200200
#define CHECK_FULL_REGS(regs) BUG_ON(!FULL_REGS(regs))
201201
#define NV_REG_POISON 0xdeadbeefdeadbeefUL
@@ -210,7 +210,7 @@ static inline void regs_set_return_value(struct pt_regs *regs, unsigned long rc)
210210
#define TRAP_FLAGS_MASK 0x1F
211211
#define TRAP(regs) ((regs)->trap & ~TRAP_FLAGS_MASK)
212212
#define FULL_REGS(regs) (((regs)->trap & 1) == 0)
213-
#define SET_FULL_REGS(regs) ((regs)->trap |= 1)
213+
#define SET_FULL_REGS(regs) ((regs)->trap &= ~1)
214214
#define IS_CRITICAL_EXC(regs) (((regs)->trap & 2) != 0)
215215
#define IS_MCHECK_EXC(regs) (((regs)->trap & 4) != 0)
216216
#define IS_DEBUG_EXC(regs) (((regs)->trap & 8) != 0)

arch/powerpc/include/asm/switch_to.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,16 @@ static inline void disable_kernel_vsx(void)
7171
{
7272
msr_check_and_clear(MSR_FP|MSR_VEC|MSR_VSX);
7373
}
74+
#else
75+
static inline void enable_kernel_vsx(void)
76+
{
77+
BUILD_BUG();
78+
}
79+
80+
static inline void disable_kernel_vsx(void)
81+
{
82+
BUILD_BUG();
83+
}
7484
#endif
7585

7686
#ifdef CONFIG_SPE

arch/powerpc/kernel/exceptions-64s.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ DEFINE_FIXED_SYMBOL(\name\()_common_real)
466466

467467
ld r10,PACAKMSR(r13) /* get MSR value for kernel */
468468
/* MSR[RI] is clear iff using SRR regs */
469-
.if IHSRR == EXC_HV_OR_STD
469+
.if IHSRR_IF_HVMODE
470470
BEGIN_FTR_SECTION
471471
xori r10,r10,MSR_RI
472472
END_FTR_SECTION_IFCLR(CPU_FTR_HVMODE)

arch/powerpc/kernel/interrupt.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,6 @@ notrace unsigned long interrupt_exit_user_prepare(struct pt_regs *regs, unsigned
436436
return ret;
437437
}
438438

439-
void unrecoverable_exception(struct pt_regs *regs);
440439
void preempt_schedule_irq(void);
441440

442441
notrace unsigned long interrupt_exit_kernel_prepare(struct pt_regs *regs, unsigned long msr)

arch/powerpc/kernel/traps.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2170,7 +2170,7 @@ DEFINE_INTERRUPT_HANDLER(SPEFloatingPointRoundException)
21702170
* in the MSR is 0. This indicates that SRR0/1 are live, and that
21712171
* we therefore lost state by taking this exception.
21722172
*/
2173-
DEFINE_INTERRUPT_HANDLER(unrecoverable_exception)
2173+
void unrecoverable_exception(struct pt_regs *regs)
21742174
{
21752175
pr_emerg("Unrecoverable exception %lx at %lx (msr=%lx)\n",
21762176
regs->trap, regs->nip, regs->msr);

0 commit comments

Comments
 (0)