From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by mx.groups.io with SMTP id smtpd.web11.14001.1583155667181102418 for ; Mon, 02 Mar 2020 05:27:47 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=khbs8WrF; spf=pass (domain: linaro.org, ip: 209.85.221.67, mailfrom: ard.biesheuvel@linaro.org) Received: by mail-wr1-f67.google.com with SMTP id z11so3823649wro.9 for ; Mon, 02 Mar 2020 05:27:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=Vkidij77sYumwJsAd20pMqPZ4/MwLa+JjL4aNnAKXf4=; b=khbs8WrFxSMZjtOYFJtSR6zu2E+yJut2PQa+WH2sKbLq+X4FOpfoElftwEz6fa9+Z1 fZIdFDLACcLvpuZlj93GpYuAiDTIjePxY0Wejfbjryqk31u94ibN9DinD72uNET+Am// FiTXtCKMXrWAGWlsSx2hA4ScwvMvjWixr2nJCwywxAgLIBH+bsJI5YuOJX2ECWyySwmp NwxaKfigIDo3ifWjymeaytVUjOutjc57aCiY/Lf1DL0OsHrAhQrfZayMbFgd8vtr6Ebk 4uylasKWYT5uqxM+HdHIdz8TrpNKSTGl167w/Vo5sfCGYuTMBws6/J/SEPHybb3qbfkt kNUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=Vkidij77sYumwJsAd20pMqPZ4/MwLa+JjL4aNnAKXf4=; b=SJwU0kbd2sweWLEycFsVqYAblMWG43afpSmNkzNWKPaTTfd5YYPALrCbNtYWwJ+SBS 4nOiTAKJ9GdSwyEcDCReVqmiNakNmFgaHUX5Z+Dl0YR7hWiGwFxN0udVsoBNC6c60YEj fOt2WM7A0Q8PpED2zOw89z6/V1jjWQ5NluO1CjydCU42xZ8WJwPR6Jw30Ko9IzvlZQ+H mEDy82QXEn7VQPgsVJqtN4if9gP7JXsfhKNa6jdMiS6FLBa7RV8Tx0sTFfGwvaHBPgi7 gelwR7godLOazkUvnE1+4kKBcYb2J6Eb1B6BUQmTdPI41VOOT0Gu6CHcxM/bnRsBGuB3 4hpg== X-Gm-Message-State: ANhLgQ3FJnJ7heTjqQFzCVR8bcbk1j5Wj+0PefAGPjY96WiURo9GZNh4 nAxV0BEAafrwM7NCvzRNWQiUuNtP0MiHBHf+ZwAMrg== X-Google-Smtp-Source: ADFU+vuxQkG8xOcX4/MgHr2uxjNTx0U+pawLd0112y5lrCTNn3t4vjllyxdZWiA88ULxDDOe8+6V+dPVqMyqdFUsY6A= X-Received: by 2002:a5d:6051:: with SMTP id j17mr2425319wrt.151.1583155665670; Mon, 02 Mar 2020 05:27:45 -0800 (PST) MIME-Version: 1.0 References: <20200226221156.29589-1-lersek@redhat.com> <20200226221156.29589-4-lersek@redhat.com> In-Reply-To: <20200226221156.29589-4-lersek@redhat.com> From: "Ard Biesheuvel" Date: Mon, 2 Mar 2020 14:27:34 +0100 Message-ID: Subject: Re: [PATCH v2 03/16] OvmfPkg: clone SmmCpuPlatformHookLib from UefiCpuPkg To: Laszlo Ersek Cc: edk2-devel-groups-io , Igor Mammedov , Jiewen Yao , Jordan Justen , Michael Kinney , =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, 26 Feb 2020 at 23:12, Laszlo Ersek wrote: > > Clone the Null instance of SmmCpuPlatformHookLib from UefiCpuPkg to > OvmfPkg. In this patch, customize the lib instance only with the followin= g > 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 > Notes: > v2: > > - 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.i= nf =3D> OvmfPkg/Library/SmmCpuPlatformHookLibQemu/SmmCpuPlatformHookLibQemu= .inf | 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 > > # > # SMM Initial Program Load (a DXE_RUNTIME_DRIVER) > # > MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf > > # > # SMM_CORE > # > MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf > > # > # 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= /SmmCpuPlatformHookLibNull.inf > + SmmCpuPlatformHookLib|OvmfPkg/Library/SmmCpuPlatformHookLibQemu/Sm= mCpuPlatformHookLibQemu.inf > SmmCpuFeaturesLib|OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeatures= Lib.inf > } > > # > # 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 > > !else > > # > # 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 > > # > # SMM Initial Program Load (a DXE_RUNTIME_DRIVER) > # > MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf > > # > # SMM_CORE > # > MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf > > # > # 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= /SmmCpuPlatformHookLibNull.inf > + SmmCpuPlatformHookLib|OvmfPkg/Library/SmmCpuPlatformHookLibQemu/Sm= mCpuPlatformHookLibQemu.inf > SmmCpuFeaturesLib|OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeatures= Lib.inf > } > > # > # 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 > > !else > > # > # 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 > > # > # SMM Initial Program Load (a DXE_RUNTIME_DRIVER) > # > MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf > > # > # SMM_CORE > # > MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf > > # > # 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= /SmmCpuPlatformHookLibNull.inf > + SmmCpuPlatformHookLib|OvmfPkg/Library/SmmCpuPlatformHookLibQemu/Sm= mCpuPlatformHookLibQemu.inf > SmmCpuFeaturesLib|OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeatures= Lib.inf > } > > # > # 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 > > !else > > # > # Variable driver stack (non-SMM) > # > OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf > OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf { > > diff --git a/UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCpuPlatformH= ookLibNull.inf b/OvmfPkg/Library/SmmCpuPlatformHookLibQemu/SmmCpuPlatformHo= okLibQemu.inf > similarity index 43% > copy from UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCpuPlatformHook= LibNull.inf > copy to OvmfPkg/Library/SmmCpuPlatformHookLibQemu/SmmCpuPlatformHookLibQe= mu.inf > index fab6b30b7a3f..82edeca3d12d 100644 > --- a/UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCpuPlatformHookLibN= ull.inf > +++ b/OvmfPkg/Library/SmmCpuPlatformHookLibQemu/SmmCpuPlatformHookLibQemu= .inf > @@ -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 > -# > ## > > -########################################################################= ######## > -# > -# Defines Section - statements that will be processed to create a Makefi= le. > -# > -########################################################################= ######## > [Defines] > - INF_VERSION =3D 0x00010005 > - BASE_NAME =3D SmmCpuPlatformHookLibNull > - MODULE_UNI_FILE =3D SmmCpuPlatformHookLibNull.uni > - FILE_GUID =3D D6494E1B-E06F-4ab5-B64D-48B25AA9EB3= 3 > + INF_VERSION =3D 1.29 > + BASE_NAME =3D SmmCpuPlatformHookLibQemu > + FILE_GUID =3D 154D6D26-54B8-45BC-BA3A-CBAA20C02A6= A > MODULE_TYPE =3D DXE_DRIVER > VERSION_STRING =3D 1.0 > LIBRARY_CLASS =3D SmmCpuPlatformHookLib > > # > -# The following information is for reference only and not required by th= e build tools. > +# The following information is for reference only and not required by th= e build > +# tools. > # > # VALID_ARCHITECTURES =3D IA32 X64 > # > > [Sources] > - SmmCpuPlatformHookLibNull.c > + SmmCpuPlatformHookLibQemu.c > > [Packages] > MdePkg/MdePkg.dec > UefiCpuPkg/UefiCpuPkg.dec > diff --git a/UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCpuPlatformH= ookLibNull.c b/OvmfPkg/Library/SmmCpuPlatformHookLibQemu/SmmCpuPlatformHook= LibQemu.c > similarity index 67% > copy from UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCpuPlatformHook= LibNull.c > copy to OvmfPkg/Library/SmmCpuPlatformHookLibQemu/SmmCpuPlatformHookLibQe= mu.c > index 6c2010dc0a67..257e1d399cc6 100644 > --- a/UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCpuPlatformHookLibN= ull.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. > > +Copyright (c) 2020, Red Hat, Inc. > Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent > > **/ > #include > #include > > /** > Checks if platform produces a valid SMI. > > This function checks if platform produces a valid SMI. This function i= s > 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= CPU > threads. > > @retval TRUE There is a valid SMI > @retval FALSE There is no valid SMI > > **/ > BOOLEAN > EFIAPI > PlatformValidSmi ( > VOID > ) > { > return TRUE; > } > > /** > Clears platform top level SMI status bit. > > This function clears platform top level SMI status bit. > > @retval TRUE The platform top level SMI status is cleared= . > - @retval FALSE The platform top level SMI status cannot be = cleared. > + @retval FALSE The platform top level SMI status cannot be > + cleared. > > **/ > BOOLEAN > EFIAPI > ClearTopLevelSmiStatus ( > VOID > ) > { > return TRUE; > } > > /** > Performs platform specific way of SMM BSP election. > > This function performs platform specific way of SMM BSP election. > > - @param IsBsp Output parameter. TRUE: the CPU this functio= n executes > - on is elected to be the SMM BSP. FALSE: the = CPU this > - function executes on is to be SMM AP. > + @param IsBsp Output parameter. TRUE: the CPU this functio= n > + executes on is elected to be the SMM BSP. FA= LSE: > + the CPU this function executes on is to be S= MM AP. > > @retval EFI_SUCCESS The function executes successfully. > - @retval EFI_NOT_READY The function does not determine whether this= CPU should be > - BSP or AP. This may occur if hardware init s= equence to > - enable the determination is yet 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 C= PU should be > - BSP or AP due to hardware error. > + @retval EFI_NOT_READY The function does not determine whether this= CPU > + should be BSP or AP. This may occur if hardw= are > + init sequence to enable the determination is= yet to > + be done, or the function chooses not to do B= SP > + election and will let SMM CPU driver to use = its > + default BSP election process. > + @retval EFI_DEVICE_ERROR The function cannot determine whether this C= PU > + should be BSP or AP due to hardware error. > > **/ > EFI_STATUS > EFIAPI > PlatformSmmBspElection ( > OUT BOOLEAN *IsBsp > ) > { > return EFI_NOT_READY; > } > > /** > Get platform page table attribute. > > This function gets page table attribute of platform. > > - @param Address Input parameter. Obtain the page table entries = attribute 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, et= c). > > - @retval EFI_SUCCESS The platform page table attribute from the ad= dress is determined. > - @retval EFI_UNSUPPORTED The platform does not support getting page ta= ble attribute for the address. > + @retval EFI_SUCCESS The platform page table attribute from the ad= dress > + is determined. > + @retval EFI_UNSUPPORTED The platform does not support getting page ta= ble > + attribute for the address. > > **/ > 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; > } > -- > 2.19.1.3.g30247aa5d201 > >