aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRobert Richter <robert.richter@amd.com>2009-07-10 09:47:17 -0400
committerRobert Richter <robert.richter@amd.com>2009-07-20 10:43:21 -0400
commit61d149d5248ad7428801cdede0f5fcc2b90cd61c (patch)
tree7cfc04e6567cf34f2cba40f86287a51566d163ad /arch
parent1b294f5960cd89e49eeb3e797860c552b03f2272 (diff)
x86/oprofile: Implement op_x86_virt_to_phys()
This patch implements a common x86 function to convert virtual counter numbers to physical. Signed-off-by: Robert Richter <robert.richter@amd.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/oprofile/nmi_int.c6
-rw-r--r--arch/x86/oprofile/op_model_amd.c2
-rw-r--r--arch/x86/oprofile/op_x86_model.h1
3 files changed, 8 insertions, 1 deletions
diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c
index 7b3362f9abdb..5856e61cb098 100644
--- a/arch/x86/oprofile/nmi_int.c
+++ b/arch/x86/oprofile/nmi_int.c
@@ -129,6 +129,11 @@ inline int op_x86_phys_to_virt(int phys)
129 return __get_cpu_var(switch_index) + phys; 129 return __get_cpu_var(switch_index) + phys;
130} 130}
131 131
132inline int op_x86_virt_to_phys(int virt)
133{
134 return virt % model->num_counters;
135}
136
132static void nmi_shutdown_mux(void) 137static void nmi_shutdown_mux(void)
133{ 138{
134 int i; 139 int i;
@@ -270,6 +275,7 @@ static void mux_clone(int cpu)
270#else 275#else
271 276
272inline int op_x86_phys_to_virt(int phys) { return phys; } 277inline int op_x86_phys_to_virt(int phys) { return phys; }
278inline int op_x86_virt_to_phys(int virt) { return virt; }
273static inline void nmi_shutdown_mux(void) { } 279static inline void nmi_shutdown_mux(void) { }
274static inline int nmi_setup_mux(void) { return 1; } 280static inline int nmi_setup_mux(void) { return 1; }
275static inline void 281static inline void
diff --git a/arch/x86/oprofile/op_model_amd.c b/arch/x86/oprofile/op_model_amd.c
index dce69b5979e6..1ea19829d985 100644
--- a/arch/x86/oprofile/op_model_amd.c
+++ b/arch/x86/oprofile/op_model_amd.c
@@ -81,7 +81,7 @@ static void op_mux_fill_in_addresses(struct op_msrs * const msrs)
81 int i; 81 int i;
82 82
83 for (i = 0; i < NUM_VIRT_COUNTERS; i++) { 83 for (i = 0; i < NUM_VIRT_COUNTERS; i++) {
84 int hw_counter = i % NUM_COUNTERS; 84 int hw_counter = op_x86_virt_to_phys(i);
85 if (reserve_perfctr_nmi(MSR_K7_PERFCTR0 + i)) 85 if (reserve_perfctr_nmi(MSR_K7_PERFCTR0 + i))
86 msrs->multiplex[i].addr = MSR_K7_PERFCTR0 + hw_counter; 86 msrs->multiplex[i].addr = MSR_K7_PERFCTR0 + hw_counter;
87 else 87 else
diff --git a/arch/x86/oprofile/op_x86_model.h b/arch/x86/oprofile/op_x86_model.h
index 4e2e7c2c519f..b83776180c7f 100644
--- a/arch/x86/oprofile/op_x86_model.h
+++ b/arch/x86/oprofile/op_x86_model.h
@@ -60,6 +60,7 @@ struct op_counter_config;
60extern u64 op_x86_get_ctrl(struct op_x86_model_spec const *model, 60extern u64 op_x86_get_ctrl(struct op_x86_model_spec const *model,
61 struct op_counter_config *counter_config); 61 struct op_counter_config *counter_config);
62extern int op_x86_phys_to_virt(int phys); 62extern int op_x86_phys_to_virt(int phys);
63extern int op_x86_virt_to_phys(int virt);
63 64
64extern struct op_x86_model_spec op_ppro_spec; 65extern struct op_x86_model_spec op_ppro_spec;
65extern struct op_x86_model_spec op_p4_spec; 66extern struct op_x86_model_spec op_p4_spec;