From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44551) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UrIXO-0003Qy-Vw for qemu-devel@nongnu.org; Mon, 24 Jun 2013 21:59:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UrIXL-0001IA-G6 for qemu-devel@nongnu.org; Mon, 24 Jun 2013 21:59:18 -0400 Received: from e39.co.us.ibm.com ([32.97.110.160]:40422) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UrIXL-0001I2-9U for qemu-devel@nongnu.org; Mon, 24 Jun 2013 21:59:15 -0400 Received: from /spool/local by e39.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 24 Jun 2013 19:59:14 -0600 Received: from d01relay03.pok.ibm.com (d01relay03.pok.ibm.com [9.56.227.235]) by d01dlp01.pok.ibm.com (Postfix) with ESMTP id 8F66138C8051 for ; Mon, 24 Jun 2013 21:59:10 -0400 (EDT) Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay03.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r5P1wBM8271350 for ; Mon, 24 Jun 2013 21:58:11 -0400 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r5P1wAlX029244 for ; Mon, 24 Jun 2013 22:58:11 -0300 From: mrhines@linux.vnet.ibm.com Date: Mon, 24 Jun 2013 21:57:58 -0400 Message-Id: <1372125485-11795-9-git-send-email-mrhines@linux.vnet.ibm.com> In-Reply-To: <1372125485-11795-1-git-send-email-mrhines@linux.vnet.ibm.com> References: <1372125485-11795-1-git-send-email-mrhines@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH v11 08/15] rdma: introduce qemu_ram_foreach_block() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 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 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 0b0118b..2e6fc00 100644 --- a/exec.c +++ b/exec.c @@ -2630,3 +2630,12 @@ bool cpu_physical_memory_is_io(hwaddr phys_addr) memory_region_is_romd(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 */ -- 1.7.10.4