From patchwork Wed Jun 17 17:56:42 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 30947 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 n5HHviG7015963 for ; Wed, 17 Jun 2009 17:57:45 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755157AbZFQR5H (ORCPT ); Wed, 17 Jun 2009 13:57:07 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752749AbZFQR5G (ORCPT ); Wed, 17 Jun 2009 13:57:06 -0400 Received: from wa4ehsobe005.messaging.microsoft.com ([216.32.181.15]:24420 "EHLO WA4EHSOBE006.bigfish.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754645AbZFQR5B (ORCPT ); Wed, 17 Jun 2009 13:57:01 -0400 Received: from mail156-wa4-R.bigfish.com (10.8.14.254) by WA4EHSOBE006.bigfish.com (10.8.40.26) with Microsoft SMTP Server id 8.1.340.0; Wed, 17 Jun 2009 17:57:03 +0000 Received: from mail156-wa4 (localhost.localdomain [127.0.0.1]) by mail156-wa4-R.bigfish.com (Postfix) with ESMTP id 47B43260388; Wed, 17 Jun 2009 17:57:03 +0000 (UTC) X-SpamScore: 3 X-BigFish: VPS3(zzzz1202hzzz32i17ch43j63h) X-Spam-TCS-SCL: 2:0 X-FB-SS: 5, Received: by mail156-wa4 (MessageSwitch) id 1245261421735945_13697; Wed, 17 Jun 2009 17:57:01 +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 mail156-wa4.bigfish.com (Postfix) with ESMTP id 7F90171805F; Wed, 17 Jun 2009 17:57:01 +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 n5HHuqeo027113; Wed, 17 Jun 2009 12:56:55 -0500 X-WSS-ID: 0KLE9UM-01-5FT-01 Received: from sausexbh2.amd.com (SAUSEXBH2.amd.com [163.181.22.102]) by ausb3twp01.amd.com (Tumbleweed MailGate 3.5.1) with ESMTP id 202011943D1; Wed, 17 Jun 2009 12:56:45 -0500 (CDT) Received: from sausexmb2.amd.com ([163.181.3.157]) by sausexbh2.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 17 Jun 2009 12:56:55 -0500 Received: from SDRSEXMB1.amd.com ([172.20.3.116]) by sausexmb2.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 17 Jun 2009 12:56:55 -0500 Received: from seurexmb1.amd.com ([165.204.9.130]) by SDRSEXMB1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 17 Jun 2009 19:56:50 +0200 Received: from lemmy.amd.com ([165.204.15.93]) by seurexmb1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 17 Jun 2009 19:56:49 +0200 Received: by lemmy.amd.com (Postfix, from userid 41430) id 285D6C9E00; Wed, 17 Jun 2009 19:56:49 +0200 (CEST) From: Joerg Roedel To: Avi Kivity CC: kvm@vger.kernel.org, Joerg Roedel Subject: [PATCH 3/3] qemu-kvm: add support for gbpages to kvm userspace Date: Wed, 17 Jun 2009 19:56:42 +0200 Message-ID: <1245261402-26440-4-git-send-email-joerg.roedel@amd.com> X-Mailer: git-send-email 1.6.3.1 In-Reply-To: <1245261402-26440-1-git-send-email-joerg.roedel@amd.com> References: <1245261402-26440-1-git-send-email-joerg.roedel@amd.com> X-OriginalArrivalTime: 17 Jun 2009 17:56:49.0368 (UTC) FILETIME=[FCD2AD80:01C9EF74] MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org This patch adds a command line parameter to expose the gbpages cpuid bit to the guest if the kvm kernel module supports it. Signed-off-by: Joerg Roedel --- qemu-kvm.c | 1 + qemu-kvm.h | 1 + qemu-options.hx | 2 ++ target-i386/helper.c | 3 +++ vl.c | 4 ++++ 5 files changed, 11 insertions(+), 0 deletions(-) diff --git a/qemu-kvm.c b/qemu-kvm.c index 2aeb17c..01a889d 100644 --- a/qemu-kvm.c +++ b/qemu-kvm.c @@ -33,6 +33,7 @@ int kvm_irqchip = 1; int kvm_pit = 1; int kvm_pit_reinject = 1; int kvm_nested = 0; +int kvm_gbpages = 0; kvm_context_t kvm_context; pthread_mutex_t qemu_mutex = PTHREAD_MUTEX_INITIALIZER; diff --git a/qemu-kvm.h b/qemu-kvm.h index fa40542..fc06b96 100644 --- a/qemu-kvm.h +++ b/qemu-kvm.h @@ -151,6 +151,7 @@ extern int kvm_irqchip; extern int kvm_pit; extern int kvm_pit_reinject; extern int kvm_nested; +extern int kvm_gbpages; extern kvm_context_t kvm_context; struct ioperm_data { diff --git a/qemu-options.hx b/qemu-options.hx index edd99db..fe9e9d3 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1594,6 +1594,8 @@ DEF("pcidevice", HAS_ARG, QEMU_OPTION_pcidevice, #endif DEF("enable-nesting", 0, QEMU_OPTION_enable_nesting, "-enable-nesting enable support for running a VM inside the VM (AMD only)\n") +DEF("enable-gbpages", 0, QEMU_OPTION_enable_gbpages, + "-enable-gbpages enable support for 1GB pages in the guest (if supported)\n") DEF("nvram", HAS_ARG, QEMU_OPTION_nvram, "-nvram FILE provide ia64 nvram contents\n") DEF("tdf", 0, QEMU_OPTION_tdf, diff --git a/target-i386/helper.c b/target-i386/helper.c index 6dc0111..9fb2ae4 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -1607,6 +1607,9 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, *ecx &= ~4UL; /* 3dnow */ *edx &= ~0xc0000000; + /* enable gbpages and let kvm disable it if unsupported */ + if (kvm_gbpages) + *edx |= (1UL << 26UL); } break; case 0x80000002: diff --git a/vl.c b/vl.c index 845ed54..262ff1b 100644 --- a/vl.c +++ b/vl.c @@ -5621,6 +5621,10 @@ int main(int argc, char **argv, char **envp) kvm_nested = 1; break; } + case QEMU_OPTION_enable_gbpages: { + kvm_gbpages = 1; + break; + } #if defined(TARGET_I386) || defined(TARGET_X86_64) || defined(TARGET_IA64) || defined(__linux__) case QEMU_OPTION_pcidevice: if (assigned_devices_index >= MAX_DEV_ASSIGN_CMDLINE) {