Re: [PATCH 02/25] x86/cpufeatures: Add SGX1 and SGX2 sub-features

From: Kai Huang
Date: Tue Mar 02 2021 - 16:30:12 EST



On Tue, 2021-03-02 at 18:53 +0100, Boris Petkov wrote:
> On March 2, 2021 5:02:13 PM GMT+01:00, Sean Christopherson <seanjc@xxxxxxxxxx> wrote:
> > The KVM use case is to query /proc/cpuinfo to see if sgx2 can be
> > enabled in a
> > guest.
>
> You mean before the guest ia created? I sure hope there's a better way to query HV-supported features than grepping /proc/cpuinfo...
>
> > The counter-argument to that is we might want sgx2 in /proc/cpuinfo to
> > mean sgx2
> > is enabled in hardware _and_ supported by the kernel. Userspace can
> > grep for
> > sgx in /proc/cpuinfo, and use cpuid to discover sgx2, so it's not a
> > blocker.
>
> Question is, what exactly that flag should denote: that EDMM is supported in the HV and guests can do the dynamic thing of adding/rwmoving EPC pages? Is that the only feature behind SGX2?

Yes SGX2 == EDMM. Other sub-features, such as VMM oversubscription, have other CPUID
bits.

>
> > That being said, adding some form of capability/versioning to SGX seems
> > inevitable, not sure it's worth witholding sgx2 from /proc/cpuinfo.
>
> See what I typed earlier - no objections from me if a proper use case is identified and written down.
>
> Thx.