From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 DBB9021A18AA9 for ; Mon, 29 May 2017 02:18:52 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4FCFB80C06; Mon, 29 May 2017 09:19:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4FCFB80C06 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=lersek@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 4FCFB80C06 Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-94.phx2.redhat.com [10.3.116.94]) by smtp.corp.redhat.com (Postfix) with ESMTP id 79BF2197E4; Mon, 29 May 2017 09:19:48 +0000 (UTC) To: Brijesh Singh , edk2-devel@lists.01.org Cc: Thomas.Lendacky@amd.com, leo.duran@amd.com, Jordan Justen References: <1495809845-32472-1-git-send-email-brijesh.singh@amd.com> <1495809845-32472-9-git-send-email-brijesh.singh@amd.com> From: Laszlo Ersek Message-ID: <0b9db573-ba08-a79f-3c18-34df6afef987@redhat.com> Date: Mon, 29 May 2017 11:19:47 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <1495809845-32472-9-git-send-email-brijesh.singh@amd.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 29 May 2017 09:19:50 +0000 (UTC) Subject: Re: [PATCH v6 08/17] OvmfPkg: Add PlatformHasIoMmuLib X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 May 2017 09:18:53 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit comments below: On 05/26/17 16:43, Brijesh Singh wrote: > Add the shorter-term library instance outlined in the previous patch to > OvmfPkg, so that we can imbue PciHostBridgeDxe with a protocol dependency > on gEdkiiIoMmuProtocolGuid OR gIoMmuAbsentProtocolGuid. > > > Cc: Jordan Justen > Cc: Laszlo Ersek > Contributed-under: TianoCore Contribution Agreement 1.0 > Suggested-by: Laszlo Ersek > Signed-off-by: Brijesh Singh > --- > OvmfPkg/Library/PlatformHasIoMmuLib/PlatformHasIoMmuLib.inf | 37 ++++++++++++++++++++ > OvmfPkg/Library/PlatformHasIoMmuLib/PlatformHasIoMmuLib.c | 32 +++++++++++++++++ > 2 files changed, 69 insertions(+) > > diff --git a/OvmfPkg/Library/PlatformHasIoMmuLib/PlatformHasIoMmuLib.inf b/OvmfPkg/Library/PlatformHasIoMmuLib/PlatformHasIoMmuLib.inf > new file mode 100644 > index 000000000000..6d97293a3334 > --- /dev/null > +++ b/OvmfPkg/Library/PlatformHasIoMmuLib/PlatformHasIoMmuLib.inf > @@ -0,0 +1,37 @@ > +## @file > +# A hook-in library for MdeModulePkg/Bus/Pci/PciHostBridgeDxe. > +# > +# Plugging this library instance into PciHostBridgeDxe makes > +# EFI_IOMMU_PROTOCOL depend on the platform's dynamic decision whether (1) s/EFI_IOMMU_PROTOCOL/PciHostBridgeDxe/ > +# to provide IOMMU implementation (usually through IoMmuDxe driver). > +# > +# Copyright (C) 2017, AMD, Inc. (2) I think you should keep the original Red Hat copyright here as well, from "EmbeddedPkg/Library/PlatformHasAcpiLib/PlatformHasAcpiLib.inf". (I think you used that file as basis for this.) (3) (4) Regarding the C source file below, the same two comments apply. With those addressed: Reviewed-by: Laszlo Ersek Don't post v7 just for this; I can fix it up at commit, if nothing else requries a v7. Thanks Laszlo > +# > +# This program and the accompanying materials are licensed and made available > +# under the terms and conditions of the BSD License which accompanies this > +# distribution. The full text of the license may be found at > +# http://opensource.org/licenses/bsd-license.php > +# > +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT > +# WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. > +## > + > +[Defines] > + INF_VERSION = 1.25 > + BASE_NAME = PlatformHasIoMmuLib > + FILE_GUID = 49b4b018-0558-448b-1e1a-12226342877d > + MODULE_TYPE = BASE > + VERSION_STRING = 1.0 > + LIBRARY_CLASS = PlatformHasIoMmuLib|DXE_DRIVER > + CONSTRUCTOR = PlatformHasIoMmuInitialize > + > +[Sources] > + PlatformHasIoMmuLib.c > + > +[Packages] > + MdeModulePkg/MdeModulePkg.dec > + MdePkg/MdePkg.dec > + OvmfPkg/OvmfPkg.dec > + > +[Depex] > + gEdkiiIoMmuProtocolGuid OR gIoMmuAbsentProtocolGuid > diff --git a/OvmfPkg/Library/PlatformHasIoMmuLib/PlatformHasIoMmuLib.c b/OvmfPkg/Library/PlatformHasIoMmuLib/PlatformHasIoMmuLib.c > new file mode 100644 > index 000000000000..9ead2637e2c8 > --- /dev/null > +++ b/OvmfPkg/Library/PlatformHasIoMmuLib/PlatformHasIoMmuLib.c > @@ -0,0 +1,32 @@ > +/** @file > + A hook-in library for MdeModulePkg/Bus/Pci/PciHostBridgeDxe. > + > + Plugging this library instance into PciHostBridgeDxe makes > + EFI_IOMMU_PROTOCOL depend on the platform's dynamic decision whether > + to provide IOMMU implementation (usually through IoMmuDxe driver). > + > + Copyright (C) 2017, AMD, Inc. > + > + This program and the accompanying materials are licensed and made available > + under the terms and conditions of the BSD License which accompanies this > + distribution. The full text of the license may be found at > + http://opensource.org/licenses/bsd-license.php > + > + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT > + WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. > +**/ > + > +#include > + > +RETURN_STATUS > +EFIAPI > +PlatformHasIoMmuInitialize ( > + VOID > + ) > +{ > + // > + // Do nothing, just imbue PciHostBridgeDxe with a protocol dependency on > + // gIoMmuAbsentProtocolGuid OR gEdkiiIoMmuProtocolGuid. > + // > + return RETURN_SUCCESS; > +} >