From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:41070) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rb8nO-0005ZM-KM for qemu-devel@nongnu.org; Thu, 15 Dec 2011 05:44:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rb8nI-0001e9-W1 for qemu-devel@nongnu.org; Thu, 15 Dec 2011 05:44:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35091) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rb8nI-0001du-Gx for qemu-devel@nongnu.org; Thu, 15 Dec 2011 05:44:08 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id pBFAi6Qk012373 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 15 Dec 2011 05:44:07 -0500 Received: from dhcp-1-237.tlv.redhat.com (dhcp-4-26.tlv.redhat.com [10.35.4.26]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id pBFAi5As009368 for ; Thu, 15 Dec 2011 05:44:06 -0500 Date: Thu, 15 Dec 2011 12:44:05 +0200 From: Gleb Natapov Message-ID: <20111215104405.GD21664@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [PATCH] enable architectural PMU cpuid leaf for kvm List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Signed-off-by: Gleb Natapov diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c index 0b3af90..91a104b 100644 --- a/target-i386/cpuid.c +++ b/target-i386/cpuid.c @@ -1180,10 +1180,19 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, break; case 0xA: /* Architectural Performance Monitoring Leaf */ - *eax = 0; - *ebx = 0; - *ecx = 0; - *edx = 0; + if (kvm_enabled()) { + KVMState *s = env->kvm_state; + + *eax = kvm_arch_get_supported_cpuid(s, 0xA, count, R_EAX); + *ebx = kvm_arch_get_supported_cpuid(s, 0xA, count, R_EBX); + *ecx = kvm_arch_get_supported_cpuid(s, 0xA, count, R_ECX); + *edx = kvm_arch_get_supported_cpuid(s, 0xA, count, R_EDX); + } else { + *eax = 0; + *ebx = 0; + *ecx = 0; + *edx = 0; + } break; case 0xD: /* Processor Extended State */ -- Gleb.