1 /******************************************************************************
2  * xenoprof.h
3  *
4  * Xenoprof: Xenoprof enables performance profiling in Xen
5  *
6  * Copyright (C) 2005 Hewlett-Packard Co.
7  * written by Aravind Menon & Jose Renato Santos
8  */
9 
10 #ifndef __XEN_XENOPROF_H__
11 #define __XEN_XENOPROF_H__
12 
13 #include <xen/inttypes.h>
14 #include <asm/xenoprof.h>
15 
16 #define PMU_OWNER_NONE          0
17 #define PMU_OWNER_XENOPROF      1
18 #define PMU_OWNER_HVM           2
19 
20 #ifdef CONFIG_XENOPROF
21 
22 struct domain;
23 struct vcpu;
24 struct cpu_user_regs;
25 
26 int acquire_pmu_ownership(int pmu_ownership);
27 void release_pmu_ownership(int pmu_ownership);
28 
29 int is_active(struct domain *d);
30 int is_passive(struct domain *d);
31 void free_xenoprof_pages(struct domain *d);
32 
33 int xenoprof_add_trace(struct vcpu *, uint64_t pc, int mode);
34 
35 void xenoprof_log_event(struct vcpu *, const struct cpu_user_regs *,
36                         uint64_t pc, int mode, int event);
37 
38 #else
acquire_pmu_ownership(int pmu_ownership)39 static inline int acquire_pmu_ownership(int pmu_ownership)
40 {
41     return 1;
42 }
43 
release_pmu_ownership(int pmu_ownership)44 static inline void release_pmu_ownership(int pmu_ownership)
45 {
46 }
47 #endif /* CONFIG_XENOPROF */
48 
49 #endif  /* __XEN__XENOPROF_H__ */
50