[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 6/7] target/i386: Adjust AMD XSAVE PKRU area offset in CPUID
From: |
David Edmondson |
Subject: |
[RFC PATCH 6/7] target/i386: Adjust AMD XSAVE PKRU area offset in CPUID leaf 0xd |
Date: |
Thu, 20 May 2021 15:56:46 +0100 |
AMD stores the pkru_state at a different offset to Intel, so update
the CPUID leaf which indicates such.
Signed-off-by: David Edmondson <david.edmondson@oracle.com>
---
target/i386/cpu.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 4f481691b4..9340a477a3 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -1397,7 +1397,7 @@ typedef struct ExtSaveArea {
uint32_t offset, size;
} ExtSaveArea;
-static const ExtSaveArea x86_ext_save_areas[] = {
+static ExtSaveArea x86_ext_save_areas[] = {
[XSTATE_FP_BIT] = {
/* x87 FP state component is always enabled if XSAVE is supported */
.feature = FEAT_1_ECX, .bits = CPUID_EXT_XSAVE,
@@ -6088,6 +6088,11 @@ static void x86_cpu_filter_features(X86CPU *cpu, bool
verbose)
mark_unavailable_features(cpu, FEAT_7_0_EBX,
CPUID_7_0_EBX_INTEL_PT, prefix);
}
}
+
+ if (IS_AMD_CPU(env)) {
+ x86_ext_save_areas[XSTATE_PKRU_BIT].offset =
+ offsetof(X86XSaveArea, amd.pkru_state);
+ }
}
static void x86_cpu_hyperv_realize(X86CPU *cpu)
--
2.30.2
- [RFC PATCH 0/7] Support protection keys in an AMD EPYC-Milan VM, David Edmondson, 2021/05/20
- [RFC PATCH 1/7] target/i386: Declare constants for XSAVE offsets, David Edmondson, 2021/05/20
- [RFC PATCH 3/7] target/i386: Clarify the padding requirements of X86XSaveArea, David Edmondson, 2021/05/20
- [RFC PATCH 4/7] target/i386: Prepare for per-vendor X86XSaveArea layout, David Edmondson, 2021/05/20
- [RFC PATCH 5/7] target/i386: Introduce AMD X86XSaveArea sub-union, David Edmondson, 2021/05/20
- [RFC PATCH 6/7] target/i386: Adjust AMD XSAVE PKRU area offset in CPUID leaf 0xd,
David Edmondson <=
- [RFC PATCH 2/7] target/i386: Use constants for XSAVE offsets, David Edmondson, 2021/05/20
- [RFC PATCH 7/7] target/i386: Manipulate only AMD XSAVE state on AMD, David Edmondson, 2021/05/20
- Re: [RFC PATCH 0/7] Support protection keys in an AMD EPYC-Milan VM, no-reply, 2021/05/20