linux/arch/riscv
Samuel Holland 7826c8f372 RISC-V: KVM: Fix inclusion of Smnpm in the guest ISA bitmap
The Smnpm extension requires special handling because the guest ISA
extension maps to a different extension (Ssnpm) on the host side.
commit 1851e78362 ("RISC-V: KVM: Allow Smnpm and Ssnpm extensions for
guests") missed that the vcpu->arch.isa bit is based only on the host
extension, so currently both KVM_RISCV_ISA_EXT_{SMNPM,SSNPM} map to
vcpu->arch.isa[RISCV_ISA_EXT_SSNPM]. This does not cause any problems
for the guest, because both extensions are force-enabled anyway when the
host supports Ssnpm, but prevents checking for (guest) Smnpm in the SBI
FWFT logic.

Redefine kvm_isa_ext_arr to look up the guest extension, since only the
guest -> host mapping is unambiguous. Factor out the logic for checking
for host support of an extension, so this special case only needs to be
handled in one place, and be explicit about which variables hold a host
vs a guest ISA extension.

Fixes: 1851e78362 ("RISC-V: KVM: Allow Smnpm and Ssnpm extensions for guests")
Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/20250111004702.2813013-2-samuel.holland@sifive.com
Signed-off-by: Anup Patel <anup@brainfault.org>
2025-07-28 22:27:45 +05:30
..
boot soc: sophgo devicetree updates for 6.16 2025-05-31 08:14:37 -07:00
configs RISC-V Patches for the 6.16 Merge Window, Part 1 2025-06-06 18:05:18 -07:00
crypto crypto: riscv/sha256 - implement library instead of shash 2025-05-05 18:20:43 +08:00
errata RISC-V: errata: Use medany for relocatable builds 2025-03-26 15:56:37 -07:00
include RISC-V: KVM: Delegate illegal instruction fault to VS mode 2025-07-28 22:27:40 +05:30
kernel riscv: cpu_ops_sbi: Use static array for boot_data 2025-06-30 06:58:11 +00:00
kvm RISC-V: KVM: Fix inclusion of Smnpm in the guest ISA bitmap 2025-07-28 22:27:45 +05:30
lib RISC-V Patches for the 6.16 Merge Window, Part 1 2025-06-06 18:05:18 -07:00
mm RISC-V Patches for the 6.16 Merge Window, Part 1 2025-06-06 18:05:18 -07:00
net bpf, riscv64: Skip redundant zext instruction after load-acquire 2025-05-09 10:05:27 -07:00
purgatory riscv/purgatory: 4B align purgatory_start 2025-04-01 07:07:12 +00:00
tools
Kbuild riscv: migrate to the generic rule for built-in DTB 2025-03-18 13:30:13 +00:00
Kconfig riscv: Require clang-17 or newer for kCFI 2025-06-30 06:58:11 +00:00
Kconfig.debug
Kconfig.errata riscv: Add ghostwrite vulnerability 2025-01-18 12:33:39 -08:00
Kconfig.socs riscv: Enable PM_GENERIC_DOMAINS for T-Head SoCs 2025-04-07 16:51:48 +01:00
Kconfig.vendor riscv: Add SiFive xsfvqmaccdod and xsfvqmaccqoq vendor extensions 2025-05-08 11:01:43 -07:00
Makefile riscv: Implement HAVE_DYNAMIC_FTRACE_WITH_CALL_OPS 2025-06-05 11:09:30 -07:00
Makefile.postlink kbuild: Create intermediate vmlinux build with relocations preserved 2025-03-17 00:29:50 +09:00