Commit fe615cbf authored by Robert Richter's avatar Robert Richter

x86/oprofile: cleanup IBS init/exit functions in op_model_amd.c

Implementation of pairwise init/exit funcions for IBS and IBS NMI
setup. There are also some function renames and the removal of forward
function declarations.
Signed-off-by: default avatarRobert Richter <robert.richter@amd.com>
parent 9fa6812d
...@@ -106,11 +106,6 @@ struct ibs_op_sample { ...@@ -106,11 +106,6 @@ struct ibs_op_sample {
unsigned int ibs_dc_phys_high; unsigned int ibs_dc_phys_high;
}; };
/*
* unitialize the APIC for the IBS interrupts if needed on AMD Family10h+
*/
static void clear_ibs_nmi(void);
static int ibs_allowed; /* AMD Family10h and later */ static int ibs_allowed; /* AMD Family10h and later */
struct op_ibs_config { struct op_ibs_config {
...@@ -390,7 +385,7 @@ static inline void apic_clear_ibs_nmi_per_cpu(void *arg) ...@@ -390,7 +385,7 @@ static inline void apic_clear_ibs_nmi_per_cpu(void *arg)
setup_APIC_eilvt_ibs(0, APIC_EILVT_MSG_FIX, 1); setup_APIC_eilvt_ibs(0, APIC_EILVT_MSG_FIX, 1);
} }
static int pfm_amd64_setup_eilvt(void) static int init_ibs_nmi(void)
{ {
#define IBSCTL_LVTOFFSETVAL (1 << 8) #define IBSCTL_LVTOFFSETVAL (1 << 8)
#define IBSCTL 0x1cc #define IBSCTL 0x1cc
...@@ -438,15 +433,22 @@ static int pfm_amd64_setup_eilvt(void) ...@@ -438,15 +433,22 @@ static int pfm_amd64_setup_eilvt(void)
return 0; return 0;
} }
/* uninitialize the APIC for the IBS interrupts if needed */
static void clear_ibs_nmi(void)
{
if (ibs_allowed)
on_each_cpu(apic_clear_ibs_nmi_per_cpu, NULL, 1);
}
/* initialize the APIC for the IBS interrupts if available */ /* initialize the APIC for the IBS interrupts if available */
static void setup_ibs(void) static void ibs_init(void)
{ {
ibs_allowed = boot_cpu_has(X86_FEATURE_IBS); ibs_allowed = boot_cpu_has(X86_FEATURE_IBS);
if (!ibs_allowed) if (!ibs_allowed)
return; return;
if (pfm_amd64_setup_eilvt()) { if (init_ibs_nmi()) {
ibs_allowed = 0; ibs_allowed = 0;
return; return;
} }
...@@ -454,12 +456,12 @@ static void setup_ibs(void) ...@@ -454,12 +456,12 @@ static void setup_ibs(void)
printk(KERN_INFO "oprofile: AMD IBS detected\n"); printk(KERN_INFO "oprofile: AMD IBS detected\n");
} }
static void ibs_exit(void)
/* uninitialize the APIC for the IBS interrupts if needed */
static void clear_ibs_nmi(void)
{ {
if (ibs_allowed) if (!ibs_allowed)
on_each_cpu(apic_clear_ibs_nmi_per_cpu, NULL, 1); return;
clear_ibs_nmi();
} }
static int (*create_arch_files)(struct super_block *sb, struct dentry *root); static int (*create_arch_files)(struct super_block *sb, struct dentry *root);
...@@ -509,7 +511,7 @@ static int setup_ibs_files(struct super_block *sb, struct dentry *root) ...@@ -509,7 +511,7 @@ static int setup_ibs_files(struct super_block *sb, struct dentry *root)
static int op_amd_init(struct oprofile_operations *ops) static int op_amd_init(struct oprofile_operations *ops)
{ {
setup_ibs(); ibs_init();
create_arch_files = ops->create_files; create_arch_files = ops->create_files;
ops->create_files = setup_ibs_files; ops->create_files = setup_ibs_files;
return 0; return 0;
...@@ -517,7 +519,7 @@ static int op_amd_init(struct oprofile_operations *ops) ...@@ -517,7 +519,7 @@ static int op_amd_init(struct oprofile_operations *ops)
static void op_amd_exit(void) static void op_amd_exit(void)
{ {
clear_ibs_nmi(); ibs_exit();
} }
#else #else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment