1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /******************************************************************************
3 * asm-x86/xenoprof.h
4 * xenoprof x86 arch specific header file
5 *
6 * Copyright (c) 2006 Isaku Yamahata <yamahata at valinux co jp>
7 * VA Linux Systems Japan K.K.
8 */
9
10 #ifndef __ASM_X86_XENOPROF_H__
11 #define __ASM_X86_XENOPROF_H__
12
13 struct vcpu;
14
15 #ifdef CONFIG_XENOPROF
16
17 #include <public/xen.h>
18
19 int nmi_reserve_counters(void);
20 int nmi_setup_events(void);
21 int nmi_enable_virq(void);
22 int nmi_start(void);
23 void nmi_stop(void);
24 void nmi_disable_virq(void);
25 void nmi_release_counters(void);
26
27 int xenoprof_arch_init(int *num_events, char *cpu_type);
28 #define xenoprof_arch_reserve_counters() nmi_reserve_counters()
29 #define xenoprof_arch_setup_events() nmi_setup_events()
30 #define xenoprof_arch_enable_virq() nmi_enable_virq()
31 #define xenoprof_arch_start() nmi_start()
32 #define xenoprof_arch_stop() nmi_stop()
33 #define xenoprof_arch_disable_virq() nmi_disable_virq()
34 #define xenoprof_arch_release_counters() nmi_release_counters()
35
36 int xenoprof_arch_counter(XEN_GUEST_HANDLE_PARAM(void) arg);
37 int compat_oprof_arch_counter(XEN_GUEST_HANDLE_PARAM(void) arg);
38 int xenoprof_arch_ibs_counter(XEN_GUEST_HANDLE_PARAM(void) arg);
39
40 struct cpu_user_regs;
41
42 /* AMD IBS support */
43 void ibs_init(void);
44 extern u32 ibs_caps;
45
46 int xenoprofile_get_mode(struct vcpu *, const struct cpu_user_regs *);
47
xenoprof_backtrace_supported(void)48 static inline int xenoprof_backtrace_supported(void)
49 {
50 return 1;
51 }
52
53 void xenoprof_backtrace(struct vcpu *, const struct cpu_user_regs *,
54 unsigned long depth, int mode);
55
56 int passive_domain_do_rdmsr(unsigned int msr, uint64_t *msr_content);
57 int passive_domain_do_wrmsr(unsigned int msr, uint64_t msr_content);
58 void passive_domain_destroy(struct vcpu *v);
59
60 bool nmi_oprofile_send_virq(void);
61
62 #else
63
passive_domain_do_rdmsr(unsigned int msr,uint64_t * msr_content)64 static inline int passive_domain_do_rdmsr(unsigned int msr,
65 uint64_t *msr_content)
66 {
67 return 0;
68 }
69
passive_domain_do_wrmsr(unsigned int msr,uint64_t msr_content)70 static inline int passive_domain_do_wrmsr(unsigned int msr,
71 uint64_t msr_content)
72 {
73 return 0;
74 }
75
passive_domain_destroy(struct vcpu * v)76 static inline void passive_domain_destroy(struct vcpu *v) {}
77
nmi_oprofile_send_virq(void)78 static inline bool nmi_oprofile_send_virq(void)
79 {
80 return false;
81 }
82
83 #endif /* CONFIG_XENOPROF */
84
85 #endif /* __ASM_X86_XENOPROF_H__ */
86
87 /*
88 * Local variables:
89 * mode: C
90 * c-file-style: "BSD"
91 * c-basic-offset: 4
92 * tab-width: 4
93 * indent-tabs-mode: nil
94 * End:
95 */
96