[RFC V3 PATCH 11/13] microvm: suspend the system as requested

Annie Li posted 13 patches 10 months ago
[RFC V3 PATCH 11/13] microvm: suspend the system as requested
Posted by Annie Li 10 months ago
Once the microvm guest requests to go to sleep state and
sets the GED register with S3 type, QEMU needs to continue
suspending the system.

Signed-off-by: Annie Li <annie.li@oracle.com>
---
 hw/acpi/generic_event_device.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/acpi/generic_event_device.c b/hw/acpi/generic_event_device.c
index 5a1ac8e362..bc53551a45 100644
--- a/hw/acpi/generic_event_device.c
+++ b/hw/acpi/generic_event_device.c
@@ -213,6 +213,9 @@ static void ged_regs_write(void *opaque, hwaddr addr, uint64_t data,
         if (slp_en && slp_typ == ACPI_GED_SLP_TYP_S5) {
             qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
         }
+        if (slp_en && slp_typ == ACPI_GED_SLP_TYP_S3) {
+            qemu_system_suspend_request();
+        }
         return;
     case ACPI_GED_REG_SLEEP_STS:
         return;
-- 
2.43.5
Re: [RFC V3 PATCH 11/13] microvm: suspend the system as requested
Posted by Gustavo Romero 9 months, 3 weeks ago
Hi Annie,

On 4/11/25 17:44, Annie Li wrote:
> Once the microvm guest requests to go to sleep state and
> sets the GED register with S3 type, QEMU needs to continue
> suspending the system.
> 
> Signed-off-by: Annie Li <annie.li@oracle.com>
> ---
>   hw/acpi/generic_event_device.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/hw/acpi/generic_event_device.c b/hw/acpi/generic_event_device.c
> index 5a1ac8e362..bc53551a45 100644
> --- a/hw/acpi/generic_event_device.c
> +++ b/hw/acpi/generic_event_device.c
> @@ -213,6 +213,9 @@ static void ged_regs_write(void *opaque, hwaddr addr, uint64_t data,
>           if (slp_en && slp_typ == ACPI_GED_SLP_TYP_S5) {
>               qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
>           }
> +        if (slp_en && slp_typ == ACPI_GED_SLP_TYP_S3) {
> +            qemu_system_suspend_request();
> +        }
>           return;
>       case ACPI_GED_REG_SLEEP_STS:
>           return;

Reviewed-by: Gustavo Romero <gustavo.romero@linaro.org>


Cheers,
Gustavo