From: Annie Li <annie.li@oracle.com>
To: qemu-devel@nongnu.org
Cc: dave@treblig.org, mst@redhat.com, imammedo@redhat.com,
anisinha@redhat.com, eduardo@habkost.net,
marcel.apfelbaum@gmail.com, philmd@linaro.org,
wangyanan55@huawei.com, zhao1.liu@intel.com, pbonzini@redhat.com,
richard.henderson@linaro.org, slp@redhat.com, eblake@redhat.com,
armbru@redhat.com, annie.li@oracle.com, miguel.luis@oracle.com
Subject: [PATCH 01/13] acpi: Implement control method sleep button
Date: Wed, 28 May 2025 12:38:34 -0400 [thread overview]
Message-ID: <20250528163835.2151-1-annie.li@oracle.com> (raw)
In-Reply-To: <20250528163545.2143-1-annie.li@oracle.com>
The fixed hardware sleep button isn't appropriate for hardware
reduced platform. This patch implements the control method sleep
button in a separate source file so that the button can be added
for various platforms.
Co-developed-by: Miguel Luis <miguel.luis@oracle.com>
Signed-off-by: Annie Li <annie.li@oracle.com>
---
hw/acpi/control_method_device.c | 38 +++++++++++++++++++++++++
hw/acpi/meson.build | 1 +
include/hw/acpi/control_method_device.h | 21 ++++++++++++++
3 files changed, 60 insertions(+)
diff --git a/hw/acpi/control_method_device.c b/hw/acpi/control_method_device.c
new file mode 100644
index 0000000000..f8d691ee04
--- /dev/null
+++ b/hw/acpi/control_method_device.c
@@ -0,0 +1,38 @@
+/*
+ * Control Method Device
+ *
+ * Copyright (c) 2023 Oracle and/or its affiliates.
+ *
+ *
+ * Authors:
+ * Annie Li <annie.li@oracle.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "hw/acpi/control_method_device.h"
+#include "hw/acpi/aml-build.h"
+
+/*
+ * The control method sleep button[ACPI v6.5 Section 4.8.2.2.2.2]
+ * resides in generic hardware address spaces. The sleep button
+ * is defined as _HID("PNP0C0E") that associates with device "SLPB".
+ */
+void acpi_dsdt_add_sleep_button(Aml *scope)
+{
+ Aml *dev = aml_device(ACPI_SLEEP_BUTTON_DEVICE);
+ aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C0E")));
+ /*
+ * No _PRW, the sleep button device is always tied to GPE L07
+ * event handler for x86 platform, or a GED event for other
+ * platforms such as virt, ARM, microvm, etc.
+ */
+ aml_append(dev, aml_operation_region("\\SLP", AML_SYSTEM_IO,
+ aml_int(0x201), 0x1));
+ Aml *field = aml_field("\\SLP", AML_BYTE_ACC, AML_NOLOCK,
+ AML_WRITE_AS_ZEROS);
+ aml_append(field, aml_named_field("SBP", 1));
+ aml_append(dev, field);
+ aml_append(scope, dev);
+}
diff --git a/hw/acpi/meson.build b/hw/acpi/meson.build
index 73f02b9691..a62e625cef 100644
--- a/hw/acpi/meson.build
+++ b/hw/acpi/meson.build
@@ -17,6 +17,7 @@ acpi_ss.add(when: 'CONFIG_ACPI_CXL', if_true: files('cxl.c'), if_false: files('c
acpi_ss.add(when: 'CONFIG_ACPI_VMGENID', if_true: files('vmgenid.c'))
acpi_ss.add(when: 'CONFIG_ACPI_VMCLOCK', if_true: files('vmclock.c'))
acpi_ss.add(when: 'CONFIG_ACPI_HW_REDUCED', if_true: files('generic_event_device.c'))
+acpi_ss.add(when: 'CONFIG_ACPI_HW_REDUCED', if_true: files('control_method_device.c'))
acpi_ss.add(when: 'CONFIG_ACPI_HMAT', if_true: files('hmat.c'))
acpi_ss.add(when: 'CONFIG_ACPI_APEI', if_true: files('ghes.c'), if_false: files('ghes-stub.c'))
acpi_ss.add(when: 'CONFIG_ACPI_PIIX4', if_true: files('piix4.c'))
diff --git a/include/hw/acpi/control_method_device.h b/include/hw/acpi/control_method_device.h
new file mode 100644
index 0000000000..079f1a74dd
--- /dev/null
+++ b/include/hw/acpi/control_method_device.h
@@ -0,0 +1,21 @@
+/*
+ * Control Method Device
+ *
+ * Copyright (c) 2023 Oracle and/or its affiliates.
+ *
+ *
+ * Authors:
+ * Annie Li <annie.li@oracle.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+
+#ifndef HW_ACPI_CONTROL_METHOD_DEVICE_H
+#define HW_ACPI_CONTROL_NETHOD_DEVICE_H
+
+#define ACPI_SLEEP_BUTTON_DEVICE "SLPB"
+
+void acpi_dsdt_add_sleep_button(Aml *scope);
+
+#endif
--
2.43.5
next prev parent reply other threads:[~2025-05-28 16:44 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-28 16:35 [PATCH 00/13] Support ACPI Control Method Sleep button Annie Li
2025-05-28 16:38 ` Annie Li [this message]
2025-06-03 12:31 ` [PATCH 01/13] acpi: Implement control method sleep button Igor Mammedov
2025-06-03 19:08 ` Annie Li
2025-08-11 11:58 ` Igor Mammedov
2025-05-28 16:38 ` [PATCH 02/13] test/acpi: allow DSDT table changes for x86 platform Annie Li
2025-05-28 16:39 ` [PATCH 03/13] acpi: Support Control Method sleep button for x86 Annie Li
2025-06-03 12:52 ` Igor Mammedov
2025-06-03 19:19 ` Annie Li
2025-05-28 16:39 ` [PATCH 04/13] tests/qtest/bios-table-tests: Update ACPI table binaries " Annie Li
2025-05-28 16:39 ` [PATCH 05/13] acpi: Send the GPE event of sleep " Annie Li
2025-06-03 12:34 ` Igor Mammedov
2025-06-03 19:21 ` Annie Li
2025-05-28 16:40 ` [PATCH 06/13] test/acpi: allow DSDT table changes for microvm Annie Li
2025-05-28 16:40 ` [PATCH 07/13] microvm: Add ACPI Control Method Sleep Button Annie Li
2025-05-28 16:40 ` [PATCH 08/13] hw/acpi: Add ACPI GED support for the sleep event Annie Li
2025-05-28 16:41 ` [PATCH 09/13] microvm: enable sleep GED event Annie Li
2025-05-28 16:41 ` [PATCH 10/13] tests/qtest/bios-table-tests: Update ACPI table binaries for microvm Annie Li
2025-05-28 16:41 ` [PATCH 11/13] microvm: suspend the system as requested Annie Li
2025-05-28 16:42 ` [PATCH 12/13] microvm: enable suspend Annie Li
2025-06-03 13:03 ` Igor Mammedov
2025-06-03 19:22 ` Annie Li
2025-08-11 12:06 ` Igor Mammedov
2025-05-28 16:42 ` [PATCH 13/13] acpi: hmp/qmp: Add hmp/qmp support for system_sleep Annie Li
2025-06-02 9:32 ` Markus Armbruster
2025-06-02 14:22 ` Annie Li
2025-06-03 12:18 ` [PATCH 00/13] Support ACPI Control Method Sleep button Igor Mammedov
2025-06-03 19:23 ` Annie Li
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=20250528163835.2151-1-annie.li@oracle.com \
--to=annie.li@oracle.com \
--cc=anisinha@redhat.com \
--cc=armbru@redhat.com \
--cc=dave@treblig.org \
--cc=eblake@redhat.com \
--cc=eduardo@habkost.net \
--cc=imammedo@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=miguel.luis@oracle.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=slp@redhat.com \
--cc=wangyanan55@huawei.com \
--cc=zhao1.liu@intel.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).