From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (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 E3C17343D74 for ; Tue, 20 Jan 2026 08:30:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768897856; cv=none; b=oZ5xshkvfTRWUeOk1fFwMwNw+PJSQ3+X2zxJlCvOrc9htPsHEtJS36EZpwwr3Bcb8fjzpd29uew9vpfuo/5Wv/+I5h2PP6HFudo4PB4p3pPWVSYrT0HB4DYAQdGlhhrTF/LaEp4T/Tqh6gxHzZyjypxlrIqD3lU5ylDp+0X+G20= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768897856; c=relaxed/simple; bh=t0McSwHEfVExTUShyhBfINzX7+UOon3jzwuCsUGr7tY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=pDWcIUBZqe85Td1Zdp9LG98XeFzqT9UJEOhL6wPGjndbk2e7b1L4gr2472MmMtwkoY23y2YyDx3xMcMQKcnl3f2iiswscFkJpXt3lZec47HFklh1Xg7lpBIKf/VFlALscsJSJF0hxwj51GP4QNmek6d7wCmC0l9ZlG/e45o/3Tc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=YKWzp753; arc=none smtp.client-ip=198.175.65.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="YKWzp753" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1768897855; x=1800433855; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=t0McSwHEfVExTUShyhBfINzX7+UOon3jzwuCsUGr7tY=; b=YKWzp7536Ibw/2hUHl2S+04OPl9mEOXE2URepSfqLCIpEk4CvX1UeM9o dDcTu3KwChv2vNAp9wHKFN4S1RwbBVFQkkMVafgCd7a2wB+Bu9HFdRXDD djnLcJU4nWjVYtipasNL8IKlK6rBevIqtXrpGOMzqYW+Of1fhiWiD+5ee V7kpZSQz9m35UMR+2ep/3OjFzhj77jqbAKzKFhO2+5rbtn237Uz0Lf2hi NvXCXC4kYBq98aKHc8j4fMxusb/8sLJ9MbA0cyAC9cWmTRwimMmZDtj7s WTMmBdN4MHxOPAtkuk6rdRPFZXC9e9fUttdCuMB/kCHfsJor6e+o/N0WC g==; X-CSE-ConnectionGUID: D5k2iuhdTtCaKg5wUR4Fgw== X-CSE-MsgGUID: Gsm943aaTyqqwA+ddsln1Q== X-IronPort-AV: E=McAfee;i="6800,10657,11676"; a="69830321" X-IronPort-AV: E=Sophos;i="6.21,240,1763452800"; d="scan'208";a="69830321" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jan 2026 00:30:54 -0800 X-CSE-ConnectionGUID: bn3ukvvKQ9+Ut1AwGldl5A== X-CSE-MsgGUID: a0dQQQWOSLyBfrq0gBQfLg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,240,1763452800"; d="scan'208";a="205855738" Received: from black.igk.intel.com ([10.91.253.5]) by orviesa009.jf.intel.com with ESMTP; 20 Jan 2026 00:30:51 -0800 Received: by black.igk.intel.com (Postfix, from userid 1003) id CEDEA98; Tue, 20 Jan 2026 09:30:50 +0100 (CET) Date: Tue, 20 Jan 2026 09:30:50 +0100 From: Andy Shevchenko To: Dave Hansen Cc: linux-kernel@vger.kernel.org, sohil.mehta@intel.com, Borislav Petkov , "H. Peter Anvin" , Ingo Molnar , Jon Kohler , Pawan Gupta , "Peter Zijlstra (Intel)" , Thomas Gleixner , Tony Luck , x86@kernel.org Subject: Re: [PATCH 5/6] x86/cpu: Add platform ID to CPU matching structure Message-ID: References: <20260119195047.86E3C696@davehans-spike.ostc.intel.com> <20260119195057.E6728139@davehans-spike.ostc.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260119195057.E6728139@davehans-spike.ostc.intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo On Mon, Jan 19, 2026 at 11:50:57AM -0800, Dave Hansen wrote: > The existing x86_match_cpu() infrastructure can be used to match > a bunch of attributes of a CPU: vendor, family, model, steppings > and CPU features. > > But, there's one more attribute that's missing and unable to be > matched against: the platform ID, enumerated on Intel CPUs in > MSR_IA32_PLATFORM_ID. It is a little more obscure and is only > queried during microcode loading. This is because Intel sometimes > has CPUs with identical family/model/stepping but which need > different microcode. These CPUs are differentiated with the > platform ID. > > Add a field in 'struct x86_cpu_id' for the platform ID. Similar > to the stepping field, make the new field a mask of platform IDs. > Some examples: > > 0x01: matches only platform ID 0x0 > 0x02: matches only platform ID 0x1 > 0x03: matches platform IDs 0x0 or 0x1 > 0x80: matches only platform ID 0x7 > 0xff: matches all 8 possible platform IDs > > Since the mask is only a byte wide, it nestles in next to another > u8 and does not even increase the size of 'struct x86_cpu_id'. > > Reserve the all 0's value as the wildcard (X86_PLATFORM_ANY). This > avoids forcing changes changes to existing 'struct x86_cpu_id' users. > They can just continue to fill the field with 0's and their matching > will work exactly as before. > > Note: If someone is ever looking for space in 'struct x86_cpu_id', > this new field could probably get stuck over in ->driver_data > for the one user that there is. ... > struct x86_cpu_id { > __u16 feature; /* bit index */ > /* Solely for kernel-internal use: DO NOT EXPORT to userspace! */ > __u16 flags; > + __u8 platform_mask; > __u8 type; > kernel_ulong_t driver_data; > }; ... > #define X86_STEPPING_ANY 0 > #define X86_STEP_MIN 0 > #define X86_STEP_MAX 0xf > +#define X86_PLATFORM_ANY 0x0 > #define X86_FEATURE_ANY 0 /* Same as FPU, you can't test for that */ Wouldn't it be slightly better to locate the new one here to follow the order in x86_cpu_id above? > #define X86_CPU_TYPE_ANY 0 -- With Best Regards, Andy Shevchenko