qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Annie Li <annie.li@oracle.com>
To: qemu-devel@nongnu.org, imammedo@redhat.com
Cc: annie.li@oracle.com, miguel.luis@oracle.com
Subject: [RFC PATCH 07/11] hw/acpi: Add ACPI GED support for the sleep event
Date: Tue,  5 Dec 2023 00:28:49 +0000	[thread overview]
Message-ID: <20231205002849.1691-1-annie.li@oracle.com> (raw)
In-Reply-To: <20231205002143.562-1-annie.li@oracle.com>

From: Miguel Luis <miguel.luis@oracle.com>

Add support for ACPI GED sleep event on the ACPI device interface so that
HW-reduced systems can enable guests to sleep.

Signed-off-by: Miguel Luis <miguel.luis@oracle.com>
---
 hw/acpi/generic_event_device.c         | 9 +++++++++
 include/hw/acpi/generic_event_device.h | 1 +
 2 files changed, 10 insertions(+)

diff --git a/hw/acpi/generic_event_device.c b/hw/acpi/generic_event_device.c
index a3d31631fe..97a6f82b35 100644
--- a/hw/acpi/generic_event_device.c
+++ b/hw/acpi/generic_event_device.c
@@ -13,6 +13,7 @@
 #include "qapi/error.h"
 #include "hw/acpi/acpi.h"
 #include "hw/acpi/generic_event_device.h"
+#include "hw/acpi/control_method_device.h"
 #include "hw/irq.h"
 #include "hw/mem/pc-dimm.h"
 #include "hw/mem/nvdimm.h"
@@ -25,6 +26,7 @@ static const uint32_t ged_supported_events[] = {
     ACPI_GED_MEM_HOTPLUG_EVT,
     ACPI_GED_PWR_DOWN_EVT,
     ACPI_GED_NVDIMM_HOTPLUG_EVT,
+    ACPI_GED_SLEEP_EVT,
 };
 
 /*
@@ -117,6 +119,11 @@ void build_ged_aml(Aml *table, const char *name, HotplugHandler *hotplug_dev,
                            aml_notify(aml_name("\\_SB.NVDR"),
                                       aml_int(0x80)));
                 break;
+            case ACPI_GED_SLEEP_EVT:
+                aml_append(if_ctx,
+                           aml_notify(aml_name(ACPI_SLEEP_BUTTON_DEVICE),
+                                      aml_int(0x80)));
+                break;
             default:
                 /*
                  * Please make sure all the events in ged_supported_events[]
@@ -284,6 +291,8 @@ static void acpi_ged_send_event(AcpiDeviceIf *adev, AcpiEventStatusBits ev)
         sel = ACPI_GED_MEM_HOTPLUG_EVT;
     } else if (ev & ACPI_POWER_DOWN_STATUS) {
         sel = ACPI_GED_PWR_DOWN_EVT;
+    } else if (ev & ACPI_SLEEP_STATUS) {
+        sel = ACPI_GED_SLEEP_EVT;
     } else if (ev & ACPI_NVDIMM_HOTPLUG_STATUS) {
         sel = ACPI_GED_NVDIMM_HOTPLUG_EVT;
     } else {
diff --git a/include/hw/acpi/generic_event_device.h b/include/hw/acpi/generic_event_device.h
index ba84ce0214..6186bdf368 100644
--- a/include/hw/acpi/generic_event_device.h
+++ b/include/hw/acpi/generic_event_device.h
@@ -95,6 +95,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(AcpiGedState, ACPI_GED)
 #define ACPI_GED_MEM_HOTPLUG_EVT   0x1
 #define ACPI_GED_PWR_DOWN_EVT      0x2
 #define ACPI_GED_NVDIMM_HOTPLUG_EVT 0x4
+#define ACPI_GED_SLEEP_EVT         0x8
 
 typedef struct GEDState {
     MemoryRegion evt;
-- 
2.34.3



  parent reply	other threads:[~2023-12-05  0:42 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-05  0:21 [RFC PATCH 00/11] Support ACPI Control Method Sleep button Annie Li
2023-12-05  0:23 ` [RFC PATCH 01/11] acpi: hmp/qmp: Add hmp/qmp support for system_sleep Annie Li
2023-12-05  9:44   ` Philippe Mathieu-Daudé
2023-12-05 14:43     ` Annie.li
2023-12-05 20:34   ` Markus Armbruster
2023-12-05 21:46     ` Annie.li
2023-12-22 12:37       ` Markus Armbruster
2023-12-22 18:39         ` Annie.li
2023-12-05  0:26 ` [RFC PATCH 02/11] acpi: Implement control method sleep button Annie Li
2023-12-05  0:26 ` [RFC PATCH 03/11] test/acpi: allow DSDT table changes Annie Li
2023-12-05  0:27 ` [RFC PATCH 04/11] acpi: Support Control Method sleep button for x86 Annie Li
2023-12-05  0:27 ` [RFC PATCH 05/11] tests/acpi/bios-tables-test: update DSDT tables for Control Method Sleep button Annie Li
2023-12-05  0:28 ` [RFC PATCH 06/11] acpi: Send the GPE event of suspend and wakeup for x86 Annie Li
2023-12-05  0:28 ` Annie Li [this message]
2023-12-05  0:29 ` [RFC PATCH 08/11] tests/acpi: allow FACP and DSDT table changes for arm/virt Annie Li
2023-12-05  0:29 ` [RFC PATCH 09/11] hw/arm: enable sleep support " Annie Li
2023-12-05  0:30 ` [RFC PATCH 10/11] tests/acpi: Update FACP and DSDT tables for sleep button Annie Li
2023-12-05  0:31 ` [RFC PATCH 11/11] arm/virt: enable sleep support 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=20231205002849.1691-1-annie.li@oracle.com \
    --to=annie.li@oracle.com \
    --cc=imammedo@redhat.com \
    --cc=miguel.luis@oracle.com \
    --cc=qemu-devel@nongnu.org \
    /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).