[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aXA0DAXJSkBn3l9r@intel.com>
Date: Wed, 21 Jan 2026 10:03:56 +0800
From: Chao Gao <chao.gao@...el.com>
To: Dave Hansen <dave.hansen@...el.com>
CC: Dave Hansen <dave.hansen@...ux.intel.com>, <linux-kernel@...r.kernel.org>,
<sohil.mehta@...el.com>, Borislav Petkov <bp@...en8.de>, "H. Peter Anvin"
<hpa@...or.com>, Ingo Molnar <mingo@...hat.com>, Jon Kohler
<jon@...anix.com>, Pawan Gupta <pawan.kumar.gupta@...ux.intel.com>, "Peter
Zijlstra (Intel)" <peterz@...radead.org>, Thomas Gleixner <tglx@...nel.org>,
Tony Luck <tony.luck@...el.com>, <x86@...nel.org>
Subject: Re: [PATCH 4/6] x86/cpu: Add platform ID to CPU info structure
On Tue, Jan 20, 2026 at 07:22:54AM -0800, Dave Hansen wrote:
>On 1/19/26 19:14, Chao Gao wrote:
>>> __u8 x86_stepping;
>>> + __u8 x86_platform_id; /* Intel-only. 3 bits */
>> Tail comments are not preferred. I've seen tglx complain about them a few times.
>
>Yeah, you're right. It doesn't fit well with the rest of the structure.
>I'll fix it.
>
>> Also, "3 bits" is misleading since x86_platform_id actually stores a bit mask.
>
>Remember, there are two structures in play here. From the cover letter:
>
>> Treat the platform ID as a peer of model/family/stepping. Store it
>> in 'struct cpuinfo_x86', enable matching on it with with 'struct
>> x86_cpu_id', and flesh out the 'old_microcode' list with it.
>
>This hunk is patching 'cpuinfo_x86' which stores the 3 bits explicitly.
Hi Dave,
This patch has:
c->x86_platform_id = intel_get_platform_id();
but intel_get_platform_id() doesn't return the 3 bits; it returns a
single-bit mask (or 0 on old CPUs).
+static inline u32 intel_get_platform_id(void)
+{
+ unsigned int val[2];
+
+ /*
+ * This can be called early. Use CPUID directly to
+ * generate the VFM value for this CPU.
+ */
+ if (intel_cpuid_vfm() < INTEL_PENTIUM_III_DESCHUTES)
+ return 0;
+
+ /* get processor flags from MSR 0x17 */
+ native_rdmsr(MSR_IA32_PLATFORM_ID, val[0], val[1]);
+ return 1 << ((val[1] >> 18) & 7);
+}
>
>I think you're thinking of the mask in 'x86_cpu_id' which is used for
>_matching_ this field in patch 5.
>
>Could you double check that you're asking about the right structure,
>please? I've certainly gotten the two structures mixed up before.
Powered by blists - more mailing lists