qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Maxim Uvarov <maxim.uvarov@linaro.org>
Cc: "Andrew Jones" <drjones@redhat.com>,
	"Jose Marinho" <Jose.Marinho@arm.com>,
	"QEMU Developers" <qemu-devel@nongnu.org>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	tf-a@lists.trustedfirmware.org, qemu-arm <qemu-arm@nongnu.org>
Subject: Re: [PATCHv7 1/3] hw: gpio: implement gpio-pwr driver for qemu reset/poweroff
Date: Tue, 19 Jan 2021 11:36:51 +0000	[thread overview]
Message-ID: <CAFEAcA_OuwCT6w8LrxfiY1856UAOG4smL0jr2CrhrVETLhHz9Q@mail.gmail.com> (raw)
In-Reply-To: <20210115101126.4259-2-maxim.uvarov@linaro.org>

On Fri, 15 Jan 2021 at 10:11, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:
>
> Implement gpio-pwr driver to allow reboot and poweroff machine.
> This is simple driver with just 2 gpios lines. Current use case
> is to reboot and poweroff virt machine in secure mode. Secure
> pl066 gpio chip is needed for that.
>
> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
> Reviewed-by: Hao Wu <wuhaotsh@google.com>
> ---
>  hw/gpio/Kconfig     |  3 ++
>  hw/gpio/gpio_pwr.c  | 70 +++++++++++++++++++++++++++++++++++++++++++++
>  hw/gpio/meson.build |  1 +
>  3 files changed, 74 insertions(+)
>  create mode 100644 hw/gpio/gpio_pwr.c

> +/*
> + * QEMU interface:
> + * two named input GPIO lines:
> + *   'reset' : when asserted, trigger system reset
> + *   'shutdown' : when asserted, trigger system shutdown
> + */

The comment says we perform the actions when the lines are
asserted...

> +static void gpio_pwr_reset(void *opaque, int n, int level)
> +{
> +    if (!level) {
> +        qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
> +    }
> +}
> +
> +static void gpio_pwr_shutdown(void *opaque, int n, int level)
> +{
> +    if (!level) {
> +        qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
> +    }
> +}

...but the code performs the actions when the lines
are de-asserted, ie when they go to 0. I think the code
should be "if (level)".

thanks
-- PMM


  reply	other threads:[~2021-01-19 11:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-15 10:11 [PATCHv7 0/3] arm-virt: add secure pl061 for reset/power down Maxim Uvarov
2021-01-15 10:11 ` [PATCHv7 1/3] hw: gpio: implement gpio-pwr driver for qemu reset/poweroff Maxim Uvarov
2021-01-19 11:36   ` Peter Maydell [this message]
2021-01-15 10:11 ` [PATCHv7 2/3] arm-virt: refactor gpios creation Maxim Uvarov
2021-01-19 11:39   ` Peter Maydell
2021-01-15 10:11 ` [PATCHv7 3/3] arm-virt: add secure pl061 for reset/power down Maxim Uvarov
2021-01-19 13:07   ` Peter Maydell
2021-01-19 13:47     ` Maxim Uvarov
2021-01-19 14:12       ` Peter Maydell

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=CAFEAcA_OuwCT6w8LrxfiY1856UAOG4smL0jr2CrhrVETLhHz9Q@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=Jose.Marinho@arm.com \
    --cc=drjones@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=maxim.uvarov@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=tf-a@lists.trustedfirmware.org \
    /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).