Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp4817515pxb; Wed, 20 Apr 2022 10:36:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1WN6TfQyZNIHBg1HgaQFtko3AqiPnB5I/UqnLDWCDgJOikZt+FyB+pn1fkUVstMtphyTG X-Received: by 2002:a17:906:7111:b0:6e8:973a:1515 with SMTP id x17-20020a170906711100b006e8973a1515mr19887478ejj.308.1650476183163; Wed, 20 Apr 2022 10:36:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650476183; cv=none; d=google.com; s=arc-20160816; b=z2Ex8d7hA8EXgMT5c/XvGd7IfPUG9N7rngqM9h6DO3H9x5FzDKkNviBT2qUZk8Nkcd y1B5/EYQSz6tZXqh6BQRyGn1eIl5JSgq6ZweesrDreUOndrDqSfblmS4zufqmgAPhu+t Tl9AZQbaUIanZcFdGT5wwOHZ50Ljd/3NK2/ZfWInYoqcLp3d/5OzTMmfheuvjuqTXCvM qIzqi3eQUQsjZewPDx1r0Nc8S+5dTANftLGavALNWHQ+VoIY5ftb609SyBdzYzEVfd5X fDnE0EcUxk1zFVZ29bkqtZOuuTqpwlpeTQewdnAYa5DX8SsCt67XY3DKx/8Eohf/Rqr/ pZOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=RHrbFYBi/qzFHB7B/mm3DnbADsP51ix+XKNZcvCBDdI=; b=cpmRRh6zhxOMmdlrSmgteRmKwdx6M7utOUQhSGEBAwh6/J/RBw1EUyziIydBlUmwmV rGqHKQjqsAjwA9JaAjTYK+oa1XmkxCzNkfgUWoUxcoYLc1IAlbekAMndJG6ALdKXpc0h toCXPwHWvsfW/xmcUG6s1obfWwybsQk7b/1vGe9sCZMauwhKagzadbcAmyU1xg1AlxXW kw1Ful3XD2pq1mOBJ1rKSaIj76UTtU8Ap0wgu6KCbQ7L0x07KsWZZ8sdTHziqRgvHoX0 OFocW1XkzJAKXMWx3x5rMxMxZWBq4ml92C2xoKOR80vfL4K8AlcQydueWIGWV0d6Ukcw uPZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Dx9tpGwf; 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=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k10-20020a170906158a00b006e8bbf3d88fsi2337657ejd.15.2022.04.20.10.35.57; Wed, 20 Apr 2022 10:36:23 -0700 (PDT) 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=@google.com header.s=20210112 header.b=Dx9tpGwf; 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=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347521AbiDSXoY (ORCPT + 99 others); Tue, 19 Apr 2022 19:44:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354561AbiDSXmd (ORCPT ); Tue, 19 Apr 2022 19:42:33 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DC7EE9F for ; Tue, 19 Apr 2022 16:39:48 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id u17-20020a05600c211100b0038eaf4cdaaeso2576525wml.1 for ; Tue, 19 Apr 2022 16:39:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=RHrbFYBi/qzFHB7B/mm3DnbADsP51ix+XKNZcvCBDdI=; b=Dx9tpGwffSyQwjHNSd6zVcAaAeE7zztKVijW4Ho4OfPOmsnL2LNx7U24GIcoMarJzR vCSNNTjPahvmsr6XdXQ/zmPc3KsmtcvXh2Q9pXY+Awuf/UntrxK1BYEinZkDZAkRMX9D 80hqpsDd1anuJx/CXprXq6QO/3hyB6iFkiGnY1ZYo61TGaEwTZJnT0KxHYNH+k4aalNS 8+CdEn9xwRRRzOMpaAsNDmWmeM59tROwLnD8mVEeeB4JnUVT6AwfY2sOOxiWp9BEdwV4 2TPBqIoUcev6KbPGpXAwxVu+xjeHMME3Pbk7nXYoJbJWNkl0/q0qXxnKS4rur+qqVEMs CH0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=RHrbFYBi/qzFHB7B/mm3DnbADsP51ix+XKNZcvCBDdI=; b=ajmI5hU9968W8KWoHX1FWvREsJ1nOHhL2QmLjcVGSlt9uHvC72DgYhzhhpZPyqCNTo WeoaFmvQ0Qo2flLl1h+hzxZYr2eDccGJGWG598qDLATpAV2VxeyiVlIt7nQLsaAHmHso pmAjqE4rYsltdK2dnO0Vua+MjtigxOBm+86kPevwbCcuS45t0XXq374AZUrwK6iEFNrh 0VTjTP6OOEnbh88dchUF7qCjdWagjCBLJI+uCSb53h2iqP2kIYRIhHWncacoRJF6OPPZ lFw7Jt57rBVPgXSm/trR9thNkby4b1WlrYHV4/Uau8PiBvdNqDq7TQAkcFvQfrbAa5tE t+zw== X-Gm-Message-State: AOAM532uDnoBfHACCmeKjzLwCnspwfzHFGgt43uTBOGjfsgeSq15Jy6y HV0GSXASaYKtcmB+mPbAyY0sME83utjK//xC+TnFvg== X-Received: by 2002:a7b:c341:0:b0:37b:c619:c9f4 with SMTP id l1-20020a7bc341000000b0037bc619c9f4mr901984wmj.38.1650411586902; Tue, 19 Apr 2022 16:39:46 -0700 (PDT) MIME-Version: 1.0 References: <20220405173741.4023216-1-jbk@chromium.org> <6528eec1-0ab1-a5ff-3e30-2e06256dfd04@molgen.mpg.de> <068becdf-2d88-65a1-5977-1fedd34a8f0b@molgen.mpg.de> <047c3145c93a35ec3096aad44b221bda7d9e12c7.camel@kernel.org> In-Reply-To: <047c3145c93a35ec3096aad44b221bda7d9e12c7.camel@kernel.org> From: Jes Klinke Date: Tue, 19 Apr 2022 16:39:35 -0700 Message-ID: Subject: Re: [PATCH] tpm: cr50: Add new device/vendor ID 0x504a6666 To: Jarkko Sakkinen Cc: Paul Menzel , "Jes B. Klinke" , linux-integrity@vger.kernel.org, Jason Gunthorpe , Peter Huewe , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable 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 Thanks for your feedback, I have sent an updated patch to the list, (as far as I could tell, the convention is to prefix with: [PATCH v2]). Regards Jes On Thu, Apr 14, 2022 at 9:53 AM Jarkko Sakkinen wrote: > > On Thu, 2022-04-14 at 17:06 +0200, Paul Menzel wrote: > > Dear Jarkko, > > > > > > Am 14.04.22 um 14:08 schrieb Jarkko Sakkinen: > > > On Thu, Apr 07, 2022 at 12:21:44PM +0200, Paul Menzel wrote: > > > > > > Thank you for your patch. > > > > > > > > Am 05.04.22 um 19:37 schrieb Jes B. Klinke: > > > > > Accept one additional numerical value of DID:VID for next generat= ion > > > > > Google TPM, to be used in future Chromebooks. > > > > > > > > Maybe extend: > > > > > > > > =E2=80=A6 Google TPM with new firmware =E2=80=A6 > > > > > > > > The TPM with the new firmware has the code name TI50, and going to = use the > > > > same interfaces. > > > > > > > > > This patch touches more lines than may seem necessary, as a resul= t of > > > > > the need to move the error case to sit after the two recognized c= ases. > > > > > > > > > > Signed-off-by: Jes B. Klinke > > > > > --- > > > > > > > > > > drivers/char/tpm/tpm_tis_i2c_cr50.c | 21 +++++++++++++-------- > > > > > 1 file changed, 13 insertions(+), 8 deletions(-) > > > > > > > > > > diff --git a/drivers/char/tpm/tpm_tis_i2c_cr50.c b/drivers/char/t= pm/tpm_tis_i2c_cr50.c > > > > > index f6c0affbb4567..bf54ebd6724b0 100644 > > > > > --- a/drivers/char/tpm/tpm_tis_i2c_cr50.c > > > > > +++ b/drivers/char/tpm/tpm_tis_i2c_cr50.c > > > > > @@ -31,6 +31,7 @@ > > > > > #define TPM_CR50_TIMEOUT_SHORT_MS 2 /* Short = timeout during transactions */ > > > > > #define TPM_CR50_TIMEOUT_NOIRQ_MS 20 /* Timeou= t for TPM ready without IRQ */ > > > > > #define TPM_CR50_I2C_DID_VID 0x00281ae0L /* Device= and vendor ID reg value */ > > > > > +#define TPM_TI50_I2C_DID_VID 0x504a6666L /* Device= and vendor ID reg value */ > > > > > #define TPM_CR50_I2C_MAX_RETRIES 3 /* Max re= tries due to I2C errors */ > > > > > #define TPM_CR50_I2C_RETRY_DELAY_LO 55 /* Min us= ecs between retries on I2C */ > > > > > #define TPM_CR50_I2C_RETRY_DELAY_HI 65 /* Max us= ecs between retries on I2C */ > > > > > @@ -742,16 +743,20 @@ static int tpm_cr50_i2c_probe(struct i2c_cl= ient *client) > > > > > } > > > > > vendor =3D le32_to_cpup((__le32 *)buf); > > > > > - if (vendor !=3D TPM_CR50_I2C_DID_VID) { > > > > > - dev_err(dev, "Vendor ID did not match! ID was %08= x\n", vendor); > > > > > - tpm_cr50_release_locality(chip, true); > > > > > - return -ENODEV; > > > > > + if (vendor =3D=3D TPM_CR50_I2C_DID_VID) { > > > > > + dev_info(dev, "cr50 TPM 2.0 (i2c 0x%02x irq %d id= 0x%x)\n", > > > > > + client->addr, client->irq, vendor >> 16)= ; > > > > > + return tpm_chip_register(chip); > > > > > + } > > > > > + if (vendor =3D=3D TPM_TI50_I2C_DID_VID) { > > > > > + dev_info(dev, "ti50 TPM 2.0 (i2c 0x%02x irq %d id= 0x%x)\n", > > > > > + client->addr, client->irq, vendor >> 16)= ; > > > > > + return tpm_chip_register(chip); > > > > > } > > > > > > > > Both branches are quite similar. Can a ternary operator be used? > > > > > > > > dev_info(dev, "%s TPM 2.0 (i2c 0x%02x irq %d id 0x%x)\n", > > > > (vendor =3D=3D TPM_CR50_I2C_DID_VID) ? "cr50" : "ti50", cl= ient->addr, > > > > client->irq, vendor >> 16); > > > > return tpm_chip_register(chip); > > > > > > > > and the original flow be left? (A separate variable can also be add= ed.) > > > > > > > > > - dev_info(dev, "cr50 TPM 2.0 (i2c 0x%02x irq %d id 0x%x)\n= ", > > > > > - client->addr, client->irq, vendor >> 16); > > > > > - > > > > > - return tpm_chip_register(chip); > > > > > + dev_err(dev, "Vendor ID did not match! ID was %08x\n", ve= ndor); > > > > > + tpm_cr50_release_locality(chip, true); > > > > > + return -ENODEV; > > > > > } > > > > > /** > > > > > OK, these are legit suggestions. Paul, can you do these changes and a= dd my > > > reviewed-by for the +1 version? > > > > I guess you mean Jes? > > > > > > Kind regards, > > Yeah, I meant Jes :-) > > /Jarkko