Blob Blame Raw
From 04f34e7c0b0fada186ca7012f5f4168f46483c5f Mon Sep 17 00:00:00 2001
From: "" <>
Date: Mon, 1 Jul 2019 16:17:34 +0100
Subject: [PATCH 05/39] i386: Disable OSPKE on CPU model definitions

Message-id: <>
Patchwork-id: 89334
O-Subject: [RHEL8.1 qemu-kvm PATCH v6 5/5] i386: Disable OSPKE on CPU model definitions
Bugzilla: 1629906
RH-Acked-by: Eduardo Habkost <>
RH-Acked-by: Paolo Bonzini <>
RH-Acked-by: Bandan Das <>

From: Eduardo Habkost <>

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 <>
(cherry picked from commit bb4928c7cafe50ab2137a0034e350ef1bfa044d9)
Signed-off-by: Paul Lai <>
Signed-off-by: Danilo C. L. de Paula <>


Signed-off-by: Danilo C. L. de Paula <>
 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 2538d82..af62281 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -2517,7 +2517,7 @@ static X86CPUDefinition builtin_x86_defs[] = {
             CPUID_7_0_EBX_AVX512BW | CPUID_7_0_EBX_AVX512CD |
             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] =