Skip to content

Commit 2a511ca

Browse files
committed
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>
1 parent 44c93b2 commit 2a511ca

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

tools/testing/selftests/kvm/lib/x86_64/processor.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -519,9 +519,6 @@ vm_paddr_t addr_arch_gva2gpa(struct kvm_vm *vm, vm_vaddr_t gva)
519519

520520
static void kvm_setup_gdt(struct kvm_vm *vm, struct kvm_dtable *dt)
521521
{
522-
if (!vm->arch.gdt)
523-
vm->arch.gdt = __vm_vaddr_alloc_page(vm, MEM_REGION_DATA);
524-
525522
dt->base = vm->arch.gdt;
526523
dt->limit = getpagesize() - 1;
527524
}
@@ -645,6 +642,7 @@ static void vm_init_descriptor_tables(struct kvm_vm *vm)
645642
extern void *idt_handlers;
646643
int i;
647644

645+
vm->arch.gdt = __vm_vaddr_alloc_page(vm, MEM_REGION_DATA);
648646
vm->arch.idt = __vm_vaddr_alloc_page(vm, MEM_REGION_DATA);
649647
vm->handlers = __vm_vaddr_alloc_page(vm, MEM_REGION_DATA);
650648
/* Handlers have the same address in both address spaces.*/

0 commit comments

Comments
 (0)