aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/oprofile
diff options
context:
space:
mode:
authorRobert Richter <robert.richter@amd.com>2009-07-09 08:38:49 -0400
committerRobert Richter <robert.richter@amd.com>2009-07-20 10:43:20 -0400
commitd0f585dd20010f8479e56b5c6f391ef18e26877e (patch)
treeaf27a5c3ff9d93df2e1ac5cd9cc95c4f1909e708 /arch/x86/oprofile
parent48fb4b46712c7d3e8adc79826311abd9ccbf7f1d (diff)
x86/oprofile: Moving nmi_cpu_save/restore_mpx_registers() in nmi_int.c
This patch moves some code in nmi_int.c to get a single separate multiplexing code section. Signed-off-by: Robert Richter <robert.richter@amd.com>
Diffstat (limited to 'arch/x86/oprofile')
-rw-r--r--arch/x86/oprofile/nmi_int.c52
1 files changed, 24 insertions, 28 deletions
diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c
index b1edfc922e7..f38c5cf0fdb 100644
--- a/arch/x86/oprofile/nmi_int.c
+++ b/arch/x86/oprofile/nmi_int.c
@@ -147,6 +147,30 @@ static void nmi_cpu_setup_mux(int cpu, struct op_msrs const * const msrs)
147 per_cpu(switch_index, cpu) = 0; 147 per_cpu(switch_index, cpu) = 0;
148} 148}
149 149
150static void nmi_cpu_save_mpx_registers(struct op_msrs *msrs)
151{
152 struct op_msr *multiplex = msrs->multiplex;
153 int i;
154
155 for (i = 0; i < model->num_counters; ++i) {
156 int virt = op_x86_phys_to_virt(i);
157 if (multiplex[virt].addr)
158 rdmsrl(multiplex[virt].addr, multiplex[virt].saved);
159 }
160}
161
162static void nmi_cpu_restore_mpx_registers(struct op_msrs *msrs)
163{
164 struct op_msr *multiplex = msrs->multiplex;
165 int i;
166
167 for (i = 0; i < model->num_counters; ++i) {
168 int virt = op_x86_phys_to_virt(i);
169 if (multiplex[virt].addr)
170 wrmsrl(multiplex[virt].addr, multiplex[virt].saved);
171 }
172}
173
150#else 174#else
151 175
152inline int op_x86_phys_to_virt(int phys) { return phys; } 176inline int op_x86_phys_to_virt(int phys) { return phys; }
@@ -252,34 +276,6 @@ static int nmi_setup(void)
252 return 0; 276 return 0;
253} 277}
254 278
255#ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX
256
257static void nmi_cpu_save_mpx_registers(struct op_msrs *msrs)
258{
259 struct op_msr *multiplex = msrs->multiplex;
260 int i;
261
262 for (i = 0; i < model->num_counters; ++i) {
263 int virt = op_x86_phys_to_virt(i);
264 if (multiplex[virt].addr)
265 rdmsrl(multiplex[virt].addr, multiplex[virt].saved);
266 }
267}
268
269static void nmi_cpu_restore_mpx_registers(struct op_msrs *msrs)
270{
271 struct op_msr *multiplex = msrs->multiplex;
272 int i;
273
274 for (i = 0; i < model->num_counters; ++i) {
275 int virt = op_x86_phys_to_virt(i);
276 if (multiplex[virt].addr)
277 wrmsrl(multiplex[virt].addr, multiplex[virt].saved);
278 }
279}
280
281#endif
282
283static void nmi_cpu_restore_registers(struct op_msrs *msrs) 279static void nmi_cpu_restore_registers(struct op_msrs *msrs)
284{ 280{
285 struct op_msr *counters = msrs->counters; 281 struct op_msr *counters = msrs->counters;