From nobody Tue Feb 10 13:36:46 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=zte.com.cn Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770604086829855.1317093730985; Sun, 8 Feb 2026 18:28:06 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vpH09-0005iC-TD; Sun, 08 Feb 2026 21:27:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vpH07-0005hy-Qk; Sun, 08 Feb 2026 21:27:47 -0500 Received: from mxct.zte.com.cn ([183.62.165.209]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vpH05-0007jZ-U9; Sun, 08 Feb 2026 21:27:47 -0500 Received: from mse-fl1.zte.com.cn (unknown [10.5.228.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mxct.zte.com.cn (FangMail) with ESMTPS id 4f8TB43SSnz4xQXL; Mon, 09 Feb 2026 10:27:40 +0800 (CST) Received: from xaxapp02.zte.com.cn ([10.88.97.241]) by mse-fl1.zte.com.cn with SMTP id 6192RZ1N094434; Mon, 9 Feb 2026 10:27:35 +0800 (+08) (envelope-from liu.xuemei1@zte.com.cn) Received: from mapi (xaxapp05[null]) by mapi (Zmail) with MAPI id mid32; Mon, 9 Feb 2026 10:27:36 +0800 (CST) X-Zmail-TransId: 2afc69894618943-92f05 X-Mailer: Zmail v1.0 Message-ID: <20260209102736221CBEZxNNsdR5VPEunLHBLz@zte.com.cn> In-Reply-To: <20260209102128930gN_7xu7bNIZcEawnIz3c7@zte.com.cn> References: 20260209102128930gN_7xu7bNIZcEawnIz3c7@zte.com.cn Date: Mon, 9 Feb 2026 10:27:36 +0800 (CST) Mime-Version: 1.0 From: To: , , , , Cc: , , , , , , , Subject: =?UTF-8?B?W1BBVENIIHY2IDMvNF0gaHcvcmlzY3YvdmlydDogYWRkIHN5c3RlbV9wb3dlcmRvd24gaG1wIGNvbW1hbmQKCiBzdXBwb3J0?= X-MAIL: mse-fl1.zte.com.cn 6192RZ1N094434 X-TLS: YES X-SPF-DOMAIN: zte.com.cn X-ENVELOPE-SENDER: liu.xuemei1@zte.com.cn X-SPF: None X-SOURCE-IP: 10.5.228.132 unknown Mon, 09 Feb 2026 10:27:40 +0800 X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 6989461C.000/4f8TB43SSnz4xQXL Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=183.62.165.209; envelope-from=liu.xuemei1@zte.com.cn; helo=mxct.zte.com.cn X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1770604090382154100 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Xuemei Liu 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 --- 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 1d7011b952..01efbf82e5 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 =3D 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 =3D container_of(notifier, RISCVVirtState, @@ -1766,6 +1777,9 @@ static void virt_machine_init(MachineState *machine) sysbus_realize_and_unref(SYS_BUS_DEVICE(iommu_sys), &error_fatal); } + s->powerdown_notifier.notify =3D virt_powerdown_req; + qemu_register_powerdown_notifier(&s->powerdown_notifier); + s->machine_done.notify =3D 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]; --=20 2.27.0