aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/oprofile/op_model_amd.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/arch/x86/oprofile/op_model_amd.c b/arch/x86/oprofile/op_model_amd.c
index c5b5c7fb3ce..423a95438cb 100644
--- a/arch/x86/oprofile/op_model_amd.c
+++ b/arch/x86/oprofile/op_model_amd.c
@@ -106,7 +106,7 @@ struct ibs_op_sample {
106 unsigned int ibs_dc_phys_high; 106 unsigned int ibs_dc_phys_high;
107}; 107};
108 108
109static int ibs_allowed; /* AMD Family10h and later */ 109static int has_ibs; /* AMD Family10h and later */
110 110
111struct op_ibs_config { 111struct op_ibs_config {
112 unsigned long op_enabled; 112 unsigned long op_enabled;
@@ -201,7 +201,7 @@ op_amd_handle_ibs(struct pt_regs * const regs,
201 struct ibs_fetch_sample ibs_fetch; 201 struct ibs_fetch_sample ibs_fetch;
202 struct ibs_op_sample ibs_op; 202 struct ibs_op_sample ibs_op;
203 203
204 if (!ibs_allowed) 204 if (!has_ibs)
205 return 1; 205 return 1;
206 206
207 if (ibs_config.fetch_enabled) { 207 if (ibs_config.fetch_enabled) {
@@ -305,14 +305,14 @@ static void op_amd_start(struct op_msrs const * const msrs)
305 } 305 }
306 306
307#ifdef CONFIG_OPROFILE_IBS 307#ifdef CONFIG_OPROFILE_IBS
308 if (ibs_allowed && ibs_config.fetch_enabled) { 308 if (has_ibs && ibs_config.fetch_enabled) {
309 low = (ibs_config.max_cnt_fetch >> 4) & 0xFFFF; 309 low = (ibs_config.max_cnt_fetch >> 4) & 0xFFFF;
310 high = ((ibs_config.rand_en & 0x1) << 25) /* bit 57 */ 310 high = ((ibs_config.rand_en & 0x1) << 25) /* bit 57 */
311 + IBS_FETCH_HIGH_ENABLE; 311 + IBS_FETCH_HIGH_ENABLE;
312 wrmsr(MSR_AMD64_IBSFETCHCTL, low, high); 312 wrmsr(MSR_AMD64_IBSFETCHCTL, low, high);
313 } 313 }
314 314
315 if (ibs_allowed && ibs_config.op_enabled) { 315 if (has_ibs && ibs_config.op_enabled) {
316 low = ((ibs_config.max_cnt_op >> 4) & 0xFFFF) 316 low = ((ibs_config.max_cnt_op >> 4) & 0xFFFF)
317 + ((ibs_config.dispatched_ops & 0x1) << 19) /* bit 19 */ 317 + ((ibs_config.dispatched_ops & 0x1) << 19) /* bit 19 */
318 + IBS_OP_LOW_ENABLE; 318 + IBS_OP_LOW_ENABLE;
@@ -341,14 +341,14 @@ static void op_amd_stop(struct op_msrs const * const msrs)
341 } 341 }
342 342
343#ifdef CONFIG_OPROFILE_IBS 343#ifdef CONFIG_OPROFILE_IBS
344 if (ibs_allowed && ibs_config.fetch_enabled) { 344 if (has_ibs && ibs_config.fetch_enabled) {
345 /* clear max count and enable */ 345 /* clear max count and enable */
346 low = 0; 346 low = 0;
347 high = 0; 347 high = 0;
348 wrmsr(MSR_AMD64_IBSFETCHCTL, low, high); 348 wrmsr(MSR_AMD64_IBSFETCHCTL, low, high);
349 } 349 }
350 350
351 if (ibs_allowed && ibs_config.op_enabled) { 351 if (has_ibs && ibs_config.op_enabled) {
352 /* clear max count and enable */ 352 /* clear max count and enable */
353 low = 0; 353 low = 0;
354 high = 0; 354 high = 0;
@@ -437,20 +437,20 @@ static int init_ibs_nmi(void)
437/* uninitialize the APIC for the IBS interrupts if needed */ 437/* uninitialize the APIC for the IBS interrupts if needed */
438static void clear_ibs_nmi(void) 438static void clear_ibs_nmi(void)
439{ 439{
440 if (ibs_allowed) 440 if (has_ibs)
441 on_each_cpu(apic_clear_ibs_nmi_per_cpu, NULL, 1); 441 on_each_cpu(apic_clear_ibs_nmi_per_cpu, NULL, 1);
442} 442}
443 443
444/* initialize the APIC for the IBS interrupts if available */ 444/* initialize the APIC for the IBS interrupts if available */
445static void ibs_init(void) 445static void ibs_init(void)
446{ 446{
447 ibs_allowed = boot_cpu_has(X86_FEATURE_IBS); 447 has_ibs = boot_cpu_has(X86_FEATURE_IBS);
448 448
449 if (!ibs_allowed) 449 if (!has_ibs)
450 return; 450 return;
451 451
452 if (init_ibs_nmi()) { 452 if (init_ibs_nmi()) {
453 ibs_allowed = 0; 453 has_ibs = 0;
454 return; 454 return;
455 } 455 }
456 456
@@ -459,7 +459,7 @@ static void ibs_init(void)
459 459
460static void ibs_exit(void) 460static void ibs_exit(void)
461{ 461{
462 if (!ibs_allowed) 462 if (!has_ibs)
463 return; 463 return;
464 464
465 clear_ibs_nmi(); 465 clear_ibs_nmi();
@@ -479,7 +479,7 @@ static int setup_ibs_files(struct super_block *sb, struct dentry *root)
479 if (ret) 479 if (ret)
480 return ret; 480 return ret;
481 481
482 if (!ibs_allowed) 482 if (!has_ibs)
483 return ret; 483 return ret;
484 484
485 /* model specific files */ 485 /* model specific files */