[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ccf47e0f-cd5e-4669-b75a-bbba9e56243f@citrix.com>
Date: Mon, 17 Mar 2025 18:10:27 +0000
From: Andrew Cooper <andrew.cooper3@...rix.com>
To: Peter Zijlstra <peterz@...radead.org>, Borislav Petkov <bp@...en8.de>
Cc: "Ahmed S. Darwish" <darwi@...utronix.de>, Ingo Molnar <mingo@...hat.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Thomas Gleixner <tglx@...utronix.de>, "H. Peter Anvin" <hpa@...or.com>,
John Ogness <john.ogness@...utronix.de>, x86@...nel.org,
x86-cpuid@...ts.linux.dev, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 01/29] x86: treewide: Introduce
x86_vendor_amd_or_hygon()
On 17/03/2025 5:48 pm, 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.
AMD and Hygon the most often compared together, because the Hygon CPUs
are so close to Zen1/2.
One trick you can do to make this easier is to define vendors IDs as (1U
<< $N). This leaves all existing code with equality checks working, but
also lets you check "vendor & (AMD | HYGON)" rather more efficiently.
~Andrew
Powered by blists - more mailing lists