aboutsummaryrefslogtreecommitdiff
path: root/exec.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2018-04-03 15:05:45 +1000
committerDavid Gibson <david@gibson.dropbear.id.au>2018-04-27 18:05:22 +1000
commit2b10808539d7ace3d9b1226a71a68e2431ef2176 (patch)
tree07bc8d753d710a7217bdd6ec69b59b89f417dab7 /exec.c
parent0de6e2a3ca2e1215a2d62d8d796589d27eca91d0 (diff)
downloadqemu-2b10808539d7ace3d9b1226a71a68e2431ef2176.zip
qemu-2b10808539d7ace3d9b1226a71a68e2431ef2176.tar.gz
qemu-2b10808539d7ace3d9b1226a71a68e2431ef2176.tar.bz2
Add host_memory_backend_pagesize() helper
There are a couple places (one generic, one target specific) where we need to get the host page size associated with a particular memory backend. I have some upcoming code which will add another place which wants this. So, for convenience, add a helper function to calculate this. host_memory_backend_pagesize() returns the host pagesize for a given HostMemoryBackend object. 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 'exec.c')
-rw-r--r--exec.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/exec.c b/exec.c
index b38b004..c7fcefa 100644
--- a/exec.c
+++ b/exec.c
@@ -1491,9 +1491,8 @@ static int find_max_supported_pagesize(Object *obj, void *opaque)
long *hpsize_min = opaque;
if (object_dynamic_cast(obj, TYPE_MEMORY_BACKEND)) {
- char *mem_path = object_property_get_str(obj, "mem-path", NULL);
- long hpsize = qemu_mempath_getpagesize(mem_path);
- g_free(mem_path);
+ long hpsize = host_memory_backend_pagesize(MEMORY_BACKEND(obj));
+
if (hpsize < *hpsize_min) {
*hpsize_min = hpsize;
}