Re: [tip:x86/urgent] x86/CPU: Add native CPUID variants returning a single datum

From: hpa
Date: Tue Jan 10 2017 - 11:41:04 EST


On January 10, 2017 1:04:15 AM PST, Borislav Petkov <bp@xxxxxxx> wrote:
>On Mon, Jan 09, 2017 at 04:19:29PM -0800, hpa@xxxxxxxxx wrote:
>> Any reason to not make these interfaces (leaf, subleaf) from the
>start?
>
>Two, actually:
>
>1. I modelled them after the cpuid_<reg>(op) versions

You are introducing a new API; makes more sense to do it right from the start. The only reason not to have a subleaf for the non-native variants is that they may decay into a function call so there is an extra cost.

>2. I don't think we need the subleaf variant right now.

But at some point we will. Just consider leaf 7.

>But, when we do, we can do that when we cross that bridge and add
>
>native_cpuid_<reg>(leaf, subleaf)
>
>which gets called by the native_cpuid_<reg>(leaf) variants.

C doesn't allow function name overloading ;) (Well, except the C11 type hacks; to the best of my knowledge that doesn't in any way support argument *count* overloading.)

This means that the naming will be awkward at best.


--
Sent from my Android device with K-9 Mail. Please excuse my brevity.