Re: [RFC PATCH 04/23] x86/cpufeatures: Add SGX1 and SGX2 sub-features

Dave Hansen
2021-01-08T05:11:31Z

On 1/7/21 6:00 PM, Kai Huang wrote:
> On Thu, 7 Jan 2021 07:41:25 +0100 Borislav Petkov wrote:
>> On Thu, Jan 07, 2021 at 12:09:46PM +1300, Kai Huang wrote:
>>> There's no urgent request to support them for now (and given basic SGX
>>> virtualization is not in upstream), but I don't know whether they need to be
>>> supported in the future.
>>
>> If that is the case, then wasting a whole leaf for two bits doesn't make
>> too much sense. And it looks like the kvm reverse lookup can be taught
>> to deal with composing that leaf dynamically when needed instead.
>
> I am not sure changing reverse lookup to handle dynamic would be acceptable. To
> me it is ugly, and I don't have a first glance on how to do it. KVM can query
> host CPUID when dealing with SGX w/o X86_FEATURE_SGX1/2, but it is not as
> straightforward as having X86_FEATURE_SGX1/2.

So, Boris was pretty direct here. Could you please go spend a bit of
time to see what it would take to make these dynamic? You can check
what our (Intel) plans are for this leaf, but if it's going to remain
sparsely-used, we need to look into making the leaves a bit more dynamic.

> And regarding to other bits of this leaf, to me: 1) we cannot rule out
> possibility that bit 5 and bit 6 will be supported in the future; 2) I cannot
> talk more but we cannot rule out the possibility that there will be other bits
> introduced in the future.

From the Intel side, let's go look at the features that are coming. We
have a list of CPUID bits that have been dedicated to future CPU
features. Let's look if 1 of these bits or 30 is coming. I don't think
it's exactly a state secret approximately how many CPUID bits we *think*
will get used in this leaf.

We can't exactly put together a roadmap of bits, microarchitectures and
chip release dates. But, we can at least say, "we have immediate plans
for most of the leaf" or "we don't plan to fill up the leaf any time soon."