From 51adb689e1db695cffdeeacafad218768fbc018c Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Wed, 26 May 2021 22:14:46 +0200 Subject: OvmfPkg: restrict XenPlatformLib to BdsDxe in the IA32, IA32X64, X64 DSCs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf" library instance is used in the following platform DSC files in edk2: OvmfPkg/OvmfPkgIa32.dsc OvmfPkg/OvmfPkgIa32X64.dsc OvmfPkg/OvmfPkgX64.dsc OvmfPkg/OvmfXen.dsc The Xen customizations are very light-weight in this PlatformBootManagerLib instance. Isolating them statically, for the sake of the first three DSC files, would save negligible binary code size, and would likely worsen code complexity (by way of introducing new internal interfaces) or blow up source code size (by duplicating almost the entire lib instance source code). So for now, keep this one bit of Xen dynamism even on QEMU. However, because it's only PlatformBootManagerLib now that uses XenPlatformLib (for the above-stated enlightenment), restrict the XenPlatformLib class resolution in the first three DSC files to the only DXE driver that consumes PlatformBootManagerLib (and therefore XenPlatformLib): BdsDxe. This will cause a build failure later if someone attempts to call a XenPlatformLib API (that is, tries to re-introduce Xen enlightenment) in a different module in these non-Xen DSC files. Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Philippe Mathieu-Daudé Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122 Signed-off-by: Laszlo Ersek Message-Id: <20210526201446.12554-44-lersek@redhat.com> Reviewed-by: Ard Biesheuvel Reviewed-by: Philippe Mathieu-Daudé --- OvmfPkg/OvmfPkgIa32.dsc | 2 +- OvmfPkg/OvmfPkgIa32X64.dsc | 2 +- OvmfPkg/OvmfPkgX64.dsc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc index 7a37efd356..f53efeae79 100644 --- a/OvmfPkg/OvmfPkgIa32.dsc +++ b/OvmfPkg/OvmfPkgIa32.dsc @@ -226,7 +226,6 @@ S3BootScriptLib|MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf - XenPlatformLib|OvmfPkg/Library/XenPlatformLib/XenPlatformLib.inf !if $(TPM_ENABLE) == TRUE Tpm12CommandLib|SecurityPkg/Library/Tpm12CommandLib/Tpm12CommandLib.inf @@ -770,6 +769,7 @@ MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf MdeModulePkg/Universal/BdsDxe/BdsDxe.inf { + XenPlatformLib|OvmfPkg/Library/XenPlatformLib/XenPlatformLib.inf !ifdef $(CSM_ENABLE) NULL|OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf NULL|OvmfPkg/Csm/LegacyBootManagerLib/LegacyBootManagerLib.inf diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc index d6cc58a261..b3662e17f2 100644 --- a/OvmfPkg/OvmfPkgIa32X64.dsc +++ b/OvmfPkg/OvmfPkgIa32X64.dsc @@ -230,7 +230,6 @@ S3BootScriptLib|MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf - XenPlatformLib|OvmfPkg/Library/XenPlatformLib/XenPlatformLib.inf !if $(TPM_ENABLE) == TRUE Tpm12CommandLib|SecurityPkg/Library/Tpm12CommandLib/Tpm12CommandLib.inf @@ -784,6 +783,7 @@ MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf MdeModulePkg/Universal/BdsDxe/BdsDxe.inf { + XenPlatformLib|OvmfPkg/Library/XenPlatformLib/XenPlatformLib.inf !ifdef $(CSM_ENABLE) NULL|OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf NULL|OvmfPkg/Csm/LegacyBootManagerLib/LegacyBootManagerLib.inf diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc index ab60c36eca..0a237a9058 100644 --- a/OvmfPkg/OvmfPkgX64.dsc +++ b/OvmfPkg/OvmfPkgX64.dsc @@ -230,7 +230,6 @@ S3BootScriptLib|MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf - XenPlatformLib|OvmfPkg/Library/XenPlatformLib/XenPlatformLib.inf !if $(TPM_ENABLE) == TRUE Tpm12CommandLib|SecurityPkg/Library/Tpm12CommandLib/Tpm12CommandLib.inf @@ -782,6 +781,7 @@ MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf MdeModulePkg/Universal/BdsDxe/BdsDxe.inf { + XenPlatformLib|OvmfPkg/Library/XenPlatformLib/XenPlatformLib.inf !ifdef $(CSM_ENABLE) NULL|OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf NULL|OvmfPkg/Csm/LegacyBootManagerLib/LegacyBootManagerLib.inf -- cgit v1.2.3