From patchwork Thu Jul 16 00:12:15 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jordan Justen X-Patchwork-Id: 35795 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 n6G0CJnp014905 for ; Thu, 16 Jul 2009 00:12:19 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756520AbZGPAMS (ORCPT ); Wed, 15 Jul 2009 20:12:18 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756662AbZGPAMS (ORCPT ); Wed, 15 Jul 2009 20:12:18 -0400 Received: from mga14.intel.com ([143.182.124.37]:33968 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751043AbZGPAMR (ORCPT ); Wed, 15 Jul 2009 20:12:17 -0400 Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga102.ch.intel.com with ESMTP; 15 Jul 2009 17:12:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.42,407,1243839600"; d="scan'208";a="165508226" Received: from jljusten-desk2.jf.intel.com (HELO localhost.localdomain) ([134.134.19.133]) by azsmga001.ch.intel.com with ESMTP; 15 Jul 2009 17:12:15 -0700 From: Jordan Justen To: kvm-devel Cc: Jordan Justen Subject: [PATCH] Update qemu-kvm to allow a larger BIOS image. Date: Wed, 15 Jul 2009 17:12:15 -0700 Message-Id: <1247703135-27408-2-git-send-email-jordan.l.justen@intel.com> X-Mailer: git-send-email 1.6.0.4 In-Reply-To: <1247703135-27408-1-git-send-email-jordan.l.justen@intel.com> References: <1247703135-27408-1-git-send-email-jordan.l.justen@intel.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Previously the KVM kernel module would allocate the address range of 0xfffbc000-0xfffbcfff for the EPT Indentity Page Tables. A separate patch is moving that to 0xfeffc000-0xfeffcfff. This patch updates qemu-kvm to move the VMX TSS Pages & update the KVM BIOS code to update the E820 BIOS call memory reservations. Previously, the VMC TSS Pages were located at 0xfffbd000-0xfffbffff. This change moved them to 0xfeffd000-0xfeffffff. This change also updates the KVM bios such that the E820 locations are returned properly for these two changes. From a high level, these are the effects of these two changes: Previously, the KVM would only accommodate a 256KB BIOS image. With these changes, the BIOS image may now grow to 16MB. Motivation for making these changes: A larger firmware image size allows alternative BIOS images to be used with KVM. Some possible uses are to enable UEFI firmware or coreboot firmware. Additionally, an alternative firmware might include a linux kernel+initrd payload, which would require several megabytes. Signed-off-by: Jordan Justen --- kvm/bios/rombios.c | 8 ++++---- kvm/include/x86/asm/vmx.h | 2 +- qemu-kvm-x86.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/kvm/bios/rombios.c b/kvm/bios/rombios.c index 6186199..2d0c153 100644 --- a/kvm/bios/rombios.c +++ b/kvm/bios/rombios.c @@ -4596,14 +4596,14 @@ ASM_END case 5: /* 4 pages before the bios, 3 pages for vmx tss pages, * the other page for EPT real mode pagetable */ - set_e820_range(ES, regs.u.r16.di, 0xfffbc000L, - 0xfffc0000L, 0, 0, 2); + set_e820_range(ES, regs.u.r16.di, 0xfeffc000L, + 0xff000000L, 0, 0, 2); regs.u.r32.ebx = 6; break; case 6: - /* 256KB BIOS area at the end of 4 GB */ + /* 16MB BIOS area at the end of 4 GB */ set_e820_range(ES, regs.u.r16.di, - 0xfffc0000L, 0x00000000L ,0, 0, 2); + 0xff000000L, 0x00000000L ,0, 0, 2); if (extra_highbits_memory_size || extra_lowbits_memory_size) regs.u.r32.ebx = 7; else diff --git a/kvm/include/x86/asm/vmx.h b/kvm/include/x86/asm/vmx.h index df8d4f9..99e2bb9 100644 --- a/kvm/include/x86/asm/vmx.h +++ b/kvm/include/x86/asm/vmx.h @@ -403,7 +403,7 @@ enum vmcs_field { #define VMX_EPT_EXECUTABLE_MASK 0x4ull #define VMX_EPT_IGMT_BIT (1ull << 6) -#define VMX_EPT_IDENTITY_PAGETABLE_ADDR 0xfffbc000ul +#define VMX_EPT_IDENTITY_PAGETABLE_ADDR 0xfeffc000ul #define ASM_VMX_VMCLEAR_RAX ".byte 0x66, 0x0f, 0xc7, 0x30" diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c index daf60b6..b5306aa 100644 --- a/qemu-kvm-x86.c +++ b/qemu-kvm-x86.c @@ -63,7 +63,7 @@ static int kvm_init_tss(kvm_context_t kvm) * this address is 3 pages before the bios, and the bios should present * as unavaible memory */ - r = kvm_set_tss_addr(kvm, 0xfffbd000); + r = kvm_set_tss_addr(kvm, 0xfeffd000); if (r < 0) { fprintf(stderr, "kvm_init_tss: unable to set tss addr\n"); return r;