diff options
author | Greg Kurz <groug@kaod.org> | 2019-12-13 12:59:56 +0100 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2019-12-17 10:59:10 +1100 |
commit | 7a90c6a1b650e3cd6391543cdf6587c5bc9f28c1 (patch) | |
tree | 204262444461cf0ff94de8f541fc11e657d0d27a /hw/ppc/pnv.c | |
parent | d76f2da7a5b6330fba70f2c14f209de92e26abab (diff) | |
download | qemu-7a90c6a1b650e3cd6391543cdf6587c5bc9f28c1.zip qemu-7a90c6a1b650e3cd6391543cdf6587c5bc9f28c1.tar.gz qemu-7a90c6a1b650e3cd6391543cdf6587c5bc9f28c1.tar.bz2 |
ppc/pnv: Introduce PnvMachineClass::dt_power_mgt()
We add an extra node to advertise power management on some machines,
namely powernv9 and powernv10. This is achieved by using the
pnv_is_power9() and pnv_is_power10() helpers.
This can be achieved with QOM. Add a method to the base class for
powernv machines and have it implemented by machine types that
support power management instead.
Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <157623839642.360005.9243510140436689941.stgit@bahia.lan>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/ppc/pnv.c')
-rw-r--r-- | hw/ppc/pnv.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 97845e7..a2ad725 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -472,7 +472,7 @@ static void pnv_dt_isa(PnvMachineState *pnv, void *fdt) &args); } -static void pnv_dt_power_mgt(void *fdt) +static void pnv_dt_power_mgt(PnvMachineState *pnv, void *fdt) { int off; @@ -539,9 +539,9 @@ static void *pnv_dt_create(MachineState *machine) pnv_dt_bmc_sensors(pnv->bmc, fdt); } - /* Create an extra node for power management on Power9 and Power10 */ - if (pnv_is_power9(pnv) || pnv_is_power10(pnv)) { - pnv_dt_power_mgt(fdt); + /* Create an extra node for power management on machines that support it */ + if (pmc->dt_power_mgt) { + pmc->dt_power_mgt(pnv, fdt); } return fdt; @@ -1709,6 +1709,7 @@ static void pnv_machine_power9_class_init(ObjectClass *oc, void *data) pmc->compat = compat; pmc->compat_size = sizeof(compat); + pmc->dt_power_mgt = pnv_dt_power_mgt; } static void pnv_machine_power10_class_init(ObjectClass *oc, void *data) @@ -1722,6 +1723,7 @@ static void pnv_machine_power10_class_init(ObjectClass *oc, void *data) pmc->compat = compat; pmc->compat_size = sizeof(compat); + pmc->dt_power_mgt = pnv_dt_power_mgt; } static void pnv_machine_class_init(ObjectClass *oc, void *data) |