From: Ani Sinha <anisinha@redhat.com>
To: liu.xuemei1@zte.com.cn
Cc: Michael Tsirkin <mst@redhat.com>,
Igor Mammedov <imammedo@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
palmer@dabbelt.com, Alistair Francis <alistair.francis@wdc.com>,
liwei1518@gmail.com, dbarboza@ventanamicro.com,
zhiwei_liu@linux.alibaba.com, sunilvl@ventanamicro.com,
qemu-riscv@nongnu.org, qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [PATCH v6 RESEND 3/4] hw/riscv/virt: add system_powerdown hmp command support
Date: Thu, 19 Mar 2026 12:56:58 +0530 [thread overview]
Message-ID: <495B8049-E563-41C2-8B53-D965517C7284@redhat.com> (raw)
In-Reply-To: <20260319110646912lfH-Px_D4YbtX1Q7ZRSXc@zte.com.cn>
> On 19 Mar 2026, at 8:36 AM, liu.xuemei1@zte.com.cn wrote:
>
> From: Xuemei Liu <liu.xuemei1@zte.com.cn>
>
> For riscv virt machine, add powerdown notification callback
> and send ACPI_POWER_DOWN_STATUS event by acpi ged. Also add
> acpi dsdt table for ACPI_POWER_BUTTON_DEVICE device in this
> patch.
>
> Signed-off-by: Xuemei Liu <liu.xuemei1@zte.com.cn>
Reviewed-by: Ani Sinha <anisinha@redhat.com>
> ---
> hw/riscv/virt-acpi-build.c | 2 ++
> hw/riscv/virt.c | 14 ++++++++++++++
> include/hw/riscv/virt.h | 1 +
> 3 files changed, 17 insertions(+)
>
> diff --git a/hw/riscv/virt-acpi-build.c b/hw/riscv/virt-acpi-build.c
> index 1717b1c24f..77aea55ece 100644
> --- a/hw/riscv/virt-acpi-build.c
> +++ b/hw/riscv/virt-acpi-build.c
> @@ -504,6 +504,8 @@ static void build_dsdt(GArray *table_data,
> ACPI_GED_IRQ, AML_SYSTEM_MEMORY,
> s->memmap[VIRT_ACPI_GED].base);
>
> + acpi_dsdt_add_power_button(scope);
> +
> aml_append(dsdt, scope);
>
> /* copy AML table into ACPI tables blob and patch header there */
> diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
> index 4f1654d5ec..20002c6e43 100644
> --- a/hw/riscv/virt.c
> +++ b/hw/riscv/virt.c
> @@ -51,6 +51,7 @@
> #include "system/kvm.h"
> #include "system/tpm.h"
> #include "system/qtest.h"
> +#include "system/runstate.h"
> #include "hw/pci/pci.h"
> #include "hw/pci-host/gpex.h"
> #include "hw/display/ramfb.h"
> @@ -1446,6 +1447,16 @@ static void virt_build_smbios(RISCVVirtState *s)
> }
> }
>
> +static void virt_powerdown_req(Notifier *notifier, void *opaque)
> +{
> + RISCVVirtState *s;
> +
> + s = container_of(notifier, RISCVVirtState, powerdown_notifier);
> + if (s->acpi_ged) {
> + acpi_send_event(s->acpi_ged, ACPI_POWER_DOWN_STATUS);
> + }
> +}
> +
> static void virt_machine_done(Notifier *notifier, void *data)
> {
> RISCVVirtState *s = container_of(notifier, RISCVVirtState,
> @@ -1773,6 +1784,9 @@ static void virt_machine_init(MachineState *machine)
> sysbus_realize_and_unref(SYS_BUS_DEVICE(iommu_sys), &error_fatal);
> }
>
> + s->powerdown_notifier.notify = virt_powerdown_req;
> + qemu_register_powerdown_notifier(&s->powerdown_notifier);
> +
> s->machine_done.notify = virt_machine_done;
> qemu_add_machine_init_done_notifier(&s->machine_done);
> }
> diff --git a/include/hw/riscv/virt.h b/include/hw/riscv/virt.h
> index 9ea0b3b7b6..e631d57268 100644
> --- a/include/hw/riscv/virt.h
> +++ b/include/hw/riscv/virt.h
> @@ -47,6 +47,7 @@ struct RISCVVirtState {
>
> /*< public >*/
> Notifier machine_done;
> + Notifier powerdown_notifier;
> DeviceState *acpi_ged;
> DeviceState *platform_bus_dev;
> RISCVHartArrayState soc[VIRT_SOCKETS_MAX];
> --
> 2.27.0
>
next prev parent reply other threads:[~2026-03-19 7:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-19 3:00 [PATCH v6 RESEND 0/4] hw/riscv/virt: Add acpi ged and powerdown support liu.xuemei1
2026-03-19 3:02 ` [PATCH v6 RESEND 1/4] tests/acpi: virt: allow DSDT acpi table changes liu.xuemei1
2026-03-19 3:04 ` [PATCH v6 RESEND 2/4] hw/riscv/virt: Add acpi ged support liu.xuemei1
2026-03-19 3:06 ` [PATCH v6 RESEND 3/4] hw/riscv/virt: add system_powerdown hmp command support liu.xuemei1
2026-03-19 7:26 ` Ani Sinha [this message]
2026-03-19 3:08 ` [PATCH v6 RESEND 4/4] tests/acpi: Add acpi ged and power button in DSDT for RISC-V liu.xuemei1
2026-03-22 15:42 ` [PATCH v6 RESEND 0/4] hw/riscv/virt: Add acpi ged and powerdown support Anup Patel
2026-03-23 1:34 ` liu.xuemei1
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=495B8049-E563-41C2-8B53-D965517C7284@redhat.com \
--to=anisinha@redhat.com \
--cc=alistair.francis@wdc.com \
--cc=dbarboza@ventanamicro.com \
--cc=imammedo@redhat.com \
--cc=liu.xuemei1@zte.com.cn \
--cc=liwei1518@gmail.com \
--cc=mst@redhat.com \
--cc=palmer@dabbelt.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=sunilvl@ventanamicro.com \
--cc=zhiwei_liu@linux.alibaba.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