All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Zhu Guihua <zhugh.fnst@cn.fujitsu.com>
To: qemu-devel@nongnu.org, imammedo@redhat.com, afaerber@suse.de,
	pbonzini@redhat.com, ehabkost@redhat.com
Cc: chen.fan.fnst@cn.fujitsu.com, izumi.taku@jp.fujitsu.com,
	Zhu Guihua <zhugh.fnst@cn.fujitsu.com>
Subject: [Qemu-devel] [PATCH v11 2/5] apic: use per CPU AS to map APIC MMIO for TCG
Date: Wed, 2 Sep 2015 17:36:19 +0800	[thread overview]
Message-ID: <73429d6177c577cb17fe07bbd446be3a7b3f8ead.1441086002.git.zhugh.fnst@cn.fujitsu.com> (raw)
In-Reply-To: <cover.1441086002.git.zhugh.fnst@cn.fujitsu.com>

TCG supports per CPU address space, and the emulation quality is
a bit better with it.
So use per CPU address space to map APIC MMIO area. This allows the
APIC base address of each cpu to be moved indepenedent of others.

Signed-off-by: Zhu Guihua <zhugh.fnst@cn.fujitsu.com>
---
 target-i386/cpu.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 66b6b0d..0a95162 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -2881,9 +2881,18 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
         goto out;
     }
 
-    /* Map APIC MMIO area */
+    /* Map APIC MMIO area, use per-CPU address space if available (TCG
+     * supports it, KVM doesn't). This allows the APIC base address of
+     * each CPU to be moved independently.
+     */
     apic = APIC_COMMON(cpu->apic_state);
-    if (!apic_mmio_map_once) {
+    if (tcg_enabled()) {
+        memory_region_add_subregion_overlap(cpu->cpu_as_root,
+                                            apic->apicbase &
+                                            MSR_IA32_APICBASE_BASE,
+                                            &apic->io_memory,
+                                            0x1000);
+    } else if (!apic_mmio_map_once) {
         memory_region_add_subregion_overlap(get_system_memory(),
                                             apic->apicbase &
                                             MSR_IA32_APICBASE_BASE,
-- 
1.9.3

  parent reply	other threads:[~2015-09-02  9:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-02  9:36 [Qemu-devel] [PATCH v11 0/5] remove icc bus/bridge Zhu Guihua
2015-09-02  9:36 ` [Qemu-devel] [PATCH v11 1/5] apic: move APIC's MMIO region mapping into APIC Zhu Guihua
2015-09-14 13:16   ` Igor Mammedov
2015-09-02  9:36 ` Zhu Guihua [this message]
2015-09-02  9:36 ` [Qemu-devel] [PATCH v11 3/5] x86: use new method to correct reset sequence Zhu Guihua
2015-09-02  9:36 ` [Qemu-devel] [PATCH v11 4/5] cpu/apic: drop icc bus/bridge Zhu Guihua
2015-09-14 13:18   ` Igor Mammedov
2015-09-15  0:52     ` Zhu Guihua
2015-09-15  8:15       ` Igor Mammedov
2015-09-02  9:36 ` [Qemu-devel] [PATCH v11 5/5] icc_bus: drop the unused files Zhu Guihua
2015-09-10 10:21 ` [Qemu-devel] [PATCH v11 0/5] remove icc bus/bridge Zhu Guihua

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=73429d6177c577cb17fe07bbd446be3a7b3f8ead.1441086002.git.zhugh.fnst@cn.fujitsu.com \
    --to=zhugh.fnst@cn.fujitsu.com \
    --cc=afaerber@suse.de \
    --cc=chen.fan.fnst@cn.fujitsu.com \
    --cc=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=izumi.taku@jp.fujitsu.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.