aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/kvm/lib/kvm_util_internal.h
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2018-07-28 18:09:44 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2018-08-06 17:32:02 +0200
commit2305339ee7129d9d56af3bdd4d59aff4d29ed390 (patch)
tree4f3fdd0a7e31a8b7f2ebf9f68221898aa043f24c /tools/testing/selftests/kvm/lib/kvm_util_internal.h
parentKVM: x86: ensure all MSRs can always be KVM_GET/SET_MSR'd (diff)
downloadlinux-dev-2305339ee7129d9d56af3bdd4d59aff4d29ed390.tar.xz
linux-dev-2305339ee7129d9d56af3bdd4d59aff4d29ed390.zip
kvm: selftests: create a GDT and TSS
The GDT and the TSS base were left to zero, and this has interesting effects when the TSS descriptor is later read to set up a VMCS's TR_BASE. Basically it worked by chance, and this patch fixes it by setting up all the protected mode data structures properly. Because the GDT and TSS addresses are virtual, the page tables now always exist at the time of vcpu setup. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tools/testing/selftests/kvm/lib/kvm_util_internal.h')
-rw-r--r--tools/testing/selftests/kvm/lib/kvm_util_internal.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/testing/selftests/kvm/lib/kvm_util_internal.h b/tools/testing/selftests/kvm/lib/kvm_util_internal.h
index a0bd1980c81c..cbb40288890a 100644
--- a/tools/testing/selftests/kvm/lib/kvm_util_internal.h
+++ b/tools/testing/selftests/kvm/lib/kvm_util_internal.h
@@ -51,13 +51,16 @@ struct kvm_vm {
struct userspace_mem_region *userspace_mem_region_head;
struct sparsebit *vpages_valid;
struct sparsebit *vpages_mapped;
+
bool pgd_created;
vm_paddr_t pgd;
+ vm_vaddr_t gdt;
+ vm_vaddr_t tss;
};
struct vcpu *vcpu_find(struct kvm_vm *vm,
uint32_t vcpuid);
-void vcpu_setup(struct kvm_vm *vm, int vcpuid);
+void vcpu_setup(struct kvm_vm *vm, int vcpuid, int pgd_memslot, int gdt_memslot);
void virt_dump(FILE *stream, struct kvm_vm *vm, uint8_t indent);
void regs_dump(FILE *stream, struct kvm_regs *regs,
uint8_t indent);