From patchwork Wed Jul 1 07:22:27 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 33419 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n617NbO5023376 for ; Wed, 1 Jul 2009 07:23:37 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752556AbZGAHWt (ORCPT ); Wed, 1 Jul 2009 03:22:49 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752279AbZGAHWt (ORCPT ); Wed, 1 Jul 2009 03:22:49 -0400 Received: from sg2ehsobe002.messaging.microsoft.com ([207.46.51.76]:5007 "EHLO SG2EHSOBE002.bigfish.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752214AbZGAHWs (ORCPT ); Wed, 1 Jul 2009 03:22:48 -0400 Received: from mail226-sin-R.bigfish.com (10.210.100.240) by SG2EHSOBE002.bigfish.com (10.210.112.22) with Microsoft SMTP Server id 8.1.340.0; Wed, 1 Jul 2009 07:22:48 +0000 Received: from mail226-sin (localhost.localdomain [127.0.0.1]) by mail226-sin-R.bigfish.com (Postfix) with ESMTP id 0E2295F0103; Wed, 1 Jul 2009 07:22:51 +0000 (UTC) X-SpamScore: 3 X-BigFish: VPS3(zzzz1202hzzz32i43j61h) X-Spam-TCS-SCL: 0:0 Received: by mail226-sin (MessageSwitch) id 1246432969955878_2350; Wed, 1 Jul 2009 07:22:49 +0000 (UCT) Received: from ausb3extmailp01.amd.com (unknown [163.181.251.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail226-sin.bigfish.com (Postfix) with ESMTP id 637FC460057; Wed, 1 Jul 2009 07:22:49 +0000 (UTC) Received: from ausb3twp01.amd.com ([163.181.250.37]) by ausb3extmailp01.amd.com (Switch-3.2.7/Switch-3.2.7) with ESMTP id n617Mbnf002285; Wed, 1 Jul 2009 02:22:40 -0500 X-WSS-ID: 0KM3DTQ-01-KED-01 Received: from sausexbh1.amd.com (sausexbh1.amd.com [163.181.22.101]) by ausb3twp01.amd.com (Tumbleweed MailGate 3.5.1) with ESMTP id 213FC1943FB; Wed, 1 Jul 2009 02:22:38 -0500 (CDT) Received: from sausexmb5.amd.com ([163.181.49.129]) by sausexbh1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 1 Jul 2009 02:22:40 -0500 Received: from SDRSEXMB1.amd.com ([172.20.3.116]) by sausexmb5.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 1 Jul 2009 02:22:40 -0500 Received: from localhost.localdomain ([165.204.15.42]) by SDRSEXMB1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 1 Jul 2009 09:22:25 +0200 From: Andre Przywara To: avi@redhat.com CC: kvm@vger.kernel.org, Andre Przywara Subject: [PATCH] qemu-kvm: remove CPUID host hacks Date: Wed, 1 Jul 2009 09:22:27 +0200 Message-ID: <1246432947-8693-1-git-send-email-andre.przywara@amd.com> X-Mailer: git-send-email 1.6.1.3 X-OriginalArrivalTime: 01 Jul 2009 07:22:25.0222 (UTC) FILETIME=[AE9B6E60:01C9FA1C] MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.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 | 22 +--------------------- 1 files changed, 1 insertions(+), 21 deletions(-) This is a rebased version of the qemu.git patch, which caused merge conflicts. Please apply! Regards, Andre. diff --git a/target-i386/helper.c b/target-i386/helper.c index d76c224..30e1d77 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -1645,29 +1645,9 @@ 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 */ + /* disable nested svm if not explicitly requested */ if (!kvm_nested) *ecx &= ~CPUID_EXT3_SVM; - /* 3dnow */ - *edx &= ~0xc0000000; } else { /* AMD 3DNow! is not supported in QEMU */ *edx &= ~(CPUID_EXT2_3DNOW | CPUID_EXT2_3DNOWEXT);