From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by mx.groups.io with SMTP id smtpd.web10.618.1631566650634063191 for ; Mon, 13 Sep 2021 13:57:31 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@ibm.com header.s=pp1 header.b=XFVTu39f; spf=none, err=permanent DNS error (domain: linux.vnet.ibm.com, ip: 148.163.158.5, mailfrom: stefanb@linux.vnet.ibm.com) Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.0.43) with SMTP id 18DIDmBQ032981; Mon, 13 Sep 2021 16:57:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=lHzUaskZgdTLK/WypaUI2+vZXekix3OYGmNa2NzWtb8=; b=XFVTu39fgL5moRCzgjxkg/p7fAlynwyKko6sStOP+xNGEUW+kmUJG7h1Pt33AGt3hvu+ 0mqZhZfQ0euN8o8uud2VjbRJfF06Mh0d95zo6yhz9Az5tW/6skzlmD1vuWb3f7AJm4F9 GbcyYLKMnuCJzTQUvrAzpQjw/SwxlUb4mkBDuQmq77VIDZ+DvSjo1t8XAIfAlwkfsHy9 nX1EQsWY2aXasrSv0DE03MO26P0v648wuXm/0zKLqrPMFyyGbuc0A+TXBc5uq5+DwCsc V8EcpUIcGU0mgdaMagdhyLIT4AW8BgJF66KHzm/mlco8MIO5KAGJw2NKfCLmVGwalEID AA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3b232j9dtg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Sep 2021 16:57:28 -0400 Received: from m0127361.ppops.net (m0127361.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 18DKWq7n028117; Mon, 13 Sep 2021 16:57:28 -0400 Received: from ppma04wdc.us.ibm.com (1a.90.2fa9.ip4.static.sl-reverse.com [169.47.144.26]) by mx0a-001b2d01.pphosted.com with ESMTP id 3b232j9dt4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Sep 2021 16:57:28 -0400 Received: from pps.filterd (ppma04wdc.us.ibm.com [127.0.0.1]) by ppma04wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 18DKvNGL029689; Mon, 13 Sep 2021 20:57:27 GMT Received: from b01cxnp22034.gho.pok.ibm.com (b01cxnp22034.gho.pok.ibm.com [9.57.198.24]) by ppma04wdc.us.ibm.com with ESMTP id 3b0m3ahq16-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Sep 2021 20:57:27 +0000 Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp22034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 18DKvReS43319658 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Sep 2021 20:57:27 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0AADEAE063; Mon, 13 Sep 2021 20:57:27 +0000 (GMT) Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F09E9AE066; Mon, 13 Sep 2021 20:57:26 +0000 (GMT) Received: from sbct-2.pok.ibm.com (unknown [9.47.158.152]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP; Mon, 13 Sep 2021 20:57:26 +0000 (GMT) From: "Stefan Berger" To: devel@edk2.groups.io Cc: mhaeuser@posteo.de, spbrogan@outlook.com, marcandre.lureau@redhat.com, kraxel@redhat.com, jiewen.yao@intel.com, Stefan Berger , Stefan Berger Subject: [RFC PATCH v1 2/4] OvmfPkg: Handle TPM 2 physical presence codes much earlier Date: Mon, 13 Sep 2021 16:57:20 -0400 Message-Id: <20210913205722.2553473-3-stefanb@linux.vnet.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210913205722.2553473-1-stefanb@linux.vnet.ibm.com> References: <20210913205722.2553473-1-stefanb@linux.vnet.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: H2uyp9bURFjDS9RRL8loL__augGqo9KR X-Proofpoint-ORIG-GUID: JJ-gyljy0oRmjj5fHkufj7yZgNbp0eUN X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.687,Hydra:6.0.235,FMLib:17.0.607.475 definitions=2020-10-13_15,2020-10-13_02,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 adultscore=0 bulkscore=0 suspectscore=0 impostorscore=0 lowpriorityscore=0 phishscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 clxscore=1015 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109030001 definitions=main-2109130046 Content-Transfer-Encoding: quoted-printable Handle the TPM 2 physical presence interface (PPI) opcodes in PlatformBootManagerBeforeConsole() before the TPM 2 platform hierarchy is disabled. Since the handling of the PPI opcodes may require inter- action with the user, initialize the keyboard before handling PPI codes. Signed-off-by: Stefan Berger --- .../PlatformBootManagerLib/BdsPlatform.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg= /Library/PlatformBootManagerLib/BdsPlatform.c index 71f63b2448..5c1603ac19 100644 --- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c +++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c @@ -387,8 +387,17 @@ PlatformBootManagerBeforeConsole ( SaveS3BootScript ();=0D }=0D =0D + PlatformInitializeConsole (=0D + XenDetected() ? gXenPlatformConsole : gPlatformConsole);=0D +=0D + //=0D + // Process TPM PPI request; this may require keyboard input=0D + //=0D + Tcg2PhysicalPresenceLibProcessRequest (NULL);=0D +=0D //=0D // Prevent further changes to LockBoxes or SMRAM.=0D + // Any TPM 2 Physical Presence Interface opcode must be handled before.= =0D //=0D Handle =3D NULL;=0D Status =3D gBS->InstallProtocolInterface (&Handle,=0D @@ -402,9 +411,6 @@ PlatformBootManagerBeforeConsole ( //=0D EfiBootManagerDispatchDeferredImages ();=0D =0D - PlatformInitializeConsole (=0D - XenDetected() ? gXenPlatformConsole : gPlatformConsole);=0D -=0D FrontPageTimeout =3D GetFrontPageTimeoutFromQemu ();=0D PcdStatus =3D PcdSet16S (PcdPlatformBootTimeOut, FrontPageTimeout);=0D ASSERT_RETURN_ERROR (PcdStatus);=0D @@ -1511,11 +1517,6 @@ PlatformBootManagerAfterConsole ( //=0D PciAcpiInitialization ();=0D =0D - //=0D - // Process TPM PPI request=0D - //=0D - Tcg2PhysicalPresenceLibProcessRequest (NULL);=0D -=0D //=0D // Process QEMU's -kernel command line option=0D //=0D --=20 2.31.1