linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] x86, intel: Introduce macros for Intel family numbers
@ 2016-06-01 17:34 Dave Hansen
  2016-06-01 17:34 ` [PATCH 2/5] x86, perf: use Intel family macros for core perf events Dave Hansen
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Dave Hansen @ 2016-06-01 17:34 UTC (permalink / raw)
  To: linux-kernel; +Cc: x86, Dave Hansen, dave.hansen


From: Dave Hansen <dave.hansen@linux.intel.com>

We have at least four long lists of open-coded family-6 model
numbers.  Half of them have these model numbers in hex and the
other half in decimal.  This makes grepping for them tons of
fun, if you were to try.

So, let's consolidate them.  Put all the definitions in one
header.  While people have been _pretty_ good at making sure to
hit all four places in the code when Intel puts out a new CPU, we
have not been perfect, and this should make it easier.

The names here are closely derived from the comments describing
the models from arch/x86/events/intel/core.c.  We could easily
make them shorter by doing things like s/SANDYBRIDGE/SNB/, but
they seemed fine even with the longer versions to me.

Do not take any of these names too literally, like "DESKTOP"
or "MOBILE".  These are all colloquial names and not precise
descriptions of everywhere a given model will show up.

Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
---

 b/arch/x86/include/asm/intel-family.h |   57 ++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)

diff -puN /dev/null arch/x86/include/asm/intel-family.h
--- /dev/null	2016-04-04 09:40:43.435149254 -0700
+++ b/arch/x86/include/asm/intel-family.h	2016-06-01 10:20:10.786311716 -0700
@@ -0,0 +1,57 @@
+#ifndef _ASM_X86_INTEL_FAMILY_H
+#define _ASM_X86_INTEL_FAMILY_H
+
+/*
+ * "Big Core" Processors (Branded as Core, Xeon, etc...)
+ *
+ * The "_X" parts are generally the EP and EX Xeons, or the
+ * "Extreme" ones, like Broadwell-E.
+ */
+
+#define INTEL_FAM6_MODEL_CORE_YONAH		0x0E
+#define INTEL_FAM6_MODEL_CORE2_MEROM		0x0F
+#define INTEL_FAM6_MODEL_CORE2_MEROM_L		0x16
+#define INTEL_FAM6_MODEL_CORE2_PENRYN		0x17
+#define INTEL_FAM6_MODEL_CORE2_DUNNINGTON	0x1D
+#define INTEL_FAM6_MODEL_NEHALEM		0x1E
+#define INTEL_FAM6_MODEL_NEHALEM_EP		0x1A
+#define INTEL_FAM6_MODEL_NEHALEM_EX		0x2E
+#define INTEL_FAM6_MODEL_WESTMERE		0x25
+#define INTEL_FAM6_MODEL_WESTMERE_EP		0x2C
+#define INTEL_FAM6_MODEL_WESTMERE_EX		0x2F
+#define INTEL_FAM6_MODEL_SANDYBRIDGE		0x2A
+#define INTEL_FAM6_MODEL_SANDYBRIDGE_X		0x2D
+#define INTEL_FAM6_MODEL_IVYBRIDGE		0x3A
+#define INTEL_FAM6_MODEL_IVYBRIDGE_X		0x3E
+#define INTEL_FAM6_MODEL_HASWELL_CORE		0x3C
+#define INTEL_FAM6_MODEL_HASWELL_X		0x3F
+#define INTEL_FAM6_MODEL_HASWELL_ULT		0x45
+#define INTEL_FAM6_MODEL_HASWELL_GT3E		0x46
+#define INTEL_FAM6_MODEL_BROADWELL_CORE_M	0x3D
+#define INTEL_FAM6_MODEL_BROADWELL_XEON_D	0x56
+#define INTEL_FAM6_MODEL_BROADWELL_GT3E		0x47
+#define INTEL_FAM6_MODEL_BROADWELL_X		0x4F
+#define INTEL_FAM6_MODEL_SKYLAKE_MOBILE		0x4E
+#define INTEL_FAM6_MODEL_SKYLAKE_DESKTOP	0x5E
+#define INTEL_FAM6_MODEL_SKYLAKE_X		0x55
+#define INTEL_FAM6_MODEL_KABYLAKE_MOBILE	0x8E
+#define INTEL_FAM6_MODEL_KABYLAKE_DESKTOP	0x9E
+
+/* "Small Core" Processors (Atom) */
+
+#define INTEL_FAM6_MODEL_ATOM_PINEVIEW		0x1C
+#define INTEL_FAM6_MODEL_ATOM_LINCROFT		0x26
+#define INTEL_FAM6_MODEL_ATOM_PENWELL		0x27
+#define INTEL_FAM6_MODEL_ATOM_CLOVERVIEW	0x35
+#define INTEL_FAM6_MODEL_ATOM_CEDARVIEW		0x36
+#define INTEL_FAM6_MODEL_ATOM_SILVERMONT1	0x37
+#define INTEL_FAM6_MODEL_ATOM_SILVERMONT2	0x4D /* Avaton/Rangely */
+#define INTEL_FAM6_MODEL_ATOM_AIRMONT		0x4C
+#define INTEL_FAM6_MODEL_ATOM_GOLDMONT		0x5C
+#define INTEL_FAM6_MODEL_ATOM_DENVERTON		0x5F /* Goldmont Microserver */
+
+/* Xeon Phi */
+
+#define INTEL_FAM6_MODEL_XEON_PHI_KNL		0x57 /* Knights Landing */
+
+#endif /* _ASM_X86_INTEL_FAMILY_H */
_

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/5] x86, perf: use Intel family macros for core perf events
  2016-06-01 17:34 [PATCH 1/5] x86, intel: Introduce macros for Intel family numbers Dave Hansen
@ 2016-06-01 17:34 ` Dave Hansen
  2016-06-01 17:46   ` Peter Zijlstra
  2016-06-01 17:34 ` [PATCH 3/5] x86, rapl: use Intel family macros for rapl Dave Hansen
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Dave Hansen @ 2016-06-01 17:34 UTC (permalink / raw)
  To: linux-kernel; +Cc: x86, Dave Hansen, dave.hansen, ak, kan.liang


From: Dave Hansen <dave.hansen@linux.intel.com>

Use the new model number macros instead of spelling things out
in the comments.

Note that this is missing a Nehalem model that is mentioned in
intel_idle.  Is that a a problem?

The resulting binary (arch/x86/events/intel/core.o) is exactly
the same with and without this patch modulo some harmless changes
to restoring %esi in the return path of functions, even those
untouched by this patch.

Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Kan Liang <kan.liang@intel.com>
---

 b/arch/x86/events/intel/core.c |   87 ++++++++++++++++++++---------------------
 1 file changed, 44 insertions(+), 43 deletions(-)

diff -puN arch/x86/events/intel/core.c~x86-intel-families-core-events arch/x86/events/intel/core.c
--- a/arch/x86/events/intel/core.c~x86-intel-families-core-events	2016-06-01 10:20:11.202330576 -0700
+++ b/arch/x86/events/intel/core.c	2016-06-01 10:20:11.208330848 -0700
@@ -16,6 +16,7 @@
 
 #include <asm/cpufeature.h>
 #include <asm/hardirq.h>
+#include <asm/intel-family.h>
 #include <asm/apic.h>
 
 #include "../perf_event.h"
@@ -3261,11 +3262,11 @@ static int intel_snb_pebs_broken(int cpu
 	u32 rev = UINT_MAX; /* default to broken for unknown models */
 
 	switch (cpu_data(cpu).x86_model) {
-	case 42: /* SNB */
+	case INTEL_FAM6_MODEL_SANDYBRIDGE:
 		rev = 0x28;
 		break;
 
-	case 45: /* SNB-EP */
+	case INTEL_FAM6_MODEL_SANDYBRIDGE_X:
 		switch (cpu_data(cpu).x86_mask) {
 		case 6: rev = 0x618; break;
 		case 7: rev = 0x70c; break;
@@ -3508,15 +3509,15 @@ __init int intel_pmu_init(void)
 	 * Install the hw-cache-events table:
 	 */
 	switch (boot_cpu_data.x86_model) {
-	case 14: /* 65nm Core "Yonah" */
+	case INTEL_FAM6_MODEL_CORE_YONAH:
 		pr_cont("Core events, ");
 		break;
 
-	case 15: /* 65nm Core2 "Merom"          */
+	case INTEL_FAM6_MODEL_CORE2_MEROM:
 		x86_add_quirk(intel_clovertown_quirk);
-	case 22: /* 65nm Core2 "Merom-L"        */
-	case 23: /* 45nm Core2 "Penryn"         */
-	case 29: /* 45nm Core2 "Dunnington (MP) */
+	case INTEL_FAM6_MODEL_CORE2_MEROM_L:
+	case INTEL_FAM6_MODEL_CORE2_PENRYN:
+	case INTEL_FAM6_MODEL_CORE2_DUNNINGTON:
 		memcpy(hw_cache_event_ids, core2_hw_cache_event_ids,
 		       sizeof(hw_cache_event_ids));
 
@@ -3527,9 +3528,9 @@ __init int intel_pmu_init(void)
 		pr_cont("Core2 events, ");
 		break;
 
-	case 30: /* 45nm Nehalem    */
-	case 26: /* 45nm Nehalem-EP */
-	case 46: /* 45nm Nehalem-EX */
+	case INTEL_FAM6_MODEL_NEHALEM:
+	case INTEL_FAM6_MODEL_NEHALEM_EP:
+	case INTEL_FAM6_MODEL_NEHALEM_EX:
 		memcpy(hw_cache_event_ids, nehalem_hw_cache_event_ids,
 		       sizeof(hw_cache_event_ids));
 		memcpy(hw_cache_extra_regs, nehalem_hw_cache_extra_regs,
@@ -3557,11 +3558,11 @@ __init int intel_pmu_init(void)
 		pr_cont("Nehalem events, ");
 		break;
 
-	case 28: /* 45nm Atom "Pineview"   */
-	case 38: /* 45nm Atom "Lincroft"   */
-	case 39: /* 32nm Atom "Penwell"    */
-	case 53: /* 32nm Atom "Cloverview" */
-	case 54: /* 32nm Atom "Cedarview"  */
+	case INTEL_FAM6_MODEL_ATOM_PINEVIEW:
+	case INTEL_FAM6_MODEL_ATOM_LINCROFT:
+	case INTEL_FAM6_MODEL_ATOM_PENWELL:
+	case INTEL_FAM6_MODEL_ATOM_CLOVERVIEW:
+	case INTEL_FAM6_MODEL_ATOM_CEDARVIEW:
 		memcpy(hw_cache_event_ids, atom_hw_cache_event_ids,
 		       sizeof(hw_cache_event_ids));
 
@@ -3573,9 +3574,9 @@ __init int intel_pmu_init(void)
 		pr_cont("Atom events, ");
 		break;
 
-	case 55: /* 22nm Atom "Silvermont"                */
-	case 76: /* 14nm Atom "Airmont"                   */
-	case 77: /* 22nm Atom "Silvermont Avoton/Rangely" */
+	case INTEL_FAM6_MODEL_ATOM_SILVERMONT1:
+	case INTEL_FAM6_MODEL_ATOM_SILVERMONT2:
+	case INTEL_FAM6_MODEL_ATOM_AIRMONT:
 		memcpy(hw_cache_event_ids, slm_hw_cache_event_ids,
 			sizeof(hw_cache_event_ids));
 		memcpy(hw_cache_extra_regs, slm_hw_cache_extra_regs,
@@ -3590,8 +3591,8 @@ __init int intel_pmu_init(void)
 		pr_cont("Silvermont events, ");
 		break;
 
-	case 92: /* 14nm Atom "Goldmont" */
-	case 95: /* 14nm Atom "Goldmont Denverton" */
+	case INTEL_FAM6_MODEL_ATOM_GOLDMONT:
+	case INTEL_FAM6_MODEL_ATOM_DENVERTON:
 		memcpy(hw_cache_event_ids, glm_hw_cache_event_ids,
 		       sizeof(hw_cache_event_ids));
 		memcpy(hw_cache_extra_regs, glm_hw_cache_extra_regs,
@@ -3614,9 +3615,9 @@ __init int intel_pmu_init(void)
 		pr_cont("Goldmont events, ");
 		break;
 
-	case 37: /* 32nm Westmere    */
-	case 44: /* 32nm Westmere-EP */
-	case 47: /* 32nm Westmere-EX */
+	case INTEL_FAM6_MODEL_WESTMERE:
+	case INTEL_FAM6_MODEL_WESTMERE_EP:
+	case INTEL_FAM6_MODEL_WESTMERE_EX:
 		memcpy(hw_cache_event_ids, westmere_hw_cache_event_ids,
 		       sizeof(hw_cache_event_ids));
 		memcpy(hw_cache_extra_regs, nehalem_hw_cache_extra_regs,
@@ -3643,8 +3644,8 @@ __init int intel_pmu_init(void)
 		pr_cont("Westmere events, ");
 		break;
 
-	case 42: /* 32nm SandyBridge         */
-	case 45: /* 32nm SandyBridge-E/EN/EP */
+	case INTEL_FAM6_MODEL_SANDYBRIDGE:
+	case INTEL_FAM6_MODEL_SANDYBRIDGE_X:
 		x86_add_quirk(intel_sandybridge_quirk);
 		x86_add_quirk(intel_ht_bug);
 		memcpy(hw_cache_event_ids, snb_hw_cache_event_ids,
@@ -3657,7 +3658,7 @@ __init int intel_pmu_init(void)
 		x86_pmu.event_constraints = intel_snb_event_constraints;
 		x86_pmu.pebs_constraints = intel_snb_pebs_event_constraints;
 		x86_pmu.pebs_aliases = intel_pebs_aliases_snb;
-		if (boot_cpu_data.x86_model == 45)
+		if (boot_cpu_data.x86_model == INTEL_FAM6_MODEL_SANDYBRIDGE_X)
 			x86_pmu.extra_regs = intel_snbep_extra_regs;
 		else
 			x86_pmu.extra_regs = intel_snb_extra_regs;
@@ -3679,8 +3680,8 @@ __init int intel_pmu_init(void)
 		pr_cont("SandyBridge events, ");
 		break;
 
-	case 58: /* 22nm IvyBridge       */
-	case 62: /* 22nm IvyBridge-EP/EX */
+	case INTEL_FAM6_MODEL_IVYBRIDGE:
+	case INTEL_FAM6_MODEL_IVYBRIDGE_X:
 		x86_add_quirk(intel_ht_bug);
 		memcpy(hw_cache_event_ids, snb_hw_cache_event_ids,
 		       sizeof(hw_cache_event_ids));
@@ -3696,7 +3697,7 @@ __init int intel_pmu_init(void)
 		x86_pmu.pebs_constraints = intel_ivb_pebs_event_constraints;
 		x86_pmu.pebs_aliases = intel_pebs_aliases_ivb;
 		x86_pmu.pebs_prec_dist = true;
-		if (boot_cpu_data.x86_model == 62)
+		if (boot_cpu_data.x86_model == INTEL_FAM6_MODEL_IVYBRIDGE_X)
 			x86_pmu.extra_regs = intel_snbep_extra_regs;
 		else
 			x86_pmu.extra_regs = intel_snb_extra_regs;
@@ -3714,10 +3715,10 @@ __init int intel_pmu_init(void)
 		break;
 
 
-	case 60: /* 22nm Haswell Core */
-	case 63: /* 22nm Haswell Server */
-	case 69: /* 22nm Haswell ULT */
-	case 70: /* 22nm Haswell + GT3e (Intel Iris Pro graphics) */
+	case INTEL_FAM6_MODEL_HASWELL_CORE:
+	case INTEL_FAM6_MODEL_HASWELL_X:
+	case INTEL_FAM6_MODEL_HASWELL_ULT:
+	case INTEL_FAM6_MODEL_HASWELL_GT3E:
 		x86_add_quirk(intel_ht_bug);
 		x86_pmu.late_ack = true;
 		memcpy(hw_cache_event_ids, hsw_hw_cache_event_ids, sizeof(hw_cache_event_ids));
@@ -3741,10 +3742,10 @@ __init int intel_pmu_init(void)
 		pr_cont("Haswell events, ");
 		break;
 
-	case 61: /* 14nm Broadwell Core-M */
-	case 86: /* 14nm Broadwell Xeon D */
-	case 71: /* 14nm Broadwell + GT3e (Intel Iris Pro graphics) */
-	case 79: /* 14nm Broadwell Server */
+	case INTEL_FAM6_MODEL_BROADWELL_CORE_M:
+	case INTEL_FAM6_MODEL_BROADWELL_XEON_D:
+	case INTEL_FAM6_MODEL_BROADWELL_GT3E:
+	case INTEL_FAM6_MODEL_BROADWELL_X:
 		x86_pmu.late_ack = true;
 		memcpy(hw_cache_event_ids, hsw_hw_cache_event_ids, sizeof(hw_cache_event_ids));
 		memcpy(hw_cache_extra_regs, hsw_hw_cache_extra_regs, sizeof(hw_cache_extra_regs));
@@ -3777,7 +3778,7 @@ __init int intel_pmu_init(void)
 		pr_cont("Broadwell events, ");
 		break;
 
-	case 87: /* Knights Landing Xeon Phi */
+	case INTEL_FAM6_MODEL_XEON_PHI_KNL:
 		memcpy(hw_cache_event_ids,
 		       slm_hw_cache_event_ids, sizeof(hw_cache_event_ids));
 		memcpy(hw_cache_extra_regs,
@@ -3795,11 +3796,11 @@ __init int intel_pmu_init(void)
 		pr_cont("Knights Landing events, ");
 		break;
 
-	case 142: /* 14nm Kabylake Mobile */
-	case 158: /* 14nm Kabylake Desktop */
-	case 78: /* 14nm Skylake Mobile */
-	case 94: /* 14nm Skylake Desktop */
-	case 85: /* 14nm Skylake Server */
+	case INTEL_FAM6_MODEL_SKYLAKE_MOBILE:
+	case INTEL_FAM6_MODEL_SKYLAKE_DESKTOP:
+	case INTEL_FAM6_MODEL_SKYLAKE_X:
+	case INTEL_FAM6_MODEL_KABYLAKE_MOBILE:
+	case INTEL_FAM6_MODEL_KABYLAKE_DESKTOP:
 		x86_pmu.late_ack = true;
 		memcpy(hw_cache_event_ids, skl_hw_cache_event_ids, sizeof(hw_cache_event_ids));
 		memcpy(hw_cache_extra_regs, skl_hw_cache_extra_regs, sizeof(hw_cache_extra_regs));
_

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 3/5] x86, rapl: use Intel family macros for rapl
  2016-06-01 17:34 [PATCH 1/5] x86, intel: Introduce macros for Intel family numbers Dave Hansen
  2016-06-01 17:34 ` [PATCH 2/5] x86, perf: use Intel family macros for core perf events Dave Hansen
@ 2016-06-01 17:34 ` Dave Hansen
  2016-06-01 17:34 ` [PATCH 4/5] x86, intel_idle: use Intel family macros for intel_idle Dave Hansen
  2016-06-01 17:34 ` [PATCH 5/5] x86, msr: use Intel family macros for msr events code Dave Hansen
  3 siblings, 0 replies; 6+ messages in thread
From: Dave Hansen @ 2016-06-01 17:34 UTC (permalink / raw)
  To: linux-kernel; +Cc: x86, Dave Hansen, dave.hansen, srinivas.pandruvada, peterz


From: Dave Hansen <dave.hansen@linux.intel.com>

Use the new INTEL_FAM6_MODEL_* macros for rapl.c.

Note that this is missing at least one Westmere model and Skylake
Server.

The resulting binary structure 'rapl_cpu_match' is the same
before and after this patch.

Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
---

 b/arch/x86/events/intel/rapl.c |   33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff -puN arch/x86/events/intel/rapl.c~x86-intel-familites-rapl arch/x86/events/intel/rapl.c
--- a/arch/x86/events/intel/rapl.c~x86-intel-familites-rapl	2016-06-01 10:20:11.655351115 -0700
+++ b/arch/x86/events/intel/rapl.c	2016-06-01 10:20:11.660351341 -0700
@@ -55,6 +55,7 @@
 #include <linux/slab.h>
 #include <linux/perf_event.h>
 #include <asm/cpu_device_id.h>
+#include <asm/intel-family.h>
 #include "../perf_event.h"
 
 MODULE_LICENSE("GPL");
@@ -786,26 +787,26 @@ static const struct intel_rapl_init_fun
 };
 
 static const struct x86_cpu_id rapl_cpu_match[] __initconst = {
-	X86_RAPL_MODEL_MATCH(42, snb_rapl_init),	/* Sandy Bridge */
-	X86_RAPL_MODEL_MATCH(45, snbep_rapl_init),	/* Sandy Bridge-EP */
+	X86_RAPL_MODEL_MATCH(INTEL_FAM6_MODEL_SANDYBRIDGE, snb_rapl_init),
+	X86_RAPL_MODEL_MATCH(INTEL_FAM6_MODEL_SANDYBRIDGE_X, snbep_rapl_init),
 
-	X86_RAPL_MODEL_MATCH(58, snb_rapl_init),	/* Ivy Bridge */
-	X86_RAPL_MODEL_MATCH(62, snbep_rapl_init),	/* IvyTown */
+	X86_RAPL_MODEL_MATCH(INTEL_FAM6_MODEL_IVYBRIDGE, snb_rapl_init),
+	X86_RAPL_MODEL_MATCH(INTEL_FAM6_MODEL_IVYBRIDGE_X, snbep_rapl_init),
 
-	X86_RAPL_MODEL_MATCH(60, hsw_rapl_init),	/* Haswell */
-	X86_RAPL_MODEL_MATCH(63, hsx_rapl_init),	/* Haswell-Server */
-	X86_RAPL_MODEL_MATCH(69, hsw_rapl_init),	/* Haswell-Celeron */
-	X86_RAPL_MODEL_MATCH(70, hsw_rapl_init),	/* Haswell GT3e */
-
-	X86_RAPL_MODEL_MATCH(61, hsw_rapl_init),	/* Broadwell */
-	X86_RAPL_MODEL_MATCH(71, hsw_rapl_init),	/* Broadwell-H */
-	X86_RAPL_MODEL_MATCH(79, hsx_rapl_init),	/* Broadwell-Server */
-	X86_RAPL_MODEL_MATCH(86, hsx_rapl_init),	/* Broadwell Xeon D */
+	X86_RAPL_MODEL_MATCH(INTEL_FAM6_MODEL_HASWELL_CORE, hsw_rapl_init),
+	X86_RAPL_MODEL_MATCH(INTEL_FAM6_MODEL_HASWELL_X, hsw_rapl_init),
+	X86_RAPL_MODEL_MATCH(INTEL_FAM6_MODEL_HASWELL_ULT, hsw_rapl_init),
+	X86_RAPL_MODEL_MATCH(INTEL_FAM6_MODEL_HASWELL_GT3E, hsw_rapl_init),
+
+	X86_RAPL_MODEL_MATCH(INTEL_FAM6_MODEL_BROADWELL_CORE_M, hsw_rapl_init),
+	X86_RAPL_MODEL_MATCH(INTEL_FAM6_MODEL_BROADWELL_GT3E, hsw_rapl_init),
+	X86_RAPL_MODEL_MATCH(INTEL_FAM6_MODEL_BROADWELL_X, hsw_rapl_init),
+	X86_RAPL_MODEL_MATCH(INTEL_FAM6_MODEL_BROADWELL_XEON_D, hsw_rapl_init),
 
-	X86_RAPL_MODEL_MATCH(87, knl_rapl_init),	/* Knights Landing */
+	X86_RAPL_MODEL_MATCH(INTEL_FAM6_MODEL_XEON_PHI_KNL, knl_rapl_init),
 
-	X86_RAPL_MODEL_MATCH(78, skl_rapl_init),	/* Skylake */
-	X86_RAPL_MODEL_MATCH(94, skl_rapl_init),	/* Skylake H/S */
+	X86_RAPL_MODEL_MATCH(INTEL_FAM6_MODEL_SKYLAKE_MOBILE, skl_rapl_init),
+	X86_RAPL_MODEL_MATCH(INTEL_FAM6_MODEL_SKYLAKE_DESKTOP, skl_rapl_init),
 	{},
 };
 
_

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 4/5] x86, intel_idle: use Intel family macros for intel_idle
  2016-06-01 17:34 [PATCH 1/5] x86, intel: Introduce macros for Intel family numbers Dave Hansen
  2016-06-01 17:34 ` [PATCH 2/5] x86, perf: use Intel family macros for core perf events Dave Hansen
  2016-06-01 17:34 ` [PATCH 3/5] x86, rapl: use Intel family macros for rapl Dave Hansen
@ 2016-06-01 17:34 ` Dave Hansen
  2016-06-01 17:34 ` [PATCH 5/5] x86, msr: use Intel family macros for msr events code Dave Hansen
  3 siblings, 0 replies; 6+ messages in thread
From: Dave Hansen @ 2016-06-01 17:34 UTC (permalink / raw)
  To: linux-kernel; +Cc: x86, Dave Hansen, dave.hansen


From: Dave Hansen <dave.hansen@linux.intel.com>

Use the new INTEL_FAM6_MODEL_* macros for intel_idle.c.  Also fix
up some of the macros to be consistent with how some of the
intel_idle code refers to the model.

There's on oddity here: model 0x1F is uniquely referred to here
and nowhere else that I could find.  0x1E/0x1F are just spelled
out as "Intel Core i7 and i5 Processors" in the SDM or as "Intel
processors based on the Nehalem, Westmere microarchitectures" in
the RDPMC section.  Comments between tables 19-19 and 19-20 in
the SDM seem to point to 0x1F being some kind of Westmere, so
let's call it "WESTMERE2".

This one probably got missed way back when we built up all the
lists of Westmere models, but nobody noticed until now.  Should
we go fix the other 3 cases?

Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
---

 b/arch/x86/include/asm/intel-family.h |   10 +++-
 b/drivers/idle/intel_idle.c           |   71 +++++++++++++++++-----------------
 2 files changed, 43 insertions(+), 38 deletions(-)

diff -puN arch/x86/include/asm/intel-family.h~x86-intel-familites-intelidle arch/x86/include/asm/intel-family.h
--- a/arch/x86/include/asm/intel-family.h~x86-intel-familites-intelidle	2016-06-01 10:20:12.088370746 -0700
+++ b/arch/x86/include/asm/intel-family.h	2016-06-01 10:20:12.094371018 -0700
@@ -6,6 +6,9 @@
  *
  * The "_X" parts are generally the EP and EX Xeons, or the
  * "Extreme" ones, like Broadwell-E.
+ *
+ * Things ending in "2" are usually because we have no better
+ * name for them.  There's no processor called "WESTMERE2".
  */
 
 #define INTEL_FAM6_MODEL_CORE_YONAH		0x0E
@@ -17,12 +20,13 @@
 #define INTEL_FAM6_MODEL_NEHALEM_EP		0x1A
 #define INTEL_FAM6_MODEL_NEHALEM_EX		0x2E
 #define INTEL_FAM6_MODEL_WESTMERE		0x25
+#define INTEL_FAM6_MODEL_WESTMERE2		0x1F
 #define INTEL_FAM6_MODEL_WESTMERE_EP		0x2C
 #define INTEL_FAM6_MODEL_WESTMERE_EX		0x2F
 #define INTEL_FAM6_MODEL_SANDYBRIDGE		0x2A
 #define INTEL_FAM6_MODEL_SANDYBRIDGE_X		0x2D
 #define INTEL_FAM6_MODEL_IVYBRIDGE		0x3A
-#define INTEL_FAM6_MODEL_IVYBRIDGE_X		0x3E
+#define INTEL_FAM6_MODEL_IVYBRIDGE_X		0x3E /* aka. Ivy Town / IVT */
 #define INTEL_FAM6_MODEL_HASWELL_CORE		0x3C
 #define INTEL_FAM6_MODEL_HASWELL_X		0x3F
 #define INTEL_FAM6_MODEL_HASWELL_ULT		0x45
@@ -44,9 +48,9 @@
 #define INTEL_FAM6_MODEL_ATOM_PENWELL		0x27
 #define INTEL_FAM6_MODEL_ATOM_CLOVERVIEW	0x35
 #define INTEL_FAM6_MODEL_ATOM_CEDARVIEW		0x36
-#define INTEL_FAM6_MODEL_ATOM_SILVERMONT1	0x37
+#define INTEL_FAM6_MODEL_ATOM_SILVERMONT1	0x37 /* BayTrail/BYT */
 #define INTEL_FAM6_MODEL_ATOM_SILVERMONT2	0x4D /* Avaton/Rangely */
-#define INTEL_FAM6_MODEL_ATOM_AIRMONT		0x4C
+#define INTEL_FAM6_MODEL_ATOM_AIRMONT		0x4C /* CherryTrail */
 #define INTEL_FAM6_MODEL_ATOM_GOLDMONT		0x5C
 #define INTEL_FAM6_MODEL_ATOM_DENVERTON		0x5F /* Goldmont Microserver */
 
diff -puN drivers/idle/intel_idle.c~x86-intel-familites-intelidle drivers/idle/intel_idle.c
--- a/drivers/idle/intel_idle.c~x86-intel-familites-intelidle	2016-06-01 10:20:12.090370837 -0700
+++ b/drivers/idle/intel_idle.c	2016-06-01 10:20:12.096371109 -0700
@@ -62,6 +62,7 @@
 #include <linux/cpu.h>
 #include <linux/module.h>
 #include <asm/cpu_device_id.h>
+#include <asm/intel-family.h>
 #include <asm/mwait.h>
 #include <asm/msr.h>
 
@@ -1020,38 +1021,38 @@ static const struct idle_cpu idle_cpu_bx
 	{ X86_VENDOR_INTEL, 6, model, X86_FEATURE_MWAIT, (unsigned long)&cpu }
 
 static const struct x86_cpu_id intel_idle_ids[] __initconst = {
-	ICPU(0x1a, idle_cpu_nehalem),
-	ICPU(0x1e, idle_cpu_nehalem),
-	ICPU(0x1f, idle_cpu_nehalem),
-	ICPU(0x25, idle_cpu_nehalem),
-	ICPU(0x2c, idle_cpu_nehalem),
-	ICPU(0x2e, idle_cpu_nehalem),
-	ICPU(0x1c, idle_cpu_atom),
-	ICPU(0x26, idle_cpu_lincroft),
-	ICPU(0x2f, idle_cpu_nehalem),
-	ICPU(0x2a, idle_cpu_snb),
-	ICPU(0x2d, idle_cpu_snb),
-	ICPU(0x36, idle_cpu_atom),
-	ICPU(0x37, idle_cpu_byt),
-	ICPU(0x4c, idle_cpu_cht),
-	ICPU(0x3a, idle_cpu_ivb),
-	ICPU(0x3e, idle_cpu_ivt),
-	ICPU(0x3c, idle_cpu_hsw),
-	ICPU(0x3f, idle_cpu_hsw),
-	ICPU(0x45, idle_cpu_hsw),
-	ICPU(0x46, idle_cpu_hsw),
-	ICPU(0x4d, idle_cpu_avn),
-	ICPU(0x3d, idle_cpu_bdw),
-	ICPU(0x47, idle_cpu_bdw),
-	ICPU(0x4f, idle_cpu_bdw),
-	ICPU(0x56, idle_cpu_bdw),
-	ICPU(0x4e, idle_cpu_skl),
-	ICPU(0x5e, idle_cpu_skl),
-	ICPU(0x8e, idle_cpu_skl),
-	ICPU(0x9e, idle_cpu_skl),
-	ICPU(0x55, idle_cpu_skx),
-	ICPU(0x57, idle_cpu_knl),
-	ICPU(0x5c, idle_cpu_bxt),
+	ICPU(INTEL_FAM6_MODEL_NEHALEM_EP,	idle_cpu_nehalem),
+	ICPU(INTEL_FAM6_MODEL_NEHALEM,		idle_cpu_nehalem),
+	ICPU(INTEL_FAM6_MODEL_WESTMERE2,	idle_cpu_nehalem),
+	ICPU(INTEL_FAM6_MODEL_WESTMERE,		idle_cpu_nehalem),
+	ICPU(INTEL_FAM6_MODEL_WESTMERE_EP,	idle_cpu_nehalem),
+	ICPU(INTEL_FAM6_MODEL_NEHALEM_EX,	idle_cpu_nehalem),
+	ICPU(INTEL_FAM6_MODEL_ATOM_PINEVIEW,	idle_cpu_atom),
+	ICPU(INTEL_FAM6_MODEL_ATOM_LINCROFT,	idle_cpu_lincroft),
+	ICPU(INTEL_FAM6_MODEL_WESTMERE_EX,	idle_cpu_nehalem),
+	ICPU(INTEL_FAM6_MODEL_SANDYBRIDGE,	idle_cpu_snb),
+	ICPU(INTEL_FAM6_MODEL_SANDYBRIDGE_X,	idle_cpu_snb),
+	ICPU(INTEL_FAM6_MODEL_ATOM_CEDARVIEW,	idle_cpu_atom),
+	ICPU(INTEL_FAM6_MODEL_ATOM_SILVERMONT1,	idle_cpu_byt),
+	ICPU(INTEL_FAM6_MODEL_ATOM_AIRMONT,	idle_cpu_cht),
+	ICPU(INTEL_FAM6_MODEL_IVYBRIDGE,	idle_cpu_ivb),
+	ICPU(INTEL_FAM6_MODEL_IVYBRIDGE_X,	idle_cpu_ivt),
+	ICPU(INTEL_FAM6_MODEL_HASWELL_CORE,	idle_cpu_hsw),
+	ICPU(INTEL_FAM6_MODEL_HASWELL_X,	idle_cpu_hsw),
+	ICPU(INTEL_FAM6_MODEL_HASWELL_ULT,	idle_cpu_hsw),
+	ICPU(INTEL_FAM6_MODEL_HASWELL_GT3E,	idle_cpu_hsw),
+	ICPU(INTEL_FAM6_MODEL_ATOM_SILVERMONT2,	idle_cpu_avn),
+	ICPU(INTEL_FAM6_MODEL_BROADWELL_CORE_M,	idle_cpu_bdw),
+	ICPU(INTEL_FAM6_MODEL_BROADWELL_GT3E,	idle_cpu_bdw),
+	ICPU(INTEL_FAM6_MODEL_BROADWELL_X,	idle_cpu_bdw),
+	ICPU(INTEL_FAM6_MODEL_BROADWELL_XEON_D,	idle_cpu_bdw),
+	ICPU(INTEL_FAM6_MODEL_SKYLAKE_MOBILE,	idle_cpu_skl),
+	ICPU(INTEL_FAM6_MODEL_SKYLAKE_DESKTOP,	idle_cpu_skl),
+	ICPU(INTEL_FAM6_MODEL_KABYLAKE_MOBILE,	idle_cpu_skl),
+	ICPU(INTEL_FAM6_MODEL_KABYLAKE_DESKTOP,	idle_cpu_skl),
+	ICPU(INTEL_FAM6_MODEL_SKYLAKE_X,	idle_cpu_skx),
+	ICPU(INTEL_FAM6_MODEL_XEON_PHI_KNL,	idle_cpu_knl),
+	ICPU(INTEL_FAM6_MODEL_ATOM_GOLDMONT,	idle_cpu_bxt),
 	{}
 };
 MODULE_DEVICE_TABLE(x86cpu, intel_idle_ids);
@@ -1261,13 +1262,13 @@ static void intel_idle_state_table_updat
 {
 	switch (boot_cpu_data.x86_model) {
 
-	case 0x3e: /* IVT */
+	case INTEL_FAM6_MODEL_IVYBRIDGE_X:
 		ivt_idle_state_table_update();
 		break;
-	case 0x5c: /* BXT */
+	case INTEL_FAM6_MODEL_ATOM_GOLDMONT:
 		bxt_idle_state_table_update();
 		break;
-	case 0x5e: /* SKL-H */
+	case INTEL_FAM6_MODEL_SKYLAKE_DESKTOP:
 		sklh_idle_state_table_update();
 		break;
 	}
_

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 5/5] x86, msr: use Intel family macros for msr events code
  2016-06-01 17:34 [PATCH 1/5] x86, intel: Introduce macros for Intel family numbers Dave Hansen
                   ` (2 preceding siblings ...)
  2016-06-01 17:34 ` [PATCH 4/5] x86, intel_idle: use Intel family macros for intel_idle Dave Hansen
@ 2016-06-01 17:34 ` Dave Hansen
  3 siblings, 0 replies; 6+ messages in thread
From: Dave Hansen @ 2016-06-01 17:34 UTC (permalink / raw)
  To: linux-kernel; +Cc: x86, Dave Hansen, dave.hansen, luto, peterz


From: Dave Hansen <dave.hansen@linux.intel.com>

Use the new INTEL_FAM6_MODEL_* macros for arch/x86/events/msr.c.

This code appears to be missing handling for "WESTMERE2" and
"SKYLAKE_X".

Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
---

 b/arch/x86/events/msr.c |   59 ++++++++++++++++++++++++------------------------
 1 file changed, 30 insertions(+), 29 deletions(-)

diff -puN arch/x86/events/msr.c~x86-intel-familites-msr arch/x86/events/msr.c
--- a/arch/x86/events/msr.c~x86-intel-familites-msr	2016-06-01 10:20:12.546391511 -0700
+++ b/arch/x86/events/msr.c	2016-06-01 10:20:12.550391692 -0700
@@ -1,4 +1,5 @@
 #include <linux/perf_event.h>
+#include <asm/intel-family.h>
 
 enum perf_msr_id {
 	PERF_MSR_TSC			= 0,
@@ -34,39 +35,39 @@ static bool test_intel(int idx)
 		return false;
 
 	switch (boot_cpu_data.x86_model) {
-	case 30: /* 45nm Nehalem    */
-	case 26: /* 45nm Nehalem-EP */
-	case 46: /* 45nm Nehalem-EX */
-
-	case 37: /* 32nm Westmere    */
-	case 44: /* 32nm Westmere-EP */
-	case 47: /* 32nm Westmere-EX */
-
-	case 42: /* 32nm SandyBridge         */
-	case 45: /* 32nm SandyBridge-E/EN/EP */
-
-	case 58: /* 22nm IvyBridge       */
-	case 62: /* 22nm IvyBridge-EP/EX */
-
-	case 60: /* 22nm Haswell Core */
-	case 63: /* 22nm Haswell Server */
-	case 69: /* 22nm Haswell ULT */
-	case 70: /* 22nm Haswell + GT3e (Intel Iris Pro graphics) */
-
-	case 61: /* 14nm Broadwell Core-M */
-	case 86: /* 14nm Broadwell Xeon D */
-	case 71: /* 14nm Broadwell + GT3e (Intel Iris Pro graphics) */
-	case 79: /* 14nm Broadwell Server */
-
-	case 55: /* 22nm Atom "Silvermont"                */
-	case 77: /* 22nm Atom "Silvermont Avoton/Rangely" */
-	case 76: /* 14nm Atom "Airmont"                   */
+	case INTEL_FAM6_MODEL_NEHALEM:
+	case INTEL_FAM6_MODEL_NEHALEM_EP:
+	case INTEL_FAM6_MODEL_NEHALEM_EX:
+
+	case INTEL_FAM6_MODEL_WESTMERE:
+	case INTEL_FAM6_MODEL_WESTMERE_EP:
+	case INTEL_FAM6_MODEL_WESTMERE_EX:
+
+	case INTEL_FAM6_MODEL_SANDYBRIDGE:
+	case INTEL_FAM6_MODEL_SANDYBRIDGE_X:
+
+	case INTEL_FAM6_MODEL_IVYBRIDGE:
+	case INTEL_FAM6_MODEL_IVYBRIDGE_X:
+
+	case INTEL_FAM6_MODEL_HASWELL_CORE:
+	case INTEL_FAM6_MODEL_HASWELL_X:
+	case INTEL_FAM6_MODEL_HASWELL_ULT:
+	case INTEL_FAM6_MODEL_HASWELL_GT3E:
+
+	case INTEL_FAM6_MODEL_BROADWELL_CORE_M:
+	case INTEL_FAM6_MODEL_BROADWELL_XEON_D:
+	case INTEL_FAM6_MODEL_BROADWELL_GT3E:
+	case INTEL_FAM6_MODEL_BROADWELL_X:
+
+	case INTEL_FAM6_MODEL_ATOM_SILVERMONT1:
+	case INTEL_FAM6_MODEL_ATOM_SILVERMONT2:
+	case INTEL_FAM6_MODEL_ATOM_AIRMONT:
 		if (idx == PERF_MSR_SMI)
 			return true;
 		break;
 
-	case 78: /* 14nm Skylake Mobile */
-	case 94: /* 14nm Skylake Desktop */
+	case INTEL_FAM6_MODEL_SKYLAKE_MOBILE:
+	case INTEL_FAM6_MODEL_SKYLAKE_DESKTOP:
 		if (idx == PERF_MSR_SMI || idx == PERF_MSR_PPERF)
 			return true;
 		break;
_

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/5] x86, perf: use Intel family macros for core perf events
  2016-06-01 17:34 ` [PATCH 2/5] x86, perf: use Intel family macros for core perf events Dave Hansen
@ 2016-06-01 17:46   ` Peter Zijlstra
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Zijlstra @ 2016-06-01 17:46 UTC (permalink / raw)
  To: Dave Hansen; +Cc: linux-kernel, x86, dave.hansen, ak, kan.liang

On Wed, Jun 01, 2016 at 10:34:42AM -0700, Dave Hansen wrote:
> 
> From: Dave Hansen <dave.hansen@linux.intel.com>
> 
> Use the new model number macros instead of spelling things out
> in the comments.
> 
> Note that this is missing a Nehalem model that is mentioned in
> intel_idle.  Is that a a problem?

Would be good to add fix up; maybe a follow up patch that fixes up all
the missing entires for all 4 lists as 6/5 ?

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-06-01 17:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-01 17:34 [PATCH 1/5] x86, intel: Introduce macros for Intel family numbers Dave Hansen
2016-06-01 17:34 ` [PATCH 2/5] x86, perf: use Intel family macros for core perf events Dave Hansen
2016-06-01 17:46   ` Peter Zijlstra
2016-06-01 17:34 ` [PATCH 3/5] x86, rapl: use Intel family macros for rapl Dave Hansen
2016-06-01 17:34 ` [PATCH 4/5] x86, intel_idle: use Intel family macros for intel_idle Dave Hansen
2016-06-01 17:34 ` [PATCH 5/5] x86, msr: use Intel family macros for msr events code Dave Hansen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).