Allow Xenoprof to be fully disabled when toggling the option off.
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
subdir-y += genapic
subdir-y += hvm
subdir-y += mm
-subdir-y += oprofile
+subdir-$(xenoprof) += oprofile
subdir-y += x86_64
obj-bin-y += alternative.init.o
CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-default
CFLAGS += '-D__OBJECT_LABEL__=$(subst /,$$,$(subst -,_,$(subst $(BASEDIR)/,,$(CURDIR))/$@))'
+CFLAGS-$(xenoprof) += -DCONFIG_XENOPROF
+
# Prevent floating-point variables from creeping into Xen.
CFLAGS += -msoft-float
#define compat_kexec_op do_ni_hypercall
#endif
+#ifndef CONFIG_XENOPROF
+#define compat_xenoprof_op do_ni_hypercall
+#endif
+
ENTRY(compat_hypercall_table)
.quad compat_set_trap_table /* 0 */
.quad do_mmu_update
#define do_kexec_op do_ni_hypercall
#endif
+#ifndef CONFIG_XENOPROF
+#define do_xenoprof_op do_ni_hypercall
+#endif
+
ENTRY(hypercall_table)
.quad do_set_trap_table /* 0 */
.quad do_mmu_update
#define CONFIG_VGA 1
#define CONFIG_VIDEO 1
-#define CONFIG_XENOPROF 1
#define CONFIG_WATCHDOG 1
#define CONFIG_MULTIBOOT 1
#ifndef __ASM_X86_XENOPROF_H__
#define __ASM_X86_XENOPROF_H__
+#ifdef CONFIG_XENOPROF
+
int nmi_reserve_counters(void);
int nmi_setup_events(void);
int nmi_enable_virq(void);
"xenoprof/x86 with autotranslated mode enabled" \
"isn't supported yet\n"); \
} while (0)
+
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);
+#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) {}
+
+#endif /* CONFIG_XENOPROF */
+
#endif /* __ASM_X86_XENOPROF_H__ */
/*
#include <public/xenoprof.h>
#include <asm/xenoprof.h>
+#define PMU_OWNER_NONE 0
+#define PMU_OWNER_XENOPROF 1
+#define PMU_OWNER_HVM 2
+
+#ifdef CONFIG_XENOPROF
+
#define XENOPROF_DOMAIN_IGNORED 0
#define XENOPROF_DOMAIN_ACTIVE 1
#define XENOPROF_DOMAIN_PASSIVE 2
#endif
struct domain;
+
+int acquire_pmu_ownership(int pmu_ownership);
+void release_pmu_ownership(int pmu_ownership);
+
int is_active(struct domain *d);
int is_passive(struct domain *d);
void free_xenoprof_pages(struct domain *d);
int xenoprof_add_trace(struct vcpu *, uint64_t pc, int mode);
-#define PMU_OWNER_NONE 0
-#define PMU_OWNER_XENOPROF 1
-#define PMU_OWNER_HVM 2
-int acquire_pmu_ownership(int pmu_ownership);
-void release_pmu_ownership(int pmu_ownership);
-
void xenoprof_log_event(struct vcpu *, const struct cpu_user_regs *,
uint64_t pc, int mode, int event);
+#else
+static inline int acquire_pmu_ownership(int pmu_ownership)
+{
+ return 1;
+}
+
+static inline void release_pmu_ownership(int pmu_ownership)
+{
+}
+#endif /* CONFIG_XENOPROF */
+
#endif /* __XEN__XENOPROF_H__ */