From patchwork Wed Mar 26 10:36:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hu Tao X-Patchwork-Id: 333861 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id CD1BB14008C for ; Wed, 26 Mar 2014 23:36:51 +1100 (EST) Received: from localhost ([::1]:47598 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSmqt-0002pQ-Ih for incoming@patchwork.ozlabs.org; Wed, 26 Mar 2014 08:22:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37637) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSlht-00017k-Dh for qemu-devel@nongnu.org; Wed, 26 Mar 2014 07:09:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WSlho-0002dp-N4 for qemu-devel@nongnu.org; Wed, 26 Mar 2014 07:09:17 -0400 Received: from [59.151.112.132] (port=14005 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSlho-0002Sd-8m for qemu-devel@nongnu.org; Wed, 26 Mar 2014 07:09:12 -0400 X-IronPort-AV: E=Sophos;i="4.97,734,1389715200"; d="scan'208";a="28487320" Received: from unknown (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 26 Mar 2014 18:34:31 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id s2QAapvv003096; Wed, 26 Mar 2014 18:36:52 +0800 Received: from G08CNEXMBPEKD03.g08.fujitsu.local ([10.167.33.86]) by G08CNEXCHPEKD01.g08.fujitsu.local ([10.167.33.80]) with mapi id 14.03.0146.002; Wed, 26 Mar 2014 18:37:04 +0800 From: "hutao@cn.fujitsu.com" To: "qemu-devel@nongnu.org" Thread-Topic: [PATCH v3 13/34] numa: introduce memory_region_allocate_system_memory Thread-Index: AQHPSN9T+SW3lKbmcEKGs9cp/7I3DQ== Date: Wed, 26 Mar 2014 10:36:59 +0000 Message-ID: <8260726ccca3bb341c28356c40bb069cd94f3c5e.1395825870.git.hutao@cn.fujitsu.com> References: In-Reply-To: Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.167.226.102] MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 59.151.112.132 Cc: "ehabkost@redhat.com" , "imammedo@redhat.com" , "mtosatti@redhat.com" , Paolo Bonzini , "a.motakis@virtualopensystems.com" , "gaowanlong@cn.fujitsu.com" Subject: [Qemu-devel] [PATCH v3 13/34] 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/hw/boards.h | 6 +++++- include/sysemu/sysemu.h | 1 + numa.c | 9 +++++++++ 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index d5fb884..571dc72 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1181,9 +1181,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_size); *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/hw/boards.h b/include/hw/boards.h index dd2c70d..1ea52c0 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -50,9 +50,13 @@ struct QEMUMachine { const char *hw_version; }; -#define TYPE_MACHINE_SUFFIX "-machine" +void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner, + const char *name, + uint64_t ram_size); + int qemu_register_machine(QEMUMachine *m); +#define TYPE_MACHINE_SUFFIX "-machine" #define TYPE_MACHINE "machine" #undef MACHINE /* BSD defines it and QEMU does not use it */ #define MACHINE(obj) \ diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 423d49e..caf88dd 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -10,6 +10,7 @@ #include "qemu/notify.h" #include "qemu/main-loop.h" #include "qemu/bitmap.h" +#include "qom/object.h" /* vl.c */ diff --git a/numa.c b/numa.c index 439df87..bcd7b04 100644 --- a/numa.c +++ b/numa.c @@ -33,6 +33,7 @@ #include "qapi/opts-visitor.h" #include "qapi/dealloc-visitor.h" #include "qapi/qmp/qerror.h" +#include "hw/boards.h" QemuOptsList qemu_numa_opts = { .name = "numa", @@ -194,3 +195,11 @@ void set_numa_modes(void) } } } + +void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner, + const char *name, + uint64_t ram_size) +{ + memory_region_init_ram(mr, owner, name, ram_size); + vmstate_register_ram_global(mr); +}