[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 1/2] apic: move apic mmio register to each apic r
From: |
Chen Fan |
Subject: |
[Qemu-devel] [PATCH v3 1/2] apic: move apic mmio register to each apic realizefn |
Date: |
Fri, 10 Apr 2015 16:18:05 +0800 |
Due to local apic address is in view of CPU's address space,
so able to move apic mapping to each apic realizefn.
Signed-off-by: Chen Fan <address@hidden>
---
hw/i386/pc.c | 7 -------
hw/intc/apic_common.c | 11 +++++------
2 files changed, 5 insertions(+), 13 deletions(-)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index a8e6be1..a5e2a27 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1089,13 +1089,6 @@ void pc_cpus_init(const char *cpu_model, DeviceState
*icc_bridge)
}
}
- /* map APIC MMIO area if CPU has APIC */
- if (cpu && cpu->apic_state) {
- /* XXX: what if the base changes? */
- sysbus_mmio_map_overlap(SYS_BUS_DEVICE(icc_bridge), 0,
- APIC_DEFAULT_ADDRESS, 0x1000);
- }
-
/* tell smbios about cpuid version and features */
smbios_set_cpuid(cpu->env.cpuid_version, cpu->env.features[FEAT_1_EDX]);
}
diff --git a/hw/intc/apic_common.c b/hw/intc/apic_common.c
index 042e960..004821a 100644
--- a/hw/intc/apic_common.c
+++ b/hw/intc/apic_common.c
@@ -306,7 +306,6 @@ static void apic_common_realize(DeviceState *dev, Error
**errp)
APICCommonClass *info;
static DeviceState *vapic;
static int apic_no;
- static bool mmio_registered;
if (apic_no >= MAX_APICS) {
error_setg(errp, "%s initialization failed.",
@@ -317,11 +316,11 @@ static void apic_common_realize(DeviceState *dev, Error
**errp)
info = APIC_COMMON_GET_CLASS(s);
info->realize(dev, errp);
- if (!mmio_registered) {
- ICCBus *b = ICC_BUS(qdev_get_parent_bus(dev));
- memory_region_add_subregion(b->apic_address_space, 0, &s->io_memory);
- mmio_registered = true;
- }
+
+ memory_region_add_subregion_overlap(CPU(s->cpu)->as->root,
+ APIC_DEFAULT_ADDRESS,
+ &s->io_memory,
+ 0x1000);
/* Note: We need at least 1M to map the VAPIC option ROM */
if (!vapic && s->vapic_control & VAPIC_ENABLE_MASK &&
--
1.9.3