x86, nfit_test: Add unit test for memcpy_mcsafe()
authorDan Williams <[email protected]>
Tue, 1 May 2018 13:49:45 +0000 (06:49 -0700)
committerDan Williams <[email protected]>
Wed, 23 May 2018 06:18:31 +0000 (23:18 -0700)
commit5d8beee20d89e34ff1dcb0da84adf7607858c59d
tree8ec057691e285c7244b82bc47b077fa0ce50fae5
parent6dfdb2b6d877d654c8c7b59d7166f4d672fba4e8
x86, nfit_test: Add unit test for memcpy_mcsafe()

Given the fact that the ACPI "EINJ" (error injection) facility is not
universally available, implement software infrastructure to validate the
memcpy_mcsafe() exception handling implementation.

For each potential read exception point in memcpy_mcsafe(), inject a
emulated exception point at the address identified by 'mcsafe_inject'
variable. With this infrastructure implement a test to validate that the
'bytes remaining' calculation is correct for a range of various source
buffer alignments.

This code is compiled out by default. The CONFIG_MCSAFE_DEBUG
configuration symbol needs to be manually enabled by editing
Kconfig.debug. I.e. this functionality can not be accidentally enabled
by a user / distro, it's only for development.

Cc: <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Tony Luck <[email protected]>
Cc: Al Viro <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Linus Torvalds <[email protected]>
Reported-by: Tony Luck <[email protected]>
Signed-off-by: Dan Williams <[email protected]>
arch/x86/Kconfig.debug
arch/x86/include/asm/mcsafe_test.h [new file with mode: 0644]
arch/x86/lib/memcpy_64.S
tools/testing/nvdimm/test/nfit.c