Hi,
On 2/9/26 9:50 PM, Marco Felsch wrote:
> On 26-02-06, Ahmad Fatoum wrote:
>> How about:
>>
>> struct imx_scratch_space {
>> union {
>> u8 __b[CONFIG_SCRATCH_SIZE];
>> struct {
>> u32 bootrom_log[128];
>> u32 reserved[128];
>> struct optee_header optee_hdr;
>> u8 fdt[] __aligned(8);
>
> This would require, that the 'fdt' element is always the last element.
> We could add a comment, but it's rather fragile IMHO.
What's fragile about it? Next one after you, will not be able to add a
new member and that's a good thing. They should rework this instead of
piling extra CONFIG variables with board-specific offsets.
>
>> };
>> };
>> };
>> static_assert(sizeof(struct imx_scratch_space)
>> - offsetof(struct imx_scratch_space, fdt)
>> <= PBL_OPTEE_DTB_MAX_SIZE);
>
> This would introduce a very strict dependency for CONFIG_SCRATCH_SIZE to
> the not always visible PBL_OPTEE_DTB_MAX_SIZE. As you said:
Wrap the assert in an #ifdef then.
>
>>>> In that case, this should go to security/Kconfig and be named something
>>>> like PBL_OPTEE_DTB_MAX_SIZE. There's no need to ask every user that
>>>> configures barebox about this.
>
> Therefore I would like to use your name suggestion
> PBL_OPTEE_DTB_MAX_SIZE but keep it loose like RK does.
>
>> The benefits I see:
>> - Just one argument to tune (CONFIG_SCRATCH_SIZE) like we already use
>> for Rockchip
>
> Rockchip is using two Kconfig switch too (ARCH_ROCKCHIP_ATF_FDT_SIZE).
Oh, I see. I can send patches to switch this over to
PBL_OPTEE_DTB_MAX_SIZE then.
>
>> - We still have a dedicated option that can be kept in-sync with the
>> exact option value in OP-TEE to find problems at compile-time
>> - Only those who actually use OP-TEE will be asked about
>> PBL_OPTEE_DTB_MAX_SIZE
>
> Good points!
>
>> Would this work for you?
>
> Please see above.
Cheers,
Ahmad
>
> Regards,
> Marco
>
>
>>
>> Cheers,
>> Ahmad
>>
>>
>>>
>>> Regards,
>>> Marco
>>>
>>>
>>>>
>>>>
>>>> Cheers,
>>>> Ahmad
>>>>
>>>> --
>>>> Pengutronix e.K. | |
>>>> Steuerwalder Str. 21 | http://www.pengutronix.de/ |
>>>> 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
>>>> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
>>>>
>>>>
>>>
>>
>> --
>> Pengutronix e.K. | |
>> Steuerwalder Str. 21 | http://www.pengutronix.de/ |
>> 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
>> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
>>
>>
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |