diff mbox

[RFC,02/17] powernv: CPU compatibility modes don't make sense for powernv

Message ID 1477825928-10803-3-git-send-email-david@gibson.dropbear.id.au (mailing list archive)
State New, archived
Headers show

Commit Message

David Gibson Oct. 30, 2016, 11:11 a.m. UTC
powernv has some code (derived from the spapr equivalent) used in device
tree generation which depends on the CPU's compatibility mode / logical
PVR.  However, compatibility modes don't make sense on powernv - at least
not as a property controlled by the host - because the guest in powernv
has full hypervisor level access to the virtual system, and so owns the
PCR (Processor Compatibility Register) which implements compatiblity modes.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 hw/ppc/pnv.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Comments

Thomas Huth Oct. 31, 2016, 7:46 a.m. UTC | #1
On 30.10.2016 12:11, David Gibson wrote:
> powernv has some code (derived from the spapr equivalent) used in device
> tree generation which depends on the CPU's compatibility mode / logical
> PVR.  However, compatibility modes don't make sense on powernv - at least
> not as a property controlled by the host - because the guest in powernv
> has full hypervisor level access to the virtual system, and so owns the
> PCR (Processor Compatibility Register) which implements compatiblity modes.
> 
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> ---
>  hw/ppc/pnv.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
> index 82276e0..6af3424 100644
> --- a/hw/ppc/pnv.c
> +++ b/hw/ppc/pnv.c
> @@ -110,7 +110,7 @@ static void powernv_create_core_node(PnvChip *chip, PnvCore *pc, void *fdt)
>      CPUState *cs = CPU(DEVICE(pc->threads));
>      DeviceClass *dc = DEVICE_GET_CLASS(cs);
>      PowerPCCPU *cpu = POWERPC_CPU(cs);
> -    int smt_threads = ppc_get_compat_smt_threads(cpu);
> +    int smt_threads = CPU_CORE(pc)->nr_threads;

ppc_get_compat_smt_threads() also checks kvmppc_smt_threads() ... as
long as we do not run the powernv architecture with KVM PR, your change
should be OK, but if we support that one day, we might need to check
kvmppc_smt_threads() here, too?

>      CPUPPCState *env = &cpu->env;
>      PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cs);
>      uint32_t servers_prop[smt_threads];
> @@ -206,10 +206,6 @@ static void powernv_create_core_node(PnvChip *chip, PnvCore *pc, void *fdt)
>      _FDT((fdt_setprop(fdt, offset, "ibm,pa-features",
>                         pa_features, sizeof(pa_features))));
>  
> -    if (cpu->cpu_version) {
> -        _FDT((fdt_setprop_cell(fdt, offset, "cpu-version", cpu->cpu_version)));
> -    }
> -
>      /* Build interrupt servers properties */
>      for (i = 0; i < smt_threads; i++) {
>          servers_prop[i] = cpu_to_be32(pc->pir + i);
> 

Reviewed-by: Thomas Huth <thuth@redhat.com>
David Gibson Oct. 31, 2016, 8:38 a.m. UTC | #2
On Mon, Oct 31, 2016 at 08:46:55AM +0100, Thomas Huth wrote:
> On 30.10.2016 12:11, David Gibson wrote:
> > powernv has some code (derived from the spapr equivalent) used in device
> > tree generation which depends on the CPU's compatibility mode / logical
> > PVR.  However, compatibility modes don't make sense on powernv - at least
> > not as a property controlled by the host - because the guest in powernv
> > has full hypervisor level access to the virtual system, and so owns the
> > PCR (Processor Compatibility Register) which implements compatiblity modes.
> > 
> > Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> > ---
> >  hw/ppc/pnv.c | 6 +-----
> >  1 file changed, 1 insertion(+), 5 deletions(-)
> > 
> > diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
> > index 82276e0..6af3424 100644
> > --- a/hw/ppc/pnv.c
> > +++ b/hw/ppc/pnv.c
> > @@ -110,7 +110,7 @@ static void powernv_create_core_node(PnvChip *chip, PnvCore *pc, void *fdt)
> >      CPUState *cs = CPU(DEVICE(pc->threads));
> >      DeviceClass *dc = DEVICE_GET_CLASS(cs);
> >      PowerPCCPU *cpu = POWERPC_CPU(cs);
> > -    int smt_threads = ppc_get_compat_smt_threads(cpu);
> > +    int smt_threads = CPU_CORE(pc)->nr_threads;
> 
> ppc_get_compat_smt_threads() also checks kvmppc_smt_threads() ... as
> long as we do not run the powernv architecture with KVM PR, your change
> should be OK, but if we support that one day, we might need to check
> kvmppc_smt_threads() here, too?

No, actually.  I covered this when I posted this patch standalone
earlier, but forgot to add it to the commit message.  If nr_threads
exceeds kvmppc_smt_threads() then things are already broken, and
clamping the value here isn't going to save us.

> 
> >      CPUPPCState *env = &cpu->env;
> >      PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cs);
> >      uint32_t servers_prop[smt_threads];
> > @@ -206,10 +206,6 @@ static void powernv_create_core_node(PnvChip *chip, PnvCore *pc, void *fdt)
> >      _FDT((fdt_setprop(fdt, offset, "ibm,pa-features",
> >                         pa_features, sizeof(pa_features))));
> >  
> > -    if (cpu->cpu_version) {
> > -        _FDT((fdt_setprop_cell(fdt, offset, "cpu-version", cpu->cpu_version)));
> > -    }
> > -
> >      /* Build interrupt servers properties */
> >      for (i = 0; i < smt_threads; i++) {
> >          servers_prop[i] = cpu_to_be32(pc->pir + i);
> > 
> 
> Reviewed-by: Thomas Huth <thuth@redhat.com>
>
Greg Kurz Oct. 31, 2016, 10:35 a.m. UTC | #3
On Sun, 30 Oct 2016 22:11:53 +1100
David Gibson <david@gibson.dropbear.id.au> wrote:

> powernv has some code (derived from the spapr equivalent) used in device
> tree generation which depends on the CPU's compatibility mode / logical
> PVR.  However, compatibility modes don't make sense on powernv - at least
> not as a property controlled by the host - because the guest in powernv
> has full hypervisor level access to the virtual system, and so owns the
> PCR (Processor Compatibility Register) which implements compatiblity modes.
> 
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> ---

As said with the standalone version:

Reviewed-by: Greg Kurz <groug@kaod.org>

>  hw/ppc/pnv.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
> index 82276e0..6af3424 100644
> --- a/hw/ppc/pnv.c
> +++ b/hw/ppc/pnv.c
> @@ -110,7 +110,7 @@ static void powernv_create_core_node(PnvChip *chip, PnvCore *pc, void *fdt)
>      CPUState *cs = CPU(DEVICE(pc->threads));
>      DeviceClass *dc = DEVICE_GET_CLASS(cs);
>      PowerPCCPU *cpu = POWERPC_CPU(cs);
> -    int smt_threads = ppc_get_compat_smt_threads(cpu);
> +    int smt_threads = CPU_CORE(pc)->nr_threads;
>      CPUPPCState *env = &cpu->env;
>      PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cs);
>      uint32_t servers_prop[smt_threads];
> @@ -206,10 +206,6 @@ static void powernv_create_core_node(PnvChip *chip, PnvCore *pc, void *fdt)
>      _FDT((fdt_setprop(fdt, offset, "ibm,pa-features",
>                         pa_features, sizeof(pa_features))));
>  
> -    if (cpu->cpu_version) {
> -        _FDT((fdt_setprop_cell(fdt, offset, "cpu-version", cpu->cpu_version)));
> -    }
> -
>      /* Build interrupt servers properties */
>      for (i = 0; i < smt_threads; i++) {
>          servers_prop[i] = cpu_to_be32(pc->pir + i);
diff mbox

Patch

diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index 82276e0..6af3424 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -110,7 +110,7 @@  static void powernv_create_core_node(PnvChip *chip, PnvCore *pc, void *fdt)
     CPUState *cs = CPU(DEVICE(pc->threads));
     DeviceClass *dc = DEVICE_GET_CLASS(cs);
     PowerPCCPU *cpu = POWERPC_CPU(cs);
-    int smt_threads = ppc_get_compat_smt_threads(cpu);
+    int smt_threads = CPU_CORE(pc)->nr_threads;
     CPUPPCState *env = &cpu->env;
     PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cs);
     uint32_t servers_prop[smt_threads];
@@ -206,10 +206,6 @@  static void powernv_create_core_node(PnvChip *chip, PnvCore *pc, void *fdt)
     _FDT((fdt_setprop(fdt, offset, "ibm,pa-features",
                        pa_features, sizeof(pa_features))));
 
-    if (cpu->cpu_version) {
-        _FDT((fdt_setprop_cell(fdt, offset, "cpu-version", cpu->cpu_version)));
-    }
-
     /* Build interrupt servers properties */
     for (i = 0; i < smt_threads; i++) {
         servers_prop[i] = cpu_to_be32(pc->pir + i);