Hi Aswin,

On 27/08/2026 09:29, Aswin Murugan wrote:
> qcom_configure_capsule_updates() unconditionally calls scsi_scan(),
> re-scanning all SCSI children even when an earlier boot stage has
> already bound them. Skip the rescan when UCLASS_SCSI already has
> devices, keeping it as a fallback if none are bound yet.

This is a nice optimisation! I think checking for existing SCSI devices
is a pretty good way to handle this, however I'm also aware of some
broader issues with how scsi initialisation is handled in U-Boot today.

Most notably, there is an edge case where we can get out of sync with
the EFI framework, resulting in EFI devices being tied to SCSI devices
which no longer exist, although to be honest I forget the exact cases
where this can happen I did manage to run into before.

We also need SCSI devices to be available for GENI fw loading, we
currently trigger fw loading relatively late which causes issues with
stuff like display bringup or any other cases where we might need to
talk to i2c/spi devices prior to EVT_LAST_STAGE_INIT so it will become
necessary to call scsi_scan() in qcom_geni_fw_initialise() as well.

Rather than impose this pattern everywhere I would rather see an
improvement to the SCSI API to scan only for /new/ scsi devices without
removing all the existing devices as scsi_scan() does today, perhaps a
way to trigger it to search for a UFS device explicitly?

Kind regards,
> 
> ~34ms saved on Qcom SoC bootup time.
> 
> Signed-off-by: Aswin Murugan <[email protected]>
> ---
>  arch/arm/mach-snapdragon/capsule_update.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-snapdragon/capsule_update.c 
> b/arch/arm/mach-snapdragon/capsule_update.c
> index 586682434b7..0e2da22afcf 100644
> --- a/arch/arm/mach-snapdragon/capsule_update.c
> +++ b/arch/arm/mach-snapdragon/capsule_update.c
> @@ -296,8 +296,8 @@ void qcom_configure_capsule_updates(void)
>       enum target_part_type target_part_type = 0;
>       enum uclass_id dev_uclass;
>  
> -     if (IS_ENABLED(CONFIG_SCSI)) {
> -             /* Scan for SCSI devices */
> +     if (IS_ENABLED(CONFIG_SCSI) && !uclass_id_count(UCLASS_SCSI)) {
> +             /* Scan for SCSI devices, unless already scanned earlier in 
> boot */
>               ret = scsi_scan(false);
>               if (ret) {
>                       debug("Failed to scan SCSI devices: %d\n", ret);

-- 
// Casey (she/her)

Reply via email to