From nobody Tue Apr 23 07:39:45 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) client-ip=80.81.252.135; envelope-from=seabios-bounces@seabios.org; helo=mail.coreboot.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org Return-Path: Received: from mail.coreboot.org (mail.coreboot.org [80.81.252.135]) by mx.zohomail.com with SMTPS id 1521475292499741.4420695314057; Mon, 19 Mar 2018 09:01:32 -0700 (PDT) Received: from [127.0.0.1] (helo=ra.coreboot.org) by mail.coreboot.org with esmtp (Exim 4.86_2) (envelope-from ) id 1exxJG-0006wv-1D; Mon, 19 Mar 2018 17:06:54 +0100 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5] helo=mx0a-001b2d01.pphosted.com) by mail.coreboot.org with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_2) (envelope-from ) id 1exxJ0-0006rb-ID for seabios@seabios.org; Mon, 19 Mar 2018 17:06:52 +0100 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w2JG0kQ7048462 for ; Mon, 19 Mar 2018 12:00:52 -0400 Received: from e38.co.us.ibm.com (e38.co.us.ibm.com [32.97.110.159]) by mx0b-001b2d01.pphosted.com with ESMTP id 2gtfew2us3-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Mon, 19 Mar 2018 12:00:50 -0400 Received: from localhost by e38.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 19 Mar 2018 10:00:34 -0600 Received: from b03cxnp08028.gho.boulder.ibm.com (9.17.130.20) by e38.co.us.ibm.com (192.168.1.138) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 19 Mar 2018 10:00:33 -0600 Received: from b03ledav003.gho.boulder.ibm.com (b03ledav003.gho.boulder.ibm.com [9.17.130.234]) by b03cxnp08028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w2JG0MCg62521396; Mon, 19 Mar 2018 09:00:33 -0700 Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F28D76A04C; Mon, 19 Mar 2018 10:00:32 -0600 (MDT) Received: from sbct-3.watson.ibm.com (unknown [9.47.158.153]) by b03ledav003.gho.boulder.ibm.com (Postfix) with ESMTP id 9D9A46A047; Mon, 19 Mar 2018 10:00:32 -0600 (MDT) From: Stefan Berger To: seabios@seabios.org, kevin@koconnor.net, stephend@silicom-usa.com Date: Mon, 19 Mar 2018 12:00:27 -0400 X-Mailer: git-send-email 2.5.5 In-Reply-To: <1521475229-21406-1-git-send-email-stefanb@linux.vnet.ibm.com> References: <1521475229-21406-1-git-send-email-stefanb@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18031916-0028-0000-0000-000009526646 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008703; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000254; SDB=6.01005375; UDB=6.00511820; IPR=6.00784659; MB=3.00020126; MTD=3.00000008; XFM=3.00000015; UTC=2018-03-19 16:00:34 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18031916-0029-0000-0000-00003A06FF4F Message-Id: <1521475229-21406-2-git-send-email-stefanb@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-19_09:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803190180 X-Spam-Score: -6.0 (------) Subject: [SeaBIOS] [PATCH v2 1/3] tpm: Wait for tpmRegValidSts flag on CRQ interface before probing X-BeenThere: seabios@seabios.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SeaBIOS mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: seabios-bounces@seabios.org Sender: "SeaBIOS" X-Duff: Orig. Duff, Duff Lite, Duff Dry, Duff Dark, Raspberry Duff, Lady Duff, Red Duff, Tartar Control Duff X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Wait for the tpmRegValidSts flag on the TPM_LOC_STATE_x register to be set; we espect the locAssigned flag to not be set. Real hardware seems to set the tpmRegValidSts flag without for example requesting access to a locality. Signed-off-by: Stefan Berger Tested-by: Stephen Douthit --- src/hw/tpm_drivers.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/hw/tpm_drivers.c b/src/hw/tpm_drivers.c index ed58bf5..7e6a96a 100644 --- a/src/hw/tpm_drivers.c +++ b/src/hw/tpm_drivers.c @@ -374,12 +374,22 @@ static u32 tis_waitrespready(enum tpmDurationType to_= t) return rc; } =20 +#define CRB_STATE_VALID_STS 0b10000000 +#define CRB_STATE_LOC_ASSIGNED 0x00000010 +#define CRB_STATE_READY_MASK (CRB_STATE_VALID_STS | CRB_STATE_LOC_ASSIGNED) + /* if device is not there, return '0', '1' otherwise */ static u32 crb_probe(void) { if (!CONFIG_TCGBIOS) return 0; =20 + /* Wait for the interface to report it's ready */ + u32 rc =3D crb_wait_reg(0, CRB_REG_LOC_STATE, TIS2_DEFAULT_TIMEOUT_D, + CRB_STATE_READY_MASK, CRB_STATE_VALID_STS); + if (rc) + return 0; + u32 ifaceid =3D readl(CRB_REG(0, CRB_REG_INTF_ID)); =20 if ((ifaceid & 0xf) !=3D 0xf) { --=20 2.5.5 _______________________________________________ SeaBIOS mailing list SeaBIOS@seabios.org https://mail.coreboot.org/mailman/listinfo/seabios From nobody Tue Apr 23 07:39:45 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) client-ip=80.81.252.135; envelope-from=seabios-bounces@seabios.org; helo=mail.coreboot.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org Return-Path: Received: from mail.coreboot.org (mail.coreboot.org [80.81.252.135]) by mx.zohomail.com with SMTPS id 1521475293522102.52759657533215; Mon, 19 Mar 2018 09:01:33 -0700 (PDT) Received: from [127.0.0.1] (helo=ra.coreboot.org) by mail.coreboot.org with esmtp (Exim 4.86_2) (envelope-from ) id 1exxJH-0006xE-Lw; Mon, 19 Mar 2018 17:06:55 +0100 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by mail.coreboot.org with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_2) (envelope-from ) id 1exxJ1-0006rc-UG for seabios@seabios.org; Mon, 19 Mar 2018 17:06:53 +0100 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w2JG0qWV022099 for ; Mon, 19 Mar 2018 12:00:53 -0400 Received: from e32.co.us.ibm.com (e32.co.us.ibm.com [32.97.110.150]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gte5np118-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Mon, 19 Mar 2018 12:00:52 -0400 Received: from localhost by e32.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 19 Mar 2018 10:00:37 -0600 Received: from b03cxnp08028.gho.boulder.ibm.com (9.17.130.20) by e32.co.us.ibm.com (192.168.1.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 19 Mar 2018 10:00:35 -0600 Received: from b03ledav003.gho.boulder.ibm.com (b03ledav003.gho.boulder.ibm.com [9.17.130.234]) by b03cxnp08028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w2JG0MCi62521396; Mon, 19 Mar 2018 09:00:34 -0700 Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7FA6C6A04D; Mon, 19 Mar 2018 10:00:34 -0600 (MDT) Received: from sbct-3.watson.ibm.com (unknown [9.47.158.153]) by b03ledav003.gho.boulder.ibm.com (Postfix) with ESMTP id 1F6676A03F; Mon, 19 Mar 2018 10:00:34 -0600 (MDT) From: Stefan Berger To: seabios@seabios.org, kevin@koconnor.net, stephend@silicom-usa.com Date: Mon, 19 Mar 2018 12:00:28 -0400 X-Mailer: git-send-email 2.5.5 In-Reply-To: <1521475229-21406-1-git-send-email-stefanb@linux.vnet.ibm.com> References: <1521475229-21406-1-git-send-email-stefanb@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18031916-0004-0000-0000-000013D26598 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008703; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000254; SDB=6.01005376; UDB=6.00511821; IPR=6.00784658; MB=3.00020126; MTD=3.00000008; XFM=3.00000015; UTC=2018-03-19 16:00:36 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18031916-0005-0000-0000-000086863012 Message-Id: <1521475229-21406-3-git-send-email-stefanb@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-19_09:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803190180 X-Spam-Score: -6.0 (------) Subject: [SeaBIOS] [PATCH v2 2/3] tpm: revert return values for successful/failed CRB probing X-BeenThere: seabios@seabios.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SeaBIOS mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: seabios-bounces@seabios.org Sender: "SeaBIOS" X-Duff: Orig. Duff, Duff Lite, Duff Dry, Duff Dark, Raspberry Duff, Lady Duff, Red Duff, Tartar Control Duff X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The return values for successful/failed CRB probing were reverted. Fix it. Signed-off-by: Stefan Berger --- src/hw/tpm_drivers.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hw/tpm_drivers.c b/src/hw/tpm_drivers.c index 7e6a96a..271f8d3 100644 --- a/src/hw/tpm_drivers.c +++ b/src/hw/tpm_drivers.c @@ -409,13 +409,13 @@ static u32 crb_probe(void) =20 /* no support for 64 bit addressing yet */ if (readl(CRB_REG(0, CRB_REG_CTRL_CMD_HADDR))) - return 1; + return 0; =20 u64 addr =3D readq(CRB_REG(0, CRB_REG_CTRL_RSP_ADDR)); if (addr > 0xffffffff) - return 1; + return 0; =20 - return 0; + return 1; } =20 static TPMVersion crb_get_tpm_version(void) --=20 2.5.5 _______________________________________________ SeaBIOS mailing list SeaBIOS@seabios.org https://mail.coreboot.org/mailman/listinfo/seabios From nobody Tue Apr 23 07:39:45 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) client-ip=80.81.252.135; envelope-from=seabios-bounces@seabios.org; helo=mail.coreboot.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org Return-Path: Received: from mail.coreboot.org (mail.coreboot.org [80.81.252.135]) by mx.zohomail.com with SMTPS id 1521475292497194.422021483124; Mon, 19 Mar 2018 09:01:32 -0700 (PDT) Received: from [127.0.0.1] (helo=ra.coreboot.org) by mail.coreboot.org with esmtp (Exim 4.86_2) (envelope-from ) id 1exxJM-0006yC-Dr; Mon, 19 Mar 2018 17:07:00 +0100 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by mail.coreboot.org with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_2) (envelope-from ) id 1exxJ6-0006rx-RD for seabios@seabios.org; Mon, 19 Mar 2018 17:06:58 +0100 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w2JG0nG6117235 for ; Mon, 19 Mar 2018 12:00:58 -0400 Received: from e31.co.us.ibm.com (e31.co.us.ibm.com [32.97.110.149]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gtdg391a7-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Mon, 19 Mar 2018 12:00:56 -0400 Received: from localhost by e31.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 19 Mar 2018 10:00:38 -0600 Received: from b03cxnp07029.gho.boulder.ibm.com (9.17.130.16) by e31.co.us.ibm.com (192.168.1.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 19 Mar 2018 10:00:36 -0600 Received: from b03ledav003.gho.boulder.ibm.com (b03ledav003.gho.boulder.ibm.com [9.17.130.234]) by b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w2JG0aHv11600258; Mon, 19 Mar 2018 09:00:36 -0700 Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EBDCE6A045; Mon, 19 Mar 2018 10:00:35 -0600 (MDT) Received: from sbct-3.watson.ibm.com (unknown [9.47.158.153]) by b03ledav003.gho.boulder.ibm.com (Postfix) with ESMTP id 9573B6A042; Mon, 19 Mar 2018 10:00:35 -0600 (MDT) From: Stefan Berger To: seabios@seabios.org, kevin@koconnor.net, stephend@silicom-usa.com Date: Mon, 19 Mar 2018 12:00:29 -0400 X-Mailer: git-send-email 2.5.5 In-Reply-To: <1521475229-21406-1-git-send-email-stefanb@linux.vnet.ibm.com> References: <1521475229-21406-1-git-send-email-stefanb@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18031916-8235-0000-0000-00000D2ED51F X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008703; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000254; SDB=6.01005375; UDB=6.00511821; IPR=6.00784659; MB=3.00020126; MTD=3.00000008; XFM=3.00000015; UTC=2018-03-19 16:00:37 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18031916-8236-0000-0000-0000401F5084 Message-Id: <1521475229-21406-4-git-send-email-stefanb@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-19_09:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803190180 X-Spam-Score: -6.0 (------) Subject: [SeaBIOS] [PATCH v2 3/3] tpm: when CRB is active, select, lock it, and check addresses X-BeenThere: seabios@seabios.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SeaBIOS mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: seabios-bounces@seabios.org Sender: "SeaBIOS" X-Duff: Orig. Duff, Duff Lite, Duff Dry, Duff Dark, Raspberry Duff, Lady Duff, Red Duff, Tartar Control Duff X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Do not just indicate that the probing for the CRB interface was successful if we find it active. Instead, select it, lock it, and test the addresses for whether they can be used (must be 32 bit). Signed-off-by: Stefan Berger --- src/hw/tpm_drivers.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/hw/tpm_drivers.c b/src/hw/tpm_drivers.c index 271f8d3..bd971f7 100644 --- a/src/hw/tpm_drivers.c +++ b/src/hw/tpm_drivers.c @@ -395,9 +395,7 @@ static u32 crb_probe(void) if ((ifaceid & 0xf) !=3D 0xf) { if ((ifaceid & 0xf) =3D=3D 1) { /* CRB is active */ - return 1; - } - if ((ifaceid & (1 << 14)) =3D=3D 0) { + } else if ((ifaceid & (1 << 14)) =3D=3D 0) { /* CRB cannot be selected */ return 0; } --=20 2.5.5 _______________________________________________ SeaBIOS mailing list SeaBIOS@seabios.org https://mail.coreboot.org/mailman/listinfo/seabios