From patchwork Wed Feb 19 07:54:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hu Tao X-Patchwork-Id: 321770 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 2C8412C0309 for ; Wed, 19 Feb 2014 19:00:06 +1100 (EST) Received: from localhost ([::1]:57010 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WG24a-000502-91 for incoming@patchwork.ozlabs.org; Wed, 19 Feb 2014 03:00:04 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49549) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WG20u-0007Rp-Dz for qemu-devel@nongnu.org; Wed, 19 Feb 2014 02:56:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WG20o-0003WR-WB for qemu-devel@nongnu.org; Wed, 19 Feb 2014 02:56:16 -0500 Received: from [222.73.24.84] (port=44768 helo=song.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WG20o-0003VB-Kq for qemu-devel@nongnu.org; Wed, 19 Feb 2014 02:56:10 -0500 X-IronPort-AV: E=Sophos;i="4.97,504,1389715200"; d="scan'208";a="9558777" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 19 Feb 2014 15:52:06 +0800 Received: from fnstmail02.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id s1J7tpcv012635; Wed, 19 Feb 2014 15:55:55 +0800 Received: from G08FNSTD100614.fnst.cn.fujitsu.com ([10.167.226.102]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2014021915534233-35704 ; Wed, 19 Feb 2014 15:53:42 +0800 From: Hu Tao To: qemu-devel@nongnu.org Date: Wed, 19 Feb 2014 15:54:00 +0800 Message-Id: <8d536491f69be68a5eca675c8a2be5bce3df0b62.1392794450.git.hutao@cn.fujitsu.com> X-Mailer: git-send-email 1.8.5.2.229.g4448466 In-Reply-To: References: X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2014/02/19 15:53:42, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2014/02/19 15:53:46, Serialize complete at 2014/02/19 15:53:46 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 222.73.24.84 Cc: pbonzini@redhat.com, lersek@redhat.com, Wanlong Gao , imammedo@redhat.com Subject: [Qemu-devel] [PATCH v18 09/14] numa: introduce memory_region_allocate_system_memory 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 From: Paolo Bonzini Signed-off-by: Paolo Bonzini Signed-off-by: Hu Tao --- hw/i386/pc.c | 4 +--- include/sysemu/sysemu.h | 5 +++++ numa.c | 10 ++++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 17d4820..ff078fb 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1165,9 +1165,7 @@ FWCfgState *pc_memory_init(QEMUMachineInitArgs *args, * with older qemus that used qemu_ram_alloc(). */ ram = g_malloc(sizeof(*ram)); - memory_region_init_ram(ram, NULL, "pc.ram", - below_4g_mem_size + above_4g_mem_size); - vmstate_register_ram_global(ram); + memory_region_allocate_system_memory(ram, NULL, "pc.ram", args); *ram_memory = ram; ram_below_4g = g_malloc(sizeof(*ram_below_4g)); memory_region_init_alias(ram_below_4g, NULL, "ram-below-4g", ram, diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 4c94cf5..e9da760 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -10,6 +10,8 @@ #include "qemu/notify.h" #include "qemu/main-loop.h" #include "qemu/bitmap.h" +#include "qom/object.h" +#include "hw/boards.h" /* vl.c */ @@ -144,6 +146,9 @@ void set_numa_nodes(void); void set_numa_modes(void); extern QemuOptsList qemu_numa_opts; int numa_init_func(QemuOpts *opts, void *opaque); +void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner, + const char *name, + QEMUMachineInitArgs *args); #define MAX_OPTION_ROMS 16 typedef struct QEMUOptionRom { diff --git a/numa.c b/numa.c index 827c76f..403b08b 100644 --- a/numa.c +++ b/numa.c @@ -188,3 +188,13 @@ void set_numa_modes(void) } } } + +void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner, + const char *name, + QEMUMachineInitArgs *args) +{ + uint64_t ram_size = args->ram_size; + + memory_region_init_ram(mr, owner, name, ram_size); + vmstate_register_ram_global(mr); +}