From: Gustavo Romero <gustavo.romero@linaro.org>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Annie Li" <annie.li@oracle.com>,
"Alex Bennée" <alex.bennee@linaro.org>
Cc: qemu-devel@nongnu.org, dave@treblig.org, mst@redhat.com,
imammedo@redhat.com, anisinha@redhat.com, eduardo@habkost.net,
marcel.apfelbaum@gmail.com, wangyanan55@huawei.com,
zhao1.liu@intel.com, pbonzini@redhat.com,
richard.henderson@linaro.org, slp@redhat.com, eblake@redhat.com,
armbru@redhat.com, miguel.luis@oracle.com
Subject: Re: [RFC V3 PATCH 05/13] acpi: Send the GPE event of suspend and wakeup for x86
Date: Thu, 17 Apr 2025 14:32:56 -0300 [thread overview]
Message-ID: <a7240b57-6f86-4172-9607-7324dd1b13a3@linaro.org> (raw)
In-Reply-To: <8e48b403-6f30-415d-b8e1-30fc772f1d7d@linaro.org>
Hi Annie,
On 4/16/25 03:24, Philippe Mathieu-Daudé wrote:
> On 15/4/25 23:48, Annie Li wrote:
>>
>> On 4/15/2025 11:29 AM, Philippe Mathieu-Daudé wrote:
>>> Hi Annie,
>>>
>>> On 15/4/25 03:24, Annie Li wrote:
>>>>
>>>> On 4/14/2025 11:18 AM, Alex Bennée wrote:
>>>>> Annie Li <annie.li@oracle.com> writes:
>>>>>
>>>>>> The GPE event is triggered to notify x86 guest to suppend
>>>>>> itself. The function acpi_send_sleep_event will also
>>>>>> trigger GED events on HW-reduced systems where ACPI GED
>>>>>> sleep event is supported.
>>>>>>
>>>>>> Signed-off-by: Annie Li <annie.li@oracle.com>
>>>>>> ---
>>>>>> hw/acpi/core.c | 10 ++++++++++
>>>>>> include/hw/acpi/acpi.h | 1 +
>>>>>> include/hw/acpi/acpi_dev_interface.h | 1 +
>>>>>> 3 files changed, 12 insertions(+)
>>>>>>
>>>>>> diff --git a/hw/acpi/core.c b/hw/acpi/core.c
>>>>>> index 58f8964e13..00a9d226f0 100644
>>>>>> --- a/hw/acpi/core.c
>>>>>> +++ b/hw/acpi/core.c
>>>>>> @@ -359,6 +359,16 @@ int acpi_get_slic_oem(AcpiSlicOem *oem)
>>>>>> return -1;
>>>>>> }
>>>>>> +void acpi_send_sleep_event(void)
>>>>>> +{
>>>>>> + Object *obj = object_resolve_path_type("", TYPE_ACPI_DEVICE_IF,
>>>>>> NULL);
>>>>> Is it a fair assumption there will only ever be one QOM object that
>>>>> provides the TYPE_ACPI_DEVICE_IF interface on a system?
>>>>
>>>> I supposed it was, but I might be wrong(seeing some classes have the same interface). Please correct me if I've missed something, thank you!
>>>
>>> /**
>>> * object_resolve_path_type:
>>> * @path: the path to resolve
>>> * @typename: the type to look for.
>>> * @ambiguous: (out) (optional): location to store whether the
>>> * lookup failed because it was ambiguous, or %NULL.
>>> * Set to %false on success.
>>>
>>> Since you use ambiguous=NULL, your code will only set %obj if there
>>> is exactly ONE device implementing the ACPI_DEVICE interface created.
>>>
>>> So far IIUC nothing forbids creating multiple ones, so if you expect
>>> only one, you should add code to handle the "2 or more" case. Or at
>>> least add a comment.
>> Actually, there is only one QOM object here.
>> There are 3 classes involves with TYPE_ACPI_DEVICE_IF interface.
>> PC, Q35, GED.
>> For x86 system, the PC or Q35 machine doesn't use GED event, instead,
>> it sends the GPE event.
>> For microvm/ARM/virt system, GED device is used, its own TYPE_ACPI_DEVICE_IF
>> is involved.
>> All these objects do not exist at the same time, so it is safe to assume only one QOM
>> object exists here.
>
> I agree this is the case as of today, but I'm not sure about tomorrow.
> AFAICT nothing prohibit instanciating more than 1 type implementing
> TYPE_ACPI_DEVICE_IF.
>
> Anyway we are just trying to be more cautious here; up to the
> maintainer.
Annie, very soon probably the GPEX device will use the TYPE_ACPI_DEVICE_IF as well.
GPEX is used in Arm machines (like "virt") and due to the support for ACPI PCI hotplug,
which needs to be routed through the PCIe controller's hotplug handlers and the ACPI pcihp
device before the hotplug event is finally delivered to the OS via the GED device, it also
will use this ACPI interface.
I can think of something when adding the ACPI PCI hotplug support on machine with GPEX,
but even for future cases, could you please add at least a check for the ambiguity and
assert for no ambiguity here?
I suspect the only case we can have an ambiguity is when we have a device that
needs to do something more complex and then deliver an event via GED, so specifically
here for the sleep button I think it's ok to, in case of ambiguity, select the GED
device by default.
Cheers,
Gustavo
next prev parent reply other threads:[~2025-04-17 17:33 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-11 20:19 [RFC V3 PATCH 00/13] Support ACPI Control Method Sleep button Annie Li
2025-04-11 20:28 ` [RFC V3 PATCH 01/13] acpi: Implement control method sleep button Annie Li
2025-04-17 17:28 ` Gustavo Romero
2025-04-17 18:40 ` Annie Li
2025-04-11 20:31 ` [RFC V3 PATCH 02/13] test/acpi: allow DSDT table changes for x86 platform Annie Li
2025-04-17 17:29 ` Gustavo Romero
2025-04-17 18:42 ` Annie Li
2025-04-11 20:34 ` [RFC V3 PATCH 03/13] acpi: Support Control Method sleep button for x86 Annie Li
2025-04-17 17:30 ` Gustavo Romero
2025-04-17 18:42 ` Annie Li
2025-04-11 20:39 ` [RFC V3 PATCH 04/13] tests/qtest/bios-table-tests: Update ACPI table binaries " Annie Li
2025-04-17 17:31 ` Gustavo Romero
2025-04-17 18:44 ` Annie Li
2025-04-11 20:41 ` [RFC V3 PATCH 05/13] acpi: Send the GPE event of suspend and wakeup " Annie Li
2025-04-14 15:18 ` Alex Bennée
2025-04-15 1:24 ` Annie Li
2025-04-15 15:29 ` Philippe Mathieu-Daudé
2025-04-15 21:48 ` Annie Li
2025-04-16 6:24 ` Philippe Mathieu-Daudé
2025-04-17 17:32 ` Gustavo Romero [this message]
2025-04-17 18:48 ` Annie Li
2025-04-17 17:40 ` Gustavo Romero
2025-04-17 18:46 ` Annie Li
2025-04-11 20:42 ` [RFC V3 PATCH 06/13] test/acpi: allow DSDT table changes for microvm Annie Li
2025-04-17 17:33 ` Gustavo Romero
2025-04-17 18:48 ` Annie Li
2025-04-11 20:42 ` [RFC V3 PATCH 07/13] microvm: support control method sleep button Annie Li
2025-04-17 17:34 ` Gustavo Romero
2025-04-17 18:49 ` Annie Li
2025-04-11 20:42 ` [RFC V3 PATCH 08/13] hw/acpi: Add ACPI GED support for the sleep event Annie Li
2025-04-17 17:35 ` Gustavo Romero
2025-04-11 20:43 ` [RFC V3 PATCH 09/13] microvm: enable sleep GED event Annie Li
2025-04-17 17:35 ` Gustavo Romero
2025-04-17 18:49 ` Annie Li
2025-04-11 20:44 ` [RFC V3 PATCH 10/13] tests/qtest/bios-table-tests: Update ACPI table binaries for microvm Annie Li
2025-04-17 17:36 ` Gustavo Romero
2025-04-17 18:50 ` Annie Li
2025-04-11 20:44 ` [RFC V3 PATCH 11/13] microvm: suspend the system as requested Annie Li
2025-04-17 17:37 ` Gustavo Romero
2025-04-11 20:44 ` [RFC V3 PATCH 12/13] microvm: enable suspend Annie Li
2025-04-17 17:37 ` Gustavo Romero
2025-04-11 20:45 ` [RFC V3 PATCH 13/13] acpi: hmp/qmp: Add hmp/qmp support for system_sleep Annie Li
2025-04-14 6:31 ` Markus Armbruster
2025-04-14 14:14 ` Annie Li
2025-04-17 17:37 ` Gustavo Romero
2025-04-17 18:51 ` 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=a7240b57-6f86-4172-9607-7324dd1b13a3@linaro.org \
--to=gustavo.romero@linaro.org \
--cc=alex.bennee@linaro.org \
--cc=anisinha@redhat.com \
--cc=annie.li@oracle.com \
--cc=armbru@redhat.com \
--cc=dave@treblig.org \
--cc=eblake@redhat.com \
--cc=eduardo@habkost.net \
--cc=imammedo@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=miguel.luis@oracle.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=slp@redhat.com \
--cc=wangyanan55@huawei.com \
--cc=zhao1.liu@intel.com \
/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).