qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v12 2/5] apic: use per CPU AS to map APIC MMIO for T


From: Zhu Guihua
Subject: [Qemu-devel] [PATCH v12 2/5] apic: use per CPU AS to map APIC MMIO for TCG
Date: Wed, 16 Sep 2015 17:19:12 +0800

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 independent of others.

Signed-off-by: Zhu Guihua <address@hidden>
---
 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 050ce11..692a284 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -2759,9 +2759,18 @@ static void x86_cpu_apic_realize(X86CPU *cpu, Error 
**errp)
     object_property_set_bool(OBJECT(cpu->apic_state), true, "realized",
                              errp);
 
-    /* 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]