Re: [RFC PATCH v2 05/26] x86/sgx: Introduce virtual EPC for use by KVM guests

Sean Christopherson
2021-01-20T17:43:35Z

On Wed, Jan 20, 2021, Jarkko Sakkinen wrote:
> On Mon, Jan 18, 2021 at 04:26:53PM +1300, Kai Huang wrote:
> > From: Sean Christopherson <sean.j.christopherson@intel.com>
> >
> > Add a misc device /dev/sgx_virt_epc to allow userspace to allocate "raw"
> > EPC without an associated enclave. The intended and only known use case
> > for raw EPC allocation is to expose EPC to a KVM guest, hence the
> > virt_epc moniker, virt.{c,h} files and X86_SGX_VIRTUALIZATION Kconfig.
>
> Is /dev/sgx_virt_epc something only usable for KVM, or is there
> any thinkable use outside of the KVM context?

I can't think of a sane use case without KVM (or an out-of-tree hypervisor).
Doing anything useful with EPC requires ENCLS, which means being able to run
CPL0 code.