mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
To: Sudeep Holla <sudeep.holla@kernel.org>, Ulf Hansson <ulfh@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
	Lorenzo Pieralisi <lpieralisi@kernel.org>,
	<linux-kernel@vger.kernel.org>,
	<dario.binacchi@amarulasolutions.com>,
	Linux STM32 <linux-stm32@st-md-mailman.stormreply.com>,
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [Linux-stm32] [PATCH] firmware: psci: handle unsupported SET_SUSPEND_MODE in PC mode
Date: Thu, 12 Nov 2026 10:40:48 +0100	[thread overview]
Message-ID: <a2432129-613b-4f17-813d-82ac8af9b6d6@foss.st.com> (raw)
In-Reply-To: <4690f55f-dc13-4e43-82f9-d508253f6c64@foss.st.com>

Hi,

On 10/30/26 11:04, Patrick DELAUNAY wrote:
> Hi,
>
> On 10/30/26 09:32, Sudeep Holla wrote:
>> On Thu, Oct 29, 2026 at 07:16:25PM +0100, Patrick Delaunay wrote:
>>> The PSCI specification makes PSCI_SET_SUSPEND_MODE optional. If it
>>> returns NOT_SUPPORTED when Linux requests platform-coordinated (PC)
>>> mode, Linux can assume that PC mode is in effect. Treat this response
>>> as success so PSCI power-domain providers can initialize when firmware
>>> does not support OS-initiated (OSI) mode.
>>>
>>> Continue to report an error when OSI mode is requested but
>>> SET_SUSPEND_MODE is not supported.
>>>
>> So, your platform advertises the presence/support for OSI mode and yet
>> opted for not implementing SET_SUSPEND_MODE ? If so, it is indeed a
>> firmware bug as reported.
>>
>
> I think it is no realy a platform bug but a too strict management in 
> Linux kernel,
>
> for PSCI power domain.
>
>
> The OSI mode is not yet supported by the STM32MP25 platform in Linux at
>
> upstream but I introduce PSCI domains in device tree (but without idle 
> power
>
> domain) just to prepare this activation in next steps.
>
>
> As the PSCI support is not activated in Firmware (TF-A BL31), the 
> firmware correctly
>
> expose its capacities (PSCI_OS_INIT_MODE =0)
>
> => PSCI feature indicate that OSI is not supported 
> (FF_SUPPORTS_OS_INIT_MODE = 0)
>
> => PSCI_SET_SUSPEND_MODE function is not supported (optional when OSI 
> is not supported)
>
>
> in Linux side, the power domain driver 
> (drivers/cpuidle/cpuidle-psci-domain.c)
>
> correctly check the support of OSI:
>
>     bool use_osi = psci_has_osi_support();
>
>
> in STM32MP25 platform use_osi = false, so the driver request
>
> Plafrom Cooordinated mode (PC mode) as expected
>
> But here  the GENPD driver try to use optional function to set mode:
>
>
>     /* let's try to enable OSI. */
>     ret = psci_set_osi_mode(use_osi);
>     if (ret)
>         goto remove_pd;
>
>
> And the problem occurs here because the optional function is called 
> but the normal use case
>
> is not handled (OSI mode not supported / PSCI_SET_SUSPEND_MODE not 
> supported)
>
>
> With the proposed patch, the Linux kernel can have PSCI domain in 
> device tree even when
>
> PSCI OSI support is deactivated in PSCI firmware (or not yet 
> activated): the domain are
>
> always ON (GENPD_FLAG_ALWAYS_ON)
>
>
> NB: I hesitate between the current patch and a patch in PSCI power 
> domain driver:
>
>
>     /* let's try to enable OSI. */
>     ret = psci_set_osi_mode(use_osi);
>
> + if (ret == -EOPNOTSUPP && !use_osi)
>
> +    ret = 0;
>
>     if (ret)
>         goto remove_pd;
>
>
> but I patch PSCI firmware driver because I think it is a more generic 
> place to handle optional PSCI function.
>
>
> Regards
>
>
> Patrick


To complete my previous answer,

In  last PSCI specification v1.3, we found this description:

"

5.21 PSCI_SET_SUSPEND_MODE

5.21.3 Caller responsibilities

The caller must be able to cope with the following error return codes:
• NOT_SUPPORTED, in which case the calling OS can assume the platform 
will work in platform-
coordinated mode. In this case, the PSCI_FEATURES feature flag 0 for 
CPU_SUSPEND is also 0.

"


My patch only implements this behavior:

the PSCI stack in Linux assumes PC mode when SET_SUSPEND_MODE is not 
supported.


Regards

Patrick


  reply	other threads:[~2026-11-12  9:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29 18:16 Patrick Delaunay
2026-10-30  8:32 ` Sudeep Holla
2026-10-30 10:04   ` Patrick DELAUNAY
2026-11-12  9:40     ` Patrick DELAUNAY [this message]
2026-11-12 10:13       ` [Linux-stm32] " Sudeep Holla
2026-11-12 10:06     ` Sudeep Holla
2026-11-12 10:36       ` Patrick DELAUNAY

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=a2432129-613b-4f17-813d-82ac8af9b6d6@foss.st.com \
    --to=patrick.delaunay@foss.st.com \
    --cc=dario.binacchi@amarulasolutions.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=lpieralisi@kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=sudeep.holla@kernel.org \
    --cc=ulfh@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®