aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2013-06-14 07:51:30 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2013-06-14 07:51:30 -0500
commit5f13731f8cb6aadecf214513ec810d61dc1f71dc (patch)
treebefdd804224f893f36f8c8c839ddb96e8f06e4c5 /hw
parent86a6a0774509c59f1570f763a0fad57e26762d9c (diff)
parentc67e216bdf42abfb8505790b2da9562356103976 (diff)
Merge remote-tracking branch 'afaerber/qom-cpu' into staging
# By Andreas Färber (12) and others # Via Andreas Färber * afaerber/qom-cpu: spapr_rtas: Abstract rtas_start_cpu() with qemu_get_cpu() spapr_rtas: Abstract rtas_query_cpu_stopped_state() with qemu_get_cpu() memory_mapping: Improve qemu_get_guest_memory_mapping() error reporting dump: Abstract dump_init() with cpu_synchronize_all_states() cpu: Change default for CPUClass::get_paging_enabled() dump: Drop qmp_dump_guest_memory() stub and build for all targets memory_mapping: Drop qemu_get_memory_mapping() stub cpu: Turn cpu_get_memory_mapping() into a CPUState hook memory_mapping: Move MemoryMappingList typedef to qemu/typedefs.h cpu: Turn cpu_paging_enabled() into a CPUState hook monitor: Simplify do_inject_mce() with qemu_get_cpu() target-i386: cpu: Fix potential buffer overrun in get_register_name_32() target-i386: Set level=4 on Conroe/Penryn/Nehalem target-i386: Update model values on Conroe/Penryn/Nehalem CPU models pc: Create pc-*-1.6 machine-types pc: Fix crash when attempting to hotplug CPU with negative ID dump: Move stubs into libqemustub.a
Diffstat (limited to 'hw')
-rw-r--r--hw/i386/pc.c5
-rw-r--r--hw/i386/pc_piix.c18
-rw-r--r--hw/i386/pc_q35.c16
-rw-r--r--hw/ppc/spapr_rtas.c28
4 files changed, 46 insertions, 21 deletions
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 4844a6b370..553becbd42 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -927,6 +927,11 @@ void pc_hot_add_cpu(const int64_t id, Error **errp)
DeviceState *icc_bridge;
int64_t apic_id = x86_cpu_apic_id_from_index(id);
+ if (id < 0) {
+ error_setg(errp, "Invalid CPU id: %" PRIi64, id);
+ return;
+ }
+
if (cpu_exists(apic_id)) {
error_setg(errp, "Unable to add CPU: %" PRIi64
", it already exists", id);
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index d6185705a6..69eb2a17be 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -327,8 +327,8 @@ static void pc_xen_hvm_init(QEMUMachineInitArgs *args)
}
#endif
-static QEMUMachine pc_i440fx_machine_v1_5 = {
- .name = "pc-i440fx-1.5",
+static QEMUMachine pc_i440fx_machine_v1_6 = {
+ .name = "pc-i440fx-1.6",
.alias = "pc",
.desc = "Standard PC (i440FX + PIIX, 1996)",
.init = pc_init_pci,
@@ -338,6 +338,19 @@ static QEMUMachine pc_i440fx_machine_v1_5 = {
DEFAULT_MACHINE_OPTIONS,
};
+static QEMUMachine pc_i440fx_machine_v1_5 = {
+ .name = "pc-i440fx-1.5",
+ .desc = "Standard PC (i440FX + PIIX, 1996)",
+ .init = pc_init_pci,
+ .hot_add_cpu = pc_hot_add_cpu,
+ .max_cpus = 255,
+ .compat_props = (GlobalProperty[]) {
+ PC_COMPAT_1_5,
+ { /* end of list */ }
+ },
+ DEFAULT_MACHINE_OPTIONS,
+};
+
static QEMUMachine pc_i440fx_machine_v1_4 = {
.name = "pc-i440fx-1.4",
.desc = "Standard PC (i440FX + PIIX, 1996)",
@@ -735,6 +748,7 @@ static QEMUMachine xenfv_machine = {
static void pc_machine_init(void)
{
+ qemu_register_machine(&pc_i440fx_machine_v1_6);
qemu_register_machine(&pc_i440fx_machine_v1_5);
qemu_register_machine(&pc_i440fx_machine_v1_4);
qemu_register_machine(&pc_machine_v1_3);
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 7888dfe03f..bb0ce6ae6b 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -215,13 +215,26 @@ static void pc_q35_init_1_4(QEMUMachineInitArgs *args)
pc_q35_init(args);
}
+static QEMUMachine pc_q35_machine_v1_6 = {
+ .name = "pc-q35-1.6",
+ .alias = "q35",
+ .desc = "Standard PC (Q35 + ICH9, 2009)",
+ .init = pc_q35_init,
+ .hot_add_cpu = pc_hot_add_cpu,
+ .max_cpus = 255,
+ DEFAULT_MACHINE_OPTIONS,
+};
+
static QEMUMachine pc_q35_machine_v1_5 = {
.name = "pc-q35-1.5",
- .alias = "q35",
.desc = "Standard PC (Q35 + ICH9, 2009)",
.init = pc_q35_init,
.hot_add_cpu = pc_hot_add_cpu,
.max_cpus = 255,
+ .compat_props = (GlobalProperty[]) {
+ PC_COMPAT_1_5,
+ { /* end of list */ }
+ },
DEFAULT_MACHINE_OPTIONS,
};
@@ -239,6 +252,7 @@ static QEMUMachine pc_q35_machine_v1_4 = {
static void pc_q35_machine_init(void)
{
+ qemu_register_machine(&pc_q35_machine_v1_6);
qemu_register_machine(&pc_q35_machine_v1_5);
qemu_register_machine(&pc_q35_machine_v1_4);
}
diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
index 8ecaa5f8ec..f4bd3c9d86 100644
--- a/hw/ppc/spapr_rtas.c
+++ b/hw/ppc/spapr_rtas.c
@@ -130,7 +130,6 @@ static void rtas_query_cpu_stopped_state(sPAPREnvironment *spapr,
uint32_t nret, target_ulong rets)
{
target_ulong id;
- CPUPPCState *env;
CPUState *cpu;
if (nargs != 1 || nret != 2) {
@@ -139,12 +138,8 @@ static void rtas_query_cpu_stopped_state(sPAPREnvironment *spapr,
}
id = rtas_ld(args, 0);
- for (env = first_cpu; env; env = env->next_cpu) {
- cpu = CPU(ppc_env_get_cpu(env));
- if (cpu->cpu_index != id) {
- continue;
- }
-
+ cpu = qemu_get_cpu(id);
+ if (cpu != NULL) {
if (cpu->halted) {
rtas_st(rets, 1, 0);
} else {
@@ -165,8 +160,7 @@ static void rtas_start_cpu(sPAPREnvironment *spapr,
uint32_t nret, target_ulong rets)
{
target_ulong id, start, r3;
- CPUState *cpu;
- CPUPPCState *env;
+ CPUState *cs;
if (nargs != 3 || nret != 1) {
rtas_st(rets, 0, -3);
@@ -177,14 +171,12 @@ static void rtas_start_cpu(sPAPREnvironment *spapr,
start = rtas_ld(args, 1);
r3 = rtas_ld(args, 2);
- for (env = first_cpu; env; env = env->next_cpu) {
- cpu = CPU(ppc_env_get_cpu(env));
-
- if (cpu->cpu_index != id) {
- continue;
- }
+ cs = qemu_get_cpu(id);
+ if (cs != NULL) {
+ PowerPCCPU *cpu = POWERPC_CPU(cs);
+ CPUPPCState *env = &cpu->env;
- if (!cpu->halted) {
+ if (!cs->halted) {
rtas_st(rets, 0, -1);
return;
}
@@ -197,9 +189,9 @@ static void rtas_start_cpu(sPAPREnvironment *spapr,
env->msr = (1ULL << MSR_SF) | (1ULL << MSR_ME);
env->nip = start;
env->gpr[3] = r3;
- cpu->halted = 0;
+ cs->halted = 0;
- qemu_cpu_kick(cpu);
+ qemu_cpu_kick(cs);
rtas_st(rets, 0, 0);
return;