lkml.org 
[lkml]   [1999]   [Aug]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: New resources - pls, explain :-(
> IN FACT we would be extremely stupid if we were to do the above. Why
> export four interfaces when two would do?
>
> Why do you continue to think that endianness is an issue? You have
> perfectly fine macros to handle endianness already, why mix that in with
> the IO part?
>
> If you just say that "__writel()" does the native byte order, then you can
> do cpu_to_be32() and get exactly the semantics that you seem to want. I
> don't understand WHY you'd want them, but I can just tell you to do
>
> __writel(cpu_to_be32(x),y)
>
> and it will be equivalent to your __writel_be(). I don't see why anybody
> would ever use the above, as the only arguments for the _be version so far
> have really been arguments for _native_ byte order on BE machines, but
> that's all the more reason to not do something silly like export hundreds
> of slightly different and useless versions of IO access.

E.g. because __writel_be(x,y) can be optimized much more than
__writel(cpu_to_be32(x),y)?
I mean it is a similar reason why there are cpu_to_be32p and cpu_to_be32.
The former is one instruction on sparc64 (the memory load with byte
swapping), the latter is a bunch of instructions (the load, several shifts
and several maskings). On sparc64 particularly will be __writel == writel
because ioremap (which is return physical address + magic; btw) will make
sure the side effect bit is set for the pages, but I guess other
architectures have similar byte swapping instructions.
One could argue that gcc could be tought to optimize sequences like
x = *(u32 *)addr;
x = ((__u32)( \
(((__u32)(x) & (__u32)0x000000ffUL) << 24) | \
(((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \
(((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \
(((__u32)(x) & (__u32)0xff000000UL) >> 24) ));
into lduwa [addr] ASI_PL, x
but it won't be easy and I wonder if it is used much outside of kernel to be
really worth implementing.

Cheers,
Jakub
___________________________________________________________________
Jakub Jelinek | jj@sunsite.mff.cuni.cz | http://sunsite.mff.cuni.cz
Administrator of SunSITE Czech Republic, MFF, Charles University
___________________________________________________________________
UltraLinux | http://ultra.linux.cz/ | http://ultra.penguin.cz/
Linux version 2.3.13 on a sparc64 machine (1343.49 BogoMips)
___________________________________________________________________

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:53    [W:0.192 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site