From patchwork Mon Sep 2 15:16:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 271971 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id D132F2C009A for ; Tue, 3 Sep 2013 01:18:03 +1000 (EST) Received: from localhost ([::1]:40496 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VGVtB-0003gU-O3 for incoming@patchwork.ozlabs.org; Mon, 02 Sep 2013 11:18:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46178) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VGVsm-0003eO-KW for qemu-devel@nongnu.org; Mon, 02 Sep 2013 11:17:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VGVsh-0005ff-5U for qemu-devel@nongnu.org; Mon, 02 Sep 2013 11:17:36 -0400 Received: from smtp.citrix.com ([66.165.176.89]:26458) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VGVsg-0005fV-WF for qemu-devel@nongnu.org; Mon, 02 Sep 2013 11:17:31 -0400 X-IronPort-AV: E=Sophos;i="4.89,1007,1367971200"; d="scan'208";a="49700866" Received: from accessns.citrite.net (HELO FTLPEX01CL02.citrite.net) ([10.9.154.239]) by FTLPIPO01.CITRIX.COM with ESMTP; 02 Sep 2013 15:17:29 +0000 Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.79) with Microsoft SMTP Server id 14.2.342.4; Mon, 2 Sep 2013 11:17:28 -0400 Received: from perard.uk.xensource.com ([10.80.2.84]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1VGVse-0005PR-Mn; Mon, 02 Sep 2013 16:17:28 +0100 From: Anthony PERARD To: Date: Mon, 2 Sep 2013 16:16:41 +0100 Message-ID: <1378135002-10052-2-git-send-email-anthony.perard@citrix.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1378135002-10052-1-git-send-email-anthony.perard@citrix.com> References: <1378135002-10052-1-git-send-email-anthony.perard@citrix.com> MIME-Version: 1.0 X-DLP: MIA2 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 66.165.176.89 Cc: Peter Maydell , "Michael S. Tsirkin" , Stefano Stabellini , Anthony Liguori , Anthony PERARD , Paolo Bonzini , =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [Qemu-devel] [PATCH v2 1/2] pc: Initializing ram_memory under Xen. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Anthony PERARD --- hw/i386/pc_piix.c | 2 +- include/hw/xen/xen.h | 4 +--- xen-all.c | 7 ++++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 3c36a2a..a5ea582 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -89,7 +89,7 @@ static void pc_init1(QEMUMachineInitArgs *args, FWCfgState *fw_cfg = NULL; PcGuestInfo *guest_info; - if (xen_enabled() && xen_hvm_init() != 0) { + if (xen_enabled() && xen_hvm_init(&ram_memory) != 0) { fprintf(stderr, "xen hardware virtual machine initialisation failed\n"); exit(1); } diff --git a/include/hw/xen/xen.h b/include/hw/xen/xen.h index 6d42dd1..e1f88bf 100644 --- a/include/hw/xen/xen.h +++ b/include/hw/xen/xen.h @@ -37,17 +37,15 @@ void xen_cmos_set_s3_resume(void *opaque, int irq, int level); qemu_irq *xen_interrupt_controller_init(void); int xen_init(void); -int xen_hvm_init(void); +int xen_hvm_init(MemoryRegion **ram_memory); void xenstore_store_pv_console_info(int i, struct CharDriverState *chr); #if defined(NEED_CPU_H) && !defined(CONFIG_USER_ONLY) -struct MemoryRegion; void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size, struct MemoryRegion *mr); void xen_modified_memory(ram_addr_t start, ram_addr_t length); #endif -struct MemoryRegion; void xen_register_framebuffer(struct MemoryRegion *mr); #if defined(CONFIG_XEN) && CONFIG_XEN_CTRL_INTERFACE_VERSION < 400 diff --git a/xen-all.c b/xen-all.c index eb13111..839f14f 100644 --- a/xen-all.c +++ b/xen-all.c @@ -154,7 +154,7 @@ qemu_irq *xen_interrupt_controller_init(void) /* Memory Ops */ -static void xen_ram_init(ram_addr_t ram_size) +static void xen_ram_init(ram_addr_t ram_size, MemoryRegion **ram_memory_p) { MemoryRegion *sysmem = get_system_memory(); ram_addr_t below_4g_mem_size, above_4g_mem_size = 0; @@ -168,6 +168,7 @@ static void xen_ram_init(ram_addr_t ram_size) block_len += HVM_BELOW_4G_MMIO_LENGTH; } memory_region_init_ram(&ram_memory, NULL, "xen.ram", block_len); + *ram_memory_p = &ram_memory; vmstate_register_ram_global(&ram_memory); if (ram_size >= HVM_BELOW_4G_RAM_END) { @@ -1059,7 +1060,7 @@ static void xen_read_physmap(XenIOState *state) free(entries); } -int xen_hvm_init(void) +int xen_hvm_init(MemoryRegion **ram_memory) { int i, rc; unsigned long ioreq_pfn; @@ -1134,7 +1135,7 @@ int xen_hvm_init(void) /* Init RAM management */ xen_map_cache_init(xen_phys_offset_to_gaddr, state); - xen_ram_init(ram_size); + xen_ram_init(ram_size, ram_memory); qemu_add_vm_change_state_handler(xen_hvm_change_state_handler, state);