Skip to content

Commit

Permalink
riscv: use hart id instead of cpu id on machine_kexec
Browse files Browse the repository at this point in the history
raw_smp_processor_id() doesn't return the hart id as stated in
arch/riscv/include/asm/smp.h, use smp_processor_id() instead
to get the cpu id, and cpuid_to_hartid_map() to pass the hart id
to the next kernel. This fixes kexec on HiFive Unleashed/Unmatched
where cpu ids and hart ids don't match (on qemu-virt they match).

Fixes: fba8a86 ("RISC-V: Add kexec support")
Signed-off-by: Nick Kossifidis <[email protected]>
Cc: [email protected]
Signed-off-by: Palmer Dabbelt <[email protected]>
  • Loading branch information
mickflemm authored and palmer-dabbelt committed Jan 9, 2022
1 parent a11c07f commit 0e105f1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion arch/riscv/kernel/machine_kexec.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ 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_hart_id = raw_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);
riscv_kexec_method kexec_method = NULL;
Expand Down

0 comments on commit 0e105f1

Please sign in to comment.