target-i386: Disable SVM by default in KVM mode

Make SVM be disabled by default on all CPU models when in KVM mode.
Nested SVM is enabled by default in the KVM kernel module, but it is
probably less stable than nested VMX (which is already disabled by
default).

Add a new compat function, x86_cpu_compat_kvm_no_autodisable(), to keep
compatibility on previous machine-types.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
Eduardo Habkost 2014-10-03 16:39:51 -03:00 committed by Andreas Färber
parent e93abc147f
commit 75d373ef97
4 changed files with 9 additions and 0 deletions

View File

@ -306,6 +306,7 @@ static void pc_compat_2_1(MachineState *machine)
{
x86_cpu_compat_set_features("coreduo", FEAT_1_ECX, CPUID_EXT_VMX, 0);
x86_cpu_compat_set_features("core2duo", FEAT_1_ECX, CPUID_EXT_VMX, 0);
x86_cpu_compat_kvm_no_autodisable(FEAT_8000_0001_ECX, CPUID_EXT3_SVM);
}
static void pc_compat_2_0(MachineState *machine)

View File

@ -285,6 +285,7 @@ static void pc_compat_2_1(MachineState *machine)
{
x86_cpu_compat_set_features("coreduo", FEAT_1_ECX, CPUID_EXT_VMX, 0);
x86_cpu_compat_set_features("core2duo", FEAT_1_ECX, CPUID_EXT_VMX, 0);
x86_cpu_compat_kvm_no_autodisable(FEAT_8000_0001_ECX, CPUID_EXT3_SVM);
}
static void pc_compat_2_0(MachineState *machine)

View File

@ -461,6 +461,7 @@ static uint32_t kvm_default_features[FEATURE_WORDS] = {
static uint32_t kvm_default_unset_features[FEATURE_WORDS] = {
[FEAT_1_EDX] = CPUID_ACPI,
[FEAT_1_ECX] = CPUID_EXT_MONITOR,
[FEAT_8000_0001_ECX] = CPUID_EXT3_SVM,
};
void x86_cpu_compat_kvm_no_autoenable(FeatureWord w, uint32_t features)
@ -468,6 +469,11 @@ void x86_cpu_compat_kvm_no_autoenable(FeatureWord w, uint32_t features)
kvm_default_features[w] &= ~features;
}
void x86_cpu_compat_kvm_no_autodisable(FeatureWord w, uint32_t features)
{
kvm_default_unset_features[w] &= ~features;
}
/*
* Returns the set of feature flags that are supported and migratable by
* QEMU, for a given FeatureWord.

View File

@ -1366,6 +1366,7 @@ void x86_cpu_compat_set_features(const char *cpu_model, FeatureWord w,
uint32_t feat_add, uint32_t feat_remove);
void x86_cpu_compat_kvm_no_autoenable(FeatureWord w, uint32_t features);
void x86_cpu_compat_kvm_no_autodisable(FeatureWord w, uint32_t features);
/* Return name of 32-bit register, from a R_* constant */