Message ID | 20240711141851.406677-7-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/11/24 16:18, Nicholas Piggin wrote: > This will allow different settings and checks for different > machine types with later changes. > > Reviewed-by: Harsh Prateek Bora <harshpb@linux.ibm.com> > Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Reviewed-by: Cédric Le Goater <clg@redhat.com> Thanks, C. > --- > include/hw/ppc/pnv.h | 1 + > hw/ppc/pnv.c | 12 +++++++++--- > 2 files changed, 10 insertions(+), 3 deletions(-) > > diff --git a/include/hw/ppc/pnv.h b/include/hw/ppc/pnv.h > index 476b136146..1993dededf 100644 > --- a/include/hw/ppc/pnv.h > +++ b/include/hw/ppc/pnv.h > @@ -76,6 +76,7 @@ struct PnvMachineClass { > /*< public >*/ > const char *compat; > int compat_size; > + int max_smt_threads; > > void (*dt_power_mgt)(PnvMachineState *pnv, void *fdt); > void (*i2c_init)(PnvMachineState *pnv); > diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c > index 3bcf11984c..4252bcd28d 100644 > --- a/hw/ppc/pnv.c > +++ b/hw/ppc/pnv.c > @@ -899,6 +899,7 @@ static void pnv_init(MachineState *machine) > PnvMachineState *pnv = PNV_MACHINE(machine); > MachineClass *mc = MACHINE_GET_CLASS(machine); > PnvMachineClass *pmc = PNV_MACHINE_GET_CLASS(machine); > + int max_smt_threads = pmc->max_smt_threads; > char *fw_filename; > long fw_size; > uint64_t chip_ram_start = 0; > @@ -997,17 +998,19 @@ static void pnv_init(MachineState *machine) > pnv->num_chips = > machine->smp.max_cpus / (machine->smp.cores * machine->smp.threads); > > - if (machine->smp.threads > 8) { > - error_report("Cannot support more than 8 threads/core " > - "on a powernv machine"); > + if (machine->smp.threads > max_smt_threads) { > + error_report("Cannot support more than %d threads/core " > + "on %s machine", max_smt_threads, mc->desc); > exit(1); > } > + > if (!is_power_of_2(machine->smp.threads)) { > error_report("Cannot support %d threads/core on a powernv" > "machine because it must be a power of 2", > machine->smp.threads); > exit(1); > } > + > /* > * TODO: should we decide on how many chips we can create based > * on #cores and Venice vs. Murano vs. Naples chip type etc..., > @@ -2491,6 +2494,7 @@ static void pnv_machine_power8_class_init(ObjectClass *oc, void *data) > > pmc->compat = compat; > pmc->compat_size = sizeof(compat); > + pmc->max_smt_threads = 8; > > machine_class_allow_dynamic_sysbus_dev(mc, TYPE_PNV_PHB); > } > @@ -2515,6 +2519,7 @@ static void pnv_machine_power9_class_init(ObjectClass *oc, void *data) > > pmc->compat = compat; > pmc->compat_size = sizeof(compat); > + pmc->max_smt_threads = 4; > pmc->dt_power_mgt = pnv_dt_power_mgt; > > machine_class_allow_dynamic_sysbus_dev(mc, TYPE_PNV_PHB); > @@ -2539,6 +2544,7 @@ static void pnv_machine_p10_common_class_init(ObjectClass *oc, void *data) > > pmc->compat = compat; > pmc->compat_size = sizeof(compat); > + pmc->max_smt_threads = 4; > pmc->dt_power_mgt = pnv_dt_power_mgt; > > xfc->match_nvt = pnv10_xive_match_nvt;
diff --git a/include/hw/ppc/pnv.h b/include/hw/ppc/pnv.h index 476b136146..1993dededf 100644 --- a/include/hw/ppc/pnv.h +++ b/include/hw/ppc/pnv.h @@ -76,6 +76,7 @@ struct PnvMachineClass { /*< public >*/ const char *compat; int compat_size; + int max_smt_threads; void (*dt_power_mgt)(PnvMachineState *pnv, void *fdt); void (*i2c_init)(PnvMachineState *pnv); diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 3bcf11984c..4252bcd28d 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -899,6 +899,7 @@ static void pnv_init(MachineState *machine) PnvMachineState *pnv = PNV_MACHINE(machine); MachineClass *mc = MACHINE_GET_CLASS(machine); PnvMachineClass *pmc = PNV_MACHINE_GET_CLASS(machine); + int max_smt_threads = pmc->max_smt_threads; char *fw_filename; long fw_size; uint64_t chip_ram_start = 0; @@ -997,17 +998,19 @@ static void pnv_init(MachineState *machine) pnv->num_chips = machine->smp.max_cpus / (machine->smp.cores * machine->smp.threads); - if (machine->smp.threads > 8) { - error_report("Cannot support more than 8 threads/core " - "on a powernv machine"); + if (machine->smp.threads > max_smt_threads) { + error_report("Cannot support more than %d threads/core " + "on %s machine", max_smt_threads, mc->desc); exit(1); } + if (!is_power_of_2(machine->smp.threads)) { error_report("Cannot support %d threads/core on a powernv" "machine because it must be a power of 2", machine->smp.threads); exit(1); } + /* * TODO: should we decide on how many chips we can create based * on #cores and Venice vs. Murano vs. Naples chip type etc..., @@ -2491,6 +2494,7 @@ static void pnv_machine_power8_class_init(ObjectClass *oc, void *data) pmc->compat = compat; pmc->compat_size = sizeof(compat); + pmc->max_smt_threads = 8; machine_class_allow_dynamic_sysbus_dev(mc, TYPE_PNV_PHB); } @@ -2515,6 +2519,7 @@ static void pnv_machine_power9_class_init(ObjectClass *oc, void *data) pmc->compat = compat; pmc->compat_size = sizeof(compat); + pmc->max_smt_threads = 4; pmc->dt_power_mgt = pnv_dt_power_mgt; machine_class_allow_dynamic_sysbus_dev(mc, TYPE_PNV_PHB); @@ -2539,6 +2544,7 @@ static void pnv_machine_p10_common_class_init(ObjectClass *oc, void *data) pmc->compat = compat; pmc->compat_size = sizeof(compat); + pmc->max_smt_threads = 4; pmc->dt_power_mgt = pnv_dt_power_mgt; xfc->match_nvt = pnv10_xive_match_nvt;