qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC PATCH RDMA support v2: 4/6] initialize RDMA options wh


From: Michael R. Hines
Subject: [Qemu-devel] [RFC PATCH RDMA support v2: 4/6] initialize RDMA options when QEMU first runs on command-line
Date: Mon, 11 Feb 2013 17:49:55 -0500

From: "Michael R. Hines" <address@hidden>


Signed-off-by: Michael R. Hines <address@hidden>
---
 exec.c |   27 +++++++++++++++++++++++++++
 vl.c   |   13 +++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/exec.c b/exec.c
index b85508b..b7ac6fa 100644
--- a/exec.c
+++ b/exec.c
@@ -25,6 +25,8 @@
 #endif
 
 #include "qemu-common.h"
+#include "qemu/rdma.h"
+#include "monitor/monitor.h"
 #include "cpu.h"
 #include "tcg.h"
 #include "hw/hw.h"
@@ -104,6 +106,31 @@ static MemoryRegion io_mem_watch;
 
 #if !defined(CONFIG_USER_ONLY)
 
+/*
+ * Memory regions need to be registered with the device and queue pairs setup
+ * in advanced before the migration starts. This tells us where the RAM blocks
+ * are so that we can register them individually.
+ */
+int rdma_init_ram_blocks(struct rdma_ram_blocks *rdma_ram_blocks)
+{
+    RAMBlock *block;
+    int num_blocks = 0;
+
+    memset(rdma_ram_blocks, 0, sizeof *rdma_ram_blocks);
+    QTAILQ_FOREACH(block, &ram_list.blocks, next) {
+        if (num_blocks >= RDMA_MAX_RAM_BLOCKS) {
+                return -1;
+        }
+        rdma_ram_blocks->block[num_blocks].local_host_addr = block->host;
+        rdma_ram_blocks->block[num_blocks].offset = (uint64_t)block->offset;
+        rdma_ram_blocks->block[num_blocks].length = (uint64_t)block->length;
+        num_blocks++;
+    }
+    rdma_ram_blocks->num_blocks = num_blocks;
+
+    return 0;
+}
+
 static void phys_map_node_reserve(unsigned nodes)
 {
     if (phys_map_nodes_nb + nodes > phys_map_nodes_nb_alloc) {
diff --git a/vl.c b/vl.c
index 7aab73b..170d209 100644
--- a/vl.c
+++ b/vl.c
@@ -29,6 +29,7 @@
 #include <sys/time.h>
 #include <zlib.h>
 #include "qemu/bitmap.h"
+#include "qemu/rdma.h"
 
 /* Needed early for CONFIG_BSD etc. */
 #include "config-host.h"
@@ -233,6 +234,9 @@ int boot_menu;
 uint8_t *boot_splash_filedata;
 size_t boot_splash_filedata_size;
 uint8_t qemu_extra_params_fw[2];
+int rdmaport = -1;
+char rdmahost[64] = "";
+struct rdma_data rdma_mdata;
 
 typedef struct FWBootEntry FWBootEntry;
 
@@ -3622,6 +3626,13 @@ int main(int argc, char **argv, char **envp)
                 default_sdcard = 0;
                 default_vga = 0;
                 break;
+            case QEMU_OPTION_rdmaport:
+                rdmaport = atoi(optarg);
+                break;
+            case QEMU_OPTION_rdmahost:
+                strncpy(rdmahost, optarg, 64);
+                rdmahost[63] = '\0';
+                break;
             case QEMU_OPTION_xen_domid:
                 if (!(xen_available())) {
                     printf("Option %s not supported for this target\n", 
popt->name);
@@ -3725,6 +3736,8 @@ int main(int argc, char **argv, char **envp)
     }
     loc_set_none();
 
+    rdma_data_init(&rdma_mdata);
+
     if (qemu_init_main_loop()) {
         fprintf(stderr, "qemu_init_main_loop failed\n");
         exit(1);
-- 
1.7.10.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]