Blame SOURCES/kvm-x86-Add-XFD-faulting-bit-for-state-components.patch

4841a6
From 098d6a965ada02f5897b73f0489413a050a176bb Mon Sep 17 00:00:00 2001
4841a6
From: Jing Liu <jing2.liu@intel.com>
4841a6
Date: Wed, 16 Feb 2022 22:04:30 -0800
4841a6
Subject: [PATCH 08/24] x86: Add XFD faulting bit for state components
4841a6
4841a6
RH-Author: Paul Lai <plai@redhat.com>
4841a6
RH-MergeRequest: 176: Enable KVM AMX support
4841a6
RH-Commit: [8/13] 0b1b46c5d075655ab94bc79e042b187c5dc55551
4841a6
RH-Bugzilla: 1916415
4841a6
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
4841a6
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
4841a6
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
4841a6
4841a6
Intel introduces XFD faulting mechanism for extended
4841a6
XSAVE features to dynamically enable the features in
4841a6
runtime. If CPUID (EAX=0Dh, ECX=n, n>1).ECX[2] is set
4841a6
as 1, it indicates support for XFD faulting of this
4841a6
state component.
4841a6
4841a6
Signed-off-by: Jing Liu <jing2.liu@intel.com>
4841a6
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
4841a6
Message-Id: <20220217060434.52460-5-yang.zhong@intel.com>
4841a6
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4841a6
(cherry picked from commit 0f17f6b30f3b051f0f96ccc98c9f7f395713699f)
4841a6
Signed-off-by: Paul Lai <plai@redhat.com>
4841a6
---
4841a6
 target/i386/cpu.c | 3 ++-
4841a6
 target/i386/cpu.h | 2 ++
4841a6
 2 files changed, 4 insertions(+), 1 deletion(-)
4841a6
4841a6
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
4841a6
index c19b51ea32..cd27c0eb81 100644
4841a6
--- a/target/i386/cpu.c
4841a6
+++ b/target/i386/cpu.c
4841a6
@@ -5503,7 +5503,8 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
4841a6
                 const ExtSaveArea *esa = &x86_ext_save_areas[count];
4841a6
                 *eax = esa->size;
4841a6
                 *ebx = esa->offset;
4841a6
-                *ecx = esa->ecx & ESA_FEATURE_ALIGN64_MASK;
4841a6
+                *ecx = esa->ecx &
4841a6
+                       (ESA_FEATURE_ALIGN64_MASK | ESA_FEATURE_XFD_MASK);
4841a6
             }
4841a6
         }
4841a6
         break;
4841a6
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
4841a6
index 58676390e6..f2bdef9c26 100644
4841a6
--- a/target/i386/cpu.h
4841a6
+++ b/target/i386/cpu.h
4841a6
@@ -555,8 +555,10 @@ typedef enum X86Seg {
4841a6
 #define XSTATE_DYNAMIC_MASK             (XSTATE_XTILE_DATA_MASK)
4841a6
 
4841a6
 #define ESA_FEATURE_ALIGN64_BIT         1
4841a6
+#define ESA_FEATURE_XFD_BIT             2
4841a6
 
4841a6
 #define ESA_FEATURE_ALIGN64_MASK        (1U << ESA_FEATURE_ALIGN64_BIT)
4841a6
+#define ESA_FEATURE_XFD_MASK            (1U << ESA_FEATURE_XFD_BIT)
4841a6
 
4841a6
 
4841a6
 /* CPUID feature words */
4841a6
-- 
4841a6
2.35.3
4841a6