Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp8161122rwb; Wed, 23 Nov 2022 16:42:57 -0800 (PST) X-Google-Smtp-Source: AA0mqf5tzc84QbALOjnjaLPjReDrwd+Df/8tH0qNJO2LwIOJOeVOZlIevcW09papoz48Qbbdkisb X-Received: by 2002:a17:90a:8a82:b0:210:7cd5:db0e with SMTP id x2-20020a17090a8a8200b002107cd5db0emr34351067pjn.30.1669250576908; Wed, 23 Nov 2022 16:42:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669250576; cv=none; d=google.com; s=arc-20160816; b=DAoKBoklArYbEG4v5pMroGV/P8fEm1vkA3l4/5CcAvyUotyP2Z1tpxnk6zGNFe35IT lGNKT+X9LCfGORzK0cyJgnZZeaezvox7ZnC59jt3+8fT/SXWDfWx4hJNijHohKODxG+W 2hw9FCNV2Le2IQgis6Pl/u57jnkzL2RPhdZh6LFGZSUXDDOqsndnUMS6y/ly95oKk5Hl gZFTShRpdrT3OLhGa9LdzCl6ykChvkBscn3CpwQt5DUvunkgtBXfaS7tXNckVl3YQaiZ SROg6N7ejXsxJW2HmEPEOBSKee2cVWFUYoUb6T13E4NHDNzhsSCMCczYQrAxELvrVQ7l scqg== 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=Mc3ptDbewTZhqLA8433t4x+gtPQyq4lzZPxuvIXfN6k=; b=s3mjdCojzY9YmYDv8UgGKw/pvC5EwgNGLCJTvWjMctTPMZ2uUROvCb3FTNl5epdtxO lHCo0OzHMLgfqss1Ry11RFAEZBC9xRyS4H8WA8tucD0wKrL0FtkGkpwvZlG45nIfWQ7C hsaUjKJQ3h2yn23Rxx5pdZ4U2tl20eWisbN78ZOFwhQEZe2z8r7vqUe4qCOEH5OTwqNi aemp9j8LK8kxYDi04IMyKIR+WaHcyJOERVvDuKnIqnwBmud+YFuwpcpDPJLhCGViosqt ySf+Z55C8hxe9dW4xHWqcdFELuA10aelnhJcso5+tw2KTxlI5BMyJeaDRzlzUahoAdZ5 DyYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RAteV+gP; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qe14-20020a17090b4f8e00b0020593d282desi3176936pjb.12.2022.11.23.16.42.45; Wed, 23 Nov 2022 16:42:56 -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=@kernel.org header.s=k20201202 header.b=RAteV+gP; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229649AbiKXAdO (ORCPT + 89 others); Wed, 23 Nov 2022 19:33:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229449AbiKXAdL (ORCPT ); Wed, 23 Nov 2022 19:33:11 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1E00BEB58; Wed, 23 Nov 2022 16:33:10 -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 ams.source.kernel.org (Postfix) with ESMTPS id 7D5BCB82196; Thu, 24 Nov 2022 00:33:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83228C433D6; Thu, 24 Nov 2022 00:33:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669249988; bh=r2YSkx4S3CaVZq6vXL3CvOrMYOo2Ac88h2M8CUqOXbI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=RAteV+gPaMzc+1HKGPNrokPxyOVOpbqSMVHSE+mu/NcjgbA8rEtJQjhVnFt+Llipl n809HBiCaiKavWOO/0AzVwVsfdXO3uZ7+LkH3c51eWqsk7yG1kn7EEUynhPfwms6Oy dzX6BMSi5RGjHmNLdoSq3LtyXFzKoUqWFbI0edNnjHvPLwjSiJF/yzCPZqrLfby/mV o4EMcnXuH71sBqHLvugwPO+VDmfG9WetMWZEBmzjxZ7c5y2mtptPONWTR4HAqBheMS vYFd934zKIOCTnP4qt++38vH4djGYS50BelCm6ZXr/ki1IFwsWHa9673NXzwdFQprA lZ6HfP/l2sY6g== Date: Thu, 24 Nov 2022 02:32:40 +0200 From: Jarkko Sakkinen To: Lino Sanfilippo Cc: peterhuewe@gmx.de, jgg@ziepe.ca, stefanb@linux.vnet.ibm.com, linux@mniewoehner.de, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, jandryuk@gmail.com, pmenzel@molgen.mpg.de, l.sanfilippo@kunbus.com, lukas@wunner.de, p.rosenberger@kunbus.com Subject: Re: [PATCH v10 12/14] tpm, tpm_tis: Claim locality when interrupts are reenabled on resume Message-ID: References: <20221120133134.28926-1-LinoSanfilippo@gmx.de> <20221120133134.28926-13-LinoSanfilippo@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221120133134.28926-13-LinoSanfilippo@gmx.de> 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-kernel@vger.kernel.org On Sun, Nov 20, 2022 at 02:31:32PM +0100, Lino Sanfilippo wrote: > From: Lino Sanfilippo > > In tpm_tis_resume() make sure that the locality has been claimed when > tpm_tis_reenable_interrupts() is called. Otherwise the writings to the > register might not have any effect. > > Fixes: 45baa1d1fa39 ("tpm_tis: Re-enable interrupts upon (S3) resume") > Signed-off-by: Lino Sanfilippo > --- > drivers/char/tpm/tpm_tis_core.c | 19 +++++++++---------- > 1 file changed, 9 insertions(+), 10 deletions(-) > > diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c > index 4312c5cc13da..2514e60f6778 100644 > --- a/drivers/char/tpm/tpm_tis_core.c > +++ b/drivers/char/tpm/tpm_tis_core.c > @@ -1220,28 +1220,27 @@ int tpm_tis_resume(struct device *dev) > struct tpm_chip *chip = dev_get_drvdata(dev); > int ret; > > + ret = tpm_tis_request_locality(chip, 0); > + if (ret < 0) > + return ret; > + > if (chip->flags & TPM_CHIP_FLAG_IRQ) > tpm_tis_reenable_interrupts(chip); > > ret = tpm_pm_resume(dev); > if (ret) > - return ret; > + goto out; > > /* > * TPM 1.2 requires self-test on resume. This function actually returns > * an error code but for unknown reason it isn't handled. > */ > - if (!(chip->flags & TPM_CHIP_FLAG_TPM2)) { > - ret = tpm_tis_request_locality(chip, 0); > - if (ret < 0) > - return ret; > - > + if (!(chip->flags & TPM_CHIP_FLAG_TPM2)) > tpm1_do_selftest(chip); > +out: > + tpm_tis_relinquish_locality(chip, 0); > > - tpm_tis_relinquish_locality(chip, 0); > - } > - > - return 0; > + return ret; > } > EXPORT_SYMBOL_GPL(tpm_tis_resume); > #endif > -- > 2.36.1 > Reviewed-by: Jarkko Sakkinen BR, Jarkko