From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Bernhard Beschow <shentey@gmail.com>, qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
Paolo Bonzini <pbonzini@redhat.com>,
qemu-ppc@nongnu.org, qemu-arm@nongnu.org
Subject: Re: [PATCH v2 2/2] hw/ppc/e500: Reuse TYPE_GPIO_PWR
Date: Mon, 7 Oct 2024 18:13:22 -0300 [thread overview]
Message-ID: <d094728d-a7bd-4e16-b3c1-82065ca9bf08@linaro.org> (raw)
In-Reply-To: <20241005100228.28094-3-shentey@gmail.com>
On 5/10/24 07:02, Bernhard Beschow wrote:
> Taking inspiration from the ARM virt machine, port away from
> qemu_allocate_irq() by reusing TYPE_GPIO_PWR.
>
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
> hw/ppc/e500.c | 16 ++++------------
> hw/ppc/Kconfig | 1 +
> 2 files changed, 5 insertions(+), 12 deletions(-)
> @@ -892,13 +890,6 @@ static DeviceState *ppce500_init_mpic(PPCE500MachineState *pms,
> return dev;
> }
>
> -static void ppce500_power_off(void *opaque, int line, int on)
> -{
> - if (on) {
> - qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
> - }
> -}
> -
> void ppce500_init(MachineState *machine)
> {
> MemoryRegion *address_space_mem = get_system_memory();
> @@ -1086,7 +1077,7 @@ void ppce500_init(MachineState *machine)
> sysbus_create_simple("e500-spin", pmc->spin_base, NULL);
>
> if (pmc->has_mpc8xxx_gpio) {
> - qemu_irq poweroff_irq;
> + DeviceState *gpio_pwr_dev;
Can we keep a reference in PPCE500MachineState?
Otherwise,
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>
> dev = qdev_new("mpc8xxx_gpio");
> s = SYS_BUS_DEVICE(dev);
> @@ -1096,8 +1087,9 @@ void ppce500_init(MachineState *machine)
> sysbus_mmio_get_region(s, 0));
>
> /* Power Off GPIO at Pin 0 */
> - poweroff_irq = qemu_allocate_irq(ppce500_power_off, NULL, 0);
> - qdev_connect_gpio_out(dev, 0, poweroff_irq);
> + gpio_pwr_dev = sysbus_create_simple("gpio-pwr", -1, NULL);
> + qdev_connect_gpio_out(dev, 0, qdev_get_gpio_in_named(gpio_pwr_dev,
> + "shutdown", 0));
> }
next prev parent reply other threads:[~2024-10-07 21:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-05 10:02 [PATCH v2 0/2] Reuse TYPE_GPIO_PWR in ppce500 machine Bernhard Beschow
2024-10-05 10:02 ` [PATCH v2 1/2] MAINTAINERS: Add hw/gpio/gpio_pwr.c Bernhard Beschow
2024-10-05 10:02 ` [PATCH v2 2/2] hw/ppc/e500: Reuse TYPE_GPIO_PWR Bernhard Beschow
2024-10-07 21:13 ` Philippe Mathieu-Daudé [this message]
2024-10-12 13:41 ` Bernhard Beschow
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=d094728d-a7bd-4e16-b3c1-82065ca9bf08@linaro.org \
--to=philmd@linaro.org \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=shentey@gmail.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).