From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52724) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VEu1L-0001v9-PH for qemu-devel@nongnu.org; Thu, 29 Aug 2013 00:39:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VEu1D-00074z-UE for qemu-devel@nongnu.org; Thu, 29 Aug 2013 00:39:47 -0400 Received: from mail-pb0-f47.google.com ([209.85.160.47]:46119) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VEu1D-00074p-OB for qemu-devel@nongnu.org; Thu, 29 Aug 2013 00:39:39 -0400 Received: by mail-pb0-f47.google.com with SMTP id rr4so7176824pbb.34 for ; Wed, 28 Aug 2013 21:39:38 -0700 (PDT) Message-ID: <521ED084.5050903@ozlabs.ru> Date: Thu, 29 Aug 2013 14:39:32 +1000 From: Alexey Kardashevskiy MIME-Version: 1.0 References: <1376606111-3518-1-git-send-email-afaerber@suse.de> <1376606111-3518-5-git-send-email-afaerber@suse.de> In-Reply-To: <1376606111-3518-5-git-send-email-afaerber@suse.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH v2 4/4] spapr: Suppress underscores in device tree CPU node List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= Cc: sPAPR , qemu-devel@nongnu.org, Prerna Saxena On 08/16/2013 08:35 AM, Andreas Färber wrote: > PAPR requires that PowerPC, 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 > Signed-off-by: Andreas Färber > --- > 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