On Fri, Apr 01, 2022 at 10:24:03PM +0800, Cathy Zhang wrote: > Regular enclave EPC pages have sgx_encl_page as their owner, but > SGX VA page and KVM guest EPC page are maintained by different > owner structures. > > SGX CPUSVN update requires to know the EPC page owner's status > and then decide how to handle the page. > > Keep a record of page type for SGX VA and KVM guest page while > the other EPC pages already have their type tracked, so that > CPUSVN update can get EPC page's owner by type and handle it then. > > Signed-off-by: Cathy Zhang <cathy.zhang@xxxxxxxxx> > --- > arch/x86/kernel/cpu/sgx/sgx.h | 4 ++++ > arch/x86/kernel/cpu/sgx/encl.c | 2 ++ > arch/x86/kernel/cpu/sgx/virt.c | 2 ++ > 3 files changed, 8 insertions(+) > > diff --git a/arch/x86/kernel/cpu/sgx/sgx.h b/arch/x86/kernel/cpu/sgx/sgx.h > index f8ed9deac18b..0b036f19cca1 100644 > --- a/arch/x86/kernel/cpu/sgx/sgx.h > +++ b/arch/x86/kernel/cpu/sgx/sgx.h > @@ -28,6 +28,10 @@ > > /* Pages on free list */ > #define SGX_EPC_PAGE_IS_FREE BIT(1) > +/* VA page */ > +#define SGX_EPC_PAGE_VA BIT(2) > +/* Pages allocated for KVM guest */ > +#define SGX_EPC_PAGE_GUEST BIT(3) Please rename this as either SGX_EPC_PAGE_KVM_GUEST or SGX_EPC_PAGE_KVM. Then it is hard to not remember what it is. BR, Jarkko