ARM: vfp: fix saving d16-d31 vfp registers on v6+ kernels
authorRussell King <rmk+kernel@arm.linux.org.uk>
Tue, 9 Oct 2012 10:13:26 +0000 (11:13 +0100)
committerBen Hutchings <ben@decadent.org.uk>
Tue, 30 Oct 2012 23:26:38 +0000 (23:26 +0000)
commita92fc36ebe032a04313cdf16b2152e36ca7c20c3
treedc8c2f5f388609b57b5e8c67be03b9b42b168cad
parent5d1d1dbc9d31707d00d4c77f3359e6c9ed992766
ARM: vfp: fix saving d16-d31 vfp registers on v6+ kernels

commit 846a136881b8f73c1f74250bf6acfaa309cab1f2 upstream.

Michael Olbrich reported that his test program fails when built with
-O2 -mcpu=cortex-a8 -mfpu=neon, and a kernel which supports v6 and v7
CPUs:

volatile int x = 2;
volatile int64_t y = 2;

int main() {
volatile int a = 0;
volatile int64_t b = 0;
while (1) {
a = (a + x) % (1 << 30);
b = (b + y) % (1 << 30);
assert(a == b);
}
}

and two instances are run.  When built for just v7 CPUs, this program
works fine.  It uses the "vadd.i64 d19, d18, d16" VFP instruction.

It appears that we do not save the high-16 double VFP registers across
context switches when the kernel is built for v6 CPUs.  Fix that.

Tested-By: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
arch/arm/include/asm/vfpmacros.h