Commit 7f46ddbd authored by Gleb Natapov's avatar Gleb Natapov Committed by Avi Kivity

KVM: apic: fix LDR calculation in x2apic mode

Signed-off-by: default avatarGleb Natapov <gleb@redhat.com>
Reviewed-by: default avatarChegu Vinod  <chegu_vinod@hp.com>
Tested-by: default avatarChegu Vinod <chegu_vinod@hp.com>
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
parent f3ac1a4b
...@@ -1311,7 +1311,7 @@ void kvm_lapic_set_base(struct kvm_vcpu *vcpu, u64 value) ...@@ -1311,7 +1311,7 @@ void kvm_lapic_set_base(struct kvm_vcpu *vcpu, u64 value)
vcpu->arch.apic_base = value; vcpu->arch.apic_base = value;
if (apic_x2apic_mode(apic)) { if (apic_x2apic_mode(apic)) {
u32 id = kvm_apic_id(apic); u32 id = kvm_apic_id(apic);
u32 ldr = ((id & ~0xf) << 16) | (1 << (id & 0xf)); u32 ldr = ((id >> 4) << 16) | (1 << (id & 0xf));
kvm_apic_set_ldr(apic, ldr); kvm_apic_set_ldr(apic, ldr);
} }
apic->base_address = apic->vcpu->arch.apic_base & apic->base_address = apic->vcpu->arch.apic_base &
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment