Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp6622851rwb; Wed, 18 Jan 2023 07:27:09 -0800 (PST) X-Google-Smtp-Source: AMrXdXtbWhAC7I4pQMgT1YELE6jwDdFUNpjFmqadIdiQVq9981XEirL0VdfQi3nvLcuZoBYaeABF X-Received: by 2002:a17:902:ea0a:b0:193:389d:ecc5 with SMTP id s10-20020a170902ea0a00b00193389decc5mr10866287plg.47.1674055628935; Wed, 18 Jan 2023 07:27:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674055628; cv=none; d=google.com; s=arc-20160816; b=Z4beDJmMOV80u19F2EDb/pMuvUKAdRBcnK7+mD8lkUC1ZbhljyjomZkKUWk2LBdGjp DOulP4yrmnI+53kilEMp4EU63ohqKs6DDrDoKNEX8XGv9YOe7nEDKNLz0pVn8qsiP0jW UphZWwmpo1vj23w3RiCJXcK78rINyYJc5ojWXNYDD6eAyvX+FCSA/FzMbl67CrI3Wb7K vG5hHnjn2rCh0xma4GVQXFnM7sYkzFYnPTrb/tXGarcbKlzh8CiquH3ILigEp0AY+Sv/ sti7NOxHXfN6BYEM3McPTgxcbCbm49TK5Gym777b1aRUSND4HMulYCkM+6PV10vavXp6 AC+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=RAkKvdYPbei4GLDCMbMoq/47wvrIe8lTvhtCoRHWpTI=; b=EXBosIdJOAK/Ox7Lw2oXLChZzU/wsgLNC3MHJt0wNpeB6Gtl/gXudwKEe5yuZnfBDl 4stXjDHBsRCS+kllaAwUSjyyMeNM2Q/sYP86WILsHEQFlvAEqo5G45h55D1xDQWsfrpC wIgmB1yHqs8wP9DDMgZysgaASVsCG4sKDyMArOG5hkBUlDkXyjIE0AmNQ0fTkJgHqL0q yPDod1O1fKToywOp/Dh2ZvGJ1EP8Xnj81P5a9qn2pxCWY3/hKCWeEmTBzm7lxyDLJ672 16KShyaME/63xlicsQqPp6XTy7D7qEFZn5Be4gJr0e82DbWQ4+8BEL73zAChKM/F0DCU SfrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=KFCCB+AG; 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=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ix4-20020a170902f80400b001926cc639ecsi25419322plb.487.2023.01.18.07.27.03; Wed, 18 Jan 2023 07:27:08 -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=@ibm.com header.s=pp1 header.b=KFCCB+AG; 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=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231648AbjAROzq (ORCPT + 45 others); Wed, 18 Jan 2023 09:55:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231767AbjAROzQ (ORCPT ); Wed, 18 Jan 2023 09:55:16 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3C2563080; Wed, 18 Jan 2023 06:49:37 -0800 (PST) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30IEEmI5013557; Wed, 18 Jan 2023 14:49:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=RAkKvdYPbei4GLDCMbMoq/47wvrIe8lTvhtCoRHWpTI=; b=KFCCB+AG18T9ypciP9tUgfI3AAOjGIaqtr+r/N+r+Q4z36eKWYOSVuZJb1Rp6f1WQtoB eHGXQObtS4D+yKxIC0bd8aZrjPU9/s1LC9eq4AMEYAYO5L656WtNc8sV7rf00kybzwTo RHy3sRvIfPk9Ve/au/SJoqECRyJUhh+GNyyRel5orxtM5sHzPr5/e2lI6t6XEO5n1pVJ tPHYvus3xgOgTfPPk+/TR6JQtBGhC3J/Z5UHK3taO5TjRau/NpLV1dnN3KUuZAqgufcn zAa4OeNyrG2frHGPumR/6hLV2itTUc970DSZUcKJ+dPIfyn81/YuLZnyv7GdUrajwRa0 Dw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3n6jby8v2b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 18 Jan 2023 14:49:34 +0000 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 30IEGP7W019520; Wed, 18 Jan 2023 14:49:33 GMT Received: from ppma03wdc.us.ibm.com (ba.79.3fa9.ip4.static.sl-reverse.com [169.63.121.186]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3n6jby8v26-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 18 Jan 2023 14:49:33 +0000 Received: from pps.filterd (ppma03wdc.us.ibm.com [127.0.0.1]) by ppma03wdc.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 30IDH8sX022508; Wed, 18 Jan 2023 14:49:33 GMT Received: from smtprelay06.dal12v.mail.ibm.com ([9.208.130.100]) by ppma03wdc.us.ibm.com (PPS) with ESMTPS id 3n3m17e7m7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 18 Jan 2023 14:49:33 +0000 Received: from smtpav06.wdc07v.mail.ibm.com (smtpav06.wdc07v.mail.ibm.com [10.39.53.233]) by smtprelay06.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 30IEnW1W7799550 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Jan 2023 14:49:32 GMT Received: from smtpav06.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0A10758054; Wed, 18 Jan 2023 14:49:32 +0000 (GMT) Received: from smtpav06.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 112355804E; Wed, 18 Jan 2023 14:49:31 +0000 (GMT) Received: from [9.160.95.236] (unknown [9.160.95.236]) by smtpav06.wdc07v.mail.ibm.com (Postfix) with ESMTP; Wed, 18 Jan 2023 14:49:30 +0000 (GMT) Message-ID: <3161efa3-2e72-bcc4-95d9-736a55f6535e@linux.ibm.com> Date: Wed, 18 Jan 2023 08:49:30 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [PATCH v2 2/2] tpm: Add reserved memory event log To: Stefan Berger , linux-integrity@vger.kernel.org Cc: linux-kernel@vger.kernel.org, jgg@ziepe.ca, jarkko@kernel.org, peterhuewe@gmx.de References: <20230113161017.1079299-1-eajames@linux.ibm.com> <20230113161017.1079299-3-eajames@linux.ibm.com> Content-Language: en-US From: Eddie James In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: zBbA5puTlZiuIf1bIEx6HFL7MP2qKjQh X-Proofpoint-GUID: kxyfaYV0nDvGuNBFZ1k7EDFgZ4rtVTx3 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.923,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-18_05,2023-01-18_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 mlxscore=0 bulkscore=0 adultscore=0 lowpriorityscore=0 phishscore=0 mlxlogscore=999 spamscore=0 clxscore=1015 priorityscore=1501 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301180124 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_MSPIKE_H2,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 1/18/23 07:27, Stefan Berger wrote: > > > On 1/13/23 11:10, Eddie James wrote: >> Some platforms may desire to pass the event log up to linux in the > > Which platforms are these that work like this? Platforms booting from U-Boot without EFI. So at the moment, IBM's OpenBMC systems hope to use this. Thanks, Eddie > >    Stefan > >> form of a reserved memory region. Add support for this in the TPM >> core to find the reserved memory region and map it. >> >> Signed-off-by: Eddie James >> --- >>   drivers/char/tpm/eventlog/of.c | 38 +++++++++++++++++++++++++++++++++- >>   1 file changed, 37 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/char/tpm/eventlog/of.c >> b/drivers/char/tpm/eventlog/of.c >> index 741ab2204b11..c815cadf00a4 100644 >> --- a/drivers/char/tpm/eventlog/of.c >> +++ b/drivers/char/tpm/eventlog/of.c >> @@ -12,12 +12,48 @@ >>     #include >>   #include >> +#include >> +#include >>   #include >> +#include >> +#include >>   #include >>     #include "../tpm.h" >>   #include "common.h" >>   +static int tpm_read_log_memory_region(struct tpm_chip *chip) >> +{ >> +    struct device_node *node; >> +    struct resource res; >> +    int rc; >> + >> +    node = of_parse_phandle(chip->dev.parent->of_node, >> "memory-region", 0); >> +    if (!node) { >> +        dev_info(&chip->dev, "no phandle\n"); >> +        return -ENODEV; >> +    } >> + >> +    rc = of_address_to_resource(node, 0, &res); >> +    of_node_put(node); >> +    if (rc) { >> +        dev_info(&chip->dev, "no mem\n"); >> +        return rc; >> +    } >> + >> +    chip->log.bios_event_log = devm_memremap(&chip->dev, res.start, >> resource_size(&res), >> +                         MEMREMAP_WB); >> +    if (!chip->log.bios_event_log) { >> +        dev_info(&chip->dev, "err memremap\n"); >> +        return -ENOMEM; >> +    } >> + >> +    chip->log.bios_event_log_end = chip->log.bios_event_log + >> resource_size(&res); >> + >> +    return chip->flags & TPM_CHIP_FLAG_TPM2 ? >> EFI_TCG2_EVENT_LOG_FORMAT_TCG_2 : >> +        EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2; >> +} >> + >>   int tpm_read_log_of(struct tpm_chip *chip) >>   { >>       struct device_node *np; >> @@ -39,7 +75,7 @@ int tpm_read_log_of(struct tpm_chip *chip) >>       sizep = of_get_property(np, "linux,sml-size", NULL); >>       basep = of_get_property(np, "linux,sml-base", NULL); >>       if (sizep == NULL && basep == NULL) >> -        return -ENODEV; >> +        return tpm_read_log_memory_region(chip); >>       if (sizep == NULL || basep == NULL) >>           return -EIO;