[PATCH v2 1/2] KVM: RISC-V: reset smstateen in a better place

Anup Patel apatel at ventanamicro.com
Thu May 8 22:13:28 PDT 2025


On Thu, May 8, 2025 at 8:02 PM Radim Krčmář <rkrcmar at ventanamicro.com> wrote:
>
> This got missed when the series was applied out of order.
>
> Signed-off-by: Radim Krčmář <rkrcmar at ventanamicro.com>
> ---
> Feel free to squash this patch with 376e3c0f8aa5 ("KVM: RISC-V: remove
> unnecessary SBI reset state").

I have squashed this patch into commit 376e3c0f8aa5

Regards,
Anup

> ---
>  arch/riscv/kvm/vcpu.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/arch/riscv/kvm/vcpu.c b/arch/riscv/kvm/vcpu.c
> index 7cc0796999eb..a78f9ec2fa0e 100644
> --- a/arch/riscv/kvm/vcpu.c
> +++ b/arch/riscv/kvm/vcpu.c
> @@ -60,6 +60,7 @@ static void kvm_riscv_vcpu_context_reset(struct kvm_vcpu *vcpu)
>
>         memset(cntx, 0, sizeof(*cntx));
>         memset(csr, 0, sizeof(*csr));
> +       memset(&vcpu->arch.smstateen_csr, 0, sizeof(vcpu->arch.smstateen_csr));
>
>         /* Restore datap as it's not a part of the guest context. */
>         cntx->vector.datap = vector_datap;
> @@ -101,8 +102,6 @@ static void kvm_riscv_reset_vcpu(struct kvm_vcpu *vcpu)
>
>         kvm_riscv_vcpu_context_reset(vcpu);
>
> -       memset(&vcpu->arch.smstateen_csr, 0, sizeof(vcpu->arch.smstateen_csr));
> -
>         kvm_riscv_vcpu_fp_reset(vcpu);
>
>         kvm_riscv_vcpu_vector_reset(vcpu);
> --
> 2.49.0
>
>



More information about the kvm-riscv mailing list