aboutsummaryrefslogtreecommitdiff
path: root/target-i386
diff options
context:
space:
mode:
authorChen Fan <chen.fan.fnst@cn.fujitsu.com>2015-09-16 17:19:11 +0800
committerEduardo Habkost <ehabkost@redhat.com>2015-10-02 16:22:02 -0300
commit8d42d2d32b508484106f1c600f5cdd5496bc867e (patch)
tree294c7fa08fda7a570b13f4760b065f741d6bf2a8 /target-i386
parent2188cc52cb363433751f72b991d8fb05fc60e39d (diff)
downloadqemu-8d42d2d32b508484106f1c600f5cdd5496bc867e.zip
qemu-8d42d2d32b508484106f1c600f5cdd5496bc867e.tar.gz
qemu-8d42d2d32b508484106f1c600f5cdd5496bc867e.tar.bz2
apic: move APIC's MMIO region mapping into APIC
When ICC bus/bridge is removed, APIC MMIO will be left unmapped since it was mapped into system's address space indirectly by ICC bridge. Fix it by moving mapping into APIC code, so it would be possible to remove ICC bus/bridge code later. Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com> Signed-off-by: Zhu Guihua <zhugh.fnst@cn.fujitsu.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'target-i386')
-rw-r--r--target-i386/cpu.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 21bad59..dba77d3 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -2758,15 +2758,30 @@ static void x86_cpu_apic_create(X86CPU *cpu, Error **errp)
/* TODO: convert to link<> */
apic = APIC_COMMON(cpu->apic_state);
apic->cpu = cpu;
+ apic->apicbase = APIC_DEFAULT_ADDRESS | MSR_IA32_APICBASE_ENABLE;
}
static void x86_cpu_apic_realize(X86CPU *cpu, Error **errp)
{
+ APICCommonState *apic;
+ static bool apic_mmio_map_once;
+
if (cpu->apic_state == NULL) {
return;
}
object_property_set_bool(OBJECT(cpu->apic_state), true, "realized",
errp);
+
+ /* Map APIC MMIO area */
+ apic = APIC_COMMON(cpu->apic_state);
+ if (!apic_mmio_map_once) {
+ memory_region_add_subregion_overlap(get_system_memory(),
+ apic->apicbase &
+ MSR_IA32_APICBASE_BASE,
+ &apic->io_memory,
+ 0x1000);
+ apic_mmio_map_once = true;
+ }
}
static void x86_cpu_machine_done(Notifier *n, void *unused)