aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKan Liang <kan.liang@linux.intel.com>2019-02-04 17:23:32 -0500
committerIngo Molnar <mingo@kernel.org>2019-02-11 02:00:41 -0500
commitbef9f2714f8cf036af3af52a15f534d2cc40c230 (patch)
treeb3c03e217fa9ead3856cc1f6d164e5ce8916c13c
parenta96fff8df28ddd2f6710e5af454a45014c73183c (diff)
perf/x86/intel: Clean up counter freezing quirk
Clean up counter freezing quirk to use the new facility to check for min microcode revisions. Rename the counter freezing quirk related functions. Because other platforms, e.g. Goldmont, also needs to call the quirk. Only check the boot CPU, assuming models and features are consistent over all CPUs. Signed-off-by: Kan Liang <kan.liang@linux.intel.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Vince Weaver <vincent.weaver@maine.edu> Cc: bp@alien8.de Link: https://lkml.kernel.org/r/1549319013-4522-4-git-send-email-kan.liang@linux.intel.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--arch/x86/events/intel/core.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
index 87f4ed203c07..c79c0165d838 100644
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -3923,23 +3923,18 @@ static __init void intel_nehalem_quirk(void)
3923 } 3923 }
3924} 3924}
3925 3925
3926static bool intel_glp_counter_freezing_broken(int cpu) 3926static const struct x86_cpu_desc counter_freezing_ucodes[] = {
3927{ 3927 INTEL_CPU_DESC(INTEL_FAM6_ATOM_GOLDMONT_PLUS, 1, 0x00000028),
3928 u32 rev = UINT_MAX; /* default to broken for unknown stepping */ 3928 INTEL_CPU_DESC(INTEL_FAM6_ATOM_GOLDMONT_PLUS, 8, 0x00000006),
3929 3929 {}
3930 switch (cpu_data(cpu).x86_stepping) { 3930};
3931 case 1:
3932 rev = 0x28;
3933 break;
3934 case 8:
3935 rev = 0x6;
3936 break;
3937 }
3938 3931
3939 return (cpu_data(cpu).microcode < rev); 3932static bool intel_counter_freezing_broken(void)
3933{
3934 return !x86_cpu_has_min_microcode_rev(counter_freezing_ucodes);
3940} 3935}
3941 3936
3942static __init void intel_glp_counter_freezing_quirk(void) 3937static __init void intel_counter_freezing_quirk(void)
3943{ 3938{
3944 /* Check if it's already disabled */ 3939 /* Check if it's already disabled */
3945 if (disable_counter_freezing) 3940 if (disable_counter_freezing)
@@ -3949,7 +3944,7 @@ static __init void intel_glp_counter_freezing_quirk(void)
3949 * If the system starts with the wrong ucode, leave the 3944 * If the system starts with the wrong ucode, leave the
3950 * counter-freezing feature permanently disabled. 3945 * counter-freezing feature permanently disabled.
3951 */ 3946 */
3952 if (intel_glp_counter_freezing_broken(raw_smp_processor_id())) { 3947 if (intel_counter_freezing_broken()) {
3953 pr_info("PMU counter freezing disabled due to CPU errata," 3948 pr_info("PMU counter freezing disabled due to CPU errata,"
3954 "please upgrade microcode\n"); 3949 "please upgrade microcode\n");
3955 x86_pmu.counter_freezing = false; 3950 x86_pmu.counter_freezing = false;
@@ -4326,7 +4321,7 @@ __init int intel_pmu_init(void)
4326 break; 4321 break;
4327 4322
4328 case INTEL_FAM6_ATOM_GOLDMONT_PLUS: 4323 case INTEL_FAM6_ATOM_GOLDMONT_PLUS:
4329 x86_add_quirk(intel_glp_counter_freezing_quirk); 4324 x86_add_quirk(intel_counter_freezing_quirk);
4330 memcpy(hw_cache_event_ids, glp_hw_cache_event_ids, 4325 memcpy(hw_cache_event_ids, glp_hw_cache_event_ids,
4331 sizeof(hw_cache_event_ids)); 4326 sizeof(hw_cache_event_ids));
4332 memcpy(hw_cache_extra_regs, glp_hw_cache_extra_regs, 4327 memcpy(hw_cache_extra_regs, glp_hw_cache_extra_regs,