@@ -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 qemu_rdma_init_ram_blocks(struct qemu_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 >= QEMU_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) {
@@ -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"
@@ -3622,6 +3623,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);
@@ -4007,6 +4015,8 @@ int main(int argc, char **argv, char **envp)
register_savevm_live(NULL, "ram", 0, 4, &savevm_ram_handlers, NULL);
+ qemu_rdma_migration_data_init(&rdma_mdata);
+
if (nb_numa_nodes > 0) {
int i;