Hi Yann,

 

Adding helper in the FCONF library will be good idea. Please post the patch to review it.

 

Thanks,
Manish Badarkhe

From: Yann Gautier <yann.gautier@foss.st.com>
Date: Monday, 13 December 2021 at 14:37
To: Manish Badarkhe <Manish.Badarkhe@arm.com>, tf-a@lists.trustedfirmware.org <tf-a@lists.trustedfirmware.org>
Subject: Re: [TF-A] FCONF warning for TOS_FW_CONFIG

Hi Manish,

I've checked what could be done for this warning.
The easiest way would be to create a new helper in
lib/fconf/fconf_dyn_cfg_getter.c.
My idea is to create a function:
unsigned int dyn_cfg_dtb_info_get_index(unsigned int config_id).
It returns the index of the config_id image in the dtb_infos[].
Or FCONF_INVALID_IDX (0xFFFFFFFFU) if it is not found.

I can then check if the TOS_FW_CONFIG is inside the FIP if
dyn_cfg_dtb_info_get_index(TOS_FW_CONFIG_ID) != FCONF_INVALID_IDX

I could have used a boolean function, but doing so allows factoring code
in dyn_cfg_dtb_info_getter().

Do you think it could be OK?


Thanks,
Yann

On 12/10/21 9:29 AM, Yann Gautier via TF-A wrote:
> Hi Manish,
>
> Thanks for your answers.
> I fear that's a kind of chicken and egg story.
> To know what BL32 is used, I need to check what's in the FIP.
> I will check with the fconf populator function
> (fconf_populate_stm32mp_io_policies()) if there is a way to retrieve and
> keep the information.
>
>
> Best regards,
> Yann
>
> On 12/7/21 8:56 PM, Manish Badarkhe wrote:
>> Hi Yann,
>>
>> I realized now, the patch I proposed does not work for you to run the
>> same BL2 image with OP-TEE (BL32) or SP_min (BL32) run.
>>
>> IMO then better retrieve the TOS_FW_CONFIG info run-time.
>>
>> Is there any way to differentiate OP-TEE or SP_min run in the ST
>> platform to use it as a run-time check?
>>
>> Thanks,
>>
>> Manish Badarkhe
>>
>> *From: *TF-A <tf-a-bounces@lists.trustedfirmware.org> on behalf of
>> Manish Badarkhe via TF-A <tf-a@lists.trustedfirmware.org>
>> *Date: *Tuesday, 7 December 2021 at 18:32
>> *To: *Yann Gautier <yann.gautier@foss.st.com>,
>> tf-a@lists.trustedfirmware.org <tf-a@lists.trustedfirmware.org>
>> *Subject: *Re: [TF-A] FCONF warning for TOS_FW_CONFIG
>>
>> Hi Yann,
>>
>> IMO, platform should not pass ‘TOS_FW_CONFIG_ID’ to this generic
>> function ‘‘dyn_cfg_dtb_info_getter’ while using OPTEE.
>>
>> It is better not to handle specific scenarios mentioned in your
>> proposed patch in the generic library function, but let me know what
>> do you think?
>>
>> I would suggest below modifications in the platform code instead:
>>
>> diff --git a/plat/st/stm32mp1/bl2_plat_setup.c
>> b/plat/st/stm32mp1/bl2_plat_setup.c
>>
>> index 7eaf0ed98..96e24401e 100644
>>
>> --- a/plat/st/stm32mp1/bl2_plat_setup.c
>>
>> +++ b/plat/st/stm32mp1/bl2_plat_setup.c
>>
>> @@ -357,7 +357,9 @@ int bl2_plat_handle_post_image_load(unsigned int
>> image_id)
>>
>>                  BL32_IMAGE_ID,
>>
>>                  BL33_IMAGE_ID,
>>
>>                  HW_CONFIG_ID,
>>
>> +#ifndef AARCH32_SP_OPTEE
>>
>>                  TOS_FW_CONFIG_ID,
>>
>> +#endif
>>
>>          };
>>
>> #endif /* !STM32MP_USE_STM32IMAGE */
>>
>> Thanks,
>>
>> Manish Badarkhe
>>
>> *From: *TF-A <tf-a-bounces@lists.trustedfirmware.org> on behalf of
>> Yann Gautier via TF-A <tf-a@lists.trustedfirmware.org>
>> *Date: *Friday, 3 December 2021 at 10:44
>> *To: *tf-a@lists.trustedfirmware.org <tf-a@lists.trustedfirmware.org>
>> *Subject: *[TF-A] FCONF warning for TOS_FW_CONFIG
>>
>> Hi,
>>
>> On STM32MP1, we'd like BL2 to be agnostic of what BL32 is in the FIP.
>> It can be either OP-TEE or TF-A SP_min.
>>
>> But on STM32MP1, SP_min needs a device tree file (TOS_FW_CONFIG_ID),
>> whereas OP-TEE doesn't use this separate DT image.
>>
>> As TOS_FW_CONFIG_ID is in list of images to be loaded by BL2, we then
>> have a warning message in case OP-TEE is used:
>> WARNING: FCONF: Invalid config id 26
>>
>> I'd like to silence this warning with this kind of patch:
>> diff --git a/lib/fconf/fconf_dyn_cfg_getter.c
>> b/lib/fconf/fconf_dyn_cfg_getter.c
>> index 25dd7f9eda..f7e9834c3b 100644
>> --- a/lib/fconf/fconf_dyn_cfg_getter.c
>> +++ b/lib/fconf/fconf_dyn_cfg_getter.c
>> @@ -51,7 +51,11 @@ struct dyn_cfg_dtb_info_t
>> *dyn_cfg_dtb_info_getter(unsigned int config_id)
>>                   }
>>           }
>>
>> -       WARN("FCONF: Invalid config id %u\n", config_id);
>> +       if (config_id == TOS_FW_CONFIG_ID) {
>> +               VERBOSE("FCONF: No TOS_FW_CONFIG image\n");
>> +       } else {
>> +               WARN("FCONF: Invalid config id %u\n", config_id);
>> +       }
>>
>>           return NULL;
>>    }
>>
>>
>> I can change the VERBOSE message to INFO.
>>
>> Do you think it is OK if I push the patch?
>>
>>
>> Thanks,
>> Yann
>> --
>> TF-A mailing list
>> TF-A@lists.trustedfirmware.org
>> https://lists.trustedfirmware.org/mailman/listinfo/tf-a
>> <https://lists.trustedfirmware.org/mailman/listinfo/tf-a>
>>
>