73f313
From b082e420af608c6b060e29e392e0a7fa0655298d Mon Sep 17 00:00:00 2001
73f313
From: Eduardo Habkost <ehabkost@redhat.com>
73f313
Date: Thu, 3 Oct 2019 22:12:16 +0200
73f313
Subject: [PATCH 2/4] i386: Disable OSPKE on Cascadelake-Server
73f313
73f313
RH-Author: Eduardo Habkost <ehabkost@redhat.com>
73f313
Message-id: <20191003221217.8527-3-ehabkost@redhat.com>
73f313
Patchwork-id: 90953
73f313
O-Subject: [RHEL-7.8 qemu-kvm PATCH 2/3] i386: Disable OSPKE on Cascadelake-Server
73f313
Bugzilla: 1638471
73f313
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
73f313
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
73f313
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
73f313
73f313
This is a partial cherry pick of upstream commit:
73f313
73f313
commit bb4928c7cafe50ab2137a0034e350ef1bfa044d9
73f313
Author: Eduardo Habkost <ehabkost@redhat.com>
73f313
Date:   Tue Mar 19 17:05:15 2019 -0300
73f313
73f313
    i386: Disable OSPKE on CPU model definitions
73f313
73f313
    Currently, the Cascadelake-Server, Icelake-Client, and
73f313
    Icelake-Server are always generating the following warning:
73f313
73f313
      qemu-system-x86_64: warning: \
73f313
        host doesn't support requested feature: CPUID.07H:ECX [bit 4]
73f313
73f313
    This happens because OSPKE was never returned by
73f313
    GET_SUPPORTED_CPUID or x86_cpu_get_supported_feature_word().
73f313
    OSPKE is a runtime flag automatically set by the KVM module or by
73f313
    TCG code, was always cleared by x86_cpu_filter_features(), and
73f313
    was not supposed to appear on the CPU model table.
73f313
73f313
    Remove the OSPKE flag from the CPU model table entries, to avoid
73f313
    the bogus warning and avoid returning invalid feature data on
73f313
    query-cpu-* QMP commands.  As OSPKE was always cleared by
73f313
    x86_cpu_filter_features(), this won't have any guest-visible
73f313
    impact.
73f313
73f313
    Include a test case that should detect the problem if we introduce
73f313
    a similar bug again.
73f313
73f313
    Fixes: c7a88b52f62b ("i386: Add new model of Cascadelake-Server")
73f313
    Fixes: 8a11c62da914 ("i386: Add new CPU model Icelake-{Server,Client}")
73f313
    Cc: Tao Xu <tao3.xu@intel.com>
73f313
    Cc: Robert Hoo <robert.hu@linux.intel.com>
73f313
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
73f313
    Message-Id: <20190319200515.14999-1-ehabkost@redhat.com>
73f313
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
73f313
73f313
It includes only the Cascadelake-Server change, because Icelake*
73f313
is not present in the RHEL7 tree.
73f313
73f313
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
73f313
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
73f313
---
73f313
 target-i386/cpu.c | 2 +-
73f313
 1 file changed, 1 insertion(+), 1 deletion(-)
73f313
73f313
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
73f313
index 5b988c9..926373b 100644
73f313
--- a/target-i386/cpu.c
73f313
+++ b/target-i386/cpu.c
73f313
@@ -1531,7 +1531,7 @@ static x86_def_t builtin_x86_defs[] = {
73f313
             CPUID_7_0_EBX_AVX512VL | CPUID_7_0_EBX_CLFLUSHOPT |
73f313
             CPUID_7_0_EBX_INTEL_PT,
73f313
         .features[FEAT_7_0_ECX] =
73f313
-            CPUID_7_0_ECX_PKU | CPUID_7_0_ECX_OSPKE |
73f313
+            CPUID_7_0_ECX_PKU |
73f313
             CPUID_7_0_ECX_AVX512VNNI,
73f313
         .features[FEAT_7_0_EDX] =
73f313
             CPUID_7_0_EDX_SPEC_CTRL | CPUID_7_0_EDX_SPEC_CTRL_SSBD,
73f313
-- 
73f313
1.8.3.1
73f313