[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 13/22] x86: Fix the 64-byte boundary enumeration for extended stat
From: |
Paolo Bonzini |
Subject: |
[PULL 13/22] x86: Fix the 64-byte boundary enumeration for extended state |
Date: |
Tue, 8 Mar 2022 12:34:36 +0100 |
From: Jing Liu <jing2.liu@intel.com>
The extended state subleaves (EAX=0Dh, ECX=n, n>1).ECX[1]
indicate whether the extended state component locates
on the next 64-byte boundary following the preceding state
component when the compacted format of an XSAVE area is
used.
Right now, they are all zero because no supported component
needed the bit to be set, but the upcoming AMX feature will
use it. Fix the subleaves value according to KVM's supported
cpuid.
Signed-off-by: Jing Liu <jing2.liu@intel.com>
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Message-Id: <20220217060434.52460-2-yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
target/i386/cpu.c | 1 +
target/i386/cpu.h | 6 ++++++
target/i386/kvm/kvm-cpu.c | 1 +
3 files changed, 8 insertions(+)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 6c7ef1099b..0f3c477dfc 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -5488,6 +5488,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index,
uint32_t count,
const ExtSaveArea *esa = &x86_ext_save_areas[count];
*eax = esa->size;
*ebx = esa->offset;
+ *ecx = esa->ecx & ESA_FEATURE_ALIGN64_MASK;
}
}
break;
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index e69ab5dd78..7bd9d58505 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -550,6 +550,11 @@ typedef enum X86Seg {
#define XSTATE_Hi16_ZMM_MASK (1ULL << XSTATE_Hi16_ZMM_BIT)
#define XSTATE_PKRU_MASK (1ULL << XSTATE_PKRU_BIT)
+#define ESA_FEATURE_ALIGN64_BIT 1
+
+#define ESA_FEATURE_ALIGN64_MASK (1U << ESA_FEATURE_ALIGN64_BIT)
+
+
/* CPUID feature words */
typedef enum FeatureWord {
FEAT_1_EDX, /* CPUID[1].EDX */
@@ -1356,6 +1361,7 @@ QEMU_BUILD_BUG_ON(sizeof(XSavePKRU) != 0x8);
typedef struct ExtSaveArea {
uint32_t feature, bits;
uint32_t offset, size;
+ uint32_t ecx;
} ExtSaveArea;
#define XSAVE_STATE_AREA_COUNT (XSTATE_PKRU_BIT + 1)
diff --git a/target/i386/kvm/kvm-cpu.c b/target/i386/kvm/kvm-cpu.c
index d95028018e..ce27d3b1df 100644
--- a/target/i386/kvm/kvm-cpu.c
+++ b/target/i386/kvm/kvm-cpu.c
@@ -104,6 +104,7 @@ static void kvm_cpu_xsave_init(void)
if (sz != 0) {
assert(esa->size == sz);
esa->offset = kvm_arch_get_supported_cpuid(s, 0xd, i, R_EBX);
+ esa->ecx = kvm_arch_get_supported_cpuid(s, 0xd, i, R_ECX);
}
}
}
--
2.35.1
- [PULL 03/22] vmxcap: Add 5-level EPT bit, (continued)
- [PULL 03/22] vmxcap: Add 5-level EPT bit, Paolo Bonzini, 2022/03/08
- [PULL 06/22] qga/vss: update informative message about MinGW, Paolo Bonzini, 2022/03/08
- [PULL 05/22] qga/vss-win32: check old VSS SDK headers, Paolo Bonzini, 2022/03/08
- [PULL 14/22] x86: Add AMX XTILECFG and XTILEDATA components, Paolo Bonzini, 2022/03/08
- [PULL 17/22] x86: Add AMX CPUIDs enumeration, Paolo Bonzini, 2022/03/08
- [PULL 12/22] linux-headers: include missing changes from 5.17, Paolo Bonzini, 2022/03/08
- [PULL 07/22] update meson-buildoptions.sh, Paolo Bonzini, 2022/03/08
- [PULL 08/22] kvm-irqchip: introduce new API to support route change, Paolo Bonzini, 2022/03/08
- [PULL 10/22] target/i386: only include bits in pg_mode if they are not ignored, Paolo Bonzini, 2022/03/08
- [PULL 09/22] kvm/msi: do explicit commit when adding msi routes, Paolo Bonzini, 2022/03/08
- [PULL 13/22] x86: Fix the 64-byte boundary enumeration for extended state,
Paolo Bonzini <=
- [PULL 16/22] x86: Add XFD faulting bit for state components, Paolo Bonzini, 2022/03/08
- [PULL 18/22] x86: add support for KVM_CAP_XSAVE2 and AMX state migration, Paolo Bonzini, 2022/03/08
- [PULL 20/22] i386: Add Icelake-Server-v6 CPU model with 5-level EPT support, Paolo Bonzini, 2022/03/08
- [PULL 15/22] x86: Grant AMX permission for guest, Paolo Bonzini, 2022/03/08
- Re: [PULL 15/22] x86: Grant AMX permission for guest, Peter Krempa, 2022/03/16
- Re: [PULL 15/22] x86: Grant AMX permission for guest, Daniel P . Berrangé, 2022/03/16
- Re: [PULL 15/22] x86: Grant AMX permission for guest, Paolo Bonzini, 2022/03/16
- Re: [PULL 15/22] x86: Grant AMX permission for guest, David Edmondson, 2022/03/16
- Re: [PULL 15/22] x86: Grant AMX permission for guest, Daniel P . Berrangé, 2022/03/16
- Re: [PULL 15/22] x86: Grant AMX permission for guest, Maxim Levitsky, 2022/03/17