Skip to content

Commit f691838

Browse files
committed
Merge tag 'powerpc-4.9-5' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Pull powerpc fixes from Michael Ellerman: "Fixes marked for stable: - fix system reset interrupt winkle wakeups - fix setting of AIL in hypervisor mode Fixes for code merged this cycle: - fix exception vector build with 2.23 era binutils - fix missing update of HID register on secondary CPUs Other: - fix missing pr_cont()s - invalidate ERAT on tlbiel for POWER9 DD1" * tag 'powerpc-4.9-5' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: powerpc/mm: Fix missing update of HID register on secondary CPUs powerpc/mm/radix: Invalidate ERAT on tlbiel for POWER9 DD1 powerpc/64: Fix setting of AIL in hypervisor mode powerpc/oops: Fix missing pr_cont()s in instruction dump powerpc/oops: Fix missing pr_cont()s in show_regs() powerpc/oops: Fix missing pr_cont()s in print_msr_bits() et. al. powerpc/oops: Fix missing pr_cont()s in show_stack() powerpc: Fix exception vector build with 2.23 era binutils powerpc/64s: Fix system reset interrupt winkle wakeups
2 parents 384b0dc + cac4a18 commit f691838

8 files changed

Lines changed: 68 additions & 33 deletions

File tree

arch/powerpc/include/asm/exception-64s.h

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
*/
9292
#define LOAD_HANDLER(reg, label) \
9393
ld reg,PACAKBASE(r13); /* get high part of &label */ \
94-
ori reg,reg,(FIXED_SYMBOL_ABS_ADDR(label))@l;
94+
ori reg,reg,FIXED_SYMBOL_ABS_ADDR(label);
9595

9696
#define __LOAD_HANDLER(reg, label) \
9797
ld reg,PACAKBASE(r13); \
@@ -158,14 +158,17 @@ BEGIN_FTR_SECTION_NESTED(943) \
158158
std ra,offset(r13); \
159159
END_FTR_SECTION_NESTED(ftr,ftr,943)
160160

161-
#define EXCEPTION_PROLOG_0(area) \
162-
GET_PACA(r13); \
161+
#define EXCEPTION_PROLOG_0_PACA(area) \
163162
std r9,area+EX_R9(r13); /* save r9 */ \
164163
OPT_GET_SPR(r9, SPRN_PPR, CPU_FTR_HAS_PPR); \
165164
HMT_MEDIUM; \
166165
std r10,area+EX_R10(r13); /* save r10 - r12 */ \
167166
OPT_GET_SPR(r10, SPRN_CFAR, CPU_FTR_CFAR)
168167

168+
#define EXCEPTION_PROLOG_0(area) \
169+
GET_PACA(r13); \
170+
EXCEPTION_PROLOG_0_PACA(area)
171+
169172
#define __EXCEPTION_PROLOG_1(area, extra, vec) \
170173
OPT_SAVE_REG_TO_PACA(area+EX_PPR, r9, CPU_FTR_HAS_PPR); \
171174
OPT_SAVE_REG_TO_PACA(area+EX_CFAR, r10, CPU_FTR_CFAR); \
@@ -196,6 +199,12 @@ END_FTR_SECTION_NESTED(ftr,ftr,943)
196199
EXCEPTION_PROLOG_1(area, extra, vec); \
197200
EXCEPTION_PROLOG_PSERIES_1(label, h);
198201

202+
/* Have the PACA in r13 already */
203+
#define EXCEPTION_PROLOG_PSERIES_PACA(area, label, h, extra, vec) \
204+
EXCEPTION_PROLOG_0_PACA(area); \
205+
EXCEPTION_PROLOG_1(area, extra, vec); \
206+
EXCEPTION_PROLOG_PSERIES_1(label, h);
207+
199208
#define __KVMTEST(h, n) \
200209
lbz r10,HSTATE_IN_GUEST(r13); \
201210
cmpwi r10,0; \

arch/powerpc/include/asm/ppc-opcode.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,5 +460,6 @@
460460

461461
#define PPC_SLBIA(IH) stringify_in_c(.long PPC_INST_SLBIA | \
462462
((IH & 0x7) << 21))
463+
#define PPC_INVALIDATE_ERAT PPC_SLBIA(7)
463464

464465
#endif /* _ASM_POWERPC_PPC_OPCODE_H */

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,19 @@ EXC_VIRT_NONE(0x4000, 0x4100)
116116

117117
EXC_REAL_BEGIN(system_reset, 0x100, 0x200)
118118
SET_SCRATCH0(r13)
119-
EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, system_reset_common, EXC_STD,
119+
GET_PACA(r13)
120+
clrrdi r13,r13,1 /* Last bit of HSPRG0 is set if waking from winkle */
121+
EXCEPTION_PROLOG_PSERIES_PACA(PACA_EXGEN, system_reset_common, EXC_STD,
120122
IDLETEST, 0x100)
121123

122124
EXC_REAL_END(system_reset, 0x100, 0x200)
123125
EXC_VIRT_NONE(0x4100, 0x4200)
124126

125127
#ifdef CONFIG_PPC_P7_NAP
126128
EXC_COMMON_BEGIN(system_reset_idle_common)
129+
BEGIN_FTR_SECTION
130+
GET_PACA(r13) /* Restore HSPRG0 to get the winkle bit in r13 */
131+
END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_300)
127132
bl pnv_restore_hyp_resource
128133

129134
li r0,PNV_THREAD_RUNNING
@@ -169,7 +174,7 @@ EXC_REAL_BEGIN(machine_check, 0x200, 0x300)
169174
SET_SCRATCH0(r13) /* save r13 */
170175
/*
171176
* Running native on arch 2.06 or later, we may wakeup from winkle
172-
* inside machine check. If yes, then last bit of HSPGR0 would be set
177+
* inside machine check. If yes, then last bit of HSPRG0 would be set
173178
* to 1. Hence clear it unconditionally.
174179
*/
175180
GET_PACA(r13)
@@ -388,7 +393,7 @@ EXC_COMMON_BEGIN(machine_check_handle_early)
388393
/*
389394
* Go back to winkle. Please note that this thread was woken up in
390395
* machine check from winkle and have not restored the per-subcore
391-
* state. Hence before going back to winkle, set last bit of HSPGR0
396+
* state. Hence before going back to winkle, set last bit of HSPRG0
392397
* to 1. This will make sure that if this thread gets woken up
393398
* again at reset vector 0x100 then it will get chance to restore
394399
* the subcore state.

arch/powerpc/kernel/process.c

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,7 +1215,7 @@ static void show_instructions(struct pt_regs *regs)
12151215
int instr;
12161216

12171217
if (!(i % 8))
1218-
printk("\n");
1218+
pr_cont("\n");
12191219

12201220
#if !defined(CONFIG_BOOKE)
12211221
/* If executing with the IMMU off, adjust pc rather
@@ -1227,18 +1227,18 @@ static void show_instructions(struct pt_regs *regs)
12271227

12281228
if (!__kernel_text_address(pc) ||
12291229
probe_kernel_address((unsigned int __user *)pc, instr)) {
1230-
printk(KERN_CONT "XXXXXXXX ");
1230+
pr_cont("XXXXXXXX ");
12311231
} else {
12321232
if (regs->nip == pc)
1233-
printk(KERN_CONT "<%08x> ", instr);
1233+
pr_cont("<%08x> ", instr);
12341234
else
1235-
printk(KERN_CONT "%08x ", instr);
1235+
pr_cont("%08x ", instr);
12361236
}
12371237

12381238
pc += sizeof(int);
12391239
}
12401240

1241-
printk("\n");
1241+
pr_cont("\n");
12421242
}
12431243

12441244
struct regbit {
@@ -1282,7 +1282,7 @@ static void print_bits(unsigned long val, struct regbit *bits, const char *sep)
12821282

12831283
for (; bits->bit; ++bits)
12841284
if (val & bits->bit) {
1285-
printk("%s%s", s, bits->name);
1285+
pr_cont("%s%s", s, bits->name);
12861286
s = sep;
12871287
}
12881288
}
@@ -1305,9 +1305,9 @@ static void print_tm_bits(unsigned long val)
13051305
* T: Transactional (bit 34)
13061306
*/
13071307
if (val & (MSR_TM | MSR_TS_S | MSR_TS_T)) {
1308-
printk(",TM[");
1308+
pr_cont(",TM[");
13091309
print_bits(val, msr_tm_bits, "");
1310-
printk("]");
1310+
pr_cont("]");
13111311
}
13121312
}
13131313
#else
@@ -1316,10 +1316,10 @@ static void print_tm_bits(unsigned long val) {}
13161316

13171317
static void print_msr_bits(unsigned long val)
13181318
{
1319-
printk("<");
1319+
pr_cont("<");
13201320
print_bits(val, msr_bits, ",");
13211321
print_tm_bits(val);
1322-
printk(">");
1322+
pr_cont(">");
13231323
}
13241324

13251325
#ifdef CONFIG_PPC64
@@ -1347,29 +1347,29 @@ void show_regs(struct pt_regs * regs)
13471347
printk(" CR: %08lx XER: %08lx\n", regs->ccr, regs->xer);
13481348
trap = TRAP(regs);
13491349
if ((regs->trap != 0xc00) && cpu_has_feature(CPU_FTR_CFAR))
1350-
printk("CFAR: "REG" ", regs->orig_gpr3);
1350+
pr_cont("CFAR: "REG" ", regs->orig_gpr3);
13511351
if (trap == 0x200 || trap == 0x300 || trap == 0x600)
13521352
#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
1353-
printk("DEAR: "REG" ESR: "REG" ", regs->dar, regs->dsisr);
1353+
pr_cont("DEAR: "REG" ESR: "REG" ", regs->dar, regs->dsisr);
13541354
#else
1355-
printk("DAR: "REG" DSISR: %08lx ", regs->dar, regs->dsisr);
1355+
pr_cont("DAR: "REG" DSISR: %08lx ", regs->dar, regs->dsisr);
13561356
#endif
13571357
#ifdef CONFIG_PPC64
1358-
printk("SOFTE: %ld ", regs->softe);
1358+
pr_cont("SOFTE: %ld ", regs->softe);
13591359
#endif
13601360
#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
13611361
if (MSR_TM_ACTIVE(regs->msr))
1362-
printk("\nPACATMSCRATCH: %016llx ", get_paca()->tm_scratch);
1362+
pr_cont("\nPACATMSCRATCH: %016llx ", get_paca()->tm_scratch);
13631363
#endif
13641364

13651365
for (i = 0; i < 32; i++) {
13661366
if ((i % REGS_PER_LINE) == 0)
1367-
printk("\nGPR%02d: ", i);
1368-
printk(REG " ", regs->gpr[i]);
1367+
pr_cont("\nGPR%02d: ", i);
1368+
pr_cont(REG " ", regs->gpr[i]);
13691369
if (i == LAST_VOLATILE && !FULL_REGS(regs))
13701370
break;
13711371
}
1372-
printk("\n");
1372+
pr_cont("\n");
13731373
#ifdef CONFIG_KALLSYMS
13741374
/*
13751375
* Lookup NIP late so we have the best change of getting the
@@ -1900,14 +1900,14 @@ void show_stack(struct task_struct *tsk, unsigned long *stack)
19001900
printk("["REG"] ["REG"] %pS", sp, ip, (void *)ip);
19011901
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
19021902
if ((ip == rth) && curr_frame >= 0) {
1903-
printk(" (%pS)",
1903+
pr_cont(" (%pS)",
19041904
(void *)current->ret_stack[curr_frame].ret);
19051905
curr_frame--;
19061906
}
19071907
#endif
19081908
if (firstframe)
1909-
printk(" (unreliable)");
1910-
printk("\n");
1909+
pr_cont(" (unreliable)");
1910+
pr_cont("\n");
19111911
}
19121912
firstframe = 0;
19131913

arch/powerpc/kernel/setup_64.c

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -226,17 +226,25 @@ static void __init configure_exceptions(void)
226226
if (firmware_has_feature(FW_FEATURE_OPAL))
227227
opal_configure_cores();
228228

229-
/* Enable AIL if supported, and we are in hypervisor mode */
230-
if (early_cpu_has_feature(CPU_FTR_HVMODE) &&
231-
early_cpu_has_feature(CPU_FTR_ARCH_207S)) {
232-
unsigned long lpcr = mfspr(SPRN_LPCR);
233-
mtspr(SPRN_LPCR, lpcr | LPCR_AIL_3);
234-
}
229+
/* AIL on native is done in cpu_ready_for_interrupts() */
235230
}
236231
}
237232

238233
static void cpu_ready_for_interrupts(void)
239234
{
235+
/*
236+
* Enable AIL if supported, and we are in hypervisor mode. This
237+
* is called once for every processor.
238+
*
239+
* If we are not in hypervisor mode the job is done once for
240+
* the whole partition in configure_exceptions().
241+
*/
242+
if (early_cpu_has_feature(CPU_FTR_HVMODE) &&
243+
early_cpu_has_feature(CPU_FTR_ARCH_207S)) {
244+
unsigned long lpcr = mfspr(SPRN_LPCR);
245+
mtspr(SPRN_LPCR, lpcr | LPCR_AIL_3);
246+
}
247+
240248
/* Set IR and DR in PACA MSR */
241249
get_paca()->kernel_msr = MSR_KERNEL;
242250
}

arch/powerpc/mm/hash_utils_64.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,6 +1029,10 @@ void hash__early_init_mmu_secondary(void)
10291029
{
10301030
/* Initialize hash table for that CPU */
10311031
if (!firmware_has_feature(FW_FEATURE_LPAR)) {
1032+
1033+
if (cpu_has_feature(CPU_FTR_POWER9_DD1))
1034+
update_hid_for_hash();
1035+
10321036
if (!cpu_has_feature(CPU_FTR_ARCH_300))
10331037
mtspr(SPRN_SDR1, _SDR1);
10341038
else

arch/powerpc/mm/pgtable-radix.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,10 @@ void radix__early_init_mmu_secondary(void)
388388
* update partition table control register and UPRT
389389
*/
390390
if (!firmware_has_feature(FW_FEATURE_LPAR)) {
391+
392+
if (cpu_has_feature(CPU_FTR_POWER9_DD1))
393+
update_hid_for_radix();
394+
391395
lpcr = mfspr(SPRN_LPCR);
392396
mtspr(SPRN_LPCR, lpcr | LPCR_UPRT | LPCR_HR);
393397

arch/powerpc/mm/tlb-radix.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ static inline void _tlbiel_pid(unsigned long pid, unsigned long ric)
5050
for (set = 0; set < POWER9_TLB_SETS_RADIX ; set++) {
5151
__tlbiel_pid(pid, set, ric);
5252
}
53+
if (cpu_has_feature(CPU_FTR_POWER9_DD1))
54+
asm volatile(PPC_INVALIDATE_ERAT : : :"memory");
5355
return;
5456
}
5557

@@ -83,6 +85,8 @@ static inline void _tlbiel_va(unsigned long va, unsigned long pid,
8385
asm volatile(PPC_TLBIEL(%0, %4, %3, %2, %1)
8486
: : "r"(rb), "i"(r), "i"(prs), "i"(ric), "r"(rs) : "memory");
8587
asm volatile("ptesync": : :"memory");
88+
if (cpu_has_feature(CPU_FTR_POWER9_DD1))
89+
asm volatile(PPC_INVALIDATE_ERAT : : :"memory");
8690
}
8791

8892
static inline void _tlbie_va(unsigned long va, unsigned long pid,

0 commit comments

Comments
 (0)