Re: [PATCH v39 01/24] x86/cpufeatures: x86/msr: Add Intel SGX hardware bits

From: Dave Hansen
Date: Mon Oct 19 2020 - 10:11:02 EST


On 10/2/20 9:50 PM, Jarkko Sakkinen wrote:
>
> Add X86_FEATURE_SGX1 and X86_FEATURE_SGX2 from CPUID.(EAX=12H, ECX=0),
> which describe the level of SGX support available [1].

The SDM says there are 6 leaf functions added with SGX2 (SDM Vol 3D
Table 36-2):

ENCLS[EAUG]
ENCLS[EMODPR]
ENCLS[EMODT]
ENCLU[EACCEPT]
ENCLU[EMODPE]
ENCLU[EACCEPTCOPY]

But I don't see *ANY* of those in use in this patch set. I know we
added a bunch of infrastructure around mitigating if EMODPE got *used*,
but does the kernel need to change its behavior if SGX1 vs. SGX2 is
supported?

BTW, the SG2 bit is defined:

Bit 01: SGX2. If 1, Indicates Intel SGX supports the collection
of SGX2 leaf functions.

which makes me think it's for leaf functions only.