aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/hvm/svm
diff options
context:
space:
mode:
authorDietmar Hahn <dietmar.hahn@ts.fujitsu.com>2013-03-26 14:24:25 +0100
committerJan Beulich <jbeulich@suse.com>2013-03-26 14:24:25 +0100
commit25250ed7c8094a905c5f03b8ae25c8694d3fa9b3 (patch)
treedadd1ea3edda3aa7e14b5113f09dd7890b8fd005 /xen/arch/x86/hvm/svm
parentdb537fe3023bf157b85c8246782cb72a6f989b31 (diff)
downloadxen-25250ed7c8094a905c5f03b8ae25c8694d3fa9b3.tar.gz
xen-25250ed7c8094a905c5f03b8ae25c8694d3fa9b3.tar.bz2
xen-25250ed7c8094a905c5f03b8ae25c8694d3fa9b3.zip
vpmu intel: Add cpuid handling when vpmu disabled
Even though vpmu is disabled in the hypervisor in the HVM guest the call of cpuid(0xa) returns informations about usable performance counters. This may confuse guest software when trying to use the counters and nothing happens. This patch clears most bits in registers eax and edx of cpuid(0xa) instruction for the guest when vpmu is disabled: - version ID of architectural performance counting - number of general pmu registers - width of general pmu registers - number of fixed pmu registers - width of ixed pmu registers Signed-off-by: Dietmar Hahn <dietmar.hahn@ts.fujitsu.com> Acked-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/arch/x86/hvm/svm')
-rw-r--r--xen/arch/x86/hvm/svm/vpmu.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/xen/arch/x86/hvm/svm/vpmu.c b/xen/arch/x86/hvm/svm/vpmu.c
index bf186fea3d..16170da3c8 100644
--- a/xen/arch/x86/hvm/svm/vpmu.c
+++ b/xen/arch/x86/hvm/svm/vpmu.c
@@ -370,6 +370,10 @@ int svm_vpmu_initialise(struct vcpu *v, unsigned int vpmu_flags)
uint8_t family = current_cpu_data.x86;
int ret = 0;
+ /* vpmu enabled? */
+ if ( !vpmu_flags )
+ return 0;
+
switch ( family )
{
case 0x10: