qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
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: [RFC V3 PATCH 07/13] microvm: support control method sleep button
Date: Fri, 11 Apr 2025 16:42:35 -0400	[thread overview]
Message-ID: <20250411204236.2977-1-annie.li@oracle.com> (raw)
In-Reply-To: <20250411201912.2872-1-annie.li@oracle.com>

Add the support of control method sleep button and System
S3 Sleeping State for microvm.

Signed-off-by: Annie Li <annie.li@oracle.com>
---
 hw/i386/acpi-microvm.c                 | 11 +++++++++++
 include/hw/acpi/generic_event_device.h |  1 +
 2 files changed, 12 insertions(+)

diff --git a/hw/i386/acpi-microvm.c b/hw/i386/acpi-microvm.c
index 279da6b4aa..57c45ea327 100644
--- a/hw/i386/acpi-microvm.c
+++ b/hw/i386/acpi-microvm.c
@@ -32,6 +32,7 @@
 #include "hw/acpi/generic_event_device.h"
 #include "hw/acpi/utils.h"
 #include "hw/acpi/erst.h"
+#include "hw/acpi/control_method_device.h"
 #include "hw/i386/fw_cfg.h"
 #include "hw/i386/microvm.h"
 #include "hw/pci/pci.h"
@@ -123,12 +124,22 @@ build_dsdt_microvm(GArray *table_data, BIOSLinker *linker,
     build_ged_aml(sb_scope, GED_DEVICE, x86ms->acpi_dev,
                   GED_MMIO_IRQ, AML_SYSTEM_MEMORY, GED_MMIO_BASE);
     acpi_dsdt_add_power_button(sb_scope);
+    acpi_dsdt_add_sleep_button(sb_scope);
     acpi_dsdt_add_virtio(sb_scope, mms);
     acpi_dsdt_add_xhci(sb_scope, mms);
     acpi_dsdt_add_pci(sb_scope, mms);
     aml_append(dsdt, sb_scope);
 
     /* ACPI 5.0: Table 7-209 System State Package */
+    scope = aml_scope("\\");
+    pkg = aml_package(4);
+    aml_append(pkg, aml_int(ACPI_GED_SLP_TYP_S3));
+    aml_append(pkg, aml_int(0)); /* ignored */
+    aml_append(pkg, aml_int(0)); /* reserved */
+    aml_append(pkg, aml_int(0)); /* reserved */
+    aml_append(scope, aml_name_decl("_S3", pkg));
+    aml_append(dsdt, scope);
+
     scope = aml_scope("\\");
     pkg = aml_package(4);
     aml_append(pkg, aml_int(ACPI_GED_SLP_TYP_S5));
diff --git a/include/hw/acpi/generic_event_device.h b/include/hw/acpi/generic_event_device.h
index d2dac87b4a..28c5785863 100644
--- a/include/hw/acpi/generic_event_device.h
+++ b/include/hw/acpi/generic_event_device.h
@@ -85,6 +85,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(AcpiGedState, ACPI_GED)
 #define ACPI_GED_SLP_TYP_POS       0x2   /* SLP_TYPx Bit Offset */
 #define ACPI_GED_SLP_TYP_MASK      0x07  /* SLP_TYPx 3-bit mask */
 #define ACPI_GED_SLP_TYP_S5        0x05  /* System _S5 State (Soft Off) */
+#define ACPI_GED_SLP_TYP_S3        0x03  /* System _S3 State (Sleeping State) */
 #define ACPI_GED_SLP_EN            0x20  /* SLP_EN write-only bit */
 
 #define GED_DEVICE      "GED"
-- 
2.43.5



  parent reply	other threads:[~2025-04-11 20:43 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-11 20:19 [RFC V3 PATCH 00/13] Support ACPI Control Method Sleep button Annie Li
2025-04-11 20:28 ` [RFC V3 PATCH 01/13] acpi: Implement control method sleep button Annie Li
2025-04-17 17:28   ` Gustavo Romero
2025-04-17 18:40     ` Annie Li
2025-04-11 20:31 ` [RFC V3 PATCH 02/13] test/acpi: allow DSDT table changes for x86 platform Annie Li
2025-04-17 17:29   ` Gustavo Romero
2025-04-17 18:42     ` Annie Li
2025-04-11 20:34 ` [RFC V3 PATCH 03/13] acpi: Support Control Method sleep button for x86 Annie Li
2025-04-17 17:30   ` Gustavo Romero
2025-04-17 18:42     ` Annie Li
2025-04-11 20:39 ` [RFC V3 PATCH 04/13] tests/qtest/bios-table-tests: Update ACPI table binaries " Annie Li
2025-04-17 17:31   ` Gustavo Romero
2025-04-17 18:44     ` Annie Li
2025-04-11 20:41 ` [RFC V3 PATCH 05/13] acpi: Send the GPE event of suspend and wakeup " Annie Li
2025-04-14 15:18   ` Alex Bennée
2025-04-15  1:24     ` Annie Li
2025-04-15 15:29       ` Philippe Mathieu-Daudé
2025-04-15 21:48         ` Annie Li
2025-04-16  6:24           ` Philippe Mathieu-Daudé
2025-04-17 17:32             ` Gustavo Romero
2025-04-17 18:48               ` Annie Li
2025-04-17 17:40   ` Gustavo Romero
2025-04-17 18:46     ` Annie Li
2025-04-11 20:42 ` [RFC V3 PATCH 06/13] test/acpi: allow DSDT table changes for microvm Annie Li
2025-04-17 17:33   ` Gustavo Romero
2025-04-17 18:48     ` Annie Li
2025-04-11 20:42 ` Annie Li [this message]
2025-04-17 17:34   ` [RFC V3 PATCH 07/13] microvm: support control method sleep button Gustavo Romero
2025-04-17 18:49     ` Annie Li
2025-04-11 20:42 ` [RFC V3 PATCH 08/13] hw/acpi: Add ACPI GED support for the sleep event Annie Li
2025-04-17 17:35   ` Gustavo Romero
2025-04-11 20:43 ` [RFC V3 PATCH 09/13] microvm: enable sleep GED event Annie Li
2025-04-17 17:35   ` Gustavo Romero
2025-04-17 18:49     ` Annie Li
2025-04-11 20:44 ` [RFC V3 PATCH 10/13] tests/qtest/bios-table-tests: Update ACPI table binaries for microvm Annie Li
2025-04-17 17:36   ` Gustavo Romero
2025-04-17 18:50     ` Annie Li
2025-04-11 20:44 ` [RFC V3 PATCH 11/13] microvm: suspend the system as requested Annie Li
2025-04-17 17:37   ` Gustavo Romero
2025-04-11 20:44 ` [RFC V3 PATCH 12/13] microvm: enable suspend Annie Li
2025-04-17 17:37   ` Gustavo Romero
2025-04-11 20:45 ` [RFC V3 PATCH 13/13] acpi: hmp/qmp: Add hmp/qmp support for system_sleep Annie Li
2025-04-14  6:31   ` Markus Armbruster
2025-04-14 14:14     ` Annie Li
2025-04-17 17:37       ` Gustavo Romero
2025-04-17 18:51         ` 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=20250411204236.2977-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).