Merge branch 'oprofile/x86-oprofile-for-tip' into oprofile/oprofile-for-tip
Robert Richter [Wed, 15 Oct 2008 20:19:41 +0000 (22:19 +0200)]
Conflicts:
arch/x86/oprofile/op_model_ppro.c

1  2 
arch/x86/oprofile/nmi_int.c
arch/x86/oprofile/op_model_ppro.c
arch/x86/oprofile/op_x86_model.h

Simple merge
@@@ -180,13 -200,55 +200,55 @@@ static void ppro_shutdown(struct op_msr
  }
  
  
- struct op_x86_model_spec const op_ppro_spec = {
-       .num_counters           = NUM_COUNTERS,
-       .num_controls           = NUM_CONTROLS,
+ struct op_x86_model_spec op_ppro_spec = {
 -      .num_counters = 2,      /* can be overriden */
 -      .num_controls = 2,      /* dito */
 -      .fill_in_addresses = &ppro_fill_in_addresses,
 -      .setup_ctrs = &ppro_setup_ctrs,
 -      .check_ctrs = &ppro_check_ctrs,
 -      .start = &ppro_start,
 -      .stop = &ppro_stop,
 -      .shutdown = &ppro_shutdown
++      .num_counters           = 2,    /* can be overriden */
++      .num_controls           = 2,    /* dito */
++      .fill_in_addresses      = &ppro_fill_in_addresses,
++      .setup_ctrs             = &ppro_setup_ctrs,
++      .check_ctrs             = &ppro_check_ctrs,
++      .start                  = &ppro_start,
++      .stop                   = &ppro_stop,
++      .shutdown               = &ppro_shutdown
+ };
+ /*
+  * Architectural performance monitoring.
+  *
+  * Newer Intel CPUs (Core1+) have support for architectural
+  * events described in CPUID 0xA. See the IA32 SDM Vol3b.18 for details.
+  * The advantage of this is that it can be done without knowing about
+  * the specific CPU.
+  */
+ void arch_perfmon_setup_counters(void)
+ {
+       union cpuid10_eax eax;
+       eax.full = cpuid_eax(0xa);
+       /* Workaround for BIOS bugs in 6/15. Taken from perfmon2 */
+       if (eax.split.version_id == 0 && current_cpu_data.x86 == 6 &&
+               current_cpu_data.x86_model == 15) {
+               eax.split.version_id = 2;
+               eax.split.num_counters = 2;
+               eax.split.bit_width = 40;
+       }
+       num_counters = eax.split.num_counters;
+       op_arch_perfmon_spec.num_counters = num_counters;
+       op_arch_perfmon_spec.num_controls = num_counters;
+       op_ppro_spec.num_counters = num_counters;
+       op_ppro_spec.num_controls = num_counters;
+ }
+ struct op_x86_model_spec op_arch_perfmon_spec = {
+       /* num_counters/num_controls filled in at runtime */
 -      .fill_in_addresses = &ppro_fill_in_addresses,
 +      .fill_in_addresses      = &ppro_fill_in_addresses,
+       /* user space does the cpuid check for available events */
 -      .setup_ctrs = &ppro_setup_ctrs,
 -      .check_ctrs = &ppro_check_ctrs,
 -      .start = &ppro_start,
 -      .stop = &ppro_stop,
 -      .shutdown = &ppro_shutdown
 +      .setup_ctrs             = &ppro_setup_ctrs,
 +      .check_ctrs             = &ppro_check_ctrs,
 +      .start                  = &ppro_start,
 +      .stop                   = &ppro_stop,
 +      .shutdown               = &ppro_shutdown
  };
Simple merge