Skip to content

Commit a2834e6

Browse files
committed
KVM: selftests: Allocate x86's TSS at VM creation
Allocate x86's per-VM TSS at creation of a non-barebones VM. Like the GDT, the TSS is needed to actually run vCPUs, i.e. every non-barebones VM is all but guaranteed to allocate the TSS sooner or later. Reviewed-by: Ackerley Tng <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent 23ef21f commit a2834e6

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -520,9 +520,6 @@ vm_paddr_t addr_arch_gva2gpa(struct kvm_vm *vm, vm_vaddr_t gva)
520520
static void kvm_setup_tss_64bit(struct kvm_vm *vm, struct kvm_segment *segp,
521521
int selector)
522522
{
523-
if (!vm->arch.tss)
524-
vm->arch.tss = __vm_vaddr_alloc_page(vm, MEM_REGION_DATA);
525-
526523
memset(segp, 0, sizeof(*segp));
527524
segp->base = vm->arch.tss;
528525
segp->limit = 0x67;
@@ -620,6 +617,8 @@ static void vm_init_descriptor_tables(struct kvm_vm *vm)
620617
vm->arch.gdt = __vm_vaddr_alloc_page(vm, MEM_REGION_DATA);
621618
vm->arch.idt = __vm_vaddr_alloc_page(vm, MEM_REGION_DATA);
622619
vm->handlers = __vm_vaddr_alloc_page(vm, MEM_REGION_DATA);
620+
vm->arch.tss = __vm_vaddr_alloc_page(vm, MEM_REGION_DATA);
621+
623622
/* Handlers have the same address in both address spaces.*/
624623
for (i = 0; i < NUM_INTERRUPTS; i++)
625624
set_idt_entry(vm, i, (unsigned long)(&idt_handlers)[i], 0,

0 commit comments

Comments
 (0)