From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6526ECD4851 for ; Wed, 13 May 2026 06:54:30 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.1307624.1579225 (Exim 4.92) (envelope-from ) id 1wN3To-0006Xa-6V; Wed, 13 May 2026 06:54:04 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 1307624.1579225; Wed, 13 May 2026 06:54:04 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wN3To-0006XT-2R; Wed, 13 May 2026 06:54:04 +0000 Received: by outflank-mailman (input) for mailman id 1307624; Wed, 13 May 2026 06:54:02 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wN3Tm-0006XN-Hz for xen-devel@lists.xenproject.org; Wed, 13 May 2026 06:54:02 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wN3Tl-001TRv-Ra for xen-devel@lists.xenproject.org; Wed, 13 May 2026 08:54:01 +0200 Received: from [10.42.69.6] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a042000-e002-0a2a0a5209dd-0a2a4506b008-36 for ; Wed, 13 May 2026 08:54:01 +0200 Received: from [209.85.128.51] (helo=mail-wm1-f51.google.com) by tlsNG-16d1c6.mxtls.expurgate.net with ESMTPS (eXpurgate 4.56.1) (envelope-from ) id 6a042009-7371-0a2a45060019-d1558033e0e7-3 for ; Wed, 13 May 2026 08:54:01 +0200 Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-488b0e1b870so107085685e9.2 for ; Tue, 12 May 2026 23:54:01 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48e8f410d9fsm49248815e9.6.2026.05.12.23.53.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 May 2026 23:54:00 -0700 (PDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=suse.com header.i="@suse.com" header.h="Content-Transfer-Encoding:In-Reply-To:Autocrypt:From:Content-Language:References:Cc:To:Subject:User-Agent:MIME-Version:Date:Message-ID" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1778655241; x=1779260041; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=0WQBOK2y5ytwxP8GeopHUORAq13cq7X0A3saVGSqMMM=; b=ViV2wDZIoLnwkdFp3VDV1sDNuqM3UCZloKdFZ0poW163zEgJUh71qzMQvHEv35VLB6 lLO+g8AdIcDHwFbKqVjgGy07Zem5Bg+RymGE4TyQ6kVY18seSXtqGBQzoG3ZMIGUFTLy BgOm/7ir9JTrpx6jUvrlNGiYw6ZLZv/m98uv6CKyJyOz0+fwRmnQUbAOFJ3XGv4RNEgd XeeHasKTrJV5nE+MA9mIZ0ZSXr2x+0NiDi2I8FMZkD8sCtbQRDFKM89ZwK04HRYEgl91 eE7a2Qct7CpkhyEZlRo4KbqMXqYjn3PNUaVurnxjcnaAWpVsHH79kBVA5ddKy1iLZTS3 CXqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778655241; x=1779260041; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=0WQBOK2y5ytwxP8GeopHUORAq13cq7X0A3saVGSqMMM=; b=IeMIoDUEB1hkKdc2h5THn7SjoYgqPopAwHSNiGNHpJUxOMUAf85l9mWUS9bGyw1vJl jMLqYPfDjV8rvjwftuj4GZeYX0V04BqeugF7HO6KalqzR/o7YXRDvE/EyV41W8zjnOEF g+qqBiZkOrfKiFfGqoih8hPEa/FaXsHeA4jB+fd5sKDLCZM1NaabTxlljPyrK7faoTEb /HVBtFGjBt86CPvRr0v8/lTOEgBi0vsEBks9yc9Rru76/5v9pJDbn9ll6M5/GgFGCm7b QnWAf8oTQ5dL9nYZ3iluHrcwK0DmSbwOlquP+2r5fcOcgDI6mWlaFJ0Arp7ZU91V7eDH TEvQ== X-Forwarded-Encrypted: i=1; AFNElJ+ykg0sE6zbF7t3WOzThck4kcZl1mQmxp/ZsO8tIOoZNl2UvumOrAfsD6IX0n/L9e67t9QbeSxLvV0=@lists.xenproject.org X-Gm-Message-State: AOJu0Yy1GCBrlELJ1AYqzR9XgqvIF6lSLpWl0mMjxL1J0U1p6czrO8+r fHHDrQKcXFRRib2QrE6CEmztjBxMmnUNG55GzE9g2rF8AVTtpK02TEZ0eJQYHavPfw== X-Gm-Gg: Acq92OFJddW/NQCUR6UJXCokvnsiQqZgGA8vAzJrfNUwjz/BDA+lFWqwCSVUUw6hqdd yGIq/NanB9FCwt0YHvH/TQcn3LR68blA9yLzcm64dqgbBX3yS74iestOhjL7FnrRUTo76mxWmBC c58lX49LHyZcatOuNeCseE28SiZ0gAbrze+CmNGsSsnc2rlb6+d01TjkO7357sJgfd3WXDHKPlT 24YyL23CWaKsXFYNKk+zMfX12oAx5kFJbDaLXQmZrFkpobpXcDj6x4VTmnuvg/uMFf8rpXfGg8B cpwN0OxV8dIHFBXEfVbW+6KOb1fdcE+l6nK6NIdDLn2+a56CmBWeCg/ES4lPrPWFocFSpC1pIVy +XLQ77eNWdNhXbLYttpZ7lRWDXAriqdcvySl9hJSXQFKaIQxIsDpYrgK4LYhohgNTT53tbOp4j4 DsJIfmUlWP6N6bQnEAH551ZDYXR6PFYu5c750pZQ8+HpU9ePHTsggGcB85zNliKdPN8i3l4PtAj pGHRzWCOj0U+kg= X-Received: by 2002:a05:600c:8705:b0:487:5c0:671f with SMTP id 5b1f17b1804b1-48fce9c731dmr18906225e9.9.1778655240745; Tue, 12 May 2026 23:54:00 -0700 (PDT) Message-ID: <7a540913-adc4-4172-9108-9c91eaf854fe@suse.com> Date: Wed, 13 May 2026 08:53:58 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v9 12/13] xen/arm: Add vPSCI SYSTEM_SUSPEND policy To: Mykola Kvach Cc: Mykola Kvach , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Andrew Cooper , Anthony PERARD , =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= , Rahul Singh , xen-devel@lists.xenproject.org References: <06448a30ef6694a55ac85d4c8c78ca2d71342430.1778605274.git.mykola_kvach@epam.com> Content-Language: en-US From: Jan Beulich Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9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ybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <06448a30ef6694a55ac85d4c8c78ca2d71342430.1778605274.git.mykola_kvach@epam.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-purgate-ID: tlsNG-16d1c6/1778655241-8EB8BD75-C0D0E279/0/0 X-purgate-type: clean X-purgate-size: 6329 On 12.05.2026 19:07, Mykola Kvach wrote: > From: Mykola Kvach > > 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 > --- > 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 > #include > > +#include > +#include > + > 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