From: Igor Mammedov <imammedo@redhat.com>
To: Annie Li <annie.li@oracle.com>
Cc: miguel.luis@oracle.com, qemu-devel@nongnu.org,
qemu-arm@nongnu.org, dave@treblig.org, mst@redhat.com,
anisinha@redhat.com, shannon.zhaosl@gmail.com,
peter.maydell@linaro.org, eduardo@habkost.net,
marcel.apfelbaum@gmail.com, philmd@linaro.org,
wangyanan55@huawei.com, zhao1.liu@intel.com, pbonzini@redhat.com,
richard.henderson@linaro.org, eblake@redhat.com,
armbru@redhat.com
Subject: Re: [RFC V2 PATCH 01/11] acpi: hmp/qmp: Add hmp/qmp support for system_sleep
Date: Mon, 7 Oct 2024 14:44:49 +0200 [thread overview]
Message-ID: <20241007144449.457d304f@imammedo.users.ipa.redhat.com> (raw)
In-Reply-To: <20240927183906.1248-2-annie.li@oracle.com>
On Fri, 27 Sep 2024 14:38:56 -0400
Annie Li <annie.li@oracle.com> wrote:
> Followng hmp/qmp commands are implemented for pressing virtual
> sleep button,
>
> hmp: system_sleep
> qmp: { "execute": "system_sleep" }
>
> These commands put the guest into suspend or other power states
> depending on the power settings inside the guest.
>
> Signed-off-by: Annie Li <annie.li@oracle.com>
> ---
> hmp-commands.hx | 14 ++++++++++++++
> hw/core/machine-hmp-cmds.c | 5 +++++
> hw/core/machine-qmp-cmds.c | 9 +++++++++
> include/monitor/hmp.h | 1 +
> qapi/machine.json | 18 ++++++++++++++++++
> qapi/pragma.json | 1 +
> 6 files changed, 48 insertions(+)
>
> diff --git a/hmp-commands.hx b/hmp-commands.hx
> index 06746f0afc..4c149f403f 100644
> --- a/hmp-commands.hx
> +++ b/hmp-commands.hx
> @@ -639,6 +639,20 @@ SRST
> whether profiling is on or off.
> ERST
>
> + {
> + .name = "system_sleep",
> + .args_type = "",
> + .params = "",
> + .help = "send ACPI sleep event",
> + .cmd = hmp_system_sleep,
> + },
> +
> +SRST
> +``system_sleep``
> + Push the virtual sleep button; if supported the system will enter
> + an ACPI sleep state.
perhaps comma after 'if supported'
> +ERST
> +
> {
> .name = "system_reset",
> .args_type = "",
> diff --git a/hw/core/machine-hmp-cmds.c b/hw/core/machine-hmp-cmds.c
> index 8701f00cc7..3ee529d8d5 100644
> --- a/hw/core/machine-hmp-cmds.c
> +++ b/hw/core/machine-hmp-cmds.c
> @@ -189,6 +189,11 @@ void hmp_system_reset(Monitor *mon, const QDict *qdict)
> qmp_system_reset(NULL);
> }
>
> +void hmp_system_sleep(Monitor *mon, const QDict *qdict)
> +{
> + qmp_system_sleep(NULL);
> +}
> +
> void hmp_system_powerdown(Monitor *mon, const QDict *qdict)
> {
> qmp_system_powerdown(NULL);
> diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c
> index 130217da8f..770f8189ba 100644
> --- a/hw/core/machine-qmp-cmds.c
> +++ b/hw/core/machine-qmp-cmds.c
> @@ -276,6 +276,15 @@ void qmp_system_reset(Error **errp)
> qemu_system_reset_request(SHUTDOWN_CAUSE_HOST_QMP_SYSTEM_RESET);
> }
>
> +void qmp_system_sleep(Error **errp)
> +{
> + if (!qemu_wakeup_suspend_enabled()) {
> + error_setg(errp,
> + "suspend from running is not supported by this guest");
it's machine and not the guest that doesn't support, isn't it?
> + return;
> + }
I'd reorder this after 6/11, to avoid adding function that does nothing
and then explaining why it is done this way.
> +}
> +
> void qmp_system_powerdown(Error **errp)
> {
> qemu_system_powerdown_request();
> diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
> index ae116d9804..e543eec109 100644
> --- a/include/monitor/hmp.h
> +++ b/include/monitor/hmp.h
> @@ -43,6 +43,7 @@ void hmp_quit(Monitor *mon, const QDict *qdict);
> void hmp_stop(Monitor *mon, const QDict *qdict);
> void hmp_sync_profile(Monitor *mon, const QDict *qdict);
> void hmp_system_reset(Monitor *mon, const QDict *qdict);
> +void hmp_system_sleep(Monitor *mon, const QDict *qdict);
> void hmp_system_powerdown(Monitor *mon, const QDict *qdict);
> void hmp_exit_preconfig(Monitor *mon, const QDict *qdict);
> void hmp_announce_self(Monitor *mon, const QDict *qdict);
> diff --git a/qapi/machine.json b/qapi/machine.json
> index d4317435e7..b32d231aa9 100644
> --- a/qapi/machine.json
> +++ b/qapi/machine.json
> @@ -362,6 +362,24 @@
> ##
> { 'command': 'system_reset' }
>
> +##
> +# @system_sleep:
> +#
> +# Requests that a guest perform a ACPI sleep transition by pushing a virtual
> +# sleep button.
> +#
> +# .. note:: A guest may or may not respond to this command. This command
> +# returning does not indicate that a guest has accepted the request
> +# or that it has gone to sleep.
> +#
> +# .. qmp-example::
> +#
> +# -> { "execute": "system_sleep" }
> +# <- { "return": {} }
> +#
> +##
> +{ 'command': 'system_sleep' }
> +
> ##
> # @system_powerdown:
> #
> diff --git a/qapi/pragma.json b/qapi/pragma.json
> index 59fbe74b8c..e2c5dcb829 100644
> --- a/qapi/pragma.json
> +++ b/qapi/pragma.json
> @@ -23,6 +23,7 @@
> 'set_password',
> 'system_powerdown',
> 'system_reset',
> + 'system_sleep',
> 'system_wakeup' ],
> # Commands allowed to return a non-dictionary
> 'command-returns-exceptions': [
next prev parent reply other threads:[~2024-10-07 12:45 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-27 18:38 [RFC V2 PATCH 00/11] Support ACPI Control Method Sleep button Annie Li
2024-09-27 18:38 ` [RFC V2 PATCH 01/11] acpi: hmp/qmp: Add hmp/qmp support for system_sleep Annie Li
2024-10-07 12:44 ` Igor Mammedov [this message]
2024-10-08 15:21 ` Annie Li
2024-09-27 18:38 ` [RFC V2 PATCH 02/11] acpi: Implement control method sleep button Annie Li
2024-10-07 12:59 ` Igor Mammedov
2024-10-08 15:22 ` Annie Li
2024-10-11 12:10 ` Igor Mammedov
2024-09-27 18:38 ` [RFC V2 PATCH 03/11] test/acpi: allow DSDT table changes Annie Li
2024-09-27 18:38 ` [RFC V2 PATCH 04/11] acpi: Support Control Method sleep button for x86 Annie Li
2024-10-07 13:32 ` Igor Mammedov
2024-10-08 15:33 ` Annie Li
2024-09-27 18:39 ` [RFC V2 PATCH 05/11] tests/acpi: Update DSDT tables for Control method sleep button Annie Li
2024-09-27 18:39 ` [RFC V2 PATCH 06/11] acpi: Send the GPE event of suspend and wakeup for x86 Annie Li
2024-09-27 18:39 ` [RFC V2 PATCH 07/11] hw/acpi: Add ACPI GED support for the sleep event Annie Li
2024-09-27 18:39 ` [RFC V2 PATCH 08/11] tests/acpi: allow FACP and DSDT table changes for arm/virt Annie Li
2024-09-27 18:39 ` [RFC V2 PATCH 09/11] hw/arm: enable sleep support " Annie Li
2024-09-27 18:39 ` [RFC V2 PATCH 10/11] tests/acpi: Update FACP and DSDT tables for sleep button Annie Li
2024-09-27 18:39 ` [RFC V2 PATCH 11/11] arm/virt: enable sleep support Annie Li
2024-10-08 11:53 ` Peter Maydell
2024-10-10 12:43 ` Miguel Luis
2024-10-07 13:41 ` [RFC V2 PATCH 00/11] Support ACPI Control Method Sleep button Igor Mammedov
2024-10-08 15:21 ` 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=20241007144449.457d304f@imammedo.users.ipa.redhat.com \
--to=imammedo@redhat.com \
--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=marcel.apfelbaum@gmail.com \
--cc=miguel.luis@oracle.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=shannon.zhaosl@gmail.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).