cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-i386-Disable-OSPKE-on-CPU-model-definitions-NEW.patch

Pablo Greco e6a3ae
From 04f34e7c0b0fada186ca7012f5f4168f46483c5f Mon Sep 17 00:00:00 2001
Pablo Greco e6a3ae
From: "plai@redhat.com" <plai@redhat.com>
Pablo Greco e6a3ae
Date: Mon, 1 Jul 2019 16:17:34 +0100
Pablo Greco e6a3ae
Subject: [PATCH 05/39] i386: Disable OSPKE on CPU model definitions
Pablo Greco e6a3ae
Pablo Greco e6a3ae
RH-Author: plai@redhat.com
Pablo Greco e6a3ae
Message-id: <1561997854-9646-6-git-send-email-plai@redhat.com>
Pablo Greco e6a3ae
Patchwork-id: 89334
Pablo Greco e6a3ae
O-Subject: [RHEL8.1 qemu-kvm PATCH v6 5/5] i386: Disable OSPKE on CPU model definitions
Pablo Greco e6a3ae
Bugzilla: 1629906
Pablo Greco e6a3ae
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
Pablo Greco e6a3ae
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Pablo Greco e6a3ae
RH-Acked-by: Bandan Das <bsd@redhat.com>
Pablo Greco e6a3ae
Pablo Greco e6a3ae
From: Eduardo Habkost <ehabkost@redhat.com>
Pablo Greco e6a3ae
Pablo Greco e6a3ae
Currently, the Cascadelake-Server, Icelake-Client, and
Pablo Greco e6a3ae
Icelake-Server are always generating the following warning:
Pablo Greco e6a3ae
Pablo Greco e6a3ae
  qemu-system-x86_64: warning: \
Pablo Greco e6a3ae
    host doesn't support requested feature: CPUID.07H:ECX [bit 4]
Pablo Greco e6a3ae
Pablo Greco e6a3ae
This happens because OSPKE was never returned by
Pablo Greco e6a3ae
GET_SUPPORTED_CPUID or x86_cpu_get_supported_feature_word().
Pablo Greco e6a3ae
OSPKE is a runtime flag automatically set by the KVM module or by
Pablo Greco e6a3ae
TCG code, was always cleared by x86_cpu_filter_features(), and
Pablo Greco e6a3ae
was not supposed to appear on the CPU model table.
Pablo Greco e6a3ae
Pablo Greco e6a3ae
Remove the OSPKE flag from the CPU model table entries, to avoid
Pablo Greco e6a3ae
the bogus warning and avoid returning invalid feature data on
Pablo Greco e6a3ae
query-cpu-* QMP commands.  As OSPKE was always cleared by
Pablo Greco e6a3ae
x86_cpu_filter_features(), this won't have any guest-visible
Pablo Greco e6a3ae
impact.
Pablo Greco e6a3ae
Pablo Greco e6a3ae
Include a test case that should detect the problem if we introduce
Pablo Greco e6a3ae
a similar bug again.
Pablo Greco e6a3ae
Pablo Greco e6a3ae
Fixes: c7a88b52f62b ("i386: Add new model of Cascadelake-Server")
Pablo Greco e6a3ae
Fixes: 8a11c62da914 ("i386: Add new CPU model Icelake-{Server,Client}")
Pablo Greco e6a3ae
Cc: Tao Xu <tao3.xu@intel.com>
Pablo Greco e6a3ae
Cc: Robert Hoo <robert.hu@linux.intel.com>
Pablo Greco e6a3ae
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Pablo Greco e6a3ae
Message-Id: <20190319200515.14999-1-ehabkost@redhat.com>
Pablo Greco e6a3ae
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Pablo Greco e6a3ae
(cherry picked from commit bb4928c7cafe50ab2137a0034e350ef1bfa044d9)
Pablo Greco e6a3ae
Signed-off-by: Paul Lai <plai@redhat.com>
Pablo Greco e6a3ae
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
Pablo Greco e6a3ae
Pablo Greco e6a3ae
Conflicts:
Pablo Greco e6a3ae
	target/i386/cpu.c
Pablo Greco e6a3ae
Pablo Greco e6a3ae
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
Pablo Greco e6a3ae
---
Pablo Greco e6a3ae
 target/i386/cpu.c | 2 +-
Pablo Greco e6a3ae
 1 file changed, 1 insertion(+), 1 deletion(-)
Pablo Greco e6a3ae
Pablo Greco e6a3ae
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
Pablo Greco e6a3ae
index 2538d82..af62281 100644
Pablo Greco e6a3ae
--- a/target/i386/cpu.c
Pablo Greco e6a3ae
+++ b/target/i386/cpu.c
Pablo Greco e6a3ae
@@ -2517,7 +2517,7 @@ static X86CPUDefinition builtin_x86_defs[] = {
Pablo Greco e6a3ae
             CPUID_7_0_EBX_AVX512BW | CPUID_7_0_EBX_AVX512CD |
Pablo Greco e6a3ae
             CPUID_7_0_EBX_AVX512VL | CPUID_7_0_EBX_CLFLUSHOPT,
Pablo Greco e6a3ae
         .features[FEAT_7_0_ECX] =
Pablo Greco e6a3ae
-            CPUID_7_0_ECX_PKU | CPUID_7_0_ECX_OSPKE |
Pablo Greco e6a3ae
+            CPUID_7_0_ECX_PKU |
Pablo Greco e6a3ae
             CPUID_7_0_ECX_AVX512VNNI,
Pablo Greco e6a3ae
         .features[FEAT_7_0_EDX] =
Pablo Greco e6a3ae
             CPUID_7_0_EDX_SPEC_CTRL | CPUID_7_0_EDX_SPEC_CTRL_SSBD,
Pablo Greco e6a3ae
-- 
Pablo Greco e6a3ae
1.8.3.1
Pablo Greco e6a3ae