mirror of
https://github.com/Motorhead1991/qemu.git
synced 2026-01-06 06:27:41 -07:00
target-i386: Move APIC to ICC bus
It allows APIC to be hotplugged. * map APIC's mmio at board level if it is present * do not register mmio region for each APIC, since only one is used/mapped Signed-off-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
62fc403f11
commit
53a89e262b
6 changed files with 42 additions and 24 deletions
|
|
@ -41,10 +41,10 @@
|
|||
#endif
|
||||
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "hw/qdev-properties.h"
|
||||
#include "hw/cpu/icc_bus.h"
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
#include "hw/xen/xen.h"
|
||||
#include "hw/sysbus.h"
|
||||
#include "hw/i386/apic_internal.h"
|
||||
#endif
|
||||
|
||||
|
|
@ -2131,6 +2131,7 @@ static void mce_init(X86CPU *cpu)
|
|||
static void x86_cpu_apic_create(X86CPU *cpu, Error **errp)
|
||||
{
|
||||
CPUX86State *env = &cpu->env;
|
||||
DeviceState *dev = DEVICE(cpu);
|
||||
APICCommonState *apic;
|
||||
const char *apic_type = "apic";
|
||||
|
||||
|
|
@ -2140,7 +2141,7 @@ static void x86_cpu_apic_create(X86CPU *cpu, Error **errp)
|
|||
apic_type = "xen-apic";
|
||||
}
|
||||
|
||||
env->apic_state = qdev_try_create(NULL, apic_type);
|
||||
env->apic_state = qdev_try_create(qdev_get_parent_bus(dev), apic_type);
|
||||
if (env->apic_state == NULL) {
|
||||
error_setg(errp, "APIC device '%s' could not be created", apic_type);
|
||||
return;
|
||||
|
|
@ -2157,7 +2158,6 @@ static void x86_cpu_apic_create(X86CPU *cpu, Error **errp)
|
|||
static void x86_cpu_apic_realize(X86CPU *cpu, Error **errp)
|
||||
{
|
||||
CPUX86State *env = &cpu->env;
|
||||
static int apic_mapped;
|
||||
|
||||
if (env->apic_state == NULL) {
|
||||
return;
|
||||
|
|
@ -2168,16 +2168,6 @@ static void x86_cpu_apic_realize(X86CPU *cpu, Error **errp)
|
|||
object_get_typename(OBJECT(env->apic_state)));
|
||||
return;
|
||||
}
|
||||
|
||||
/* XXX: mapping more APICs at the same memory location */
|
||||
if (apic_mapped == 0) {
|
||||
/* NOTE: the APIC is directly connected to the CPU - it is not
|
||||
on the global memory bus. */
|
||||
/* XXX: what if the base changes? */
|
||||
sysbus_mmio_map_overlap(SYS_BUS_DEVICE(env->apic_state), 0,
|
||||
APIC_DEFAULT_ADDRESS, 0x1000);
|
||||
apic_mapped = 1;
|
||||
}
|
||||
}
|
||||
#else
|
||||
static void x86_cpu_apic_realize(X86CPU *cpu, Error **errp)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue