summaryrefslogtreecommitdiffstats
path: root/backends/hostmem-file.c
diff options
context:
space:
mode:
authorPeter Maydell2018-11-28 12:32:33 +0100
committerPeter Maydell2018-11-28 12:32:33 +0100
commitc56606684ad253fad1fc160a225295bcfb3fba14 (patch)
tree3945ebc96fcf7c3701e03c66b52d2137c67363de /backends/hostmem-file.c
parentscsi: Address spurious clang warning (diff)
parenthostmem: no need to check for host_memory_backend_mr_inited() in alloc() (diff)
downloadqemu-c56606684ad253fad1fc160a225295bcfb3fba14.tar.gz
qemu-c56606684ad253fad1fc160a225295bcfb3fba14.tar.xz
qemu-c56606684ad253fad1fc160a225295bcfb3fba14.zip
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
* lsi HBA reselection fix (George) * Small cleanups (Li Qiang) * bugfixes for vhost-user-bridge and hostmem (Marc-André) * single-thread TCG fix (me) * VMX migration blocker (me) * target/i386 fix for LOCK (Richard) * MAINTAINERS update (Philippe, Thomas) # gpg: Signature made Wed 28 Nov 2018 10:51:36 GMT # gpg: using RSA key BFFBD25F78C7AE83 # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1 # Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83 * remotes/bonzini/tags/for-upstream: hostmem: no need to check for host_memory_backend_mr_inited() in alloc() hostmem-memfd: honour share=on/off property MAINTAINERS: Add an entry for the Firmware Configuration (fw_cfg) device MAINTAINERS: Add some missing entries related to accelerators target/i386: Generate #UD when applying LOCK to a register destination checkpatch: g_test_message does not need a trailing newline vl.c: remove outdated comment vhost-user-bridge: fix recvmsg iovlen vl: Improve error message when we can't load fw_cfg from file vmstate: constify VMStateField migration: savevm: consult migration blockers lsi: Reselection needed to remove pending commands from queue cpus: run work items for all vCPUs if single-threaded target/i386: kvm: add VMX migration blocker Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'backends/hostmem-file.c')
-rw-r--r--backends/hostmem-file.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c
index 639c8d4307..6630021226 100644
--- a/backends/hostmem-file.c
+++ b/backends/hostmem-file.c
@@ -42,6 +42,9 @@ static void
file_backend_memory_alloc(HostMemoryBackend *backend, Error **errp)
{
HostMemoryBackendFile *fb = MEMORY_BACKEND_FILE(backend);
+#ifdef CONFIG_POSIX
+ gchar *path;
+#endif
if (!backend->size) {
error_setg(errp, "can't create backend with size 0");
@@ -54,18 +57,15 @@ file_backend_memory_alloc(HostMemoryBackend *backend, Error **errp)
#ifndef CONFIG_POSIX
error_setg(errp, "-mem-path not supported on this host");
#else
- if (!host_memory_backend_mr_inited(backend)) {
- gchar *path;
- backend->force_prealloc = mem_prealloc;
- path = object_get_canonical_path(OBJECT(backend));
- memory_region_init_ram_from_file(&backend->mr, OBJECT(backend),
- path,
- backend->size, fb->align,
- (backend->share ? RAM_SHARED : 0) |
- (fb->is_pmem ? RAM_PMEM : 0),
- fb->mem_path, errp);
- g_free(path);
- }
+ backend->force_prealloc = mem_prealloc;
+ path = object_get_canonical_path(OBJECT(backend));
+ memory_region_init_ram_from_file(&backend->mr, OBJECT(backend),
+ path,
+ backend->size, fb->align,
+ (backend->share ? RAM_SHARED : 0) |
+ (fb->is_pmem ? RAM_PMEM : 0),
+ fb->mem_path, errp);
+ g_free(path);
#endif
}