Archive-only list for patches
 help / color / mirror / Atom feed
From: Tony Luck <tony.luck@intel.com>
To: patches@lists.linux.dev
Cc: Tony Luck <tony.luck@intel.com>
Subject: [PATCH 18/74] x86/cpu/vfm: Update arch/x86/kernel/cpu/intel.c
Date: Thu, 28 Mar 2024 09:27:12 -0700	[thread overview]
Message-ID: <20240328162820.242778-18-tony.luck@intel.com> (raw)
In-Reply-To: <20240328090459.242500-tony.luck@intel.com>

New CPU #defines encode vendor and family as well as model.

Signed-off-by: Tony Luck <tony.luck@intel.com>
---
 arch/x86/kernel/cpu/intel.c | 115 +++++++++++++++++++-----------------
 1 file changed, 60 insertions(+), 55 deletions(-)

diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index be30d7fa2e66..3dca2c94b7d8 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -72,19 +72,19 @@ static bool cpu_model_supports_sld __ro_after_init;
  */
 static void check_memory_type_self_snoop_errata(struct cpuinfo_x86 *c)
 {
-	switch (c->x86_model) {
-	case INTEL_FAM6_CORE_YONAH:
-	case INTEL_FAM6_CORE2_MEROM:
-	case INTEL_FAM6_CORE2_MEROM_L:
-	case INTEL_FAM6_CORE2_PENRYN:
-	case INTEL_FAM6_CORE2_DUNNINGTON:
-	case INTEL_FAM6_NEHALEM:
-	case INTEL_FAM6_NEHALEM_G:
-	case INTEL_FAM6_NEHALEM_EP:
-	case INTEL_FAM6_NEHALEM_EX:
-	case INTEL_FAM6_WESTMERE:
-	case INTEL_FAM6_WESTMERE_EP:
-	case INTEL_FAM6_SANDYBRIDGE:
+	switch (c->x86_vfm) {
+	case INTEL_CORE_YONAH:
+	case INTEL_CORE2_MEROM:
+	case INTEL_CORE2_MEROM_L:
+	case INTEL_CORE2_PENRYN:
+	case INTEL_CORE2_DUNNINGTON:
+	case INTEL_NEHALEM:
+	case INTEL_NEHALEM_G:
+	case INTEL_NEHALEM_EP:
+	case INTEL_NEHALEM_EX:
+	case INTEL_WESTMERE:
+	case INTEL_WESTMERE_EP:
+	case INTEL_SANDYBRIDGE:
 		setup_clear_cpu_cap(X86_FEATURE_SELFSNOOP);
 	}
 }
@@ -106,9 +106,9 @@ static void probe_xeon_phi_r3mwait(struct cpuinfo_x86 *c)
 	 */
 	if (c->x86 != 6)
 		return;
-	switch (c->x86_model) {
-	case INTEL_FAM6_XEON_PHI_KNL:
-	case INTEL_FAM6_XEON_PHI_KNM:
+	switch (c->x86_vfm) {
+	case INTEL_XEON_PHI_KNL:
+	case INTEL_XEON_PHI_KNM:
 		break;
 	default:
 		return;
@@ -134,34 +134,41 @@ static void probe_xeon_phi_r3mwait(struct cpuinfo_x86 *c)
  * - Release note from 20180108 microcode release
  */
 struct sku_microcode {
-	u8 model;
+	u32 vfm;
 	u8 stepping;
 	u32 microcode;
 };
 static const struct sku_microcode spectre_bad_microcodes[] = {
-	{ INTEL_FAM6_KABYLAKE,		0x0B,	0x80 },
-	{ INTEL_FAM6_KABYLAKE,		0x0A,	0x80 },
-	{ INTEL_FAM6_KABYLAKE,		0x09,	0x80 },
-	{ INTEL_FAM6_KABYLAKE_L,	0x0A,	0x80 },
-	{ INTEL_FAM6_KABYLAKE_L,	0x09,	0x80 },
-	{ INTEL_FAM6_SKYLAKE_X,		0x03,	0x0100013e },
-	{ INTEL_FAM6_SKYLAKE_X,		0x04,	0x0200003c },
-	{ INTEL_FAM6_BROADWELL,		0x04,	0x28 },
-	{ INTEL_FAM6_BROADWELL_G,	0x01,	0x1b },
-	{ INTEL_FAM6_BROADWELL_D,	0x02,	0x14 },
-	{ INTEL_FAM6_BROADWELL_D,	0x03,	0x07000011 },
-	{ INTEL_FAM6_BROADWELL_X,	0x01,	0x0b000025 },
-	{ INTEL_FAM6_HASWELL_L,		0x01,	0x21 },
-	{ INTEL_FAM6_HASWELL_G,		0x01,	0x18 },
-	{ INTEL_FAM6_HASWELL,		0x03,	0x23 },
-	{ INTEL_FAM6_HASWELL_X,		0x02,	0x3b },
-	{ INTEL_FAM6_HASWELL_X,		0x04,	0x10 },
-	{ INTEL_FAM6_IVYBRIDGE_X,	0x04,	0x42a },
+	{ INTEL_KABYLAKE,	0x0B,	0x80 },
+	{ INTEL_KABYLAKE,	0x0A,	0x80 },
+	{ INTEL_KABYLAKE,	0x09,	0x80 },
+	{ INTEL_KABYLAKE_L,	0x0A,	0x80 },
+	{ INTEL_KABYLAKE_L,	0x09,	0x80 },
+	{ INTEL_SKYLAKE_X,	0x03,	0x0100013e },
+	{ INTEL_SKYLAKE_X,	0x04,	0x0200003c },
+	{ INTEL_BROADWELL,	0x04,	0x28 },
+	{ INTEL_BROADWELL_G,	0x01,	0x1b },
+	{ INTEL_BROADWELL_D,	0x02,	0x14 },
+	{ INTEL_BROADWELL_D,	0x03,	0x07000011 },
+	{ INTEL_BROADWELL_X,	0x01,	0x0b000025 },
+	{ INTEL_HASWELL_L,	0x01,	0x21 },
+	{ INTEL_HASWELL_G,	0x01,	0x18 },
+	{ INTEL_HASWELL,	0x03,	0x23 },
+	{ INTEL_HASWELL_X,	0x02,	0x3b },
+	{ INTEL_HASWELL_X,	0x04,	0x10 },
+	{ INTEL_IVYBRIDGE_X,	0x04,	0x42a },
 	/* Observed in the wild */
-	{ INTEL_FAM6_SANDYBRIDGE_X,	0x06,	0x61b },
-	{ INTEL_FAM6_SANDYBRIDGE_X,	0x07,	0x712 },
+	{ INTEL_SANDYBRIDGE_X,	0x06,	0x61b },
+	{ INTEL_SANDYBRIDGE_X,	0x07,	0x712 },
 };
 
+static bool vfm_match(struct cpuinfo_x86 *c, u32 vfm)
+{
+	return c->x86_vendor == VFM_VENDOR(vfm) &&
+	       c->x86 == VFM_FAMILY(vfm) &&
+	       c->x86_model == VFM_MODEL(vfm);
+}
+
 static bool bad_spectre_microcode(struct cpuinfo_x86 *c)
 {
 	int i;
@@ -173,11 +180,8 @@ static bool bad_spectre_microcode(struct cpuinfo_x86 *c)
 	if (cpu_has(c, X86_FEATURE_HYPERVISOR))
 		return false;
 
-	if (c->x86 != 6)
-		return false;
-
 	for (i = 0; i < ARRAY_SIZE(spectre_bad_microcodes); i++) {
-		if (c->x86_model == spectre_bad_microcodes[i].model &&
+		if (vfm_match(c, spectre_bad_microcodes[i].vfm) &&
 		    c->x86_stepping == spectre_bad_microcodes[i].stepping)
 			return (c->microcode <= spectre_bad_microcodes[i].microcode);
 	}
@@ -312,7 +316,7 @@ static void early_init_intel(struct cpuinfo_x86 *c)
 	 * need the microcode to have already been loaded... so if it is
 	 * not, recommend a BIOS update and disable large pages.
 	 */
-	if (c->x86 == 6 && c->x86_model == 0x1c && c->x86_stepping <= 2 &&
+	if (c->x86_vfm == INTEL_ATOM_BONNELL && c->x86_stepping <= 2 &&
 	    c->microcode < 0x20e) {
 		pr_warn("Atom PSE erratum detected, BIOS microcode update recommended\n");
 		clear_cpu_cap(c, X86_FEATURE_PSE);
@@ -345,11 +349,11 @@ static void early_init_intel(struct cpuinfo_x86 *c)
 
 	/* Penwell and Cloverview have the TSC which doesn't sleep on S3 */
 	if (c->x86 == 6) {
-		switch (c->x86_model) {
-		case INTEL_FAM6_ATOM_SALTWELL_MID:
-		case INTEL_FAM6_ATOM_SALTWELL_TABLET:
-		case INTEL_FAM6_ATOM_SILVERMONT_MID:
-		case INTEL_FAM6_ATOM_AIRMONT_NP:
+		switch (c->x86_vfm) {
+		case INTEL_ATOM_SALTWELL_MID:
+		case INTEL_ATOM_SALTWELL_TABLET:
+		case INTEL_ATOM_SILVERMONT_MID:
+		case INTEL_ATOM_AIRMONT_NP:
 			set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC_S3);
 			break;
 		default:
@@ -393,7 +397,7 @@ static void early_init_intel(struct cpuinfo_x86 *c)
 	 * should be false so that __flush_tlb_all() causes CR3 instead of CR4.PGE
 	 * to be modified.
 	 */
-	if (c->x86 == 5 && c->x86_model == 9) {
+	if (c->x86_vfm == INTEL_QUARK_X1000) {
 		pr_info("Disabling PGE capability bit\n");
 		setup_clear_cpu_cap(X86_FEATURE_PGE);
 	}
@@ -625,12 +629,13 @@ static void init_intel(struct cpuinfo_x86 *c)
 			set_cpu_cap(c, X86_FEATURE_PEBS);
 	}
 
-	if (c->x86 == 6 && boot_cpu_has(X86_FEATURE_CLFLUSH) &&
-	    (c->x86_model == 29 || c->x86_model == 46 || c->x86_model == 47))
+	if (boot_cpu_has(X86_FEATURE_CLFLUSH) &&
+	    (c->x86_vfm == INTEL_CORE2_DUNNINGTON ||
+	     c->x86_vfm == INTEL_NEHALEM_EX ||
+	     c->x86_vfm == INTEL_WESTMERE_EX))
 		set_cpu_bug(c, X86_BUG_CLFLUSH_MONITOR);
 
-	if (c->x86 == 6 && boot_cpu_has(X86_FEATURE_MWAIT) &&
-		((c->x86_model == INTEL_FAM6_ATOM_GOLDMONT)))
+	if (boot_cpu_has(X86_FEATURE_MWAIT) && c->x86_vfm == INTEL_ATOM_GOLDMONT)
 		set_cpu_bug(c, X86_BUG_MONITOR);
 
 #ifdef CONFIG_X86_64
@@ -1246,9 +1251,9 @@ void handle_bus_lock(struct pt_regs *regs)
  * feature even though they do not enumerate IA32_CORE_CAPABILITIES.
  */
 static const struct x86_cpu_id split_lock_cpu_ids[] __initconst = {
-	X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_X,	0),
-	X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_L,	0),
-	X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_D,	0),
+	X86_MATCH_VFM(INTEL_ICELAKE_X,	0),
+	X86_MATCH_VFM(INTEL_ICELAKE_L,	0),
+	X86_MATCH_VFM(INTEL_ICELAKE_D,	0),
 	{}
 };
 
-- 
2.44.0


  parent reply	other threads:[~2024-03-28 16:28 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-28 16:26 [PATCH 00/74] New Intel CPUID families Tony Luck
2024-03-28 16:26 ` [PATCH 01/74] x86/cpu/vfm: Add/initialize x86_vfm field to struct cpuinfo_x86 Tony Luck
2024-03-28 16:26 ` [PATCH 02/74] x86/cpu/vfm: Add new macros to work with (vendor/family/model) values Tony Luck
2024-03-28 16:26 ` [PATCH 03/74] x86/cpu/vfm: Update arch/x86/include/asm/intel-family.h Tony Luck
2024-03-28 16:26 ` [PATCH 04/74] x86/cpu/vfm: Update arch/x86/crypto/poly1305_glue.c Tony Luck
2024-03-28 16:26 ` [PATCH 05/74] x86/cpu/vfm: Update arch/x86/crypto/twofish_glue_3way.c Tony Luck
2024-03-28 16:27 ` [PATCH 06/74] x86/cpu/vfm: Update arch/x86/events/intel/cstate.c Tony Luck
2024-03-28 16:27 ` [PATCH 07/74] x86/cpu/vfm: Update arch/x86/events/intel/lbr.c Tony Luck
2024-03-28 16:27 ` [PATCH 08/74] x86/cpu/vfm: Update arch/x86/events/intel/pt.c Tony Luck
2024-03-28 16:27 ` [PATCH 09/74] x86/cpu/vfm: Update arch/x86/events/intel/uncore.c Tony Luck
2024-03-28 16:27 ` [PATCH 10/74] x86/cpu/vfm: Update arch/x86/events/intel/uncore_nhmex.c Tony Luck
2024-03-28 16:27 ` [PATCH 11/74] x86/cpu/vfm: Update arch/x86/events/intel/uncore_snbep.c Tony Luck
2024-03-28 16:27 ` [PATCH 12/74] x86/cpu/vfm: Update arch/x86/events/msr.c Tony Luck
2024-03-28 16:27 ` [PATCH 13/74] x86/cpu/vfm: Update arch/x86/events/rapl.c Tony Luck
2024-03-28 16:27 ` [PATCH 14/74] x86/cpu/vfm: Update arch/x86/kernel/apic/apic.c Tony Luck
2024-03-28 16:27 ` [PATCH 15/74] x86/cpu/vfm: Update arch/x86/kernel/cpu/aperfmperf.c Tony Luck
2024-03-28 16:27 ` [PATCH 16/74] x86/cpu/vfm: Update arch/x86/kernel/cpu/bugs.c Tony Luck
2024-03-28 16:27 ` [PATCH 17/74] x86/cpu/vfm: Update arch/x86/kernel/cpu/common.c Tony Luck
2024-03-28 16:27 ` Tony Luck [this message]
2024-03-28 16:27 ` [PATCH 19/74] x86/cpu/vfm: Update arch/x86/kernel/cpu/intel_epb.c Tony Luck
2024-03-28 16:27 ` [PATCH 20/74] x86/cpu/vfm: Update arch/x86/kernel/cpu/match.c Tony Luck
2024-03-28 16:27 ` [PATCH 21/74] x86/cpu/vfm: Update arch/x86/kernel/cpu/mce/core.c Tony Luck
2024-03-28 16:27 ` [PATCH 22/74] x86/cpu/vfm: Update arch/x86/kernel/cpu/mce/intel.c Tony Luck
2024-03-28 16:27 ` [PATCH 23/74] x86/cpu/vfm: Update arch/x86/kernel/cpu/mce/severity.c Tony Luck
2024-03-28 16:27 ` [PATCH 24/74] x86/cpu/vfm: Update arch/x86/kernel/cpu/microcode/intel.c Tony Luck
2024-03-28 16:27 ` [PATCH 25/74] x86/cpu/vfm: Update arch/x86/kernel/cpu/resctrl/core.c Tony Luck
2024-03-28 16:27 ` [PATCH 26/74] x86/cpu/vfm: Update arch/x86/kernel/cpu/resctrl/pseudo_lock.c Tony Luck
2024-03-28 16:27 ` [PATCH 27/74] x86/cpu/vfm: Update arch/x86/kernel/smpboot.c Tony Luck
2024-03-28 16:27 ` [PATCH 28/74] x86/cpu/vfm: Update arch/x86/kernel/tsc.c Tony Luck
2024-03-28 16:27 ` [PATCH 29/74] x86/cpu/vfm: Update arch/x86/kernel/tsc_msr.c Tony Luck
2024-03-28 16:27 ` [PATCH 30/74] x86/cpu/vfm: Update arch/x86/kvm/pmu.c Tony Luck
2024-03-28 16:27 ` [PATCH 31/74] x86/cpu/vfm: Update arch/x86/kvm/vmx/vmx.c Tony Luck
2024-03-28 16:27 ` [PATCH 32/74] x86/cpu/vfm: Update arch/x86/mm/init.c Tony Luck
2024-03-28 16:27 ` [PATCH 33/74] x86/cpu/vfm: Update arch/x86/pci/intel_mid_pci.c Tony Luck
2024-03-28 16:27 ` [PATCH 34/74] x86/cpu/vfm: Update arch/x86/virt/vmx/tdx/tdx.c Tony Luck
2024-03-28 16:27 ` [PATCH 35/74] x86/cpu/vfm: Update drivers/acpi/acpi_lpss.c Tony Luck
2024-03-28 16:27 ` [PATCH 36/74] x86/cpu/vfm: Update drivers/acpi/x86/utils.c Tony Luck
2024-03-28 16:27 ` [PATCH 37/74] x86/cpu/vfm: Update tpm files Tony Luck
2024-03-28 16:27 ` [PATCH 38/74] x86/cpu/vfm: Update drivers/cpufreq/intel_pstate.c Tony Luck
2024-03-28 16:27 ` [PATCH 39/74] x86/cpu/vfm: Update drivers/cpufreq/speedstep-centrino.c Tony Luck
2024-03-28 16:27 ` [PATCH 40/74] x86/cpu/vfm: Update drivers/edac/i10nm_base.c Tony Luck
2024-03-28 16:27 ` [PATCH 41/74] x86/cpu/vfm: Update drivers/edac/pnd2_edac.c Tony Luck
2024-03-28 16:27 ` [PATCH 42/74] x86/cpu/vfm: Update drivers/edac/sb_edac.c Tony Luck
2024-03-28 16:27 ` [PATCH 43/74] x86/cpu/vfm: Update drivers/edac/skx_base.c Tony Luck
2024-03-28 16:27 ` [PATCH 44/74] x86/cpu/vfm: Update drivers/extcon/extcon-axp288.c Tony Luck
2024-03-28 16:27 ` [PATCH 45/74] x86/cpu/vfm: Update drivers/hwmon/peci/cputemp.c Tony Luck
2024-03-28 16:27 ` [PATCH 46/74] x86/cpu/vfm: Update drivers/idle/intel_idle.c Tony Luck
2024-03-28 16:27 ` [PATCH 47/74] x86/cpu/vfm: Update drivers/pci/pci-mid.c Tony Luck
2024-03-28 16:27 ` [PATCH 48/74] x86/cpu/vfm: Update drivers/peci/cpu.c Tony Luck
2024-03-28 16:27 ` [PATCH 49/74] x86/cpu/vfm: Update drivers/platform/x86/intel/ifs/core.c Tony Luck
2024-03-28 16:27 ` [PATCH 50/74] x86/cpu/vfm: Update drivers/platform/x86/intel_ips.c Tony Luck
2024-03-28 16:27 ` [PATCH 51/74] x86/cpu/vfm: Update drivers/platform/x86/intel/pmc/core.c Tony Luck
2024-03-28 16:27 ` [PATCH 52/74] x86/cpu/vfm: Update drivers/platform/x86/intel/pmc/pltdrv.c Tony Luck
2024-03-28 16:27 ` [PATCH 53/74] x86/cpu/vfm: Update drivers/platform/x86/intel_scu_wdt.c Tony Luck
2024-03-28 16:27 ` [PATCH 54/74] x86/cpu/vfm: Update drivers/platform/x86/intel/speed_select_if/isst_if_common.c Tony Luck
2024-03-28 16:27 ` [PATCH 55/74] x86/cpu/vfm: Update drivers/platform/x86/intel/speed_select_if/isst_if_mbox_msr.c Tony Luck
2024-03-28 16:27 ` [PATCH 56/74] x86/cpu/vfm: Update drivers/platform/x86/intel/telemetry/debugfs.c Tony Luck
2024-03-28 16:27 ` [PATCH 57/74] x86/cpu/vfm: Update drivers/platform/x86/intel/telemetry/pltdrv.c Tony Luck
2024-03-28 16:27 ` [PATCH 58/74] x86/cpu/vfm: Update drivers/platform/x86/intel/turbo_max_3.c Tony Luck
2024-03-28 16:27 ` [PATCH 59/74] x86/cpu/vfm: Update drivers/platform/x86/intel/uncore-frequency/uncore-frequency.c Tony Luck
2024-03-28 16:27 ` [PATCH 60/74] x86/cpu/vfm: Update drivers/platform/x86/p2sb.c Tony Luck
2024-03-28 16:27 ` [PATCH 61/74] x86/cpu/vfm: Update drivers/powercap/intel_rapl_common.c Tony Luck
2024-03-28 16:27 ` [PATCH 62/74] x86/cpu/vfm: Update drivers/powercap/intel_rapl_msr.c Tony Luck
2024-03-28 16:27 ` [PATCH 63/74] x86/cpu/vfm: Update drivers/staging/media/atomisp/include/linux/atomisp_platform.h Tony Luck
2024-03-28 16:27 ` [PATCH 64/74] x86/cpu/vfm: Update intel_soc_dts_thermal.c Tony Luck
2024-03-28 16:27 ` [PATCH 65/74] x86/cpu/vfm: Update drivers/thermal/intel/intel_tcc_cooling.c Tony Luck
2024-03-28 16:28 ` [PATCH 66/74] x86/cpu/vfm: Update sound/soc/intel/avs/boards/es8336.c Tony Luck
2024-03-28 16:28 ` [PATCH 67/74] x86/cpu/vfm: Update arch/x86/events/intel/core.c Tony Luck
2024-03-28 16:28 ` [PATCH 68/74] x86/cpu/vfm: Update arch/x86/platform/intel-mid/intel-mid.c Tony Luck
2024-03-28 16:28 ` [PATCH 69/74] x86/cpu/vfm: Update arch/x86/platform/atom/punit_atom_debug.c Tony Luck
2024-03-28 16:28 ` [PATCH 70/74] x86/cpu/vfm: Update arch/x86/events/intel/core.c Tony Luck
2024-03-28 16:28 ` [PATCH 71/74] x86/cpu/vfm: Update tools/power/x86/turbostat/turbostat.c Tony Luck
2024-03-28 16:28 ` [PATCH 72/74] x86/cpu/vfm: Update arch/x86/boot/cpucheck.c Tony Luck
2024-03-28 16:28 ` [PATCH 73/74] x86/cpu/vfm: Delete X86_MATCH_INTEL_FAM6_MODEL[_STEPPING]() macros Tony Luck
2024-03-28 16:28 ` [PATCH 74/74] x86/cpu/vfm: Delete all the *_FAM6_ CPU #defines Tony Luck

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=20240328162820.242778-18-tony.luck@intel.com \
    --to=tony.luck@intel.com \
    --cc=patches@lists.linux.dev \
    /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