On Tue, 2019-02-26 at 14:59 +1100, David Gibson wrote: > On Tue, Feb 26, 2019 at 02:05:31PM +1100, Suraj Jitindar Singh wrote: > > Enable the large decrementer by default on POWER9 cpu models. The > > default value applied is that provided in the cpu class. > > > > Signed-off-by: Suraj Jitindar Singh <sjitindarsi...@gmail.com> > > --- > > hw/ppc/spapr_caps.c | 7 +++++++ > > 1 file changed, 7 insertions(+) > > > > diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c > > index e07568fb94..f48aa367e3 100644 > > --- a/hw/ppc/spapr_caps.c > > +++ b/hw/ppc/spapr_caps.c > > @@ -566,11 +566,18 @@ sPAPRCapabilityInfo > > capability_table[SPAPR_CAP_NUM] = { > > static sPAPRCapabilities default_caps_with_cpu(sPAPRMachineState > > *spapr, > > const char > > *cputype) > > { > > + PowerPCCPUClass *pcc = > > POWERPC_CPU_CLASS(object_class_by_name(cputype)); > > sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr); > > sPAPRCapabilities caps; > > > > caps = smc->default_caps; > > > > + caps.caps[SPAPR_CAP_LARGE_DECREMENTER] = pcc->hdecr_bits; > > So, the rule with default_caps_with_cpu() is that it can reduce the > value from the machine-global default, but never increase it (because > that could change guest visible behaviour for existing machine > versions). > > I think the line above will do that.
Yep > > > + if (!ppc_type_check_compat(cputype, CPU_POWERPC_LOGICAL_3_00, > > + 0, spapr->max_compat_pvr)) { > > + caps.caps[SPAPR_CAP_LARGE_DECREMENTER] = 0; > > And this part I think is redundant, because hdecr_bits won't be large > for anything pre-POWER9. > > > + } > > + > > if (!ppc_type_check_compat(cputype, CPU_POWERPC_LOGICAL_2_07, > > 0, spapr->max_compat_pvr)) { > > caps.caps[SPAPR_CAP_HTM] = SPAPR_CAP_OFF; > >