mbox series

[RFC,00/11] Support ACPI Control Method Sleep button

Message ID 20231205002143.562-1-annie.li@oracle.com
Headers show
Series Support ACPI Control Method Sleep button | expand

Message

Annie Li Dec. 5, 2023, 12:21 a.m. UTC
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 different architectures since the code can be shared among
them.

This patch set implements Control Method Sleep button for both x86
and ARM platform.

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 6.6.0-rc2+, and Windows Server 2016,
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:

[ 268.429495] evregion-0119 ev_address_space_dispa: ----Entry
[ 268.430480] evrgnini-0043 ev_system_memory_regio: ----Entry
[ 268.431423] evrgnini-0079 ev_system_memory_regio: ----Exit- AE_OK
[ 268.432303] evregion-0230 ev_address_space_dispa: Handler 0000000081544775 (@00000000e8f0a66d) Address 0000000009080000 [SystemMemory]
[ 268.433943] evregion-0325 ev_address_space_dispa: ----Exit- AE_OK
[ 268.434793]   evmisc-0132 ev_queue_notify_reques: Dispatching Notify on [SLPB] (Device) Value 0x80 (Status Change) Node 00000000ada658b8

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.2dd133be@redhat.com/T/#mfe24f89778020deeacfe45083f3eea3cf9f55961

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/bios-tables-test: 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               |  49 ++++++++++++++++++
 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       |  20 +++++++
 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/pc/DSDT                       | Bin 6830 -> 7012 bytes
 tests/data/acpi/pc/DSDT.acpierst              | Bin 6741 -> 6923 bytes
 tests/data/acpi/pc/DSDT.acpihmat              | Bin 8155 -> 8337 bytes
 tests/data/acpi/pc/DSDT.bridge                | Bin 13701 -> 13883 bytes
 tests/data/acpi/pc/DSDT.cphp                  | Bin 7294 -> 7476 bytes
 tests/data/acpi/pc/DSDT.dimmpxm               | Bin 8484 -> 8666 bytes
 tests/data/acpi/pc/DSDT.hpbridge              | Bin 6781 -> 6963 bytes
 tests/data/acpi/pc/DSDT.hpbrroot              | Bin 3337 -> 3519 bytes
 tests/data/acpi/pc/DSDT.ipmikcs               | Bin 6902 -> 7084 bytes
 tests/data/acpi/pc/DSDT.memhp                 | Bin 8189 -> 8371 bytes
 tests/data/acpi/pc/DSDT.nohpet                | Bin 6688 -> 6870 bytes
 tests/data/acpi/pc/DSDT.numamem               | Bin 6836 -> 7018 bytes
 tests/data/acpi/pc/DSDT.roothp                | Bin 10623 -> 10805 bytes
 tests/data/acpi/q35/DSDT                      | Bin 8355 -> 8537 bytes
 tests/data/acpi/q35/DSDT.acpierst             | Bin 8372 -> 8554 bytes
 tests/data/acpi/q35/DSDT.acpihmat             | Bin 9680 -> 9862 bytes
 tests/data/acpi/q35/DSDT.acpihmat-noinitiator | Bin 8634 -> 8816 bytes
 tests/data/acpi/q35/DSDT.applesmc             | Bin 8401 -> 8583 bytes
 tests/data/acpi/q35/DSDT.bridge               | Bin 11968 -> 12150 bytes
 tests/data/acpi/q35/DSDT.core-count           | Bin 12913 -> 13095 bytes
 tests/data/acpi/q35/DSDT.core-count2          | Bin 33770 -> 33952 bytes
 tests/data/acpi/q35/DSDT.cphp                 | Bin 8819 -> 9001 bytes
 tests/data/acpi/q35/DSDT.cxl                  | Bin 9713 -> 9895 bytes
 tests/data/acpi/q35/DSDT.dimmpxm              | Bin 10009 -> 10191 bytes
 tests/data/acpi/q35/DSDT.ipmibt               | Bin 8430 -> 8612 bytes
 tests/data/acpi/q35/DSDT.ipmismbus            | Bin 8443 -> 8625 bytes
 tests/data/acpi/q35/DSDT.ivrs                 | Bin 8372 -> 8554 bytes
 tests/data/acpi/q35/DSDT.memhp                | Bin 9714 -> 9896 bytes
 tests/data/acpi/q35/DSDT.mmio64               | Bin 9485 -> 9667 bytes
 tests/data/acpi/q35/DSDT.multi-bridge         | Bin 13208 -> 13390 bytes
 tests/data/acpi/q35/DSDT.noacpihp             | Bin 8235 -> 8417 bytes
 tests/data/acpi/q35/DSDT.nohpet               | Bin 8213 -> 8395 bytes
 tests/data/acpi/q35/DSDT.numamem              | Bin 8361 -> 8543 bytes
 tests/data/acpi/q35/DSDT.pvpanic-isa          | Bin 8456 -> 8638 bytes
 tests/data/acpi/q35/DSDT.thread-count         | Bin 12913 -> 13095 bytes
 tests/data/acpi/q35/DSDT.thread-count2        | Bin 33770 -> 33952 bytes
 tests/data/acpi/q35/DSDT.tis.tpm12            | Bin 8961 -> 9143 bytes
 tests/data/acpi/q35/DSDT.tis.tpm2             | Bin 8987 -> 9169 bytes
 tests/data/acpi/q35/DSDT.type4-count          | Bin 18589 -> 18771 bytes
 tests/data/acpi/q35/DSDT.viot                 | Bin 9464 -> 9646 bytes
 tests/data/acpi/q35/DSDT.xapic                | Bin 35718 -> 35900 bytes
 tests/data/acpi/virt/DSDT                     | Bin 5196 -> 5278 bytes
 tests/data/acpi/virt/DSDT.acpihmatvirt        | Bin 5282 -> 5364 bytes
 tests/data/acpi/virt/DSDT.memhp               | Bin 6557 -> 6639 bytes
 tests/data/acpi/virt/DSDT.pxb                 | Bin 7679 -> 7761 bytes
 tests/data/acpi/virt/DSDT.topology            | Bin 5398 -> 5480 bytes
 tests/data/acpi/virt/FACP                     | Bin 276 -> 276 bytes
 65 files changed, 181 insertions(+), 5 deletions(-)
 create mode 100644 hw/acpi/control_method_device.c
 create mode 100644 include/hw/acpi/control_method_device.h