[U-Boot] [PATCH 2/4] cache_v7: Check for dcache enablement in dcache flush functions

Aneesh V aneesh at ti.com
Thu Jun 28 01:17:57 CEST 2012


Hi Sricharan,

On 06/21/2012 02:25 AM, Sricharan R wrote:
> Hi,
> [snip..]
>> On 06/15/2012 07:48 AM, R, Sricharan wrote:
>>> Hi,
>>>
>>>>> On Fri, Jun 15, 2012 at 12:31 AM, Tom Rini<trini at ti.com>   wrote:
>>>>>> If we are built with D-CACHE enabled but have run 'dcache off' and
>> then
>>>>>> attempt to flush unaligned regions we spam the console with
>> problems
>>>>>> that aren't true (as the cache was off).
>>>>>>
>>>>>     Today we do cache maintenance operations after the dcache is
>> turned off.
>>>>>     One example is before jumping to kernel, we try to invalidate
>> the caches,
>>>>>     in cache turned off state. So with this patch those maintenance
>> calls will
>>>>>     do nothing, which is not correct.
>>>>
>>>> Ah yes,  But, shouldn't we be doing these same operations as part of
>>>> turning the cache off?
>>>>
>>>     The problem is that while turning of dcaches, we flush it, and
>> turn
>>>    cache and MMU off.  But these operations are not happening
>>>    automatically in a single call. So there is a chance of  valid
>>>    entries present in cache even after it is OFF.
>>
>> I think this is what we need to fix. Otherwise, Tom's change looks good
>> to me. How about an invalidate in dcache_disable() or something like
>> that?
>>
>    Correct. So if the cleaning up sequence is fine, then ok.
>    So there should be no need to check if caches are OFF inside
>    the maintenance functions. Kernel does not looks like doing such checks.
>    The real issue looks like we should have had assembly level functions
>    to do the cleanup routines for flush-invalidate-turn OFF caches/MMU
> atomically.

Sorry for the late reply. Yes, kernel doesn't do such checks. But
kernel's implementation is different from u-boot implementation. In
kernel the invalidate routine flushes unaligned lines in the end which,
after a lot of discussions[1], we decided to avoid in u-boot. Instead
we printed noisy error messages to alert the user. Now these messages
will appear even if we are calling the maintenance functions after the
disable and that's what Tom is trying to avoid.

br,
Aneeesh

[1] http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/105113


More information about the U-Boot mailing list