aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/oprofile
diff options
context:
space:
mode:
authorRobert Richter <robert.richter@amd.com>2008-11-24 08:58:03 -0500
committerRobert Richter <robert.richter@amd.com>2008-12-10 08:20:08 -0500
commitfe615cbf34fc6a1c53c359417da4696328a488ed (patch)
tree1e2bd7720e5be3568a6934bf53a430b6a14bc9b8 /arch/x86/oprofile
parent9fa6812dbab9207f7af52c3d0417f1f9eb89c386 (diff)
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: Robert Richter <robert.richter@amd.com>
Diffstat (limited to 'arch/x86/oprofile')
-rw-r--r--arch/x86/oprofile/op_model_amd.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/arch/x86/oprofile/op_model_amd.c b/arch/x86/oprofile/op_model_amd.c
index 8ff657b3ff89..98658f25f542 100644
--- a/arch/x86/oprofile/op_model_amd.c
+++ b/arch/x86/oprofile/op_model_amd.c
@@ -106,11 +106,6 @@ struct ibs_op_sample {
106 unsigned int ibs_dc_phys_high; 106 unsigned int ibs_dc_phys_high;
107}; 107};
108 108
109/*
110 * unitialize the APIC for the IBS interrupts if needed on AMD Family10h+
111 */
112static void clear_ibs_nmi(void);
113
114static int ibs_allowed; /* AMD Family10h and later */ 109static int ibs_allowed; /* AMD Family10h and later */
115 110
116struct op_ibs_config { 111struct op_ibs_config {
@@ -390,7 +385,7 @@ static inline void apic_clear_ibs_nmi_per_cpu(void *arg)
390 setup_APIC_eilvt_ibs(0, APIC_EILVT_MSG_FIX, 1); 385 setup_APIC_eilvt_ibs(0, APIC_EILVT_MSG_FIX, 1);
391} 386}
392 387
393static int pfm_amd64_setup_eilvt(void) 388static int init_ibs_nmi(void)
394{ 389{
395#define IBSCTL_LVTOFFSETVAL (1 << 8) 390#define IBSCTL_LVTOFFSETVAL (1 << 8)
396#define IBSCTL 0x1cc 391#define IBSCTL 0x1cc
@@ -438,15 +433,22 @@ static int pfm_amd64_setup_eilvt(void)
438 return 0; 433 return 0;
439} 434}
440 435
436/* uninitialize the APIC for the IBS interrupts if needed */
437static void clear_ibs_nmi(void)
438{
439 if (ibs_allowed)
440 on_each_cpu(apic_clear_ibs_nmi_per_cpu, NULL, 1);
441}
442
441/* initialize the APIC for the IBS interrupts if available */ 443/* initialize the APIC for the IBS interrupts if available */
442static void setup_ibs(void) 444static void ibs_init(void)
443{ 445{
444 ibs_allowed = boot_cpu_has(X86_FEATURE_IBS); 446 ibs_allowed = boot_cpu_has(X86_FEATURE_IBS);
445 447
446 if (!ibs_allowed) 448 if (!ibs_allowed)
447 return; 449 return;
448 450
449 if (pfm_amd64_setup_eilvt()) { 451 if (init_ibs_nmi()) {
450 ibs_allowed = 0; 452 ibs_allowed = 0;
451 return; 453 return;
452 } 454 }
@@ -454,12 +456,12 @@ static void setup_ibs(void)
454 printk(KERN_INFO "oprofile: AMD IBS detected\n"); 456 printk(KERN_INFO "oprofile: AMD IBS detected\n");
455} 457}
456 458
457 459static void ibs_exit(void)
458/* uninitialize the APIC for the IBS interrupts if needed */
459static void clear_ibs_nmi(void)
460{ 460{
461 if (ibs_allowed) 461 if (!ibs_allowed)
462 on_each_cpu(apic_clear_ibs_nmi_per_cpu, NULL, 1); 462 return;
463
464 clear_ibs_nmi();
463} 465}
464 466
465static int (*create_arch_files)(struct super_block *sb, struct dentry *root); 467static 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 511
510static int op_amd_init(struct oprofile_operations *ops) 512static int op_amd_init(struct oprofile_operations *ops)
511{ 513{
512 setup_ibs(); 514 ibs_init();
513 create_arch_files = ops->create_files; 515 create_arch_files = ops->create_files;
514 ops->create_files = setup_ibs_files; 516 ops->create_files = setup_ibs_files;
515 return 0; 517 return 0;
@@ -517,7 +519,7 @@ static int op_amd_init(struct oprofile_operations *ops)
517 519
518static void op_amd_exit(void) 520static void op_amd_exit(void)
519{ 521{
520 clear_ibs_nmi(); 522 ibs_exit();
521} 523}
522 524
523#else 525#else