aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/hvm/vpmu.c
diff options
context:
space:
mode:
authorDietmar Hahn <dietmar.hahn@ts.fujitsu.com>2012-03-15 15:13:00 +0100
committerDietmar Hahn <dietmar.hahn@ts.fujitsu.com>2012-03-15 15:13:00 +0100
commit1a8aa75edc94f7129f8ae79276f934e04f21c03b (patch)
treec0e7c5aa4cf047b8b1eb5bfbc0e56eaffe166fe4 /xen/arch/x86/hvm/vpmu.c
parent3db3601531e994e8ec00d89a946829bfc7532723 (diff)
downloadxen-1a8aa75edc94f7129f8ae79276f934e04f21c03b.tar.gz
xen-1a8aa75edc94f7129f8ae79276f934e04f21c03b.tar.bz2
xen-1a8aa75edc94f7129f8ae79276f934e04f21c03b.zip
x86/vpmu: Add the BTS extension
Add the BTS functionality to the existing vpmu implementation for Intel CPUs. Signed-off-by: Dietmar Hahn <dietmar.hahn@ts.fujitsu.com> Committed-by: Jan Beulich <jbeulich@suse.com>
Diffstat (limited to 'xen/arch/x86/hvm/vpmu.c')
-rw-r--r--xen/arch/x86/hvm/vpmu.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/xen/arch/x86/hvm/vpmu.c b/xen/arch/x86/hvm/vpmu.c
index d260968994..e9a881bdce 100644
--- a/xen/arch/x86/hvm/vpmu.c
+++ b/xen/arch/x86/hvm/vpmu.c
@@ -32,8 +32,36 @@
#include <asm/hvm/svm/svm.h>
#include <asm/hvm/svm/vmcb.h>
-static bool_t __read_mostly opt_vpmu_enabled;
-boolean_param("vpmu", opt_vpmu_enabled);
+
+/*
+ * "vpmu" : vpmu generally enabled
+ * "vpmu=off" : vpmu generally disabled
+ * "vpmu=bts" : vpmu enabled and Intel BTS feature switched on.
+ */
+static unsigned int __read_mostly opt_vpmu_enabled;
+static void parse_vpmu_param(char *s);
+custom_param("vpmu", parse_vpmu_param);
+
+static void __init parse_vpmu_param(char *s)
+{
+ switch ( parse_bool(s) )
+ {
+ case 0:
+ break;
+ default:
+ if ( !strcmp(s, "bts") )
+ opt_vpmu_enabled |= VPMU_BOOT_BTS;
+ else if ( *s )
+ {
+ printk("VPMU: unknown flag: %s - vpmu disabled!\n", s);
+ break;
+ }
+ /* fall through */
+ case 1:
+ opt_vpmu_enabled |= VPMU_BOOT_ENABLED;
+ break;
+ }
+}
int vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content)
{
@@ -104,12 +132,12 @@ void vpmu_initialise(struct vcpu *v)
switch ( vendor )
{
case X86_VENDOR_AMD:
- if ( svm_vpmu_initialise(v) != 0 )
+ if ( svm_vpmu_initialise(v, opt_vpmu_enabled) != 0 )
opt_vpmu_enabled = 0;
break;
case X86_VENDOR_INTEL:
- if ( vmx_vpmu_initialise(v) != 0 )
+ if ( vmx_vpmu_initialise(v, opt_vpmu_enabled) != 0 )
opt_vpmu_enabled = 0;
break;