[U-Boot] [PATCH v2] ARM926ejs: Add routines to invalidate D-Cache

Albert ARIBAUD
2011-08-08T11:05:07Z

Hi Aneesh,

On 08/08/2011 12:27, Aneesh V wrote:
> Hi Reinhard,
>
> On Monday 08 August 2011 03:55 PM, Reinhard Meyer wrote:
>> Hi Aneesh,
>>> On Monday 08 August 2011 03:29 PM, Reinhard Meyer wrote:
>>>> Dear Albert, Aneesh, Hong,
>>>>
>>>> There seem to be functions of type
>>>>
>>>> xxx(start, end) and xxx(start, size).
>>>>
>>>> Can't it be somehow decided to use only one variant
>>>> in all cases (flush, invalidate)?
>>>
>>> The u-boot standard seems to be xxx(start, end) where the operation
>>> will be done on the range [start, end). This is what I figured out by
>>> looking at the prototypes and existing implementations when I did the
>>> armv7 work and I have stuck to this standard.
>>>
>>> Hong also seems to be following the same standard.
>>>
>>> If there is no objection, I shall add this definition to the README I
>>> am adding.
>>
>> Maybe its arch specific, I just saw this in another thread, thats why
>> I asked:
>>
>>
>> +++ b/arch/mips/cpu/mips32/cpu.c
>> @@ -52,6 +52,11 @@ int do_reset(cmd_tbl_t *cmdtp, int flag, int argc,
>> char * const argv[])
>>
>> void flush_cache(ulong start_addr, ulong size)
>
> I think the confusion about flush_cache() is because in
> include/common.h the prototype for flush_cache() doesn't have names for
> the paramaeters. It's like this:
>
> void flush_cache (unsigned long, unsigned long);
>
> However, the invalidate and flush range functions are clearly defined:
>
> void flush_dcache_range(unsigned long start, unsigned long stop);
> void invalidate_dcache_range(unsigned long start, unsigned long stop);
>
> I don't know what to do about flush_cache() now that it seems to have
> conflicting implementations.

My opinion is that global cache functions should not have arguments at
all and should act on the full cache. Note that drivers should only use
range versions, not global versions; the only places I see global cache
actions occurring are initialization when invalidating the whole cache
just before enabling it, and control transfer to an OS where the whole
cache should be flushed, invalidated and then disabled before jumping to
the OS.

So here, if any arch has cache functions that are non-global but don't
have "range" in their names, that should be changed.

Also, any function with only parameter types have parameter names added
(cosmetic patch welcome for anything of this kind in ARM).

> best regards,
> Aneesh

Amicalement,
--
Albert.