Message ID | 20240712120247.477133-16-npiggin@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | ppc/pnv: Better big-core model, lpar-per-core, PC unit | expand |
On 7/12/24 14:02, Nicholas Piggin wrote: > Big-core implementation is complete, so expose it as a machine > property that may be set with big-core=on option on powernv9 and > powernv10 machines. > > Signed-off-by: Nicholas Piggin <npiggin@gmail.com> > --- > hw/ppc/pnv.c | 62 +++++++++++++++++++++++++++++++++++------------ > hw/ppc/pnv_core.c | 2 +- > 2 files changed, 47 insertions(+), 17 deletions(-) > > diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c > index 24f7c007ce..e405d416ff 100644 > --- a/hw/ppc/pnv.c > +++ b/hw/ppc/pnv.c > @@ -2338,6 +2338,7 @@ static void pnv_chip_core_realize(PnvChip *chip, Error **errp) > &error_abort); > > pnv_core->tod_state.big_core_quirk = pmc->quirk_tb_big_core; > + pnv_core->big_core = chip->big_core; This can be dropped with the previous change. > qdev_realize(DEVICE(pnv_core), NULL, &error_fatal); > > @@ -2578,6 +2579,34 @@ static int pnv10_xive_match_nvt(XiveFabric *xfb, uint8_t format, > return total_count; > } > > +static bool pnv_machine_get_big_core(Object *obj, Error **errp) > +{ > + PnvMachineState *pnv = PNV_MACHINE(obj); > + return pnv->big_core; > +} > + > +static void pnv_machine_set_big_core(Object *obj, bool value, Error **errp) > +{ > + PnvMachineState *pnv = PNV_MACHINE(obj); > + pnv->big_core = value; > +} > + > +static bool pnv_machine_get_hb(Object *obj, Error **errp) > +{ > + PnvMachineState *pnv = PNV_MACHINE(obj); > + > + return !!pnv->fw_load_addr; > +} > + > +static void pnv_machine_set_hb(Object *obj, bool value, Error **errp) > +{ > + PnvMachineState *pnv = PNV_MACHINE(obj); > + > + if (value) { > + pnv->fw_load_addr = 0x8000000; > + } > +} > + > static void pnv_machine_power8_class_init(ObjectClass *oc, void *data) > { > MachineClass *mc = MACHINE_CLASS(oc); > @@ -2629,6 +2658,12 @@ static void pnv_machine_power9_class_init(ObjectClass *oc, void *data) > pmc->dt_power_mgt = pnv_dt_power_mgt; > > machine_class_allow_dynamic_sysbus_dev(mc, TYPE_PNV_PHB); > + > + object_class_property_add_bool(oc, "big-core", > + pnv_machine_get_big_core, > + pnv_machine_set_big_core); > + object_class_property_set_description(oc, "big-core", > + "Use big-core (aka fused-core) mode"); > } > > static void pnv_machine_p10_common_class_init(ObjectClass *oc, void *data) > @@ -2665,6 +2700,17 @@ static void pnv_machine_power10_class_init(ObjectClass *oc, void *data) > > pnv_machine_p10_common_class_init(oc, data); > mc->desc = "IBM PowerNV (Non-Virtualized) POWER10"; > + > + /* > + * This is the parent of POWER10 Rainier class, so properies go here > + * rather than common init (which would add them to both parent and > + * child which is invalid). > + */ > + object_class_property_add_bool(oc, "big-core", > + pnv_machine_get_big_core, > + pnv_machine_set_big_core); > + object_class_property_set_description(oc, "big-core", > + "Use big-core (aka fused-core) mode"); > } > > static void pnv_machine_p10_rainier_class_init(ObjectClass *oc, void *data) > @@ -2677,22 +2723,6 @@ static void pnv_machine_p10_rainier_class_init(ObjectClass *oc, void *data) > pmc->i2c_init = pnv_rainier_i2c_init; > } > > -static bool pnv_machine_get_hb(Object *obj, Error **errp) > -{ > - PnvMachineState *pnv = PNV_MACHINE(obj); > - > - return !!pnv->fw_load_addr; > -} > - > -static void pnv_machine_set_hb(Object *obj, bool value, Error **errp) > -{ > - PnvMachineState *pnv = PNV_MACHINE(obj); > - > - if (value) { > - pnv->fw_load_addr = 0x8000000; > - } > -} > - > static void pnv_cpu_do_nmi_on_cpu(CPUState *cs, run_on_cpu_data arg) > { > CPUPPCState *env = cpu_env(cs); > diff --git a/hw/ppc/pnv_core.c b/hw/ppc/pnv_core.c > index a96ec4e2b9..238a4cd4ab 100644 > --- a/hw/ppc/pnv_core.c > +++ b/hw/ppc/pnv_core.c > @@ -296,7 +296,7 @@ static void pnv_core_realize(DeviceState *dev, Error **errp) > obj = object_new(typename); > cpu = POWERPC_CPU(obj); > > - pc->threads[i] = POWERPC_CPU(obj); > + pc->threads[i] = cpu; > if (cc->nr_threads > 1) { > cpu->env.has_smt_siblings = true; > } Superfluous change ? Thanks, C.
On Sat Jul 13, 2024 at 5:24 PM AEST, Cédric Le Goater wrote: > On 7/12/24 14:02, Nicholas Piggin wrote: > > Big-core implementation is complete, so expose it as a machine > > property that may be set with big-core=on option on powernv9 and > > powernv10 machines. > > > > Signed-off-by: Nicholas Piggin <npiggin@gmail.com> > > --- > > hw/ppc/pnv.c | 62 +++++++++++++++++++++++++++++++++++------------ > > hw/ppc/pnv_core.c | 2 +- > > 2 files changed, 47 insertions(+), 17 deletions(-) > > > > diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c > > index 24f7c007ce..e405d416ff 100644 > > --- a/hw/ppc/pnv.c > > +++ b/hw/ppc/pnv.c > > @@ -2338,6 +2338,7 @@ static void pnv_chip_core_realize(PnvChip *chip, Error **errp) > > &error_abort); > > > > pnv_core->tod_state.big_core_quirk = pmc->quirk_tb_big_core; > > + pnv_core->big_core = chip->big_core; > > > This can be dropped with the previous change. Sounds good, hopefully I can get it to work :P > > > qdev_realize(DEVICE(pnv_core), NULL, &error_fatal); > > > > @@ -2578,6 +2579,34 @@ static int pnv10_xive_match_nvt(XiveFabric *xfb, uint8_t format, > > return total_count; > > } > > > > +static bool pnv_machine_get_big_core(Object *obj, Error **errp) > > +{ > > + PnvMachineState *pnv = PNV_MACHINE(obj); > > + return pnv->big_core; > > +} > > + > > +static void pnv_machine_set_big_core(Object *obj, bool value, Error **errp) > > +{ > > + PnvMachineState *pnv = PNV_MACHINE(obj); > > + pnv->big_core = value; > > +} > > + > > +static bool pnv_machine_get_hb(Object *obj, Error **errp) > > +{ > > + PnvMachineState *pnv = PNV_MACHINE(obj); > > + > > + return !!pnv->fw_load_addr; > > +} > > + > > +static void pnv_machine_set_hb(Object *obj, bool value, Error **errp) > > +{ > > + PnvMachineState *pnv = PNV_MACHINE(obj); > > + > > + if (value) { > > + pnv->fw_load_addr = 0x8000000; > > + } > > +} > > + > > static void pnv_machine_power8_class_init(ObjectClass *oc, void *data) > > { > > MachineClass *mc = MACHINE_CLASS(oc); > > @@ -2629,6 +2658,12 @@ static void pnv_machine_power9_class_init(ObjectClass *oc, void *data) > > pmc->dt_power_mgt = pnv_dt_power_mgt; > > > > machine_class_allow_dynamic_sysbus_dev(mc, TYPE_PNV_PHB); > > + > > + object_class_property_add_bool(oc, "big-core", > > + pnv_machine_get_big_core, > > + pnv_machine_set_big_core); > > + object_class_property_set_description(oc, "big-core", > > + "Use big-core (aka fused-core) mode"); > > } > > > > static void pnv_machine_p10_common_class_init(ObjectClass *oc, void *data) > > @@ -2665,6 +2700,17 @@ static void pnv_machine_power10_class_init(ObjectClass *oc, void *data) > > > > pnv_machine_p10_common_class_init(oc, data); > > mc->desc = "IBM PowerNV (Non-Virtualized) POWER10"; > > + > > + /* > > + * This is the parent of POWER10 Rainier class, so properies go here > > + * rather than common init (which would add them to both parent and > > + * child which is invalid). > > + */ > > + object_class_property_add_bool(oc, "big-core", > > + pnv_machine_get_big_core, > > + pnv_machine_set_big_core); > > + object_class_property_set_description(oc, "big-core", > > + "Use big-core (aka fused-core) mode"); > > } > > > > static void pnv_machine_p10_rainier_class_init(ObjectClass *oc, void *data) > > @@ -2677,22 +2723,6 @@ static void pnv_machine_p10_rainier_class_init(ObjectClass *oc, void *data) > > pmc->i2c_init = pnv_rainier_i2c_init; > > } > > > > -static bool pnv_machine_get_hb(Object *obj, Error **errp) > > -{ > > - PnvMachineState *pnv = PNV_MACHINE(obj); > > - > > - return !!pnv->fw_load_addr; > > -} > > - > > -static void pnv_machine_set_hb(Object *obj, bool value, Error **errp) > > -{ > > - PnvMachineState *pnv = PNV_MACHINE(obj); > > - > > - if (value) { > > - pnv->fw_load_addr = 0x8000000; > > - } > > -} > > - > > static void pnv_cpu_do_nmi_on_cpu(CPUState *cs, run_on_cpu_data arg) > > { > > CPUPPCState *env = cpu_env(cs); > > diff --git a/hw/ppc/pnv_core.c b/hw/ppc/pnv_core.c > > index a96ec4e2b9..238a4cd4ab 100644 > > --- a/hw/ppc/pnv_core.c > > +++ b/hw/ppc/pnv_core.c > > @@ -296,7 +296,7 @@ static void pnv_core_realize(DeviceState *dev, Error **errp) > > obj = object_new(typename); > > cpu = POWERPC_CPU(obj); > > > > - pc->threads[i] = POWERPC_CPU(obj); > > + pc->threads[i] = cpu; > > if (cc->nr_threads > 1) { > > cpu->env.has_smt_siblings = true; > > } > > Superfluous change ? Yup, snuck in. Good catch. Thanks, Nick
diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 24f7c007ce..e405d416ff 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -2338,6 +2338,7 @@ static void pnv_chip_core_realize(PnvChip *chip, Error **errp) &error_abort); pnv_core->tod_state.big_core_quirk = pmc->quirk_tb_big_core; + pnv_core->big_core = chip->big_core; qdev_realize(DEVICE(pnv_core), NULL, &error_fatal); @@ -2578,6 +2579,34 @@ static int pnv10_xive_match_nvt(XiveFabric *xfb, uint8_t format, return total_count; } +static bool pnv_machine_get_big_core(Object *obj, Error **errp) +{ + PnvMachineState *pnv = PNV_MACHINE(obj); + return pnv->big_core; +} + +static void pnv_machine_set_big_core(Object *obj, bool value, Error **errp) +{ + PnvMachineState *pnv = PNV_MACHINE(obj); + pnv->big_core = value; +} + +static bool pnv_machine_get_hb(Object *obj, Error **errp) +{ + PnvMachineState *pnv = PNV_MACHINE(obj); + + return !!pnv->fw_load_addr; +} + +static void pnv_machine_set_hb(Object *obj, bool value, Error **errp) +{ + PnvMachineState *pnv = PNV_MACHINE(obj); + + if (value) { + pnv->fw_load_addr = 0x8000000; + } +} + static void pnv_machine_power8_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); @@ -2629,6 +2658,12 @@ static void pnv_machine_power9_class_init(ObjectClass *oc, void *data) pmc->dt_power_mgt = pnv_dt_power_mgt; machine_class_allow_dynamic_sysbus_dev(mc, TYPE_PNV_PHB); + + object_class_property_add_bool(oc, "big-core", + pnv_machine_get_big_core, + pnv_machine_set_big_core); + object_class_property_set_description(oc, "big-core", + "Use big-core (aka fused-core) mode"); } static void pnv_machine_p10_common_class_init(ObjectClass *oc, void *data) @@ -2665,6 +2700,17 @@ static void pnv_machine_power10_class_init(ObjectClass *oc, void *data) pnv_machine_p10_common_class_init(oc, data); mc->desc = "IBM PowerNV (Non-Virtualized) POWER10"; + + /* + * This is the parent of POWER10 Rainier class, so properies go here + * rather than common init (which would add them to both parent and + * child which is invalid). + */ + object_class_property_add_bool(oc, "big-core", + pnv_machine_get_big_core, + pnv_machine_set_big_core); + object_class_property_set_description(oc, "big-core", + "Use big-core (aka fused-core) mode"); } static void pnv_machine_p10_rainier_class_init(ObjectClass *oc, void *data) @@ -2677,22 +2723,6 @@ static void pnv_machine_p10_rainier_class_init(ObjectClass *oc, void *data) pmc->i2c_init = pnv_rainier_i2c_init; } -static bool pnv_machine_get_hb(Object *obj, Error **errp) -{ - PnvMachineState *pnv = PNV_MACHINE(obj); - - return !!pnv->fw_load_addr; -} - -static void pnv_machine_set_hb(Object *obj, bool value, Error **errp) -{ - PnvMachineState *pnv = PNV_MACHINE(obj); - - if (value) { - pnv->fw_load_addr = 0x8000000; - } -} - static void pnv_cpu_do_nmi_on_cpu(CPUState *cs, run_on_cpu_data arg) { CPUPPCState *env = cpu_env(cs); diff --git a/hw/ppc/pnv_core.c b/hw/ppc/pnv_core.c index a96ec4e2b9..238a4cd4ab 100644 --- a/hw/ppc/pnv_core.c +++ b/hw/ppc/pnv_core.c @@ -296,7 +296,7 @@ static void pnv_core_realize(DeviceState *dev, Error **errp) obj = object_new(typename); cpu = POWERPC_CPU(obj); - pc->threads[i] = POWERPC_CPU(obj); + pc->threads[i] = cpu; if (cc->nr_threads > 1) { cpu->env.has_smt_siblings = true; }
Big-core implementation is complete, so expose it as a machine property that may be set with big-core=on option on powernv9 and powernv10 machines. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> --- hw/ppc/pnv.c | 62 +++++++++++++++++++++++++++++++++++------------ hw/ppc/pnv_core.c | 2 +- 2 files changed, 47 insertions(+), 17 deletions(-)