pj4 -marm breaks thumb ftrace

Russell King - ARM Linux linux at arm.linux.org.uk
Thu Nov 12 02:38:24 PST 2015


On Thu, Nov 12, 2015 at 11:30:24AM +0100, Ard Biesheuvel wrote:
> Compiling pj4-cp0.c in thumb mode fails on the sub instruction in the
> following sequence:
> 
> static void __init pj4_cp_access_write(u32 value)
> {
> u32 temp;
> 
>     __asm__ __volatile__ (
>         "mcr p15, 0, %1, c1, c0, 2\n\t"
>         "mrc p15, 0, %0, c1, c0, 2\n\t"
>         "mov %0, %0\n\t"
>         "sub pc, pc, #4\n\t"
>         : "=r" (temp) : "r" (value));
> }
> 
> I wonder if the sub instruction is simply there to flush the pipeline, but
> let's not get into that.

It is.  The whole "mov %0, %0; sub pc, pc, #4" is a documented requirement
for Xscale and derivatives to ensure that effects of previous instructions
are seen by following instructios.  It predates ARMs barriers.

-- 
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.



More information about the linux-arm-kernel mailing list