From nobody Sat Feb 7 05:14:52 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+54944+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+54944+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1582755136; cv=none; d=zohomail.com; s=zohoarc; b=PKxoryuc9khxkT0eBtrYhhttiekdRTni09vCsnTc8Mkj2IbS5UmOSfLfTdHw4Q/eqvbC0+/fczGcpyJvzSslSDbJgtfqMza9WZT78cgbPHwT+DILfDkrvDPiBLVl96kv+J2NrMxMh4kMuP1iXSU6m0JgtBbBVOFsJ+LIs7vQM6M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582755136; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=P6Ae19drtwej6Lp2Ph6M0+WoQ/fpomontfd0WFBOHqA=; b=crUs6J6XLRxLJr9UHF+Ob084URvu68/8k+4K1vc2WGoLcvQhw3mp1AQZWQiVSuHRuym9xZRyHReldAIuQY2vOrF6MQBlawf+IZJfC3CDgtK/sVgxn4q6BHzYv4hkKZ7RWDwl3Ue+xkOxIyB9p85de5fGzRqJNu08zVX95uURV/g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+54944+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1582755136580605.3157894928358; Wed, 26 Feb 2020 14:12:16 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id BSrtYY1788612xni2uqut5bA; Wed, 26 Feb 2020 14:12:15 -0800 X-Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.61]) by mx.groups.io with SMTP id smtpd.web12.228.1582755134838277737 for ; Wed, 26 Feb 2020 14:12:15 -0800 X-Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-68-3NMhZI0kN0icBukjR95yjQ-1; Wed, 26 Feb 2020 17:12:12 -0500 X-MC-Unique: 3NMhZI0kN0icBukjR95yjQ-1 X-Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DCCAFDB61; Wed, 26 Feb 2020 22:12:10 +0000 (UTC) X-Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-185.ams2.redhat.com [10.36.116.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id 01EA260BEF; Wed, 26 Feb 2020 22:12:08 +0000 (UTC) From: "Laszlo Ersek" To: edk2-devel-groups-io Cc: Ard Biesheuvel , Igor Mammedov , Jiewen Yao , Jordan Justen , Michael Kinney , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [edk2-devel] [PATCH v2 03/16] OvmfPkg: clone SmmCpuPlatformHookLib from UefiCpuPkg Date: Wed, 26 Feb 2020 23:11:43 +0100 Message-Id: <20200226221156.29589-4-lersek@redhat.com> In-Reply-To: <20200226221156.29589-1-lersek@redhat.com> References: <20200226221156.29589-1-lersek@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: 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 X-Gm-Message-State: ROGPqa7PazelvQ0aDdwi1I0nx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1582755135; bh=P6Ae19drtwej6Lp2Ph6M0+WoQ/fpomontfd0WFBOHqA=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=IbMT0J+U0vf8TBpABhLHpkPBoTMxXAqr8a8aLqyw2UmiZw9PxXrlr85l10oCQAkENig 7/ILtt19zsWxPzhsYOCyeUMGN8JJrTL2EknP15UkKzKZ3nEUWfJNwz55rblRlcMoNcNTG OhAdD4qHRetKhK9L0ynZKSR9v13SnkxMasQ= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Clone the Null instance of SmmCpuPlatformHookLib from UefiCpuPkg to OvmfPkg. In this patch, customize the lib instance only with the following no-op steps: - Replace Null/NULL references in filenames and comments with Qemu/QEMU references. - Update copyright notices. - Clean up and rewrap comment blocks. - Update INF_VERSION to the latest INF spec version (1.29). - Update FILE_GUID. - Drop the UNI file. This patch is best reviewed with: $ git show --find-copies=3D43 --find-copies-harder Cc: Ard Biesheuvel Cc: Igor Mammedov Cc: Jiewen Yao Cc: Jordan Justen Cc: Michael Kinney Cc: Philippe Mathieu-Daud=C3=A9 Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1512 Signed-off-by: Laszlo Ersek Acked-by: Ard Biesheuvel Reviewed-by: Ard Biesheuvel Reviewed-by: Philippe Mathieu-Daude --- Notes: v2: =20 - Pick up Ard's Acked-by, which is conditional on approval from Intel reviewers on Cc. (I'd like to save Ard the churn of re-acking unmodified patches.) OvmfPkg/OvmfPkgIa32.dsc = = | 2 +- OvmfPkg/OvmfPkgIa32X64.dsc = = | 2 +- OvmfPkg/OvmfPkgX64.dsc = = | 2 +- UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCpuPlatformHookLibNull.inf= =3D> OvmfPkg/Library/SmmCpuPlatformHookLibQemu/SmmCpuPlatformHookLibQemu.i= nf | 21 +++++------- UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCpuPlatformHookLibNull.c = =3D> OvmfPkg/Library/SmmCpuPlatformHookLibQemu/SmmCpuPlatformHookLibQemu.c = | 36 ++++++++++++-------- 5 files changed, 32 insertions(+), 31 deletions(-) diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc index 19728f20b34e..813995fefad8 100644 --- a/OvmfPkg/OvmfPkgIa32.dsc +++ b/OvmfPkg/OvmfPkgIa32.dsc @@ -858,45 +858,45 @@ [Components] UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf =20 # # SMM Initial Program Load (a DXE_RUNTIME_DRIVER) # MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf =20 # # SMM_CORE # MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf =20 # # Privileged drivers (DXE_SMM_DRIVER modules) # UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf { LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxSmmLib.inf } UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf { - SmmCpuPlatformHookLib|UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/S= mmCpuPlatformHookLibNull.inf + SmmCpuPlatformHookLib|OvmfPkg/Library/SmmCpuPlatformHookLibQemu/SmmC= puPlatformHookLibQemu.inf SmmCpuFeaturesLib|OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLi= b.inf } =20 # # Variable driver stack (SMM) # OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf { NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf } MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf =20 !else =20 # # Variable driver stack (non-SMM) # OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf { diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc index 3c0c229e3a72..a256c7084a7e 100644 --- a/OvmfPkg/OvmfPkgIa32X64.dsc +++ b/OvmfPkg/OvmfPkgIa32X64.dsc @@ -872,45 +872,45 @@ [Components.X64] UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf =20 # # SMM Initial Program Load (a DXE_RUNTIME_DRIVER) # MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf =20 # # SMM_CORE # MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf =20 # # Privileged drivers (DXE_SMM_DRIVER modules) # UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf { LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxSmmLib.inf } UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf { - SmmCpuPlatformHookLib|UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/S= mmCpuPlatformHookLibNull.inf + SmmCpuPlatformHookLib|OvmfPkg/Library/SmmCpuPlatformHookLibQemu/SmmC= puPlatformHookLibQemu.inf SmmCpuFeaturesLib|OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLi= b.inf } =20 # # Variable driver stack (SMM) # OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf { NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf } MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf =20 !else =20 # # Variable driver stack (non-SMM) # OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf { diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc index f6c1d8d228c6..78079b9f8e13 100644 --- a/OvmfPkg/OvmfPkgX64.dsc +++ b/OvmfPkg/OvmfPkgX64.dsc @@ -870,45 +870,45 @@ [Components] UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf =20 # # SMM Initial Program Load (a DXE_RUNTIME_DRIVER) # MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf =20 # # SMM_CORE # MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf =20 # # Privileged drivers (DXE_SMM_DRIVER modules) # UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf { LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxSmmLib.inf } UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf { - SmmCpuPlatformHookLib|UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/S= mmCpuPlatformHookLibNull.inf + SmmCpuPlatformHookLib|OvmfPkg/Library/SmmCpuPlatformHookLibQemu/SmmC= puPlatformHookLibQemu.inf SmmCpuFeaturesLib|OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLi= b.inf } =20 # # Variable driver stack (SMM) # OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf { NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf } MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf =20 !else =20 # # Variable driver stack (non-SMM) # OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf { diff --git a/UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCpuPlatformHoo= kLibNull.inf b/OvmfPkg/Library/SmmCpuPlatformHookLibQemu/SmmCpuPlatformHook= LibQemu.inf similarity index 43% copy from UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCpuPlatformHookLi= bNull.inf copy to OvmfPkg/Library/SmmCpuPlatformHookLibQemu/SmmCpuPlatformHookLibQemu= .inf index fab6b30b7a3f..82edeca3d12d 100644 --- a/UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCpuPlatformHookLibNul= l.inf +++ b/OvmfPkg/Library/SmmCpuPlatformHookLibQemu/SmmCpuPlatformHookLibQemu.i= nf @@ -1,34 +1,29 @@ ## @file -# SMM CPU Platform Hook NULL library instance. +# SMM CPU Platform Hook library instance for QEMU. # +# Copyright (c) 2020, Red Hat, Inc. # Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent -# ## =20 -##########################################################################= ###### -# -# Defines Section - statements that will be processed to create a Makefile. -# -##########################################################################= ###### [Defines] - INF_VERSION =3D 0x00010005 - BASE_NAME =3D SmmCpuPlatformHookLibNull - MODULE_UNI_FILE =3D SmmCpuPlatformHookLibNull.uni - FILE_GUID =3D D6494E1B-E06F-4ab5-B64D-48B25AA9EB33 + INF_VERSION =3D 1.29 + BASE_NAME =3D SmmCpuPlatformHookLibQemu + FILE_GUID =3D 154D6D26-54B8-45BC-BA3A-CBAA20C02A6A MODULE_TYPE =3D DXE_DRIVER VERSION_STRING =3D 1.0 LIBRARY_CLASS =3D SmmCpuPlatformHookLib =20 # -# The following information is for reference only and not required by the = build tools. +# The following information is for reference only and not required by the = build +# tools. # # VALID_ARCHITECTURES =3D IA32 X64 # =20 [Sources] - SmmCpuPlatformHookLibNull.c + SmmCpuPlatformHookLibQemu.c =20 [Packages] MdePkg/MdePkg.dec UefiCpuPkg/UefiCpuPkg.dec diff --git a/UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCpuPlatformHoo= kLibNull.c b/OvmfPkg/Library/SmmCpuPlatformHookLibQemu/SmmCpuPlatformHookLi= bQemu.c similarity index 67% copy from UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCpuPlatformHookLi= bNull.c copy to OvmfPkg/Library/SmmCpuPlatformHookLibQemu/SmmCpuPlatformHookLibQemu= .c index 6c2010dc0a67..257e1d399cc6 100644 --- a/UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCpuPlatformHookLibNul= l.c +++ b/OvmfPkg/Library/SmmCpuPlatformHookLibQemu/SmmCpuPlatformHookLibQemu.c @@ -1,102 +1,108 @@ /** @file -SMM CPU Platform Hook NULL library instance. +SMM CPU Platform Hook library instance for QEMU. =20 +Copyright (c) 2020, Red Hat, Inc. Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ #include #include =20 /** Checks if platform produces a valid SMI. =20 This function checks if platform produces a valid SMI. This function is called at SMM entry to detect if this is a spurious SMI. This function must be implemented in an MP safe way because it is called by multiple C= PU threads. =20 @retval TRUE There is a valid SMI @retval FALSE There is no valid SMI =20 **/ BOOLEAN EFIAPI PlatformValidSmi ( VOID ) { return TRUE; } =20 /** Clears platform top level SMI status bit. =20 This function clears platform top level SMI status bit. =20 @retval TRUE The platform top level SMI status is cleared. - @retval FALSE The platform top level SMI status cannot be cl= eared. + @retval FALSE The platform top level SMI status cannot be + cleared. =20 **/ BOOLEAN EFIAPI ClearTopLevelSmiStatus ( VOID ) { return TRUE; } =20 /** Performs platform specific way of SMM BSP election. =20 This function performs platform specific way of SMM BSP election. =20 - @param IsBsp Output parameter. TRUE: the CPU this function = executes - on is elected to be the SMM BSP. FALSE: the CP= U this - function executes on is to be SMM AP. + @param IsBsp Output parameter. TRUE: the CPU this function + executes on is elected to be the SMM BSP. FALS= E: + the CPU this function executes on is to be SMM= AP. =20 @retval EFI_SUCCESS The function executes successfully. - @retval EFI_NOT_READY The function does not determine whether this C= PU should be - BSP or AP. This may occur if hardware init seq= uence to - enable the determination is yet to be done, or= the function - chooses not to do BSP election and will let SM= M CPU driver to - use its default BSP election process. - @retval EFI_DEVICE_ERROR The function cannot determine whether this CPU= should be - BSP or AP due to hardware error. + @retval EFI_NOT_READY The function does not determine whether this C= PU + should be BSP or AP. This may occur if hardware + init sequence to enable the determination is y= et to + be done, or the function chooses not to do BSP + election and will let SMM CPU driver to use its + default BSP election process. + @retval EFI_DEVICE_ERROR The function cannot determine whether this CPU + should be BSP or AP due to hardware error. =20 **/ EFI_STATUS EFIAPI PlatformSmmBspElection ( OUT BOOLEAN *IsBsp ) { return EFI_NOT_READY; } =20 /** Get platform page table attribute. =20 This function gets page table attribute of platform. =20 - @param Address Input parameter. Obtain the page table entries at= tribute on this address. + @param Address Input parameter. Obtain the page table entries + attribute on this address. @param PageSize Output parameter. The size of the page. @param NumOfPages Output parameter. Number of page. @param PageAttribute Output parameter. Paging Attributes (WB, UC, etc). =20 - @retval EFI_SUCCESS The platform page table attribute from the addr= ess is determined. - @retval EFI_UNSUPPORTED The platform does not support getting page tabl= e attribute for the address. + @retval EFI_SUCCESS The platform page table attribute from the addr= ess + is determined. + @retval EFI_UNSUPPORTED The platform does not support getting page table + attribute for the address. =20 **/ EFI_STATUS EFIAPI GetPlatformPageTableAttribute ( IN UINT64 Address, IN OUT SMM_PAGE_SIZE_TYPE *PageSize, IN OUT UINTN *NumOfPages, IN OUT UINTN *PageAttribute ) { return EFI_UNSUPPORTED; } --=20 2.19.1.3.g30247aa5d201 -=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 (#54944): https://edk2.groups.io/g/devel/message/54944 Mute This Topic: https://groups.io/mt/71575165/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-