RISC-V: fixups to work with crash tool
A handful of fixes to our kexec/crash kernel support that allow crash tool to function. Link: https://lore.kernel.org/r/mhng-f5fdaa37-e99a-4214-a297-ec81f0fed0c1@palmer-mbp2014 * commit 'f9293ad46d8ba9909187a37b7215324420ad4596': RISC-V: Add modules to virtual kernel memory layout dump RISC-V: Fixup schedule out issue in machine_crash_shutdown() RISC-V: Fixup get incorrect user mode PC for kernel mode regs RISC-V: kexec: Fixup use of smp_processor_id() in preemptible context
This commit is contained in:
commit
da06cc5bb6
|
@ -44,7 +44,7 @@ SYM_CODE_START(riscv_crash_save_regs)
|
|||
REG_S t6, PT_T6(a0) /* x31 */
|
||||
|
||||
csrr t1, CSR_STATUS
|
||||
csrr t2, CSR_EPC
|
||||
auipc t2, 0x0
|
||||
csrr t3, CSR_TVAL
|
||||
csrr t4, CSR_CAUSE
|
||||
|
||||
|
|
|
@ -138,19 +138,37 @@ void machine_shutdown(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
/* Override the weak function in kernel/panic.c */
|
||||
void crash_smp_send_stop(void)
|
||||
{
|
||||
static int cpus_stopped;
|
||||
|
||||
/*
|
||||
* This function can be called twice in panic path, but obviously
|
||||
* we execute this only once.
|
||||
*/
|
||||
if (cpus_stopped)
|
||||
return;
|
||||
|
||||
smp_send_stop();
|
||||
cpus_stopped = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* machine_crash_shutdown - Prepare to kexec after a kernel crash
|
||||
*
|
||||
* This function is called by crash_kexec just before machine_kexec
|
||||
* below and its goal is similar to machine_shutdown, but in case of
|
||||
* a kernel crash. Since we don't handle such cases yet, this function
|
||||
* is empty.
|
||||
* and its goal is to shutdown non-crashing cpus and save registers.
|
||||
*/
|
||||
void
|
||||
machine_crash_shutdown(struct pt_regs *regs)
|
||||
{
|
||||
local_irq_disable();
|
||||
|
||||
/* shutdown non-crashing cpus */
|
||||
crash_smp_send_stop();
|
||||
|
||||
crash_save_cpu(regs, smp_processor_id());
|
||||
machine_shutdown();
|
||||
pr_info("Starting crashdump kernel...\n");
|
||||
}
|
||||
|
||||
|
@ -171,7 +189,7 @@ machine_kexec(struct kimage *image)
|
|||
struct kimage_arch *internal = &image->arch;
|
||||
unsigned long jump_addr = (unsigned long) image->start;
|
||||
unsigned long first_ind_entry = (unsigned long) &image->head;
|
||||
unsigned long this_cpu_id = smp_processor_id();
|
||||
unsigned long this_cpu_id = __smp_processor_id();
|
||||
unsigned long this_hart_id = cpuid_to_hartid_map(this_cpu_id);
|
||||
unsigned long fdt_addr = internal->fdt_addr;
|
||||
void *control_code_buffer = page_address(image->control_code_page);
|
||||
|
|
|
@ -135,6 +135,10 @@ static void __init print_vm_layout(void)
|
|||
(unsigned long)VMEMMAP_END);
|
||||
print_ml("vmalloc", (unsigned long)VMALLOC_START,
|
||||
(unsigned long)VMALLOC_END);
|
||||
#ifdef CONFIG_64BIT
|
||||
print_ml("modules", (unsigned long)MODULES_VADDR,
|
||||
(unsigned long)MODULES_END);
|
||||
#endif
|
||||
print_ml("lowmem", (unsigned long)PAGE_OFFSET,
|
||||
(unsigned long)high_memory);
|
||||
if (IS_ENABLED(CONFIG_64BIT)) {
|
||||
|
|
Loading…
Reference in New Issue