Hey Neil,

On Thursday, 4 June 2026 at 4:33 PM, Neil Armstrong <[email protected]> 
wrote:

> On 6/2/26 09:19, Sam Day via B4 Relay wrote:
> > From: Sam Day <[email protected]>
> >
> > If there's no PSCI implementation, then change the enable-method of all
> > CPUs from "psci" to "spin-table". Later, when spin_table_update_dt runs,
> > it will further patch the CPU nodes with the necessary cpu-release-addr.
> >
> > This new fixup is only applied when CONFIG_ARMV8_SPIN_TABLE is enabled,
> > since that also determines whether spin_table_update_dt runs.
> >
> > Signed-off-by: Sam Day <[email protected]>
> > ---
> >   arch/arm/mach-snapdragon/board.c | 41 
> > ++++++++++++++++++++++++++++++++++++++++
> >   1 file changed, 41 insertions(+)
> >
> > diff --git a/arch/arm/mach-snapdragon/board.c 
> > b/arch/arm/mach-snapdragon/board.c
> > index 829a0109ac7..3b08069af98 100644
> > --- a/arch/arm/mach-snapdragon/board.c
> > +++ b/arch/arm/mach-snapdragon/board.c
> > @@ -183,7 +183,9 @@ static void show_psci_version(void)
> >   static void qcom_psci_fixup(void *fdt)
> >   {
> >     int offset, ret;
> > +   uint reg;
> >     struct arm_smccc_res res;
> > +   const char *prop;
> >
> >     arm_smccc_smc(ARM_PSCI_0_2_FN_PSCI_VERSION, 0, 0, 0, 0, 0, 0, 0, &res);
> >
> > @@ -198,6 +200,45 @@ static void qcom_psci_fixup(void *fdt)
> >     ret = fdt_del_node(fdt, offset);
> >     if (ret)
> >             log_err("Failed to delete /psci node: %d\n", ret);
> > +
> > +   if (!CONFIG_IS_ENABLED(ARMV8_SPIN_TABLE))
> > +           return;
> 
> Can this be dynamic ?

Sure can! ... Just as soon as I pin down exactly what you mean by that :D

Are you asking that this be guarded not just by ARMV8_SPIN_TABLE
enablement, but also by root device compatible?

e.g:

        if (!CONFIG_IS_ENABLED(ARMV8_SPIN_TABLE))
                return;

        if (fdt_node_check_compatible(fdt, 0, "qcom,msm8916") &&
        fdt_node_check_compatible(fdt, 0, "qcom,apq8016"))
                return;

Kind regards,
Sam

> 
> Neil
> 
> > +
> > +   /* If spin-table support is enabled, make sure any CPU nodes with a
> > +    * PSCI enable-method are updated to spin-table. Further, any PSCI
> > +    * power-domains properties are removed.
> > +    */
> > +
> > +   offset = fdt_path_offset(fdt, "/cpus");
> > +   if (offset < 0)
> > +           return;
> > +
> > +   for (offset = fdt_first_subnode(fdt, offset);
> > +        offset >= 0;
> > +        offset = fdt_next_subnode(fdt, offset)) {
> > +           prop = fdt_getprop(fdt, offset, "device_type", NULL);
> > +           if (!prop || strcmp(prop, "cpu"))
> > +                   continue;
> > +
> > +           prop = fdt_getprop(fdt, offset, "enable-method", NULL);
> > +           if (!prop || strcmp(prop, "psci"))
> > +                   continue;
> > +
> > +           reg = fdtdec_get_uint(fdt, offset, "reg", 0);
> > +           ret = fdt_setprop_string(fdt, offset,
> > +                                    "enable-method", "spin-table");
> > +           if (ret)
> > +                   log_err("Failed to set CPU%d enable-method to 
> > 'spin-table', this CPU will not be available to booted OS! %d\n",
> > +                           reg, ret);
> > +
> > +           log_info("Patched CPU%d enable-method to 'spin-table'\n", reg);
> > +
> > +           prop = fdt_getprop(fdt, offset, "power-domain-names", NULL);
> > +           if (prop && !strcmp(prop, "psci")) {
> > +                   fdt_delprop(fdt, offset, "power-domains");
> > +                   fdt_delprop(fdt, offset, "power-domain-names");
> > +           }
> > +   }
> >   }
> >
> >   /* We support booting U-Boot with an internal DT when running as a 
> > first-stage bootloader
> >
> 
>

Reply via email to