qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

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>

+20 -9
+1 -1
Makefile.target
··· 146 146 obj-y += memory.o cputlb.o 147 147 obj-y += memory_mapping.o 148 148 obj-y += dump.o 149 - obj-y += migration/ram.o migration/savevm.o 149 + obj-y += migration/ram.o 150 150 LIBS := $(libs_softmmu) $(LIBS) 151 151 152 152 # Hardware support
+9
exec.c
··· 3444 3444 return TARGET_PAGE_SIZE; 3445 3445 } 3446 3446 3447 + int qemu_target_page_bits(void) 3448 + { 3449 + return TARGET_PAGE_BITS; 3450 + } 3451 + 3452 + int qemu_target_page_bits_min(void) 3453 + { 3454 + return TARGET_PAGE_BITS_MIN; 3455 + } 3447 3456 #endif 3448 3457 3449 3458 /*
+2
include/exec/target_page.h
··· 15 15 #define EXEC_TARGET_PAGE_H 16 16 17 17 size_t qemu_target_page_size(void); 18 + int qemu_target_page_bits(void); 19 + int qemu_target_page_bits_min(void); 18 20 19 21 #endif
+1 -1
migration/Makefile.objs
··· 1 1 common-obj-y += migration.o socket.o fd.o exec.o 2 - common-obj-y += tls.o channel.o 2 + common-obj-y += tls.o channel.o savevm.o 3 3 common-obj-y += colo-comm.o colo.o colo-failover.o 4 4 common-obj-y += vmstate.o vmstate-types.o page_cache.o 5 5 common-obj-y += qemu-file.o
+7 -7
migration/savevm.c
··· 27 27 */ 28 28 29 29 #include "qemu/osdep.h" 30 - #include "cpu.h" 31 30 #include "hw/boards.h" 32 31 #include "hw/hw.h" 33 32 #include "hw/qdev.h" ··· 288 287 289 288 state->len = strlen(current_name); 290 289 state->name = current_name; 291 - state->target_page_bits = TARGET_PAGE_BITS; 290 + state->target_page_bits = qemu_target_page_bits(); 292 291 } 293 292 294 293 static int configuration_pre_load(void *opaque) ··· 299 298 * predates the variable-target-page-bits support and is using the 300 299 * minimum possible value for this CPU. 301 300 */ 302 - state->target_page_bits = TARGET_PAGE_BITS_MIN; 301 + state->target_page_bits = qemu_target_page_bits_min(); 303 302 return 0; 304 303 } 305 304 ··· 314 313 return -EINVAL; 315 314 } 316 315 317 - if (state->target_page_bits != TARGET_PAGE_BITS) { 316 + if (state->target_page_bits != qemu_target_page_bits()) { 318 317 error_report("Received TARGET_PAGE_BITS is %d but local is %d", 319 - state->target_page_bits, TARGET_PAGE_BITS); 318 + state->target_page_bits, qemu_target_page_bits()); 320 319 return -EINVAL; 321 320 } 322 321 ··· 332 331 */ 333 332 static bool vmstate_target_page_bits_needed(void *opaque) 334 333 { 335 - return TARGET_PAGE_BITS > TARGET_PAGE_BITS_MIN; 334 + return qemu_target_page_bits() 335 + > qemu_target_page_bits_min(); 336 336 } 337 337 338 338 static const VMStateDescription vmstate_target_page_bits = { ··· 1138 1138 } 1139 1139 1140 1140 vmdesc = qjson_new(); 1141 - json_prop_int(vmdesc, "page_size", TARGET_PAGE_SIZE); 1141 + json_prop_int(vmdesc, "page_size", qemu_target_page_size()); 1142 1142 json_start_array(vmdesc, "devices"); 1143 1143 QTAILQ_FOREACH(se, &savevm_state.handlers, entry) { 1144 1144