Blob Blame History Raw
From b082e420af608c6b060e29e392e0a7fa0655298d Mon Sep 17 00:00:00 2001
From: Eduardo Habkost <>
Date: Thu, 3 Oct 2019 22:12:16 +0200
Subject: [PATCH 2/4] i386: Disable OSPKE on Cascadelake-Server

RH-Author: Eduardo Habkost <>
Message-id: <>
Patchwork-id: 90953
O-Subject: [RHEL-7.8 qemu-kvm PATCH 2/3] i386: Disable OSPKE on Cascadelake-Server
Bugzilla: 1638471
RH-Acked-by: Dr. David Alan Gilbert <>
RH-Acked-by: Paolo Bonzini <>
RH-Acked-by: Igor Mammedov <>

This is a partial cherry pick of upstream commit:

commit bb4928c7cafe50ab2137a0034e350ef1bfa044d9
Author: Eduardo Habkost <>
Date:   Tue Mar 19 17:05:15 2019 -0300

    i386: Disable OSPKE on CPU model definitions

    Currently, the Cascadelake-Server, Icelake-Client, and
    Icelake-Server are always generating the following warning:

      qemu-system-x86_64: warning: \
        host doesn't support requested feature: CPUID.07H:ECX [bit 4]

    This happens because OSPKE was never returned by
    GET_SUPPORTED_CPUID or x86_cpu_get_supported_feature_word().
    OSPKE is a runtime flag automatically set by the KVM module or by
    TCG code, was always cleared by x86_cpu_filter_features(), and
    was not supposed to appear on the CPU model table.

    Remove the OSPKE flag from the CPU model table entries, to avoid
    the bogus warning and avoid returning invalid feature data on
    query-cpu-* QMP commands.  As OSPKE was always cleared by
    x86_cpu_filter_features(), this won't have any guest-visible

    Include a test case that should detect the problem if we introduce
    a similar bug again.

    Fixes: c7a88b52f62b ("i386: Add new model of Cascadelake-Server")
    Fixes: 8a11c62da914 ("i386: Add new CPU model Icelake-{Server,Client}")
    Cc: Tao Xu <>
    Cc: Robert Hoo <>
    Signed-off-by: Eduardo Habkost <>
    Message-Id: <>
    Signed-off-by: Eduardo Habkost <>

It includes only the Cascadelake-Server change, because Icelake*
is not present in the RHEL7 tree.

Signed-off-by: Eduardo Habkost <>
Signed-off-by: Miroslav Rezanina <>
 target-i386/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 5b988c9..926373b 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1531,7 +1531,7 @@ static x86_def_t builtin_x86_defs[] = {
             CPUID_7_0_EBX_AVX512VL | CPUID_7_0_EBX_CLFLUSHOPT |
         .features[FEAT_7_0_ECX] =
-            CPUID_7_0_ECX_PKU | CPUID_7_0_ECX_OSPKE |
+            CPUID_7_0_ECX_PKU |
         .features[FEAT_7_0_EDX] =