On 08/16/2013 08:35 AM, Andreas Färber wrote: > PAPR requires that PowerPC,<name> shall not contain underscores, so skip > any underscores in the type name.
Again, as this is for sPAPR only and spapr-supported CPUs have fw_name, why to bother with "_" at all? Where can it possibly come from? Sorry if I am asking something really stupid, it is just that the solution for the pretty trivial problem looks bigger that I'd expect :) > Reported-by: Prerna Saxena <pre...@linux.vnet.ibm.com> > Signed-off-by: Andreas Färber <afaer...@suse.de> > --- > hw/ppc/spapr.c | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) > > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index 0e9be32..137e060 100644 > --- a/hw/ppc/spapr.c > +++ b/hw/ppc/spapr.c > @@ -264,7 +264,7 @@ static void *spapr_create_fdt_skel(hwaddr initrd_base, > char qemu_hypertas_prop[] = "hcall-memop1"; > uint32_t refpoints[] = {cpu_to_be32(0x4), cpu_to_be32(0x4)}; > uint32_t interrupt_server_ranges_prop[] = {0, cpu_to_be32(smp_cpus)}; > - int i, smt = kvmppc_smt_threads(); > + int i, j, smt = kvmppc_smt_threads(); > unsigned char vec5[] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x80}; > > fdt = g_malloc0(FDT_MAX_SIZE); > @@ -350,6 +350,17 @@ static void *spapr_create_fdt_skel(hwaddr initrd_base, > } > nodename = g_strndup(typename, > strlen(typename) - strlen("-" > TYPE_POWERPC_CPU)); > + for (i = j = 0; j < strlen(nodename); i++, j++) { > + if (nodename[j] == '_') { > + j++; > + } > + if (j > i) { > + nodename[i] = nodename[j]; > + } > + } > + if (j > i) { > + nodename[i] = '\0'; > + } > dc->fw_name = g_strdup_printf("PowerPC,%s", nodename); > g_free(nodename); > } > -- Alexey