[U-Boot] [PATCH 1/2] bouncebuf: Add static buffer allocation method for SPL.

Christoph Müllner christoph.muellner at theobroma-systems.com
Tue May 7 13:55:06 UTC 2019



On 07.05.19 15:52, Marek Vasut wrote:
> On 5/7/19 3:45 PM, Christoph Müllner wrote:
>>
>>
>> On 07.05.19 15:06, Marek Vasut wrote:
>>> On 5/7/19 11:09 AM, Christoph Muellner wrote:
>>>> If we are using malloc-simple, we get into the problem, that
>>>> calls to free() won't free any memory. When using bouncebuf
>>>> in SPL with malloc-simple this means, that every allocated buffer
>>>> is lost. This can quickly consume the whole heap.
>>>
>>> When does such a scenario happen ?
>>
>> RK3399 with mainline U-Boot and mainline ATF.
>> We have 0x4000 bytes heap in SPL.
>> For the SRAM part of ATF we need to allocate 0x2000-0x2200 bytes.
>> For the PMUSRAM part about the same again.
>>
>> I tried to increase the heap size to 0x10000, but that seems
>> to break some unchecked assumptions about the memory layout,
>> because then SPL resets very early.
> 
> So what calls this malloc-free pair so often to spend all the simple
> malloc area ?

The bouncebuf code (bounce_buffer_start(), which does memalign().
It is called twice (once for SRAM and once for PMUSRAM) as mentioned above.

That's all part of loading the ATF parts (on RK3399 we have normal ATF code,
SRAM code and PMUSRAM code).


More information about the U-Boot mailing list