[PATCH] riscv-v: kvm: Make kvm_riscv_guest_timer_init a void function

Anup Patel anup at brainfault.org
Mon Jul 4 02:12:13 PDT 2022


On Fri, Jul 1, 2022 at 2:15 PM Nikolay Borisov <nborisov at suse.com> wrote:
>
> It can never fail so convey that fact explicitly by making the function
> void. Also in kvm_arch_init_vm it makes it clear that there no need
> to do any cleanup after kvm_riscv_gstage_vmid_init has been called.
>
> Signed-off-by: Nikolay Borisov <nborisov at suse.com>

Minor typo in patch subject. It should have prefix "riscv: kvm:".

I have taken care of above typo and queued it for 5.20

Thanks,
Anup

> ---
>  arch/riscv/include/asm/kvm_vcpu_timer.h | 2 +-
>  arch/riscv/kvm/vcpu_timer.c             | 4 +---
>  arch/riscv/kvm/vm.c                     | 4 +++-
>  3 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/arch/riscv/include/asm/kvm_vcpu_timer.h b/arch/riscv/include/asm/kvm_vcpu_timer.h
> index 375281eb49e0..50138e2eb91b 100644
> --- a/arch/riscv/include/asm/kvm_vcpu_timer.h
> +++ b/arch/riscv/include/asm/kvm_vcpu_timer.h
> @@ -39,6 +39,6 @@ int kvm_riscv_vcpu_timer_init(struct kvm_vcpu *vcpu);
>  int kvm_riscv_vcpu_timer_deinit(struct kvm_vcpu *vcpu);
>  int kvm_riscv_vcpu_timer_reset(struct kvm_vcpu *vcpu);
>  void kvm_riscv_vcpu_timer_restore(struct kvm_vcpu *vcpu);
> -int kvm_riscv_guest_timer_init(struct kvm *kvm);
> +void kvm_riscv_guest_timer_init(struct kvm *kvm);
>
>  #endif
> diff --git a/arch/riscv/kvm/vcpu_timer.c b/arch/riscv/kvm/vcpu_timer.c
> index 5c4c37ff2d48..595043857049 100644
> --- a/arch/riscv/kvm/vcpu_timer.c
> +++ b/arch/riscv/kvm/vcpu_timer.c
> @@ -214,12 +214,10 @@ void kvm_riscv_vcpu_timer_restore(struct kvm_vcpu *vcpu)
>  #endif
>  }
>
> -int kvm_riscv_guest_timer_init(struct kvm *kvm)
> +void kvm_riscv_guest_timer_init(struct kvm *kvm)
>  {
>         struct kvm_guest_timer *gt = &kvm->arch.timer;
>
>         riscv_cs_get_mult_shift(&gt->nsec_mult, &gt->nsec_shift);
>         gt->time_delta = -get_cycles64();
> -
> -       return 0;
>  }
> diff --git a/arch/riscv/kvm/vm.c b/arch/riscv/kvm/vm.c
> index 945a2bf5e3f6..65a964d7e70d 100644
> --- a/arch/riscv/kvm/vm.c
> +++ b/arch/riscv/kvm/vm.c
> @@ -41,7 +41,9 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
>                 return r;
>         }
>
> -       return kvm_riscv_guest_timer_init(kvm);
> +       kvm_riscv_guest_timer_init(kvm);
> +
> +       return 0;
>  }
>
>  void kvm_arch_destroy_vm(struct kvm *kvm)
> --
> 2.25.1
>



More information about the kvm-riscv mailing list