Message ID | 20240125140502.22400-2-o451686892@gmail.com |
---|---|
State | Superseded |
Delegated to: | Tom Rini |
Headers | show |
Series | Random Number Generator fixes | expand |
On 25.01.24 15:05, 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> 5.15.2 Implementation responsibilities PSCI_FEATURES should report the presence of SMCCC_VERSION in privileged platform firmware compliant with PSCI v1.0 and later revisions. Acked-by: Heinrich Schuchardt <xypron.glpk@gmx.de> > --- > 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; > > diff --git a/include/linux/arm-smccc.h b/include/linux/arm-smccc.h > index f44e9e8f93..453017eb5f 100644 > --- a/include/linux/arm-smccc.h > +++ b/include/linux/arm-smccc.h > @@ -55,6 +55,7 @@ > #define ARM_SMCCC_QUIRK_NONE 0 > #define ARM_SMCCC_QUIRK_QCOM_A6 1 /* Save/restore register a6 */ > > +#define ARM_SMCCC_VERSION 0x80000000 > #define ARM_SMCCC_ARCH_FEATURES 0x80000001 > > #define ARM_SMCCC_RET_NOT_SUPPORTED ((unsigned long)-1)
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
Hi Abdellatif, On Fri, Jan 26, 2024 at 7:20 PM Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com> wrote: > > 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 Okay, I will add it. BR, Weizhao > > 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
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; diff --git a/include/linux/arm-smccc.h b/include/linux/arm-smccc.h index f44e9e8f93..453017eb5f 100644 --- a/include/linux/arm-smccc.h +++ b/include/linux/arm-smccc.h @@ -55,6 +55,7 @@ #define ARM_SMCCC_QUIRK_NONE 0 #define ARM_SMCCC_QUIRK_QCOM_A6 1 /* Save/restore register a6 */ +#define ARM_SMCCC_VERSION 0x80000000 #define ARM_SMCCC_ARCH_FEATURES 0x80000001 #define ARM_SMCCC_RET_NOT_SUPPORTED ((unsigned long)-1)
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(-)