mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-23 05:56:14 -04:00
KVM: selftests: Add a fully functional "struct xstate" for x86
Add a working xstate data structure for the usage of AMX and potential future usage on other xstate components. AMX selftest requires checking both the xstate_bv and xcomp_bv. Existing code relies on pointer arithmetics to fetch xstate_bv and does not support xcomp_bv. So, add a working xstate data structure into processor.h for x86. Suggested-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Mingwei Zhang <mizhang@google.com> Link: https://lore.kernel.org/r/20230221163655.920289-3-mizhang@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
This commit is contained in:
committed by
Sean Christopherson
parent
735b0e0f2d
commit
5de4a3765b
@@ -48,6 +48,18 @@ extern bool host_cpu_is_amd;
|
||||
#define X86_CR4_SMAP (1ul << 21)
|
||||
#define X86_CR4_PKE (1ul << 22)
|
||||
|
||||
struct xstate_header {
|
||||
u64 xstate_bv;
|
||||
u64 xcomp_bv;
|
||||
u64 reserved[6];
|
||||
} __attribute__((packed));
|
||||
|
||||
struct xstate {
|
||||
u8 i387[512];
|
||||
struct xstate_header header;
|
||||
u8 extended_state_area[0];
|
||||
} __attribute__ ((packed, aligned (64)));
|
||||
|
||||
/* Note, these are ordered alphabetically to match kvm_cpuid_entry2. Eww. */
|
||||
enum cpuid_output_regs {
|
||||
KVM_CPUID_EAX,
|
||||
|
||||
Reference in New Issue
Block a user