From 990e0be2603511560168e1ad61f68294d951c39e Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 24 Jul 2018 13:59:21 +0200 Subject: [PATCH 1/4] i386: do not migrate MSR_SMI_COUNT on machine types <2.12 MSR_SMI_COUNT started being migrated in QEMU 2.12. Do not migrate it on older machine types, or the subsection causes a load failure for guests that use SMM. Signed-off-by: Paolo Bonzini --- include/hw/i386/pc.h | 4 ++++ target/i386/cpu.c | 2 ++ target/i386/cpu.h | 1 + target/i386/machine.c | 2 +- 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 654003f44c..6894f37df1 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -317,6 +317,10 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); #define PC_COMPAT_2_11 \ HW_COMPAT_2_11 \ {\ + .driver = TYPE_X86_CPU,\ + .property = "x-migrate-smi-count",\ + .value = "off",\ + },{\ .driver = "Skylake-Server" "-" TYPE_X86_CPU,\ .property = "clflushopt",\ .value = "off",\ diff --git a/target/i386/cpu.c b/target/i386/cpu.c index f454d4beb3..723e02221e 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -5435,6 +5435,8 @@ static Property x86_cpu_properties[] = { false), DEFINE_PROP_BOOL("vmware-cpuid-freq", X86CPU, vmware_cpuid_freq, true), DEFINE_PROP_BOOL("tcg-cpuid", X86CPU, expose_tcg, true), + DEFINE_PROP_BOOL("x-migrate-smi-count", X86CPU, migrate_smi_count, + true), /* * lecacy_cache defaults to true unless the CPU model provides its * own cache information (see x86_cpu_load_def()). diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 194e2e6b92..c18863ec7a 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1379,6 +1379,7 @@ struct X86CPU { bool expose_kvm; bool expose_tcg; bool migratable; + bool migrate_smi_count; bool max_features; /* Enable all supported features automatically */ uint32_t apic_id; diff --git a/target/i386/machine.c b/target/i386/machine.c index 8b64dff487..084c2c73a8 100644 --- a/target/i386/machine.c +++ b/target/i386/machine.c @@ -400,7 +400,7 @@ static bool msr_smi_count_needed(void *opaque) X86CPU *cpu = opaque; CPUX86State *env = &cpu->env; - return env->msr_smi_count != 0; + return cpu->migrate_smi_count && env->msr_smi_count != 0; } static const VMStateDescription vmstate_msr_smi_count = { From 1d3db6bdbb0b541744cc9e008371ec7a37986d8a Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 24 Jul 2018 13:59:40 +0200 Subject: [PATCH 2/4] i386: implement MSR_SMI_COUNT for TCG This is trivial, so just do it. Signed-off-by: Paolo Bonzini --- target/i386/misc_helper.c | 3 +++ target/i386/smm_helper.c | 1 + 2 files changed, 4 insertions(+) diff --git a/target/i386/misc_helper.c b/target/i386/misc_helper.c index 628f64aad5..78f2020ef2 100644 --- a/target/i386/misc_helper.c +++ b/target/i386/misc_helper.c @@ -447,6 +447,9 @@ void helper_rdmsr(CPUX86State *env) val = env->tsc_aux; break; #endif + case MSR_SMI_COUNT: + val = env->msr_smi_count; + break; case MSR_MTRRphysBase(0): case MSR_MTRRphysBase(1): case MSR_MTRRphysBase(2): diff --git a/target/i386/smm_helper.c b/target/i386/smm_helper.c index 90621e5977..c1c34a75db 100644 --- a/target/i386/smm_helper.c +++ b/target/i386/smm_helper.c @@ -54,6 +54,7 @@ void do_smm_enter(X86CPU *cpu) qemu_log_mask(CPU_LOG_INT, "SMM: enter\n"); log_cpu_state_mask(CPU_LOG_INT, CPU(cpu), CPU_DUMP_CCOP); + env->msr_smi_count++; env->hflags |= HF_SMM_MASK; if (env->hflags2 & HF2_NMI_MASK) { env->hflags2 |= HF2_SMM_INSIDE_NMI_MASK; From e4dab9449a41d1bc61e4866c6fe2582513ddbff4 Mon Sep 17 00:00:00 2001 From: Pavel Dovgalyuk Date: Wed, 25 Jul 2018 15:15:26 +0300 Subject: [PATCH 3/4] timer: remove replay clock probe in deadline calculation Ciro Santilli reported that commit a5ed352596a8b7eb2f9acce34371b944ac3056c4 breaks the execution replay. It happens due to the probing the clock for the new instances of iothread. However, this probing was made in replay mode for the timer lists that are empty. This patch removes clock probing in replay mode. It is an artifact of the old version with another thread model. Signed-off-by: Pavel Dovgalyuk Message-Id: <20180725121526.12867.17866.stgit@pasha-VirtualBox> Signed-off-by: Paolo Bonzini --- util/qemu-timer.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/util/qemu-timer.c b/util/qemu-timer.c index 2ed1bf2778..86bfe84037 100644 --- a/util/qemu-timer.c +++ b/util/qemu-timer.c @@ -578,17 +578,10 @@ int64_t timerlistgroup_deadline_ns(QEMUTimerListGroup *tlg) { int64_t deadline = -1; QEMUClockType type; - bool play = replay_mode == REPLAY_MODE_PLAY; for (type = 0; type < QEMU_CLOCK_MAX; type++) { if (qemu_clock_use_for_deadline(type)) { - if (!play || type == QEMU_CLOCK_REALTIME) { - deadline = qemu_soonest_timeout(deadline, - timerlist_deadline_ns(tlg->tl[type])); - } else { - /* Read clock from the replay file and - do not calculate the deadline, based on virtual clock. */ - qemu_clock_get_ns(type); - } + deadline = qemu_soonest_timeout(deadline, + timerlist_deadline_ns(tlg->tl[type])); } } return deadline; From cc4c77e12b422db8a685cec97866950895a684bc Mon Sep 17 00:00:00 2001 From: Jay Zhou Date: Sat, 28 Apr 2018 13:54:24 +0800 Subject: [PATCH 4/4] backends/cryptodev: remove dead code Fix Coverity issue 1390600. Signed-off-by: Jay Zhou Message-Id: <1524894864-7492-1-git-send-email-jianjay.zhou@huawei.com> Reviewed-by: Stefan Hajnoczi Signed-off-by: Paolo Bonzini --- backends/cryptodev-vhost-user.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/backends/cryptodev-vhost-user.c b/backends/cryptodev-vhost-user.c index d52daccfcd..d539f14d59 100644 --- a/backends/cryptodev-vhost-user.c +++ b/backends/cryptodev-vhost-user.c @@ -157,7 +157,6 @@ static void cryptodev_vhost_user_event(void *opaque, int event) { CryptoDevBackendVhostUser *s = opaque; CryptoDevBackend *b = CRYPTODEV_BACKEND(s); - Error *err = NULL; int queues = b->conf.peers.queues; assert(queues < MAX_CRYPTO_QUEUE_NUM); @@ -174,10 +173,6 @@ static void cryptodev_vhost_user_event(void *opaque, int event) cryptodev_vhost_user_stop(queues, s); break; } - - if (err) { - error_report_err(err); - } } static void cryptodev_vhost_user_init(