From patchwork Tue Jun 18 20:15:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: mrhines@linux.vnet.ibm.com X-Patchwork-Id: 252437 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)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 20CC42C02F4 for ; Wed, 19 Jun 2013 06:37:32 +1000 (EST) Received: from localhost ([::1]:46396 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Up2L9-00023g-PE for incoming@patchwork.ozlabs.org; Tue, 18 Jun 2013 16:17:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50617) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Up2KL-0001MZ-GN for qemu-devel@nongnu.org; Tue, 18 Jun 2013 16:16:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Up2KI-00075x-QY for qemu-devel@nongnu.org; Tue, 18 Jun 2013 16:16:29 -0400 Received: from e9.ny.us.ibm.com ([32.97.182.139]:56466) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Up2KI-00075s-MQ for qemu-devel@nongnu.org; Tue, 18 Jun 2013 16:16:26 -0400 Received: from /spool/local by e9.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 18 Jun 2013 16:16:26 -0400 Received: from d01dlp03.pok.ibm.com (9.56.250.168) by e9.ny.us.ibm.com (192.168.1.109) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 18 Jun 2013 16:16:24 -0400 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id BEC17C90067 for ; Tue, 18 Jun 2013 16:16:22 -0400 (EDT) Received: from d03av06.boulder.ibm.com (d03av06.boulder.ibm.com [9.17.195.245]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r5IKGJAo244688 for ; Tue, 18 Jun 2013 16:16:22 -0400 Received: from d03av06.boulder.ibm.com (loopback [127.0.0.1]) by d03av06.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r5IKIbr3013753 for ; Tue, 18 Jun 2013 14:18:37 -0600 Received: from mrhinesdev.klabtestbed.com (klinux.watson.ibm.com [9.2.208.21]) by d03av06.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r5IKISUJ013141; Tue, 18 Jun 2013 14:18:36 -0600 From: mrhines@linux.vnet.ibm.com To: qemu-devel@nongnu.org Date: Tue, 18 Jun 2013 16:15:55 -0400 Message-Id: <1371586561-22803-9-git-send-email-mrhines@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1371586561-22803-1-git-send-email-mrhines@linux.vnet.ibm.com> References: <1371586561-22803-1-git-send-email-mrhines@linux.vnet.ibm.com> X-TM-AS-MML: No X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13061820-7182-0000-0000-000007647854 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 32.97.182.139 Cc: aliguori@us.ibm.com, quintela@redhat.com, knoel@redhat.com, owasserm@redhat.com, abali@us.ibm.com, mrhines@us.ibm.com, gokul@us.ibm.com, pbonzini@redhat.com, chegu_vinod@hp.com Subject: [Qemu-devel] [PATCH v10 08/14] rdma: introduce qemu_ram_foreach_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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: "Michael R. Hines" This is used during RDMA initialization in order to transmit a description of all the RAM blocks to the peer for later dynamic chunk registration purposes. Reviewed-by: Paolo Bonzini Reviewed-by: Chegu Vinod Reviewed-by: Eric Blake Tested-by: Chegu Vinod Tested-by: Michael R. Hines Signed-off-by: Michael R. Hines --- exec.c | 9 +++++++++ include/exec/cpu-common.h | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/exec.c b/exec.c index 5b8b40d..a094664 100644 --- a/exec.c +++ b/exec.c @@ -2604,3 +2604,12 @@ bool cpu_physical_memory_is_io(hwaddr phys_addr) memory_region_is_romd(section->mr)); } #endif + +void qemu_ram_foreach_block(RAMBlockIterFunc func, void *opaque) +{ + RAMBlock *block; + + QTAILQ_FOREACH(block, &ram_list.blocks, next) { + func(block->host, block->offset, block->length, opaque); + } +} diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h index e061e21..92a4223 100644 --- a/include/exec/cpu-common.h +++ b/include/exec/cpu-common.h @@ -113,6 +113,11 @@ void cpu_physical_memory_write_rom(hwaddr addr, extern struct MemoryRegion io_mem_rom; extern struct MemoryRegion io_mem_notdirty; +typedef void (RAMBlockIterFunc)(void *host_addr, + ram_addr_t offset, ram_addr_t length, void *opaque); + +void qemu_ram_foreach_block(RAMBlockIterFunc func, void *opaque); + #endif #endif /* !CPU_COMMON_H */