From patchwork Thu Mar 9 13:22:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Dr. David Alan Gilbert" X-Patchwork-Id: 736992 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 3vfB0Y5sBnz9s7j for ; Fri, 10 Mar 2017 00:23:09 +1100 (AEDT) Received: from localhost ([::1]:34107 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cly25-0002dt-HP for incoming@patchwork.ozlabs.org; Thu, 09 Mar 2017 08:23:05 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60998) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cly1Q-0002dE-SM for qemu-devel@nongnu.org; Thu, 09 Mar 2017 08:22:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cly1N-0003ep-4T for qemu-devel@nongnu.org; Thu, 09 Mar 2017 08:22:24 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49442) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cly1M-0003eh-UJ for qemu-devel@nongnu.org; Thu, 09 Mar 2017 08:22:21 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1F7A780478; Thu, 9 Mar 2017 13:22:21 +0000 (UTC) Received: from dgilbert-t530.redhat.com (ovpn-117-164.ams2.redhat.com [10.36.117.164]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v29DMHTo015625; Thu, 9 Mar 2017 08:22:19 -0500 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, quintela@redhat.com Date: Thu, 9 Mar 2017 13:22:15 +0000 Message-Id: <20170309132216.23482-2-dgilbert@redhat.com> In-Reply-To: <20170309132216.23482-1-dgilbert@redhat.com> References: <20170309132216.23482-1-dgilbert@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 09 Mar 2017 13:22:21 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 1/2] RAMBlocks: qemu_ram_is_shared X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, pbonzini@redhat.com, pasic@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: "Dr. David Alan Gilbert" Provide a helper to say whether a RAMBlock was created as a shared mapping. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Halil Pasic Reviewed-by: Juan Quintela --- exec.c | 5 +++++ include/exec/cpu-common.h | 1 + 2 files changed, 6 insertions(+) diff --git a/exec.c b/exec.c index aabb035..1f25a12 100644 --- a/exec.c +++ b/exec.c @@ -2593,6 +2593,11 @@ MemoryRegion *get_system_io(void) return system_io; } +bool qemu_ram_is_shared(RAMBlock *rb) +{ + return rb->flags & RAM_SHARED; +} + #endif /* !defined(CONFIG_USER_ONLY) */ /* physical memory access (slow version, mainly for debug) */ diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h index b62f0d8..4d45a72 100644 --- a/include/exec/cpu-common.h +++ b/include/exec/cpu-common.h @@ -69,6 +69,7 @@ RAMBlock *qemu_ram_block_from_host(void *ptr, bool round_offset, void qemu_ram_set_idstr(RAMBlock *block, const char *name, DeviceState *dev); void qemu_ram_unset_idstr(RAMBlock *block); const char *qemu_ram_get_idstr(RAMBlock *rb); +bool qemu_ram_is_shared(RAMBlock *rb); size_t qemu_ram_pagesize(RAMBlock *block); size_t qemu_ram_pagesize_largest(void);