From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.120]) by mx.groups.io with SMTP id smtpd.web12.3157.1590057265666436336 for ; Thu, 21 May 2020 03:34:25 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hh82EkD3; spf=pass (domain: redhat.com, ip: 207.211.31.120, mailfrom: philmd@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590057264; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MjqBttzKDCXNOzBH3hEU/fs+MHf73OVLzJWzLHwpRl0=; b=hh82EkD3P3adIOV2DQz+sRRVx4aRDI+gmoMX1CzEz43ord66TNuL9apyhJzwEEN57ZP2M9 YawVvYQTMWENLtdSu29OsH/GJNY9LsoAhsIvSrGW+Qf0cdbAx/agNGI+lMBo3I9wX+vrAT E9a0qPRin50/gFwBL/1g62+Jp1FgXcY= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-115-wVzDV-FROdGXxQPjSIGPHg-1; Thu, 21 May 2020 06:34:21 -0400 X-MC-Unique: wVzDV-FROdGXxQPjSIGPHg-1 Received: by mail-wr1-f69.google.com with SMTP id d16so2728607wrv.18 for ; Thu, 21 May 2020 03:34:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=MjqBttzKDCXNOzBH3hEU/fs+MHf73OVLzJWzLHwpRl0=; b=pre/zoTIpZlYPi9mdrjhgb5FbOFZSOzQ27BC8ZnfOqIR5vq44iOAzFFcJnFrmLSrA4 1ewSMtZeN9xvjjUSYG5xcUOC0GepQnVVEtkAbL93aIHFKUaTFiK4I/9j/rmKApwG+9+Q lkTxDizHYXBW9JpEE4nP+IBIgKxZclsK+fiFZ64qFjI5ZWOCR8ZQK/dZFdk0QWTzgTED YbCgvQtezKKiKQzHCHMJnjnqreuRgvtIzEdL5+zUXAUVAStJwA2ZCdKG5hTIZ/C4/ELB 5TCU5Yyi2E+zQLoqMODjpllx59FjnEtL+qJ9xj3+in3dSEUbaqPLocavTyK8eyiAh3RW cK9A== X-Gm-Message-State: AOAM532K4DGoTTZHPgaJnroOzC+Po5QPCfSB3cL9/DWPLU4FQB1ZXfjc aU7TC7XOk4LO7MPOPTsRgjwWHF3S6bsR/xoXXDM9UjYXhkXh35gA02vyiCJyZtbp+S4AX5LHQvi nCxz6awet4Om2aQ== X-Received: by 2002:adf:f3c5:: with SMTP id g5mr7826672wrp.163.1590057260396; Thu, 21 May 2020 03:34:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJykGHqd7I/ROxc32NABqkzIVRIEM+madB2Xk+uLfQhOFqOeO/yahRPRtUEMEJEporub7JklxQ== X-Received: by 2002:adf:f3c5:: with SMTP id g5mr7826645wrp.163.1590057260101; Thu, 21 May 2020 03:34:20 -0700 (PDT) Return-Path: Received: from [192.168.1.40] (17.red-88-21-202.staticip.rima-tde.net. [88.21.202.17]) by smtp.gmail.com with ESMTPSA id n65sm5285367wmb.48.2020.05.21.03.34.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 21 May 2020 03:34:19 -0700 (PDT) Subject: Re: [PATCH 3/3] OvmfPkg/Tcg2ConfigPei: skip TPM-1.2 detection when building for ARM/AARCH64 To: Laszlo Ersek , edk2-devel-groups-io Cc: Ard Biesheuvel , Eric Auger , Jordan Justen , =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= , Simon Hardy , Stefan Berger References: <20200520225841.17793-1-lersek@redhat.com> <20200520225841.17793-4-lersek@redhat.com> From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= Message-ID: Date: Thu, 21 May 2020 12:34:18 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200520225841.17793-4-lersek@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 5/21/20 12:58 AM, Laszlo Ersek wrote: > Dating back to commits f5cb3767038e and ddd34a818315d, the > "ArmVirtPkg/ArmVirtQemu.dsc" platform includes the > "OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf" module when the TPM2_ENABLE > build flag is defined. > > This was regressed in commit 89236992913f, which added a Tpm12DeviceLib > dependency to Tcg2ConfigPei. "ArmVirtQemu.dsc" does not resolve that class > to any instance, so now we get a build failure: > >> build.py... >> ArmVirtPkg/ArmVirtQemu.dsc(...): error 4000: Instance of library class >> [Tpm12DeviceLib] is not found >> in [OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf] [AARCH64] >> consumed by module [OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf] > > The TPM-1.2 code in OvmfPkg/Tcg2ConfigPei is limited to a special use case > (a kind of physical TPM-1.2 assignment), and that has never applied to > "ArmVirtQemu.dsc". > > Short-circuit the TPM-1.2 detection in the ARM/AARCH64 builds of > OvmfPkg/Tcg2ConfigPei, removing the Tpm12DeviceLib dependency. > > Functionally, this patch is a no-op on IA32 / X64. > > Cc: Ard Biesheuvel > Cc: Eric Auger > Cc: Jordan Justen > Cc: Marc-André Lureau > Cc: Philippe Mathieu-Daudé > Cc: Simon Hardy > Cc: Stefan Berger > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2728 > Signed-off-by: Laszlo Ersek > --- > OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf | 11 +++++++-- > OvmfPkg/Tcg/Tcg2Config/Tpm12Support.h | 4 ++++ > OvmfPkg/Tcg/Tcg2Config/Tpm12SupportNull.c | 25 ++++++++++++++++++++ > 3 files changed, 38 insertions(+), 2 deletions(-) > > diff --git a/OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf b/OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf > index aa996b7da778..194ebfba6409 100644 > --- a/OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf > +++ b/OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf > @@ -21,9 +21,14 @@ [Defines] > > [Sources] > Tcg2ConfigPeim.c > - Tpm12Support.c > Tpm12Support.h > > +[Sources.IA32, Sources.X64] > + Tpm12Support.c > + > +[Sources.ARM, Sources.AARCH64] > + Tpm12SupportNull.c > + > [Packages] > MdePkg/MdePkg.dec > MdeModulePkg/MdeModulePkg.dec > @@ -35,9 +40,11 @@ [LibraryClasses] > BaseLib > DebugLib > PeiServicesLib > - Tpm12DeviceLib > Tpm2DeviceLib > > +[LibraryClasses.IA32, LibraryClasses.X64] > + Tpm12DeviceLib > + > [Guids] > gEfiTpmDeviceSelectedGuid ## PRODUCES ## GUID # Used as a PPI GUID > gEfiTpmDeviceInstanceTpm20DtpmGuid ## SOMETIMES_CONSUMES > diff --git a/OvmfPkg/Tcg/Tcg2Config/Tpm12Support.h b/OvmfPkg/Tcg/Tcg2Config/Tpm12Support.h > index c739775d2353..d92c43253081 100644 > --- a/OvmfPkg/Tcg/Tcg2Config/Tpm12Support.h > +++ b/OvmfPkg/Tcg/Tcg2Config/Tpm12Support.h > @@ -15,6 +15,10 @@ > /** > Detect the presence of a TPM with interface version 1.2. > > + @retval EFI_UNSUPPORTED The platform that includes this particular > + implementation of the function does not support > + TPM-1.2. > + > @retval EFI_SUCCESS TPM-1.2 available. The Tpm12RequestUseTpm() and > Tpm12SubmitCommand(TPM_ORD_GetTicks) operations > (from the Tpm12DeviceLib class) have succeeded. > diff --git a/OvmfPkg/Tcg/Tcg2Config/Tpm12SupportNull.c b/OvmfPkg/Tcg/Tcg2Config/Tpm12SupportNull.c > new file mode 100644 > index 000000000000..7bb377b9b9b0 > --- /dev/null > +++ b/OvmfPkg/Tcg/Tcg2Config/Tpm12SupportNull.c > @@ -0,0 +1,25 @@ > +/** @file > + Null implementation of InternalTpm12Detect(), always returning > + EFI_UNSUPPORTED. > + > + Copyright (C) 2020, Red Hat, Inc. > + > + SPDX-License-Identifier: BSD-2-Clause-Patent > +**/ > + > +#include "Tpm12Support.h" > + > +/** > + Detect the presence of a TPM with interface version 1.2. > + > + @retval EFI_UNSUPPORTED The platform that includes this particular > + implementation of the function does not support > + TPM-1.2. > +**/ > +EFI_STATUS > +InternalTpm12Detect ( > + VOID > + ) > +{ > + return EFI_UNSUPPORTED; > +} > Reviewed-by: Philippe Mathieu-Daude