]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: Initialize number of APIC LVT entries during APIC creation
authorSean Christopherson <seanjc@google.com>
Fri, 8 Jul 2022 22:38:51 +0000 (15:38 -0700)
committerSean Christopherson <seanjc@google.com>
Fri, 8 Jul 2022 22:55:28 +0000 (15:55 -0700)
commitd7edb22163d276c52a9da932fa5ba07e123742c3
tree9a7db1b22c2c701b8ffb6ba293a09b02aa0d00dd
parent63830f02d8d7c98b02249abce3bf0a64c78b1752
KVM: x86: Initialize number of APIC LVT entries during APIC creation

Initialize the number of LVT entries during APIC creation, else the field
will be incorrectly left '0' if userspace never invokes KVM_X86_SETUP_MCE.

Add and use a helper to calculate the number of entries even though
MCG_CMCI_P is not set by default in vcpu->arch.mcg_cap.  Relying on that
to always be true is unnecessarily risky, and subtle/confusing as well.

Fixes: 7dbdcb4e6022 ("KVM: x86: Add Corrected Machine Check Interrupt (CMCI) emulation to lapic.")
Reported-by: Xiaoyao Li <xiaoyao.li@intel.com>
Cc: Jue Wang <juew@google.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/lapic.c