From cbea0c26e718191b57783f847ad2c805670439e8 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 2 Apr 2015 14:13:55 +0200 Subject: [PATCH 1/6] target-i386: save 64-bit CR3 in 64-bit SMM state save area The x86_64 CR3 register is 64 bits wide, save all of them! Signed-off-by: Paolo Bonzini --- target-i386/smm_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target-i386/smm_helper.c b/target-i386/smm_helper.c index 58051d3bcc..c62f46847c 100644 --- a/target-i386/smm_helper.c +++ b/target-i386/smm_helper.c @@ -101,7 +101,7 @@ void do_smm_enter(X86CPU *cpu) stl_phys(cs->as, sm_state + 0x7f60, env->dr[7]); stl_phys(cs->as, sm_state + 0x7f48, env->cr[4]); - stl_phys(cs->as, sm_state + 0x7f50, env->cr[3]); + stq_phys(cs->as, sm_state + 0x7f50, env->cr[3]); stl_phys(cs->as, sm_state + 0x7f58, env->cr[0]); stl_phys(cs->as, sm_state + 0x7efc, SMM_REVISION_ID); @@ -236,7 +236,7 @@ void helper_rsm(CPUX86State *env) env->dr[7] = ldl_phys(cs->as, sm_state + 0x7f60); cpu_x86_update_cr4(env, ldl_phys(cs->as, sm_state + 0x7f48)); - cpu_x86_update_cr3(env, ldl_phys(cs->as, sm_state + 0x7f50)); + cpu_x86_update_cr3(env, ldq_phys(cs->as, sm_state + 0x7f50)); cpu_x86_update_cr0(env, ldl_phys(cs->as, sm_state + 0x7f58)); for (i = 0; i < 6; i++) { From 420957a5982113416c5e442687de5e1ffaffeafc Mon Sep 17 00:00:00 2001 From: Joseph Hindin Date: Wed, 1 Apr 2015 19:38:57 +0300 Subject: [PATCH 2/6] qga: fitering out -fstack-protector-strong configure script may add -fstack-protector-strong option instead of -fstack-protector-all, depending on availability ( see commit 63678e17c ). Both options have to by filtered out for qga-vss.dll, otherwise MinGW cross-compilation fails at linking stage. Signed-off-by: Joseph Hindin Message-Id: <1427906337-20805-2-git-send-email-jhindin@daynix.com> Signed-off-by: Paolo Bonzini --- qga/vss-win32/Makefile.objs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qga/vss-win32/Makefile.objs b/qga/vss-win32/Makefile.objs index 6a69d5008d..7c96c6b288 100644 --- a/qga/vss-win32/Makefile.objs +++ b/qga/vss-win32/Makefile.objs @@ -3,7 +3,7 @@ qga-vss-dll-obj-y += requester.o provider.o install.o obj-qga-vss-dll-obj-y = $(addprefix $(obj)/, $(qga-vss-dll-obj-y)) -$(obj-qga-vss-dll-obj-y): QEMU_CXXFLAGS = $(filter-out -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wold-style-declaration -Wold-style-definition -Wredundant-decls -fstack-protector-all, $(QEMU_CFLAGS)) -Wno-unknown-pragmas -Wno-delete-non-virtual-dtor +$(obj-qga-vss-dll-obj-y): QEMU_CXXFLAGS = $(filter-out -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wold-style-declaration -Wold-style-definition -Wredundant-decls -fstack-protector-all -fstack-protector-strong, $(QEMU_CFLAGS)) -Wno-unknown-pragmas -Wno-delete-non-virtual-dtor $(obj)/qga-vss.dll: LDFLAGS = -shared -Wl,--add-stdcall-alias,--enable-stdcall-fixup -lole32 -loleaut32 -lshlwapi -luuid -static $(obj)/qga-vss.dll: $(obj-qga-vss-dll-obj-y) $(SRC_PATH)/$(obj)/qga-vss.def From 9cb11fd7539b5b787d8fb3834004804a58dd16ae Mon Sep 17 00:00:00 2001 From: Nadav Amit Date: Thu, 2 Apr 2015 02:58:36 +0300 Subject: [PATCH 3/6] target-i386: clear bsp bit when designating bsp Since the BSP bit is writable on real hardware, during reset all the CPUs which were not chosen to be the BSP should have their BSP bit cleared. This fix is required for KVM to work correctly when it changes the BSP bit. An additional fix is required for QEMU tcg to allow software to change the BSP bit. Signed-off-by: Nadav Amit Message-Id: <1427932716-11800-1-git-send-email-namit@cs.technion.ac.il> Signed-off-by: Paolo Bonzini --- hw/intc/apic_common.c | 8 ++++++-- include/hw/i386/apic.h | 2 +- target-i386/cpu.c | 4 +--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/hw/intc/apic_common.c b/hw/intc/apic_common.c index 0858b45943..042e960f42 100644 --- a/hw/intc/apic_common.c +++ b/hw/intc/apic_common.c @@ -215,14 +215,18 @@ void apic_init_reset(DeviceState *dev) } } -void apic_designate_bsp(DeviceState *dev) +void apic_designate_bsp(DeviceState *dev, bool bsp) { if (dev == NULL) { return; } APICCommonState *s = APIC_COMMON(dev); - s->apicbase |= MSR_IA32_APICBASE_BSP; + if (bsp) { + s->apicbase |= MSR_IA32_APICBASE_BSP; + } else { + s->apicbase &= ~MSR_IA32_APICBASE_BSP; + } } static void apic_reset_common(DeviceState *dev) diff --git a/include/hw/i386/apic.h b/include/hw/i386/apic.h index 1d48e027c3..51eb6d3884 100644 --- a/include/hw/i386/apic.h +++ b/include/hw/i386/apic.h @@ -21,7 +21,7 @@ void apic_sipi(DeviceState *s); void apic_handle_tpr_access_report(DeviceState *d, target_ulong ip, TPRAccess access); void apic_poll_irq(DeviceState *d); -void apic_designate_bsp(DeviceState *d); +void apic_designate_bsp(DeviceState *d, bool bsp); /* pc.c */ DeviceState *cpu_get_current_apic(void); diff --git a/target-i386/cpu.c b/target-i386/cpu.c index b2d1c95df4..03b33cf3bd 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -2714,9 +2714,7 @@ static void x86_cpu_reset(CPUState *s) #if !defined(CONFIG_USER_ONLY) /* We hard-wire the BSP to the first CPU. */ - if (s->cpu_index == 0) { - apic_designate_bsp(cpu->apic_state); - } + apic_designate_bsp(cpu->apic_state, s->cpu_index == 0); s->halted = !cpu_is_bsp(cpu); From 0a7cf217d81161e36af2344e911d56d4f9fef9c5 Mon Sep 17 00:00:00 2001 From: Marcel Apfelbaum Date: Wed, 1 Apr 2015 19:47:21 +0300 Subject: [PATCH 4/6] util/qemu-config: fix regression of qmp_query_command_line_options Commit 49d2e64 (machine: remove qemu_machine_opts global list) made machine options specific to machine sub-type, leaving the qemu_machine_opts desc array empty. Sadly this is the place qmp_query_command_line_options is looking for supported options. As a fix for for 2.3 the machine_qemu_opts (the generic ones) are restored only for qemu-config scope. We need to find a better fix for 2.4. Reported-by: Tony Krowiak Signed-off-by: Marcel Apfelbaum Message-Id: <1427906841-1576-1-git-send-email-marcel@redhat.com> Signed-off-by: Paolo Bonzini --- util/qemu-config.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/util/qemu-config.c b/util/qemu-config.c index f3463df678..2d32ce7e91 100644 --- a/util/qemu-config.c +++ b/util/qemu-config.c @@ -6,6 +6,7 @@ #include "hw/qdev.h" #include "qapi/error.h" #include "qmp-commands.h" +#include "hw/i386/pc.h" static QemuOptsList *vm_config_groups[32]; static QemuOptsList *drive_config_groups[4]; @@ -148,6 +149,84 @@ static CommandLineParameterInfoList *get_drive_infolist(void) return head; } +/* restore machine options that are now machine's properties */ +static QemuOptsList machine_opts = { + .merge_lists = true, + .head = QTAILQ_HEAD_INITIALIZER(machine_opts.head), + .desc = { + { + .name = "type", + .type = QEMU_OPT_STRING, + .help = "emulated machine" + },{ + .name = "accel", + .type = QEMU_OPT_STRING, + .help = "accelerator list", + },{ + .name = "kernel_irqchip", + .type = QEMU_OPT_BOOL, + .help = "use KVM in-kernel irqchip", + },{ + .name = "kvm_shadow_mem", + .type = QEMU_OPT_SIZE, + .help = "KVM shadow MMU size", + },{ + .name = "kernel", + .type = QEMU_OPT_STRING, + .help = "Linux kernel image file", + },{ + .name = "initrd", + .type = QEMU_OPT_STRING, + .help = "Linux initial ramdisk file", + },{ + .name = "append", + .type = QEMU_OPT_STRING, + .help = "Linux kernel command line", + },{ + .name = "dtb", + .type = QEMU_OPT_STRING, + .help = "Linux kernel device tree file", + },{ + .name = "dumpdtb", + .type = QEMU_OPT_STRING, + .help = "Dump current dtb to a file and quit", + },{ + .name = "phandle_start", + .type = QEMU_OPT_NUMBER, + .help = "The first phandle ID we may generate dynamically", + },{ + .name = "dt_compatible", + .type = QEMU_OPT_STRING, + .help = "Overrides the \"compatible\" property of the dt root node", + },{ + .name = "dump-guest-core", + .type = QEMU_OPT_BOOL, + .help = "Include guest memory in a core dump", + },{ + .name = "mem-merge", + .type = QEMU_OPT_BOOL, + .help = "enable/disable memory merge support", + },{ + .name = "usb", + .type = QEMU_OPT_BOOL, + .help = "Set on/off to enable/disable usb", + },{ + .name = "firmware", + .type = QEMU_OPT_STRING, + .help = "firmware image", + },{ + .name = "iommu", + .type = QEMU_OPT_BOOL, + .help = "Set on/off to enable/disable Intel IOMMU (VT-d)", + },{ + .name = "suppress-vmdesc", + .type = QEMU_OPT_BOOL, + .help = "Set on to disable self-describing migration", + }, + { /* End of list */ } + } +}; + CommandLineOptionInfoList *qmp_query_command_line_options(bool has_option, const char *option, Error **errp) @@ -162,6 +241,8 @@ CommandLineOptionInfoList *qmp_query_command_line_options(bool has_option, info->option = g_strdup(vm_config_groups[i]->name); if (!strcmp("drive", vm_config_groups[i]->name)) { info->parameters = get_drive_infolist(); + } else if (!strcmp("machine", vm_config_groups[i]->name)) { + info->parameters = query_option_descs(machine_opts.desc); } else { info->parameters = query_option_descs(vm_config_groups[i]->desc); From 4cc856fabae1447d53890e707c70f257a7691174 Mon Sep 17 00:00:00 2001 From: zhanghailiang Date: Thu, 2 Apr 2015 19:26:31 +0000 Subject: [PATCH 5/6] kvm-all: Sync dirty-bitmap from kvm before kvm destroy the corresponding dirty_bitmap Sometimes, we destroy the dirty_bitmap in kvm_memory_slot before any sync action occur, this bit in dirty_bitmap will be missed, and which will lead the corresponding dirty pages to be missed in migration. This usually happens when do migration during VM's Start-up or Reboot. Signed-off-by: zhanghailiang [Use s->migration_log instead of exec.c's in_migration. - Paolo] Signed-off-by: Paolo Bonzini --- kvm-all.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kvm-all.c b/kvm-all.c index 335438adb5..dd44f8c753 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -715,7 +715,7 @@ static void kvm_set_phys_mem(MemoryRegionSection *section, bool add) old = *mem; - if (mem->flags & KVM_MEM_LOG_DIRTY_PAGES) { + if ((mem->flags & KVM_MEM_LOG_DIRTY_PAGES) || s->migration_log) { kvm_physical_sync_dirty_bitmap(section); } From fb8597bb65eff5c868db52668d21888e4fe7c27a Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Wed, 1 Apr 2015 13:58:38 -0400 Subject: [PATCH 6/6] Use $(MAKE) for recursive make On BSDs "make" is typically BSD make, while "gmake" is GNU make. Signed-off-by: Ed Maste Message-Id: <1427911118-21905-1-git-send-email-emaste@freebsd.org> [Fix $(INSTALLER) too as reported by Fam Zheng. - Paolo] Signed-off-by: Paolo Bonzini --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 88bce561a8..93af871dde 100644 --- a/Makefile +++ b/Makefile @@ -331,8 +331,8 @@ distclean: clean rm -rf $$d || exit 1 ; \ done rm -Rf .sdk - if test -f pixman/config.log; then make -C pixman distclean; fi - if test -f dtc/version_gen.h; then make $(DTC_MAKE_ARGS) clean; fi + if test -f pixman/config.log; then $(MAKE) -C pixman distclean; fi + if test -f dtc/version_gen.h; then $(MAKE) $(DTC_MAKE_ARGS) clean; fi KEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \ ar de en-us fi fr-be hr it lv nl pl ru th \ @@ -532,7 +532,7 @@ installer: $(INSTALLER) INSTDIR=/tmp/qemu-nsis $(INSTALLER): $(SRC_PATH)/qemu.nsi - make install prefix=${INSTDIR} + $(MAKE) install prefix=${INSTDIR} ifdef SIGNCODE (cd ${INSTDIR}; \ for i in *.exe; do \