From patchwork Mon Jan 25 16:52:35 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jes Sorensen X-Patchwork-Id: 43680 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E1B6EB7CC1 for ; Tue, 26 Jan 2010 15:43:28 +1100 (EST) Received: from localhost ([127.0.0.1]:37835 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NZdCt-0003zb-Ao for incoming@patchwork.ozlabs.org; Mon, 25 Jan 2010 23:39:15 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NZSBB-00023i-MZ for qemu-devel@nongnu.org; Mon, 25 Jan 2010 11:52:45 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NZSB7-0001xb-Tg for qemu-devel@nongnu.org; Mon, 25 Jan 2010 11:52:45 -0500 Received: from [199.232.76.173] (port=46483 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NZSB7-0001xN-PQ for qemu-devel@nongnu.org; Mon, 25 Jan 2010 11:52:41 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50099) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NZSB7-00069d-BY for qemu-devel@nongnu.org; Mon, 25 Jan 2010 11:52:41 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o0PGqcLA028016 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 25 Jan 2010 11:52:39 -0500 Received: from [10.36.8.164] (vpn2-8-164.ams2.redhat.com [10.36.8.164]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o0PGqaRl022699; Mon, 25 Jan 2010 11:52:37 -0500 Message-ID: <4B5DCC53.508@redhat.com> Date: Mon, 25 Jan 2010 17:52:35 +0100 From: Jes Sorensen User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.5) Gecko/20091209 Fedora/3.0-4.fc12 Lightning/1.0pre Thunderbird/3.0 MIME-Version: 1.0 To: qemu-devel@nongnu.org References: <4B5DCAF2.3010105@redhat.com> <4B5DCB93.7050007@redhat.com> In-Reply-To: <4B5DCB93.7050007@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. X-Mailman-Approved-At: Mon, 25 Jan 2010 23:24:35 -0500 Cc: Anthony Liguori , Kevin O'Connor , Avi Kivity , kvm@vger.kernel.org Subject: [Qemu-devel] [PATCH] QEMU - provide e820 reserve through qemu_cfg X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Hi, This is the QEMU patch for providing the e820-reserve space through qemu-cfg. Cheers, Jes Use qemu-cfg to notify the BIOS of the location of the TSS range to reserve in the e820 table, to avoid relying on hard coded values. Signed-off-by: Jes Sorensen --- hw/pc.c | 5 +++++ kvm.h | 7 +++++++ target-i386/kvm.c | 5 +++++ 3 files changed, 17 insertions(+) Index: qemu/hw/pc.c =================================================================== --- qemu.orig/hw/pc.c +++ qemu/hw/pc.c @@ -45,6 +45,7 @@ #include "loader.h" #include "elf.h" #include "multiboot.h" +#include "kvm.h" /* output Bochs bios info messages */ //#define DEBUG_BIOS @@ -59,6 +60,7 @@ #define FW_CFG_ACPI_TABLES (FW_CFG_ARCH_LOCAL + 0) #define FW_CFG_SMBIOS_ENTRIES (FW_CFG_ARCH_LOCAL + 1) #define FW_CFG_IRQ0_OVERRIDE (FW_CFG_ARCH_LOCAL + 2) +#define FW_CFG_E820_RESERVE (FW_CFG_ARCH_LOCAL + 3) #define MAX_IDE_BUS 2 @@ -66,6 +68,7 @@ static fdctrl_t *floppy_controller; static RTCState *rtc_state; static PITState *pit; static PCII440FXState *i440fx_state; +struct fw_cfg_e820_reserve e820_reserve; typedef struct isa_irq_state { qemu_irq *i8259; @@ -466,6 +469,8 @@ static void *bochs_bios_init(void) if (smbios_table) fw_cfg_add_bytes(fw_cfg, FW_CFG_SMBIOS_ENTRIES, smbios_table, smbios_len); + fw_cfg_add_bytes(fw_cfg, FW_CFG_E820_RESERVE, (uint8_t *)&e820_reserve, + sizeof(struct fw_cfg_e820_reserve)); /* allocate memory for the NUMA channel: one (64bit) word for the number * of nodes, one word for each VCPU->node and one word for each node to Index: qemu/kvm.h =================================================================== --- qemu.orig/kvm.h +++ qemu/kvm.h @@ -96,6 +96,13 @@ void kvm_arch_reset_vcpu(CPUState *env); struct kvm_guest_debug; struct kvm_debug_exit_arch; +struct fw_cfg_e820_reserve { + uint32_t addr; + uint32_t length; +}; + +extern struct fw_cfg_e820_reserve e820_reserve; + struct kvm_sw_breakpoint { target_ulong pc; target_ulong saved_insn; Index: qemu/target-i386/kvm.c =================================================================== --- qemu.orig/target-i386/kvm.c +++ qemu/target-i386/kvm.c @@ -356,6 +356,11 @@ int kvm_arch_init(KVMState *s, int smp_c * as unavaible memory. FIXME, need to ensure the e820 map deals with * this? */ + /* + * Tell fw_cfg to notify the BIOS to reserve the range. + */ + e820_reserve.addr = 0xfffbc000; + e820_reserve.length = 0x4000; return kvm_vm_ioctl(s, KVM_SET_TSS_ADDR, 0xfffbd000); }