summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Christopherson <seanjc@google.com>2024-03-14 16:26:31 -0700
committerSean Christopherson <seanjc@google.com>2024-04-29 12:55:17 -0700
commit2a511ca994933ba02309c65401d88cbf4f19630e (patch)
treed091b6b65dcb8e8d65eda07a3a5a5537fbac1d45
parent44c93b27726928a7b28eca233f7a504b92bc8f88 (diff)
KVM: selftests: Allocate x86's GDT during VM creation
Allocate the GDT during creation of non-barebones VMs instead of waiting until the first vCPU is created, as the whole point of non-barebones VMs is to be able to run vCPUs, i.e. the GDT is going to get allocated no matter what. Reviewed-by: Ackerley Tng <ackerleytng@google.com> Link: https://lore.kernel.org/r/20240314232637.2538648-13-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
-rw-r--r--tools/testing/selftests/kvm/lib/x86_64/processor.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/tools/testing/selftests/kvm/lib/x86_64/processor.c b/tools/testing/selftests/kvm/lib/x86_64/processor.c
index ff800b860913..7ac77dd970ca 100644
--- a/tools/testing/selftests/kvm/lib/x86_64/processor.c
+++ b/tools/testing/selftests/kvm/lib/x86_64/processor.c
@@ -519,9 +519,6 @@ vm_paddr_t addr_arch_gva2gpa(struct kvm_vm *vm, vm_vaddr_t gva)
static void kvm_setup_gdt(struct kvm_vm *vm, struct kvm_dtable *dt)
{
- if (!vm->arch.gdt)
- vm->arch.gdt = __vm_vaddr_alloc_page(vm, MEM_REGION_DATA);
-
dt->base = vm->arch.gdt;
dt->limit = getpagesize() - 1;
}
@@ -645,6 +642,7 @@ static void vm_init_descriptor_tables(struct kvm_vm *vm)
extern void *idt_handlers;
int i;
+ vm->arch.gdt = __vm_vaddr_alloc_page(vm, MEM_REGION_DATA);
vm->arch.idt = __vm_vaddr_alloc_page(vm, MEM_REGION_DATA);
vm->handlers = __vm_vaddr_alloc_page(vm, MEM_REGION_DATA);
/* Handlers have the same address in both address spaces.*/