The e500 platform code uses the function ppc_get_vcpu_dt_id() but that
function is actually specific to SPAPR machines, not PPC CPUs, and
will always return the cpu_index in this context.
Simply use the cpu_index instead (which is 'i' in this context
because qemu_get_cpu(i) returns the cpu with cpu_index == i).
Signed-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
---
hw/ppc/e500.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index 62f1857206..2a6d34ceb1 100644
--- a/hw/ppc/e500.c
+++ b/hw/ppc/e500.c
@@ -382,7 +382,6 @@ static int ppce500_load_device_tree(MachineState *machine,
the first node as boot node and be happy */
for (i = smp_cpus - 1; i >= 0; i--) {
CPUState *cpu;
- PowerPCCPU *pcpu;
char cpu_name[128];
uint64_t cpu_release_addr = params->spin_base + (i * 0x20);
@@ -391,16 +390,13 @@ static int ppce500_load_device_tree(MachineState *machine,
continue;
}
env = cpu->env_ptr;
- pcpu = POWERPC_CPU(cpu);
- snprintf(cpu_name, sizeof(cpu_name), "/cpus/PowerPC,8544@%x",
- ppc_get_vcpu_dt_id(pcpu));
+ snprintf(cpu_name, sizeof(cpu_name), "/cpus/PowerPC,8544@%x", i);
qemu_fdt_add_subnode(fdt, cpu_name);
qemu_fdt_setprop_cell(fdt, cpu_name, "clock-frequency", clock_freq);
qemu_fdt_setprop_cell(fdt, cpu_name, "timebase-frequency", tb_freq);
qemu_fdt_setprop_string(fdt, cpu_name, "device_type", "cpu");
- qemu_fdt_setprop_cell(fdt, cpu_name, "reg",
- ppc_get_vcpu_dt_id(pcpu));
+ qemu_fdt_setprop_cell(fdt, cpu_name, "reg", i);
qemu_fdt_setprop_cell(fdt, cpu_name, "d-cache-line-size",
env->dcache_line_size);
qemu_fdt_setprop_cell(fdt, cpu_name, "i-cache-line-size",
--
2.12.1.382.gc0f9c7058
On Thu, 3 Aug 2017 16:28:36 +1000
Sam Bobroff <sam.bobroff@au1.ibm.com> wrote:
> The e500 platform code uses the function ppc_get_vcpu_dt_id() but that
> function is actually specific to SPAPR machines, not PPC CPUs, and
> will always return the cpu_index in this context.
>
ie, e500 compatible CPUs don't support SMT ? Then maybe the e500 machine
should ensure smp_threads == 1, but this can done in a followup patch.
> Simply use the cpu_index instead (which is 'i' in this context
> because qemu_get_cpu(i) returns the cpu with cpu_index == i).
>
> Signed-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
> ---
> hw/ppc/e500.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
> index 62f1857206..2a6d34ceb1 100644
> --- a/hw/ppc/e500.c
> +++ b/hw/ppc/e500.c
> @@ -382,7 +382,6 @@ static int ppce500_load_device_tree(MachineState *machine,
> the first node as boot node and be happy */
> for (i = smp_cpus - 1; i >= 0; i--) {
> CPUState *cpu;
> - PowerPCCPU *pcpu;
> char cpu_name[128];
> uint64_t cpu_release_addr = params->spin_base + (i * 0x20);
>
> @@ -391,16 +390,13 @@ static int ppce500_load_device_tree(MachineState *machine,
> continue;
> }
> env = cpu->env_ptr;
> - pcpu = POWERPC_CPU(cpu);
>
> - snprintf(cpu_name, sizeof(cpu_name), "/cpus/PowerPC,8544@%x",
> - ppc_get_vcpu_dt_id(pcpu));
> + snprintf(cpu_name, sizeof(cpu_name), "/cpus/PowerPC,8544@%x", i);
> qemu_fdt_add_subnode(fdt, cpu_name);
> qemu_fdt_setprop_cell(fdt, cpu_name, "clock-frequency", clock_freq);
> qemu_fdt_setprop_cell(fdt, cpu_name, "timebase-frequency", tb_freq);
> qemu_fdt_setprop_string(fdt, cpu_name, "device_type", "cpu");
> - qemu_fdt_setprop_cell(fdt, cpu_name, "reg",
> - ppc_get_vcpu_dt_id(pcpu));
> + qemu_fdt_setprop_cell(fdt, cpu_name, "reg", i);
> qemu_fdt_setprop_cell(fdt, cpu_name, "d-cache-line-size",
> env->dcache_line_size);
> qemu_fdt_setprop_cell(fdt, cpu_name, "i-cache-line-size",
On Thu, Aug 03, 2017 at 03:15:04PM +0200, Greg Kurz wrote:
> On Thu, 3 Aug 2017 16:28:36 +1000
> Sam Bobroff <sam.bobroff@au1.ibm.com> wrote:
>
> > The e500 platform code uses the function ppc_get_vcpu_dt_id() but that
> > function is actually specific to SPAPR machines, not PPC CPUs, and
> > will always return the cpu_index in this context.
> >
>
> ie, e500 compatible CPUs don't support SMT ? Then maybe the e500 machine
> should ensure smp_threads == 1, but this can done in a followup patch.
Uh.. sort of, it's really more about the host than guest restrictions.
I've rewritten the commit message to give a bit more context.
> > Simply use the cpu_index instead (which is 'i' in this context
> > because qemu_get_cpu(i) returns the cpu with cpu_index == i).
> >
> > Signed-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
>
> Reviewed-by: Greg Kurz <groug@kaod.org>
Applied to ppc-for-2.11
>
> > ---
> > hw/ppc/e500.c | 8 ++------
> > 1 file changed, 2 insertions(+), 6 deletions(-)
> >
> > diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
> > index 62f1857206..2a6d34ceb1 100644
> > --- a/hw/ppc/e500.c
> > +++ b/hw/ppc/e500.c
> > @@ -382,7 +382,6 @@ static int ppce500_load_device_tree(MachineState *machine,
> > the first node as boot node and be happy */
> > for (i = smp_cpus - 1; i >= 0; i--) {
> > CPUState *cpu;
> > - PowerPCCPU *pcpu;
> > char cpu_name[128];
> > uint64_t cpu_release_addr = params->spin_base + (i * 0x20);
> >
> > @@ -391,16 +390,13 @@ static int ppce500_load_device_tree(MachineState *machine,
> > continue;
> > }
> > env = cpu->env_ptr;
> > - pcpu = POWERPC_CPU(cpu);
> >
> > - snprintf(cpu_name, sizeof(cpu_name), "/cpus/PowerPC,8544@%x",
> > - ppc_get_vcpu_dt_id(pcpu));
> > + snprintf(cpu_name, sizeof(cpu_name), "/cpus/PowerPC,8544@%x", i);
> > qemu_fdt_add_subnode(fdt, cpu_name);
> > qemu_fdt_setprop_cell(fdt, cpu_name, "clock-frequency", clock_freq);
> > qemu_fdt_setprop_cell(fdt, cpu_name, "timebase-frequency", tb_freq);
> > qemu_fdt_setprop_string(fdt, cpu_name, "device_type", "cpu");
> > - qemu_fdt_setprop_cell(fdt, cpu_name, "reg",
> > - ppc_get_vcpu_dt_id(pcpu));
> > + qemu_fdt_setprop_cell(fdt, cpu_name, "reg", i);
> > qemu_fdt_setprop_cell(fdt, cpu_name, "d-cache-line-size",
> > env->dcache_line_size);
> > qemu_fdt_setprop_cell(fdt, cpu_name, "i-cache-line-size",
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
© 2016 - 2026 Red Hat, Inc.