Skip to content

Commit 58c81bc

Browse files
committed
KVM: x86: Refactor handling of SIPI_RECEIVED when setting MP_STATE
Convert the incoming mp_state to INIT_RECIEVED instead of manually calling kvm_set_mp_state() to make it more obvious that the SIPI_RECEIVED logic is translating the incoming state to KVM's internal tracking, as opposed to being some entirely unique flow. Opportunistically add a comment to explain what the code is doing. No functional change intended. Link: https://lore.kernel.org/r/20250605195018.539901-5-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent 0fe3e8d commit 58c81bc

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

arch/x86/kvm/x86.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11929,11 +11929,17 @@ int kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu,
1192911929
goto out;
1193011930
}
1193111931

11932+
/*
11933+
* SIPI_RECEIVED is obsolete and no longer used internally; KVM instead
11934+
* leaves the vCPU in INIT_RECIEVED (Wait-For-SIPI) and pends the SIPI.
11935+
* Translate SIPI_RECEIVED as appropriate for backwards compatibility.
11936+
*/
1193211937
if (mp_state->mp_state == KVM_MP_STATE_SIPI_RECEIVED) {
11933-
kvm_set_mp_state(vcpu, KVM_MP_STATE_INIT_RECEIVED);
11938+
mp_state->mp_state = KVM_MP_STATE_INIT_RECEIVED;
1193411939
set_bit(KVM_APIC_SIPI, &vcpu->arch.apic->pending_events);
11935-
} else
11936-
kvm_set_mp_state(vcpu, mp_state->mp_state);
11940+
}
11941+
11942+
kvm_set_mp_state(vcpu, mp_state->mp_state);
1193711943
kvm_make_request(KVM_REQ_EVENT, vcpu);
1193811944

1193911945
ret = 0;

0 commit comments

Comments
 (0)