Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp3358497rwb; Fri, 20 Jan 2023 15:06:37 -0800 (PST) X-Google-Smtp-Source: AMrXdXvXiO5apCqRgsS3bbUZMYeSCnrBuQ3n5JHQSsJwgYFQPp8fJjoZw61KGce/3Nkkq4+D6tyO X-Received: by 2002:a17:906:4a12:b0:7ad:d7a4:4346 with SMTP id w18-20020a1709064a1200b007add7a44346mr17999638eju.66.1674255997584; Fri, 20 Jan 2023 15:06:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674255997; cv=none; d=google.com; s=arc-20160816; b=DfrXcMa6dIgkznN9Z80Ci3aKPb4dbLCHb/rQQc7kYkDqksvM6JQAKhtHIqCyug1nnf 2PTH+jEDWCYS1d+ql9BpDE27IfhUD0M81b9yMe/ZrFGMP5GV8qq2arHLr/paqKRTt9Di gL+y5FUVOeCGuTaxkyejHliohMBH2i4VWECs643fVrMo4lFVu42fSTcntbgs3UV73bej hZqDuUzZjX47a0YPtXIVIndi3zaejSTUdOMcmBspQ51qftD9PxY5BH/7LagLLvvXhIH/ THHOTb6ctmA72dx/xRq+q53t0eKki6KRF9F3jKm0YZpylmn1i84xGiPyX3gdmIj2DOiM m3aA== 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=zAMx8EirihwD9UWQqrzL4mgOdBhzYqwua0stwcBAXkA=; b=RUShwjG2eQBix4hHqIIFt6LzNAoyIKt7WM7LSAhZc899/IjB56yoo6EICHIYOtav2w pnwbUDH5aTW6BV2QDx6icOqfcQExHj8S6kUkWIZDXunnG1GaErPfuE3sXIh7FZWWu4RB +OGWdE5cM2PUgq8f3+T43xb5uAsQ3sUjOCNc7BedX78URoxTtOoLpbXipDcnCQac9KYA dnO2v66OyKHaV/WPcrDSjts1wgBDXeOhPqleYFX48NuyQGFiWFCRgLPUwHyH0v+WLHjn SA8RiPFjFfuWb29BqhoCuP633gW/php0dYdUXNjX9LKuaE2Wh0v2nOCG6Dwgxm3wjQsF n6gQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NzmNBo5p; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ji22-20020a170907981600b008733a7cc602si13731976ejc.19.2023.01.20.15.06.08; Fri, 20 Jan 2023 15:06:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-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=@kernel.org header.s=k20201202 header.b=NzmNBo5p; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230045AbjATW5J (ORCPT + 99 others); Fri, 20 Jan 2023 17:57:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229695AbjATW5I (ORCPT ); Fri, 20 Jan 2023 17:57:08 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DAE7EB5C; Fri, 20 Jan 2023 14:56:40 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 76160620DC; Fri, 20 Jan 2023 22:56:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 546A7C433EF; Fri, 20 Jan 2023 22:56:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674255373; bh=oKkf+3Q00EAO2IQpP2ByrfkTu1TC3Bz2jqgj3PZH6PQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=NzmNBo5pWTxCwXoH0a09URQ35CxJllJ7ZLTx0s6tk84iP9ghkbZ456e1RsoYumXPA 0P2LRE6zdU9RuUkniD+0Zoh1jQ3DSIs22QHjfQoP1AYEAaIXuZ7vi/QD1IqciTXUO2 +DIXG29qkSmTWTkgp5r8CVst1DlL4dpWt4Oqv+VQC28qZO/wBBbSZYQnGCWPD1WbAi Y7v9Z6HCAJe2NHI9c1LKhKf8OBK78NBqAltqti0fNVMJAlHI8rKswZysP4WMbtMf8M wO9k9noYac4ACsDgYgd9Jsu1kywyp/7BCtza+cftv2hGULqPXs87IC/zz28HA8VZKa 59bQV8ds2AMbg== Date: Fri, 20 Jan 2023 22:56:11 +0000 From: Jarkko Sakkinen To: "Kalra, Ashish" Cc: Michael Roth , 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, pbonzini@redhat.com, seanjc@google.com, vkuznets@redhat.com, wanpengli@tencent.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, marcorr@google.com, sathyanarayanan.kuppuswamy@linux.intel.com, alpergun@google.com, dgilbert@redhat.com, harald@profian.com, Brijesh Singh Subject: Re: [PATCH RFC v7 25/64] crypto: ccp: Add support to initialize the AMD-SP for SEV-SNP Message-ID: References: <20221214194056.161492-1-michael.roth@amd.com> <20221214194056.161492-26-michael.roth@amd.com> <897b503e-48d1-bc4b-1e68-42792d589ddb@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <897b503e-48d1-bc4b-1e68-42792d589ddb@amd.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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-crypto@vger.kernel.org On Thu, Jan 05, 2023 at 04:54:23PM -0600, Kalra, Ashish wrote: > Hello Jarkko, > > On 1/4/2023 6:12 AM, Jarkko Sakkinen wrote: > > On Wed, Dec 14, 2022 at 01:40:17PM -0600, Michael Roth wrote: > > > + /* > > > + * If boot CPU supports SNP, then first attempt to initialize > > > + * the SNP firmware. > > > + */ > > > + if (cpu_feature_enabled(X86_FEATURE_SEV_SNP)) { > > > + if (!sev_version_greater_or_equal(SNP_MIN_API_MAJOR, SNP_MIN_API_MINOR)) { > > > + dev_err(sev->dev, "SEV-SNP support requires firmware version >= %d:%d\n", > > > + SNP_MIN_API_MAJOR, SNP_MIN_API_MINOR); > > > + } else { > > > + rc = sev_snp_init(&error, true); > > > + if (rc) { > > > + /* > > > + * Don't abort the probe if SNP INIT failed, > > > + * continue to initialize the legacy SEV firmware. > > > + */ > > > + dev_err(sev->dev, "SEV-SNP: failed to INIT error %#x\n", error); > > > + } > > > + } > > > + } > > > > I think this is not right as there is a dep between sev init and this, > > and there is about a dozen of call sites already __sev_platform_init_locked(). > > > > sev_init ? > > As this is invoked during CCP module load/initialization, shouldn't this get > invoked before any other call sites invoking __sev_platform_init_locked() ? Then it should not be exported because this the only working call site. However, the benefit of __sev_platform_init_locked() addressing SNP init is that psp_init_on_probe can also postpone SNP init without possibility to any side effects (other call sites than sev_guest_init()). BR, Jarkko