} 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'",
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;
}