diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/oprofile/op_model_amd.c | 59 |
1 files changed, 38 insertions, 21 deletions
diff --git a/arch/x86/oprofile/op_model_amd.c b/arch/x86/oprofile/op_model_amd.c index b67a6b5aa8d4..96852d5480e0 100644 --- a/arch/x86/oprofile/op_model_amd.c +++ b/arch/x86/oprofile/op_model_amd.c | |||
@@ -70,9 +70,22 @@ static u64 ibs_op_ctl; | |||
70 | * Same bit mask as for IBS cpuid feature flags (Fn8000_001B_EAX), but | 70 | * Same bit mask as for IBS cpuid feature flags (Fn8000_001B_EAX), but |
71 | * bit 0 is used to indicate the existence of IBS. | 71 | * bit 0 is used to indicate the existence of IBS. |
72 | */ | 72 | */ |
73 | #define IBS_CAPS_AVAIL (1LL<<0) | 73 | #define IBS_CAPS_AVAIL (1U<<0) |
74 | #define IBS_CAPS_RDWROPCNT (1LL<<3) | 74 | #define IBS_CAPS_FETCHSAM (1U<<1) |
75 | #define IBS_CAPS_OPCNT (1LL<<4) | 75 | #define IBS_CAPS_OPSAM (1U<<2) |
76 | #define IBS_CAPS_RDWROPCNT (1U<<3) | ||
77 | #define IBS_CAPS_OPCNT (1U<<4) | ||
78 | |||
79 | #define IBS_CAPS_DEFAULT (IBS_CAPS_AVAIL \ | ||
80 | | IBS_CAPS_FETCHSAM \ | ||
81 | | IBS_CAPS_OPSAM) | ||
82 | |||
83 | /* | ||
84 | * IBS APIC setup | ||
85 | */ | ||
86 | #define IBSCTL 0x1cc | ||
87 | #define IBSCTL_LVT_OFFSET_VALID (1ULL<<8) | ||
88 | #define IBSCTL_LVT_OFFSET_MASK 0x0F | ||
76 | 89 | ||
77 | /* | 90 | /* |
78 | * IBS randomization macros | 91 | * IBS randomization macros |
@@ -92,12 +105,12 @@ static u32 get_ibs_caps(void) | |||
92 | /* check IBS cpuid feature flags */ | 105 | /* check IBS cpuid feature flags */ |
93 | max_level = cpuid_eax(0x80000000); | 106 | max_level = cpuid_eax(0x80000000); |
94 | if (max_level < IBS_CPUID_FEATURES) | 107 | if (max_level < IBS_CPUID_FEATURES) |
95 | return IBS_CAPS_AVAIL; | 108 | return IBS_CAPS_DEFAULT; |
96 | 109 | ||
97 | ibs_caps = cpuid_eax(IBS_CPUID_FEATURES); | 110 | ibs_caps = cpuid_eax(IBS_CPUID_FEATURES); |
98 | if (!(ibs_caps & IBS_CAPS_AVAIL)) | 111 | if (!(ibs_caps & IBS_CAPS_AVAIL)) |
99 | /* cpuid flags not valid */ | 112 | /* cpuid flags not valid */ |
100 | return IBS_CAPS_AVAIL; | 113 | return IBS_CAPS_DEFAULT; |
101 | 114 | ||
102 | return ibs_caps; | 115 | return ibs_caps; |
103 | } | 116 | } |
@@ -527,22 +540,26 @@ static int setup_ibs_files(struct super_block *sb, struct dentry *root) | |||
527 | ibs_config.op_enabled = 0; | 540 | ibs_config.op_enabled = 0; |
528 | ibs_config.dispatched_ops = 0; | 541 | ibs_config.dispatched_ops = 0; |
529 | 542 | ||
530 | dir = oprofilefs_mkdir(sb, root, "ibs_fetch"); | 543 | if (ibs_caps & IBS_CAPS_FETCHSAM) { |
531 | oprofilefs_create_ulong(sb, dir, "enable", | 544 | dir = oprofilefs_mkdir(sb, root, "ibs_fetch"); |
532 | &ibs_config.fetch_enabled); | 545 | oprofilefs_create_ulong(sb, dir, "enable", |
533 | oprofilefs_create_ulong(sb, dir, "max_count", | 546 | &ibs_config.fetch_enabled); |
534 | &ibs_config.max_cnt_fetch); | 547 | oprofilefs_create_ulong(sb, dir, "max_count", |
535 | oprofilefs_create_ulong(sb, dir, "rand_enable", | 548 | &ibs_config.max_cnt_fetch); |
536 | &ibs_config.rand_en); | 549 | oprofilefs_create_ulong(sb, dir, "rand_enable", |
537 | 550 | &ibs_config.rand_en); | |
538 | dir = oprofilefs_mkdir(sb, root, "ibs_op"); | 551 | } |
539 | oprofilefs_create_ulong(sb, dir, "enable", | 552 | |
540 | &ibs_config.op_enabled); | 553 | if (ibs_caps & IBS_CAPS_OPSAM) { |
541 | oprofilefs_create_ulong(sb, dir, "max_count", | 554 | dir = oprofilefs_mkdir(sb, root, "ibs_op"); |
542 | &ibs_config.max_cnt_op); | 555 | oprofilefs_create_ulong(sb, dir, "enable", |
543 | if (ibs_caps & IBS_CAPS_OPCNT) | 556 | &ibs_config.op_enabled); |
544 | oprofilefs_create_ulong(sb, dir, "dispatched_ops", | 557 | oprofilefs_create_ulong(sb, dir, "max_count", |
545 | &ibs_config.dispatched_ops); | 558 | &ibs_config.max_cnt_op); |
559 | if (ibs_caps & IBS_CAPS_OPCNT) | ||
560 | oprofilefs_create_ulong(sb, dir, "dispatched_ops", | ||
561 | &ibs_config.dispatched_ops); | ||
562 | } | ||
546 | 563 | ||
547 | return 0; | 564 | return 0; |
548 | } | 565 | } |