From patchwork Tue Mar 1 06:18:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fam Zheng X-Patchwork-Id: 8462191 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EE2D8C0553 for ; Tue, 1 Mar 2016 06:21:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5BB0E2014A for ; Tue, 1 Mar 2016 06:21:52 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id AB7D420125 for ; Tue, 1 Mar 2016 06:21:51 +0000 (UTC) Received: from localhost ([::1]:41176 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aadgt-0001MW-2o for patchwork-qemu-devel@patchwork.kernel.org; Tue, 01 Mar 2016 01:21:51 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44910) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aaddx-0004qT-VJ for qemu-devel@nongnu.org; Tue, 01 Mar 2016 01:18:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aaddw-0005tA-Vt for qemu-devel@nongnu.org; Tue, 01 Mar 2016 01:18:49 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50477) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aaddw-0005t6-Qi for qemu-devel@nongnu.org; Tue, 01 Mar 2016 01:18:48 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 84D2D804EC; Tue, 1 Mar 2016 06:18:48 +0000 (UTC) Received: from fam-t430.redhat.com (vpn1-5-42.pek2.redhat.com [10.72.5.42]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u216IPXa031427; Tue, 1 Mar 2016 01:18:44 -0500 From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 1 Mar 2016 14:18:20 +0800 Message-Id: <1456813104-25902-4-git-send-email-famz@redhat.com> In-Reply-To: <1456813104-25902-1-git-send-email-famz@redhat.com> References: <1456813104-25902-1-git-send-email-famz@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Paolo Bonzini , arei.gonglei@huawei.com, peterx@redhat.com Subject: [Qemu-devel] [PATCH v2 3/7] memory: Implement memory_region_get_ram_addr with mr->ram_block 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Fam Zheng Reviewed-by: Gonglei --- include/exec/memory.h | 8 +------- memory.c | 5 +++++ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/include/exec/memory.h b/include/exec/memory.h index d5284c2..810d2c0 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -978,14 +978,8 @@ void memory_region_add_subregion_overlap(MemoryRegion *mr, /** * memory_region_get_ram_addr: Get the ram address associated with a memory * region - * - * DO NOT USE THIS FUNCTION. This is a temporary workaround while the Xen - * code is being reworked. */ -static inline ram_addr_t memory_region_get_ram_addr(MemoryRegion *mr) -{ - return mr->ram_addr; -} +ram_addr_t memory_region_get_ram_addr(MemoryRegion *mr); uint64_t memory_region_get_alignment(const MemoryRegion *mr); /** diff --git a/memory.c b/memory.c index fe70075..b2b2216 100644 --- a/memory.c +++ b/memory.c @@ -1596,6 +1596,11 @@ void *memory_region_get_ram_ptr(MemoryRegion *mr) return ptr + offset; } +ram_addr_t memory_region_get_ram_addr(MemoryRegion *mr) +{ + return mr->ram_block ? mr->ram_block->offset : RAM_ADDR_INVALID; +} + void memory_region_ram_resize(MemoryRegion *mr, ram_addr_t newsize, Error **errp) { assert(mr->ram_addr != RAM_ADDR_INVALID);