qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 0/4] Introduce a battery, AC adapter, and lid button


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH 0/4] Introduce a battery, AC adapter, and lid button
Date: Wed, 20 Jan 2021 22:52:42 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0

Hi Leonid, Marcel,

On 1/20/21 9:54 PM, Leonid Bloch wrote:
> 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.

Your series looks good. Now for this feature to be even more useful for
the community, it would be better to

1/ Have a generic (kind of abstract QDev) battery model.
   Your model would be the ISA implementation. But we could add LPC,
   SPI or I2C implementations for example.

2/ Make it a model backend accepting various kind of frontends:
   - host Linux sysfs mirroring is a particular frontend implementation
   - mirroring on Windows would be another
   - any connection (TCP) to battery simulator (Octave, ...)

Meanwhile 2/ is not available, it would be useful to have QMP commands
to set the battery charge and state (also max capacity).

Ditto QMP command to set the LID/AC adapter state.

> 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.
[...]

In patch #2 you comment 'if a "fake" host battery is to be provided,
a 'sysfs_path' property allows to override the default one.'.

Eventually you'd provide a such fake file as example, ideally used
by a QTest.

Another question. If the battery is disconnected, is there an event
propagated to the guest?

Thanks for contributing these patches :)

Phil.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]