aboutsummaryrefslogtreecommitdiff
path: root/target/i386
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2020-06-23 19:01:16 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2020-06-26 09:39:40 -0400
commit730319aef0fcb94f11a4a2d32656437fdde7efdd (patch)
tree389d5ba8b684ff387a88bd6f57ac24c94b2e91b5 /target/i386
parentc8d7fd059d73a7d3035e379c319034c30ba3dbbf (diff)
downloadqemu-730319aef0fcb94f11a4a2d32656437fdde7efdd.zip
qemu-730319aef0fcb94f11a4a2d32656437fdde7efdd.tar.gz
qemu-730319aef0fcb94f11a4a2d32656437fdde7efdd.tar.bz2
i386: Mask SVM features if nested SVM is disabled
QEMU incorrectly validates FEAT_SVM feature flags against GET_SUPPORTED_CPUID even if SVM features are being masked out by cpu_x86_cpuid(). This can make QEMU print warnings on most AMD CPU models, even when SVM nesting is disabled (which is the default). This bug was never detected before because of a Linux KVM bug: until Linux v5.6, KVM was not filtering out SVM features in GET_SUPPORTED_CPUID when nested was disabled. This KVM bug was fixed in Linux v5.7-rc1, on Linux commit a50718cc3f43 ("KVM: nSVM: Expose SVM features to L1 iff nested is enabled"). Fix the problem by adding a CPUID_EXT3_SVM dependency to all FEAT_SVM feature flags in the feature_dependencies table. Reported-by: Yanan Fu <yfu@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <20200623230116.277409-1-ehabkost@redhat.com> [Fix testcase. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'target/i386')
-rw-r--r--target/i386/cpu.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 06dc013..36cbd3d 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -1404,6 +1404,10 @@ static FeatureDep feature_dependencies[] = {
.from = { FEAT_VMX_SECONDARY_CTLS, VMX_SECONDARY_EXEC_ENABLE_VMFUNC },
.to = { FEAT_VMX_VMFUNC, ~0ull },
},
+ {
+ .from = { FEAT_8000_0001_ECX, CPUID_EXT3_SVM },
+ .to = { FEAT_SVM, ~0ull },
+ },
};
typedef struct X86RegisterInfo32 {