From: Michael Roth <mdroth@linux.vnet.ibm.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: aik@ozlabs.ru, qemu-devel@nongnu.org, agraf@suse.de,
ncmike@ncultra.org, qemu-ppc@nongnu.org,
tyreld@linux.vnet.ibm.com, bharata.rao@gmail.com,
nfont@linux.vnet.ibm.com
Subject: Re: [Qemu-devel] [PATCH v4 03/17] spapr_rtas: add get/set-power-level RTAS interfaces
Date: Tue, 27 Jan 2015 15:36:58 -0600 [thread overview]
Message-ID: <20150127213658.28073.58588@loki> (raw)
In-Reply-To: <20150127052411.GC28888@voom.redhat.com>
Quoting David Gibson (2015-01-26 23:24:11)
> On Sun, Jan 25, 2015 at 11:21:26PM -0600, Michael Roth wrote:
> > Quoting David Gibson (2015-01-16 00:21:55)
> > > On Tue, Dec 23, 2014 at 06:30:17AM -0600, Michael Roth wrote:
> > > > From: Nathan Fontenot <nfont@linux.vnet.ibm.com>
> > > >
> > > > Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
> > > > Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
> > > > ---
> > > > hw/ppc/spapr_rtas.c | 25 +++++++++++++++++++++++++
> > > > 1 file changed, 25 insertions(+)
> > > >
> > > > diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
> > > > index 2ec2a8e..a2fb533 100644
> > > > --- a/hw/ppc/spapr_rtas.c
> > > > +++ b/hw/ppc/spapr_rtas.c
> > > > @@ -290,6 +290,27 @@ 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)
> > > > +{
> > > > + /* we currently only use a single, "live insert" powerdomain for
> > > > + * hotplugged/dlpar'd resources, so the power is always live/full (100)
> > > > + */
> > >
> > > Even so, you should at least validate the number of args and rets, and
> > > preferably check that the user isn't attempt to set something for some
> > > other, non-existent power domain.
> > >
> > > > + 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)
> > > > +{
> > > > + rtas_st(rets, 0, RTAS_OUT_SUCCESS);
> > > > + rtas_st(rets, 1, 100);
> > > > +}
> > > > +
> > > > static struct rtas_call {
> > > > const char *name;
> > > > spapr_rtas_fn fn;
> > > > @@ -419,6 +440,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)
> > >
> > > This code should probably go in spapr_drc.c. The idea that spapr_rtas
> > > was just the RTAS dispatch code, and RTAS functions that had no other
> > > home. Generally RTAS functions should live with the devices they're
> > > connected to.
> >
> > In this particular case the calls act on a "power domain" which isn't
> > actually modeled in QEMU (we just assume a single "live-insertion" domain
> > which just magically does everything we want), so I think it makes
> > sense to leave these here.
>
> Yeah, fair enough.
Hmm, looking at it again, set-indicator and get-sensor-state aren't actually
specific to DR, but might be extended to handle a number of other types of
sensors in the future ("Reset Component", "Error Log", and "Global Interrupt
Queue Control" may be interesting in this regard).
So it looks like only configure-connector is specifically for DR. Still
planning on moving it to spapr_drc_rtas.c, unless you'd prefer not to
at this point (it'll be lonely for the foreseable future).
>
> > But for the others it does make sense to tie them with spapr_drc.c, or
> > maybe spapr_drc_rtas.c to maintain the encapsulation of DRC state behind
> > well-defined accessors.
>
> Ok.
>
> --
> David Gibson | I'll have my music baroque, and my code
> david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
> | _way_ _around_!
> http://www.ozlabs.org/~dgibson
next prev parent reply other threads:[~2015-01-27 21:37 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-23 12:30 [Qemu-devel] [PATCH v4 00/17] spapr: add support for pci hotplug Michael Roth
2014-12-23 12:30 ` [Qemu-devel] [PATCH v4 01/17] docs: add sPAPR hotplug/dynamic-reconfiguration documentation Michael Roth
2015-01-16 5:28 ` David Gibson
2014-12-23 12:30 ` [Qemu-devel] [PATCH v4 02/17] spapr_drc: initial implementation of sPAPRDRConnector device Michael Roth
2015-01-02 10:32 ` Bharata B Rao
2015-01-26 4:56 ` Michael Roth
2015-01-16 6:19 ` David Gibson
2015-01-26 4:01 ` Michael Roth
2014-12-23 12:30 ` [Qemu-devel] [PATCH v4 03/17] spapr_rtas: add get/set-power-level RTAS interfaces Michael Roth
2015-01-16 6:21 ` David Gibson
2015-01-26 5:21 ` Michael Roth
2015-01-27 5:24 ` David Gibson
2015-01-27 21:36 ` Michael Roth [this message]
2015-01-27 22:05 ` Tyrel Datwyler
2015-01-28 0:42 ` Michael Roth
2015-02-09 16:29 ` Nathan Fontenot
2014-12-23 12:30 ` [Qemu-devel] [PATCH v4 04/17] spapr_rtas: add set-indicator RTAS interface Michael Roth
2015-01-16 6:25 ` David Gibson
2014-12-23 12:30 ` [Qemu-devel] [PATCH v4 05/17] spapr_rtas: add get-sensor-state " Michael Roth
2015-01-16 6:28 ` David Gibson
2014-12-23 12:30 ` [Qemu-devel] [PATCH v4 06/17] spapr: add rtas_st_buffer_direct() helper Michael Roth
2015-01-19 3:25 ` David Gibson
2014-12-23 12:30 ` [Qemu-devel] [PATCH v4 07/17] spapr_rtas: add ibm, configure-connector RTAS interface Michael Roth
2015-01-19 3:44 ` David Gibson
2014-12-23 12:30 ` [Qemu-devel] [PATCH v4 08/17] spapr_events: re-use EPOW event infrastructure for hotplug events Michael Roth
2015-01-19 4:31 ` David Gibson
2015-01-26 16:56 ` Michael Roth
2015-01-27 5:27 ` David Gibson
2015-01-28 3:56 ` Bharata B Rao
2014-12-23 12:30 ` [Qemu-devel] [PATCH v4 09/17] spapr_events: event-scan RTAS interface Michael Roth
2015-01-19 4:34 ` David Gibson
2014-12-23 12:30 ` [Qemu-devel] [PATCH v4 10/17] spapr_drc: add spapr_drc_populate_dt() Michael Roth
2015-01-19 5:15 ` David Gibson
2015-01-26 20:35 ` Michael Roth
2015-01-27 5:30 ` David Gibson
2014-12-23 12:30 ` [Qemu-devel] [PATCH v4 11/17] spapr: introduce pseries-2.3 machine type Michael Roth
2015-01-19 5:16 ` David Gibson
2014-12-23 12:30 ` [Qemu-devel] [PATCH v4 12/17] spapr_pci: add dynamic-reconfiguration option for spapr-pci-host-bridge Michael Roth
2015-01-19 5:18 ` David Gibson
2014-12-23 12:30 ` [Qemu-devel] [PATCH v4 13/17] spapr_pci: create DRConnectors for each PCI slot during PHB realize Michael Roth
2015-01-19 5:20 ` David Gibson
2014-12-23 12:30 ` [Qemu-devel] [PATCH v4 14/17] spapr_pci: populate DRC dt entries for PHBs Michael Roth
2015-01-19 5:22 ` David Gibson
2015-01-26 20:44 ` Michael Roth
2014-12-23 12:30 ` [Qemu-devel] [PATCH v4 15/17] pci: make pci_bar useable outside pci.c Michael Roth
2015-01-19 5:24 ` David Gibson
2014-12-23 12:30 ` [Qemu-devel] [PATCH v4 16/17] spapr_pci: enable basic hotplug operations Michael Roth
2015-01-19 5:58 ` David Gibson
2015-01-26 21:17 ` Michael Roth
2015-01-27 5:37 ` David Gibson
2015-01-23 5:17 ` Alexey Kardashevskiy
2015-01-26 21:20 ` Michael Roth
2014-12-23 12:30 ` [Qemu-devel] [PATCH v4 17/17] spapr_pci: emit hotplug add/remove events during hotplug Michael Roth
2015-01-19 6:00 ` David Gibson
2015-01-26 21:32 ` Michael Roth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150127213658.28073.58588@loki \
--to=mdroth@linux.vnet.ibm.com \
--cc=agraf@suse.de \
--cc=aik@ozlabs.ru \
--cc=bharata.rao@gmail.com \
--cc=david@gibson.dropbear.id.au \
--cc=ncmike@ncultra.org \
--cc=nfont@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=tyreld@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).