0a122b
From 34bab268a046ceb03e4f925eb8f45a80314c6c34 Mon Sep 17 00:00:00 2001
0a122b
Message-Id: <34bab268a046ceb03e4f925eb8f45a80314c6c34.1387382496.git.minovotn@redhat.com>
0a122b
In-Reply-To: <c5386144fbf09f628148101bc674e2421cdd16e3.1387382496.git.minovotn@redhat.com>
0a122b
References: <c5386144fbf09f628148101bc674e2421cdd16e3.1387382496.git.minovotn@redhat.com>
0a122b
From: Nigel Croxon <ncroxon@redhat.com>
0a122b
Date: Thu, 14 Nov 2013 22:52:45 +0100
0a122b
Subject: [PATCH 09/46] rdma: introduce qemu_ram_foreach_block()
0a122b
0a122b
RH-Author: Nigel Croxon <ncroxon@redhat.com>
0a122b
Message-id: <1384469598-13137-10-git-send-email-ncroxon@redhat.com>
0a122b
Patchwork-id: 55693
0a122b
O-Subject: [RHEL7.0 PATCH 09/42] rdma: introduce qemu_ram_foreach_block()
0a122b
Bugzilla: 1011720
0a122b
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>
0a122b
RH-Acked-by: Amit Shah <amit.shah@redhat.com>
0a122b
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
0a122b
0a122b
Bugzilla: 1011720
0a122b
https://bugzilla.redhat.com/show_bug.cgi?id=1011720
0a122b
0a122b
>From commit ID:
0a122b
commit bd2fa51fcdba3408f308df1b08fae04053ecdee5
0a122b
Author: Michael R. Hines <mrhines@us.ibm.com>
0a122b
Date:   Tue Jun 25 21:35:34 2013 -0400
0a122b
0a122b
    rdma: introduce qemu_ram_foreach_block()
0a122b
0a122b
    This is used during RDMA initialization in order to
0a122b
    transmit a description of all the RAM blocks to the
0a122b
    peer for later dynamic chunk registration purposes.
0a122b
0a122b
    Reviewed-by: Juan Quintela <quintela@redhat.com>
0a122b
    Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
0a122b
    Reviewed-by: Chegu Vinod <chegu_vinod@hp.com>
0a122b
    Tested-by: Chegu Vinod <chegu_vinod@hp.com>
0a122b
    Tested-by: Michael R. Hines <mrhines@us.ibm.com>
0a122b
    Signed-off-by: Michael R. Hines <mrhines@us.ibm.com>
0a122b
    Signed-off-by: Juan Quintela <quintela@redhat.com>
0a122b
---
0a122b
 exec.c                    |    9 +++++++++
0a122b
 include/exec/cpu-common.h |    5 +++++
0a122b
 2 files changed, 14 insertions(+), 0 deletions(-)
0a122b
0a122b
Signed-off-by: Michal Novotny <minovotn@redhat.com>
0a122b
---
0a122b
 exec.c                    | 9 +++++++++
0a122b
 include/exec/cpu-common.h | 5 +++++
0a122b
 2 files changed, 14 insertions(+)
0a122b
0a122b
diff --git a/exec.c b/exec.c
0a122b
index cb11571..64af205 100644
0a122b
--- a/exec.c
0a122b
+++ b/exec.c
0a122b
@@ -2644,3 +2644,12 @@ bool cpu_physical_memory_is_io(hwaddr phys_addr)
0a122b
              memory_region_is_romd(section->mr));
0a122b
 }
0a122b
 #endif
0a122b
+
0a122b
+void qemu_ram_foreach_block(RAMBlockIterFunc func, void *opaque)
0a122b
+{
0a122b
+    RAMBlock *block;
0a122b
+
0a122b
+    QTAILQ_FOREACH(block, &ram_list.blocks, next) {
0a122b
+        func(block->host, block->offset, block->length, opaque);
0a122b
+    }
0a122b
+}
0a122b
diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
0a122b
index 2e5f11f..2900fd6 100644
0a122b
--- a/include/exec/cpu-common.h
0a122b
+++ b/include/exec/cpu-common.h
0a122b
@@ -119,6 +119,11 @@ extern struct MemoryRegion io_mem_rom;
0a122b
 extern struct MemoryRegion io_mem_unassigned;
0a122b
 extern struct MemoryRegion io_mem_notdirty;
0a122b
 
0a122b
+typedef void (RAMBlockIterFunc)(void *host_addr,
0a122b
+    ram_addr_t offset, ram_addr_t length, void *opaque);
0a122b
+
0a122b
+void qemu_ram_foreach_block(RAMBlockIterFunc func, void *opaque);
0a122b
+
0a122b
 #endif
0a122b
 
0a122b
 #endif /* !CPU_COMMON_H */
0a122b
-- 
0a122b
1.7.11.7
0a122b