Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp953938ybb; Wed, 25 Mar 2020 12:44:45 -0700 (PDT) X-Google-Smtp-Source: ADFU+vv1uYvuyT6qa1tNWja29EWafS+pX4cW3vva7rFWniEJ/qmLtpCSv6N+H2Hk8UH+D5hjR919 X-Received: by 2002:aca:482:: with SMTP id 124mr3728668oie.35.1585165485290; Wed, 25 Mar 2020 12:44:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585165485; cv=none; d=google.com; s=arc-20160816; b=Oa+ssbgrjQcluYP2fujd05FxagQ/SayhiK+fvgznj/Bm3/atA1iYUFllNjEiCd2xQs EggWaD7W90cPdDReEJhT6UWwnkyAykZnWCqGDQASQtDpZZChb6hL8adz9UNy1rJ9xrZ0 glND4p/NY905G9P5sheXD3fhJC/6RivMODoh4bnThs0roTr8kUlH/J5lasEXjiwXcfHG V6URTYGMzuzKbkjHAy3dzuGMpfMbhQOojlwz3oy7wwu9d2JmpEWLfIx+p4kCHq/tTQ36 XdyCR35Dvo0kZinh6JIAdGVtY08mrl9SL9QPQ8Z7y0RZQtum7S8CyF8h3+euTMp1myZ5 nUKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=XAb6QqtAg9fzT26EuPW/JVjcAAgb8qiqvg83Fm5maEc=; b=qkMzgol2Kd00Tbj3wHUzF+4Hyj0XwWnKw6EHYUBw+e3XtC12snvljXdL80Rmbzc0tM 5EDSbTLkiB0cPEaBeItManUt2qQ43tXQi9AyqNHQxnAuA+1weJ+G+8mf4tBlJaaQfWYO RybgDT7iAvi6c5iL5fo3VJu5/Jls1E3XSRWYntVMAH9dbD+6puKAgTMdDna1JLZ0w9tu y3Hqx4ntqBud8FqVkNhGYfMGELjb3AKTO2mmvHorQKtqIWS7c1JcE+ezOAvfJ342J/w6 KY2LlfSfqtlBI2wOpW5beE/4alKOn6pUYJFqtESvOdRY2zS2Fvci0ytc3R7wi1UhswRU EJ0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b="BXaM3/il"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e22si1902980oob.87.2020.03.25.12.44.32; Wed, 25 Mar 2020 12:44:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b="BXaM3/il"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727749AbgCYToB (ORCPT + 99 others); Wed, 25 Mar 2020 15:44:01 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:60616 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727574AbgCYTn5 (ORCPT ); Wed, 25 Mar 2020 15:43:57 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 02PJdA09063142; Wed, 25 Mar 2020 19:43:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2020-01-29; bh=XAb6QqtAg9fzT26EuPW/JVjcAAgb8qiqvg83Fm5maEc=; b=BXaM3/il9dQ6M3B2o9MVv+KMtJ3pJvGMkKMKfzBdxLJSEnGMa35IrcGx2BNfCJPup7TG Qj8FRvzt8TVpWBxI1JPYJca6bUPBo8TCq+SIT1fPi20ZtBTyZBuB7nhg8/H0L1ClpvzH Xk9T9HTpbxOsOoXBtP9iQbz9521ez6f1RBLm7Dc1QUSWdXeIaujVDcdM6wYMg3MWsWcZ 6nbykbVkFFdtudtWBWfDuuCYMNuEiBMNeGILJYEJd0PI2+KUKnTTLQ7eFKOaF4KO4xTi gN0zFSGyQKgN037ZSiikihaN2rjSwDBS/7BsohpwrBTd70VEg25bQ6XFpgDHeOaigS76 NA== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 2ywavmbs8v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Mar 2020 19:43:40 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 02PJgZ3V072580; Wed, 25 Mar 2020 19:43:40 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3020.oracle.com with ESMTP id 30073b1uf5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Mar 2020 19:43:40 +0000 Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 02PJhcWQ008282; Wed, 25 Mar 2020 19:43:38 GMT Received: from pneuma.us.oracle.com (/10.39.203.246) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 25 Mar 2020 12:43:38 -0700 From: Ross Philipson To: linux-kernel@vger.kernel.org, x86@kernel.org, linux-doc@vger.kernel.org Cc: ross.philipson@oracle.com, dpsmith@apertussolutions.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, trenchboot-devel@googlegroups.com Subject: [RFC PATCH 12/12] tpm: Allow locality 2 to be set when initializing the TPM for Secure Launch Date: Wed, 25 Mar 2020 15:43:17 -0400 Message-Id: <20200325194317.526492-13-ross.philipson@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200325194317.526492-1-ross.philipson@oracle.com> References: <20200325194317.526492-1-ross.philipson@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9571 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 suspectscore=0 mlxscore=0 phishscore=0 bulkscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2003250157 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9571 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 priorityscore=1501 mlxscore=0 bulkscore=0 clxscore=1015 impostorscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 spamscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2003250156 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 3d6d394a8661..e74860537252 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 @@ dev_t tpm_devt; static int tpm_request_locality(struct tpm_chip *chip) { - int rc; + int rc, locality; if (!chip->ops->request_locality) return 0; - rc = chip->ops->request_locality(chip, 0); + if (slaunch_get_flags() & (SL_FLAG_ACTIVE|SL_FLAG_ARCH_TXT)) { + 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; + } + + rc = chip->ops->request_locality(chip, locality); if (rc < 0) return rc; -- 2.25.1