Received: by 2002:a05:7208:3188:b0:7e:5202:c8b4 with SMTP id r8csp984680rbd; Fri, 23 Feb 2024 09:23:12 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUR7+lPdFx1Pg+xksyLGBTiogibfaXSIRHd3LN3lLc/gZ9DiMe7ZpHBv6zw7OS+dl8rGiT3l9iOMJ06hJnf/e+qpyAB1LVOCzNd9ciQXA== X-Google-Smtp-Source: AGHT+IEgbB6ui7663RmlXzGVxKxv0iGvhQTd799SVHvj2Trfn5rcR72EO2Tzbsv/uUscmziXE3yK X-Received: by 2002:a0c:970a:0:b0:68f:1313:4f25 with SMTP id k10-20020a0c970a000000b0068f13134f25mr437514qvd.54.1708708992301; Fri, 23 Feb 2024 09:23:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708708992; cv=pass; d=google.com; s=arc-20160816; b=bv+TGLwVEoDmkNvFc1d3nwJ4NX0bTLAe2rFjSoVluEkfV5dhl66M4B/lEu4TNOLgyc jHKCxcwdxWx/FmB2QyBdtGKXB3rEGyM0gvHAIX//KA8bW576M82qfimXM/0WpPQ7UbRu pAIfhLK2I1Ujdj1jeTt+A2pZwgMGR9tfztltAriNuWw3b6dc9tdimX1utOUGNDF+hJkG tG4aHubdH+pNmkS67h2Gx0USwuVmdHMe92/ROO0FMq/Bvzuy2CYF7VqGxTAQ+WjW+Fa5 XP6JS8Bi/dmioG1zjSEpHjIyhRSR+IVu4na1Pr5C1Tvb/7gXvUQOocFLZNyBmCUjoquk CHUw== 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 :dkim-signature; bh=fbdOsTQ4/aB9Xs+//i/yYaDnT36ysQWNMNiNUj7P11E=; fh=snuN8lTu7CCcd4L/3/zvkp75hhbwDFXBlKsWrCpSFxM=; b=TfwOFPT1cEakshgJfRxKEkDNpWSyTSws7/SYpuV21ouee1J0O76aQznc/JWb6DVqcY 9RDV0X96PImtDoIaJ3hAv7x4m93bsADvxHHqS4aEfBSjCN2/lz2HgNvZX2ODgnaFOpbJ ZdadOswcRwFUucUWZRlnbn0I1QmWlRZ7cWqvQS/i/yD7a31TNGNqnkyiOVZRoALuVYwv /dtrU+sWCovsCHABRjBStDd+pX95s2bb0OSe8Otpag2AimTwZQoC4mBZK1FlNKrxb1op +ci2mjLBIYJ8inMbIXrz+ZDG1XFot1gG30rg1cDwqpUiqNoMrGNNDPOTX6fF52sjFP2O 6baA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=3yQ4ffSH; 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-78822-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78822-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 6-20020ad45ba6000000b0068fccf88ba7si2781902qvq.596.2024.02.23.09.23.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 09:23:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-78822-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=3yQ4ffSH; 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-78822-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78822-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 129C71C23DF2 for ; Fri, 23 Feb 2024 17:23:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C2B15134738; Fri, 23 Feb 2024 17:22:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="3yQ4ffSH" Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.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 8531E12E1F9 for ; Fri, 23 Feb 2024 17:22:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708708960; cv=none; b=l1KEf9hID1iVw4abwO6mwpJFReXoV5wT9rWY5jyT61gIAHw47hjafJSJFAZQZgemb89VSZi7NVXJBuNSO9LFozM9Kt+LZxxmLUG+o+HdKeneDTazcngj/dPYOCi6Wx183if2M0nqggw+pEqjUN8lrrob+lCj5Jq123h6mNSLw/k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708708960; c=relaxed/simple; bh=xI1CYXpRQxNW6RhypQf+M8k1lJvk1Cdwf26jKyWxh9Y=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=k84hyx7/ylXApTobiR+QYMwm/XtoLK9nRROGRfc7Bo+V9sERQ0zNNn+zm3560VJCHYc9bHWz6nwwFEwmHMsi3vIJzG4N1DLxehQc/OaepyTR6KeCFelD18qVxXLTyuHI09BI4GESyMpX/pT8CDalvXmhvv35917dbiPl7UatsQY= 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=3yQ4ffSH; arc=none smtp.client-ip=209.85.128.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-yw1-f202.google.com with SMTP id 00721157ae682-607e8e8c2f1so19812887b3.3 for ; Fri, 23 Feb 2024 09:22:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708708957; x=1709313757; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=fbdOsTQ4/aB9Xs+//i/yYaDnT36ysQWNMNiNUj7P11E=; b=3yQ4ffSHhQXMfao1E8/GViA4MRnYrQRIn75v76OQeDmZM4vJdccsjiq3T2LHkNF/1q LwTyjQy/Yz93PPSXdYiVkwBZjnM6EaBVAJTui83MFM4t771Kr3ihpJHfYk/CveHTnOXG 798E6PIgkQrnPJq2nGNBi7croB8u3KQ+VMiD9Zpwbry9HENX4+y9/1RB8P8lIktyDA0F 7bxjNQgnbI/qgeEvNRUzV8PgexiujJCkz+g3SN5jPRiuNLXvYuta4HLTAymnlKUzaXI7 m4vI6+doksz5Kq7NK+BAnDVXozfdWjSt0vPndXNGtVVHLTlG9+3buUPhoBV+UmVE8ycs TgMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708708957; x=1709313757; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=fbdOsTQ4/aB9Xs+//i/yYaDnT36ysQWNMNiNUj7P11E=; b=vwZc9vyzMfbPlYRz1s1AbQfpeOHSm+Oy9yx0jPcWwXduQSfS8FHsqRaI1OVOmuDRr9 6kPZ4eWceuYyCNbVb2mBzMQaOOtPLnQGEsJi+6YLUdozzYnhaRLyg4VB5iEqbtQustuW hHuUTlldP0WKTI99Ugu5Ex/rona2xtMZqDq/qSQptaQOdcjJln9S7kAho16s00P6a+eH Za3XhNwBf1oEFWCnyOHs66GfON0+V0QCUNG2m+uvIuvvFlbmX94rLFOdD8iUVMQSM/zg yBIfzhEttkM0t/1JhyvrXUYkkJellnjjiLprjSZoL7YN3+QSFk24qSGDABd96FkQlKfM PQHg== X-Gm-Message-State: AOJu0YxDgb48SRVEAov19EK3rcr0TEa9pt+olToDH/sMTzJQi1hPyJ6N cPeM+i98fJ/nPIXj7p3nLdITUGXmRrlzE3SWUpLLm3g3VOy5kV80dMS4grhDS+QmXdUA0NKNr+2 EhA== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a0d:d592:0:b0:608:21cf:ef0 with SMTP id x140-20020a0dd592000000b0060821cf0ef0mr84992ywd.4.1708708957651; Fri, 23 Feb 2024 09:22:37 -0800 (PST) Date: Fri, 23 Feb 2024 09:22:36 -0800 In-Reply-To: <20240223104009.632194-10-pbonzini@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240223104009.632194-1-pbonzini@redhat.com> <20240223104009.632194-10-pbonzini@redhat.com> Message-ID: Subject: Re: [PATCH v2 09/11] KVM: SEV: define VM types for SEV and SEV-ES From: Sean Christopherson To: Paolo Bonzini Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, michael.roth@amd.com, aik@amd.com Content-Type: text/plain; charset="us-ascii" On Fri, Feb 23, 2024, Paolo Bonzini wrote: > @@ -3193,3 +3199,16 @@ void sev_vcpu_deliver_sipi_vector(struct kvm_vcpu *vcpu, u8 vector) > > ghcb_set_sw_exit_info_2(svm->sev_es.ghcb, 1); > } > + > +bool sev_is_vm_type_supported(unsigned long type) > +{ > + if (type == KVM_X86_SEV_VM) > + return sev_enabled; Oh, I almost forgot! This is the perfect way to solve the mess where sev_enabled is true, but all ASIDs are binned to SEV-ES[1], which sefltests doesn't currently handle because the info isn't surfaced to userspace[2]. So it'll end up like this? if (sev_enabled && min_sev_asid <= max_sev_asid) kvm_caps.supported_vm_types |= BIT(KVM_X86_SEV_VM); [1] https://lore.kernel.org/all/20240131235609.4161407-1-seanjc@google.com [2] https://lore.kernel.org/all/ZdfQ4jI8yT-bvbV4@google.com > + if (type == KVM_X86_SEV_ES_VM) > + return sev_es_enabled;