diff options
Diffstat (limited to 'arch/x86/oprofile/nmi_int.c')
-rw-r--r-- | arch/x86/oprofile/nmi_int.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c index c31f87bbf436..388ee15e0e42 100644 --- a/arch/x86/oprofile/nmi_int.c +++ b/arch/x86/oprofile/nmi_int.c | |||
@@ -31,6 +31,26 @@ static DEFINE_PER_CPU(unsigned long, saved_lvtpc); | |||
31 | /* 0 == registered but off, 1 == registered and on */ | 31 | /* 0 == registered but off, 1 == registered and on */ |
32 | static int nmi_enabled = 0; | 32 | static int nmi_enabled = 0; |
33 | 33 | ||
34 | /* common functions */ | ||
35 | |||
36 | u64 op_x86_get_ctrl(struct op_x86_model_spec const *model, | ||
37 | struct op_counter_config *counter_config) | ||
38 | { | ||
39 | u64 val = 0; | ||
40 | u16 event = (u16)counter_config->event; | ||
41 | |||
42 | val |= ARCH_PERFMON_EVENTSEL_INT; | ||
43 | val |= counter_config->user ? ARCH_PERFMON_EVENTSEL_USR : 0; | ||
44 | val |= counter_config->kernel ? ARCH_PERFMON_EVENTSEL_OS : 0; | ||
45 | val |= (counter_config->unit_mask & 0xFF) << 8; | ||
46 | event &= model->event_mask ? model->event_mask : 0xFF; | ||
47 | val |= event & 0xFF; | ||
48 | val |= (event & 0x0F00) << 24; | ||
49 | |||
50 | return val; | ||
51 | } | ||
52 | |||
53 | |||
34 | static int profile_exceptions_notify(struct notifier_block *self, | 54 | static int profile_exceptions_notify(struct notifier_block *self, |
35 | unsigned long val, void *data) | 55 | unsigned long val, void *data) |
36 | { | 56 | { |