Subject: Re: [RFC/PATCH 1/3] powerpc: add ioremap_bat() function for setting up BAT translated IO regions.

From: Benjamin Herrenschmidt <[email-masked]>
Date: Fri, 08 Aug 2008 08:09:11 +1000

On Wed, 2008-08-06 at 17:11 -0600, Grant Likely wrote:
> I'm not sure what you're asking.  Are you asking about this particular
> test, or are you asking why I don't also test the size?

Badly worded. 

I meant BAT sizes are masks of bits. IE, they are power of 2 and the
BAT address must be aligned to that power of 2 (ie, the BAT matching
uses the size as a bit mask of relevant bits to compare).

Unless I misread, your code doesn't provide the necessary tests/rounding
of size and alignment of the virtual address.. does it ?
 
> I do this particular test to make absolute sure that the caller
> absolutely understands the limitations of the block mapping.  If they
> call this with something that isn't 128k aligned, then I make it fail
> immediately so the coder is forced to go and understand what they are
> allowed to do.  Basically, I'm reinforcing the fact that this is not
> the same as ioremap().
> 
> I haven't decided yet if I should test size in the same way.
> Thoughts?

Ben.