From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55849) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d38bE-0007tp-Gn for qemu-devel@nongnu.org; Tue, 25 Apr 2017 18:06:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d38bB-0006JH-4g for qemu-devel@nongnu.org; Tue, 25 Apr 2017 18:06:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39984) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d38bA-0006IJ-S2 for qemu-devel@nongnu.org; Tue, 25 Apr 2017 18:06:17 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DC4723D97F for ; Tue, 25 Apr 2017 22:06:15 +0000 (UTC) From: Juan Quintela Date: Wed, 26 Apr 2017 00:04:50 +0200 Message-Id: <20170425220451.6028-41-quintela@redhat.com> In-Reply-To: <20170425220451.6028-1-quintela@redhat.com> References: <20170425220451.6028-1-quintela@redhat.com> Subject: [Qemu-devel] [PATCH 40/41] migration: Make savevm.c target independent List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: dgilbert@redhat.com, lvivier@redhat.com, peterx@redhat.com It only needed TARGET_PAGE_SIZE/BITS/BITS_MIN values, so just export them from exec.h Signed-off-by: Juan Quintela --- Makefile.target | 2 +- exec.c | 9 +++++++++ include/exec/target_page.h | 2 ++ migration/Makefile.objs | 2 +- migration/savevm.c | 14 +++++++------- 5 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Makefile.target b/Makefile.target index e62021d..4020b01 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) # xen support diff --git a/exec.c b/exec.c index e9a201a..447ac63 100644 --- a/exec.c +++ b/exec.c @@ -3387,6 +3387,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 0961591..e3a19cc 100644 --- a/include/exec/target_page.h +++ b/include/exec/target_page.h @@ -16,5 +16,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 775e4ad..4277c88 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 global_state.o diff --git a/migration/savevm.c b/migration/savevm.c index 6a47dcd..2e5f6a4 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" @@ -315,7 +314,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) @@ -326,7 +325,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; } @@ -341,9 +340,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; } @@ -359,7 +358,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 = { @@ -1165,7 +1165,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) { -- 2.9.3