summaryrefslogtreecommitdiff
path: root/xen/include/asm-x86/xenoprof.h
blob: cf6af8c5df525c6925df9eeaae4be52738d21fee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/******************************************************************************
 * asm-x86/xenoprof.h
 * xenoprof x86 arch specific header file
 *
 * Copyright (c) 2006 Isaku Yamahata <yamahata at valinux co jp>
 *                    VA Linux Systems Japan K.K.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef __ASM_X86_XENOPROF_H__
#define __ASM_X86_XENOPROF_H__

struct vcpu;

#ifdef CONFIG_XENOPROF

#include <public/xen.h>

int nmi_reserve_counters(void);
int nmi_setup_events(void);
int nmi_enable_virq(void);
int nmi_start(void);
void nmi_stop(void);
void nmi_disable_virq(void);
void nmi_release_counters(void);

int xenoprof_arch_init(int *num_events, char *cpu_type);
#define xenoprof_arch_reserve_counters()        nmi_reserve_counters()
#define xenoprof_arch_setup_events()            nmi_setup_events()
#define xenoprof_arch_enable_virq()             nmi_enable_virq()
#define xenoprof_arch_start()                   nmi_start()
#define xenoprof_arch_stop()                    nmi_stop()
#define xenoprof_arch_disable_virq()            nmi_disable_virq()
#define xenoprof_arch_release_counters()        nmi_release_counters()

int xenoprof_arch_counter(XEN_GUEST_HANDLE_PARAM(void) arg);
int compat_oprof_arch_counter(XEN_GUEST_HANDLE_PARAM(void) arg);
int xenoprof_arch_ibs_counter(XEN_GUEST_HANDLE_PARAM(void) arg);

struct cpu_user_regs;

/* AMD IBS support */
void ibs_init(void);
extern u32 ibs_caps;

int xenoprofile_get_mode(struct vcpu *, const struct cpu_user_regs *);

static inline int xenoprof_backtrace_supported(void)
{
    return 1;
}

void xenoprof_backtrace(struct vcpu *, const struct cpu_user_regs *,
                        unsigned long depth, int mode);

int passive_domain_do_rdmsr(unsigned int msr, uint64_t *msr_content);
int passive_domain_do_wrmsr(unsigned int msr, uint64_t msr_content);
void passive_domain_destroy(struct vcpu *v);

bool nmi_oprofile_send_virq(void);

#else

static inline int passive_domain_do_rdmsr(unsigned int msr,
                                          uint64_t *msr_content)
{
    return 0;
}

static inline int passive_domain_do_wrmsr(unsigned int msr,
                                          uint64_t msr_content)
{
    return 0;
}

static inline void passive_domain_destroy(struct vcpu *v) {}

static inline bool nmi_oprofile_send_virq(void)
{
    return false;
}

#endif /* CONFIG_XENOPROF */

#endif /* __ASM_X86_XENOPROF_H__ */

/*
 * Local variables:
 * mode: C
 * c-file-style: "BSD"
 * c-basic-offset: 4
 * tab-width: 4
 * indent-tabs-mode: nil
 * End:
 */