selftests/powerpc: Check all FPRs in fpu_syscall test
authorMichael Ellerman <mpe@ellerman.id.au>
Tue, 28 Nov 2023 13:27:48 +0000 (00:27 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 13 Dec 2023 02:29:09 +0000 (13:29 +1100)
commit1bdf22580b794a498b17617bcd7ae417d6b78444
tree1181a74fe79e53a965520d9a5212d596a870fd5f
parent60d2c3af9a0c04dc2d34a62e9f5e7033b40dfed8
selftests/powerpc: Check all FPRs in fpu_syscall test

There is a selftest that checks if FPRs are corrupted across a fork, aka
clone. It was added as part of the series that optimised the clone path
to save the parent's FP state without "giving up" (turning off FP).

See commit 8792468da5e1 ("powerpc: Add the ability to save FPU without
giving it up").

The test encodes the assumption that FPRs 0-13 are volatile across the
syscall, by only checking the volatile FPRs are not changed by the fork.
There was also a comment in the fpu_preempt test alluding to that:

  The check_fpu function in asm only checks the non volatile registers
  as it is reused from the syscall test

It is true that the function call ABI treats f0-f13 as volatile,
however the syscall ABI has since been documented as *not* treating those
registers as volatile. See commit 7b8845a2a2ec ("powerpc/64: Document
the syscall ABI").

So change the test to check all FPRs are not corrupted by the syscall.
Note that this currently fails, because save_fpu() etc. do not restore
f0/vsr0.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20231128132748.1990179-5-mpe@ellerman.id.au
tools/testing/selftests/powerpc/math/fpu_asm.S
tools/testing/selftests/powerpc/math/fpu_syscall.c