From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 9913C9415E6 for ; Wed, 17 Jan 2024 09:47:57 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=jtsk2CYl+6zsQERFIRgtrv1JBsehQmKZwGXZN3Pmxr8=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1705484876; v=1; b=ZP1DDR25td984y48Q9gWFpp6FgXQcimwOrfxbdcYabSwhqbim2hv38kPur5TKLs4hlqPd+qX dZaRhBLQIT0BM1wK0cGNOnGn0xEjIqr5nxguKHXg0/lDrIXnUDVgzl4Dg2ZNNrthx/VtpB/kPtL o2u6rbkFvjvELB+1E1a2+MMs= X-Received: by 127.0.0.2 with SMTP id RA1cYY7687511xAvdoYO4V9G; Wed, 17 Jan 2024 01:47:56 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web10.5924.1705484875644647021 for ; Wed, 17 Jan 2024 01:47:55 -0800 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-606-qc2X2DN6NZ2LeD39l-Elaw-1; Wed, 17 Jan 2024 04:47:53 -0500 X-MC-Unique: qc2X2DN6NZ2LeD39l-Elaw-1 X-Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 287A8185A782 for ; Wed, 17 Jan 2024 09:47:53 +0000 (UTC) X-Received: from [10.39.192.21] (unknown [10.39.192.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 753E81BDB1; Wed, 17 Jan 2024 09:47:52 +0000 (UTC) Message-ID: Date: Wed, 17 Jan 2024 10:47:51 +0100 MIME-Version: 1.0 Subject: Re: [edk2-devel] [PATCH 2/2] OvmfPkg/Tcg2Config: remove unused TPM 1.2 support To: devel@edk2.groups.io, kraxel@redhat.com Cc: Oliver Steffen References: <20240116154229.554679-1-kraxel@redhat.com> <20240116154229.554679-3-kraxel@redhat.com> From: "Laszlo Ersek" In-Reply-To: <20240116154229.554679-3-kraxel@redhat.com> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,lersek@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: qvz2HWP4zHSwKj6gCeZ9KOXDx7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=ZP1DDR25; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io On 1/16/24 16:42, Gerd Hoffmann wrote: > Signed-off-by: Gerd Hoffmann > --- > OvmfPkg/Tcg/Tcg2Config/Tcg12ConfigPei.inf | 56 --------------- > OvmfPkg/Tcg/Tcg2Config/Tpm12Support.c | 83 ----------------------- > 2 files changed, 139 deletions(-) > delete mode 100644 OvmfPkg/Tcg/Tcg2Config/Tcg12ConfigPei.inf > delete mode 100644 OvmfPkg/Tcg/Tcg2Config/Tpm12Support.c >=20 > diff --git a/OvmfPkg/Tcg/Tcg2Config/Tcg12ConfigPei.inf b/OvmfPkg/Tcg/Tcg2= Config/Tcg12ConfigPei.inf > deleted file mode 100644 > index e8e0b88e6058..000000000000 > --- a/OvmfPkg/Tcg/Tcg2Config/Tcg12ConfigPei.inf > +++ /dev/null > @@ -1,56 +0,0 @@ > -## @file > -# Set TPM device type - supports TPM 1.2 and 2.0 > -# > -# In SecurityPkg, this module initializes the TPM device type based on a= UEFI > -# variable and/or hardware detection. In OvmfPkg, the module only perfor= ms TPM > -# hardware detection. > -# > -# Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
> -# Copyright (C) 2018, Red Hat, Inc. > -# > -# SPDX-License-Identifier: BSD-2-Clause-Patent > -## > - > -[Defines] > - INF_VERSION =3D 0x00010005 > - BASE_NAME =3D Tcg2ConfigPei > - FILE_GUID =3D 8AD3148F-945F-46B4-8ACD-71469EA7394= 5 > - MODULE_TYPE =3D PEIM > - VERSION_STRING =3D 1.0 > - ENTRY_POINT =3D Tcg2ConfigPeimEntryPoint > - > -[Sources] > - Tcg2ConfigPeim.c > - Tpm12Support.h > - Tpm12Support.c > - > -[Packages] > - MdePkg/MdePkg.dec > - MdeModulePkg/MdeModulePkg.dec > - OvmfPkg/OvmfPkg.dec > - SecurityPkg/SecurityPkg.dec > - > -[LibraryClasses] > - PeimEntryPoint > - DebugLib > - PeiServicesLib > - Tpm2DeviceLib > - BaseLib > - Tpm12DeviceLib > - > -[Guids] > - gEfiTpmDeviceSelectedGuid ## PRODUCES ## GUID # Used as a PP= I GUID > - gEfiTpmDeviceInstanceTpm20DtpmGuid ## SOMETIMES_CONSUMES > - gEfiTpmDeviceInstanceTpm12Guid ## SOMETIMES_CONSUMES > - > -[Ppis] > - gPeiTpmInitializationDonePpiGuid ## SOMETIMES_PRODUCES > - > -[Pcd] > - gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid ## PR= ODUCES > - > -[Depex.IA32, Depex.X64] > - gOvmfTpmMmioAccessiblePpiGuid > - > -[Depex.ARM, Depex.AARCH64] > - gOvmfTpmDiscoveredPpiGuid > diff --git a/OvmfPkg/Tcg/Tcg2Config/Tpm12Support.c b/OvmfPkg/Tcg/Tcg2Conf= ig/Tpm12Support.c > deleted file mode 100644 > index c88da5758b44..000000000000 > --- a/OvmfPkg/Tcg/Tcg2Config/Tpm12Support.c > +++ /dev/null > @@ -1,83 +0,0 @@ > -/** @file > - Implement the InternalTpm12Detect() function on top of the Tpm12Device= Lib > - class. > - > - Copyright (C) 2020, Red Hat, Inc. > - > - SPDX-License-Identifier: BSD-2-Clause-Patent > -**/ > - > -#include > -#include > - > -#include "Tpm12Support.h" > - > -#pragma pack (1) > -typedef struct { > - TPM_RSP_COMMAND_HDR Hdr; > - TPM_CURRENT_TICKS CurrentTicks; > -} TPM_RSP_GET_TICKS; > -#pragma pack () > - > -/** > - Probe for the TPM for 1.2 version, by sending TPM1.2 GetTicks > - > - Sending a TPM1.2 command to a TPM2 should return a TPM1.2 > - header (tag =3D 0xc4) and error code (TPM_BADTAG =3D 0x1e) > - > - @retval EFI_SUCCESS TPM version 1.2 probing successful. > - > - @return Error codes propagated from Tpm12SubmitCommand(). > -**/ > -STATIC > -EFI_STATUS > -TestTpm12 ( > - ) > -{ > - EFI_STATUS Status; > - TPM_RQU_COMMAND_HDR Command; > - TPM_RSP_GET_TICKS Response; > - UINT32 Length; > - > - Command.tag =3D SwapBytes16 (TPM_TAG_RQU_COMMAND); > - Command.paramSize =3D SwapBytes32 (sizeof (Command)); > - Command.ordinal =3D SwapBytes32 (TPM_ORD_GetTicks); > - > - Length =3D sizeof (Response); > - Status =3D Tpm12SubmitCommand ( > - sizeof (Command), > - (UINT8 *)&Command, > - &Length, > - (UINT8 *)&Response > - ); > - if (EFI_ERROR (Status)) { > - return Status; > - } > - > - return EFI_SUCCESS; > -} > - > -/** > - Detect the presence of a TPM with interface version 1.2. > - > - @retval EFI_SUCCESS TPM-1.2 available. The Tpm12RequestUseTpm() a= nd > - Tpm12SubmitCommand(TPM_ORD_GetTicks) operatio= ns > - (from the Tpm12DeviceLib class) have succeede= d. > - > - @return Error codes propagated from Tpm12RequestUseTp= m() and > - Tpm12SubmitCommand(). > -**/ > -EFI_STATUS > -InternalTpm12Detect ( > - VOID > - ) > -{ > - EFI_STATUS Status; > - > - Status =3D Tpm12RequestUseTpm (); > - if (EFI_ERROR (Status)) { > - return Status; > - } > - > - return TestTpm12 (); > -} This patch is good: Reviewed-by: Laszlo Ersek but the series shouldn't stop here. In "OvmfPkg/Tcg/Tcg2Config", we're left with an INF file (Tcg2ConfigPei.inf) that still references "Tpm12Support.h", and the common C source file "Tcg2ConfigPeim.c" still calls the one API -- InternalTpm12Detect() -- declared in that header file. The only remaining implementation of InternalTpm12Detect() is now in "Tpm12SupportNull.c", and all it does is "return EFI_UNSUPPORTED". Therefore, in a subsequent patch, "Tpm12SupportNull.c" and "Tpm12Support.h" should be removed, both from the tree, and from the remaining INF file. Furthermore, the InternalTpm12Detect() call in "Tcg2ConfigPeim.c", and everything that depends on the success of that call, now counts as dead code, and should be removed. And *that* in turn means that we should also remove "gEfiTpmDeviceInstanceTpm12Guid" from the [Guids] section of the remaining INF file. Thanks, Laszlo -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#113940): https://edk2.groups.io/g/devel/message/113940 Mute This Topic: https://groups.io/mt/103764205/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/19134562= 12/xyzzy [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-