Re: [PATCH v2] hvc_dcc : add support to armv4 and armv5 core

From: Arnd Bergmann
Date: Tue Sep 25 2012 - 13:11:02 EST


On Tuesday 25 September 2012, Matthieu CASTET wrote:
> > static inline char __dcc_getchar(void)
> > {
> > char __c;
> >
> > if (__LINUX_ARM_ARCH >= 6)
> > asm volatile("mrc p14, 0, %0, c0, c5, 0 @ read comms data reg"
> > : "=r" (__c));
> > else
> > asm volatile ("mrc p14, 0, %0, c1, c0 @ read comms data reg"
> > : "=r" (ret));
> > isb();
> >
> > return __c;
> > }
> >
> > Arnd
> >
> Yes doing that will be great!
>
> But Alan wanted "all be runtime handled".
>
> May be we can do something like:
>
>
> static int cpu_arch;
>
> static inline char __dcc_getchar(void)
> {
> char __c;
>
> if (cpu_arch >= 6)
> asm volatile("mrc p14, 0, %0, c0, c5, 0 @ read comms data reg"
> : "=r" (__c));
> else
> asm volatile ("mrc p14, 0, %0, c1, c0 @ read comms data reg"
> : "=r" (ret));
> isb();
>
> return __c;
> }

It's not possible to build a kernel that runs on ARMv5 (or below) and also on
ARMv6 (or above), so the effect would be exactly the same. While we are putting
a lot of effort into making all sorts of ARMv6 and ARMv7 based systems work
with the same kernel binary, it's highly unlikely we would ever need the
above to be runtime selected, because there are a lot of other differences
at assembly level.

Arnd

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