Commit d90696ed authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'powerpc-4.15-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux

Pull powerpc fixes from Michael Ellerman:

 "One notable fix for kexec on Power9, where we were not clearing MMU
  PID properly which sometimes leads to hangs. Finally debugged to a
  root cause by Nick.

  A revert of a patch which tried to rework our panic handling to get
  more output on the console, but inadvertently broke reporting the
  panic to the hypervisor, which apparently people care about.

  Then a fix for an oops in the PMU code, and finally some s/%p/%px/ in
  xmon.

  Thanks to: David Gibson, Nicholas Piggin, Ravi Bangoria"

* tag 'powerpc-4.15-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
  powerpc/xmon: Don't print hashed pointers in xmon
  powerpc/64s: Initialize ISAv3 MMU registers before setting partition table
  Revert "powerpc: Do not call ppc_md.panic in fadump panic notifier"
  powerpc/perf: Fix oops when grouping different pmu events
parents c6b3e969 d8104182
...@@ -76,6 +76,7 @@ struct machdep_calls { ...@@ -76,6 +76,7 @@ struct machdep_calls {
void __noreturn (*restart)(char *cmd); void __noreturn (*restart)(char *cmd);
void __noreturn (*halt)(void); void __noreturn (*halt)(void);
void (*panic)(char *str);
void (*cpu_die)(void); void (*cpu_die)(void);
long (*time_init)(void); /* Optional, may be NULL */ long (*time_init)(void); /* Optional, may be NULL */
......
...@@ -24,6 +24,7 @@ extern void reloc_got2(unsigned long); ...@@ -24,6 +24,7 @@ extern void reloc_got2(unsigned long);
void check_for_initrd(void); void check_for_initrd(void);
void initmem_init(void); void initmem_init(void);
void setup_panic(void);
#define ARCH_PANIC_TIMEOUT 180 #define ARCH_PANIC_TIMEOUT 180
#ifdef CONFIG_PPC_PSERIES #ifdef CONFIG_PPC_PSERIES
......
...@@ -102,6 +102,7 @@ _GLOBAL(__setup_cpu_power9) ...@@ -102,6 +102,7 @@ _GLOBAL(__setup_cpu_power9)
li r0,0 li r0,0
mtspr SPRN_PSSCR,r0 mtspr SPRN_PSSCR,r0
mtspr SPRN_LPID,r0 mtspr SPRN_LPID,r0
mtspr SPRN_PID,r0
mfspr r3,SPRN_LPCR mfspr r3,SPRN_LPCR
LOAD_REG_IMMEDIATE(r4, LPCR_PECEDH | LPCR_PECE_HVEE | LPCR_HVICE | LPCR_HEIC) LOAD_REG_IMMEDIATE(r4, LPCR_PECEDH | LPCR_PECE_HVEE | LPCR_HVICE | LPCR_HEIC)
or r3, r3, r4 or r3, r3, r4
...@@ -126,6 +127,7 @@ _GLOBAL(__restore_cpu_power9) ...@@ -126,6 +127,7 @@ _GLOBAL(__restore_cpu_power9)
li r0,0 li r0,0
mtspr SPRN_PSSCR,r0 mtspr SPRN_PSSCR,r0
mtspr SPRN_LPID,r0 mtspr SPRN_LPID,r0
mtspr SPRN_PID,r0
mfspr r3,SPRN_LPCR mfspr r3,SPRN_LPCR
LOAD_REG_IMMEDIATE(r4, LPCR_PECEDH | LPCR_PECE_HVEE | LPCR_HVICE | LPCR_HEIC) LOAD_REG_IMMEDIATE(r4, LPCR_PECEDH | LPCR_PECE_HVEE | LPCR_HVICE | LPCR_HEIC)
or r3, r3, r4 or r3, r3, r4
......
...@@ -1462,25 +1462,6 @@ static void fadump_init_files(void) ...@@ -1462,25 +1462,6 @@ static void fadump_init_files(void)
return; return;
} }
static int fadump_panic_event(struct notifier_block *this,
unsigned long event, void *ptr)
{
/*
* If firmware-assisted dump has been registered then trigger
* firmware-assisted dump and let firmware handle everything
* else. If this returns, then fadump was not registered, so
* go through the rest of the panic path.
*/
crash_fadump(NULL, ptr);
return NOTIFY_DONE;
}
static struct notifier_block fadump_panic_block = {
.notifier_call = fadump_panic_event,
.priority = INT_MIN /* may not return; must be done last */
};
/* /*
* Prepare for firmware-assisted dump. * Prepare for firmware-assisted dump.
*/ */
...@@ -1513,9 +1494,6 @@ int __init setup_fadump(void) ...@@ -1513,9 +1494,6 @@ int __init setup_fadump(void)
init_fadump_mem_struct(&fdm, fw_dump.reserve_dump_area_start); init_fadump_mem_struct(&fdm, fw_dump.reserve_dump_area_start);
fadump_init_files(); fadump_init_files();
atomic_notifier_chain_register(&panic_notifier_list,
&fadump_panic_block);
return 1; return 1;
} }
subsys_initcall(setup_fadump); subsys_initcall(setup_fadump);
...@@ -704,6 +704,30 @@ int check_legacy_ioport(unsigned long base_port) ...@@ -704,6 +704,30 @@ int check_legacy_ioport(unsigned long base_port)
} }
EXPORT_SYMBOL(check_legacy_ioport); EXPORT_SYMBOL(check_legacy_ioport);
static int ppc_panic_event(struct notifier_block *this,
unsigned long event, void *ptr)
{
/*
* If firmware-assisted dump has been registered then trigger
* firmware-assisted dump and let firmware handle everything else.
*/
crash_fadump(NULL, ptr);
ppc_md.panic(ptr); /* May not return */
return NOTIFY_DONE;
}
static struct notifier_block ppc_panic_block = {
.notifier_call = ppc_panic_event,
.priority = INT_MIN /* may not return; must be done last */
};
void __init setup_panic(void)
{
if (!ppc_md.panic)
return;
atomic_notifier_chain_register(&panic_notifier_list, &ppc_panic_block);
}
#ifdef CONFIG_CHECK_CACHE_COHERENCY #ifdef CONFIG_CHECK_CACHE_COHERENCY
/* /*
* For platforms that have configurable cache-coherency. This function * For platforms that have configurable cache-coherency. This function
...@@ -848,6 +872,9 @@ void __init setup_arch(char **cmdline_p) ...@@ -848,6 +872,9 @@ void __init setup_arch(char **cmdline_p)
/* Probe the machine type, establish ppc_md. */ /* Probe the machine type, establish ppc_md. */
probe_machine(); probe_machine();
/* Setup panic notifier if requested by the platform. */
setup_panic();
/* /*
* Configure ppc_md.power_save (ppc32 only, 64-bit machines do * Configure ppc_md.power_save (ppc32 only, 64-bit machines do
* it from their respective probe() function. * it from their respective probe() function.
......
...@@ -1415,7 +1415,7 @@ static int collect_events(struct perf_event *group, int max_count, ...@@ -1415,7 +1415,7 @@ static int collect_events(struct perf_event *group, int max_count,
int n = 0; int n = 0;
struct perf_event *event; struct perf_event *event;
if (!is_software_event(group)) { if (group->pmu->task_ctx_nr == perf_hw_context) {
if (n >= max_count) if (n >= max_count)
return -1; return -1;
ctrs[n] = group; ctrs[n] = group;
...@@ -1423,7 +1423,7 @@ static int collect_events(struct perf_event *group, int max_count, ...@@ -1423,7 +1423,7 @@ static int collect_events(struct perf_event *group, int max_count,
events[n++] = group->hw.config; events[n++] = group->hw.config;
} }
list_for_each_entry(event, &group->sibling_list, group_entry) { list_for_each_entry(event, &group->sibling_list, group_entry) {
if (!is_software_event(event) && if (event->pmu->task_ctx_nr == perf_hw_context &&
event->state != PERF_EVENT_STATE_OFF) { event->state != PERF_EVENT_STATE_OFF) {
if (n >= max_count) if (n >= max_count)
return -1; return -1;
......
...@@ -104,6 +104,20 @@ static void __noreturn ps3_halt(void) ...@@ -104,6 +104,20 @@ static void __noreturn ps3_halt(void)
ps3_sys_manager_halt(); /* never returns */ ps3_sys_manager_halt(); /* never returns */
} }
static void ps3_panic(char *str)
{
DBG("%s:%d %s\n", __func__, __LINE__, str);
smp_send_stop();
printk("\n");
printk(" System does not reboot automatically.\n");
printk(" Please press POWER button.\n");
printk("\n");
while(1)
lv1_pause(1);
}
#if defined(CONFIG_FB_PS3) || defined(CONFIG_FB_PS3_MODULE) || \ #if defined(CONFIG_FB_PS3) || defined(CONFIG_FB_PS3_MODULE) || \
defined(CONFIG_PS3_FLASH) || defined(CONFIG_PS3_FLASH_MODULE) defined(CONFIG_PS3_FLASH) || defined(CONFIG_PS3_FLASH_MODULE)
static void __init prealloc(struct ps3_prealloc *p) static void __init prealloc(struct ps3_prealloc *p)
...@@ -255,6 +269,7 @@ define_machine(ps3) { ...@@ -255,6 +269,7 @@ define_machine(ps3) {
.probe = ps3_probe, .probe = ps3_probe,
.setup_arch = ps3_setup_arch, .setup_arch = ps3_setup_arch,
.init_IRQ = ps3_init_IRQ, .init_IRQ = ps3_init_IRQ,
.panic = ps3_panic,
.get_boot_time = ps3_get_boot_time, .get_boot_time = ps3_get_boot_time,
.set_dabr = ps3_set_dabr, .set_dabr = ps3_set_dabr,
.calibrate_decr = ps3_calibrate_decr, .calibrate_decr = ps3_calibrate_decr,
......
...@@ -726,6 +726,7 @@ define_machine(pseries) { ...@@ -726,6 +726,7 @@ define_machine(pseries) {
.pcibios_fixup = pSeries_final_fixup, .pcibios_fixup = pSeries_final_fixup,
.restart = rtas_restart, .restart = rtas_restart,
.halt = rtas_halt, .halt = rtas_halt,
.panic = rtas_os_term,
.get_boot_time = rtas_get_boot_time, .get_boot_time = rtas_get_boot_time,
.get_rtc_time = rtas_get_rtc_time, .get_rtc_time = rtas_get_rtc_time,
.set_rtc_time = rtas_set_rtc_time, .set_rtc_time = rtas_set_rtc_time,
......
...@@ -1590,7 +1590,7 @@ static void print_bug_trap(struct pt_regs *regs) ...@@ -1590,7 +1590,7 @@ static void print_bug_trap(struct pt_regs *regs)
printf("kernel BUG at %s:%u!\n", printf("kernel BUG at %s:%u!\n",
bug->file, bug->line); bug->file, bug->line);
#else #else
printf("kernel BUG at %p!\n", (void *)bug->bug_addr); printf("kernel BUG at %px!\n", (void *)bug->bug_addr);
#endif #endif
#endif /* CONFIG_BUG */ #endif /* CONFIG_BUG */
} }
...@@ -2329,7 +2329,7 @@ static void dump_one_paca(int cpu) ...@@ -2329,7 +2329,7 @@ static void dump_one_paca(int cpu)
p = &paca[cpu]; p = &paca[cpu];
printf("paca for cpu 0x%x @ %p:\n", cpu, p); printf("paca for cpu 0x%x @ %px:\n", cpu, p);
printf(" %-*s = %s\n", 20, "possible", cpu_possible(cpu) ? "yes" : "no"); printf(" %-*s = %s\n", 20, "possible", cpu_possible(cpu) ? "yes" : "no");
printf(" %-*s = %s\n", 20, "present", cpu_present(cpu) ? "yes" : "no"); printf(" %-*s = %s\n", 20, "present", cpu_present(cpu) ? "yes" : "no");
...@@ -2945,7 +2945,7 @@ static void show_task(struct task_struct *tsk) ...@@ -2945,7 +2945,7 @@ static void show_task(struct task_struct *tsk)
(tsk->exit_state & EXIT_DEAD) ? 'E' : (tsk->exit_state & EXIT_DEAD) ? 'E' :
(tsk->state & TASK_INTERRUPTIBLE) ? 'S' : '?'; (tsk->state & TASK_INTERRUPTIBLE) ? 'S' : '?';
printf("%p %016lx %6d %6d %c %2d %s\n", tsk, printf("%px %016lx %6d %6d %c %2d %s\n", tsk,
tsk->thread.ksp, tsk->thread.ksp,
tsk->pid, tsk->parent->pid, tsk->pid, tsk->parent->pid,
state, task_thread_info(tsk)->cpu, state, task_thread_info(tsk)->cpu,
...@@ -2988,7 +2988,7 @@ static void show_pte(unsigned long addr) ...@@ -2988,7 +2988,7 @@ static void show_pte(unsigned long addr)
if (setjmp(bus_error_jmp) != 0) { if (setjmp(bus_error_jmp) != 0) {
catch_memory_errors = 0; catch_memory_errors = 0;
printf("*** Error dumping pte for task %p\n", tsk); printf("*** Error dumping pte for task %px\n", tsk);
return; return;
} }
...@@ -3074,7 +3074,7 @@ static void show_tasks(void) ...@@ -3074,7 +3074,7 @@ static void show_tasks(void)
if (setjmp(bus_error_jmp) != 0) { if (setjmp(bus_error_jmp) != 0) {
catch_memory_errors = 0; catch_memory_errors = 0;
printf("*** Error dumping task %p\n", tsk); printf("*** Error dumping task %px\n", tsk);
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment