hax: executed 'hax_populate_ram()' in more proper position 44/31844/3
authorSeokYeon Hwang <syeon.hwang@samsung.com>
Thu, 11 Dec 2014 06:10:20 +0000 (15:10 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Tue, 16 Dec 2014 11:09:42 +0000 (03:09 -0800)
Change-Id: I8bd616077d223ffebba8b4287cd6f675486ad806
Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
exec.c

diff --git a/exec.c b/exec.c
index c54be02..bce0d85 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -1314,21 +1314,6 @@ static ram_addr_t ram_block_add(RAMBlock *new_block, Error **errp)
         } else {
             new_block->host = phys_mem_alloc(new_block->length,
                                              &new_block->mr->align);
-#ifdef CONFIG_HAX
-            /*
-             * In Hax, the qemu allocate the virtual address, and HAX kernel
-             * populate the memory with physical memory. Currently we have no
-             * paging, so user should make sure enough free memory in advance
-             */
-            if (hax_enabled()) {
-                int ret;
-                ret = hax_populate_ram((uint64_t)(uintptr_t)new_block->host, size);
-                if (ret < 0) {
-                    fprintf(stderr, "Hax failed to populate ram\n");
-                    exit(-1);
-                }
-            }
-#endif
             if (!new_block->host) {
                 error_setg_errno(errp, errno,
                                  "cannot set up guest memory '%s'",
@@ -1375,6 +1360,21 @@ static ram_addr_t ram_block_add(RAMBlock *new_block, Error **errp)
     if (kvm_enabled()) {
         kvm_setup_guest_memory(new_block->host, new_block->length);
     }
+#ifdef CONFIG_HAX
+    /*
+     * In Hax, the qemu allocate the virtual address, and HAX kernel
+     * populate the memory with physical memory. Currently we have no
+     * paging, so user should make sure enough free memory in advance
+     */
+    if (hax_enabled()) {
+        int ret = hax_populate_ram((uint64_t)(uintptr_t)new_block->host,
+                                new_block->length);
+        if (ret < 0) {
+            fprintf(stderr, "HAX failed to populate ram\n");
+            exit(-1);
+        }
+    }
+#endif
 
     return new_block->offset;
 }