Subject: Re: [PATCH] [PPC 44x] L2-cache synchronization for ppc44x

From: Benjamin Herrenschmidt <[email-masked]>
Date: Mon, 26 Nov 2007 17:47:30 +1100

On Thu, 2007-11-08 at 02:12 +0300, Yuri Tikhonov wrote:
> This is the updated patch for support synchronization of L2-Cache with the external memory on the ppc44x-based platforms.
> 
>  Differencies against the previous patch-set:
> - remove L2_CACHE config option;
> - introduce the ppc machdep to invalidate L2 cache lines;
> - some code clean-up.
> 
> Signed-off-by: Yuri Tikhonov <[email-masked]>
> Signed-off-by: Pavel Kolesnikov <[email-masked]>

It's almost right :-0

You want something a bit more details than just a
ppc_md.l2cache_inv_range.

I'd suggest you do a separate extcache_ops structure that contains
callbacks for all 3 directions (flush, flush & invalidate, invalidate),
then fill that up accordingly.

It might be a good idea in the long run to do some tricks to avoid a
branch via function pointer since the cache ops are pretty "hot", but if
that ever happens, I'll do that via asm patching tricks I suppose.

Now regarding the line size, I would recommend using the device-tree to
describe the cache instead rather than a config option. The intend is to
be able to build a single binary kernel that can boot multiple variants
of 44x.

I may eventually rewrite your patch around those ideas next week if you
don't feel like doing it -and- I get bored :-)

Cheers,
Ben.