riscv: use hart id instead of cpu id on machine_kexec
authorNick Kossifidis <mick@ics.forth.gr>
Fri, 26 Nov 2021 18:04:10 +0000 (20:04 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jan 2022 10:02:50 +0000 (11:02 +0100)
commita2389e4f54e5acdde7e6266df0c1fed9bed70eec
tree0d280d8b398eb91e2c82ac41b4ffd4a7be2173ad
parentb9f3e769ecf57ce4ad098dd270ab452e072febfa
riscv: use hart id instead of cpu id on machine_kexec

commit 0e105f1d0037d677dff3c697d22f9551e6c39af8 upstream.

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: fba8a8674f68 ("RISC-V: Add kexec support")
Signed-off-by: Nick Kossifidis <mick@ics.forth.gr>
Cc: stable@vger.kernel.org
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/riscv/kernel/machine_kexec.c