public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Laszlo Ersek" <lersek@redhat.com>
To: devel@edk2.groups.io, jiaxin.wu@intel.com
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>,
	Jiewen Yao <jiewen.yao@intel.com>,
	Jordan Justen <jordan.l.justen@intel.com>,
	Eric Dong <eric.dong@intel.com>, Ray Ni <ray.ni@intel.com>,
	Zeng Star <star.zeng@intel.com>,
	Rahul Kumar <rahul1.kumar@intel.com>,
	Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [edk2-devel] [PATCH v1 5/7] OvmfPkg: Specifies SmmCpuSyncLib instance
Date: Tue, 7 Nov 2023 11:59:32 +0100	[thread overview]
Message-ID: <656463e5-7c98-0624-b0d1-98c65880b44a@redhat.com> (raw)
In-Reply-To: <20231103153012.3704-6-jiaxin.wu@intel.com>

On 11/3/23 16:30, Wu, Jiaxin wrote:
> The SmmCpuSyncLib instance is included in UefiCpuLibs.dsc.inc.
> This patch is to specify SmmCpuSyncLib instance in OvmfPkg by
> using "!include UefiCpuPkg/UefiCpuLibs.dsc.inc".
> 
> Change-Id: I2ab1737425e26a7bfc4f564b3b7f15ca5c2268fb
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Zeng Star <star.zeng@intel.com>
> Cc: Rahul Kumar <rahul1.kumar@intel.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
> ---
>  OvmfPkg/CloudHv/CloudHvX64.dsc | 1 +
>  OvmfPkg/OvmfPkgIa32.dsc        | 1 +
>  OvmfPkg/OvmfPkgIa32X64.dsc     | 1 +
>  OvmfPkg/OvmfPkgX64.dsc         | 1 +
>  4 files changed, 4 insertions(+)
> 
> diff --git a/OvmfPkg/CloudHv/CloudHvX64.dsc b/OvmfPkg/CloudHv/CloudHvX64.dsc
> index c23c7eaf6c..e65767fe16 100644
> --- a/OvmfPkg/CloudHv/CloudHvX64.dsc
> +++ b/OvmfPkg/CloudHv/CloudHvX64.dsc
> @@ -122,10 +122,11 @@
>  # Library Class section - list of all Library Classes needed by this Platform.
>  #
>  ################################################################################
>  
>  !include MdePkg/MdeLibs.dsc.inc
> +!include UefiCpuPkg/UefiCpuLibs.dsc.inc
>  
>  [LibraryClasses]
>    PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
>    TimerLib|OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf
>    ResetSystemLib|OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf
> diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
> index ed3a19feeb..07d16e6935 100644
> --- a/OvmfPkg/OvmfPkgIa32.dsc
> +++ b/OvmfPkg/OvmfPkgIa32.dsc
> @@ -125,10 +125,11 @@
>  # Library Class section - list of all Library Classes needed by this Platform.
>  #
>  ################################################################################
>  
>  !include MdePkg/MdeLibs.dsc.inc
> +!include UefiCpuPkg/UefiCpuLibs.dsc.inc
>  
>  [LibraryClasses]
>    PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
>    TimerLib|OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf
>    ResetSystemLib|OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf
> diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
> index 16ca139b29..8d243b7075 100644
> --- a/OvmfPkg/OvmfPkgIa32X64.dsc
> +++ b/OvmfPkg/OvmfPkgIa32X64.dsc
> @@ -130,10 +130,11 @@
>  # Library Class section - list of all Library Classes needed by this Platform.
>  #
>  ################################################################################
>  
>  !include MdePkg/MdeLibs.dsc.inc
> +!include UefiCpuPkg/UefiCpuLibs.dsc.inc
>  
>  [LibraryClasses]
>    PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
>    TimerLib|OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf
>    ResetSystemLib|OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf
> diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
> index dc1a0942aa..6343789152 100644
> --- a/OvmfPkg/OvmfPkgX64.dsc
> +++ b/OvmfPkg/OvmfPkgX64.dsc
> @@ -143,10 +143,11 @@
>  # Library Class section - list of all Library Classes needed by this Platform.
>  #
>  ################################################################################
>  
>  !include MdePkg/MdeLibs.dsc.inc
> +!include UefiCpuPkg/UefiCpuLibs.dsc.inc
>  
>  [LibraryClasses]
>    PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
>    TimerLib|OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf
>    ResetSystemLib|OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf

I am undecided about this patch.

More precisely, I'm undecided that this is the right way to introduce
"UefiCpuLibs.dsc.inc".

In my opinion,"UefiCpuLibs.dsc.inc" should be a general-purpose include
file.

But, at this moment, the include file only resolves the "SmmCpuSyncLib"
class -- and that resolution is useless for any IA32/X64 platform that
does not use the SMM machinery. In particular, the resolution is useless
even for OVMF X64 (for example) if it is built without SMM_REQUIRE.

Furthermore, OVMF X64 uses a bunch of other UefiCpuPkg libraries:

BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
CcExitLibNull/CcExitLibNull.inf
CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf
CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf
CpuPageTableLib/CpuPageTableLib.inf
MicrocodeLib/MicrocodeLib.inf
MmSaveStateLib/AmdMmSaveStateLib.inf
MpInitLib/DxeMpInitLib.inf
MpInitLib/PeiMpInitLib.inf
MpInitLibUp/MpInitLibUp.inf
MtrrLib/MtrrLib.inf
SmmCpuRendezvousLib/SmmCpuRendezvousLib.inf

It's weird to put SmmCpuSyncLib in the new DSC include file, but not
CpuPageTableLib or MtrrLib (for example), which seem much more generic.

For now I'd suggest avoiding "UefiCpuLibs.dsc.inc" altogether, and
resolving just "SmmCpuSyncLib" in the OVMF DSC files -- and only when
SMM_REQUIRE is defined on the build command line (i.e., when
PiSmmCpuDxeSmm is built into the firmware platform).

We can certainly introduce "UefiCpuLibs.dsc.inc" later, but for that:

- we need to collect all UefiCpuPkg library classes and instances that
are commonly used (and then probably use multiple module type
sections!). Example: "OvmfPkg/Include/Dsc/OvmfTpmLibs.dsc.inc"

- some of those resolutions should be conditional, and so we'd have to
properly prefix macro names like SMM_REQUIRE with something like
UEFI_CPU_. Basically introduce a namespace for those build time macros.
Example: "NetworkPkg/NetworkDefines.dsc.inc", which uses the NETWORK_
macro prefix for enabling various features.

Laszlo



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#110840): https://edk2.groups.io/g/devel/message/110840
Mute This Topic: https://groups.io/mt/102366302/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/xyzzy [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  reply	other threads:[~2023-11-07 10:59 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-03 15:30 [edk2-devel] [PATCH v1 0/7] Refine SMM CPU Sync flow and abstract SmmCpuSyncLib Wu, Jiaxin
2023-11-03 15:30 ` [edk2-devel] [PATCH v1 1/7] UefiCpuPkg/PiSmmCpuDxeSmm: Optimize Semaphore Sync between BSP and AP Wu, Jiaxin
2023-11-07  8:28   ` Laszlo Ersek
2023-11-07 10:27     ` Laszlo Ersek
2023-11-03 15:30 ` [edk2-devel] [PATCH v1 2/7] UefiCpuPkg/PiSmmCpuDxeSmm: Reduce times of BSP and AP Sync for SMM Exit Wu, Jiaxin
2023-11-07  9:47   ` Laszlo Ersek
2023-11-03 15:30 ` [edk2-devel] [PATCH v1 3/7] UefiCpuPkg: Adds SmmCpuSyncLib library class Wu, Jiaxin
2023-11-07 10:26   ` Laszlo Ersek
2023-11-07 10:29     ` Laszlo Ersek
2023-11-13  3:15     ` Ni, Ray
2023-11-13 10:43       ` Laszlo Ersek
2023-11-03 15:30 ` [edk2-devel] [PATCH v1 4/7] UefiCpuPkg: Implements SmmCpuSyncLib library instance Wu, Jiaxin
2023-11-07 10:46   ` Laszlo Ersek
2023-11-07 10:47   ` Laszlo Ersek
2023-11-03 15:30 ` [edk2-devel] [PATCH v1 5/7] OvmfPkg: Specifies SmmCpuSyncLib instance Wu, Jiaxin
2023-11-07 10:59   ` Laszlo Ersek [this message]
2023-11-03 15:30 ` [edk2-devel] [PATCH v1 6/7] UefiPayloadPkg: " Wu, Jiaxin
2023-11-06  1:11   ` Guo, Gua
2023-11-03 15:30 ` [edk2-devel] [PATCH v1 7/7] UefiCpuPkg/PiSmmCpuDxeSmm: Consume SmmCpuSyncLib Wu, Jiaxin
2023-11-07 11:00   ` Laszlo Ersek
2023-11-07 11:47     ` Wu, Jiaxin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=656463e5-7c98-0624-b0d1-98c65880b44a@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox