aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2016-08-10 15:13:30 +0100
committerPeter Maydell <peter.maydell@linaro.org>2016-08-10 15:13:30 +0100
commitd578cca333168ada7f9421beb3f07abe8990e7e3 (patch)
treeea7b8cf01e2fbe97664b8e0d224bd011c8347fc6
parent2bb15bddf2607110820d5ce5aa43baac27292fb3 (diff)
parentd11b268e1765e8878c1150d463b9f6dc3a8d4456 (diff)
downloadqemu-d578cca333168ada7f9421beb3f07abe8990e7e3.zip
qemu-d578cca333168ada7f9421beb3f07abe8990e7e3.tar.gz
qemu-d578cca333168ada7f9421beb3f07abe8990e7e3.tar.bz2
Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.7-20160810' into staging
ppc patch queue for 2016-08-10 Here are some more last minute PAPR and ppc related fixes for qemu-2.7. One patch makes compressed memory dumps work with guest kernels using page sizes up to 64KiB. This is important since most current pseries guests use a 64KiB default page size. The remainder fix a regression with handling of CPU aliases which causes serious problem for libvirt. # gpg: Signature made Wed 10 Aug 2016 06:44:27 BST # gpg: using RSA key 0x6C38CACA20D9B392 # gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>" # gpg: aka "David Gibson (Red Hat) <dgibson@redhat.com>" # gpg: aka "David Gibson (ozlabs.org) <dgibson@ozlabs.org>" # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: 75F4 6586 AE61 A66C C44E 87DC 6C38 CACA 20D9 B392 * remotes/dgibson/tags/ppc-for-2.7-20160810: ppc/kvm: Register also a generic spapr CPU core family type ppc/kvm: Do not mess up the generic CPU family registration hw/ppc/spapr: Look up CPU alias names instead of hard-coding the aliases ppc: Introduce a function to look up CPU alias strings spapr: remove extra type variable ppc64: fix compressed dump with pseries kernel Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--hw/ppc/spapr.c15
-rw-r--r--hw/ppc/spapr_cpu_core.c38
-rw-r--r--target-ppc/arch_dump.c5
-rw-r--r--target-ppc/cpu.h1
-rw-r--r--target-ppc/kvm.c19
-rw-r--r--target-ppc/translate_init.c13
6 files changed, 57 insertions, 34 deletions
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 57564e5..0787c66 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -1815,6 +1815,11 @@ static void ppc_spapr_init(MachineState *machine)
if (mc->query_hotpluggable_cpus) {
char *type = spapr_get_cpu_core_type(machine->cpu_model);
+ if (type == NULL) {
+ error_report("Unable to find sPAPR CPU Core definition");
+ exit(1);
+ }
+
spapr->cores = g_new0(Object *, spapr_max_cores);
for (i = 0; i < spapr_max_cores; i++) {
int core_id = i * smp_threads;
@@ -1826,15 +1831,7 @@ static void ppc_spapr_init(MachineState *machine)
qemu_register_reset(spapr_drc_reset, drc);
if (i < spapr_cores) {
- char *type = spapr_get_cpu_core_type(machine->cpu_model);
- Object *core;
-
- if (!object_class_by_name(type)) {
- error_report("Unable to find sPAPR CPU Core definition");
- exit(1);
- }
-
- core = object_new(type);
+ Object *core = object_new(type);
object_property_set_int(core, smp_threads, "nr-threads",
&error_fatal);
object_property_set_int(core, core_id, CPU_CORE_PROP_CORE_ID,
diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
index 716f7c4..bcb483d 100644
--- a/hw/ppc/spapr_cpu_core.c
+++ b/hw/ppc/spapr_cpu_core.c
@@ -93,6 +93,19 @@ char *spapr_get_cpu_core_type(const char *model)
core_type = g_strdup_printf("%s-%s", model_pieces[0], TYPE_SPAPR_CPU_CORE);
g_strfreev(model_pieces);
+
+ /* Check whether it exists or whether we have to look up an alias name */
+ if (!object_class_by_name(core_type)) {
+ const char *realmodel;
+
+ g_free(core_type);
+ realmodel = ppc_cpu_lookup_alias(model);
+ if (realmodel) {
+ return spapr_get_cpu_core_type(realmodel);
+ }
+ return NULL;
+ }
+
return core_type;
}
@@ -354,41 +367,32 @@ typedef struct SPAPRCoreInfo {
} SPAPRCoreInfo;
static const SPAPRCoreInfo spapr_cores[] = {
- /* 970 and aliaes */
+ /* 970 */
{ .name = "970_v2.2", .initfn = spapr_cpu_core_970_initfn },
- { .name = "970", .initfn = spapr_cpu_core_970_initfn },
- /* 970MP variants and aliases */
+ /* 970MP variants */
{ .name = "970MP_v1.0", .initfn = spapr_cpu_core_970MP_v10_initfn },
{ .name = "970mp_v1.0", .initfn = spapr_cpu_core_970MP_v10_initfn },
{ .name = "970MP_v1.1", .initfn = spapr_cpu_core_970MP_v11_initfn },
{ .name = "970mp_v1.1", .initfn = spapr_cpu_core_970MP_v11_initfn },
- { .name = "970mp", .initfn = spapr_cpu_core_970MP_v11_initfn },
- /* POWER5 and aliases */
+ /* POWER5+ */
{ .name = "POWER5+_v2.1", .initfn = spapr_cpu_core_POWER5plus_initfn },
- { .name = "POWER5+", .initfn = spapr_cpu_core_POWER5plus_initfn },
- /* POWER7 and aliases */
+ /* POWER7 */
{ .name = "POWER7_v2.3", .initfn = spapr_cpu_core_POWER7_initfn },
- { .name = "POWER7", .initfn = spapr_cpu_core_POWER7_initfn },
- /* POWER7+ and aliases */
+ /* POWER7+ */
{ .name = "POWER7+_v2.1", .initfn = spapr_cpu_core_POWER7plus_initfn },
- { .name = "POWER7+", .initfn = spapr_cpu_core_POWER7plus_initfn },
- /* POWER8 and aliases */
+ /* POWER8 */
{ .name = "POWER8_v2.0", .initfn = spapr_cpu_core_POWER8_initfn },
- { .name = "POWER8", .initfn = spapr_cpu_core_POWER8_initfn },
- { .name = "power8", .initfn = spapr_cpu_core_POWER8_initfn },
- /* POWER8E and aliases */
+ /* POWER8E */
{ .name = "POWER8E_v2.1", .initfn = spapr_cpu_core_POWER8E_initfn },
- { .name = "POWER8E", .initfn = spapr_cpu_core_POWER8E_initfn },
- /* POWER8NVL and aliases */
+ /* POWER8NVL */
{ .name = "POWER8NVL_v1.0", .initfn = spapr_cpu_core_POWER8NVL_initfn },
- { .name = "POWER8NVL", .initfn = spapr_cpu_core_POWER8NVL_initfn },
{ .name = NULL }
};
diff --git a/target-ppc/arch_dump.c b/target-ppc/arch_dump.c
index df1fd8c..40282a1 100644
--- a/target-ppc/arch_dump.c
+++ b/target-ppc/arch_dump.c
@@ -220,6 +220,11 @@ int cpu_get_dump_info(ArchDumpInfo *info,
} else {
info->d_endian = ELFDATA2LSB;
}
+ /* 64KB is the max page size for pseries kernel */
+ if (strncmp(object_get_typename(qdev_get_machine()),
+ "pseries-", 8) == 0) {
+ info->page_size = (1U << 16);
+ }
return 0;
}
diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h
index 5fce1ff..786ab5c 100644
--- a/target-ppc/cpu.h
+++ b/target-ppc/cpu.h
@@ -1201,6 +1201,7 @@ extern const struct VMStateDescription vmstate_ppc_cpu;
/*****************************************************************************/
PowerPCCPU *cpu_ppc_init(const char *cpu_model);
void ppc_translate_init(void);
+const char *ppc_cpu_lookup_alias(const char *alias);
void gen_update_current_nip(void *opaque);
/* you can call this signal handler from your SIGBUS and SIGSEGV
signal handlers to inform the virtual CPU of exceptions. non zero
diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index 84764ed..dcb68b9 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -2394,6 +2394,13 @@ static int kvm_ppc_register_host_cpu_type(void)
type_info.parent = object_class_get_name(OBJECT_CLASS(pvr_pcc));
type_register(&type_info);
+ /* Register generic family CPU class for a family */
+ pvr_pcc = ppc_cpu_get_family_class(pvr_pcc);
+ dc = DEVICE_CLASS(pvr_pcc);
+ type_info.parent = object_class_get_name(OBJECT_CLASS(pvr_pcc));
+ type_info.name = g_strdup_printf("%s-"TYPE_POWERPC_CPU, dc->desc);
+ type_register(&type_info);
+
#if defined(TARGET_PPC64)
type_info.name = g_strdup_printf("%s-"TYPE_SPAPR_CPU_CORE, "host");
type_info.parent = TYPE_SPAPR_CPU_CORE,
@@ -2402,16 +2409,12 @@ static int kvm_ppc_register_host_cpu_type(void)
type_info.class_init = NULL;
type_register(&type_info);
g_free((void *)type_info.name);
- type_info.instance_size = 0;
- type_info.instance_init = NULL;
-#endif
- /* Register generic family CPU class for a family */
- pvr_pcc = ppc_cpu_get_family_class(pvr_pcc);
- dc = DEVICE_CLASS(pvr_pcc);
- type_info.parent = object_class_get_name(OBJECT_CLASS(pvr_pcc));
- type_info.name = g_strdup_printf("%s-"TYPE_POWERPC_CPU, dc->desc);
+ /* Register generic spapr CPU family class for current host CPU type */
+ type_info.name = g_strdup_printf("%s-"TYPE_SPAPR_CPU_CORE, dc->desc);
type_register(&type_info);
+ g_free((void *)type_info.name);
+#endif
return 0;
}
diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index 5f28a36..7a9b15e 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -10012,6 +10012,19 @@ static ObjectClass *ppc_cpu_class_by_name(const char *name)
return NULL;
}
+const char *ppc_cpu_lookup_alias(const char *alias)
+{
+ int ai;
+
+ for (ai = 0; ppc_cpu_aliases[ai].alias != NULL; ai++) {
+ if (strcmp(ppc_cpu_aliases[ai].alias, alias) == 0) {
+ return ppc_cpu_aliases[ai].model;
+ }
+ }
+
+ return NULL;
+}
+
PowerPCCPU *cpu_ppc_init(const char *cpu_model)
{
return POWERPC_CPU(cpu_generic_init(TYPE_POWERPC_CPU, cpu_model));