From patchwork Wed May 14 09:43:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hu Tao X-Patchwork-Id: 348722 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 0FE17140094 for ; Wed, 14 May 2014 19:58:16 +1000 (EST) Received: from localhost ([::1]:50602 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkVwx-00011W-6N for incoming@patchwork.ozlabs.org; Wed, 14 May 2014 05:58:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33272) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkVl8-0005rR-UD for qemu-devel@nongnu.org; Wed, 14 May 2014 05:46:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WkVl4-0006LG-BD for qemu-devel@nongnu.org; Wed, 14 May 2014 05:45:58 -0400 Received: from [59.151.112.132] (port=27911 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkVl3-0006Gd-U2 for qemu-devel@nongnu.org; Wed, 14 May 2014 05:45:54 -0400 X-IronPort-AV: E=Sophos;i="4.97,1051,1389715200"; d="scan'208";a="30507058" Received: from unknown (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 14 May 2014 17:43:04 +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 s4E9jaDZ002789; Wed, 14 May 2014 17:45:36 +0800 Received: from G08FNSTD100614.fnst.cn.fujitsu.com (10.167.226.102) by G08CNEXCHPEKD01.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.146.2; Wed, 14 May 2014 17:45:47 +0800 From: Hu Tao To: Date: Wed, 14 May 2014 17:43:22 +0800 Message-ID: <196c2f1237850c89ed0c16862177f1fe6cee002a.1400049817.git.hutao@cn.fujitsu.com> X-Mailer: git-send-email 1.8.5.2.229.g4448466 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [10.167.226.102] X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 59.151.112.132 Cc: Paolo Bonzini , Igor Mammedov Subject: [Qemu-devel] [PATCH v3.2 18/31] memory: move RAM_PREALLOC_MASK to exec.c, rename 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 Prepare for adding more flags. The "_MASK" suffix is unique, kill it. Signed-off-by: Paolo Bonzini Signed-off-by: Hu Tao --- exec.c | 9 ++++++--- include/exec/cpu-all.h | 3 --- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/exec.c b/exec.c index 99dcd14..b46cce4 100644 --- a/exec.c +++ b/exec.c @@ -70,6 +70,9 @@ AddressSpace address_space_memory; MemoryRegion io_mem_rom, io_mem_notdirty; static MemoryRegion io_mem_unassigned; +/* RAM is pre-allocated and passed into qemu_ram_alloc_from_ptr */ +#define RAM_PREALLOC (1 << 0) + #endif struct CPUTailQ cpus = QTAILQ_HEAD_INITIALIZER(cpus); @@ -1316,7 +1319,7 @@ ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host, new_block->fd = -1; new_block->host = host; if (host) { - new_block->flags |= RAM_PREALLOC_MASK; + new_block->flags |= RAM_PREALLOC; } return ram_block_add(new_block); } @@ -1355,7 +1358,7 @@ void qemu_ram_free(ram_addr_t addr) QTAILQ_REMOVE(&ram_list.blocks, block, next); ram_list.mru_block = NULL; ram_list.version++; - if (block->flags & RAM_PREALLOC_MASK) { + if (block->flags & RAM_PREALLOC) { ; } else if (xen_enabled()) { xen_invalidate_map_cache_entry(block->host); @@ -1387,7 +1390,7 @@ void qemu_ram_remap(ram_addr_t addr, ram_addr_t length) offset = addr - block->offset; if (offset < block->length) { vaddr = block->host + offset; - if (block->flags & RAM_PREALLOC_MASK) { + if (block->flags & RAM_PREALLOC) { ; } else if (xen_enabled()) { abort(); diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index dfdd071..6960544 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -414,9 +414,6 @@ CPUArchState *cpu_copy(CPUArchState *env); /* memory API */ -/* RAM is pre-allocated and passed into qemu_ram_alloc_from_ptr */ -#define RAM_PREALLOC_MASK (1 << 0) - typedef struct RAMBlock { struct MemoryRegion *mr; uint8_t *host;