From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:57022) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQ3VJ-0007sL-1I for qemu-devel@nongnu.org; Wed, 10 Apr 2013 18:28:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UQ3VG-00018e-NB for qemu-devel@nongnu.org; Wed, 10 Apr 2013 18:28:32 -0400 Received: from e34.co.us.ibm.com ([32.97.110.152]:50464) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQ3VG-00017n-HX for qemu-devel@nongnu.org; Wed, 10 Apr 2013 18:28:30 -0400 Received: from /spool/local by e34.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 10 Apr 2013 16:28:27 -0600 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id DD61E1FF0049 for ; Wed, 10 Apr 2013 16:23:24 -0600 (MDT) Received: from d03av06.boulder.ibm.com (d03av06.boulder.ibm.com [9.17.195.245]) by d03relay04.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r3AMSOQN368258 for ; Wed, 10 Apr 2013 16:28:24 -0600 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 r3AMVBcC003110 for ; Wed, 10 Apr 2013 16:31:11 -0600 From: mrhines@linux.vnet.ibm.com Date: Wed, 10 Apr 2013 18:28:09 -0400 Message-Id: <1365632901-15470-2-git-send-email-mrhines@linux.vnet.ibm.com> In-Reply-To: <1365632901-15470-1-git-send-email-mrhines@linux.vnet.ibm.com> References: <1365632901-15470-1-git-send-email-mrhines@linux.vnet.ibm.com> Subject: [Qemu-devel] [RFC PATCH RDMA support v1: 01/13] 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, mst@redhat.com, owasserm@redhat.com, abali@us.ibm.com, mrhines@us.ibm.com, gokul@us.ibm.com, pbonzini@redhat.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. 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 fa1e0c3..0e5a2c3 100644 --- a/exec.c +++ b/exec.c @@ -2631,3 +2631,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 2e5f11f..88cb741 100644 --- a/include/exec/cpu-common.h +++ b/include/exec/cpu-common.h @@ -119,6 +119,11 @@ extern struct MemoryRegion io_mem_rom; extern struct MemoryRegion io_mem_unassigned; 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