From patchwork Mon Jan 25 16:49:23 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jes Sorensen X-Patchwork-Id: 75063 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id o0PGnkxm009162 for ; Mon, 25 Jan 2010 16:49:46 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754061Ab0AYQto (ORCPT ); Mon, 25 Jan 2010 11:49:44 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754057Ab0AYQto (ORCPT ); Mon, 25 Jan 2010 11:49:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39423 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754055Ab0AYQtn (ORCPT ); Mon, 25 Jan 2010 11:49:43 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o0PGnURu009035 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 25 Jan 2010 11:49:31 -0500 Received: from [10.36.8.164] (vpn2-8-164.ams2.redhat.com [10.36.8.164]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o0PGnODs032235; Mon, 25 Jan 2010 11:49:24 -0500 Message-ID: <4B5DCB93.7050007@redhat.com> Date: Mon, 25 Jan 2010 17:49:23 +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 CC: kvm@vger.kernel.org, "Kevin O'Connor" , Avi Kivity , Anthony Liguori Subject: [PATCH] QEMU-KVM - provide e820 reserve through qemu_cfg References: <4B5DCAF2.3010105@redhat.com> In-Reply-To: <4B5DCAF2.3010105@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Index: qemu-kvm/hw/fw_cfg.h =================================================================== --- qemu-kvm.orig/hw/fw_cfg.h +++ qemu-kvm/hw/fw_cfg.h @@ -67,4 +67,9 @@ FWCfgState *fw_cfg_init(uint32_t ctl_por #endif /* NO_QEMU_PROTOS */ +struct fw_cfg_e820_reserve { + uint32_t addr; + uint32_t length; +}; + #endif Index: qemu-kvm/hw/pc.c =================================================================== --- qemu-kvm.orig/hw/pc.c +++ qemu-kvm/hw/pc.c @@ -66,6 +66,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 @@ -73,6 +74,7 @@ static fdctrl_t *floppy_controller; static RTCState *rtc_state; static PITState *pit; static PCII440FXState *i440fx_state; +struct fw_cfg_e820_reserve e820_reserve; qemu_irq *ioapic_irq_hack; @@ -475,6 +477,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/kvm.h =================================================================== --- qemu-kvm.orig/kvm.h +++ qemu-kvm/kvm.h @@ -101,6 +101,8 @@ void kvm_arch_reset_vcpu(CPUState *env); struct kvm_guest_debug; struct kvm_debug_exit_arch; +extern struct fw_cfg_e820_reserve e820_reserve; + struct kvm_sw_breakpoint { target_ulong pc; target_ulong saved_insn; Index: qemu-kvm/qemu-kvm-x86.c =================================================================== --- qemu-kvm.orig/qemu-kvm-x86.c +++ qemu-kvm/qemu-kvm-x86.c @@ -23,6 +23,7 @@ #include "kvm.h" #include "hw/pc.h" +#include "hw/fw_cfg.h" #define MSR_IA32_TSC 0x10 @@ -37,6 +38,11 @@ int kvm_set_tss_addr(kvm_context_t kvm, { #ifdef KVM_CAP_SET_TSS_ADDR int r; + /* + * Tell fw_cfg to notify the BIOS to reserve the range. + */ + e820_reserve.addr = addr; + e820_reserve.length = 0x4000; r = kvm_ioctl(kvm_state, KVM_CHECK_EXTENSION, KVM_CAP_SET_TSS_ADDR); if (r > 0) { Index: qemu-kvm/target-i386/kvm.c =================================================================== --- qemu-kvm.orig/target-i386/kvm.c +++ qemu-kvm/target-i386/kvm.c @@ -25,6 +25,8 @@ #include "gdbstub.h" #include "host-utils.h" +extern struct fw_cfg_e820_reserve e820_reserve; + #ifdef KVM_UPSTREAM //#define DEBUG_KVM @@ -298,6 +300,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); }