|
@@ -2250,6 +2250,7 @@ static int kvm_apic_state_fixup(struct kvm_vcpu *vcpu,
|
|
|
{
|
|
|
if (apic_x2apic_mode(vcpu->arch.apic)) {
|
|
|
u32 *id = (u32 *)(s->regs + APIC_ID);
|
|
|
+ u32 *ldr = (u32 *)(s->regs + APIC_LDR);
|
|
|
|
|
|
if (vcpu->kvm->arch.x2apic_format) {
|
|
|
if (*id != vcpu->vcpu_id)
|
|
@@ -2260,6 +2261,10 @@ static int kvm_apic_state_fixup(struct kvm_vcpu *vcpu,
|
|
|
else
|
|
|
*id <<= 24;
|
|
|
}
|
|
|
+
|
|
|
+ /* In x2APIC mode, the LDR is fixed and based on the id */
|
|
|
+ if (set)
|
|
|
+ *ldr = kvm_apic_calc_x2apic_ldr(*id);
|
|
|
}
|
|
|
|
|
|
return 0;
|