RISC-V: Use common riscv_cpuid_to_hartid_mask() for both SMP=y and SMP=n
authorSean Christopherson <seanjc@google.com>
Mon, 29 Nov 2021 21:43:42 +0000 (21:43 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jan 2022 10:02:50 +0000 (11:02 +0100)
commit1402857bf15ff820f970142d69cb2931d1e04718
tree1a8979ac644e78a77a17fe83606ed32d75c4eecc
parent6250ecf5ba42292b652cd01c9fcb2239010c5c44
RISC-V: Use common riscv_cpuid_to_hartid_mask() for both SMP=y and SMP=n

commit 869c70609248102f3a2e95a39b6233ff6ea2c932 upstream.

Use what is currently the SMP=y version of riscv_cpuid_to_hartid_mask()
for both SMP=y and SMP=n to fix a build failure with KVM=m and SMP=n due
to boot_cpu_hartid not being exported.  This also fixes a second bug
where the SMP=n version assumes the sole CPU in the system is in the
incoming mask, which may not hold true in kvm_riscv_vcpu_sbi_ecall() if
the KVM guest VM has multiple vCPUs (on a SMP=n system).

Fixes: 1ef46c231df4 ("RISC-V: Implement new SBI v0.2 extensions")
Reported-by: Adam Borowski <kilobyte@angband.pl>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Cc: stable@vger.kernel.org
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/riscv/include/asm/smp.h
arch/riscv/kernel/setup.c
arch/riscv/kernel/smp.c