summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorAndrew Jones <ajones@ventanamicro.com>2025-02-17 09:45:09 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-03-07 18:27:04 +0100
commit0be8eabac35f81b454389193705903e715993c7e (patch)
tree086f4b1260d8b149e727dd1c2cf9001423762004 /arch
parentce5f6c8d5d4e07a73bbc2be868d1c53c5c79e0e3 (diff)
downloadlinux-0be8eabac35f81b454389193705903e715993c7e.tar.gz
linux-0be8eabac35f81b454389193705903e715993c7e.tar.bz2
linux-0be8eabac35f81b454389193705903e715993c7e.zip
riscv: KVM: Fix hart suspend_type use
[ Upstream commit e3219b0c491f2aa0e0b200a39d3352ab05cdda96 ] The spec says suspend_type is 32 bits wide and "In case the data is defined as 32bit wide, higher privilege software must ensure that it only uses 32 bit data." Mask off upper bits of suspend_type before using it. Fixes: 763c8bed8c05 ("RISC-V: KVM: Implement SBI HSM suspend call") Signed-off-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org> Link: https://lore.kernel.org/r/20250217084506.18763-9-ajones@ventanamicro.com Signed-off-by: Anup Patel <anup@brainfault.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/riscv/kvm/vcpu_sbi_hsm.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/riscv/kvm/vcpu_sbi_hsm.c b/arch/riscv/kvm/vcpu_sbi_hsm.c
index 13a35eb77e8e..3070bb31745d 100644
--- a/arch/riscv/kvm/vcpu_sbi_hsm.c
+++ b/arch/riscv/kvm/vcpu_sbi_hsm.c
@@ -9,6 +9,7 @@
#include <linux/errno.h>
#include <linux/err.h>
#include <linux/kvm_host.h>
+#include <linux/wordpart.h>
#include <asm/sbi.h>
#include <asm/kvm_vcpu_sbi.h>
@@ -109,7 +110,7 @@ static int kvm_sbi_ext_hsm_handler(struct kvm_vcpu *vcpu, struct kvm_run *run,
}
return 0;
case SBI_EXT_HSM_HART_SUSPEND:
- switch (cp->a0) {
+ switch (lower_32_bits(cp->a0)) {
case SBI_HSM_SUSPEND_RET_DEFAULT:
kvm_riscv_vcpu_wfi(vcpu);
break;