mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-20 11:13:58 +08:00
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>
This commit is contained in:
parent
48fb4b4671
commit
d0f585dd20
@ -147,6 +147,30 @@ static void nmi_cpu_setup_mux(int cpu, struct op_msrs const * const msrs)
|
|||||||
per_cpu(switch_index, cpu) = 0;
|
per_cpu(switch_index, cpu) = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void nmi_cpu_save_mpx_registers(struct op_msrs *msrs)
|
||||||
|
{
|
||||||
|
struct op_msr *multiplex = msrs->multiplex;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < model->num_counters; ++i) {
|
||||||
|
int virt = op_x86_phys_to_virt(i);
|
||||||
|
if (multiplex[virt].addr)
|
||||||
|
rdmsrl(multiplex[virt].addr, multiplex[virt].saved);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void nmi_cpu_restore_mpx_registers(struct op_msrs *msrs)
|
||||||
|
{
|
||||||
|
struct op_msr *multiplex = msrs->multiplex;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < model->num_counters; ++i) {
|
||||||
|
int virt = op_x86_phys_to_virt(i);
|
||||||
|
if (multiplex[virt].addr)
|
||||||
|
wrmsrl(multiplex[virt].addr, multiplex[virt].saved);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
inline int op_x86_phys_to_virt(int phys) { return phys; }
|
inline int op_x86_phys_to_virt(int phys) { return phys; }
|
||||||
@ -252,34 +276,6 @@ static int nmi_setup(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX
|
|
||||||
|
|
||||||
static void nmi_cpu_save_mpx_registers(struct op_msrs *msrs)
|
|
||||||
{
|
|
||||||
struct op_msr *multiplex = msrs->multiplex;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < model->num_counters; ++i) {
|
|
||||||
int virt = op_x86_phys_to_virt(i);
|
|
||||||
if (multiplex[virt].addr)
|
|
||||||
rdmsrl(multiplex[virt].addr, multiplex[virt].saved);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void nmi_cpu_restore_mpx_registers(struct op_msrs *msrs)
|
|
||||||
{
|
|
||||||
struct op_msr *multiplex = msrs->multiplex;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < model->num_counters; ++i) {
|
|
||||||
int virt = op_x86_phys_to_virt(i);
|
|
||||||
if (multiplex[virt].addr)
|
|
||||||
wrmsrl(multiplex[virt].addr, multiplex[virt].saved);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void nmi_cpu_restore_registers(struct op_msrs *msrs)
|
static void nmi_cpu_restore_registers(struct op_msrs *msrs)
|
||||||
{
|
{
|
||||||
struct op_msr *counters = msrs->counters;
|
struct op_msr *counters = msrs->counters;
|
||||||
|
Loading…
Reference in New Issue
Block a user