[PATCH 08/27] RISC-V: KVM: Factor-out VCPU config into separate sources

Radim Krčmář radim.krcmar at oss.qualcomm.com
Fri Mar 13 06:46:18 PDT 2026


2026-01-20T13:29:54+05:30, Anup Patel <anup.patel at oss.qualcomm.com>:
> The VCPU config deals with hideleg, hedeleg, henvcfg, and hstateenX
> CSR configuration for each VCPU. Factor-out VCPU config into separate
> sources so that VCPU config can do things differently for guest HS-mode
> and guest VS/VU-mode.
>
> Signed-off-by: Anup Patel <anup.patel at oss.qualcomm.com>
> ---
> diff --git a/arch/riscv/kvm/vcpu.c b/arch/riscv/kvm/vcpu.c
> @@ -871,7 +820,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)
>  	struct kvm_run *run = vcpu->run;
>  
>  	if (!vcpu->arch.ran_atleast_once)
> -		kvm_riscv_vcpu_setup_config(vcpu);
> +		kvm_riscv_vcpu_config_ran_once(vcpu);
>  
>  	/* Mark this VCPU ran at least once */
>  	vcpu->arch.ran_atleast_once = true;
> diff --git a/arch/riscv/kvm/vcpu_config.c b/arch/riscv/kvm/vcpu_config.c
> +void kvm_riscv_vcpu_config_ran_once(struct kvm_vcpu *vcpu)

ran_once is a bit awkward name since it hasn't ran once...
Maybe _once or _first_run?  Not that it matters,

Reviewed-by: Radim Krčmář <radim.krcmar at oss.qualcomm.com>



More information about the linux-riscv mailing list