RISC-V: KVM: Allow Smnpm and Ssnpm extensions for guests
authorSamuel Holland <samuel.holland@sifive.com>
Wed, 16 Oct 2024 20:27:50 +0000 (13:27 -0700)
committerPalmer Dabbelt <palmer@rivosinc.com>
Thu, 24 Oct 2024 21:13:00 +0000 (14:13 -0700)
commit1851e7836212c76bebb6944bb1541ddcccbea535
tree06aac7187ecc8407dda5b67eeb109f84b43cf81a
parent3c2e0aff7b4f03fbc11b7d63c8db5b94a48978cf
RISC-V: KVM: Allow Smnpm and Ssnpm extensions for guests

The interface for controlling pointer masking in VS-mode is henvcfg.PMM,
which is part of the Ssnpm extension, even though pointer masking in
HS-mode is provided by the Smnpm extension. As a result, emulating Smnpm
in the guest requires (only) Ssnpm on the host.

The guest configures Smnpm through the SBI Firmware Features extension,
which KVM does not yet implement, so currently the ISA extension has no
visible effect on the guest, and thus it cannot be disabled. Ssnpm is
configured using the senvcfg CSR within the guest, so that extension
cannot be hidden from the guest without intercepting writes to the CSR.

Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/20241016202814.4061541-10-samuel.holland@sifive.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/include/uapi/asm/kvm.h
arch/riscv/kvm/vcpu_onereg.c