[U-Boot] [PATCH] nios2: convert cache flush to use dm cpu data

Ley Foon Tan
2015-10-09T02:49:03Z

On Fri, Oct 9, 2015 at 5:39 AM, Marek Vasut <marex@denx.de> wrote:

>> +
>> +DECLARE_GLOBAL_DATA_PTR;
>> +
>> +static void __flush_dcache_all(unsigned long start, unsigned long end)
>> +{
>> + unsigned long addr;
>> +
>> + start &= ~(gd->arch.dcache_line_size - 1);
>
> I'd suggest to use GENMASK() here, but I don't think we picked this from Linux
> just yet.
>
>> + end += (gd->arch.dcache_line_size - 1);
>> + end &= ~(gd->arch.dcache_line_size - 1);
>
> Is this an attempt at poor-mans' rounding ? I think you want to implment
> something like arch/arm/cpu/arm926ejs/cache.c check_cache_range() and NOT
> do any rounding here. The reason for that is that if you do rounding, you
> might accidentally corrupt a piece of memory which was just delivered via
> DMA before you did the flush.
The code above is to convert the address to dcache line size.
arch/arm/cpu/arm926ejs/cache.c check_cache_range() will skip the cache
flushing if it is unaligned to cache line size. I'm not sure how
frequent U-boot access to non-aligned cache line size.

Regards
Ley Foon