From nobody Thu Apr 2 06:32:31 2026 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 29A9F3A255D for ; Wed, 4 Mar 2026 18:10:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772647822; cv=none; b=AN5HLUMO1/pekZjwT5KF0UZxOmQyn2gsnrESyy0d2YIyjd+8wnmMBB6/Ie70x3CUNy4qvhKL7Ko7Xng2gAubDXpqL2wIONl3Lc+269Siia3C9uyx/mIyf4BbIFKyXhnsg10rwv1bDlVP2xHu5lVO778p9iO1Q0XQYZdH8TAv1VQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772647822; c=relaxed/simple; bh=MmTETMKUaJp+MeJ5YNbDKZaL7oSjQVJatBReOClA1vw=; h=Subject:To:Cc:From:Date:References:In-Reply-To:Message-Id; b=a4+AJgLkZAH4YHEg8kUd2Ir22mo1fCYKD6WVkkCLvfVbivmCc+UdPP9FkvwEI/5knKg6AWMwCUWKf0LLO7Mc4Fvh34T81kRsw33saoUxvFkuuUAlS1BuxDeSjWL3gmv9rcSXe3eErIrjbNMz260IcxGvo94rzzKOU+2RCEnIT8w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=deS9A9sw; arc=none smtp.client-ip=192.198.163.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="deS9A9sw" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1772647821; x=1804183821; h=subject:to:cc:from:date:references:in-reply-to: message-id; bh=MmTETMKUaJp+MeJ5YNbDKZaL7oSjQVJatBReOClA1vw=; b=deS9A9swVa7WRqsJTQFACM+QWZ8lsDoSIXN/j18Y2ncfM4lae/p/6YCL gq4jG3CWVPX3h4qU8OFDFBVwlUkZHfuCGpAyaaprbb9POG27wx6aXw9P8 EsnxVwDthLPf1vdd6jwq+Xqo9nVogCEFZ4meIDtodOhgPqzYOM32fRcVv szjF3GOBPpC7tSrLsh+zPUYeJT918FlKGGfuvCDy/biOBG7akxohG+ieY tGIzJD8GdhILmX20soLiKfj8fQySKhfMLcrVUxBDxTSREyYH9gqycXrSC jrzEy1Fx0roEWitdNf2/UY91o/HL0PoDovHBs14WB51xYiv8FhnJlodaz Q==; X-CSE-ConnectionGUID: /wDQFQwRTwGQ6k83e3rKHQ== X-CSE-MsgGUID: RJOI8wm6S/eU+lZSxkUbHw== X-IronPort-AV: E=McAfee;i="6800,10657,11719"; a="61291103" X-IronPort-AV: E=Sophos;i="6.21,324,1763452800"; d="scan'208";a="61291103" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Mar 2026 10:10:21 -0800 X-CSE-ConnectionGUID: a4i7foiiRyWhcUUb//euUw== X-CSE-MsgGUID: mea9muL6QhunkvCIwfPjsg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,324,1763452800"; d="scan'208";a="215752588" Received: from davehans-spike.ostc.intel.com (HELO localhost.localdomain) ([10.165.164.11]) by fmviesa010.fm.intel.com with ESMTP; 04 Mar 2026 10:10:21 -0800 Subject: [PATCH v4 2/4] x86/cpu: Add platform ID to CPU info structure To: linux-kernel@vger.kernel.org Cc: sohil.mehta@intel.com, zhao1.liu@intel.com, Dave Hansen , Borislav Petkov , "H. Peter Anvin" , Ingo Molnar , Jon Kohler , Pawan Gupta , "Peter Zijlstra (Intel)" , Thomas Gleixner , Tony Luck , x86@kernel.org From: Dave Hansen Date: Wed, 04 Mar 2026 10:10:20 -0800 References: <20260304181016.85EC87C7@davehans-spike.ostc.intel.com> In-Reply-To: <20260304181016.85EC87C7@davehans-spike.ostc.intel.com> Message-Id: <20260304181020.8D518228@davehans-spike.ostc.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Dave Hansen The end goal here is to be able to do x86_match_cpu() and match on a specific platform ID. While it would be possible to stash this ID off somewhere or read it dynamically, that approaches would not be consistent with the other fields which can be matched. Read the platform ID and store it in cpuinfo_x86. There are lots of sites to set this new field. Place it near the place c->microcode is established since the platform ID is so closely intertwined with microcode updates. Note: This should not grow the size of 'struct cpuinfo_x86' in practice since the u8 fits next to another u8 in the structure. Signed-off-by: Dave Hansen Reviewed-by: Sohil Mehta Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: "H. Peter Anvin" Cc: Tony Luck Cc: Pawan Gupta Cc: "Peter Zijlstra (Intel)" Cc: x86@kernel.org Cc: Jon Kohler -- Changes from v2: * rename x86_platform_id=3D>intel_platform_id and remove initialization from generic code * Add a amd_unused so it's clear the AMD folks have a free field to play with. Reviewed-by: Pawan Gupta --- b/arch/x86/include/asm/microcode.h | 2 ++ b/arch/x86/include/asm/processor.h | 5 +++++ b/arch/x86/kernel/cpu/intel.c | 1 + b/arch/x86/kernel/cpu/microcode/intel.c | 2 +- 4 files changed, 9 insertions(+), 1 deletion(-) diff -puN arch/x86/include/asm/microcode.h~cpu-x86_stepping arch/x86/includ= e/asm/microcode.h --- a/arch/x86/include/asm/microcode.h~cpu-x86_stepping 2026-02-24 15:37:21= .947261472 -0800 +++ b/arch/x86/include/asm/microcode.h 2026-02-24 15:37:21.955261858 -0800 @@ -61,6 +61,8 @@ static inline int intel_microcode_get_da return hdr->datasize ? : DEFAULT_UCODE_DATASIZE; } =20 +extern u32 intel_get_platform_id(void); + static inline u32 intel_get_microcode_revision(void) { u32 rev, dummy; diff -puN arch/x86/include/asm/processor.h~cpu-x86_stepping arch/x86/includ= e/asm/processor.h --- a/arch/x86/include/asm/processor.h~cpu-x86_stepping 2026-02-24 15:37:21= .949261568 -0800 +++ b/arch/x86/include/asm/processor.h 2026-02-24 15:37:21.955261858 -0800 @@ -140,6 +140,11 @@ struct cpuinfo_x86 { __u32 x86_vfm; }; __u8 x86_stepping; + union { + // MSR_IA32_PLATFORM_ID[52-50] + __u8 intel_platform_id; + __u8 amd_unused; + }; #ifdef CONFIG_X86_64 /* Number of 4K pages in DTLB/ITLB combined(in pages): */ int x86_tlbsize; diff -puN arch/x86/kernel/cpu/intel.c~cpu-x86_stepping arch/x86/kernel/cpu/= intel.c --- a/arch/x86/kernel/cpu/intel.c~cpu-x86_stepping 2026-02-24 15:37:21.9502= 61617 -0800 +++ b/arch/x86/kernel/cpu/intel.c 2026-02-24 15:37:21.955261858 -0800 @@ -205,6 +205,7 @@ static void early_init_intel(struct cpui =20 if (c->x86 >=3D 6 && !cpu_has(c, X86_FEATURE_IA64)) c->microcode =3D intel_get_microcode_revision(); + c->intel_platform_id =3D intel_get_platform_id(); =20 /* Now if any of them are set, check the blacklist and clear the lot */ if ((cpu_has(c, X86_FEATURE_SPEC_CTRL) || diff -puN arch/x86/kernel/cpu/microcode/intel.c~cpu-x86_stepping arch/x86/k= ernel/cpu/microcode/intel.c --- a/arch/x86/kernel/cpu/microcode/intel.c~cpu-x86_stepping 2026-02-24 15:= 37:21.952261713 -0800 +++ b/arch/x86/kernel/cpu/microcode/intel.c 2026-02-24 15:37:21.955261858 -= 0800 @@ -133,7 +133,7 @@ static u32 intel_cpuid_vfm(void) return IFM(fam, model); } =20 -static u32 intel_get_platform_id(void) +u32 intel_get_platform_id(void) { unsigned int val[2]; =20 _