diff options
author | Juan Quintela <quintela@redhat.com> | 2017-04-24 21:03:48 +0200 |
---|---|---|
committer | Juan Quintela <quintela@redhat.com> | 2017-05-18 19:21:00 +0200 |
commit | 46d702b106d20beda2fcd0f96ddc44855ba262b3 (patch) | |
tree | ce122bd7827f2bcc9120e28fb1bf63b498f18fd4 | |
parent | 51180423a226adbd80d64bf75b8522256b1266f1 (diff) |
migration: Make savevm.c target independent
It only needed TARGET_PAGE_SIZE/BITS/BITS_MIN values, so just export
them from exec.h
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
-rw-r--r-- | Makefile.target | 2 | ||||
-rw-r--r-- | exec.c | 9 | ||||
-rw-r--r-- | include/exec/target_page.h | 2 | ||||
-rw-r--r-- | migration/Makefile.objs | 2 | ||||
-rw-r--r-- | migration/savevm.c | 14 |
5 files changed, 20 insertions, 9 deletions
diff --git a/Makefile.target b/Makefile.target index 465a633367..ce8dfe44a8 100644 --- a/Makefile.target +++ b/Makefile.target @@ -146,7 +146,7 @@ obj-$(CONFIG_KVM) += kvm-all.o obj-y += memory.o cputlb.o obj-y += memory_mapping.o obj-y += dump.o -obj-y += migration/ram.o migration/savevm.o +obj-y += migration/ram.o LIBS := $(libs_softmmu) $(LIBS) # Hardware support @@ -3444,6 +3444,15 @@ size_t qemu_target_page_size(void) return TARGET_PAGE_SIZE; } +int qemu_target_page_bits(void) +{ + return TARGET_PAGE_BITS; +} + +int qemu_target_page_bits_min(void) +{ + return TARGET_PAGE_BITS_MIN; +} #endif /* diff --git a/include/exec/target_page.h b/include/exec/target_page.h index 626eda8029..96726c36a4 100644 --- a/include/exec/target_page.h +++ b/include/exec/target_page.h @@ -15,5 +15,7 @@ #define EXEC_TARGET_PAGE_H size_t qemu_target_page_size(void); +int qemu_target_page_bits(void); +int qemu_target_page_bits_min(void); #endif diff --git a/migration/Makefile.objs b/migration/Makefile.objs index 3272415de8..90f8c1f177 100644 --- a/migration/Makefile.objs +++ b/migration/Makefile.objs @@ -1,5 +1,5 @@ common-obj-y += migration.o socket.o fd.o exec.o -common-obj-y += tls.o channel.o +common-obj-y += tls.o channel.o savevm.o common-obj-y += colo-comm.o colo.o colo-failover.o common-obj-y += vmstate.o vmstate-types.o page_cache.o common-obj-y += qemu-file.o diff --git a/migration/savevm.c b/migration/savevm.c index 8763700bd5..d971e5ee47 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -27,7 +27,6 @@ */ #include "qemu/osdep.h" -#include "cpu.h" #include "hw/boards.h" #include "hw/hw.h" #include "hw/qdev.h" @@ -288,7 +287,7 @@ static void configuration_pre_save(void *opaque) state->len = strlen(current_name); state->name = current_name; - state->target_page_bits = TARGET_PAGE_BITS; + state->target_page_bits = qemu_target_page_bits(); } static int configuration_pre_load(void *opaque) @@ -299,7 +298,7 @@ static int configuration_pre_load(void *opaque) * predates the variable-target-page-bits support and is using the * minimum possible value for this CPU. */ - state->target_page_bits = TARGET_PAGE_BITS_MIN; + state->target_page_bits = qemu_target_page_bits_min(); return 0; } @@ -314,9 +313,9 @@ static int configuration_post_load(void *opaque, int version_id) return -EINVAL; } - if (state->target_page_bits != TARGET_PAGE_BITS) { + if (state->target_page_bits != qemu_target_page_bits()) { error_report("Received TARGET_PAGE_BITS is %d but local is %d", - state->target_page_bits, TARGET_PAGE_BITS); + state->target_page_bits, qemu_target_page_bits()); return -EINVAL; } @@ -332,7 +331,8 @@ static int configuration_post_load(void *opaque, int version_id) */ static bool vmstate_target_page_bits_needed(void *opaque) { - return TARGET_PAGE_BITS > TARGET_PAGE_BITS_MIN; + return qemu_target_page_bits() + > qemu_target_page_bits_min(); } static const VMStateDescription vmstate_target_page_bits = { @@ -1138,7 +1138,7 @@ void qemu_savevm_state_complete_precopy(QEMUFile *f, bool iterable_only) } vmdesc = qjson_new(); - json_prop_int(vmdesc, "page_size", TARGET_PAGE_SIZE); + json_prop_int(vmdesc, "page_size", qemu_target_page_size()); json_start_array(vmdesc, "devices"); QTAILQ_FOREACH(se, &savevm_state.handlers, entry) { |