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