File 0063-target-i386-cpu.c-special-case-SEV-.patch of Package qemu.12238
From: Bruce Rogers <brogers@suse.com>
Date: Tue, 6 Aug 2019 19:16:25 -0600
Subject: target/i386/cpu.c: special case SEV xlevel handling on old machine
types
While we wait for a better vetted upstream solution, lets check for SEV
usage as we decide what value to use for the cpuid xlevel. Both explicit
setting of xlevel as well as the use of a machine type of 2_11 or
earlier will bypass the xlevel setting needed for SEV usage. It is wrong
to bypass the explicit xlevel setting for SEV usage, and highly unlikely
that someone is explicitly setting xlevel to something for an SEV
enabled guest, so assume the earlier case to have a workable SEV guest.
[BR: BSC#1144087]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
target/i386/cpu.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index fd1e032af1..abee39029f 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -5091,7 +5091,8 @@ static void x86_cpu_expand_features(X86CPU *cpu, Error **errp)
if (env->cpuid_level == UINT32_MAX) {
env->cpuid_level = env->cpuid_min_level;
}
- if (env->cpuid_xlevel == UINT32_MAX) {
+ if (env->cpuid_xlevel == UINT32_MAX ||
+ (cpu->full_cpuid_auto_level && sev_enabled())) {
env->cpuid_xlevel = env->cpuid_min_xlevel;
}
if (env->cpuid_xlevel2 == UINT32_MAX) {