Skip to content

Commit 0e105f1

Browse files
mickflemmpalmer-dabbelt
authored andcommitted
riscv: use hart id instead of cpu id on machine_kexec
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]>
1 parent a11c07f commit 0e105f1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/riscv/kernel/machine_kexec.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,8 @@ machine_kexec(struct kimage *image)
169169
struct kimage_arch *internal = &image->arch;
170170
unsigned long jump_addr = (unsigned long) image->start;
171171
unsigned long first_ind_entry = (unsigned long) &image->head;
172-
unsigned long this_hart_id = raw_smp_processor_id();
172+
unsigned long this_cpu_id = smp_processor_id();
173+
unsigned long this_hart_id = cpuid_to_hartid_map(this_cpu_id);
173174
unsigned long fdt_addr = internal->fdt_addr;
174175
void *control_code_buffer = page_address(image->control_code_page);
175176
riscv_kexec_method kexec_method = NULL;

0 commit comments

Comments
 (0)