thebeanogamer / rpms / qemu-kvm

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