OSDN Git Service

KVM: compute correct map even if all APICs are software disabled
authorPaolo Bonzini <pbonzini@redhat.com>
Thu, 6 Nov 2014 09:51:45 +0000 (10:51 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 17 Nov 2014 11:16:19 +0000 (12:16 +0100)
commita3e339e1cec899908f516a4ebde64cac500b0c45
tree5317dfdb5f8ae44b3198ac5e52c2afcfd20f9fde
parent173beedc1601f51dae9d579aa7a414c5aa8f700b
KVM: compute correct map even if all APICs are software disabled

Logical destination mode can be used to send NMI IPIs even when all
APICs are software disabled, so if all APICs are software disabled we
should still look at the DFRs.

So the DFRs should all be the same, even if some or all APICs are
software disabled.  However, the SDM does not say this, so tweak
the logic as follows:

- if one APIC is enabled and has LDR != 0, use that one to build the map.
This picks the right DFR in case an OS is only setting it for the
software-enabled APICs, or in case an OS is using logical addressing
on some APICs while leaving the rest in reset state (using LDR was
suggested by Radim).

- if all APICs are disabled, pick a random one to build the map.
We use the last one with LDR != 0 for simplicity.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/lapic.c