RISC-V: KVM: Probe for SBI extension status
authorAndrew Jones <ajones@ventanamicro.com>
Tue, 30 May 2023 17:50:24 +0000 (19:50 +0200)
committerAnup Patel <anup@brainfault.org>
Tue, 6 Jun 2023 03:45:21 +0000 (09:15 +0530)
commit95c99104cb42bea5a0874c362f284ae4b91289dd
tree693f9833139ed6c51bb0bc124ba7f4886fc682ac
parent9f9e3ebe111c7aabf18a4085648dcc58c568c1d6
RISC-V: KVM: Probe for SBI extension status

Rather than defaulting the status to available and allowing the user
to set availability, default to uninitialized and only allow the user
to set the status to unavailable. Then, when an extension is first
used, ensure it is available by invoking its probe function, if it
has one (an extension is assumed available if it doesn't have a probe
function). Checking the status in kvm_vcpu_sbi_find_ext() ensures
extension functions cannot be invoked when they're unavailable.

Signed-off-by: Andrew Jones <ajones@ventanamicro.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Signed-off-by: Anup Patel <anup@brainfault.org>
arch/riscv/include/asm/kvm_vcpu_sbi.h
arch/riscv/kvm/vcpu_sbi.c