x86/sgx: Replace section->init_laundry_list with sgx_dirty_page_list
authorJarkko Sakkinen <jarkko@kernel.org>
Wed, 17 Mar 2021 23:53:30 +0000 (01:53 +0200)
committerBorislav Petkov <bp@suse.de>
Thu, 18 Mar 2021 15:17:26 +0000 (16:17 +0100)
commit51ab30eb2ad4c4a61f827dc18863cd70dc46dc32
treeb661b7a63dd656630ef9c807c525794e570e9977
parent1e28eed17697bcf343c6743f0028cc3b5dd88bf0
x86/sgx: Replace section->init_laundry_list with sgx_dirty_page_list

During normal runtime, the "ksgxd" daemon behaves like a version of
kswapd just for SGX. But, before it starts acting like kswapd, its first
job is to initialize enclave memory.

Currently, the SGX boot code places each enclave page on a
epc_section->init_laundry_list. Once it starts up, the ksgxd code walks
over that list and populates the actual SGX page allocator.

However, the per-section structures are going away to make way for the
SGX NUMA allocator. There's also little need to have a per-section
structure; the enclave pages are all treated identically, and they can
be placed on the correct allocator list from metadata stored in the
enclave page (struct sgx_epc_page) itself.

Modify sgx_sanitize_section() to take a single page list instead of
taking a section and deriving the list from there.

Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Dave Hansen <dave.hansen@linux.intel.com>
Link: https://lkml.kernel.org/r/20210317235332.362001-1-jarkko.sakkinen@intel.com
arch/x86/kernel/cpu/sgx/main.c
arch/x86/kernel/cpu/sgx/sgx.h