From: Glauber Costa <glommer@redhat.com>
To: kvm@vger.kernel.org
Cc: avi@redhat.com, ehabkost@redhat.com
Subject: [PATCH 2/2] Present kvm with corret apic phys id.
Date: Wed, 29 Apr 2009 16:31:41 -0400 [thread overview]
Message-ID: <1241037101-24842-3-git-send-email-glommer@redhat.com> (raw)
In-Reply-To: <1241037101-24842-2-git-send-email-glommer@redhat.com>
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>
---
qemu/hw/apic.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/qemu/hw/apic.c b/qemu/hw/apic.c
index b926508..0ace5cc 100644
--- a/qemu/hw/apic.c
+++ b/qemu/hw/apic.c
@@ -830,7 +830,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;
@@ -863,7 +863,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);
--
1.5.6.6
next prev parent reply other threads:[~2009-04-29 20:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-29 20:31 [PATCH 0/2] Fix cpu hotplug in upstream kvm Glauber Costa
2009-04-29 20:31 ` [PATCH 1/2] don't start cpu main loop while there is still init work to do Glauber Costa
2009-04-29 20:31 ` Glauber Costa [this message]
2009-05-04 8:32 ` [PATCH 2/2] Present kvm with corret apic phys id Avi Kivity
2009-05-04 8:30 ` [PATCH 1/2] don't start cpu main loop while there is still init work to do Avi Kivity
2009-05-04 14:26 ` Glauber Costa
2009-05-04 14:33 ` Avi Kivity
2009-05-04 14:44 ` Glauber Costa
2009-05-04 14:48 ` Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1241037101-24842-3-git-send-email-glommer@redhat.com \
--to=glommer@redhat.com \
--cc=avi@redhat.com \
--cc=ehabkost@redhat.com \
--cc=kvm@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox