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.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJXqr87AAoJEGw4ysog2bOSseYQAJrJgerj3DT24UWJtZ+F2hZT
 dt5EMk36CcE4QWqRTzee58Qxl+qbJOSrodMcSPoB0XyIqZO/jl1J59xAjcjAPpZI
 GkOlNhnUvJOuZTf9IwwIZdf68tAequPS5UXmwJ/ra6gV4/+U4lgafEPSvLYSZ0Hq
 c1YjYl3Mjg5CkmO2Kypm+hAD/hSSnkz2Mp5hD2kBIWsr3nBY6dbjvUwGJihbKDbO
 3kNBeMKfLfEJskoDdUgtqnO6cPvxHqugPKKa+KOZS7urHKVsJRVvhi1NJP7MvIxG
 u9p9tTxVyTC2aFaWNcCxUGspU+nhHgPDYsGB1AMmkIfW/YqjTj9HDXkqllB0rwUQ
 KJc5PVliaA3jAFxM8VsAMoF+HmfOCvca0xUdIwut8QVdbCoBLyaIskjj/e7IlNO/
 bKHCliFVIxln39kduUkfZ+AQC4b9EoJY4Z519gwTva78RkhlotyLuMwhK1A37IT2
 v7bDib88Ji4g7rsxDQkCmVi3JTyLYHtFXwDwdCp3F/51KPeVu7k3qNsF1i/qFP/b
 CQSqNpi2D3rN4Mx2rJBYtDcYIFZxbtSMiwd4GALy3P4hRbLzqR31msLQAq5G6q59
 Yg5CYj0AcmVmZA4yg5X8N8Jdx2sH1BFqszmtoLTlsUVvMvw1j7wgsznsvQ3Mm8zF
 uqaJDayYXsc3d4zxKyOw
 =v3op
 -----END PGP SIGNATURE-----

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>
This commit is contained in:
Peter Maydell 2016-08-10 15:13:30 +01:00
commit d578cca333
6 changed files with 57 additions and 34 deletions

View File

@ -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,

View File

@ -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 }
};

View File

@ -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;
}

View File

@ -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

View File

@ -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;
}

View File

@ -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));