aboutsummaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2018-04-03 14:55:11 +1000
committerDavid Gibson <david@gibson.dropbear.id.au>2018-04-27 18:05:22 +1000
commit0de6e2a3ca2e1215a2d62d8d796589d27eca91d0 (patch)
tree89c3e7fac8cf32172e02f41622da2ebb2b2840c5 /target
parent8a4fd427fe8236bb4f6993702112f058b5d80507 (diff)
downloadqemu-0de6e2a3ca2e1215a2d62d8d796589d27eca91d0.zip
qemu-0de6e2a3ca2e1215a2d62d8d796589d27eca91d0.tar.gz
qemu-0de6e2a3ca2e1215a2d62d8d796589d27eca91d0.tar.bz2
Make qemu_mempath_getpagesize() accept NULL
qemu_mempath_getpagesize() gets the effective (host side) page size for a block of memory backed by an mmap()ed file on the host. It requires the mem_path parameter to be non-NULL. This ends up meaning all the callers need a different case for handling anonymous memory (for memory-backend-ram or default memory with -mem-path is not specified). We can make all those callers a little simpler by having qemu_mempath_getpagesize() accept NULL, and treat that as the anonymous memory case. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Greg Kurz <groug@kaod.org> Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'target')
-rw-r--r--target/ppc/kvm.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
index 79a436a..e24fa50 100644
--- a/target/ppc/kvm.c
+++ b/target/ppc/kvm.c
@@ -499,12 +499,8 @@ bool kvmppc_is_mem_backend_page_size_ok(const char *obj_path)
char *mempath = object_property_get_str(mem_obj, "mem-path", NULL);
long pagesize;
- if (mempath) {
- pagesize = qemu_mempath_getpagesize(mempath);
- g_free(mempath);
- } else {
- pagesize = getpagesize();
- }
+ pagesize = qemu_mempath_getpagesize(mempath);
+ g_free(mempath);
return pagesize >= max_cpu_page_size;
}