提交 173beedc 编写于 作者: N Nadav Amit 提交者: Paolo Bonzini

KVM: x86: Software disabled APIC should still deliver NMIs

Currently, the APIC logical map does not consider VCPUs whose local-apic is
software-disabled.  However, NMIs, INIT, etc. should still be delivered to such
VCPUs. Therefore, the APIC mode should first be determined, and then the map,
considering all VCPUs should be constructed.

To address this issue, first find the APIC mode, and only then construct the
logical map.
Signed-off-by: NNadav Amit <namit@cs.technion.ac.il>
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
上级 5cc15027
...@@ -156,8 +156,6 @@ static void recalculate_apic_map(struct kvm *kvm) ...@@ -156,8 +156,6 @@ static void recalculate_apic_map(struct kvm *kvm)
kvm_for_each_vcpu(i, vcpu, kvm) { kvm_for_each_vcpu(i, vcpu, kvm) {
struct kvm_lapic *apic = vcpu->arch.apic; struct kvm_lapic *apic = vcpu->arch.apic;
u16 cid, lid;
u32 ldr;
if (!kvm_apic_present(vcpu)) if (!kvm_apic_present(vcpu))
continue; continue;
...@@ -175,13 +173,22 @@ static void recalculate_apic_map(struct kvm *kvm) ...@@ -175,13 +173,22 @@ static void recalculate_apic_map(struct kvm *kvm)
new->cid_mask = (1 << KVM_X2APIC_CID_BITS) - 1; new->cid_mask = (1 << KVM_X2APIC_CID_BITS) - 1;
new->lid_mask = 0xffff; new->lid_mask = 0xffff;
new->broadcast = X2APIC_BROADCAST; new->broadcast = X2APIC_BROADCAST;
} else if (kvm_apic_sw_enabled(apic) && break;
!new->cid_mask /* flat mode */ && } else if (kvm_apic_sw_enabled(apic)) {
kvm_apic_get_reg(apic, APIC_DFR) == APIC_DFR_CLUSTER) { if (kvm_apic_get_reg(apic, APIC_DFR) ==
new->cid_shift = 4; APIC_DFR_CLUSTER) {
new->cid_mask = 0xf; new->cid_shift = 4;
new->lid_mask = 0xf; new->cid_mask = 0xf;
new->lid_mask = 0xf;
}
break;
} }
}
kvm_for_each_vcpu(i, vcpu, kvm) {
struct kvm_lapic *apic = vcpu->arch.apic;
u16 cid, lid;
u32 ldr;
new->phys_map[kvm_apic_id(apic)] = apic; new->phys_map[kvm_apic_id(apic)] = apic;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册