Re: [PATCH v2 01/29] x86: treewide: Introduce x86_vendor_amd_or_hygon()

From: Dave Hansen
Date: Mon Mar 17 2025 - 14:11:36 EST


On 3/17/25 10:48, Peter Zijlstra wrote:
> On Mon, Mar 17, 2025 at 06:32:16PM +0100, Borislav Petkov wrote:
>> On Mon, Mar 17, 2025 at 05:47:17PM +0100, Ahmed S. Darwish wrote:
>>> The pattern to check if an x86 vendor is AMD or HYGON (or not both) is
>>> pretty common. Introduce x86_vendor_amd_or_hygon() at <asm/processor.h>
>> So if we need to check "intel too", we do
>>
>> x86_vendor_amd_or_hygon_or_intel?
>>
>> Nah, this is silly.
> Would it make more sense to have a Zen1 feature and check that instead?
>
> Because, IIRC Hygon is simply a Zen1 copy.

Some of them can just go away, I think. This, for instance:

if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD &&
boot_cpu_data.x86_vendor != X86_VENDOR_HYGON)
return false;

if (cpu_feature_enabled(X86_FEATURE_ZEN))
return false;

Do we even need a vendor check if we're checking X86_FEATURE_ZEN? Is
someone setting X86_FEATURE_ZEN on Intel? ;)