Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp3720477pxt; Tue, 10 Aug 2021 09:46:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy81joLQOZNQxopv2uE348a0zi3IRrV/pIQTbAGaRLNkQK7J3q0t+p/Ut1dthnr4YXjvIeh X-Received: by 2002:a17:907:9851:: with SMTP id jj17mr10794512ejc.489.1628614009400; Tue, 10 Aug 2021 09:46:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628614009; cv=none; d=google.com; s=arc-20160816; b=eGZYJAe5mcN+QUQfCj44AnwzyD/p/PehAb5w8y2uoWbglH6UGArrRMv1Bz3aAVJNSe ROWLD6xjEtI8eDzICbwwPnHqmBbFgARvJcfg0GrliZidQ31y6fiiuMoswqlOztcouOGV fBKGjRoTkTPM978xwsOVXBZmjE+sHZWfMBFFTNwNpROObmQwRMSB2ty3+LUQ2QLcHkE1 XOZf5Q+LFRCrrHJFZsEd01j+f+jMwFTEWX5UNFRIlRzW8idb2snQA2OkDk2UukI59l43 /05ZsTv5ohFbv2YK4gzc2/kPPnzWktOEd448K7ZDqVxUeVeqr/0GWvUWEikV0eb92zcI Nr0g== 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=+spgJDhB+yFYsxuXv5b5e0JL2BP2+xM+hy1hw+UF8KA=; b=pjxbD10eyqh6yu9bmapvzdWgKsOo7MU4ar6ZZpGJrlFTkwZjRZnJGAtDCAIVO5tshk toaqbrIWleYivY0fDy5t0wS0sAtbg/G2lFaAXgqE61osKoPqThxyvcHkUR1H/N0c3YUX ItXd+ApyVDCnWmgZp857xz2gme/srHaqtdkI/cXW5pdbQ6vukshXihEelO1/4P2apiY8 J3BP4w4CQsuxOGMGYD7VpD0UGgVlL5p4+zzHBG2ws8Iz7fFGAGGH5dlT78ueeVipeo29 pz8ICg2BnXFAzF/DgjAre1G0Bp3aY5CfOALNA1MmnjSU1IrQ/EYeTU8FmeJMcyZ0lG+U yL8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HsnroX+J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l17si17614451edw.336.2021.08.10.09.46.23; Tue, 10 Aug 2021 09:46:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@kernel.org header.s=k20201202 header.b=HsnroX+J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S233782AbhHJQVo (ORCPT + 99 others); Tue, 10 Aug 2021 12:21:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:60946 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231688AbhHJQVo (ORCPT ); Tue, 10 Aug 2021 12:21:44 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4E2BF60249; Tue, 10 Aug 2021 16:21:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628612481; bh=yG+iEfJwheMuv6bvfl91XDL3vUDwY4OSRwYIFp8xSnU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HsnroX+JuNHAl9TWSqRq8BGHFcXQiwC5YipxrRlYrrltKYC8gLDSKgTPYazEfhEs2 wzfMH7DkP/DJ0qlK9znkvW/W10sXUwzVYPWEtsCUW6EZg50FVsGAXEGKf0D9bjEe91 YO7yXwpe7B+QWKO6DSz24r/qGTEYA+Qw/qpIN3Z18XAzuGB9hOU0OkOJgX9faZhbDu beyf39ZZzc1hcWF8P7EOilSktkZuKVQJvWvQ0MtSiUU1U9wUBgpMNbJRty/YlEo8Y7 Y97x78cwuEyURW8GlEG6qDRAi98iMUAKxnKPrYmWzIBRaCxG+q7oHnH0QABfdG5vdy gvTGa4CyxIW/A== Date: Tue, 10 Aug 2021 19:21:19 +0300 From: Jarkko Sakkinen To: Ross Philipson Cc: linux-kernel@vger.kernel.org, x86@kernel.org, iommu@lists.linux-foundation.org, linux-integrity@vger.kernel.org, linux-doc@vger.kernel.org, dpsmith@apertussolutions.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, luto@amacapital.net, kanth.ghatraju@oracle.com, trenchboot-devel@googlegroups.com Subject: Re: [PATCH v3 14/14] tpm: Allow locality 2 to be set when initializing the TPM for Secure Launch Message-ID: <20210810162119.htk366pmacrnzdmh@kernel.org> References: <1628527136-2478-1-git-send-email-ross.philipson@oracle.com> <1628527136-2478-15-git-send-email-ross.philipson@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1628527136-2478-15-git-send-email-ross.philipson@oracle.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 09, 2021 at 12:38:56PM -0400, Ross Philipson wrote: > The Secure Launch MLE environment uses PCRs that are only accessible from > the DRTM locality 2. By default the TPM drivers always initialize the > locality to 0. When a Secure Launch is in progress, initialize the > locality to 2. > > Signed-off-by: Ross Philipson > --- > drivers/char/tpm/tpm-chip.c | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c > index ddaeceb..48b9351 100644 > --- a/drivers/char/tpm/tpm-chip.c > +++ b/drivers/char/tpm/tpm-chip.c > @@ -23,6 +23,7 @@ > #include > #include > #include > +#include > #include "tpm.h" > > DEFINE_IDR(dev_nums_idr); > @@ -34,12 +35,20 @@ > > static int tpm_request_locality(struct tpm_chip *chip) > { > - int rc; > + int rc, locality; int locality; int rc; > > if (!chip->ops->request_locality) > return 0; > > - rc = chip->ops->request_locality(chip, 0); > + if (slaunch_get_flags() & SL_FLAG_ACTIVE) { > + dev_dbg(&chip->dev, "setting TPM locality to 2 for MLE\n"); > + locality = 2; > + } else { > + dev_dbg(&chip->dev, "setting TPM locality to 0\n"); > + locality = 0; > + } Please, remove dev_dbg()'s. > + > + rc = chip->ops->request_locality(chip, locality); > if (rc < 0) > return rc; > > -- > 1.8.3.1 /Jarkko