From: Paolo Bonzini Date: Thu, 29 Sep 2022 17:25:13 +0000 (-0400) Subject: Merge tag 'kvm-x86-6.1-2' of https://github.com/sean-jc/linux into HEAD X-Git-Tag: v6.1-rc5~198^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c99ad25b0d2bdb703a23217cfb0cf4bab364e9c7;p=platform%2Fkernel%2Flinux-starfive.git Merge tag 'kvm-x86-6.1-2' of https://github.com/sean-jc/linux into HEAD KVM x86 updates for 6.1, batch #2: - Misc PMU fixes and cleanups. - Fixes for Hyper-V hypercall selftest --- c99ad25b0d2bdb703a23217cfb0cf4bab364e9c7 diff --cc arch/x86/kvm/x86.c index b0c47b4,eb9d2c2..4bd5f8a --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@@ -11107,29 -11302,17 +11316,30 @@@ int kvm_arch_vcpu_ioctl_set_mpstate(str vcpu_load(vcpu); - if (!lapic_in_kernel(vcpu) && - mp_state->mp_state != KVM_MP_STATE_RUNNABLE) + switch (mp_state->mp_state) { + case KVM_MP_STATE_UNINITIALIZED: + case KVM_MP_STATE_HALTED: + case KVM_MP_STATE_AP_RESET_HOLD: + case KVM_MP_STATE_INIT_RECEIVED: + case KVM_MP_STATE_SIPI_RECEIVED: + if (!lapic_in_kernel(vcpu)) + goto out; + break; + + case KVM_MP_STATE_RUNNABLE: + break; + + default: goto out; + } /* - * KVM_MP_STATE_INIT_RECEIVED means the processor is in - * INIT state; latched init should be reported using - * KVM_SET_VCPU_EVENTS, so reject it here. + * Pending INITs are reported using KVM_SET_VCPU_EVENTS, disallow + * forcing the guest into INIT/SIPI if those events are supposed to be + * blocked. KVM prioritizes SMI over INIT, so reject INIT/SIPI state + * if an SMI is pending as well. */ - if ((kvm_vcpu_latch_init(vcpu) || vcpu->arch.smi_pending) && + if ((!kvm_apic_init_sipi_allowed(vcpu) || vcpu->arch.smi_pending) && (mp_state->mp_state == KVM_MP_STATE_SIPI_RECEIVED || mp_state->mp_state == KVM_MP_STATE_INIT_RECEIVED)) goto out;