[PATCH v2 2/6] arm: snapdragon: Guard PSCI functions with CONFIG_ARM_SMCCC

Varadarajan Narayanan varadarajan.narayanan at oss.qualcomm.com
Thu Jun 11 12:25:25 CEST 2026


On Mon, Jun 08, 2026 at 02:36:29PM +0530, Balaji Selvanathan wrote:
> In snagboot mode, U-Boot is loaded directly by XBL without PSCI
> firmware support. The functions show_psci_version() and
> qcom_psci_fixup() call arm_smccc_smc() which is unavailable when
> CONFIG_ARM_SMCCC is disabled, causing build failures.
>
> Wrap both functions with CONFIG_ARM_SMCCC guards and provide
> empty inline stubs for the disabled case.
>
> Signed-off-by: Balaji Selvanathan <balaji.selvanathan at oss.qualcomm.com>
> ---
> Changes in v2:
> - Newly introduced in v2
> ---
>  arch/arm/mach-snapdragon/board.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
>
> diff --git a/arch/arm/mach-snapdragon/board.c b/arch/arm/mach-snapdragon/board.c
> index 829a0109ac7..be4bdd49cf6 100644
> --- a/arch/arm/mach-snapdragon/board.c
> +++ b/arch/arm/mach-snapdragon/board.c
> @@ -158,6 +158,7 @@ static int qcom_parse_memory(const void *fdt)
>  	return 0;
>  }
>
> +#ifdef CONFIG_ARM_SMCCC
>  static void show_psci_version(void)
>  {
>  	struct arm_smccc_res res;
> @@ -172,6 +173,12 @@ static void show_psci_version(void)
>  	      PSCI_VERSION_MAJOR(res.a0),
>  	      PSCI_VERSION_MINOR(res.a0));
>  }
> +#else
> +static inline void show_psci_version(void)
> +{
> +	/* PSCI not available - no-op */
> +}
> +#endif

static void show_psci_version(void)
{
	if (!IS_ENABLED(CONFIG_ARM_SMCCC))
		return;
	. . .
}

Wouldn't this work? Didn't checkpatch complain?

>
>  /**
>   * Most MSM8916 devices in the wild shipped without PSCI support, but the
> @@ -180,6 +187,7 @@ static void show_psci_version(void)
>   * firmware driver doesn't bind (which then binds a sysreset driver that won't
>   * work).
>   */
> +#ifdef CONFIG_ARM_SMCCC
>  static void qcom_psci_fixup(void *fdt)
>  {
>  	int offset, ret;
> @@ -199,6 +207,12 @@ static void qcom_psci_fixup(void *fdt)
>  	if (ret)
>  		log_err("Failed to delete /psci node: %d\n", ret);
>  }
> +#else
> +static inline void qcom_psci_fixup(void *fdt)
> +{
> +	/* PSCI not available - no-op */
> +}
> +#endif

Same here.

-Varada

>
>  /* We support booting U-Boot with an internal DT when running as a first-stage bootloader
>   * or for supporting quirky devices where it's easier to leave the downstream DT in place
>
> --
> 2.34.1
>


More information about the U-Boot mailing list