Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp518769pxh; Tue, 9 Nov 2021 14:35:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJwQtdmp6aYNPx2iyeqTUzJp+fuCnN7L7f+6L4OvOZAEszik3d0SfMGesgAZWXjkgryFhbo8 X-Received: by 2002:a05:6e02:1848:: with SMTP id b8mr7689088ilv.299.1636497303301; Tue, 09 Nov 2021 14:35:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636497303; cv=none; d=google.com; s=arc-20160816; b=bPwL0h68wzqo0ZccjftcO7vK+w6SoRnXedUm1FoY+pdgIprOIoWoEjOAIMZPewKZvh zCmH2fqB1rkaV3UaVbEjbA3fMCblFLThr8CdlYakRtj7u2t6VTaec0Ptl5Lo5SL2GlFn goGADUjDDowp8CWo48PnUt5Fm3ahV365+sV736Nrr1hElnuh0aWMQvC+ocAmIQzwQ4YR wO7b2b3lJeV0DthJwJ0zCSq2P6Z1F+cyMeWb0RU4tafonyBSRFIiOKpd81lNsWx2MA0g EZV7+g4iVaLIMkiX86dd9oiccpVfojOuGZ/b6RKzul9R+sESBzhjhCmIoEnkNFbWZIfq sGjg== 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=1J1nd78cdv8kJv4UV8p3MY6PnDte+RFrlg5PV9fd6w8=; b=kH5nc4nkRCRlKBL5AVmzZ2Q4fNpo+NU+L7ifAOLzZKfQ9Q10tyhz1cpOqEgcOgr4Go a1FZz4LKsrrwOLpZmgEDCiX38zbdqVnN1fK6qg2U4j8d18+IUqgqmoyKaWTD+Xojfqo1 1W3D5RBqGJyrlPiBvYTIsRu5mxPPiVrxqxPCOxTLhLSOsxNOmFdrvjSCXN8VBoehFPTs wckU383NNDhEaB1avB5CZnXRAHn+q58F/RqYxAmFR+8LxSE15EggqrCFc84aPcj3AasF 48ch4JgaPRQZdq03pMIAi3TRHqgGYeE4nyoaZWs8VGKfhb85S13lUpf1ddja+gRcof99 GvZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Skk8b9vn; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p8si39100850ilh.106.2021.11.09.14.34.42; Tue, 09 Nov 2021 14:35:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Skk8b9vn; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235354AbhKIQer (ORCPT + 99 others); Tue, 9 Nov 2021 11:34:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235386AbhKIQeh (ORCPT ); Tue, 9 Nov 2021 11:34:37 -0500 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 426C1C0613F5 for ; Tue, 9 Nov 2021 08:31:51 -0800 (PST) Received: by mail-pl1-x631.google.com with SMTP id r5so21910583pls.1 for ; Tue, 09 Nov 2021 08:31:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=1J1nd78cdv8kJv4UV8p3MY6PnDte+RFrlg5PV9fd6w8=; b=Skk8b9vnj8IsmyAslWRo75Vfvafe0qUtaLxjEX9gJu1p+WAzrUMmzNJUbbEy32MEKU UaSnyAYMEE3+qoCxcd2TfEfIB9HRoKGi4+P5Bp1Yn1Iekk3gDWFrrDEb/QOrR+uAm7Mt V5UOxCUOGDigLnxHOb3wiJ+FmrBZ0RidENkBfRYAPEQ3Qgkn6RMDQlj95MXJ792lnPDm NsF4LHRq3XY5VBJrB7WeoBNbSCCmfCmaxH0yre5YoAXU2GBt4t8fG1cpPq9BMn2lBkUy kUO8YsbXVIRHjJl2ItsZPONIRAqcwlJIfRIUbadVw577AjbTlHum2GJNh4frrtPMHvHY GbdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=1J1nd78cdv8kJv4UV8p3MY6PnDte+RFrlg5PV9fd6w8=; b=Tuuo748bYqzo8Z82j5vzzQcAqQvZ91fe2aPBWZNI3VAQ1g6H6m4NcEQ55/bk+c4WUl priVRqd7AcAKS+NPxA/yU4NyTMczSbGUTdBWJDmqDqRdcK9hTcFFvtMNgPkPxX3mjHJd A5HDEahBRocOH1tuq/mEiGZMFJd0esunPPd6m30sUBt9pzGmqudEK2ENEeZdYgwZ/ib+ ULpsI0a9MVhPvoXnlrmQIAcepRXH7dFt1pzXGABmhcKHBP7050JBJLhWKD7+UpLouTny hjHYT92qkrCKrbZxDCenZ4+OmGhiTT6fyiiDcVu6K+2mfP1k15A0uqgQB9qVqMrow7ta 2a8Q== X-Gm-Message-State: AOAM532yHMXmNfmt8KFf9YEoZxQUfIsESfatI5ldQ7AP7kR8Psy2Tt28 87jC5HUwJR2PxuAplX19RV/2dQ== X-Received: by 2002:a17:902:c206:b0:142:631:5ffc with SMTP id 6-20020a170902c20600b0014206315ffcmr8483029pll.38.1636475510533; Tue, 09 Nov 2021 08:31:50 -0800 (PST) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id u2sm19222139pfi.120.2021.11.09.08.31.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Nov 2021 08:31:49 -0800 (PST) Date: Tue, 9 Nov 2021 16:31:46 +0000 From: Sean Christopherson To: Peter Gonda Cc: thomas.lendacky@amd.com, Marc Orr , David Rientjes , Brijesh Singh , Joerg Roedel , Herbert Xu , John Allen , "David S. Miller" , Paolo Bonzini , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V3 2/4] crypto: ccp - Move SEV_INIT retry for corrupted data Message-ID: References: <20211102142331.3753798-1-pgonda@google.com> <20211102142331.3753798-3-pgonda@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211102142331.3753798-3-pgonda@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Tue, Nov 02, 2021, Peter Gonda wrote: > This change moves the data corrupted retry of SEV_INIT into the Use imperative mood. > __sev_platform_init_locked() function. This is for upcoming INIT_EX > support as well as helping direct callers of > __sev_platform_init_locked() which currently do not support the > retry. > > Signed-off-by: Peter Gonda > Reviewed-by: Marc Orr > Acked-by: David Rientjes > Acked-by: Tom Lendacky > Cc: Tom Lendacky > Cc: Brijesh Singh > Cc: Marc Orr > Cc: Joerg Roedel > Cc: Herbert Xu > Cc: David Rientjes > Cc: John Allen > Cc: "David S. Miller" > Cc: Paolo Bonzini > Cc: linux-crypto@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > --- > drivers/crypto/ccp/sev-dev.c | 24 ++++++++++++------------ > 1 file changed, 12 insertions(+), 12 deletions(-) > > diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c > index ec89a82ba267..e4bc833949a0 100644 > --- a/drivers/crypto/ccp/sev-dev.c > +++ b/drivers/crypto/ccp/sev-dev.c > @@ -267,6 +267,18 @@ static int __sev_platform_init_locked(int *error) > } > > rc = __sev_do_cmd_locked(SEV_CMD_INIT, &data, error); > + if (rc && *error == SEV_RET_SECURE_DATA_INVALID) { There are no guarantees that @error is non-NULL as this is reachable via an exported function, sev_platform_init(). Which ties in with my complaints in the previous patch that the API is a bit of a mess. > + /* > + * INIT command returned an integrity check failure > + * status code, meaning that firmware load and > + * validation of SEV related persistent data has > + * failed and persistent state has been erased. > + * Retrying INIT command here should succeed. > + */ > + dev_dbg(sev->dev, "SEV: retrying INIT command"); > + rc = __sev_do_cmd_locked(SEV_CMD_INIT, &data, error); > + } > + > if (rc) > return rc; > > @@ -1091,18 +1103,6 @@ void sev_pci_init(void) > > /* Initialize the platform */ > rc = sev_platform_init(&error); > - if (rc && (error == SEV_RET_SECURE_DATA_INVALID)) { > - /* > - * INIT command returned an integrity check failure > - * status code, meaning that firmware load and > - * validation of SEV related persistent data has > - * failed and persistent state has been erased. > - * Retrying INIT command here should succeed. > - */ > - dev_dbg(sev->dev, "SEV: retrying INIT command"); > - rc = sev_platform_init(&error); > - } > - > if (rc) { > dev_err(sev->dev, "SEV: failed to INIT error %#x, rc %d\n", > error, rc); > -- > 2.33.1.1089.g2158813163f-goog >