x86/sgx: Hook arch_memory_failure() into mainline code
authorTony Luck <tony.luck@intel.com>
Tue, 26 Oct 2021 22:00:48 +0000 (15:00 -0700)
committerDave Hansen <dave.hansen@linux.intel.com>
Mon, 15 Nov 2021 19:13:16 +0000 (11:13 -0800)
commit03b122da74b22fbe7cd98184fa5657a9ce13970c
tree8facf7bfc6961ff9dfd924ac0d17da0ab4a277a7
parenta495cbdffa30558b34f3c95555cecc4fd9688039
x86/sgx: Hook arch_memory_failure() into mainline code

Add a call inside memory_failure() to call the arch specific code
to check if the address is an SGX EPC page and handle it.

Note the SGX EPC pages do not have a "struct page" entry, so the hook
goes in at the same point as the device mapping hook.

Pull the call to acquire the mutex earlier so the SGX errors are also
protected.

Make set_mce_nospec() skip SGX pages when trying to adjust
the 1:1 map.

Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Reviewed-by: Naoya Horiguchi <naoya.horiguchi@nec.com>
Tested-by: Reinette Chatre <reinette.chatre@intel.com>
Link: https://lkml.kernel.org/r/20211026220050.697075-6-tony.luck@intel.com
arch/x86/include/asm/processor.h
arch/x86/include/asm/set_memory.h
include/linux/mm.h
mm/memory-failure.c