]> git.proxmox.com Git - mirror_qemu.git/commit - target/i386/kvm.c
kvm: apic: set APIC base as part of kvm_apic_put
authorDr. David Alan Gilbert <dgilbert@redhat.com>
Thu, 22 Sep 2016 12:49:17 +0000 (14:49 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 22 Sep 2016 15:25:59 +0000 (17:25 +0200)
commitf8d9ccf8d5f9f4b7d364100871c4c7303b546de5
treed20c18fe7e24a010e0c8693e412b4c302053727b
parent73e1b8f2f9b8a90361f9c1af306ee17bfcfd592d
kvm: apic: set APIC base as part of kvm_apic_put

The parsing of KVM_SET_LAPIC's input depends on the current value of the
APIC base MSR---which indeed is stored in APICCommonState---but for historical
reasons APIC base is set through KVM_SET_SREGS together with cr8 (which is
really just the APIC TPR) and the actual "special CPU registers".

APIC base must now be set before the actual LAPIC registers, so do that
in kvm_apic_put.  It will be set again to the same value with KVM_SET_SREGS,
but that's not a big issue.

This only happens since Linux 4.8, which checks for x2apic mode in
KVM_SET_LAPIC.  However it's really a QEMU bug; until the recent
commit 78d6a05 ("x86/lapic: Load LAPIC state at post_load", 2016-09-13)
QEMU was indeed setting APIC base (via KVM_SET_SREGS) before the other
LAPIC registers.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hw/i386/kvm/apic.c
target-i386/kvm.c
target-i386/kvm_i386.h