Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp578423lqt; Fri, 19 Apr 2024 04:52:47 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUl/oLoUUU9d3kAXnGgXpTE8RfTpEvdTK10tD5Hu3QM7aYGZIgRKva5NC6/l3dXZ9aWcAuU5bKJNpVVTzH/mH9DxBFIqRQYyukYrkKfbA== X-Google-Smtp-Source: AGHT+IF8rqHxUKySXmitNhe1p/h2Sn/Nm5Pwm4RdSf8QNzOBoh/1D27N4vNoFZStQvPWc0btbYk2 X-Received: by 2002:a17:90a:f517:b0:2a5:3616:94c6 with SMTP id cs23-20020a17090af51700b002a5361694c6mr1680170pjb.44.1713527566977; Fri, 19 Apr 2024 04:52:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713527566; cv=pass; d=google.com; s=arc-20160816; b=D/U6g2dP2nkTyJO3Lrpy7chhd5UBQN/hrVSrOy3sZFBQinTgDmrlpzsWOrdnWkM5g9 NXBmi5EZ8GFZqFuWbwIOoxCZSPAh/XkQupTNV8GDPhAqZrGEXxR7YaFyEpeuRbbu/pSC oeSE3RWocemGsOD2giWJxUNgX/mSHdhsEOlxhbtW/uTx/w60WUBSrIc4/nJ4WxoYMIy/ dagT2J9kyQodJQy99FrJ5YuO6/qCPAeJxPoyI5t5nG1N/s3VYlxzdhoc2WjL8yoBa7nC G6tFSP1j6rLKMJqB7cq2zYXuR8/f15MQkfdxWz4zjeHCOcxTW2JNSFpDIEnbb+tV/X/Q svVw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=+9gAW74TdLSgAKKdOeHRcIuNI+2QlXI+dYyfePDOsqM=; fh=YXsfRRlkosqGgrS+EgXyzOU8zqC+PR9yASpcvTK4Aow=; b=nCtjD0kxASqMLcRKLXCGksl8/hBL6Q5rKHH4VbDPlY4BUr5gGwa4cDFjNAJvalL0wT J9lxTBy+qm6nDT/hXakTNLMvTMyKVOLYX+k3BD26aJkctYtQ4JqCDDfFZrlk+a6g25tJ hos++JY+1QF4aq5Tkys1xxENc+YlJk4+H9CuevLqITXu2zO1hnVX8BJgs0aQe7R90C48 shEkbO9J1F7kcFJx2dj+h1TNTTHMcyIJzmTtYDPFiB82TqCGUQkENe5o9IOEltxLzRVy Q+uGL7y6+CffRhdw6FezJsRccJnLFJ9pp2zSqQ5y9XtimaSAu8ZZwRoqkuPqeyPL6vum Jb9A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QvHM1QVx; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-crypto+bounces-3707-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-3707-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id in4-20020a17090b438400b002a286ac52fbsi4951161pjb.136.2024.04.19.04.52.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 04:52:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-3707-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QvHM1QVx; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-crypto+bounces-3707-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-3707-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.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 48D2728247D for ; Fri, 19 Apr 2024 11:52:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C23CF83A09; Fri, 19 Apr 2024 11:52:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="QvHM1QVx" X-Original-To: linux-crypto@vger.kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1BAFC82D99 for ; Fri, 19 Apr 2024 11:52:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713527561; cv=none; b=OV7iAy1e66m/mhRnOsclIWeVWTapqYAlE7BB031XM5ZkNwxh5go0eMvG5IutFc8OOEEa7H5uIIFx5kT6/g/6DzjxajIOJBKTgo574haFIsEwewtfnlmnu5RIpEQ5vciIkp3P/0fDB8ecFPpG8DqqEr6vaj8YgN+6t80WW+ur2UU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713527561; c=relaxed/simple; bh=+HnpYIljW903ODlD5/xLD4aOITxYFLDumzggzFZ3LXU=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=e5gFN6YbBTK0SnTmj3UjB/IsYd1ib3FDCGAEsZLYdNMYx3I9AXbNDCRUYzZS7yPuHtuDAY33Q5+w1euyM5VGaVrN5kSTOHEWl7csoXszEh1RbWnnEHzBjxStvafw4RLMvRWnh0nQlebBumn6SfAr9RyWar+J3yDn/w98JUvPhJI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=QvHM1QVx; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713527559; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+9gAW74TdLSgAKKdOeHRcIuNI+2QlXI+dYyfePDOsqM=; b=QvHM1QVxXd24ATflP4j3EP3JLsgHH5oOiuRX4z2SfJmPwCr+muAzsDosE8SrJGYIY7Jhc9 inL0nS2Te9StRN2JXrNa7BuxSxoI4el830nrv7l6tByDJrXGMh0N0Msr5f4+Ke4wlFuhnr Yg8V0jb5hVKk0kuRJ51c8ZDua88CKOM= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-383-cFhd3Ov-OzuTyDGs5FGOwQ-1; Fri, 19 Apr 2024 07:52:37 -0400 X-MC-Unique: cFhd3Ov-OzuTyDGs5FGOwQ-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-349d779625eso1485416f8f.2 for ; Fri, 19 Apr 2024 04:52:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713527556; x=1714132356; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+9gAW74TdLSgAKKdOeHRcIuNI+2QlXI+dYyfePDOsqM=; b=vDF2X/VFyWLPK9VSg0JwdRDtlxFewFAb1qm68JD5UHZ+bEd2N2lFkNFaK3ScuGUnKK nGY3RqJebbdtO9qxZYDBB+Xh0TH7pAgQ7czTKOSnozPpGWebjkXrWQp1cgY29+4vifoD NICsVV2ezzjc+nriHKpYFDQtCG4tbXMW3QoCrTPKHLPvss+gcTQSqqTF2gLD9e5Azmsj NOxAZu8N9OdKbCNYMvUumLxZDtWnfaFUJHUkAN7xrJDmXt4WtpXxSvGMqmYYW6IlFWYt B6R4kKcaaA0Mi8hPQoXN3EH2nXiN3OGGsbxWjVfVl1+eEyt1ymWMsl2jbag8I2c//Vqs 91xQ== X-Forwarded-Encrypted: i=1; AJvYcCX5Ij8SSEOucFwSqIATL0A/x24dHAMW/RuNO97i5RfQyWUjf5Eph8ujfSnade7K4XeDZQfpUcILRlrQMY3V1w6qAvBi8+sOGKIMew/s X-Gm-Message-State: AOJu0YysnI2THAODbkEA58ULG5ZZkE8IcRyKLK59iHqrTHZ45PDZjuSI Gdl/VyhbFzm7JZSUrwaXH/L5mK8rhWYT2u9HUhOQYzjUX79E0Ur7JDHteXuK0eOGVl2paF1SnBS yzZAWMzBqBQtpsHLWBXx+O4N/493vbKm9ZOfmMAap8VcsxTi+HP6HtdNEn8/b3NAylwHVS4356c 2qGggie/W6zF0smfy+hkMpgh72iCIK5tJvM+IF X-Received: by 2002:adf:e683:0:b0:345:605e:fa38 with SMTP id r3-20020adfe683000000b00345605efa38mr1433604wrm.60.1713527556826; Fri, 19 Apr 2024 04:52:36 -0700 (PDT) X-Received: by 2002:adf:e683:0:b0:345:605e:fa38 with SMTP id r3-20020adfe683000000b00345605efa38mr1433571wrm.60.1713527556446; Fri, 19 Apr 2024 04:52:36 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240418194133.1452059-1-michael.roth@amd.com> <20240418194133.1452059-10-michael.roth@amd.com> In-Reply-To: <20240418194133.1452059-10-michael.roth@amd.com> From: Paolo Bonzini Date: Fri, 19 Apr 2024 13:52:24 +0200 Message-ID: Subject: Re: [PATCH v13 09/26] KVM: SEV: Add KVM_SEV_SNP_LAUNCH_START command To: Michael Roth Cc: kvm@vger.kernel.org, linux-coco@lists.linux.dev, linux-mm@kvack.org, linux-crypto@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, mingo@redhat.com, jroedel@suse.de, thomas.lendacky@amd.com, hpa@zytor.com, ardb@kernel.org, seanjc@google.com, vkuznets@redhat.com, jmattson@google.com, luto@kernel.org, dave.hansen@linux.intel.com, slp@redhat.com, pgonda@google.com, peterz@infradead.org, srinivas.pandruvada@linux.intel.com, rientjes@google.com, dovmurik@linux.ibm.com, tobin@ibm.com, bp@alien8.de, vbabka@suse.cz, kirill@shutemov.name, ak@linux.intel.com, tony.luck@intel.com, sathyanarayanan.kuppuswamy@linux.intel.com, alpergun@google.com, jarkko@kernel.org, ashish.kalra@amd.com, nikunj.dadhania@amd.com, pankaj.gupta@amd.com, liam.merwick@oracle.com, Brijesh Singh Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Apr 18, 2024 at 9:42=E2=80=AFPM Michael Roth = wrote: > +/* As defined by SEV-SNP Firmware ABI, under "Guest Policy". */ > +#define SNP_POLICY_MASK_API_MAJOR GENMASK_ULL(15, 8) > +#define SNP_POLICY_MASK_API_MINOR GENMASK_ULL(7, 0) > + > +#define SNP_POLICY_MASK_VALID (SNP_POLICY_MASK_SMT |= \ > + SNP_POLICY_MASK_RSVD_MBO |= \ > + SNP_POLICY_MASK_DEBUG |= \ > + SNP_POLICY_MASK_SINGLE_SOCKET |= \ > + SNP_POLICY_MASK_API_MAJOR |= \ > + SNP_POLICY_MASK_API_MINOR) > + > +/* KVM's SNP support is compatible with 1.51 of the SEV-SNP Firmware ABI= . */ > +#define SNP_POLICY_API_MAJOR 1 > +#define SNP_POLICY_API_MINOR 51 > +static inline bool sev_version_greater_or_equal(u8 major, u8 minor) > +{ > + if (major < SNP_POLICY_API_MAJOR) > + return true; Should it perhaps refuse version 0.x? With something like a #define SNP_POLICY_API_MAJOR_MIN 1 to make it a bit more future proof (and testable). > + major =3D (params.policy & SNP_POLICY_MASK_API_MAJOR); This should be >> 8. Do the QEMU patches not set the API version? :) Paolo