Received: by 2002:ab2:2994:0:b0:1ef:ca3e:3cd5 with SMTP id n20csp446388lqb; Thu, 14 Mar 2024 16:36:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVdI3eVPPoC+zhcWIohIkGoCD1D2ldbomh8L2JInUwPz8CvrOi9Ma22N57t8A14L5R253d59T3K7IAC5U1hKq9866b/D7lCzEOmIum5og== X-Google-Smtp-Source: AGHT+IHDGn3IY/fkqZyNZUWqKHCceJPof9aDWaXsVAq1qOsacsjK0yCx43HORJFcxDddxbBQks55 X-Received: by 2002:a05:6a20:9c90:b0:1a3:4314:f4a0 with SMTP id mj16-20020a056a209c9000b001a34314f4a0mr2830977pzb.26.1710459365017; Thu, 14 Mar 2024 16:36:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710459365; cv=pass; d=google.com; s=arc-20160816; b=SO818dapSW+NqoXrh16sGYCXtV2dreD1MxAn1U+URxuHpRU130RMJSXNuOqkqe5OUm izWDcDUm4UFp4zeGlzCSPunWgLckbO+8dPsNXYuCKrrHbNG6BZX3zdGSYT8fzXZrwbWM qIapv6tcxl/XZpnkvHaMfecIKtKbsvpDUjgY7iKjBhGAnuV93vIRyNH9wgiYonBfNiqF mOkfDH3gzaj6qORUFDeXXJzzGwzy7bObLT+JYgJtMc05FdGrsIMFRZd6VWKugvafYUIF 4Xpe1oXe1lTV3Z69pG+EfHRxm7kPkgwkjDIay5wuWterRIjA/sCIMyd0UlPEhqAf2DuT CoNg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :reply-to:dkim-signature; bh=uF6G18lAXQi7SGjNgTcxotaL8n8pv6tjDstW0Eyh3/8=; fh=vk4Xy0sbxrvyOesWIa2L8wEDKphxOip8aDW50XpF5pc=; b=OhZUBRfGwYErwMkCWPQAmnqb+q6yPxtj9nxfqoPupMc0OAhtxbfeN+m46PeSS57dy+ U/DqwB4kIIMD/g4ZQnVQpPBkTVQ554SveyPLuSrQKdn5XjX1FHIQzx4eU2zbQ1VEbom3 JJ1qhEquXXw3xtaNxjgDXowptp0TCJhtXtN8Hij6RQh+/bI+YX2gH9bMlcF4QuzpYWBE 16evyhFuTJnd8AZYojxITFsYyFcIALoTX1wsiZ2SDA3dE8gHhzG02mr2zo9Vn30CVEd3 hJqGjZl+V5Lw9BRxZi272uKb28ZDuE0LgdO/fXoIa/AC/jd9fDqATsZoGkwcnX3Izk9d fmEg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=ReKB1Qn2; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-103907-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103907-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id w9-20020a17090a15c900b0029c3e321f18si1552291pjd.71.2024.03.14.16.36.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Mar 2024 16:36:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-103907-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=ReKB1Qn2; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-103907-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103907-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id B0CF2282EEB for ; Thu, 14 Mar 2024 23:36:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 969885786A; Thu, 14 Mar 2024 23:27:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ReKB1Qn2" Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C097254FA7 for ; Thu, 14 Mar 2024 23:27:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710458830; cv=none; b=gWm9JWCwDvZJuBBTGIHY6medieKxp3xP2+wfz6+sLojxaRWj94SVt1MqiPOmlx1UEREpmKL2u4F3xyLM6kFQX1bL5if9OQYxGJdWCyYjaVGPYeoft+hZbFrDeipHSz3DuxykphwMpWOc9cTxstkbN8k5bAkHi3W/dm/ZgpVMVpA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710458830; c=relaxed/simple; bh=jUV1XZXOApDn8WUrRGJsIujEhPRAE62JvDa/WRT16zw=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=I9Hwntw52di28OYqoXRa9Tj/cNYkqgimCG95MyBYdOhaV7zALR1/FIWQP6MxvjaykR+YdMbDM8KDswaCsvtp4Oo9+TDxJdjkIZDKvg+qGIXwRbSAdfz+vmbqhb5OhJjzgEXnQnvpkPfNDIJQLFd0Pr3RCqt5pjKrO/MXrTwEOEI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=ReKB1Qn2; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dc6dbdcfd39so2618220276.2 for ; Thu, 14 Mar 2024 16:27:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1710458828; x=1711063628; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=uF6G18lAXQi7SGjNgTcxotaL8n8pv6tjDstW0Eyh3/8=; b=ReKB1Qn2+k9AbxeqOKDN15hZigiNAx4WBg47yVUrPgZ996NzhhQqOptjWcfpVPTPio lRkMdf9UykW4zGTBTzW10IS7BowxAtBwgSrNihTarK2kV0jUvW0BrI0oWKHrFsDjmtX0 UEIIvioN5dm0sYs44R1joQ4oBrgrgr+r4i33+y5PzYXpJhG/D90UqJFt9YB0A/p0b/yz beyrI4dd0QzJ0VzK5z3QhGzi1yxo4Nxka5zDSwojvsw57mXibBRYOkkyb1Gc1ZqhLC89 9gfEUSYnjQyTF8OBBA3bnPU2ge7WRoJa4ryjGe+i+QVxO8XYcOgGmhjX9d056olnjryk ujjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710458828; x=1711063628; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=uF6G18lAXQi7SGjNgTcxotaL8n8pv6tjDstW0Eyh3/8=; b=ViAA2/63VLMNm93xkIUCgT8UQ8tpfnREjUglHVesugOhsqMWG+KkZUMhIBWzJhtWfb ExQcCk4vXv0jT26KU7VJpZHV61QLq9GjpGZr+LmA/dPrf2Hy8C/gfoF0gaErvbm2IoE4 da5S4nCg7JCk1BX6Fr/SCScrenUvl+XgK63+No1Ff1KBX2dPKU6Uqi8gI4QbsxHA/mao r4TkeOFDAmNGHcSamO7YZ5gFbU0JPHMKBVCe0JUWnTBxUAgzE3wBRnk3khlRRHsUlmRm PAppK2dQs2hu8s/sgbk19UdolRZQ3pZyFWca2BBP3llWdsP8VVIbKZN7008HYfbJkU2q Ormw== X-Forwarded-Encrypted: i=1; AJvYcCU8jm6i+izLFatBeowehpmprjZIJTfS5NqIpQUS4LzSS5qdo+YwJ5/9hLFPl4XLkLyFooDoir08o1gPmC1cnZBBNs1I74+25MNvlNfg X-Gm-Message-State: AOJu0Yy0mDliv6aZfolznkVxWqZw+OGRfmI+VRra2+49/LTVhj9wc0dE HfN+TPxPjlt9m7FgjmiB5XZXJQIVAuuFNvPTvxv2PJbAf7ktiXsz9eUDVyLNyX4vfmBDlai0cc2 iog== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:6902:18d5:b0:dc7:68b5:4f21 with SMTP id ck21-20020a05690218d500b00dc768b54f21mr168369ybb.9.1710458827844; Thu, 14 Mar 2024 16:27:07 -0700 (PDT) Reply-To: Sean Christopherson Date: Thu, 14 Mar 2024 16:26:34 -0700 In-Reply-To: <20240314232637.2538648-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240314232637.2538648-1-seanjc@google.com> X-Mailer: git-send-email 2.44.0.291.gc1ea87d7ee-goog Message-ID: <20240314232637.2538648-16-seanjc@google.com> Subject: [PATCH 15/18] KVM: selftests: Allocate x86's TSS at VM creation From: Sean Christopherson To: Marc Zyngier , Oliver Upton , Paolo Bonzini , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Sean Christopherson , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Ackerley Tng Content-Type: text/plain; charset="UTF-8" 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. Signed-off-by: Sean Christopherson --- tools/testing/selftests/kvm/lib/x86_64/processor.c | 5 ++--- 1 file changed, 2 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 5cf845975f66..03b9387a1d2e 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_tss_64bit(struct kvm_vm *vm, struct kvm_segment *segp, int selector) { - if (!vm->arch.tss) - vm->arch.tss = __vm_vaddr_alloc_page(vm, MEM_REGION_DATA); - memset(segp, 0, sizeof(*segp)); segp->base = vm->arch.tss; segp->limit = 0x67; @@ -619,6 +616,8 @@ static void vm_init_descriptor_tables(struct kvm_vm *vm) 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); + vm->arch.tss = __vm_vaddr_alloc_page(vm, MEM_REGION_DATA); + /* Handlers have the same address in both address spaces.*/ for (i = 0; i < NUM_INTERRUPTS; i++) set_idt_entry(vm, i, (unsigned long)(&idt_handlers)[i], 0, -- 2.44.0.291.gc1ea87d7ee-goog