diff options
author | Robert Richter <robert.richter@amd.com> | 2011-09-21 05:30:17 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-10-10 00:57:11 -0400 |
commit | ee5789dbcc800ba7d641443e53f60d53977f9747 (patch) | |
tree | f4fac5769d7e76fff1e74ffc662a6af0441591a9 /arch/x86/oprofile/op_model_amd.c | |
parent | efc3aac5f3d7dbd47fd0a4983979dd4342a78fba (diff) |
perf, x86: Share IBS macros between perf and oprofile
Moving IBS macros from oprofile to <asm/perf_event.h> to make it
available to perf. No additional changes.
Signed-off-by: Robert Richter <robert.richter@amd.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1316597423-25723-2-git-send-email-robert.richter@amd.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/oprofile/op_model_amd.c')
-rw-r--r-- | arch/x86/oprofile/op_model_amd.c | 37 |
1 files changed, 3 insertions, 34 deletions
diff --git a/arch/x86/oprofile/op_model_amd.c b/arch/x86/oprofile/op_model_amd.c index 9cbb710dc94b..e947e5cb2e61 100644 --- a/arch/x86/oprofile/op_model_amd.c +++ b/arch/x86/oprofile/op_model_amd.c | |||
@@ -29,8 +29,6 @@ | |||
29 | #include "op_x86_model.h" | 29 | #include "op_x86_model.h" |
30 | #include "op_counter.h" | 30 | #include "op_counter.h" |
31 | 31 | ||
32 | #define NUM_COUNTERS 4 | ||
33 | #define NUM_COUNTERS_F15H 6 | ||
34 | #ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX | 32 | #ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX |
35 | #define NUM_VIRT_COUNTERS 32 | 33 | #define NUM_VIRT_COUNTERS 32 |
36 | #else | 34 | #else |
@@ -70,35 +68,6 @@ static struct ibs_config ibs_config; | |||
70 | static struct ibs_state ibs_state; | 68 | static struct ibs_state ibs_state; |
71 | 69 | ||
72 | /* | 70 | /* |
73 | * IBS cpuid feature detection | ||
74 | */ | ||
75 | |||
76 | #define IBS_CPUID_FEATURES 0x8000001b | ||
77 | |||
78 | /* | ||
79 | * Same bit mask as for IBS cpuid feature flags (Fn8000_001B_EAX), but | ||
80 | * bit 0 is used to indicate the existence of IBS. | ||
81 | */ | ||
82 | #define IBS_CAPS_AVAIL (1U<<0) | ||
83 | #define IBS_CAPS_FETCHSAM (1U<<1) | ||
84 | #define IBS_CAPS_OPSAM (1U<<2) | ||
85 | #define IBS_CAPS_RDWROPCNT (1U<<3) | ||
86 | #define IBS_CAPS_OPCNT (1U<<4) | ||
87 | #define IBS_CAPS_BRNTRGT (1U<<5) | ||
88 | #define IBS_CAPS_OPCNTEXT (1U<<6) | ||
89 | |||
90 | #define IBS_CAPS_DEFAULT (IBS_CAPS_AVAIL \ | ||
91 | | IBS_CAPS_FETCHSAM \ | ||
92 | | IBS_CAPS_OPSAM) | ||
93 | |||
94 | /* | ||
95 | * IBS APIC setup | ||
96 | */ | ||
97 | #define IBSCTL 0x1cc | ||
98 | #define IBSCTL_LVT_OFFSET_VALID (1ULL<<8) | ||
99 | #define IBSCTL_LVT_OFFSET_MASK 0x0F | ||
100 | |||
101 | /* | ||
102 | * IBS randomization macros | 71 | * IBS randomization macros |
103 | */ | 72 | */ |
104 | #define IBS_RANDOM_BITS 12 | 73 | #define IBS_RANDOM_BITS 12 |
@@ -439,7 +408,7 @@ static int op_amd_fill_in_addresses(struct op_msrs * const msrs) | |||
439 | goto fail; | 408 | goto fail; |
440 | } | 409 | } |
441 | /* both registers must be reserved */ | 410 | /* both registers must be reserved */ |
442 | if (num_counters == NUM_COUNTERS_F15H) { | 411 | if (num_counters == AMD64_NUM_COUNTERS_F15H) { |
443 | msrs->counters[i].addr = MSR_F15H_PERF_CTR + (i << 1); | 412 | msrs->counters[i].addr = MSR_F15H_PERF_CTR + (i << 1); |
444 | msrs->controls[i].addr = MSR_F15H_PERF_CTL + (i << 1); | 413 | msrs->controls[i].addr = MSR_F15H_PERF_CTL + (i << 1); |
445 | } else { | 414 | } else { |
@@ -741,9 +710,9 @@ static int op_amd_init(struct oprofile_operations *ops) | |||
741 | ops->create_files = setup_ibs_files; | 710 | ops->create_files = setup_ibs_files; |
742 | 711 | ||
743 | if (boot_cpu_data.x86 == 0x15) { | 712 | if (boot_cpu_data.x86 == 0x15) { |
744 | num_counters = NUM_COUNTERS_F15H; | 713 | num_counters = AMD64_NUM_COUNTERS_F15H; |
745 | } else { | 714 | } else { |
746 | num_counters = NUM_COUNTERS; | 715 | num_counters = AMD64_NUM_COUNTERS; |
747 | } | 716 | } |
748 | 717 | ||
749 | op_amd_spec.num_counters = num_counters; | 718 | op_amd_spec.num_counters = num_counters; |