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

From: Ingo Molnar
Date: Mon Mar 17 2025 - 17:42:29 EST



* Ahmed S. Darwish <darwi@xxxxxxxxxxxxx> wrote:

> - if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD &&
> - boot_cpu_data.x86_vendor != X86_VENDOR_HYGON)
> + if (!x86_vendor_amd_or_hygon(boot_cpu_data.x86_vendor))
> return -ENODEV;

Could we just not do this?

The above vendor check may or may not be equivalent X86_FEATURE_ZEN1,
which we could first assert via a single boot-time check:

WARN_ON_ONCE(boot_cpu_has(X86_FEATURE_ZEN1) !=
((boot_cpu_data.x86_vendor != X86_VENDOR_AMD &&
boot_cpu_data.x86_vendor != X86_VENDOR_HYGON)));

And then replace all the above with the much simpler construct of:

if (!boot_cpu_has(X86_FEATURE_ZEN1))
return -ENODEV;

But I'd suggest keeping this patch at the tail of the series, because
if it regresses it would be easier to drop/revert.

Thanks,

Ingo