Re: [PATCH v11 7/8] KVM: SEV: Fold sev_es_vcpu_reset() into sev_vcpu_create()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 8/20/2025 5:18 AM, Sean Christopherson wrote:
> Fold the remaining line of sev_es_vcpu_reset() into sev_vcpu_create() as
> there's no need for a dedicated RESET hook just to init a mutex, and the
> mutex should be initialized as early as possible anyways.
> 
> No functional change intended.
> 
> Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>

Reviewed-by: Nikunj A Dadhania <nikunj@xxxxxxx>

> ---
>  arch/x86/kvm/svm/sev.c | 7 ++-----
>  arch/x86/kvm/svm/svm.c | 3 ---
>  arch/x86/kvm/svm/svm.h | 1 -
>  3 files changed, 2 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
> index ee7a05843548..7d1d34e45310 100644
> --- a/arch/x86/kvm/svm/sev.c
> +++ b/arch/x86/kvm/svm/sev.c
> @@ -4577,6 +4577,8 @@ int sev_vcpu_create(struct kvm_vcpu *vcpu)
>  	struct vcpu_svm *svm = to_svm(vcpu);
>  	struct page *vmsa_page;
>  
> +	mutex_init(&svm->sev_es.snp_vmsa_mutex);
> +
>  	if (!sev_es_guest(vcpu->kvm))
>  		return 0;
>  
> @@ -4592,11 +4594,6 @@ int sev_vcpu_create(struct kvm_vcpu *vcpu)
>  	return 0;
>  }
>  
> -void sev_es_vcpu_reset(struct vcpu_svm *svm)
> -{
> -	mutex_init(&svm->sev_es.snp_vmsa_mutex);
> -}
> -
>  void sev_es_prepare_switch_to_guest(struct vcpu_svm *svm, struct sev_es_save_area *hostsa)
>  {
>  	struct kvm *kvm = svm->vcpu.kvm;
> diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
> index 8ed135dbd649..b237b4081c91 100644
> --- a/arch/x86/kvm/svm/svm.c
> +++ b/arch/x86/kvm/svm/svm.c
> @@ -1244,9 +1244,6 @@ static void __svm_vcpu_reset(struct kvm_vcpu *vcpu)
>  
>  	svm->nmi_masked = false;
>  	svm->awaiting_iret_completion = false;
> -
> -	if (sev_es_guest(vcpu->kvm))
> -		sev_es_vcpu_reset(svm);
>  }
>  
>  static void svm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event)
> diff --git a/arch/x86/kvm/svm/svm.h b/arch/x86/kvm/svm/svm.h
> index 321480ebe62f..3c7f208b7935 100644
> --- a/arch/x86/kvm/svm/svm.h
> +++ b/arch/x86/kvm/svm/svm.h
> @@ -829,7 +829,6 @@ int pre_sev_run(struct vcpu_svm *svm, int cpu);
>  void sev_init_vmcb(struct vcpu_svm *svm, bool init_event);
>  void sev_vcpu_after_set_cpuid(struct vcpu_svm *svm);
>  int sev_es_string_io(struct vcpu_svm *svm, int size, unsigned int port, int in);
> -void sev_es_vcpu_reset(struct vcpu_svm *svm);
>  void sev_es_recalc_msr_intercepts(struct kvm_vcpu *vcpu);
>  void sev_vcpu_deliver_sipi_vector(struct kvm_vcpu *vcpu, u8 vector);
>  void sev_es_prepare_switch_to_guest(struct vcpu_svm *svm, struct sev_es_save_area *hostsa);





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux