Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp678759rdb; Thu, 22 Feb 2024 16:43:24 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWMvdA7EH81rXbdoD3r5vL/GPYqsWF3oYgO6sGbrA9pPy0xurT32I1rrcCYYIl1QFztnzaI4HgeBCAQo9JlLU19dp8F8dYpmTX5mSuyQg== X-Google-Smtp-Source: AGHT+IH4hYFvYwCNHqMjJOq9cTSzArS4uWbV9mHTwFqsM3GdvZv55PXhM/Gfu/Nnrpa3FTZnbHPL X-Received: by 2002:ac8:5a47:0:b0:42e:401d:2fa1 with SMTP id o7-20020ac85a47000000b0042e401d2fa1mr924136qta.2.1708649004274; Thu, 22 Feb 2024 16:43:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708649004; cv=pass; d=google.com; s=arc-20160816; b=cEqe+qpGaewexHp5qKzpF/HcN6z21d81UFxkaUFLdSiPlFzBM4xho13bIX5CTP9EPc CjjCR+pqE/o+U64ZxNImpd91GShrDcZ2V7Ldww/oX53wLN7z9N9YMJX/RSCxLk1cmgZa DCYxRbZ8X5Ul7N7ywLRdNqF9/9nWtF9vp0pBseNXYowMQISBOqKAQ2oV/DUXZGvavFqD 0zc2HTybWX13LHldcxxJfjZ3hO5wLQOL55iINogg5yXDy35IVXdB51XXEE7us5Pmk3QZ rYQ8Mzb5n4ie8yhwnIhazZntriomQug2wTUcjWrG3cLFMIn7LZ+KJBIBCUMpLKGVjK5U iWjw== 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=S8c8bYa8F6WSgYnQg5Ml3mIasYavsfmgJ65i8xz9FOg=; fh=FAAV72/zItnd4/mjua2ekSWY4f2ukRzsDAl4NOK4vss=; b=MjPBmF5Rm3T391+AwJajkxc+ie8ctUecWUAxaaOkhtK1aEcBtERTAUbCWvFDSwSnnc x8IIxA53kQK3eH3uJFOvpUfE7zDHYCJJsjTSPEKE6vNrBksrY4dRSeCTb3hSVB1B/0sB f3f7DeUfGp5msxsYEpXbOmm9ohJ4rC5gCKp+piJHbo+JfDgKMht6+jEEW8qTlvyvJfh7 nmO2IAP8d+XvqHAMBl3uZXswFgOS2Jm2OeBN0jxa63jVMK5OIeD8voZZFNpSUjxX1AbU dP1nNy+hjnrGBdEIv5H3iRS8VKn1lb56rsdgc1GZ9o7+PdHyVHETbRXmQ7d3LjPLGgT/ nqtA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=BAa7me75; 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-77582-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77582-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id o26-20020ac8699a000000b0042d918da42dsi13587078qtq.37.2024.02.22.16.43.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 16:43:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-77582-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=BAa7me75; 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-77582-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77582-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id F33001C21FFD for ; Fri, 23 Feb 2024 00:43:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 97935AD58; Fri, 23 Feb 2024 00:43:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="BAa7me75" Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.202]) (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 3D43E79DC for ; Fri, 23 Feb 2024 00:43:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708648985; cv=none; b=dXrQwVhKPrMf6SOYDKqatc6Z1JPEJ0WAn6Rp1xdfZJmnd15KJXY6qdJ1ZVjhxoD/Xyn8by052rJxC3HslcUefnzyM6xkre7W5+foj6Q9IZopKj1HsvJYHKXpaQ7nsBkNJbMoS+7QfzVt0Ew/AdAIbCPpMRiy9iyn7tyoN+askc4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708648985; c=relaxed/simple; bh=e0zqvQX4ZlL0fPn4DwqoWoLqJX7b6wznfe/Oj9KjKhM=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=cYJyqCPGH3d+nziXMDp543109k331Nk21Q4n89GElCMbcYHOTAM1OogDlDaYBOWGFKgX0pcSPgecCoRZ32u0N7ts6sRgCGT2kjIkiY8wEGUpexWGRwNRvuhrlat9hG5scxmU1xjL7m4aG9EXszAzxPkMn0TZ5vaggSo6G7AcW80= 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=BAa7me75; arc=none smtp.client-ip=209.85.214.202 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-pl1-f202.google.com with SMTP id d9443c01a7336-1dbc9504a1cso2457515ad.3 for ; Thu, 22 Feb 2024 16:43:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708648983; x=1709253783; 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=S8c8bYa8F6WSgYnQg5Ml3mIasYavsfmgJ65i8xz9FOg=; b=BAa7me75LRuDqlpTm3X0tdjmN0XFop78UuVTZca+6ISLX+0aGhdMgTCZGQv5VGyCf2 hS0nLEVDmiahO64jlYgZKFjVo40L5HlhTRUvEX1gy5uGfBwVYHmnXZAfdkwMMNRW00Qk NZXW+73OxpUHJj1CZj9evmS+zbjWjHckicZhHf/NXRvjO2U9h4VRzR8bgYUT+cf/EY7s iAyClbozLWKDut/i+b/lmf7imhSasBcn0RQMGAcILNCPFhhQJSLtsexJZRjFbk+ZI++A okD+w5WHIkk42eT3eMupOyKG+PJzToM543jV+/MhxusKHYlMY5Igp3s25aezDaP0vjPF GWJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708648983; x=1709253783; 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=S8c8bYa8F6WSgYnQg5Ml3mIasYavsfmgJ65i8xz9FOg=; b=pae9NTsEBrEVsbYL+QTmmkFeLvKxtXVZ4DXwroVdaYz7MtfA+w4UUTrG7LCaFsRqLV TKb2nXC3Kn4KypoQnGD3noAsR52LAlNvBMUcuoJXoosNAOLHsEBEGB4GeotRnqaIdRzG tJyk0T32YjoaKxOz+lQSOMLEumhb5gg1Zi0FMyXiWG0h6WteQ7AUJjx8hUAFBQMdsQhd ZMc4H8K5B8u6AzJ/aVrmGeKXDkArtGwtVFcF/rLp95qggrR3K1DWHy6n/X7Uxq3qwrcu ibTahktahMtrGQmr7mKRr2NFPlGIDEgJbiLEGeWVh4auI9BlbEB0JpB7doiT0aBTq2m4 lRVw== X-Forwarded-Encrypted: i=1; AJvYcCW8fqVEcCEPolbKtM9eeWgq3IjCXExAWEKy4tQKzUBFwa91PAgLbCHcEHBJjNoIgvy8N0Bp1eZvrMGeqmNbkwUJrmi8RA7Nk7cGkXl4 X-Gm-Message-State: AOJu0Yzjh1Sl/oL/Vtcu/k99VO2ksG1H2LzIQv1vj3JpbxrzR/bZsevq +h9kXnC66eByyhEiomCDIiKviKH96x0DKVVHnypkLHNUOTb3Uz++CGlbCOLs9zo7P/PIw6ELQTg O7g== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:902:d2d2:b0:1db:d810:89a5 with SMTP id n18-20020a170902d2d200b001dbd81089a5mr26791plc.0.1708648983559; Thu, 22 Feb 2024 16:43:03 -0800 (PST) Reply-To: Sean Christopherson Date: Thu, 22 Feb 2024 16:42:48 -0800 In-Reply-To: <20240223004258.3104051-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: <20240223004258.3104051-1-seanjc@google.com> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog Message-ID: <20240223004258.3104051-2-seanjc@google.com> Subject: [PATCH v9 01/11] KVM: selftests: Extend VM creation's @shape to allow control of VM subtype From: Sean Christopherson To: Paolo Bonzini , Marc Zyngier , Oliver Upton , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Sean Christopherson Cc: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Vishal Annapurve , Ackerley Tng , Andrew Jones , Tom Lendacky , Michael Roth , Carlos Bilbao , Peter Gonda , Itaru Kitayama Content-Type: text/plain; charset="UTF-8" Carve out space in the @shape passed to the various VM creation helpers to allow using the shape to control the subtype of VM, e.g. to identify x86's SEV VMs (which are "regular" VMs as far as KVM is concerned). Cc: Paolo Bonzini Cc: Sean Christopherson Cc: Vishal Annapurve Cc: Ackerley Tng Cc: Andrew Jones Cc: Tom Lendacky Cc: Michael Roth Tested-by: Carlos Bilbao Signed-off-by: Sean Christopherson --- tools/testing/selftests/kvm/include/kvm_util_base.h | 9 +++++++-- tools/testing/selftests/kvm/lib/kvm_util.c | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/kvm/include/kvm_util_base.h b/tools/testing/selftests/kvm/include/kvm_util_base.h index 070f250036fc..d9dc31af2f96 100644 --- a/tools/testing/selftests/kvm/include/kvm_util_base.h +++ b/tools/testing/selftests/kvm/include/kvm_util_base.h @@ -90,6 +90,7 @@ enum kvm_mem_region_type { struct kvm_vm { int mode; unsigned long type; + uint8_t subtype; int kvm_fd; int fd; unsigned int pgtable_levels; @@ -191,10 +192,14 @@ enum vm_guest_mode { }; struct vm_shape { - enum vm_guest_mode mode; - unsigned int type; + uint32_t type; + uint8_t mode; + uint8_t subtype; + uint16_t padding; }; +kvm_static_assert(sizeof(struct vm_shape) == sizeof(uint64_t)); + #define VM_TYPE_DEFAULT 0 #define VM_SHAPE(__mode) \ diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c index 4994afbdab40..a53caf81eb87 100644 --- a/tools/testing/selftests/kvm/lib/kvm_util.c +++ b/tools/testing/selftests/kvm/lib/kvm_util.c @@ -276,6 +276,7 @@ struct kvm_vm *____vm_create(struct vm_shape shape) vm->mode = shape.mode; vm->type = shape.type; + vm->subtype = shape.subtype; vm->pa_bits = vm_guest_mode_params[vm->mode].pa_bits; vm->va_bits = vm_guest_mode_params[vm->mode].va_bits; -- 2.44.0.rc0.258.g7320e95886-goog