@@ -3944,7 +3944,6 @@ static int sev_snp_ap_creation(struct vcpu_svm *svm)
3944
3944
struct vcpu_svm * target_svm ;
3945
3945
unsigned int request ;
3946
3946
unsigned int apic_id ;
3947
- int ret ;
3948
3947
3949
3948
request = lower_32_bits (svm -> vmcb -> control .exit_info_1 );
3950
3949
apic_id = upper_32_bits (svm -> vmcb -> control .exit_info_1 );
@@ -3957,27 +3956,23 @@ static int sev_snp_ap_creation(struct vcpu_svm *svm)
3957
3956
return - EINVAL ;
3958
3957
}
3959
3958
3960
- ret = 0 ;
3961
-
3962
3959
target_svm = to_svm (target_vcpu );
3963
3960
3964
- mutex_lock (& target_svm -> sev_es .snp_vmsa_mutex );
3961
+ guard ( mutex ) (& target_svm -> sev_es .snp_vmsa_mutex );
3965
3962
3966
3963
switch (request ) {
3967
3964
case SVM_VMGEXIT_AP_CREATE_ON_INIT :
3968
3965
case SVM_VMGEXIT_AP_CREATE :
3969
3966
if (vcpu -> arch .regs [VCPU_REGS_RAX ] != sev -> vmsa_features ) {
3970
3967
vcpu_unimpl (vcpu , "vmgexit: mismatched AP sev_features [%#lx] != [%#llx] from guest\n" ,
3971
3968
vcpu -> arch .regs [VCPU_REGS_RAX ], sev -> vmsa_features );
3972
- ret = - EINVAL ;
3973
- goto out ;
3969
+ return - EINVAL ;
3974
3970
}
3975
3971
3976
3972
if (!page_address_valid (vcpu , svm -> vmcb -> control .exit_info_2 )) {
3977
3973
vcpu_unimpl (vcpu , "vmgexit: invalid AP VMSA address [%#llx] from guest\n" ,
3978
3974
svm -> vmcb -> control .exit_info_2 );
3979
- ret = - EINVAL ;
3980
- goto out ;
3975
+ return - EINVAL ;
3981
3976
}
3982
3977
3983
3978
/*
@@ -3991,8 +3986,7 @@ static int sev_snp_ap_creation(struct vcpu_svm *svm)
3991
3986
vcpu_unimpl (vcpu ,
3992
3987
"vmgexit: AP VMSA address [%llx] from guest is unsafe as it is 2M aligned\n" ,
3993
3988
svm -> vmcb -> control .exit_info_2 );
3994
- ret = - EINVAL ;
3995
- goto out ;
3989
+ return - EINVAL ;
3996
3990
}
3997
3991
3998
3992
target_svm -> sev_es .snp_vmsa_gpa = svm -> vmcb -> control .exit_info_2 ;
@@ -4003,8 +3997,7 @@ static int sev_snp_ap_creation(struct vcpu_svm *svm)
4003
3997
default :
4004
3998
vcpu_unimpl (vcpu , "vmgexit: invalid AP creation request [%#x] from guest\n" ,
4005
3999
request );
4006
- ret = - EINVAL ;
4007
- goto out ;
4000
+ return - EINVAL ;
4008
4001
}
4009
4002
4010
4003
target_svm -> sev_es .snp_ap_waiting_for_reset = true;
@@ -4018,10 +4011,7 @@ static int sev_snp_ap_creation(struct vcpu_svm *svm)
4018
4011
kvm_vcpu_kick (target_vcpu );
4019
4012
}
4020
4013
4021
- out :
4022
- mutex_unlock (& target_svm -> sev_es .snp_vmsa_mutex );
4023
-
4024
- return ret ;
4014
+ return 0 ;
4025
4015
}
4026
4016
4027
4017
static int snp_handle_guest_req (struct vcpu_svm * svm , gpa_t req_gpa , gpa_t resp_gpa )
0 commit comments