From: Sohil Mehta <sohil.mehta@intel.com>
To: Borislav Petkov <bp@alien8.de>, Sean Christopherson <seanjc@google.com>
Cc: x86-ML <x86@kernel.org>, LKML <linux-kernel@vger.kernel.org>,
Dave Hansen <dave.hansen@linux.intel.com>,
"Luck, Tony" <tony.luck@intel.com>
Subject: Re: [RFC PATCH] x86/cpu: Change AMD uarch detection
Date: Fri, 30 Oct 2026 14:29:25 -0700 [thread overview]
Message-ID: <2a6f9c90-a6a3-4b4b-a77b-9a3b99d66d4a@intel.com> (raw)
In-Reply-To: <20261029175611.GEauOIu-Xi9_DGVXKe@fat_crate.local>
On 10/29/2026 10:56 AM, Borislav Petkov wrote:
> Looks easy enough but needs thorough testing and perhaps some commenting how
> we're using x86_vfm on AMD a bit differently.
>
I was working on adding guidance for x86_vfm usage for Intel in the
kernel documentation when I saw this thread. Here's the initial draft I
had for Intel:
Intel CPU model checks
----------------------
Intel CPU model checks should use the combined vendor/family/model
field, x86_vfm, together with the INTEL_* defines in
asm/intel-family.h. Avoid comparing x86_model against literal
model numbers. Instead of writing::
if (c->x86 == 6 && c->x86_model == 0x97)
Please use::
if (c->x86_vfm == INTEL_ALDERLAKE)
To match several models, prefer an x86_match_cpu() table built
with X86_MATCH_VFM(). If a model is missing from
asm/intel-family.h, add a define for it.
Range checks on x86_vfm can work, but they are discouraged for
newer CPUs. Model numbers are not assigned in release order, and
the newer Families 18 and 19 interleave with Family 6, which makes
ranges hard to get right.
IIUC, the AMD usage is primarily geared towards range checks for a group
of CPUs whereas the Intel usage is for specific targeted CPUs.
Expressing uarch reusing x86_vfm and using it for range checks can be
tricky. See below.
> amd-family.h is not really necessary right now but that's immaterial for this
> change - we can always convert to it later if absolutely necessary. And
> I don't think it will be.
>
...
> @@ -483,13 +482,13 @@ static void bsp_init_amd(struct cpuinfo_x86 *c)
> switch (c->x86_model) {
> case 0x00 ... 0x2f:
> case 0x50 ... 0x5f:
> - setup_force_cpu_cap(X86_FEATURE_ZEN1);
> + c->x86_vfm = AMD_ZEN1;
Since x86_vfm is a union, wouldn't this clobber the vendor, family and
model? This will set the x86_vendor to 0 and get detected as an Intel CPU.
> break;
> case 0x30 ... 0x4f:
> case 0x60 ... 0x7f:
> case 0x90 ... 0x91:
> case 0xa0 ... 0xaf:
> - setup_force_cpu_cap(X86_FEATURE_ZEN2);
> + c->x86_vfm = AMD_ZEN2;
> break;
> default:
next prev parent reply other threads:[~2026-10-30 21:29 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-22 4:00 Borislav Petkov
2026-10-27 15:20 ` Sean Christopherson
2026-10-28 4:46 ` Borislav Petkov
2026-10-28 14:05 ` Sean Christopherson
2026-10-28 15:34 ` Borislav Petkov
2026-10-29 17:56 ` Borislav Petkov
2026-10-30 19:13 ` Sean Christopherson
2026-10-30 21:29 ` Sohil Mehta [this message]
2026-10-31 1:55 ` Borislav Petkov
2026-10-31 5:08 ` Sohil Mehta
2026-10-31 5:32 ` Borislav Petkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2a6f9c90-a6a3-4b4b-a77b-9a3b99d66d4a@intel.com \
--to=sohil.mehta@intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=seanjc@google.com \
--cc=tony.luck@intel.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®