qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Damien Hedde <damien.hedde@greensocs.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>, qemu-devel@nongnu.org
Cc: edgar.iglesias@xilinx.com, peter.maydell@linaro.org,
	alistair@alistair23.me, mark.burton@greensocs.com,
	saipava@xilinx.com, qemu-arm@nongnu.org, pbonzini@redhat.com,
	luc.michel@greensocs.com
Subject: Re: [Qemu-devel] [Qemu-arm] [RFC PATCH 2/6] qdev: add power/clock gating control on bus tree
Date: Thu, 2 Aug 2018 13:07:04 +0200	[thread overview]
Message-ID: <4210d2d7-1ad5-ccc6-d2ab-1a633e1f12e4@greensocs.com> (raw)
In-Reply-To: <155529c9-2847-0f30-9277-6b2c8bb31b78@amsat.org>

Hi,

On 07/27/2018 06:39 PM, Philippe Mathieu-Daudé wrote:
> Hi Damien,
> 
> On 07/27/2018 11:37 AM, Damien Hedde wrote:
>> Add functions [qdev|qbus]_set_[power|clock]_all(_fn).
>> Theses allow to control power and clock gating along a bus hierarchy.
>>
>> Signed-off-by: Damien Hedde <damien.hedde@greensocs.com>
>> ---
>>  include/hw/qdev-core.h | 20 +++++++++++++++++
>>  hw/core/qdev.c         | 51 ++++++++++++++++++++++++++++++++++++++++++
>>  2 files changed, 71 insertions(+)
>>
>> diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
>> index 659287e185..607c367738 100644
>> --- a/include/hw/qdev-core.h
>> +++ b/include/hw/qdev-core.h
>> @@ -464,4 +464,24 @@ void device_set_power(DeviceState *dev, bool en);
>>   */
>>  void device_set_clock(DeviceState *dev, bool en);
>>  
>> +/**
>> + * qdev/qbus_set_power_all(_fn)
>> + * Enable/Disable the power of a tree starting
>> + * at given device or bus
>> + */
>> +void qdev_set_power_all(DeviceState *dev, bool en);
>> +void qdev_set_power_all_fn(void *opaque, bool en);
>> +void qbus_set_power_all(BusState *bus, bool en);
>> +void qbus_set_power_all_fn(void *opaque, bool en);
> 
> I think we don't need the _fn() functions, most of the current codebase
> directly use DEVICE(x) or BUS(x) to casts.

Ok, I will remove them.

> 
>> +
>> +/**
>> + * qdev/qbus_set_clock_all(_fn)
>> + * Enable/Disable the clock of a tree starting
>> + * at given device or bus
>> + */
>> +void qdev_set_clock_all(DeviceState *dev, bool en);
>> +void qdev_set_clock_all_fn(void *opaque, bool en);
>> +void qbus_set_clock_all(BusState *bus, bool en);
>> +void qbus_set_clock_all_fn(void *opaque, bool en);
>> +
>>  #endif
>> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
>> index bb6d36eab9..24b90bd45f 100644
>> --- a/hw/core/qdev.c
>> +++ b/hw/core/qdev.c
>> @@ -1138,6 +1138,57 @@ void device_set_clock(DeviceState *dev, bool en)
>>      }
>>  }
>>  
>> +static int qdev_set_power_one(DeviceState *dev, void *opaque)
>> +{
>> +    device_set_power(dev, *((bool *)opaque));
>> +    return 0;
>> +}
>> +
>> +void qdev_set_power_all(DeviceState *dev, bool en)
>> +{
>> +    qdev_walk_children(dev, NULL, NULL, qdev_set_power_one, NULL, &en);
>> +}
>> +
>> +void qdev_set_power_all_fn(void *opaque, bool en)
>> +{
>> +    qdev_set_power_all(DEVICE(opaque), en);
>> +}
>> +
>> +void qbus_set_power_all(BusState *bus, bool en)
>> +{
>> +    qbus_walk_children(bus, NULL, NULL, qdev_set_power_one, NULL, &en);
>> +}
>> +
>> +void qbus_set_power_all_fn(void *opaque, bool en)
>> +{
>> +    qbus_set_power_all(BUS(opaque), en);
>> +}
>> +
>> +static int qdev_set_clock_one(DeviceState *dev, void *opaque)
>> +{
>> +    device_set_clock(dev, *((bool *)opaque));
>> +    return 0;
>> +}
>> +
>> +void qdev_set_clock_all(DeviceState *dev, bool en)
>> +{
>> +    qdev_walk_children(dev, NULL, NULL, qdev_set_clock_one, NULL, &en);
>> +}
>> +
>> +void qdev_set_clock_all_fn(void *opaque, bool en)
>> +{
>> +    qdev_set_clock_all(DEVICE(opaque), en);
>> +}
>> +
>> +void qbus_set_clock_all(BusState *bus, bool en)
>> +{
>> +    qbus_walk_children(bus, NULL, NULL, qdev_set_clock_one, NULL, &en);
>> +}
>> +
>> +void qbus_set_clock_all_fn(void *opaque, bool en)
>> +{
>> +    qbus_set_clock_all(BUS(opaque), en);
>> +}
>>  
>>  Object *qdev_get_machine(void)
>>  {
>>
> 

  reply	other threads:[~2018-08-02 11:07 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-27 14:37 [Qemu-devel] [RFC PATCH 0/6] Clock and power gating support Damien Hedde
2018-07-27 14:37 ` [Qemu-devel] [RFC PATCH 1/6] qdev: add a power and clock " Damien Hedde
     [not found]   ` <994d20ce-5332-b0db-aac0-bc906ef12fdb@amsat.org>
2018-07-31 10:35     ` Damien Hedde
2018-07-27 14:37 ` [Qemu-devel] [RFC PATCH 2/6] qdev: add power/clock gating control on bus tree Damien Hedde
2018-07-27 16:39   ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2018-08-02 11:07     ` Damien Hedde [this message]
2018-07-27 14:37 ` [Qemu-devel] [RFC PATCH 3/6] sysbus: Specialize gating_update to enable/disable memory regions Damien Hedde
2018-07-27 16:43   ` Philippe Mathieu-Daudé
2018-07-27 14:37 ` [Qemu-devel] [RFC PATCH 4/6] cadence_uart: add clock/power gating support Damien Hedde
2018-07-27 17:13   ` Philippe Mathieu-Daudé
2018-07-27 14:37 ` [Qemu-devel] [RFC PATCH 5/6] zynq_slcr: add uart clock gating and soft reset support Damien Hedde
2018-07-27 14:37 ` [Qemu-devel] [RFC PATCH 6/6] xilinx_zynq: add uart clock gating support Damien Hedde
2018-07-27 14:59 ` [Qemu-devel] [RFC PATCH 0/6] Clock and power " Peter Maydell
2018-07-27 15:12   ` KONRAD Frederic
2018-07-30 13:17     ` Mark Burton

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=4210d2d7-1ad5-ccc6-d2ab-1a633e1f12e4@greensocs.com \
    --to=damien.hedde@greensocs.com \
    --cc=alistair@alistair23.me \
    --cc=edgar.iglesias@xilinx.com \
    --cc=f4bug@amsat.org \
    --cc=luc.michel@greensocs.com \
    --cc=mark.burton@greensocs.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=saipava@xilinx.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).