On Wed, 2021-01-06 at 14:55 +1300, Kai Huang wrote: > From: Sean Christopherson <sean.j.christopherson@xxxxxxxxx> > > SGX virtualization requires to allocate "raw" EPC and use it as virtual > EPC for SGX guest. Unlike EPC used by SGX driver, virtual EPC doesn't > track how EPC pages are used in VM, e.g. (de)construction of enclaves, > so it cannot guarantee EREMOVE success, e.g. it doesn't have a priori > knowledge of which pages are SECS with non-zero child counts. > > Split sgx_free_page() into two parts so that the "add to free list" > part can be used by virtual EPC without having to modify the EREMOVE > logic in sgx_free_page(). > > Signed-off-by: Sean Christopherson <sean.j.christopherson@xxxxxxxxx> > Signed-off-by: Kai Huang <kai.huang@xxxxxxxxx> I have a better idea with the same outcome for KVM. https://lore.kernel.org/linux-sgx/20210111223610.62261-1-jarkko@xxxxxxxxxx/T/#t /Jarkko