qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [Qemu-ppc] [PATCH v2 4/4] spapr: Suppress underscores i


From: Alexey Kardashevskiy
Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH v2 4/4] spapr: Suppress underscores in device tree CPU node
Date: Thu, 29 Aug 2013 14:39:32 +1000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7

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 <address@hidden>
> Signed-off-by: Andreas Färber <address@hidden>
> ---
>  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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]