From nobody Sun Apr 28 21:53:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 151086426728453.48341934606424; Thu, 16 Nov 2017 12:31:07 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id BE8A82035A7BA; Thu, 16 Nov 2017 12:26:55 -0800 (PST) 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 E82D3220D4BE9 for ; Thu, 16 Nov 2017 12:26:54 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 752946A7DA; Thu, 16 Nov 2017 20:31:04 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-117-65.ams2.redhat.com [10.36.117.65]) by smtp.corp.redhat.com (Postfix) with ESMTP id 859E6B32BA; Thu, 16 Nov 2017 20:31:01 +0000 (UTC) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=209.132.183.28; helo=mx1.redhat.com; envelope-from=pbonzini@redhat.com; receiver=edk2-devel@lists.01.org From: Paolo Bonzini To: edk2-devel@lists.01.org Date: Thu, 16 Nov 2017 21:30:57 +0100 Message-Id: <20171116203100.28085-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 16 Nov 2017 20:31:04 +0000 (UTC) Subject: [edk2] [PATCH v3 0/3] OvmfPkg: save on I/O port accesses when the debug port is not in use 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: , Cc: Jordan Justen , Laszlo Ersek , Ard Biesheuvel MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This is version 3 of the series to skip debug port I/O port writes when the debug port device wasn't added to the virtual machine. The differences from v2 are entirely cosmetic, and I'm including them at the end of this message for ease of review. Thanks, Paolo Paolo Bonzini (3): OvmfPkg: make PlatformDebugLibIoPort a proper BASE library OvmfPkg: create a separate PlatformDebugLibIoPort instance for SEC OvmfPkg: save on I/O port accesses when the debug port is not in use OvmfPkg/OvmfPkgIa32.dsc | 2 = +- OvmfPkg/OvmfPkgIa32X64.dsc | 2 = +- OvmfPkg/OvmfPkgX64.dsc | 2 = +- OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf | 3 = ++- OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf | 52 = +++++++++++++++++++++++++++++++++++++++++ OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.h | 55 = ++++++++++++++++++++++++++++++++++++++++++++ OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c | 44 = +++++++++++++++++++---------------- OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.c | 55 = ++++++++++++++++++++++++++++++++++++++++++++ OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetectRom.c | 48 = ++++++++++++++++++++++++++++++++++++++ 9 files changed, 241 insertions(+), 24 deletions(-) create mode 100644 OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebug= LibIoPort.inf create mode 100644 OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.h create mode 100644 OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.c create mode 100644 OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetectRo= m.c --=20 2.14.3 diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.= inf b/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf index 65d8683f1f..de3c2f542b 100644 --- a/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf +++ b/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf @@ -21,7 +21,7 @@ [Defines] FILE_GUID =3D DF934DA3-CD31-49FE-AF50-B3C87C79325F MODULE_TYPE =3D BASE VERSION_STRING =3D 1.0 - LIBRARY_CLASS =3D DebugLib + LIBRARY_CLASS =3D DebugLib|PEI_CORE PEIM DXE_CORE DXE_D= RIVER DXE_RUNTIME_DRIVER SMM_CORE DXE_SMM_DRIVER UEFI_DRIVER UEFI_APPLICATI= ON CONSTRUCTOR =3D PlatformDebugLibIoPortConstructor =20 # diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPo= rt.inf b/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.i= nf index 93763d47dd..491c0318de 100644 --- a/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf +++ b/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf @@ -21,7 +21,7 @@ [Defines] FILE_GUID =3D CEB0D9D3-328F-4C24-8C02-28FA1986AE1B MODULE_TYPE =3D BASE VERSION_STRING =3D 1.0 - LIBRARY_CLASS =3D DebugLib + LIBRARY_CLASS =3D DebugLib|SEC CONSTRUCTOR =3D PlatformRomDebugLibIoPortConstructor =20 # diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.h b/Ovmf= Pkg/Library/PlatformDebugLibIoPort/DebugLibDetect.h index c34ca9c72b..1f739b55d8 100644 --- a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.h +++ b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.h @@ -17,7 +17,6 @@ #define __DEBUG_IO_PORT_DETECT_H__ =20 #include -#include =20 // // The constant value that is read from the debug I/O port @@ -30,7 +29,8 @@ PlatformDebugLibIoPortFound can call this function directly or cache the result. =20 - @retval BOOLEAN TRUE if the debug I/O port device was detected. + @retval TRUE if the debug I/O port device was detected. + @retval FALSE otherwise =20 **/ BOOLEAN @@ -44,7 +44,8 @@ PlatformDebugLibIoPortDetect ( calls this function instead of PlatformDebugLibIoPortDetect, to allow caching if possible. =20 - @retval BOOLEAN TRUE if the debug I/O port device was detected. + @retval TRUE if the debug I/O port device was detected. + @retval FALSE otherwise =20 **/ BOOLEAN diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c b/OvmfPkg/Li= brary/PlatformDebugLibIoPort/DebugLib.c index 79486ac8a6..36cde54976 100644 --- a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c +++ b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c @@ -15,7 +15,6 @@ **/ =20 #include -#include #include #include #include @@ -63,9 +62,10 @@ DebugPrint ( ASSERT (Format !=3D NULL); =20 // - // Do nothing if the global mask disables this message or the device is = inactive + // Check if the global mask disables this message or the device is inact= ive // - if ((ErrorLevel & GetDebugPrintErrorLevel ()) =3D=3D 0 || !PlatformDebug= LibIoPortFound ()) { + if ((ErrorLevel & GetDebugPrintErrorLevel ()) =3D=3D 0 || + !PlatformDebugLibIoPortFound ()) { return; } =20 @@ -273,7 +273,8 @@ DebugPrintLevelEnabled ( /** Return the result of detecting the debug I/O port device. =20 - @retval BOOLEAN TRUE if the debug I/O port device was detected. + @retval TRUE if the debug I/O port device was detected. + @retval FALSE otherwise =20 **/ BOOLEAN diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.c b/Ovmf= Pkg/Library/PlatformDebugLibIoPort/DebugLibDetect.c index 610987aca9..81c44eece9 100644 --- a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.c +++ b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.c @@ -14,7 +14,6 @@ **/ =20 #include -#include #include "DebugLibDetect.h" =20 // @@ -26,7 +25,7 @@ STATIC BOOLEAN mDebugIoPortFound =3D FALSE; This constructor function checks if the debug I/O port device is present, caching the result for later use. =20 - @retval EFI_SUCCESS The constructor always returns RETURN_SUCCESS. + @retval RETURN_SUCCESS The constructor always returns RETURN_SUCCESS. =20 **/ RETURN_STATUS @@ -36,13 +35,14 @@ PlatformDebugLibIoPortConstructor ( ) { mDebugIoPortFound =3D PlatformDebugLibIoPortDetect(); - return EFI_SUCCESS; + return RETURN_SUCCESS; } =20 /** Return the cached result of detecting the debug I/O port device. =20 - @retval BOOLEAN TRUE if the debug I/O port device was detected. + @retval TRUE if the debug I/O port device was detected. + @retval FALSE otherwise =20 **/ BOOLEAN diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetectRom.c b/O= vmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetectRom.c index f71b6567dc..b950919675 100644 --- a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetectRom.c +++ b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetectRom.c @@ -14,13 +14,12 @@ **/ =20 #include -#include #include "DebugLibDetect.h" =20 /** - This constructor function does not have to do anything. + This constructor function does not have anything to do. =20 - @retval EFI_SUCCESS The constructor always returns RETURN_SUCCESS. + @retval RETURN_SUCCESS The constructor always returns RETURN_SUCCESS. =20 **/ RETURN_STATUS @@ -29,13 +28,14 @@ PlatformRomDebugLibIoPortConstructor ( VOID ) { - return EFI_SUCCESS; + return RETURN_SUCCESS; } =20 /** Return the result of detecting the debug I/O port device. =20 - @retval BOOLEAN TRUE if the debug I/O port device was detected. + @retval TRUE if the debug I/O port device was detected. + @retval FALSE otherwise =20 **/ BOOLEAN _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel