yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
Blob Blame History Raw
From 34bab268a046ceb03e4f925eb8f45a80314c6c34 Mon Sep 17 00:00:00 2001
Message-Id: <34bab268a046ceb03e4f925eb8f45a80314c6c34.1387382496.git.minovotn@redhat.com>
In-Reply-To: <c5386144fbf09f628148101bc674e2421cdd16e3.1387382496.git.minovotn@redhat.com>
References: <c5386144fbf09f628148101bc674e2421cdd16e3.1387382496.git.minovotn@redhat.com>
From: Nigel Croxon <ncroxon@redhat.com>
Date: Thu, 14 Nov 2013 22:52:45 +0100
Subject: [PATCH 09/46] rdma: introduce qemu_ram_foreach_block()

RH-Author: Nigel Croxon <ncroxon@redhat.com>
Message-id: <1384469598-13137-10-git-send-email-ncroxon@redhat.com>
Patchwork-id: 55693
O-Subject: [RHEL7.0 PATCH 09/42] rdma: introduce qemu_ram_foreach_block()
Bugzilla: 1011720
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>
RH-Acked-by: Amit Shah <amit.shah@redhat.com>
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>

Bugzilla: 1011720
https://bugzilla.redhat.com/show_bug.cgi?id=1011720

>From commit ID:
commit bd2fa51fcdba3408f308df1b08fae04053ecdee5
Author: Michael R. Hines <mrhines@us.ibm.com>
Date:   Tue Jun 25 21:35:34 2013 -0400

    rdma: introduce qemu_ram_foreach_block()

    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: Juan Quintela <quintela@redhat.com>
    Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
    Reviewed-by: Chegu Vinod <chegu_vinod@hp.com>
    Tested-by: Chegu Vinod <chegu_vinod@hp.com>
    Tested-by: Michael R. Hines <mrhines@us.ibm.com>
    Signed-off-by: Michael R. Hines <mrhines@us.ibm.com>
    Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 exec.c                    |    9 +++++++++
 include/exec/cpu-common.h |    5 +++++
 2 files changed, 14 insertions(+), 0 deletions(-)

Signed-off-by: Michal Novotny <minovotn@redhat.com>
---
 exec.c                    | 9 +++++++++
 include/exec/cpu-common.h | 5 +++++
 2 files changed, 14 insertions(+)

diff --git a/exec.c b/exec.c
index cb11571..64af205 100644
--- a/exec.c
+++ b/exec.c
@@ -2644,3 +2644,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..2900fd6 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.11.7