The ACPI sleep button can be implemented as a fixed hardware button
or Control Method Sleep button.

The patch of implementing a fixed hardware sleep button was posted
here 1). More discussions can be found here 2). Essentially, the
discussion mainly focuses on whether the sleep button is implemented
as a fixed hardware button or Control Method Sleep button. The latter
benefits various architectures since the code can be shared among
them.

This patch set implements Control Method Sleep button for both x86
and ARM platform.(The patch set was posted previously here 3). We
rebase all the patches on QEMU9.1.0 and re-post it).

For x86, a sleep button GPE event handler is implemented, so a GPE
event is triggered to indicate the OSPM the sleep button is pressed.
Tests have been done for Linux guest, and Windows Server guest,
the sleep button works as expected.

For ARM, a GED event is triggered to notify the OSPM. With proper
debug knobs it is possible to see the guest OSPM acknowledges the
sleep event:

(qemu) system_sleep
(qemu) [6.744138] exregion-0179 ex_system_memory_space: System-Memory (width 
32) R/W 0 Address=0000000009080000
[6.746003] evmisc-0132 ev_queue_notify_reques: Dispatching Notify on [SLPB] 
(Device) Value 0x80 (Status Change) Node 00000000f0e6819e
[6.802873] PM: suspend entry (s2idle)
[6.806201] Filesystems sync: 0.002 seconds
[6.807580] Freezing user space processes
[6.809478] Freezing user space processes completed (elapsed 0.001 seconds)
[6.810602] OOM killer disabled.
[6.811111] Freezing remaining freezable tasks
[6.812953] Freezing remaining freezable tasks completed (elapsed 0.001 seconds)
[6.814126] printk: Suspending console(s) (use no_console_suspend to debug)

But that seems to be all, depicting that sleep/wakeup for ARM is broken
and there are still missing some pieces of the puzzle.

Nonetheless, we would like to take this RFC as an opportunity for updates
on this subject as possible roadmaps.

1) https://lists.gnu.org/archive/html/qemu-devel/2017-07/msg06478.html
2) 
https://lore.kernel.org/all/20210920095316.2dd13...@redhat.com/T/#mfe24f89778020deeacfe45083f3eea3cf9f55961
3) https://lore.kernel.org/all/20231205002143.562-1-annie...@oracle.com/T/


Annie Li (6):
  acpi: hmp/qmp: Add hmp/qmp support for system_sleep
  acpi: Implement control method sleep button
  test/acpi: allow DSDT table changes
  acpi: Support Control Method sleep button for x86
  tests/acpi: Update DSDT tables for Control method sleep button
  acpi: Send the GPE event of suspend and wakeup for x86

Miguel Luis (5):
  hw/acpi: Add ACPI GED support for the sleep event
  tests/acpi: allow FACP and DSDT table changes for arm/virt
  hw/arm: enable sleep support for arm/virt
  tests/acpi: Update FACP and DSDT tables for sleep button
  arm/virt: enable sleep support

 hmp-commands.hx                               |  14 +++++
 hw/acpi/control_method_device.c               |  54 ++++++++++++++++++
 hw/acpi/core.c                                |  17 ++++--
 hw/acpi/generic_event_device.c                |   9 +++
 hw/acpi/meson.build                           |   1 +
 hw/arm/virt-acpi-build.c                      |  13 +++++
 hw/arm/virt.c                                 |  14 ++++-
 hw/core/machine-hmp-cmds.c                    |   5 ++
 hw/core/machine-qmp-cmds.c                    |  11 ++++
 hw/i386/acpi-build.c                          |   9 +++
 include/hw/acpi/acpi.h                        |   1 +
 include/hw/acpi/acpi_dev_interface.h          |   1 +
 include/hw/acpi/control_method_device.h       |  25 ++++++++
 include/hw/acpi/generic_event_device.h        |   1 +
 include/hw/arm/virt.h                         |   1 +
 include/monitor/hmp.h                         |   1 +
 qapi/machine.json                             |  18 ++++++
 qapi/pragma.json                              |   1 +
 tests/data/acpi/aarch64/virt/DSDT             | Bin 5196 -> 5278 bytes
 .../data/acpi/aarch64/virt/DSDT.acpihmatvirt  | Bin 5282 -> 5364 bytes
 tests/data/acpi/aarch64/virt/DSDT.memhp       | Bin 6557 -> 6639 bytes
 tests/data/acpi/aarch64/virt/DSDT.pxb         | Bin 7679 -> 7761 bytes
 tests/data/acpi/aarch64/virt/DSDT.topology    | Bin 5398 -> 5480 bytes
 tests/data/acpi/aarch64/virt/FACP             | Bin 276 -> 276 bytes
 tests/data/acpi/x86/pc/DSDT                   | Bin 6830 -> 7012 bytes
 tests/data/acpi/x86/pc/DSDT.acpierst          | Bin 6741 -> 6923 bytes
 tests/data/acpi/x86/pc/DSDT.acpihmat          | Bin 8155 -> 8337 bytes
 tests/data/acpi/x86/pc/DSDT.bridge            | Bin 13701 -> 13883 bytes
 tests/data/acpi/x86/pc/DSDT.cphp              | Bin 7294 -> 7476 bytes
 tests/data/acpi/x86/pc/DSDT.dimmpxm           | Bin 8484 -> 8666 bytes
 tests/data/acpi/x86/pc/DSDT.hpbridge          | Bin 6781 -> 6963 bytes
 tests/data/acpi/x86/pc/DSDT.hpbrroot          | Bin 3337 -> 3519 bytes
 tests/data/acpi/x86/pc/DSDT.ipmikcs           | Bin 6902 -> 7084 bytes
 tests/data/acpi/x86/pc/DSDT.memhp             | Bin 8189 -> 8371 bytes
 tests/data/acpi/x86/pc/DSDT.nohpet            | Bin 6688 -> 6870 bytes
 tests/data/acpi/x86/pc/DSDT.numamem           | Bin 6836 -> 7018 bytes
 tests/data/acpi/x86/pc/DSDT.roothp            | Bin 10623 -> 10805 bytes
 tests/data/acpi/x86/q35/DSDT                  | Bin 8355 -> 8537 bytes
 tests/data/acpi/x86/q35/DSDT.acpierst         | Bin 8372 -> 8554 bytes
 tests/data/acpi/x86/q35/DSDT.acpihmat         | Bin 9680 -> 9862 bytes
 .../acpi/x86/q35/DSDT.acpihmat-noinitiator    | Bin 8634 -> 8816 bytes
 tests/data/acpi/x86/q35/DSDT.applesmc         | Bin 8401 -> 8583 bytes
 tests/data/acpi/x86/q35/DSDT.bridge           | Bin 11968 -> 12150 bytes
 tests/data/acpi/x86/q35/DSDT.core-count       | Bin 12913 -> 13095 bytes
 tests/data/acpi/x86/q35/DSDT.core-count2      | Bin 33770 -> 33952 bytes
 tests/data/acpi/x86/q35/DSDT.cphp             | Bin 8819 -> 9001 bytes
 tests/data/acpi/x86/q35/DSDT.cxl              | Bin 9714 -> 9896 bytes
 tests/data/acpi/x86/q35/DSDT.dimmpxm          | Bin 10009 -> 10191 bytes
 tests/data/acpi/x86/q35/DSDT.ipmibt           | Bin 8430 -> 8612 bytes
 tests/data/acpi/x86/q35/DSDT.ipmismbus        | Bin 8443 -> 8625 bytes
 tests/data/acpi/x86/q35/DSDT.ivrs             | Bin 8372 -> 8554 bytes
 tests/data/acpi/x86/q35/DSDT.memhp            | Bin 9714 -> 9896 bytes
 tests/data/acpi/x86/q35/DSDT.mmio64           | Bin 9485 -> 9667 bytes
 tests/data/acpi/x86/q35/DSDT.multi-bridge     | Bin 13208 -> 13390 bytes
 tests/data/acpi/x86/q35/DSDT.noacpihp         | Bin 8235 -> 8417 bytes
 tests/data/acpi/x86/q35/DSDT.nohpet           | Bin 8213 -> 8395 bytes
 tests/data/acpi/x86/q35/DSDT.numamem          | Bin 8361 -> 8543 bytes
 tests/data/acpi/x86/q35/DSDT.pvpanic-isa      | Bin 8456 -> 8638 bytes
 tests/data/acpi/x86/q35/DSDT.thread-count     | Bin 12913 -> 13095 bytes
 tests/data/acpi/x86/q35/DSDT.thread-count2    | Bin 33770 -> 33952 bytes
 tests/data/acpi/x86/q35/DSDT.tis.tpm12        | Bin 8961 -> 9143 bytes
 tests/data/acpi/x86/q35/DSDT.tis.tpm2         | Bin 8987 -> 9169 bytes
 tests/data/acpi/x86/q35/DSDT.type4-count      | Bin 18589 -> 18771 bytes
 tests/data/acpi/x86/q35/DSDT.viot             | Bin 9464 -> 9646 bytes
 tests/data/acpi/x86/q35/DSDT.xapic            | Bin 35718 -> 35900 bytes
 65 files changed, 191 insertions(+), 5 deletions(-)
 create mode 100644 hw/acpi/control_method_device.c
 create mode 100644 include/hw/acpi/control_method_device.h

-- 
2.43.5


Reply via email to