diff options
author | Glauber Costa <glommer@redhat.com> | 2009-04-29 16:31:41 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2009-05-06 10:02:35 +0300 |
commit | a7292021481b3122a4f1a2544a7e2e257bfa347d (patch) | |
tree | aa78c49466ed5e7548e2449cd52a40bfd23689c1 | |
parent | 27545831850dd1beb14392572fa0bbc6af636115 (diff) |
Present kvm with corret apic phys id.
KVM will 24-shift bits in addr 0x20 (APIC_ID) before actually
using it. We currently load phys_id as "s->id". After shifted
by 24 bits, it will result in a meaningless value. We should really
be doing "s->id << 24", which, after shifted, will lead to the correct
value.
This is for the load function. save has the invert problem.
Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r-- | hw/apic.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -831,7 +831,7 @@ static void kvm_kernel_lapic_save_to_user(APICState *s) kvm_get_lapic(kvm_context, s->cpu_env->cpu_index, kapic); - s->id = kapic_reg(kapic, 0x2); + s->id = kapic_reg(kapic, 0x2) >> 24; s->tpr = kapic_reg(kapic, 0x8); s->arb_id = kapic_reg(kapic, 0x9); s->log_dest = kapic_reg(kapic, 0xd) >> 24; @@ -864,7 +864,7 @@ static void kvm_kernel_lapic_load_from_user(APICState *s) int i; memset(klapic, 0, sizeof apic); - kapic_set_reg(klapic, 0x2, s->id); + kapic_set_reg(klapic, 0x2, s->id << 24); kapic_set_reg(klapic, 0x8, s->tpr); kapic_set_reg(klapic, 0xd, s->log_dest << 24); kapic_set_reg(klapic, 0xe, s->dest_mode << 28 | 0x0fffffff); |