This patch set contains my fixes and updates for v23 except sgx_alloc_page() changes that I will submit a bit later. v3: * Rebasing did not went right in the last version. v2: * Added the bug fix to not allow legitly BLOCKED pages to end up to the free page pool. Cc: Sean Christopherson <sean.j.christopherson@xxxxxxxxx> Cc: Shay Katz-zamir <shay.katz-zamir@xxxxxxxxx> Cc: Serge Ayoun <serge.ayoun@xxxxxxxxx> Jarkko Sakkinen (17): selftest/x86/sgx: Remove encl_piggy.h x86/sgx: Clean up internal includes x86/sgx: Write backing storage only if EWB is successful x86/sgx: Rename 'j' as 'cnt' in sgx_reclaim_pages() x86/sgx: Turn encls_failed() as inline function x86/sgx: Move sgx_einit() to encls.c x86/sgx: Remove pages in sgx_reclaimer_write() x86/sgx: Calculate page index in sgx_reclaimer_write() x86/sgx: Move SGX_ENCL_DEAD check to sgx_reclaimer_write() x86/sgx: Free VA slot when the EWB flow fails x86/sgx: Call sgx_encl_destroy() when the EWB flow fails x86/sgx: Open code sgx_reclaimer_get() and sgx_reclaimer_put() x86/sgx: Introduce sgx_can_reclaim() x86/sgx: Replace section->free_cnt with a global sgx_nr_free_pages x86/sgx: sgx_vma_access(): Do not return -ECANCELED on invalid TCS pages x86/sgx: Introduce sgx_encl_get_backing() x86/sgx: Fix pages in the BLOCKED state ending up to the free pool arch/x86/kernel/cpu/sgx/driver.c | 2 + arch/x86/kernel/cpu/sgx/driver.h | 3 - arch/x86/kernel/cpu/sgx/encl.c | 104 +++---- arch/x86/kernel/cpu/sgx/encl.h | 23 +- arch/x86/kernel/cpu/sgx/encls.c | 54 +++- arch/x86/kernel/cpu/sgx/encls.h | 23 +- arch/x86/kernel/cpu/sgx/ioctl.c | 5 +- arch/x86/kernel/cpu/sgx/main.c | 64 +--- arch/x86/kernel/cpu/sgx/reclaim.c | 299 +++++++++---------- arch/x86/kernel/cpu/sgx/sgx.h | 6 +- tools/testing/selftests/x86/sgx/encl_piggy.h | 14 - tools/testing/selftests/x86/sgx/main.c | 1 - 12 files changed, 276 insertions(+), 322 deletions(-) delete mode 100644 tools/testing/selftests/x86/sgx/encl_piggy.h -- 2.20.1