From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=209.132.183.28; helo=mx1.redhat.com; envelope-from=marcandre.lureau@redhat.com; receiver=edk2-devel@lists.01.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 53176209603E9 for ; Tue, 15 May 2018 05:30:21 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DB2B4126F07; Tue, 15 May 2018 12:30:20 +0000 (UTC) Received: from localhost (ovpn-116-28.phx2.redhat.com [10.3.116.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5A5079BD49; Tue, 15 May 2018 12:30:08 +0000 (UTC) From: marcandre.lureau@redhat.com To: edk2-devel@lists.01.org Cc: pjones@redhat.com, jiewen.yao@intel.com, stefanb@linux.vnet.ibm.com, lersek@redhat.com, qemu-devel@nongnu.org, javierm@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Tue, 15 May 2018 14:30:03 +0200 Message-Id: <20180515123007.10164-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 15 May 2018 12:30:21 +0000 (UTC) Subject: [PATCH 0/4] RFC: ovmf: Add support for TPM Physical Presence interface X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 May 2018 12:30:22 -0000 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Marc-André Lureau Hi, The following series adds basic TPM PPI 1.3 support for OVMF-on-QEMU with TPM2 (I haven't tested TPM1, for lack of interest). PPI test runs successfully with Windows 10 WHLK, despite the limited number of supported funcions (tpm2_ppi_funcs table, in particular, no function allows to manipulate Tcg2PhysicalPresenceFlags) The way it works is relatively simple: a memory region is allocated by QEMU to save PPI related variables. An ACPI interface is exposed by QEMU to let the guest manipulate those. At boot, ovmf processes and updates the PPI qemu region and request variables. I build edk2 with: $ build -DTPM2_ENABLE -DSECURE_BOOT_ENABLE I test with qemu & swtpm/libtpms (tpm2 branches, swtpm_setup.sh --tpm2 --tpm-state tpmstatedir) $ swtpm socket --tpmstate tpmstatedir --ctrl type=unixio,path=tpmsock --tpm2 & $ qemu .. -chardev socket,id=chrtpm,path=tpmsock -tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-crb,tpmdev=tpm0 Github trees: https://github.com/elmarco/edk2/tree/tpm-ppi https://github.com/elmarco/qemu/tree/tpm-ppi Thanks Marc-André Lureau (4): ovmf: add and link with Tcg2PhysicalPresenceLibNull when !TPM2_ENABLE ovmf: add QemuTpm.h header ovmf: replace SecurityPkg with OvfmPkg Tcg2PhysicalPresenceLibQemu ovmf: process TPM PPI request in AfterConsole() OvmfPkg/Include/IndustryStandard/QemuTpm.h | 67 ++ .../PlatformBootManagerLib/BdsPlatform.c | 8 + .../PlatformBootManagerLib.inf | 2 + .../DxeTcg2PhysicalPresenceLib.c | 26 + .../DxeTcg2PhysicalPresenceLib.inf | 34 + .../DxeTcg2PhysicalPresenceLib.c | 881 ++++++++++++++++++ .../DxeTcg2PhysicalPresenceLib.inf | 67 ++ .../DxeTcg2PhysicalPresenceLib.uni | 26 + .../PhysicalPresenceStrings.uni | 49 + OvmfPkg/OvmfPkgIa32.dsc | 4 +- OvmfPkg/OvmfPkgIa32X64.dsc | 4 +- OvmfPkg/OvmfPkgX64.dsc | 4 +- 12 files changed, 1169 insertions(+), 3 deletions(-) create mode 100644 OvmfPkg/Include/IndustryStandard/QemuTpm.h create mode 100644 OvmfPkg/Library/Tcg2PhysicalPresenceLibNull/DxeTcg2PhysicalPresenceLib.c create mode 100644 OvmfPkg/Library/Tcg2PhysicalPresenceLibNull/DxeTcg2PhysicalPresenceLib.inf create mode 100644 OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.c create mode 100644 OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.inf create mode 100644 OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.uni create mode 100644 OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/PhysicalPresenceStrings.uni -- 2.17.0.253.g3dd125b46d