Skip to content

Commit ecf9343

Browse files
committed
Merge tag 'powerpc-5.14-5' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Pull powerpc fixes from Michael Ellerman: - Fix crashes coming out of nap on 32-bit Book3s (eg. powerbooks). - Fix critical and debug interrupts on BookE, seen as crashes when using ptrace. - Fix an oops when running an SMP kernel on a UP system. - Update pseries LPAR security flavor after partition migration. - Fix an oops when using kprobes on BookE. - Fix oops on 32-bit pmac by not calling do_IRQ() from timer_interrupt(). - Fix softlockups on CPU hotplug into a CPU-less node with xive (P9). Thanks to Cédric Le Goater, Christophe Leroy, Finn Thain, Geetika Moolchandani, Laurent Dufour, Laurent Vivier, Nicholas Piggin, Pu Lehui, Radu Rendec, Srikar Dronamraju, and Stan Johnson. * tag 'powerpc-5.14-5' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: powerpc/xive: Do not skip CPU-less nodes when creating the IPIs powerpc/interrupt: Do not call single_step_exception() from other exceptions powerpc/interrupt: Fix OOPS by not calling do_IRQ() from timer_interrupt() powerpc/kprobes: Fix kprobe Oops happens in booke powerpc/pseries: Fix update of LPAR security flavor after LPM powerpc/smp: Fix OOPS in topology_init() powerpc/32: Fix critical and debug interrupts on BOOKE powerpc/32s: Fix napping restore in data storage interrupt (DSI)
2 parents c4f14ea + cbc06f0 commit ecf9343

File tree

13 files changed

+82
-62
lines changed

13 files changed

+82
-62
lines changed

arch/powerpc/include/asm/interrupt.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,9 @@ DECLARE_INTERRUPT_HANDLER_NMI(hmi_exception_realmode);
583583

584584
DECLARE_INTERRUPT_HANDLER_ASYNC(TAUException);
585585

586+
/* irq.c */
587+
DECLARE_INTERRUPT_HANDLER_ASYNC(do_IRQ);
588+
586589
void __noreturn unrecoverable_exception(struct pt_regs *regs);
587590

588591
void replay_system_reset(void);

arch/powerpc/include/asm/irq.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ extern void *mcheckirq_ctx[NR_CPUS];
5252
extern void *hardirq_ctx[NR_CPUS];
5353
extern void *softirq_ctx[NR_CPUS];
5454

55-
extern void do_IRQ(struct pt_regs *regs);
55+
void __do_IRQ(struct pt_regs *regs);
5656
extern void __init init_IRQ(void);
5757
extern void __do_irq(struct pt_regs *regs);
5858

arch/powerpc/include/asm/ptrace.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,22 @@ struct pt_regs
7070
unsigned long __pad[4]; /* Maintain 16 byte interrupt stack alignment */
7171
};
7272
#endif
73+
#if defined(CONFIG_PPC32) && defined(CONFIG_BOOKE)
74+
struct { /* Must be a multiple of 16 bytes */
75+
unsigned long mas0;
76+
unsigned long mas1;
77+
unsigned long mas2;
78+
unsigned long mas3;
79+
unsigned long mas6;
80+
unsigned long mas7;
81+
unsigned long srr0;
82+
unsigned long srr1;
83+
unsigned long csrr0;
84+
unsigned long csrr1;
85+
unsigned long dsrr0;
86+
unsigned long dsrr1;
87+
};
88+
#endif
7389
};
7490
#endif
7591

arch/powerpc/kernel/asm-offsets.c

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -309,24 +309,21 @@ int main(void)
309309
STACK_PT_REGS_OFFSET(STACK_REGS_IAMR, iamr);
310310
#endif
311311

312-
#if defined(CONFIG_PPC32)
313-
#if defined(CONFIG_BOOKE) || defined(CONFIG_40x)
314-
DEFINE(EXC_LVL_SIZE, STACK_EXC_LVL_FRAME_SIZE);
315-
DEFINE(MAS0, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, mas0));
312+
#if defined(CONFIG_PPC32) && defined(CONFIG_BOOKE)
313+
STACK_PT_REGS_OFFSET(MAS0, mas0);
316314
/* we overload MMUCR for 44x on MAS0 since they are mutually exclusive */
317-
DEFINE(MMUCR, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, mas0));
318-
DEFINE(MAS1, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, mas1));
319-
DEFINE(MAS2, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, mas2));
320-
DEFINE(MAS3, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, mas3));
321-
DEFINE(MAS6, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, mas6));
322-
DEFINE(MAS7, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, mas7));
323-
DEFINE(_SRR0, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, srr0));
324-
DEFINE(_SRR1, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, srr1));
325-
DEFINE(_CSRR0, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, csrr0));
326-
DEFINE(_CSRR1, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, csrr1));
327-
DEFINE(_DSRR0, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, dsrr0));
328-
DEFINE(_DSRR1, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, dsrr1));
329-
#endif
315+
STACK_PT_REGS_OFFSET(MMUCR, mas0);
316+
STACK_PT_REGS_OFFSET(MAS1, mas1);
317+
STACK_PT_REGS_OFFSET(MAS2, mas2);
318+
STACK_PT_REGS_OFFSET(MAS3, mas3);
319+
STACK_PT_REGS_OFFSET(MAS6, mas6);
320+
STACK_PT_REGS_OFFSET(MAS7, mas7);
321+
STACK_PT_REGS_OFFSET(_SRR0, srr0);
322+
STACK_PT_REGS_OFFSET(_SRR1, srr1);
323+
STACK_PT_REGS_OFFSET(_CSRR0, csrr0);
324+
STACK_PT_REGS_OFFSET(_CSRR1, csrr1);
325+
STACK_PT_REGS_OFFSET(_DSRR0, dsrr0);
326+
STACK_PT_REGS_OFFSET(_DSRR1, dsrr1);
330327
#endif
331328

332329
/* About the CPU features table */

arch/powerpc/kernel/head_book3s_32.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ ALT_MMU_FTR_SECTION_END_IFSET(MMU_FTR_HPTE_TABLE)
300300
EXCEPTION_PROLOG_1
301301
EXCEPTION_PROLOG_2 INTERRUPT_DATA_STORAGE DataAccess handle_dar_dsisr=1
302302
prepare_transfer_to_handler
303-
lwz r5, _DSISR(r11)
303+
lwz r5, _DSISR(r1)
304304
andis. r0, r5, DSISR_DABRMATCH@h
305305
bne- 1f
306306
bl do_page_fault

arch/powerpc/kernel/head_booke.h

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -168,20 +168,18 @@ ALT_FTR_SECTION_END_IFSET(CPU_FTR_EMB_HV)
168168
/* only on e500mc */
169169
#define DBG_STACK_BASE dbgirq_ctx
170170

171-
#define EXC_LVL_FRAME_OVERHEAD (THREAD_SIZE - INT_FRAME_SIZE - EXC_LVL_SIZE)
172-
173171
#ifdef CONFIG_SMP
174172
#define BOOKE_LOAD_EXC_LEVEL_STACK(level) \
175173
mfspr r8,SPRN_PIR; \
176174
slwi r8,r8,2; \
177175
addis r8,r8,level##_STACK_BASE@ha; \
178176
lwz r8,level##_STACK_BASE@l(r8); \
179-
addi r8,r8,EXC_LVL_FRAME_OVERHEAD;
177+
addi r8,r8,THREAD_SIZE - INT_FRAME_SIZE;
180178
#else
181179
#define BOOKE_LOAD_EXC_LEVEL_STACK(level) \
182180
lis r8,level##_STACK_BASE@ha; \
183181
lwz r8,level##_STACK_BASE@l(r8); \
184-
addi r8,r8,EXC_LVL_FRAME_OVERHEAD;
182+
addi r8,r8,THREAD_SIZE - INT_FRAME_SIZE;
185183
#endif
186184

187185
/*
@@ -208,7 +206,7 @@ ALT_FTR_SECTION_END_IFSET(CPU_FTR_EMB_HV)
208206
mtmsr r11; \
209207
mfspr r11,SPRN_SPRG_THREAD; /* if from user, start at top of */\
210208
lwz r11, TASK_STACK - THREAD(r11); /* this thread's kernel stack */\
211-
addi r11,r11,EXC_LVL_FRAME_OVERHEAD; /* allocate stack frame */\
209+
addi r11,r11,THREAD_SIZE - INT_FRAME_SIZE; /* allocate stack frame */\
212210
beq 1f; \
213211
/* COMING FROM USER MODE */ \
214212
stw r9,_CCR(r11); /* save CR */\
@@ -516,24 +514,5 @@ ALT_FTR_SECTION_END_IFSET(CPU_FTR_EMB_HV)
516514
bl kernel_fp_unavailable_exception; \
517515
b interrupt_return
518516

519-
#else /* __ASSEMBLY__ */
520-
struct exception_regs {
521-
unsigned long mas0;
522-
unsigned long mas1;
523-
unsigned long mas2;
524-
unsigned long mas3;
525-
unsigned long mas6;
526-
unsigned long mas7;
527-
unsigned long srr0;
528-
unsigned long srr1;
529-
unsigned long csrr0;
530-
unsigned long csrr1;
531-
unsigned long dsrr0;
532-
unsigned long dsrr1;
533-
};
534-
535-
/* ensure this structure is always sized to a multiple of the stack alignment */
536-
#define STACK_EXC_LVL_FRAME_SIZE ALIGN(sizeof (struct exception_regs), 16)
537-
538517
#endif /* __ASSEMBLY__ */
539518
#endif /* __HEAD_BOOKE_H__ */

arch/powerpc/kernel/irq.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ void __do_irq(struct pt_regs *regs)
750750
trace_irq_exit(regs);
751751
}
752752

753-
DEFINE_INTERRUPT_HANDLER_ASYNC(do_IRQ)
753+
void __do_IRQ(struct pt_regs *regs)
754754
{
755755
struct pt_regs *old_regs = set_irq_regs(regs);
756756
void *cursp, *irqsp, *sirqsp;
@@ -774,6 +774,11 @@ DEFINE_INTERRUPT_HANDLER_ASYNC(do_IRQ)
774774
set_irq_regs(old_regs);
775775
}
776776

777+
DEFINE_INTERRUPT_HANDLER_ASYNC(do_IRQ)
778+
{
779+
__do_IRQ(regs);
780+
}
781+
777782
static void *__init alloc_vm_stack(void)
778783
{
779784
return __vmalloc_node(THREAD_SIZE, THREAD_ALIGN, THREADINFO_GFP,

arch/powerpc/kernel/kprobes.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,8 @@ int kprobe_handler(struct pt_regs *regs)
292292
if (user_mode(regs))
293293
return 0;
294294

295-
if (!(regs->msr & MSR_IR) || !(regs->msr & MSR_DR))
295+
if (!IS_ENABLED(CONFIG_BOOKE) &&
296+
(!(regs->msr & MSR_IR) || !(regs->msr & MSR_DR)))
296297
return 0;
297298

298299
/*

arch/powerpc/kernel/sysfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,7 @@ static int __init topology_init(void)
11671167
* CPU. For instance, the boot cpu might never be valid
11681168
* for hotplugging.
11691169
*/
1170-
if (smp_ops->cpu_offline_self)
1170+
if (smp_ops && smp_ops->cpu_offline_self)
11711171
c->hotpluggable = 1;
11721172
#endif
11731173

arch/powerpc/kernel/time.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ DEFINE_INTERRUPT_HANDLER_ASYNC(timer_interrupt)
586586

587587
#if defined(CONFIG_PPC32) && defined(CONFIG_PPC_PMAC)
588588
if (atomic_read(&ppc_n_lost_interrupts) != 0)
589-
do_IRQ(regs);
589+
__do_IRQ(regs);
590590
#endif
591591

592592
old_regs = set_irq_regs(regs);

0 commit comments

Comments
 (0)