[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCHv7 1/3] hw: gpio: implement gpio-pwr driver for qemu reset/pow
From: |
Peter Maydell |
Subject: |
Re: [PATCHv7 1/3] hw: gpio: implement gpio-pwr driver for qemu reset/poweroff |
Date: |
Tue, 19 Jan 2021 11:36:51 +0000 |
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