Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MJaaX-00017u-FA for qemu-devel@nongnu.org; Wed, 24 Jun 2009 18:05:05 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MJaaR-00011b-LM for qemu-devel@nongnu.org; Wed, 24 Jun 2009 18:05:04 -0400 Received: from [199.232.76.173] (port=34215 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MJaaR-00011K-D2 for qemu-devel@nongnu.org; Wed, 24 Jun 2009 18:04:59 -0400 Received: from outbound-dub.frontbridge.com ([213.199.154.16]:40606 helo=IE1EHSOBE003.bigfish.com) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_ARCFOUR_MD5:16) (Exim 4.60) (envelope-from ) id 1MJaaQ-0001yU-Rp for qemu-devel@nongnu.org; Wed, 24 Jun 2009 18:04:59 -0400 From: Andre Przywara Date: Thu, 25 Jun 2009 00:08:03 +0200 Message-ID: <1245881284-3656-6-git-send-email-andre.przywara@amd.com> In-Reply-To: <1245881284-3656-1-git-send-email-andre.przywara@amd.com> References: <1245881284-3656-1-git-send-email-andre.przywara@amd.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH 5/6] remove CPUID host hacks List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: avi@redhat.com, aliguori@us.ibm.com Cc: Andre Przywara , qemu-devel@nongnu.org KVM provides an in-kernel feature to disable CPUID bits that are not present in the current host. So there is no need here to duplicate this work. Additionally allows 3DNow! on capable processors, since the restriction seems to apply to QEMU/TCG only. Signed-off-by: Andre Przywara --- target-i386/helper.c | 27 +++++---------------------- 1 files changed, 5 insertions(+), 22 deletions(-) diff --git a/target-i386/helper.c b/target-i386/helper.c index 2e77570..bcaaab7 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -1643,28 +1643,11 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, *edx = env->cpuid_ext2_features; if (kvm_enabled()) { - uint32_t h_eax, h_edx; - - host_cpuid(index, 0, &h_eax, NULL, NULL, &h_edx); - - /* disable CPU features that the host does not support */ - - /* long mode */ - if ((h_edx & 0x20000000) == 0 /* || !lm_capable_kernel */) - *edx &= ~0x20000000; - /* syscall */ - if ((h_edx & 0x00000800) == 0) - *edx &= ~0x00000800; - /* nx */ - if ((h_edx & 0x00100000) == 0) - *edx &= ~0x00100000; - - /* disable CPU features that KVM cannot support */ - - /* svm */ - *ecx &= ~4UL; - /* 3dnow */ - *edx &= ~0xc0000000; + /* Nested SVM not yet supported in KVM */ + *ecx &= ~CPUID_EXT3_SVM; + } else { + /* AMD 3DNow! is not supported in QEMU */ + *edx &= ~(CPUID_EXT2_3DNOW | CPUID_EXT2_3DNOWEXT); } break; case 0x80000002: -- 1.6.1.3