Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp11031745rwl; Mon, 2 Jan 2023 12:31:25 -0800 (PST) X-Google-Smtp-Source: AMrXdXulVy3U8Wlb75I79CEqWmcYbryRwNlv9a6Fcd/av0qbI1wuJTHiDx4ZSwUzhVWdivrGCCHj X-Received: by 2002:a17:906:6dc3:b0:7c1:49c:f9cd with SMTP id j3-20020a1709066dc300b007c1049cf9cdmr36776211ejt.54.1672691485405; Mon, 02 Jan 2023 12:31:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672691485; cv=none; d=google.com; s=arc-20160816; b=hFgrULc7qms8T0LNr18OwrOAcFYz8fSmdR03FESzViBnNl9zpAPPGW9INXqqGYE9Qe OCNWJpWR70jV9kZi4+A4QSy42FdC2MGZnZgmwyE6+SM8JX3+eMf6sLTJfYfk2mPehDMn ni2BG1fdNL+66lMSKk7Tc4F/xH/dQEelzeKoC15XZ44OxRmydNzBB/0SBpQ/vMN5oXUm HHjkcG1IuoL1E58YTfdi1gLTxhDLtO8NeIXUpj5QYT/9YBgjIACrOEZNuAVVosdtaiUy L4GcN44vvTpV3Nkj6x0mo4xdfyiOc77twxCJTbxRJeclQL1aMw95k4sf0PUxMM2F7En1 givg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=QfkRnZ8rB5PER1Hjpd4mBmBLogx74L19nz9zOgfhl18=; b=MAlq5h/iSo8nDbUK75p0PJdBGakf5VXhtfrAqs5Rxv+J0Q3ULvmUlXdYBKzMDQQFwR b6G0i6lee4vdrr3xovLH4h9dXjAZ6dIRMADVj2ZZ36nCrt11bVpu8JHSYzafAEOivj26 rUVwQIZy5izkA+qApVF5NwO9NWwObWjoih2ROFajImKni8SulBRX2JBMPJgHIXgXkdlu stq53fAWAWVO3hJsZResUrQZjS9gkGEg4dgxML9f5b98oTYUloi/amlhYJjU6oYIhFAa LwZvVb5EY9Z11D7Uj1151K/jYSRU4IFMvQHmOwPv2fjh0SupJlTUwvsck1PD5ZRTyVbv C2kA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=qa8K5TXi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hq23-20020a1709073f1700b007ae832c0b69si28159356ejc.512.2023.01.02.12.31.08; Mon, 02 Jan 2023 12:31:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=qa8K5TXi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232994AbjABUCW (ORCPT + 61 others); Mon, 2 Jan 2023 15:02:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230443AbjABUCS (ORCPT ); Mon, 2 Jan 2023 15:02:18 -0500 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E58521B4; Mon, 2 Jan 2023 12:02:17 -0800 (PST) Received: from zn.tnic (p5de8e9fe.dip0.t-ipconnect.de [93.232.233.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id A059F1EC0518; Mon, 2 Jan 2023 21:02:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1672689735; 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:in-reply-to:in-reply-to: references:references; bh=QfkRnZ8rB5PER1Hjpd4mBmBLogx74L19nz9zOgfhl18=; b=qa8K5TXi6a8VfthYzIFjpTBIjFj9eQJSPfIH1VQ+mfjfiEupRte6mF4aGmAC4I7NISFiR5 w9CBxK9iP8YjzP6eBf13M8VU3T/dKlHqWigm+ODKHeRNYDHkeHtp3QfFZhhytSzlN4T7BU 8ueypGzaB2bJTgAKDXztWIbzDKbyfBc= Date: Mon, 2 Jan 2023 21:02:11 +0100 From: Borislav Petkov To: "Nikunj A. Dadhania" Cc: David Rientjes , linux-kernel@vger.kernel.org, x86@kernel.org, kvm@vger.kernel.org, mingo@redhat.com, tglx@linutronix.de, dave.hansen@linux.intel.com, seanjc@google.com, pbonzini@redhat.com, thomas.lendacky@amd.com, michael.roth@amd.com, stable@kernel.org Subject: Re: [PATCH v3] x86/sev: Add SEV-SNP guest feature negotiation support Message-ID: References: <20230102083810.71178-1-nikunj@amd.com> <3169b54b-d990-7707-5ec4-cde7261318fe@google.com> <45487a87-764a-7ff3-292b-4a55fe29f7ba@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <45487a87-764a-7ff3-292b-4a55fe29f7ba@amd.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 02, 2023 at 08:50:23PM +0530, Nikunj A. Dadhania wrote: > >> + /* > >> + * Terminate the boot if hypervisor has enabled any feature > >> + * lacking guest side implementation. > >> + */ > >> + if (sev_status & SNP_FEATURES_IMPL_REQ & ~SNP_FEATURES_PRESENT) > >> + sev_es_terminate(SEV_TERM_SET_GEN, GHCB_SNP_FEAT_NOT_IMPLEMENTED); > > > > We can't help out by specifying which feature(s)? > > The purpose of SNP_FEATURES_PRESENT is just that, at present no features that need guest > implementation is part of the kernel. For e.g. I will be posting patches with SecureTSC > enabled, that will make the following change. I think what David means is, can we have sev_es_terminate() say exactly which feature wasn't implemented instead of users having to dig out which one exactly wasn't by trying to find out what their SNP_FEATURES_IMPL_REQ and SNP_FEATURES_PRESENT masks are. Looking at the GHCB protocol, where GHCB_SNP_FEAT_NOT_IMPLEMENTED reason code goes is GHCBData[23:16] which is not enough... And the VMSA has SEV_FEATURES but that's guest-only. I guess we need a way to communicate those masks in a more user-friendly way so that it is exactly clear because of which missing feature(s) has the guest terminated. Hmm. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette