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

Jarkko Sakkinen
2021-01-21T01:49:09Z

On Wed, Jan 20, 2021 at 09:40:52AM -0800, Sean Christopherson wrote:
> 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.

OK, thanks for elaboration.

To bring more context to my thinking to call this to sgx_vepc is that it's
kind of "standard" in other device names I've such as:

- vhost_net
- vhci
- vtpm
- vcs*
- The list goes on..

Since "virtual something" is always abbreviated just with a 'v', wouldn't it
make sense to just follow along?

/Jarkko