linux/arch/riscv/kvm
Tan Chi 41e81f7e3e RISC-V: KVM: Fix HSM hart status error propagation
kvm_sbi_hsm_vcpu_get_status() returns SBI_ERR_INVALID_PARAM when
the requested hart does not exist. However, the HART_STATUS case
returns from the SBI handler without storing this error in
retdata->err_val.

As a result, a guest querying the status of a non-existent hart
observes SBI_SUCCESS instead of SBI_ERR_INVALID_PARAM.

Use the common SBI error handling path for HART_STATUS after
saving a valid hart state in retdata->out_val. This preserves
the returned error when kvm_sbi_hsm_vcpu_get_status() fails.

Fixes: bae0dfd74e ("RISC-V: KVM: Modify SBI extension handler to return SBI error code")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Tan Chi <tanchi25@mails.ucas.ac.cn>
Reviewed-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/20260914031146.446157-1-tanchi25@mails.ucas.ac.cn
Signed-off-by: Anup Patel <anup@brainfault.org>
History 2026-09-15 18:55:51 +05:30
..
aia.c KVM: RISC-V: Add CPU PM notifier for non-retention idle states 2026-08-12 22:07:07 +05:30
aia_aplic.c RISC-V: KVM: Account VM-scoped allocations to the VM cgroup 2026-08-01 14:14:06 +05:30
aia_device.c RISC-V: KVM: Reject overlapping AIA IMSIC address fields 2026-08-07 20:48:39 +05:30
aia_imsic.c RISC-V: KVM: Serialize IMSIC attributes with vCPU migration 2026-09-15 18:55:51 +05:30
gstage.c RISC-V: KVM: Improve dirty log clearing by skipping zero bits in mask 2026-08-07 18:44:46 +05:30
isa.c Arm: 2026-08-25 11:48:04 -07:00
Kconfig KVM: remove CONFIG_KVM_GENERIC_MMU_NOTIFIER 2026-02-28 15:31:35 +01:00
main.c Arm: 2026-08-25 11:48:04 -07:00
Makefile RISC-V: KVM: Factor-out VCPU config into separate sources 2026-04-03 17:48:40 +05:30
mmu.c RISC-V: KVM: Propagate interrupted G-stage faults 2026-09-15 18:55:51 +05:30
nacl.c KVM: riscv: Fix NACL hfence entry update order 2026-09-15 18:55:51 +05:30
tlb.c RISC-V: KVM: Guard HFENCE range loops against overflow 2026-08-08 11:29:41 +05:30
trace.h RISC-V: KVM: Add more arch-specific tracepoints 2026-07-30 13:13:05 +05:30
vcpu.c RISC-V: KVM: Fix the conversion between vsip and hvip 2026-09-15 18:55:51 +05:30
vcpu_config.c RISC-V: KVM: Add SBI extension validate callback 2026-07-30 11:38:58 +05:30
vcpu_exit.c RISC-V: KVM: Propagate interrupted G-stage faults 2026-09-15 18:55:51 +05:30
vcpu_fp.c riscv: Standardize extension capitalization 2026-08-07 19:24:33 -06:00
vcpu_insn.c RISC-V: KVM: Add more arch-specific tracepoints 2026-07-30 13:13:05 +05:30
vcpu_onereg.c RISC-V: KVM: Fix the conversion between vsip and hvip 2026-09-15 18:55:51 +05:30
vcpu_pmu.c RISC-V: KVM: Fix perf-backed counter accounting across stop and read 2026-09-15 18:55:51 +05:30
vcpu_sbi.c RISC-V: KVM: Reset the SBI extension when disable it 2026-07-30 11:38:58 +05:30
vcpu_sbi_base.c RISC-V: KVM: Add separate source for forwarded SBI extensions 2025-11-24 09:55:36 +05:30
vcpu_sbi_forward.c RISC-V: KVM: Add SBI MPXY extension support for Guest 2025-11-24 09:55:36 +05:30
vcpu_sbi_fwft.c RISC-V: KVM: Account VM-scoped allocations to the VM cgroup 2026-08-01 14:14:06 +05:30
vcpu_sbi_hsm.c RISC-V: KVM: Fix HSM hart status error propagation 2026-09-15 18:55:51 +05:30
vcpu_sbi_pmu.c RISC-V: KVM: Implement get event info function 2025-09-16 11:49:31 +05:30
vcpu_sbi_replace.c RISC-V: KVM: Add separate source for forwarded SBI extensions 2025-11-24 09:55:36 +05:30
vcpu_sbi_sta.c RISC-V: KVM: Fix invalid HVA warning in steal-time recording 2026-05-18 10:19:18 +05:30
vcpu_sbi_system.c RISC-V: KVM: Document a TOCTOU race in SBI system suspend handler 2026-06-04 11:12:40 +05:30
vcpu_sbi_v01.c RISC-V: KVM: Avoid one-word masks for SBI v0.1 all-harts 2026-08-08 11:40:39 +05:30
vcpu_switch.S RISC-V: KVM: Use SBI sync SRET call when available 2024-10-28 16:44:03 +05:30
vcpu_timer.c RISC-V: KVM: Synchronize hrtimer callback during teardown 2026-09-15 18:55:51 +05:30
vcpu_vector.c Arm: 2026-08-25 11:48:04 -07:00
vm.c RISC-V: KVM: Reuse KVM_CAP_VM_GPA_BITS to select HGATP.MODE 2026-04-04 13:48:21 +05:30
vmid.c RISC-V: KVM: Support runtime configuration for per-VM's HGATP mode 2026-04-04 13:21:21 +05:30