Skip to content

Introduce a battery, AC adapter, and lid button

Leonid Bloch qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4hw/acpi: Increase the number of possible ACPI interruptshw/acpi/core.c+15 -20 replies
2/4hw/acpi: Introduce the QEMU BatteryMAINTAINERS docs/specs/battery.txt hw/acpi/Kconfig +7 more+692 -00 replies
3/4hw/acpi: Introduce the QEMU AC adapterMAINTAINERS docs/specs/acad.txt hw/acpi/Kconfig +7 more+448 -00 replies
4/4hw/acpi: Introduce the QEMU lid buttonMAINTAINERS docs/specs/button.txt hw/acpi/Kconfig +7 more+443 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/4] Introduce a battery, AC adapter, and lid button

This series introduces the following ACPI devices:

* Battery
* AC adapter
* Laptop lid button

When running QEMU on a laptop, these paravirtualized devices reflect the state of these physical devices onto the guest. This functionality is relevant not only for laptops, but also for any other device which has e.g. a battery. This even allows to insert a ``fake'' battery to the guest, in a form of a file which emulates the behavior of the actual battery in sysfs. A possible use case for such a ``fake'' battery can be limiting the budget of VM usage to a subscriber, in a naturally-visible way. But of course, the main purpose here is addressing the desktop users.

This series was tested with Windows and (desktop) Linux guests, on which indeed the battery icon appears in the corresponding state (full, charging, discharging, time remaining to empty, etc.) and the AC adapter plugging/unplugging behaves as expected. So is the laptop lid button.

For the ease of review, these commits are also available here:
https://github.com/blochl/qemu/pull/1/commits

Thanks,
Leonid.

Leonid Bloch (4):
hw/acpi: Increase the number of possible ACPI interrupts hw/acpi: Introduce the QEMU Battery
hw/acpi: Introduce the QEMU AC adapter
hw/acpi: Introduce the QEMU lid button

 MAINTAINERS                          |  15 +
 docs/specs/acad.txt                  |  24 ++
 docs/specs/battery.txt               |  23 ++
 docs/specs/button.txt                |  35 ++
 hw/acpi/Kconfig                      |  12 +
 hw/acpi/acad.c                       | 318 +++++++++++++++++
 hw/acpi/battery.c                    | 512 +++++++++++++++++++++++++++
 hw/acpi/button.c                     | 327 +++++++++++++++++
 hw/acpi/core.c                       |  17 +-
 hw/acpi/meson.build                  |   3 +
 hw/acpi/trace-events                 |  15 +
 hw/i386/Kconfig                      |   3 +
 hw/i386/acpi-build.c                 | 178 ++++++++++
 include/hw/acpi/acad.h               |  37 ++
 include/hw/acpi/acpi_dev_interface.h |   3 +
 include/hw/acpi/battery.h            |  43 +++
 include/hw/acpi/button.h             |  35 ++
 17 files changed, 1598 insertions(+), 2 deletions(-)
 create mode 100644 docs/specs/acad.txt
 create mode 100644 docs/specs/battery.txt
 create mode 100644 docs/specs/button.txt
 create mode 100644 hw/acpi/acad.c
 create mode 100644 hw/acpi/battery.c
 create mode 100644 hw/acpi/button.c
 create mode 100644 include/hw/acpi/acad.h
 create mode 100644 include/hw/acpi/battery.h
 create mode 100644 include/hw/acpi/button.h
Signature · 1 line
2.30.0