From 49c04d7104408a8c95ca2e28bab5925f17bfde27 Mon Sep 17 00:00:00 2001 From: Eduardo Habkost Date: Mon, 26 Feb 2018 04:47:01 -0500 Subject: [PATCH] target-i386: Clear KVM CPUID features if KVM is disabled This will ensure all checks for features[FEAT_KVM] in the code will be correct in case the KVM CPUID leaf is completely disabled. Backports commit aec661de86894e914d2d82431d9cefa9a9a40213 from qemu --- qemu/target-i386/cpu.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/qemu/target-i386/cpu.c b/qemu/target-i386/cpu.c index 5bd5790e..62f6cb28 100644 --- a/qemu/target-i386/cpu.c +++ b/qemu/target-i386/cpu.c @@ -3023,6 +3023,11 @@ static int x86_cpu_realizefn(struct uc_struct *uc, DeviceState *dev, Error **err cpu->env.features[w] &= ~cpu->minus_features[w]; } + // Unicorn: commented out + //if (!kvm_enabled() || !cpu->expose_kvm) { + env->features[FEAT_KVM] = 0; + //} + x86_cpu_enable_xsave_components(cpu); /* CPUID[EAX=7,ECX=0].EBX always increased level automatically: */