public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
To: Weizhao Ouyang <o451686892@gmail.com>
Cc: Sughosh Ganu <sughosh.ganu@linaro.org>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Tom Rini <trini@konsulko.com>,
	Etienne Carriere <etienne.carriere@linaro.org>,
	Simon Glass <sjg@chromium.org>, Peng Fan <peng.fan@nxp.com>,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	Jens Wiklander <jens.wiklander@linaro.org>,
	Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>,
	u-boot@lists.denx.de, nd@arm.com
Subject: Re: [PATCH 1/3] firmware: psci: Fix bind_smccc_features psci check
Date: Fri, 26 Jan 2024 11:20:28 +0000	[thread overview]
Message-ID: <20240126112028.GA62785@e130802.arm.com> (raw)
In-Reply-To: <20240125140502.22400-2-o451686892@gmail.com>

Hi Weizhao,

On Thu, Jan 25, 2024 at 02:05:00PM +0000, Weizhao Ouyang wrote:
> According to PSCI specification DEN0022F, PSCI_FEATURES is used to check
> whether the SMCCC is implemented by discovering SMCCC_VERSION.
> 
> Signed-off-by: Weizhao Ouyang <o451686892@gmail.com>
> ---
>  drivers/firmware/psci.c   | 2 +-
>  include/linux/arm-smccc.h | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c
> index c6b9efab41..894be8128d 100644
> --- a/drivers/firmware/psci.c
> +++ b/drivers/firmware/psci.c
> @@ -135,7 +135,7 @@ static int bind_smccc_features(struct udevice *dev, int psci_method)
>  	    PSCI_VERSION_MAJOR(psci_0_2_get_version()) == 0)
>  		return 0;
>  
> -	if (request_psci_features(ARM_SMCCC_ARCH_FEATURES) ==
> +	if (request_psci_features(ARM_SMCCC_VERSION) ==
>  	    PSCI_RET_NOT_SUPPORTED)
>  		return 0;

I suggest we add checks on the SMCCC version like this:

    if SMCCC_VERSION >= 1.1
       assume SMCCC_ARCH_FEATURES is supported
       discover arch features and bind drivers/devices
    else
       error


For more details [1][2].


[1]: SMC Calling Convention 1.5 (https://developer.arm.com/documentation/den0028/latest/)

SMCCC_ARCH_FEATURES MANDATORY from SMCCC v1.1

The implementation of this function can be detected by checking the SMCCC version. This function is mandatory
if SMCCC_VERSION indicates that version 1.1 or later is implemented.

[2]: Linux checks SMCCC v1.1: https://elixir.bootlin.com/linux/latest/source/drivers/firmware/psci/psci.c#L597

Cheers,
Abdellatif

  parent reply	other threads:[~2024-01-26 11:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-25 14:04 [PATCH 0/3] Random Number Generator fixes Weizhao Ouyang
2024-01-25 14:05 ` [PATCH 1/3] firmware: psci: Fix bind_smccc_features psci check Weizhao Ouyang
2024-01-25 15:36   ` Heinrich Schuchardt
2024-01-26 11:20   ` Abdellatif El Khlifi [this message]
2024-01-29  2:47     ` Weizhao Ouyang
2024-01-25 14:05 ` [PATCH 2/3] driver: rng: Fix SMCCC TRNG crash Weizhao Ouyang
2024-01-25 14:55   ` Heinrich Schuchardt
2024-01-26 13:04   ` Heinrich Schuchardt
2024-01-25 14:05 ` [PATCH 3/3] cmd: rng: Add rng list command Weizhao Ouyang
2024-01-25 14:49   ` Heinrich Schuchardt
2024-01-25 15:11     ` Weizhao Ouyang

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=20240126112028.GA62785@e130802.arm.com \
    --to=abdellatif.elkhlifi@arm.com \
    --cc=etienne.carriere@linaro.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jens.wiklander@linaro.org \
    --cc=nd@arm.com \
    --cc=o451686892@gmail.com \
    --cc=peng.fan@nxp.com \
    --cc=sjg@chromium.org \
    --cc=sughosh.ganu@linaro.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /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