[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 21/40] spapr_rtas: add get/set-power-level RTAS interfa
From: |
Alexander Graf |
Subject: |
[Qemu-ppc] [PULL 21/40] spapr_rtas: add get/set-power-level RTAS interfaces |
Date: |
Wed, 3 Jun 2015 23:45:22 +0200 |
From: Nathan Fontenot <address@hidden>
These interfaces manage the power domains that guest devices are
assigned to and are used to power on/off devices. Currently we
only utilize 1 power domain, the 'live-insertion' domain, which
automates power management of plugged/unplugged devices, essentially
making these calls no-ops, but the RTAS interfaces are still required
by guest hotplug code and PAPR+.
See docs/specs/ppc-spapr-hotplug.txt for a complete description of
these interfaces.
Signed-off-by: Nathan Fontenot <address@hidden>
Signed-off-by: Michael Roth <address@hidden>
Reviewed-by: David Gibson <address@hidden>
Signed-off-by: David Gibson <address@hidden>
Signed-off-by: Alexander Graf <address@hidden>
---
hw/ppc/spapr_rtas.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)
diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
index 0f1ae55..d7694cd 100644
--- a/hw/ppc/spapr_rtas.c
+++ b/hw/ppc/spapr_rtas.c
@@ -245,6 +245,56 @@ static void rtas_ibm_os_term(PowerPCCPU *cpu,
rtas_st(rets, 0, ret);
}
+static void rtas_set_power_level(PowerPCCPU *cpu, sPAPREnvironment *spapr,
+ uint32_t token, uint32_t nargs,
+ target_ulong args, uint32_t nret,
+ target_ulong rets)
+{
+ int32_t power_domain;
+
+ if (nargs != 2 || nret != 2) {
+ rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR);
+ return;
+ }
+
+ /* we currently only use a single, "live insert" powerdomain for
+ * hotplugged/dlpar'd resources, so the power is always live/full (100)
+ */
+ power_domain = rtas_ld(args, 0);
+ if (power_domain != -1) {
+ rtas_st(rets, 0, RTAS_OUT_NOT_SUPPORTED);
+ return;
+ }
+
+ rtas_st(rets, 0, RTAS_OUT_SUCCESS);
+ rtas_st(rets, 1, 100);
+}
+
+static void rtas_get_power_level(PowerPCCPU *cpu, sPAPREnvironment *spapr,
+ uint32_t token, uint32_t nargs,
+ target_ulong args, uint32_t nret,
+ target_ulong rets)
+{
+ int32_t power_domain;
+
+ if (nargs != 1 || nret != 2) {
+ rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR);
+ return;
+ }
+
+ /* we currently only use a single, "live insert" powerdomain for
+ * hotplugged/dlpar'd resources, so the power is always live/full (100)
+ */
+ power_domain = rtas_ld(args, 0);
+ if (power_domain != -1) {
+ rtas_st(rets, 0, RTAS_OUT_NOT_SUPPORTED);
+ return;
+ }
+
+ rtas_st(rets, 0, RTAS_OUT_SUCCESS);
+ rtas_st(rets, 1, 100);
+}
+
static struct rtas_call {
const char *name;
spapr_rtas_fn fn;
@@ -370,6 +420,10 @@ static void core_rtas_register_types(void)
rtas_ibm_set_system_parameter);
spapr_rtas_register(RTAS_IBM_OS_TERM, "ibm,os-term",
rtas_ibm_os_term);
+ spapr_rtas_register(RTAS_SET_POWER_LEVEL, "set-power-level",
+ rtas_set_power_level);
+ spapr_rtas_register(RTAS_GET_POWER_LEVEL, "get-power-level",
+ rtas_get_power_level);
}
type_init(core_rtas_register_types)
--
1.8.1.4
- [Qemu-ppc] [PULL 23/40] spapr_rtas: add get-sensor-state RTAS interface, (continued)
- [Qemu-ppc] [PULL 23/40] spapr_rtas: add get-sensor-state RTAS interface, Alexander Graf, 2015/06/03
- [Qemu-ppc] [PULL 31/40] pci: make pci_bar useable outside pci.c, Alexander Graf, 2015/06/03
- [Qemu-ppc] [PULL 01/40] macio: Convert to realize(), Alexander Graf, 2015/06/03
- [Qemu-ppc] [PULL 18/40] hw/ppc/spapr: Use error_report() instead of hw_error(), Alexander Graf, 2015/06/03
- [Qemu-ppc] [PULL 10/40] spapr_iommu: Add separate trace points for PCI DMA operations, Alexander Graf, 2015/06/03
- [Qemu-ppc] [PULL 30/40] spapr_pci: create DRConnectors for each PCI slot during PHB realize, Alexander Graf, 2015/06/03
- [Qemu-ppc] [PULL 14/40] spapr_iommu: Give unique QOM name to TCE table, Alexander Graf, 2015/06/03
- [Qemu-ppc] [PULL 07/40] spapr_pci: Introduce a liobn number generating macros, Alexander Graf, 2015/06/03
- [Qemu-ppc] [PULL 21/40] spapr_rtas: add get/set-power-level RTAS interfaces,
Alexander Graf <=
- [Qemu-ppc] [PULL 35/40] spapr: override default ram size to 512MB, Alexander Graf, 2015/06/03
- [Qemu-ppc] [PULL 37/40] Add David Gibson for sPAPR in MAINTAINERS file, Alexander Graf, 2015/06/03
- [Qemu-ppc] [PULL 04/40] spapr_pci: Fix unsafe signed/unsigned comparisons, Alexander Graf, 2015/06/03
- [Qemu-ppc] [PULL 29/40] spapr_pci: add dynamic-reconfiguration option for spapr-pci-host-bridge, Alexander Graf, 2015/06/03
- [Qemu-ppc] [PULL 38/40] tci: do not use CPUArchState in tcg-target.h, Alexander Graf, 2015/06/03
- [Qemu-ppc] [PULL 22/40] spapr_rtas: add set-indicator RTAS interface, Alexander Graf, 2015/06/03
- [Qemu-ppc] [PULL 39/40] tcg: add TCG_TARGET_TLB_DISPLACEMENT_BITS, Alexander Graf, 2015/06/03
- [Qemu-ppc] [PULL 36/40] pseries: Enable in-kernel H_LOGICAL_CI_{LOAD, STORE} implementations, Alexander Graf, 2015/06/03
- [Qemu-ppc] [PULL 11/40] spapr_pci: Make find_phb()/find_dev() public, Alexander Graf, 2015/06/03
- [Qemu-ppc] [PULL 17/40] hw/ppc/spapr: Fix error message when firmware could not be loaded, Alexander Graf, 2015/06/03