From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by mx.groups.io with SMTP id smtpd.web09.457.1581879293275993931 for ; Sun, 16 Feb 2020 10:54:53 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: linux.ibm.com, ip: 148.163.156.1, mailfrom: stefanb@linux.ibm.com) Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 01GIrv2I180295; Sun, 16 Feb 2020 13:54:52 -0500 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 2y6cu0v2bd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 16 Feb 2020 13:54:52 -0500 Received: from m0098409.ppops.net (m0098409.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 01GIspSi181689; Sun, 16 Feb 2020 13:54:51 -0500 Received: from ppma01dal.us.ibm.com (83.d6.3fa9.ip4.static.sl-reverse.com [169.63.214.131]) by mx0a-001b2d01.pphosted.com with ESMTP id 2y6cu0v2b8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 16 Feb 2020 13:54:51 -0500 Received: from pps.filterd (ppma01dal.us.ibm.com [127.0.0.1]) by ppma01dal.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 01GIp0S1021685; Sun, 16 Feb 2020 18:54:50 GMT Received: from b03cxnp07029.gho.boulder.ibm.com (b03cxnp07029.gho.boulder.ibm.com [9.17.130.16]) by ppma01dal.us.ibm.com with ESMTP id 2y6895y9tb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 16 Feb 2020 18:54:50 +0000 Received: from b03ledav005.gho.boulder.ibm.com (b03ledav005.gho.boulder.ibm.com [9.17.130.236]) by b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 01GIsn6X47186292 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 16 Feb 2020 18:54:49 GMT Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A7A51BE04F; Sun, 16 Feb 2020 18:54:49 +0000 (GMT) Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 40AEDBE051; Sun, 16 Feb 2020 18:54:49 +0000 (GMT) Received: from sbct-3.pok.ibm.com (unknown [9.47.158.153]) by b03ledav005.gho.boulder.ibm.com (Postfix) with ESMTP; Sun, 16 Feb 2020 18:54:49 +0000 (GMT) Subject: Re: [edk2-devel] [PATCH v2 0/3] Ovmf: enable TPM 1.2 To: devel@edk2.groups.io, mlureau@redhat.com, jiewen.yao@intel.com Cc: "edk2-devel@lists.01.org" , "lersek@redhat.com" , "simon.hardy@itdev.co.uk" References: <20200213131222.157700-1-marcandre.lureau@redhat.com> <74D8A39837DF1E4DA445A8C0B3885C503F92D53C@shsmsx102.ccr.corp.intel.com> From: "Stefan Berger" Message-ID: <75a5caf6-5b60-685c-9f09-240406eb2b5a@linux.ibm.com> Date: Sun, 16 Feb 2020 13:54:48 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-02-16_04:2020-02-14,2020-02-16 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 mlxscore=0 suspectscore=0 bulkscore=0 spamscore=0 lowpriorityscore=0 impostorscore=0 adultscore=0 clxscore=1011 mlxlogscore=999 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002160170 X-MIME-Autoconverted: from 8bit to quoted-printable by mx0a-001b2d01.pphosted.com id 01GIrv2I180295 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 2/15/20 6:33 AM, Marc-Andr=C3=A9 Lureau wrote: > Hi Yao > > On Thu, Feb 13, 2020 at 2:51 PM Yao, Jiewen wrote= : >> Hi Lureau >> I don=E2=80=99t think we should expose the TPM Interface type via TpmCo= mmandLib. >> >> That is the TPM device implementation. The TPM device might use TIS/FIF= O/CRB, but there might be also other type such as I2C, or fTPM implementati= on type. >> >> To distinguish TPM2.0 or TPM1.2, the standard way is to send startup co= mmand. > Thanks for the feedback, unfortunately I don't know how to achieve > this for both tpm/vtpm (uninitialized) & passthrough (initialized). > > If the device is uninitialized, sending Tpm12Startup (TPM_ST_CLEAR) to > detect 1.2 in Tcg2ConfigPeimEntryPoint will work, but then > Tpm12Startup () in TcgPei:PeimEntryMA will later fail. > > If the device is initialized/passthrough, sending Tpm12Startup > (TPM_ST_CLEAR) will fail, so it could send Tpm12Startup (TPM_ST_STATE) > instead. But that will fail to detect uninitialized 1.2 device. > > I am stuck, any help welcome! You should be able to do this in the same way as we do it in QEMU: https://github.com/qemu/qemu/blob/master/hw/tpm/tpm_util.c#L190 Send a command (non-TPM_Startup) to it and inspect the TAG in the header. =C2=A0=C2=A0 Stefan > > thanks > >> Thank you >> Yao Jiewen >> >> >>> -----Original Message----- >>> From: devel@edk2.groups.io On Behalf Of >>> marcandre.lureau@redhat.com >>> Sent: Thursday, February 13, 2020 9:12 PM >>> To: edk2-devel@lists.01.org; devel@edk2.groups.io >>> Cc: stefanb@linux.ibm.com; lersek@redhat.com; simon.hardy@itdev.co.uk; >>> Marc-Andr=C3=A9 Lureau >>> Subject: [edk2-devel] [PATCH v2 0/3] Ovmf: enable TPM 1.2 >>> >>> From: Marc-Andr=C3=A9 Lureau >>> >>> Hi, >>> >>> The following patches add basic TPM 1.2 support for Ovmf/QEMU. >>> >>> I tested successfully Win10 with TIS/TPM 1.2 & CRB/TPM 2.0 >>> passthrough, and emulated CRB/TPM 2.0. >>> (fwiw, I haven't tried to enable TPM_CONFIG_ENABLE) >>> >>> Marc-Andr=C3=A9 Lureau (3): >>> Ovmf: rename TPM2 config prefix to TPM >>> SecurityPkg: export Tpm12GetPtpInterfaceType() >>> Ovmf: enable TPM 1.2 support >>> >>> OvmfPkg/OvmfPkgIa32.dsc | 39 +++++++++++++----= -- >>> OvmfPkg/OvmfPkgIa32.fdf | 10 +++-- >>> OvmfPkg/OvmfPkgIa32X64.dsc | 39 +++++++++++++----= -- >>> OvmfPkg/OvmfPkgIa32X64.fdf | 10 +++-- >>> OvmfPkg/OvmfPkgX64.dsc | 39 +++++++++++++----= -- >>> OvmfPkg/OvmfPkgX64.fdf | 10 +++-- >>> OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf | 3 ++ >>> OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPeim.c | 17 +++++++- >>> SecurityPkg/Include/Library/Tpm12DeviceLib.h | 13 +++++++ >>> .../Library/Tpm12DeviceLibDTpm/Tpm12Tis.c | 17 ++++---- >>> 10 files changed, 141 insertions(+), 56 deletions(-) >>> >>> -- >>> 2.25.0.rc2.1.g09a9a1a997 >>> >>> >>> >> >> >> > >=20 >