Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp389114pxk; Thu, 24 Sep 2020 08:03:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyGdfL/lossEi20AS9UmPjxJR2Dbnmadep6ftWE8ywcKD7XkP3crEFu1NRpb0FkvWa9WCkd X-Received: by 2002:a50:fb15:: with SMTP id d21mr364261edq.150.1600959806325; Thu, 24 Sep 2020 08:03:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600959806; cv=none; d=google.com; s=arc-20160816; b=SXu0Vgt0clGzjI+DZfhztm1NzI7CfxuQq7XZBKZKiD0TcUoAMZja4KTWdWK/+46qpZ ggDz+u35I1fIkQFKLuMJijKXJFFXFMblDgMozuWIBEppcD2kDqEZx5DMqr9GbESR9Y4U vWTtyFxm9uWvyJbYnRxAVE4oOkmuT3vba6rmnozPDO2mU6uPEDRKpdqWPFIlGvSNgqzs dMh8kUodTJxxcOF0ptqlx/m+ZM2pqftFafWX7mmPHhFyfWEUDBdxG5Bde1L/9R0+pnOQ IO5Ca6s1+zKjkCo1dbNl42uZuNj0iCgIjG2LCCfc95FBVaq4E91+z6uB37Iq/Fdzayqi Yybw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=vaYMWdLIOGxcNOMQTNn3bCU6SyHr+JucLkpHQ7mukEM=; b=W1gMNJsXRPebaq1R3Mo8Y/3J7ZxUsJ8Cp0sc9QK6gh6DDfKI7DQfmH6Fl9lC9QEuUy 59YsiM/LwGRmB3ZuDQJJHluFphJcEL0P1j6DLYmua0ANNvm0el6cIHNi7UAisn2y+iGd CTgOIJR0ojAlt4W4oB6HXYSfS+2zZDzgnMwyHGlvx+V3T0REFSziqw/f+4TDJELVyjuw /taDt8RLI8eaBUoFGESl5n8NVNPAtRCc0/rUO8QneZk+bAlhc8Zadc2T21/k3qOEFfwo vu1laZaa2oOAhMHgOgqIprKSe2MO1RR7Mb4I662Q2QdOVw2ebWzuCa3MtKaTqmN2RAz0 9wLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=dRmZk9zT; 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=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bs7si2160015ejb.410.2020.09.24.08.03.02; Thu, 24 Sep 2020 08:03:26 -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=@oracle.com header.s=corp-2020-01-29 header.b=dRmZk9zT; 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=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728422AbgIXO6k (ORCPT + 99 others); Thu, 24 Sep 2020 10:58:40 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:48080 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728395AbgIXO6d (ORCPT ); Thu, 24 Sep 2020 10:58:33 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 08OEsvoK071951; Thu, 24 Sep 2020 14:58:20 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; s=corp-2020-01-29; bh=vaYMWdLIOGxcNOMQTNn3bCU6SyHr+JucLkpHQ7mukEM=; b=dRmZk9zTDAL/dli17qKPLMAflBh4u8NCrCW3zKgSZMbzSC4YwYvZ/6kRDGvtE78zIGC3 Gwq3UKwuhxSqqnKh4tpvuXNclH3IvmeLhiXWv/NyfOfJqBVBHp55YTSObVKM3PRTs5mw T22i9NwH5rkwlZ7BZRjIylt4Icgc8AGawti7qV2sEDG7b07yE/fNFNj+PSYKLE2ExQAJ 4TbPcvWysd4N8OaOxyH4XqbkKKi38Fop0EgUidAWHEzAEmwaDyxVRdPUNe5/thOt/18W pcOts2kFW5UWGStl3/7l+qwSVz6xZirpDkCAKFdjFzrd1uVlB4zLmxJxXORvgVpaeZBJ GQ== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 33ndnurumg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 24 Sep 2020 14:58:20 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 08OEuTRK096375; Thu, 24 Sep 2020 14:58:20 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3020.oracle.com with ESMTP id 33nurw9x6s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 24 Sep 2020 14:58:20 +0000 Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 08OEwJiT002831; Thu, 24 Sep 2020 14:58:19 GMT Received: from disposition.us.oracle.com (/10.152.32.81) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 24 Sep 2020 07:58:18 -0700 From: Ross Philipson To: linux-kernel@vger.kernel.org, x86@kernel.org, iommu@lists.linux-foundation.org, linux-integrity@vger.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, luto@amacapital.net, trenchboot-devel@googlegroups.com Subject: [PATCH 13/13] tpm: Allow locality 2 to be set when initializing the TPM for Secure Launch Date: Thu, 24 Sep 2020 10:58:41 -0400 Message-Id: <1600959521-24158-14-git-send-email-ross.philipson@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1600959521-24158-1-git-send-email-ross.philipson@oracle.com> References: <1600959521-24158-1-git-send-email-ross.philipson@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9753 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 phishscore=0 mlxlogscore=999 bulkscore=0 mlxscore=0 suspectscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009240114 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9753 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 lowpriorityscore=0 phishscore=0 adultscore=0 suspectscore=0 bulkscore=0 clxscore=1015 impostorscore=0 mlxlogscore=999 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009240114 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 ddaeceb..f35faab 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; 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; -- 1.8.3.1