Re: [PATCH 1/4 v3] x86: AMD: Replace numeric value for SME CPUID leaf with a #define

From: Paolo Bonzini
Date: Sat Sep 12 2020 - 02:54:51 EST


On 11/09/20 23:21, Borislav Petkov wrote:
> On Fri, Sep 11, 2020 at 07:25:58PM +0000, Krish Sadhukhan wrote:
>
> <-- patches need commit message.
>
> ...
>
>> diff --git a/arch/x86/kernel/cpu/scattered.c b/arch/x86/kernel/cpu/scattered.c
>> index 62b137c3c97a..033c112e03fc 100644
>> --- a/arch/x86/kernel/cpu/scattered.c
>> +++ b/arch/x86/kernel/cpu/scattered.c
>> @@ -39,8 +39,8 @@ static const struct cpuid_bit cpuid_bits[] = {
>> { X86_FEATURE_CPB, CPUID_EDX, 9, 0x80000007, 0 },
>> { X86_FEATURE_PROC_FEEDBACK, CPUID_EDX, 11, 0x80000007, 0 },
>> { X86_FEATURE_MBA, CPUID_EBX, 6, 0x80000008, 0 },
>> - { X86_FEATURE_SME, CPUID_EAX, 0, 0x8000001f, 0 },
>> - { X86_FEATURE_SEV, CPUID_EAX, 1, 0x8000001f, 0 },
>> + { X86_FEATURE_SME, CPUID_EAX, 0, CPUID_AMD_SME, 0 },
>> + { X86_FEATURE_SEV, CPUID_EAX, 1, CPUID_AMD_SME, 0 },
>
> So this one gets a name and all the others above don't?
>
> This fact should've given you a hint that there's no need for naming
> CPUID leafs - it is easier to grep CPU manuals by the values so you can
> drop this patch.

Also, there'd be confusion between the CPUID_* enum in
arch/x86/include/asm/cpufeature.h.

Paolo