summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/kvm/include/x86_64
diff options
context:
space:
mode:
authorYang Zhong <yang.zhong@intel.com>2021-12-23 15:53:21 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2022-01-14 19:44:44 +0100
commit6559b4a523cd65f6005b4592833b16ba970abdf5 (patch)
treef2e99e15f9e6c843f45b1970d27ee73f08ba8dbb /tools/testing/selftests/kvm/include/x86_64
parentselftest: kvm: Reorder vcpu_load_state steps for AMX (diff)
downloadlinux-6559b4a523cd65f6005b4592833b16ba970abdf5.tar.xz
linux-6559b4a523cd65f6005b4592833b16ba970abdf5.zip
selftest: kvm: Move struct kvm_x86_state to header
Those changes can avoid dereferencing pointer compile issue when amx_test.c reference state->xsave. Move struct kvm_x86_state definition to processor.h. Signed-off-by: Yang Zhong <yang.zhong@intel.com> Message-Id: <20211223145322.2914028-3-yang.zhong@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tools/testing/selftests/kvm/include/x86_64')
-rw-r--r--tools/testing/selftests/kvm/include/x86_64/processor.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/tools/testing/selftests/kvm/include/x86_64/processor.h b/tools/testing/selftests/kvm/include/x86_64/processor.h
index 58633e51960f..e94ba0fc67d8 100644
--- a/tools/testing/selftests/kvm/include/x86_64/processor.h
+++ b/tools/testing/selftests/kvm/include/x86_64/processor.h
@@ -94,6 +94,21 @@ struct desc_ptr {
uint64_t address;
} __attribute__((packed));
+struct kvm_x86_state {
+ struct kvm_xsave *xsave;
+ struct kvm_vcpu_events events;
+ struct kvm_mp_state mp_state;
+ struct kvm_regs regs;
+ struct kvm_xcrs xcrs;
+ struct kvm_sregs sregs;
+ struct kvm_debugregs debugregs;
+ union {
+ struct kvm_nested_state nested;
+ char nested_[16384];
+ };
+ struct kvm_msrs msrs;
+};
+
static inline uint64_t get_desc64_base(const struct desc64 *desc)
{
return ((uint64_t)desc->base3 << 32) |
@@ -350,7 +365,6 @@ static inline unsigned long get_xmm(int n)
bool is_intel_cpu(void);
-struct kvm_x86_state;
struct kvm_x86_state *vcpu_save_state(struct kvm_vm *vm, uint32_t vcpuid);
void vcpu_load_state(struct kvm_vm *vm, uint32_t vcpuid,
struct kvm_x86_state *state);