]> git.baikalelectronics.ru Git - kernel.git/commitdiff
selftest: kvm: Move struct kvm_x86_state to header
authorYang Zhong <yang.zhong@intel.com>
Thu, 23 Dec 2021 14:53:21 +0000 (09:53 -0500)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 14 Jan 2022 18:44:44 +0000 (13:44 -0500)
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>
tools/testing/selftests/kvm/include/x86_64/processor.h
tools/testing/selftests/kvm/lib/x86_64/processor.c

index 58633e51960f0640b5c7f20c4bcb8b8e6d4b91f7..e94ba0fc67d80ba072ee410eb2c2aec4e8897d29 100644 (file)
@@ -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);
index 93264424aee57366ab97a6d267eeb570c5b6745b..babb0f28575c71bdad93cf8c3e1a0d40dbeadd2e 100644 (file)
@@ -1056,21 +1056,6 @@ void vcpu_dump(FILE *stream, struct kvm_vm *vm, uint32_t vcpuid, uint8_t indent)
        sregs_dump(stream, &sregs, indent + 4);
 }
 
-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 int kvm_get_num_msrs_fd(int kvm_fd)
 {
        struct kvm_msr_list nmsrs;