From: Jan Beulich <jbeulich@suse.com>
To: Mykola Kvach <xakep.amatop@gmail.com>
Cc: "Mykola Kvach" <mykola_kvach@epam.com>,
"Stefano Stabellini" <sstabellini@kernel.org>,
"Julien Grall" <julien@xen.org>,
"Bertrand Marquis" <bertrand.marquis@arm.com>,
"Michal Orzel" <michal.orzel@amd.com>,
"Volodymyr Babchuk" <Volodymyr_Babchuk@epam.com>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
"Anthony PERARD" <anthony.perard@vates.tech>,
"Roger Pau Monné" <roger.pau@citrix.com>,
"Rahul Singh" <rahul.singh@arm.com>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH v9 12/13] xen/arm: Add vPSCI SYSTEM_SUSPEND policy
Date: Wed, 13 May 2026 08:53:58 +0200 [thread overview]
Message-ID: <7a540913-adc4-4172-9108-9c91eaf854fe@suse.com> (raw)
In-Reply-To: <06448a30ef6694a55ac85d4c8c78ca2d71342430.1778605274.git.mykola_kvach@epam.com>
On 12.05.2026 19:07, Mykola Kvach wrote:
> From: Mykola Kvach <mykola_kvach@epam.com>
>
> Introduce CONFIG_HAS_HWDOM_SYSTEM_SUSPEND as an architecture-selected
> capability for platforms where the hardware domain can be parked with
> SHUTDOWN_suspend without calling hwdom_shutdown().
>
> Expose PSCI SYSTEM_SUSPEND as a vPSCI operation for all domains. For
> non-control domains, including the hardware domain when it is not acting as a
> control domain, the call is handled as a guest/domain suspend request and
> parks the domain in SHUTDOWN_suspend.
>
> Control domains need additional sequencing because their SYSTEM_SUSPEND
> request is used to coordinate host-wide suspend. A non-last awake control
> domain may be parked in SHUTDOWN_suspend without requiring the host suspend
> path to be available. The last awake control domain is treated as the point
> where the request becomes a host-suspend request, and it may only proceed
> when all non-control domains are already in SHUTDOWN_suspend and the host
> suspend path is available.
>
> Keep the control-domain sequencing and domain-readiness checks out of
> PSCI_FEATURES. They are per-attempt runtime conditions rather than stable PSCI
> function availability. Advertise SYSTEM_SUSPEND as implemented by vPSCI and
> enforce the sequencing policy in the call handler.
>
> Select HAS_HWDOM_SYSTEM_SUSPEND independently from CONFIG_SYSTEM_SUSPEND so
> that SHUTDOWN_suspend from the hardware domain can be treated as a domain
> suspend state rather than as a hardware-domain initiated host shutdown. This
> does not by itself imply that host-wide suspend is available.
>
> Add host_system_suspend_allowed() to combine the host PSCI SYSTEM_SUSPEND
> capability with runtime blockers reported by Xen-owned subsystems. Add
> runtime blockers for registered serial, IOMMU, GIC and SMMUv3 MSI IRQ paths
> lacking suspend/resume support. These blockers are runtime based, so they
> only apply to drivers or paths that Xen actually uses on the platform. For
> SMMUv3, the blocker applies only when Xen actually uses the MSI IRQ path,
> since resume does not restore the SMMU *_IRQ_CFGn MSI registers yet.
>
> Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
> ---
> xen/arch/arm/Kconfig | 1 +
> xen/arch/arm/gic.c | 6 ++
> xen/arch/arm/include/asm/psci.h | 3 +
> xen/arch/arm/include/asm/suspend.h | 10 ++-
> xen/arch/arm/psci.c | 7 ++
> xen/arch/arm/suspend.c | 40 +++++++++
> xen/arch/arm/vpsci.c | 114 +++++++++++++++++++++++---
> xen/common/Kconfig | 3 +
> xen/common/domain.c | 7 +-
> xen/drivers/char/serial.c | 12 +++
> xen/drivers/passthrough/arm/iommu.c | 4 +
> xen/drivers/passthrough/arm/smmu-v3.c | 4 +
> xen/include/xen/serial.h | 1 +
> xen/include/xen/suspend.h | 2 +
> 14 files changed, 201 insertions(+), 13 deletions(-)
>
Contrary to what the cover letter says, there's no revlog here.
> --- a/xen/arch/arm/suspend.c
> +++ b/xen/arch/arm/suspend.c
> @@ -1,9 +1,49 @@
> /* SPDX-License-Identifier: GPL-2.0-only */
>
> +#include <asm/psci.h>
> #include <asm/suspend.h>
>
> +#include <xen/lib.h>
> +#include <xen/serial.h>
> +
> struct resume_cpu_context resume_cpu_context;
>
> +/*
> + * Non-PSCI infrastructure can make host suspend impossible even when the PSCI
> + * SYSTEM_SUSPEND conduit is present, e.g. when a Xen-owned driver has no valid
> + * suspend/resume path.
> + *
> + * This gate is checked only when the last awake control domain attempts to
> + * turn a guest SYSTEM_SUSPEND request into a host-suspend request.
> + */
> +static bool host_system_suspend_runtime_allowed = true;
> +
> +static bool host_serial_suspend_allowed(void)
> +{
> + if ( serial_suspend_supported() )
> + return true;
> +
> + printk_once(XENLOG_INFO
> + "Host SYSTEM_SUSPEND blocked: serial driver lacks suspend/resume support\n");
Please try to keep log messages down to a reasonable size. In the case here,
what value does "suspend/resume" add?
> +static int32_t domain_psci_system_suspend_policy(struct domain *d)
> +{
> + struct domain *other;
> + bool last_awake_control_domain = true;
> + bool awake_non_control_domain = false;
> +
> + /* Only control domains participate in sequencing policy. */
> + if ( !is_control_domain(d) )
> + return 0;
> +
> + rcu_read_lock(&domlist_read_lock);
> +
> + for_each_domain ( other )
> + {
> + bool suspended;
> +
> + if ( other == d )
> + continue;
> +
> + suspended = domain_in_suspend_state(other);
> + if ( suspended )
> + continue;
> +
> + if ( is_control_domain(other) )
> + {
> + last_awake_control_domain = false;
> + break;
> + }
> +
> + awake_non_control_domain = true;
> + }
> +
> + rcu_read_unlock(&domlist_read_lock);
> +
> + /*
> + * Another control domain is still awake. This request is only the first
> + * phase of the sequencing: park this control domain and leave the host
> + * running. Host-wide suspend gates must not block this intermediate state.
> + */
> + if ( !last_awake_control_domain )
> + return 0;
> +
> + /*
> + * This is the last awake control domain. It must not be parked unless the
> + * request can proceed as a host-suspend request; otherwise Xen would lose
> + * the last domain that can coordinate the system suspend.
> + */
> + if ( awake_non_control_domain )
> + {
> + printk(XENLOG_DEBUG
> + "SYSTEM_SUSPEND denied: last awake control domain dom%u requested host suspend while non-control domains are still awake\n",
> + d->domain_id);
Same here, plus please use %pd.
> --- a/xen/drivers/char/serial.c
> +++ b/xen/drivers/char/serial.c
> @@ -497,6 +497,8 @@ const struct vuart_info *serial_vuart_info(int idx)
>
> #ifdef CONFIG_SYSTEM_SUSPEND
>
> +static bool __read_mostly serial_suspend_available = true;
__ro_after_init?
Jan
next prev parent reply other threads:[~2026-05-13 6:54 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-12 17:07 [PATCH v9 00/13] Add initial Xen Suspend-to-RAM support on ARM64 Mykola Kvach
2026-05-12 17:07 ` [PATCH v9 01/13] xen/arm: Add suspend and resume timer helpers Mykola Kvach
2026-05-12 17:07 ` [PATCH v9 02/13] xen/arm: gic-v2: Implement GIC suspend/resume functions Mykola Kvach
2026-05-13 14:08 ` Luca Fancellu
2026-05-15 7:59 ` Mykola Kvach
2026-05-15 9:52 ` Luca Fancellu
2026-05-12 17:07 ` [PATCH v9 03/13] xen/arm: gic-v3: tolerate retained redistributor LPI state across CPU_OFF Mykola Kvach
2026-05-13 14:51 ` Luca Fancellu
2026-05-14 8:41 ` Mykola Kvach
2026-05-12 17:07 ` [PATCH v9 04/13] xen/arm: gic-v3: Implement GICv3 suspend/resume functions Mykola Kvach
2026-05-13 16:11 ` Luca Fancellu
2026-05-12 17:07 ` [PATCH v9 05/13] xen/arm: gic-v3: add ITS suspend/resume support Mykola Kvach
2026-05-14 14:45 ` Luca Fancellu
2026-05-12 17:07 ` [PATCH v9 06/13] xen/arm: tee: keep init_tee_secondary() for hotplug and resume Mykola Kvach
2026-05-12 17:07 ` [PATCH v9 07/13] xen/arm: ffa: fix notification SRI across CPU hotplug/suspend Mykola Kvach
2026-05-12 17:07 ` [PATCH v9 08/13] iommu/ipmmu-vmsa: Implement suspend/resume callbacks Mykola Kvach
2026-05-14 15:57 ` Luca Fancellu
2026-05-12 17:07 ` [PATCH v9 09/13] xen/arm: smmu-v3: add suspend/resume handlers Mykola Kvach
2026-05-14 16:41 ` Luca Fancellu
2026-05-12 17:07 ` [PATCH v9 10/13] xen/arm64: Save/restore CPU context across SYSTEM_SUSPEND Mykola Kvach
2026-05-14 17:20 ` Luca Fancellu
2026-05-12 17:07 ` [PATCH v9 11/13] xen/arm: Implement PSCI SYSTEM_SUSPEND call (host interface) Mykola Kvach
2026-05-15 7:04 ` Luca Fancellu
2026-05-12 17:07 ` [PATCH v9 12/13] xen/arm: Add vPSCI SYSTEM_SUSPEND policy Mykola Kvach
2026-05-13 6:53 ` Jan Beulich [this message]
2026-05-14 14:51 ` Mykola Kvach
2026-05-15 8:17 ` Luca Fancellu
2026-05-12 17:07 ` [PATCH v9 13/13] xen/arm: Add host system suspend backend Mykola Kvach
2026-05-15 8:44 ` Luca Fancellu
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=7a540913-adc4-4172-9108-9c91eaf854fe@suse.com \
--to=jbeulich@suse.com \
--cc=Volodymyr_Babchuk@epam.com \
--cc=andrew.cooper3@citrix.com \
--cc=anthony.perard@vates.tech \
--cc=bertrand.marquis@arm.com \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=mykola_kvach@epam.com \
--cc=rahul.singh@arm.com \
--cc=roger.pau@citrix.com \
--cc=sstabellini@kernel.org \
--cc=xakep.amatop@gmail.com \
--cc=xen-devel@lists.xenproject.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.