Skip to content

Commit c6e129f

Browse files
committed
KVM: SVM: Simplify request+kick logic in SNP AP Creation handling
Drop the local "kick" variable and the unnecessary "fallthrough" logic from sev_snp_ap_creation(), and simply pivot on the request when deciding whether or not to immediate force a state update on the target vCPU. No functional change intended. Reviewed-by: Pankaj Gupta <pankaj.gupta@amd.com> Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com> Link: https://lore.kernel.org/r/20250227012541.3234589-7-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent 745ff82 commit c6e129f

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

arch/x86/kvm/svm/sev.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3944,7 +3944,6 @@ static int sev_snp_ap_creation(struct vcpu_svm *svm)
39443944
struct vcpu_svm *target_svm;
39453945
unsigned int request;
39463946
unsigned int apic_id;
3947-
bool kick;
39483947
int ret;
39493948

39503949
request = lower_32_bits(svm->vmcb->control.exit_info_1);
@@ -3962,18 +3961,10 @@ static int sev_snp_ap_creation(struct vcpu_svm *svm)
39623961

39633962
target_svm = to_svm(target_vcpu);
39643963

3965-
/*
3966-
* The target vCPU is valid, so the vCPU will be kicked unless the
3967-
* request is for CREATE_ON_INIT.
3968-
*/
3969-
kick = true;
3970-
39713964
mutex_lock(&target_svm->sev_es.snp_vmsa_mutex);
39723965

39733966
switch (request) {
39743967
case SVM_VMGEXIT_AP_CREATE_ON_INIT:
3975-
kick = false;
3976-
fallthrough;
39773968
case SVM_VMGEXIT_AP_CREATE:
39783969
if (vcpu->arch.regs[VCPU_REGS_RAX] != sev->vmsa_features) {
39793970
vcpu_unimpl(vcpu, "vmgexit: mismatched AP sev_features [%#lx] != [%#llx] from guest\n",
@@ -4018,7 +4009,11 @@ static int sev_snp_ap_creation(struct vcpu_svm *svm)
40184009

40194010
target_svm->sev_es.snp_ap_waiting_for_reset = true;
40204011

4021-
if (kick) {
4012+
/*
4013+
* Unless Creation is deferred until INIT, signal the vCPU to update
4014+
* its state.
4015+
*/
4016+
if (request != SVM_VMGEXIT_AP_CREATE_ON_INIT) {
40224017
kvm_make_request(KVM_REQ_UPDATE_PROTECTED_GUEST_STATE, target_vcpu);
40234018
kvm_vcpu_kick(target_vcpu);
40244019
}

0 commit comments

Comments
 (0)