* Re: [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib [not found] <17C74D78B0B952AD.15491@groups.io> @ 2024-04-18 8:02 ` Wu, Jiaxin 2024-04-22 7:57 ` Gerd Hoffmann 2024-04-18 8:03 ` Wu, Jiaxin 1 sibling, 1 reply; 17+ messages in thread From: Wu, Jiaxin @ 2024-04-18 8:02 UTC (permalink / raw) To: devel@edk2.groups.io, Wu, Jiaxin Cc: Ni, Ray, Zeng, Star, Gerd Hoffmann, Kumar, Rahul R, Dong, Guo, Rhodes, Sean, Lu, James, Guo, Gua, Ard Biesheuvel, Yao, Jiewen, Abdul Lateef Attar, Abner Chang, Tom Lendacky Hi Gerd, Could you help review & check below OVMF related patches? > OvmfPkg/SmmRelocationLib: Add library instance for OVMF > OvmfPkg/PlatformInitLib: Create gEfiSmmSmramMemoryGuid > OvmfPkg: Refine SmmAccess implementation > OvmfPkg/SmmCpuFeaturesLib: Check Smbase Relocation is done or not > OvmfPkg/PlatformPei: Relocate SmBases in PEI phase Thanks, Jiaxin > -----Original Message----- > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Wu, > Jiaxin > Sent: Thursday, April 18, 2024 2:56 PM > To: devel@edk2.groups.io > Cc: Ni, Ray <ray.ni@intel.com>; Zeng, Star <star.zeng@intel.com>; Gerd > Hoffmann <kraxel@redhat.com>; Kumar, Rahul R <rahul.r.kumar@intel.com>; > Dong, Guo <guo.dong@intel.com>; Rhodes, Sean <sean@starlabs.systems>; > Lu, James <james.lu@intel.com>; Guo, Gua <gua.guo@intel.com>; Ard > Biesheuvel <ardb+tianocore@kernel.org>; Yao, Jiewen > <jiewen.yao@intel.com>; Abdul Lateef Attar <AbdulLateef.Attar@amd.com>; > Abner Chang <abner.chang@amd.com>; Tom Lendacky > <thomas.lendacky@amd.com> > Subject: [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib > > PR: https://github.com/tianocore/edk2/pull/5546 > > Intel plans to separate the smbase relocation logic from > PiSmmCpuDxeSmm driver, and the related behavior will be > moved to the new interface defined by the SmmRelocationLib > class. > > The SmmRelocationLib class provides the SmmRelocationInit() > interface for platform to do the smbase relocation, which > shall provide below 2 functionalities: > 1. Relocate smbases for each processor. > 2. Create the gSmmBaseHobGuid HOB. > > With SmmRelocationLib, PiSmmCpuDxeSmm driver (which runs at > a later phase) can be simplfied as below for SMM init: > 1. Consume the gSmmBaseHobGuid HOB for the relocated smbases > for each Processor. > 2. Execute the early SMM Init. > > Cc: Ray Ni <ray.ni@intel.com> > Cc: Zeng Star <star.zeng@intel.com> > Cc: Gerd Hoffmann <kraxel@redhat.com> > Cc: Rahul Kumar <rahul1.kumar@intel.com> > Cc: Guo Dong <guo.dong@intel.com> > Cc: Sean Rhodes <sean@starlabs.systems> > Cc: James Lu <james.lu@intel.com> > Cc: Gua Guo <gua.guo@intel.com> > Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> > Cc: Jiewen Yao <jiewen.yao@intel.com> > Cc: Abdul Lateef Attar <AbdulLateef.Attar@amd.com> > Cc: Abner Chang <abner.chang@amd.com> > Cc: Tom Lendacky <thomas.lendacky@amd.com> > Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> > > Jiaxin Wu (13): > UefiCpuPkg: Add SmmRelocationLib class > UefiCpuPkg/SmmRelocationLib: Add SmmRelocationLib library instance > UefiCpuPkg/SmmRelocationLib: Rename global variables > UefiCpuPkg/SmmRelocationLib: Avoid unnecessary memory allocation > UefiCpuPkg/SmmRelocationLib: Remove unnecessary global variable > UefiCpuPkg/SmmRelocationLib: Add library instance for AMD > OvmfPkg/SmmRelocationLib: Add library instance for OVMF > OvmfPkg/PlatformInitLib: Create gEfiSmmSmramMemoryGuid > OvmfPkg: Refine SmmAccess implementation > OvmfPkg/SmmCpuFeaturesLib: Check Smbase Relocation is done or not > OvmfPkg/PlatformPei: Relocate SmBases in PEI phase > UefiPayloadPkg/UefiPayloadPkg.dsc: Include SmmRelocationLib > UefiCpuPkg/PiSmmCpuDxeSmm: Remove SmBases relocation logic > > OvmfPkg/AmdSev/AmdSevX64.dsc | 1 + > OvmfPkg/CloudHv/CloudHvX64.dsc | 1 + > OvmfPkg/Library/PlatformInitLib/MemDetect.c | 104 ++-- > .../Library/PlatformInitLib/PlatformInitLib.inf | 6 +- > .../Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c | 33 +- > .../Library/SmmRelocationLib}/Ia32/Semaphore.c | 13 +- > .../Library/SmmRelocationLib}/Ia32/SmmInit.nasm | 83 +++- > .../SmmRelocationLib/InternalSmmRelocationLib.h | 127 +++++ > .../Library/SmmRelocationLib/SmmRelocationLib.c | 549 > +++++++++++++++++++++ > .../Library/SmmRelocationLib/SmmRelocationLib.inf | 60 +++ > .../SmmRelocationLib/SmramSaveStateConfig.c | 100 ++++ > .../Library/SmmRelocationLib}/X64/Semaphore.c | 13 +- > .../Library/SmmRelocationLib}/X64/SmmInit.nasm | 85 +++- > OvmfPkg/Microvm/MicrovmX64.dsc | 1 + > OvmfPkg/OvmfPkgIa32.dsc | 1 + > OvmfPkg/OvmfPkgIa32X64.dsc | 1 + > OvmfPkg/OvmfPkgX64.dsc | 1 + > OvmfPkg/PlatformPei/Platform.c | 3 + > OvmfPkg/PlatformPei/Platform.h | 5 + > OvmfPkg/PlatformPei/PlatformPei.inf | 5 +- > OvmfPkg/PlatformPei/SmmRelocation.c | 80 +++ > OvmfPkg/SmmAccess/SmmAccess2Dxe.c | 4 +- > OvmfPkg/SmmAccess/SmmAccess2Dxe.inf | 5 + > OvmfPkg/SmmAccess/SmmAccessPei.c | 88 +--- > OvmfPkg/SmmAccess/SmmAccessPei.inf | 7 +- > OvmfPkg/SmmAccess/SmramInternal.c | 73 +-- > OvmfPkg/SmmAccess/SmramInternal.h | 18 +- > UefiCpuPkg/Include/Library/SmmRelocationLib.h | 42 ++ > .../SmmRelocationLib/AmdSmmRelocationLib.inf | 60 +++ > .../SmmRelocationLib/AmdSmramSaveStateConfig.c | 125 +++++ > .../SmmRelocationLib}/Ia32/Semaphore.c | 13 +- > .../SmmRelocationLib}/Ia32/SmmInit.nasm | 83 +++- > .../SmmRelocationLib/InternalSmmRelocationLib.h | 127 +++++ > .../Library/SmmRelocationLib/SmmRelocationLib.c | 549 > +++++++++++++++++++++ > .../Library/SmmRelocationLib/SmmRelocationLib.inf | 61 +++ > .../SmmRelocationLib/SmramSaveStateConfig.c | 136 +++++ > .../SmmRelocationLib}/X64/Semaphore.c | 13 +- > .../SmmRelocationLib}/X64/SmmInit.nasm | 85 +++- > UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 21 +- > UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c | 10 +- > UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c | 331 ++----------- > UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 103 +--- > UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf | 4 - > UefiCpuPkg/PiSmmCpuDxeSmm/SmmMpPerf.h | 2 +- > UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c | 69 --- > UefiCpuPkg/UefiCpuPkg.dec | 3 + > UefiCpuPkg/UefiCpuPkg.dsc | 2 + > UefiPayloadPkg/UefiPayloadPkg.dsc | 2 + > 48 files changed, 2514 insertions(+), 794 deletions(-) > copy {UefiCpuPkg/PiSmmCpuDxeSmm => > OvmfPkg/Library/SmmRelocationLib}/Ia32/Semaphore.c (71%) > copy {UefiCpuPkg/PiSmmCpuDxeSmm => > OvmfPkg/Library/SmmRelocationLib}/Ia32/SmmInit.nasm (47%) > create mode 100644 > OvmfPkg/Library/SmmRelocationLib/InternalSmmRelocationLib.h > create mode 100644 > OvmfPkg/Library/SmmRelocationLib/SmmRelocationLib.c > create mode 100644 > OvmfPkg/Library/SmmRelocationLib/SmmRelocationLib.inf > create mode 100644 > OvmfPkg/Library/SmmRelocationLib/SmramSaveStateConfig.c > copy {UefiCpuPkg/PiSmmCpuDxeSmm => > OvmfPkg/Library/SmmRelocationLib}/X64/Semaphore.c (78%) > copy {UefiCpuPkg/PiSmmCpuDxeSmm => > OvmfPkg/Library/SmmRelocationLib}/X64/SmmInit.nasm (59%) > create mode 100644 OvmfPkg/PlatformPei/SmmRelocation.c > create mode 100644 UefiCpuPkg/Include/Library/SmmRelocationLib.h > create mode 100644 > UefiCpuPkg/Library/SmmRelocationLib/AmdSmmRelocationLib.inf > create mode 100644 > UefiCpuPkg/Library/SmmRelocationLib/AmdSmramSaveStateConfig.c > rename UefiCpuPkg/{PiSmmCpuDxeSmm => > Library/SmmRelocationLib}/Ia32/Semaphore.c (71%) > rename UefiCpuPkg/{PiSmmCpuDxeSmm => > Library/SmmRelocationLib}/Ia32/SmmInit.nasm (47%) > create mode 100644 > UefiCpuPkg/Library/SmmRelocationLib/InternalSmmRelocationLib.h > create mode 100644 > UefiCpuPkg/Library/SmmRelocationLib/SmmRelocationLib.c > create mode 100644 > UefiCpuPkg/Library/SmmRelocationLib/SmmRelocationLib.inf > create mode 100644 > UefiCpuPkg/Library/SmmRelocationLib/SmramSaveStateConfig.c > rename UefiCpuPkg/{PiSmmCpuDxeSmm => > Library/SmmRelocationLib}/X64/Semaphore.c (78%) > rename UefiCpuPkg/{PiSmmCpuDxeSmm => > Library/SmmRelocationLib}/X64/SmmInit.nasm (59%) > > -- > 2.16.2.windows.1 > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117964): https://edk2.groups.io/g/devel/message/117964 Mute This Topic: https://groups.io/mt/105593568/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib 2024-04-18 8:02 ` [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib Wu, Jiaxin @ 2024-04-22 7:57 ` Gerd Hoffmann 2024-04-23 7:31 ` Wu, Jiaxin 0 siblings, 1 reply; 17+ messages in thread From: Gerd Hoffmann @ 2024-04-22 7:57 UTC (permalink / raw) To: Wu, Jiaxin Cc: devel@edk2.groups.io, Ni, Ray, Zeng, Star, Kumar, Rahul R, Dong, Guo, Rhodes, Sean, Lu, James, Guo, Gua, Ard Biesheuvel, Yao, Jiewen, Abdul Lateef Attar, Abner Chang, Tom Lendacky On Thu, Apr 18, 2024 at 08:02:43AM +0000, Wu, Jiaxin wrote: > Hi Gerd, > > Could you help review & check below OVMF related patches? > > > OvmfPkg/SmmRelocationLib: Add library instance for OVMF > > OvmfPkg/PlatformInitLib: Create gEfiSmmSmramMemoryGuid > > OvmfPkg: Refine SmmAccess implementation > > OvmfPkg/SmmCpuFeaturesLib: Check Smbase Relocation is done or not > > OvmfPkg/PlatformPei: Relocate SmBases in PEI phase Patch series breaks S3 suspend support in OVMF. On a quick check (OvmfPkgX64 only) using AmdSmmRelocationLib.inf for OVMF seems to work fine (S3 is broken too though). take care, Gerd -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#118074): https://edk2.groups.io/g/devel/message/118074 Mute This Topic: https://groups.io/mt/105593568/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib 2024-04-22 7:57 ` Gerd Hoffmann @ 2024-04-23 7:31 ` Wu, Jiaxin 2024-04-23 8:43 ` Gerd Hoffmann 0 siblings, 1 reply; 17+ messages in thread From: Wu, Jiaxin @ 2024-04-23 7:31 UTC (permalink / raw) To: Gerd Hoffmann Cc: devel@edk2.groups.io, Ni, Ray, Zeng, Star, Kumar, Rahul R, Dong, Guo, Rhodes, Sean, Lu, James, Guo, Gua, Ard Biesheuvel, Yao, Jiewen, Abdul Lateef Attar, Abner Chang, Tom Lendacky Thanks Gerd, I will try the S3 on OVMF. And for AmdSmmRelocationLib usage in OVMF, do you prefer: 1. use the AmdSmmRelocationLib directly in this patch set? Or 2. still keep the original to create the OvmfPkg/SmmRelocationLib, and clean the code in the future patch? Both are fine to me, depends on you. Thanks, Jiaxin > -----Original Message----- > From: Gerd Hoffmann <kraxel@redhat.com> > Sent: Monday, April 22, 2024 3:58 PM > To: Wu, Jiaxin <jiaxin.wu@intel.com> > Cc: devel@edk2.groups.io; Ni, Ray <ray.ni@intel.com>; Zeng, Star > <star.zeng@intel.com>; Kumar, Rahul R <rahul.r.kumar@intel.com>; Dong, > Guo <guo.dong@intel.com>; Rhodes, Sean <sean@starlabs.systems>; Lu, > James <james.lu@intel.com>; Guo, Gua <gua.guo@intel.com>; Ard Biesheuvel > <ardb+tianocore@kernel.org>; Yao, Jiewen <jiewen.yao@intel.com>; Abdul > Lateef Attar <AbdulLateef.Attar@amd.com>; Abner Chang > <abner.chang@amd.com>; Tom Lendacky <thomas.lendacky@amd.com> > Subject: Re: [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib > > On Thu, Apr 18, 2024 at 08:02:43AM +0000, Wu, Jiaxin wrote: > > Hi Gerd, > > > > Could you help review & check below OVMF related patches? > > > > > OvmfPkg/SmmRelocationLib: Add library instance for OVMF > > > OvmfPkg/PlatformInitLib: Create gEfiSmmSmramMemoryGuid > > > OvmfPkg: Refine SmmAccess implementation > > > OvmfPkg/SmmCpuFeaturesLib: Check Smbase Relocation is done or not > > > OvmfPkg/PlatformPei: Relocate SmBases in PEI phase > > Patch series breaks S3 suspend support in OVMF. > > On a quick check (OvmfPkgX64 only) using AmdSmmRelocationLib.inf for > OVMF seems to work fine (S3 is broken too though). > > take care, > Gerd -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#118128): https://edk2.groups.io/g/devel/message/118128 Mute This Topic: https://groups.io/mt/105593568/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib 2024-04-23 7:31 ` Wu, Jiaxin @ 2024-04-23 8:43 ` Gerd Hoffmann 2024-04-23 12:16 ` Wu, Jiaxin 2024-04-24 3:56 ` Wu, Jiaxin 0 siblings, 2 replies; 17+ messages in thread From: Gerd Hoffmann @ 2024-04-23 8:43 UTC (permalink / raw) To: Wu, Jiaxin Cc: devel@edk2.groups.io, Ni, Ray, Zeng, Star, Kumar, Rahul R, Dong, Guo, Rhodes, Sean, Lu, James, Guo, Gua, Ard Biesheuvel, Yao, Jiewen, Abdul Lateef Attar, Abner Chang, Tom Lendacky On Tue, Apr 23, 2024 at 07:31:18AM +0000, Wu, Jiaxin wrote: > Thanks Gerd, I will try the S3 on OVMF. > > And for AmdSmmRelocationLib usage in OVMF, do you prefer: > 1. use the AmdSmmRelocationLib directly in this patch set? Or > 2. still keep the original to create the OvmfPkg/SmmRelocationLib, and clean the code in the future patch? Clear preference for (1), why introduce OvmfPkg/SmmRelocationLib only to delete it shortly thereafter? take care, Gerd -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#118130): https://edk2.groups.io/g/devel/message/118130 Mute This Topic: https://groups.io/mt/105593568/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib 2024-04-23 8:43 ` Gerd Hoffmann @ 2024-04-23 12:16 ` Wu, Jiaxin 2024-04-24 3:56 ` Wu, Jiaxin 1 sibling, 0 replies; 17+ messages in thread From: Wu, Jiaxin @ 2024-04-23 12:16 UTC (permalink / raw) To: Gerd Hoffmann Cc: devel@edk2.groups.io, Ni, Ray, Zeng, Star, Kumar, Rahul R, Dong, Guo, Rhodes, Sean, Lu, James, Guo, Gua, Ard Biesheuvel, Yao, Jiewen, Abdul Lateef Attar, Abner Chang, Tom Lendacky As I documented in the comment: This patch provides the SmmRelocationLib library instance for OVMF to handle the logic difference, and it won't change the existing implementation code logic. But as I said, it depends on you. I will drop the OvmfPkg/SmmRelocationLib since confirmed we can use the ADM version for OVMF. Thanks, Jiaxin > -----Original Message----- > From: Gerd Hoffmann <kraxel@redhat.com> > Sent: Tuesday, April 23, 2024 4:43 PM > To: Wu, Jiaxin <jiaxin.wu@intel.com> > Cc: devel@edk2.groups.io; Ni, Ray <ray.ni@intel.com>; Zeng, Star > <star.zeng@intel.com>; Kumar, Rahul R <rahul.r.kumar@intel.com>; Dong, > Guo <guo.dong@intel.com>; Rhodes, Sean <sean@starlabs.systems>; Lu, > James <james.lu@intel.com>; Guo, Gua <gua.guo@intel.com>; Ard Biesheuvel > <ardb+tianocore@kernel.org>; Yao, Jiewen <jiewen.yao@intel.com>; Abdul > Lateef Attar <AbdulLateef.Attar@amd.com>; Abner Chang > <abner.chang@amd.com>; Tom Lendacky <thomas.lendacky@amd.com> > Subject: Re: [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib > > On Tue, Apr 23, 2024 at 07:31:18AM +0000, Wu, Jiaxin wrote: > > Thanks Gerd, I will try the S3 on OVMF. > > > > And for AmdSmmRelocationLib usage in OVMF, do you prefer: > > 1. use the AmdSmmRelocationLib directly in this patch set? Or > > 2. still keep the original to create the OvmfPkg/SmmRelocationLib, and clean > the code in the future patch? > > Clear preference for (1), why introduce OvmfPkg/SmmRelocationLib only to > delete it shortly thereafter? > > take care, > Gerd -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#118137): https://edk2.groups.io/g/devel/message/118137 Mute This Topic: https://groups.io/mt/105593568/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib 2024-04-23 8:43 ` Gerd Hoffmann 2024-04-23 12:16 ` Wu, Jiaxin @ 2024-04-24 3:56 ` Wu, Jiaxin 2024-04-24 11:29 ` Gerd Hoffmann 1 sibling, 1 reply; 17+ messages in thread From: Wu, Jiaxin @ 2024-04-24 3:56 UTC (permalink / raw) To: Gerd Hoffmann Cc: devel@edk2.groups.io, Ni, Ray, Zeng, Star, Kumar, Rahul R, Dong, Guo, Rhodes, Sean, Lu, James, Guo, Gua, Ard Biesheuvel, Yao, Jiewen, Abdul Lateef Attar, Abner Chang, Tom Lendacky Hi Gerd, AMD version is not work for IA32X64 ovmf. I checked the detailed: CpuSaveState->x64 is always used for OVMF no matter IA32 or X64, while AMD is not, which is decided by the MSR EFER_ADDRESS LMA bit check. There is a potential issue/open in OVMF why need use the X64 CpuSaveState for IA32. Before this open resolved, I still prefer to keep use the ovmf specific lib instance. Thanks, Jiaxin > -----Original Message----- > From: Wu, Jiaxin > Sent: Tuesday, April 23, 2024 8:16 PM > To: Gerd Hoffmann <kraxel@redhat.com> > Cc: devel@edk2.groups.io; Ni, Ray <ray.ni@intel.com>; Zeng, Star > <star.zeng@intel.com>; Kumar, Rahul R <rahul.r.kumar@intel.com>; Dong, > Guo <guo.dong@intel.com>; Rhodes, Sean <sean@starlabs.systems>; Lu, > James <james.lu@intel.com>; Guo, Gua <gua.guo@intel.com>; Ard Biesheuvel > <ardb+tianocore@kernel.org>; Yao, Jiewen <jiewen.yao@intel.com>; Abdul > Lateef Attar <AbdulLateef.Attar@amd.com>; Abner Chang > <abner.chang@amd.com>; Tom Lendacky <thomas.lendacky@amd.com> > Subject: RE: [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib > > As I documented in the comment: > > This patch provides the SmmRelocationLib library instance > for OVMF to handle the logic difference, and it won't change > the existing implementation code logic. > > But as I said, it depends on you. I will drop the OvmfPkg/SmmRelocationLib > since confirmed we can use the ADM version for OVMF. > > Thanks, > Jiaxin > > > -----Original Message----- > > From: Gerd Hoffmann <kraxel@redhat.com> > > Sent: Tuesday, April 23, 2024 4:43 PM > > To: Wu, Jiaxin <jiaxin.wu@intel.com> > > Cc: devel@edk2.groups.io; Ni, Ray <ray.ni@intel.com>; Zeng, Star > > <star.zeng@intel.com>; Kumar, Rahul R <rahul.r.kumar@intel.com>; Dong, > > Guo <guo.dong@intel.com>; Rhodes, Sean <sean@starlabs.systems>; Lu, > > James <james.lu@intel.com>; Guo, Gua <gua.guo@intel.com>; Ard > Biesheuvel > > <ardb+tianocore@kernel.org>; Yao, Jiewen <jiewen.yao@intel.com>; Abdul > > Lateef Attar <AbdulLateef.Attar@amd.com>; Abner Chang > > <abner.chang@amd.com>; Tom Lendacky <thomas.lendacky@amd.com> > > Subject: Re: [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib > > > > On Tue, Apr 23, 2024 at 07:31:18AM +0000, Wu, Jiaxin wrote: > > > Thanks Gerd, I will try the S3 on OVMF. > > > > > > And for AmdSmmRelocationLib usage in OVMF, do you prefer: > > > 1. use the AmdSmmRelocationLib directly in this patch set? Or > > > 2. still keep the original to create the OvmfPkg/SmmRelocationLib, and > clean > > the code in the future patch? > > > > Clear preference for (1), why introduce OvmfPkg/SmmRelocationLib only to > > delete it shortly thereafter? > > > > take care, > > Gerd -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#118180): https://edk2.groups.io/g/devel/message/118180 Mute This Topic: https://groups.io/mt/105593568/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib 2024-04-24 3:56 ` Wu, Jiaxin @ 2024-04-24 11:29 ` Gerd Hoffmann 2024-04-25 0:54 ` Wu, Jiaxin 0 siblings, 1 reply; 17+ messages in thread From: Gerd Hoffmann @ 2024-04-24 11:29 UTC (permalink / raw) To: Wu, Jiaxin Cc: devel@edk2.groups.io, Ni, Ray, Zeng, Star, Kumar, Rahul R, Dong, Guo, Rhodes, Sean, Lu, James, Guo, Gua, Ard Biesheuvel, Yao, Jiewen, Abdul Lateef Attar, Abner Chang, Tom Lendacky On Wed, Apr 24, 2024 at 03:56:56AM +0000, Wu, Jiaxin wrote: > Hi Gerd, > > AMD version is not work for IA32X64 ovmf. > > I checked the detailed: CpuSaveState->x64 is always used for OVMF no matter IA32 or X64, while AMD is not, which is decided by the MSR EFER_ADDRESS LMA bit check. Hmm, probably because only PEI runs in 32-bit mode whereas DXE and SMM run in 64-bit mode, so 32-bit PEI has to prepare things for the 64-bit SMM. > There is a potential issue/open in OVMF why need use the X64 > CpuSaveState for IA32. Before this open resolved, I still prefer to > keep use the ovmf specific lib instance. Yes, lets stick to the ovmf version for now, and maybe remove it later when fixing the ia32 ovmf builds. take care, Gerd -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#118204): https://edk2.groups.io/g/devel/message/118204 Mute This Topic: https://groups.io/mt/105593568/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib 2024-04-24 11:29 ` Gerd Hoffmann @ 2024-04-25 0:54 ` Wu, Jiaxin 2024-04-25 5:50 ` Ni, Ray 0 siblings, 1 reply; 17+ messages in thread From: Wu, Jiaxin @ 2024-04-25 0:54 UTC (permalink / raw) To: Gerd Hoffmann Cc: devel@edk2.groups.io, Ni, Ray, Zeng, Star, Kumar, Rahul R, Dong, Guo, Rhodes, Sean, Lu, James, Guo, Gua, Ard Biesheuvel, Yao, Jiewen, Abdul Lateef Attar, Abner Chang, Tom Lendacky > > > > AMD version is not work for IA32X64 ovmf. > > > > I checked the detailed: CpuSaveState->x64 is always used for OVMF no > matter IA32 or X64, while AMD is not, which is decided by the MSR > EFER_ADDRESS LMA bit check. > > Hmm, probably because only PEI runs in 32-bit mode whereas DXE and SMM > run in 64-bit mode, so 32-bit PEI has to prepare things for the 64-bit > SMM. > > > There is a potential issue/open in OVMF why need use the X64 > > CpuSaveState for IA32. Before this open resolved, I still prefer to > > keep use the ovmf specific lib instance. > > Yes, lets stick to the ovmf version for now, and maybe remove it later > when fixing the ia32 ovmf builds. > Ok, no problem. -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#118249): https://edk2.groups.io/g/devel/message/118249 Mute This Topic: https://groups.io/mt/105593568/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib 2024-04-25 0:54 ` Wu, Jiaxin @ 2024-04-25 5:50 ` Ni, Ray 2024-04-25 6:58 ` Gerd Hoffmann 0 siblings, 1 reply; 17+ messages in thread From: Ni, Ray @ 2024-04-25 5:50 UTC (permalink / raw) To: Wu, Jiaxin, Gerd Hoffmann Cc: devel@edk2.groups.io, Zeng, Star, Kumar, Rahul R, Dong, Guo, Rhodes, Sean, Lu, James, Guo, Gua, Ard Biesheuvel, Yao, Jiewen, Abdul Lateef Attar, Abner Chang, Tom Lendacky [-- Attachment #1: Type: text/plain, Size: 3429 bytes --] I checked the AMD64 Architecture Programmer's Manual and it says below: --- AMD64 manual --- SMM-revision Level—Bits 15:0. Specifies the version of SMM supported by the processor. The SMM-revision level is of the form 0_xx64h, where xx starts with 00 and is incremented for later revisions to the SMM mechanism. --- That means the SMMRevId is 0_xx64h for AMD64 processor. But I am not sure what the value is for AMD32 processor. Maybe 0 according to the OVMF logic. --- OVMF's logic --- AMD_SMRAM_SAVE_STATE_MAP *CpuSaveState; CpuSaveState = (AMD_SMRAM_SAVE_STATE_MAP *)(UINTN)(SMM_DEFAULT_SMBASE + SMRAM_SAVE_STATE_MAP_OFFSET); if ((CpuSaveState->x86.SMMRevId & 0xFFFF) == 0) { CpuSaveState->x86.SMBASE = (UINT32)SmBase; } else { CpuSaveState->x64.SMBASE = (UINT32)SmBase; } ------ But, I am very suspicious about the logic in AMD's version as below: --- AMD's version SmmSaveStateRegisterLma = (UINT8)EFI_MM_SAVE_STATE_REGISTER_LMA_32BIT; LMAValue = (UINT32)AsmReadMsr64 (EFER_ADDRESS) & LMA; if (LMAValue) { SmmSaveStateRegisterLma = (UINT8)EFI_MM_SAVE_STATE_REGISTER_LMA_64BIT; } --- The above logic detects the current CPU mode and 64bit save state area layout is used if it's running in 64bit. But if a AMD64 CPU runs in 32bit mode, the above logic causes the 32bit save state area layout is used. It's not right! The save state area layout does not depend on the CPU running mode, but whether it's a legacy CPU or a 64-capable CPU. Jiaxin, I agree that the confusion should be cleaned up by AMD experts. Let's not change any existing behavior. Thanks, Ray ________________________________ From: Wu, Jiaxin <jiaxin.wu@intel.com> Sent: Thursday, April 25, 2024 8:54 To: Gerd Hoffmann <kraxel@redhat.com> Cc: devel@edk2.groups.io <devel@edk2.groups.io>; Ni, Ray <ray.ni@intel.com>; Zeng, Star <star.zeng@intel.com>; Kumar, Rahul R <rahul.r.kumar@intel.com>; Dong, Guo <guo.dong@intel.com>; Rhodes, Sean <sean@starlabs.systems>; Lu, James <james.lu@intel.com>; Guo, Gua <gua.guo@intel.com>; Ard Biesheuvel <ardb+tianocore@kernel.org>; Yao, Jiewen <jiewen.yao@intel.com>; Abdul Lateef Attar <AbdulLateef.Attar@amd.com>; Abner Chang <abner.chang@amd.com>; Tom Lendacky <thomas.lendacky@amd.com> Subject: RE: [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib > > > > AMD version is not work for IA32X64 ovmf. > > > > I checked the detailed: CpuSaveState->x64 is always used for OVMF no > matter IA32 or X64, while AMD is not, which is decided by the MSR > EFER_ADDRESS LMA bit check. > > Hmm, probably because only PEI runs in 32-bit mode whereas DXE and SMM > run in 64-bit mode, so 32-bit PEI has to prepare things for the 64-bit > SMM. > > > There is a potential issue/open in OVMF why need use the X64 > > CpuSaveState for IA32. Before this open resolved, I still prefer to > > keep use the ovmf specific lib instance. > > Yes, lets stick to the ovmf version for now, and maybe remove it later > when fixing the ia32 ovmf builds. > Ok, no problem. -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#118266): https://edk2.groups.io/g/devel/message/118266 Mute This Topic: https://groups.io/mt/105593568/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- [-- Attachment #2: Type: text/html, Size: 11104 bytes --] ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib 2024-04-25 5:50 ` Ni, Ray @ 2024-04-25 6:58 ` Gerd Hoffmann 2024-04-26 6:07 ` Ni, Ray 2024-04-26 13:18 ` Lendacky, Thomas via groups.io 0 siblings, 2 replies; 17+ messages in thread From: Gerd Hoffmann @ 2024-04-25 6:58 UTC (permalink / raw) To: Ni, Ray Cc: Wu, Jiaxin, devel@edk2.groups.io, Zeng, Star, Kumar, Rahul R, Dong, Guo, Rhodes, Sean, Lu, James, Guo, Gua, Ard Biesheuvel, Yao, Jiewen, Abdul Lateef Attar, Abner Chang, Tom Lendacky Hi, > That means the SMMRevId is 0_xx64h for AMD64 processor. But I am not > sure what the value is for AMD32 processor. Maybe 0 according to the > OVMF logic. The smm emulation in the linux kernel uses 0 and 0x64. > But, I am very suspicious about the logic in AMD's version as below: > --- AMD's version > SmmSaveStateRegisterLma = (UINT8)EFI_MM_SAVE_STATE_REGISTER_LMA_32BIT; > > LMAValue = (UINT32)AsmReadMsr64 (EFER_ADDRESS) & LMA; > if (LMAValue) { > SmmSaveStateRegisterLma = (UINT8)EFI_MM_SAVE_STATE_REGISTER_LMA_64BIT; > } > --- > The above logic detects the current CPU mode and 64bit save state area layout is used if it's running in 64bit. > But if a AMD64 CPU runs in 32bit mode, the above logic causes the > 32bit save state area layout is used. It's not right! The save state > area layout does not depend on the CPU running mode, but whether it's > a legacy CPU or a 64-capable CPU. Well, that is not entirely clear to me. Could it be 64-bit processors support both 32-bit and 64-bit format, for backward compatibility reasons? So OvmfPkgIa32 builds could use the 32-bit format, OvmfPkgX64 builds use the 64-bit format, everything works fine? The tricky corner case is OvmfPkgIa32X64, where (after applying this series) 32-bit PEI should setup things for 64-bit SMM/DXE, and checking the current processor mode will not give use the result we need. > Jiaxin, I agree that the confusion should be cleaned up by AMD > experts. Let's not change any existing behavior. Agree. Tom? take care, Gerd -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#118272): https://edk2.groups.io/g/devel/message/118272 Mute This Topic: https://groups.io/mt/105593568/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib 2024-04-25 6:58 ` Gerd Hoffmann @ 2024-04-26 6:07 ` Ni, Ray 2024-04-26 13:18 ` Lendacky, Thomas via groups.io 1 sibling, 0 replies; 17+ messages in thread From: Ni, Ray @ 2024-04-26 6:07 UTC (permalink / raw) To: Gerd Hoffmann Cc: Wu, Jiaxin, devel@edk2.groups.io, Zeng, Star, Kumar, Rahul R, Dong, Guo, Rhodes, Sean, Lu, James, Guo, Gua, Ard Biesheuvel, Yao, Jiewen, Abdul Lateef Attar, Abner Chang, Tom Lendacky [-- Attachment #1: Type: text/plain, Size: 3256 bytes --] Thanks, Ray ________________________________ From: Gerd Hoffmann <kraxel@redhat.com> Sent: Thursday, April 25, 2024 14:58 To: Ni, Ray <ray.ni@intel.com> Cc: Wu, Jiaxin <jiaxin.wu@intel.com>; devel@edk2.groups.io <devel@edk2.groups.io>; Zeng, Star <star.zeng@intel.com>; Kumar, Rahul R <rahul.r.kumar@intel.com>; Dong, Guo <guo.dong@intel.com>; Rhodes, Sean <sean@starlabs.systems>; Lu, James <james.lu@intel.com>; Guo, Gua <gua.guo@intel.com>; Ard Biesheuvel <ardb+tianocore@kernel.org>; Yao, Jiewen <jiewen.yao@intel.com>; Abdul Lateef Attar <AbdulLateef.Attar@amd.com>; Abner Chang <abner.chang@amd.com>; Tom Lendacky <thomas.lendacky@amd.com> Subject: Re: [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib Hi, > That means the SMMRevId is 0_xx64h for AMD64 processor. But I am not > sure what the value is for AMD32 processor. Maybe 0 according to the > OVMF logic. The smm emulation in the linux kernel uses 0 and 0x64. [Ray] OK. that supports the OVMF instance's logic. But I'd like Tom or any other AMD guys to provide spec that says 0 for AMD32. > But, I am very suspicious about the logic in AMD's version as below: > --- AMD's version > SmmSaveStateRegisterLma = (UINT8)EFI_MM_SAVE_STATE_REGISTER_LMA_32BIT; > > LMAValue = (UINT32)AsmReadMsr64 (EFER_ADDRESS) & LMA; > if (LMAValue) { > SmmSaveStateRegisterLma = (UINT8)EFI_MM_SAVE_STATE_REGISTER_LMA_64BIT; > } > --- > The above logic detects the current CPU mode and 64bit save state area layout is used if it's running in 64bit. > But if a AMD64 CPU runs in 32bit mode, the above logic causes the > 32bit save state area layout is used. It's not right! The save state > area layout does not depend on the CPU running mode, but whether it's > a legacy CPU or a 64-capable CPU. Well, that is not entirely clear to me. Could it be 64-bit processors support both 32-bit and 64-bit format, for backward compatibility reasons? [Ray] The CPU uses a fixed save state area layout no matter it runs in 32bit or 64bit. The 64bit cpu only uses the 64bit format, no matter it runs in 32bit or 64bit. So OvmfPkgIa32 builds could use the 32-bit format, OvmfPkgX64 builds use the 64-bit format, everything works fine? [Ray] For OVMF, it depends on how the virtual cpu is defined by QEMU implementation. If the underline CPU is a AMD64 cpu, the CPU supports running in 32bit or 64bit modes. But no matter it runs in 32bit or 64bit, the save state area layout always follows the 64bit format. The tricky corner case is OvmfPkgIa32X64, where (after applying this series) 32-bit PEI should setup things for 64-bit SMM/DXE, and checking the current processor mode will not give use the result we need. > Jiaxin, I agree that the confusion should be cleaned up by AMD > experts. Let's not change any existing behavior. Agree. Tom? take care, Gerd -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#118310): https://edk2.groups.io/g/devel/message/118310 Mute This Topic: https://groups.io/mt/105593568/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- [-- Attachment #2: Type: text/html, Size: 6039 bytes --] ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib 2024-04-25 6:58 ` Gerd Hoffmann 2024-04-26 6:07 ` Ni, Ray @ 2024-04-26 13:18 ` Lendacky, Thomas via groups.io 1 sibling, 0 replies; 17+ messages in thread From: Lendacky, Thomas via groups.io @ 2024-04-26 13:18 UTC (permalink / raw) To: Gerd Hoffmann, Ni, Ray Cc: Wu, Jiaxin, devel@edk2.groups.io, Zeng, Star, Kumar, Rahul R, Dong, Guo, Rhodes, Sean, Lu, James, Guo, Gua, Ard Biesheuvel, Yao, Jiewen, Abdul Lateef Attar, Abner Chang On 4/25/24 01:58, Gerd Hoffmann wrote: > Hi, > >> That means the SMMRevId is 0_xx64h for AMD64 processor. But I am not >> sure what the value is for AMD32 processor. Maybe 0 according to the >> OVMF logic. > > The smm emulation in the linux kernel uses 0 and 0x64. > >> But, I am very suspicious about the logic in AMD's version as below: >> --- AMD's version >> SmmSaveStateRegisterLma = (UINT8)EFI_MM_SAVE_STATE_REGISTER_LMA_32BIT; >> >> LMAValue = (UINT32)AsmReadMsr64 (EFER_ADDRESS) & LMA; >> if (LMAValue) { >> SmmSaveStateRegisterLma = (UINT8)EFI_MM_SAVE_STATE_REGISTER_LMA_64BIT; >> } >> --- >> The above logic detects the current CPU mode and 64bit save state area layout is used if it's running in 64bit. > >> But if a AMD64 CPU runs in 32bit mode, the above logic causes the >> 32bit save state area layout is used. It's not right! The save state >> area layout does not depend on the CPU running mode, but whether it's >> a legacy CPU or a 64-capable CPU. > > Well, that is not entirely clear to me. Could it be 64-bit processors > support both 32-bit and 64-bit format, for backward compatibility > reasons? > > So OvmfPkgIa32 builds could use the 32-bit format, OvmfPkgX64 builds use > the 64-bit format, everything works fine? > > The tricky corner case is OvmfPkgIa32X64, where (after applying this > series) 32-bit PEI should setup things for 64-bit SMM/DXE, and checking > the current processor mode will not give use the result we need. > >> Jiaxin, I agree that the confusion should be cleaned up by AMD >> experts. Let's not change any existing behavior. > > Agree. Tom? I don't have a lot of experience with SMM. I believe Paolo first ported over the support into OVMF and might have more insight? I'll try to take a look at it when I can, but maybe @Abner or @Abdul might have more understanding of SMM with which they can comment. Thanks, Tom > > take care, > Gerd > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#118340): https://edk2.groups.io/g/devel/message/118340 Mute This Topic: https://groups.io/mt/105593568/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib [not found] <17C74D78B0B952AD.15491@groups.io> 2024-04-18 8:02 ` [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib Wu, Jiaxin @ 2024-04-18 8:03 ` Wu, Jiaxin 2024-04-19 3:35 ` Ni, Ray 1 sibling, 1 reply; 17+ messages in thread From: Wu, Jiaxin @ 2024-04-18 8:03 UTC (permalink / raw) To: devel@edk2.groups.io, Wu, Jiaxin Cc: Ni, Ray, Zeng, Star, Gerd Hoffmann, Kumar, Rahul R, Dong, Guo, Rhodes, Sean, Lu, James, Guo, Gua, Ard Biesheuvel, Yao, Jiewen, Abdul Lateef Attar, Abner Chang, Tom Lendacky Hi Tom & Abner, Could you help check & review AMD related patch? > UefiCpuPkg/SmmRelocationLib: Add library instance for AMD Thanks, Jiaxin > -----Original Message----- > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Wu, > Jiaxin > Sent: Thursday, April 18, 2024 2:56 PM > To: devel@edk2.groups.io > Cc: Ni, Ray <ray.ni@intel.com>; Zeng, Star <star.zeng@intel.com>; Gerd > Hoffmann <kraxel@redhat.com>; Kumar, Rahul R <rahul.r.kumar@intel.com>; > Dong, Guo <guo.dong@intel.com>; Rhodes, Sean <sean@starlabs.systems>; > Lu, James <james.lu@intel.com>; Guo, Gua <gua.guo@intel.com>; Ard > Biesheuvel <ardb+tianocore@kernel.org>; Yao, Jiewen > <jiewen.yao@intel.com>; Abdul Lateef Attar <AbdulLateef.Attar@amd.com>; > Abner Chang <abner.chang@amd.com>; Tom Lendacky > <thomas.lendacky@amd.com> > Subject: [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib > > PR: https://github.com/tianocore/edk2/pull/5546 > > Intel plans to separate the smbase relocation logic from > PiSmmCpuDxeSmm driver, and the related behavior will be > moved to the new interface defined by the SmmRelocationLib > class. > > The SmmRelocationLib class provides the SmmRelocationInit() > interface for platform to do the smbase relocation, which > shall provide below 2 functionalities: > 1. Relocate smbases for each processor. > 2. Create the gSmmBaseHobGuid HOB. > > With SmmRelocationLib, PiSmmCpuDxeSmm driver (which runs at > a later phase) can be simplfied as below for SMM init: > 1. Consume the gSmmBaseHobGuid HOB for the relocated smbases > for each Processor. > 2. Execute the early SMM Init. > > Cc: Ray Ni <ray.ni@intel.com> > Cc: Zeng Star <star.zeng@intel.com> > Cc: Gerd Hoffmann <kraxel@redhat.com> > Cc: Rahul Kumar <rahul1.kumar@intel.com> > Cc: Guo Dong <guo.dong@intel.com> > Cc: Sean Rhodes <sean@starlabs.systems> > Cc: James Lu <james.lu@intel.com> > Cc: Gua Guo <gua.guo@intel.com> > Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> > Cc: Jiewen Yao <jiewen.yao@intel.com> > Cc: Abdul Lateef Attar <AbdulLateef.Attar@amd.com> > Cc: Abner Chang <abner.chang@amd.com> > Cc: Tom Lendacky <thomas.lendacky@amd.com> > Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> > > Jiaxin Wu (13): > UefiCpuPkg: Add SmmRelocationLib class > UefiCpuPkg/SmmRelocationLib: Add SmmRelocationLib library instance > UefiCpuPkg/SmmRelocationLib: Rename global variables > UefiCpuPkg/SmmRelocationLib: Avoid unnecessary memory allocation > UefiCpuPkg/SmmRelocationLib: Remove unnecessary global variable > UefiCpuPkg/SmmRelocationLib: Add library instance for AMD > OvmfPkg/SmmRelocationLib: Add library instance for OVMF > OvmfPkg/PlatformInitLib: Create gEfiSmmSmramMemoryGuid > OvmfPkg: Refine SmmAccess implementation > OvmfPkg/SmmCpuFeaturesLib: Check Smbase Relocation is done or not > OvmfPkg/PlatformPei: Relocate SmBases in PEI phase > UefiPayloadPkg/UefiPayloadPkg.dsc: Include SmmRelocationLib > UefiCpuPkg/PiSmmCpuDxeSmm: Remove SmBases relocation logic > > OvmfPkg/AmdSev/AmdSevX64.dsc | 1 + > OvmfPkg/CloudHv/CloudHvX64.dsc | 1 + > OvmfPkg/Library/PlatformInitLib/MemDetect.c | 104 ++-- > .../Library/PlatformInitLib/PlatformInitLib.inf | 6 +- > .../Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c | 33 +- > .../Library/SmmRelocationLib}/Ia32/Semaphore.c | 13 +- > .../Library/SmmRelocationLib}/Ia32/SmmInit.nasm | 83 +++- > .../SmmRelocationLib/InternalSmmRelocationLib.h | 127 +++++ > .../Library/SmmRelocationLib/SmmRelocationLib.c | 549 > +++++++++++++++++++++ > .../Library/SmmRelocationLib/SmmRelocationLib.inf | 60 +++ > .../SmmRelocationLib/SmramSaveStateConfig.c | 100 ++++ > .../Library/SmmRelocationLib}/X64/Semaphore.c | 13 +- > .../Library/SmmRelocationLib}/X64/SmmInit.nasm | 85 +++- > OvmfPkg/Microvm/MicrovmX64.dsc | 1 + > OvmfPkg/OvmfPkgIa32.dsc | 1 + > OvmfPkg/OvmfPkgIa32X64.dsc | 1 + > OvmfPkg/OvmfPkgX64.dsc | 1 + > OvmfPkg/PlatformPei/Platform.c | 3 + > OvmfPkg/PlatformPei/Platform.h | 5 + > OvmfPkg/PlatformPei/PlatformPei.inf | 5 +- > OvmfPkg/PlatformPei/SmmRelocation.c | 80 +++ > OvmfPkg/SmmAccess/SmmAccess2Dxe.c | 4 +- > OvmfPkg/SmmAccess/SmmAccess2Dxe.inf | 5 + > OvmfPkg/SmmAccess/SmmAccessPei.c | 88 +--- > OvmfPkg/SmmAccess/SmmAccessPei.inf | 7 +- > OvmfPkg/SmmAccess/SmramInternal.c | 73 +-- > OvmfPkg/SmmAccess/SmramInternal.h | 18 +- > UefiCpuPkg/Include/Library/SmmRelocationLib.h | 42 ++ > .../SmmRelocationLib/AmdSmmRelocationLib.inf | 60 +++ > .../SmmRelocationLib/AmdSmramSaveStateConfig.c | 125 +++++ > .../SmmRelocationLib}/Ia32/Semaphore.c | 13 +- > .../SmmRelocationLib}/Ia32/SmmInit.nasm | 83 +++- > .../SmmRelocationLib/InternalSmmRelocationLib.h | 127 +++++ > .../Library/SmmRelocationLib/SmmRelocationLib.c | 549 > +++++++++++++++++++++ > .../Library/SmmRelocationLib/SmmRelocationLib.inf | 61 +++ > .../SmmRelocationLib/SmramSaveStateConfig.c | 136 +++++ > .../SmmRelocationLib}/X64/Semaphore.c | 13 +- > .../SmmRelocationLib}/X64/SmmInit.nasm | 85 +++- > UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 21 +- > UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c | 10 +- > UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c | 331 ++----------- > UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 103 +--- > UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf | 4 - > UefiCpuPkg/PiSmmCpuDxeSmm/SmmMpPerf.h | 2 +- > UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c | 69 --- > UefiCpuPkg/UefiCpuPkg.dec | 3 + > UefiCpuPkg/UefiCpuPkg.dsc | 2 + > UefiPayloadPkg/UefiPayloadPkg.dsc | 2 + > 48 files changed, 2514 insertions(+), 794 deletions(-) > copy {UefiCpuPkg/PiSmmCpuDxeSmm => > OvmfPkg/Library/SmmRelocationLib}/Ia32/Semaphore.c (71%) > copy {UefiCpuPkg/PiSmmCpuDxeSmm => > OvmfPkg/Library/SmmRelocationLib}/Ia32/SmmInit.nasm (47%) > create mode 100644 > OvmfPkg/Library/SmmRelocationLib/InternalSmmRelocationLib.h > create mode 100644 > OvmfPkg/Library/SmmRelocationLib/SmmRelocationLib.c > create mode 100644 > OvmfPkg/Library/SmmRelocationLib/SmmRelocationLib.inf > create mode 100644 > OvmfPkg/Library/SmmRelocationLib/SmramSaveStateConfig.c > copy {UefiCpuPkg/PiSmmCpuDxeSmm => > OvmfPkg/Library/SmmRelocationLib}/X64/Semaphore.c (78%) > copy {UefiCpuPkg/PiSmmCpuDxeSmm => > OvmfPkg/Library/SmmRelocationLib}/X64/SmmInit.nasm (59%) > create mode 100644 OvmfPkg/PlatformPei/SmmRelocation.c > create mode 100644 UefiCpuPkg/Include/Library/SmmRelocationLib.h > create mode 100644 > UefiCpuPkg/Library/SmmRelocationLib/AmdSmmRelocationLib.inf > create mode 100644 > UefiCpuPkg/Library/SmmRelocationLib/AmdSmramSaveStateConfig.c > rename UefiCpuPkg/{PiSmmCpuDxeSmm => > Library/SmmRelocationLib}/Ia32/Semaphore.c (71%) > rename UefiCpuPkg/{PiSmmCpuDxeSmm => > Library/SmmRelocationLib}/Ia32/SmmInit.nasm (47%) > create mode 100644 > UefiCpuPkg/Library/SmmRelocationLib/InternalSmmRelocationLib.h > create mode 100644 > UefiCpuPkg/Library/SmmRelocationLib/SmmRelocationLib.c > create mode 100644 > UefiCpuPkg/Library/SmmRelocationLib/SmmRelocationLib.inf > create mode 100644 > UefiCpuPkg/Library/SmmRelocationLib/SmramSaveStateConfig.c > rename UefiCpuPkg/{PiSmmCpuDxeSmm => > Library/SmmRelocationLib}/X64/Semaphore.c (78%) > rename UefiCpuPkg/{PiSmmCpuDxeSmm => > Library/SmmRelocationLib}/X64/SmmInit.nasm (59%) > > -- > 2.16.2.windows.1 > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117965): https://edk2.groups.io/g/devel/message/117965 Mute This Topic: https://groups.io/mt/105593568/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib 2024-04-18 8:03 ` Wu, Jiaxin @ 2024-04-19 3:35 ` Ni, Ray 2024-04-19 3:47 ` Chang, Abner via groups.io 0 siblings, 1 reply; 17+ messages in thread From: Ni, Ray @ 2024-04-19 3:35 UTC (permalink / raw) To: Wu, Jiaxin, devel@edk2.groups.io Cc: Zeng, Star, Gerd Hoffmann, Kumar, Rahul R, Dong, Guo, Rhodes, Sean, Lu, James, Guo, Gua, Ard Biesheuvel, Yao, Jiewen, Abdul Lateef Attar, Abner Chang, Tom Lendacky [-- Attachment #1: Type: text/plain, Size: 9266 bytes --] Jiaxin, I see Abdul from AMD has given R-B. I assume that's sufficient for merging this patch. Thanks, Ray ________________________________ From: Wu, Jiaxin <jiaxin.wu@intel.com> Sent: Thursday, April 18, 2024 16:03 To: devel@edk2.groups.io <devel@edk2.groups.io>; Wu, Jiaxin <jiaxin.wu@intel.com> Cc: Ni, Ray <ray.ni@intel.com>; Zeng, Star <star.zeng@intel.com>; Gerd Hoffmann <kraxel@redhat.com>; Kumar, Rahul R <rahul.r.kumar@intel.com>; Dong, Guo <guo.dong@intel.com>; Rhodes, Sean <sean@starlabs.systems>; Lu, James <james.lu@intel.com>; Guo, Gua <gua.guo@intel.com>; Ard Biesheuvel <ardb+tianocore@kernel.org>; Yao, Jiewen <jiewen.yao@intel.com>; Abdul Lateef Attar <AbdulLateef.Attar@amd.com>; Abner Chang <abner.chang@amd.com>; Tom Lendacky <thomas.lendacky@amd.com> Subject: RE: [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib Hi Tom & Abner, Could you help check & review AMD related patch? > UefiCpuPkg/SmmRelocationLib: Add library instance for AMD Thanks, Jiaxin > -----Original Message----- > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Wu, > Jiaxin > Sent: Thursday, April 18, 2024 2:56 PM > To: devel@edk2.groups.io > Cc: Ni, Ray <ray.ni@intel.com>; Zeng, Star <star.zeng@intel.com>; Gerd > Hoffmann <kraxel@redhat.com>; Kumar, Rahul R <rahul.r.kumar@intel.com>; > Dong, Guo <guo.dong@intel.com>; Rhodes, Sean <sean@starlabs.systems>; > Lu, James <james.lu@intel.com>; Guo, Gua <gua.guo@intel.com>; Ard > Biesheuvel <ardb+tianocore@kernel.org>; Yao, Jiewen > <jiewen.yao@intel.com>; Abdul Lateef Attar <AbdulLateef.Attar@amd.com>; > Abner Chang <abner.chang@amd.com>; Tom Lendacky > <thomas.lendacky@amd.com> > Subject: [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib > > PR: https://github.com/tianocore/edk2/pull/5546 > > Intel plans to separate the smbase relocation logic from > PiSmmCpuDxeSmm driver, and the related behavior will be > moved to the new interface defined by the SmmRelocationLib > class. > > The SmmRelocationLib class provides the SmmRelocationInit() > interface for platform to do the smbase relocation, which > shall provide below 2 functionalities: > 1. Relocate smbases for each processor. > 2. Create the gSmmBaseHobGuid HOB. > > With SmmRelocationLib, PiSmmCpuDxeSmm driver (which runs at > a later phase) can be simplfied as below for SMM init: > 1. Consume the gSmmBaseHobGuid HOB for the relocated smbases > for each Processor. > 2. Execute the early SMM Init. > > Cc: Ray Ni <ray.ni@intel.com> > Cc: Zeng Star <star.zeng@intel.com> > Cc: Gerd Hoffmann <kraxel@redhat.com> > Cc: Rahul Kumar <rahul1.kumar@intel.com> > Cc: Guo Dong <guo.dong@intel.com> > Cc: Sean Rhodes <sean@starlabs.systems> > Cc: James Lu <james.lu@intel.com> > Cc: Gua Guo <gua.guo@intel.com> > Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> > Cc: Jiewen Yao <jiewen.yao@intel.com> > Cc: Abdul Lateef Attar <AbdulLateef.Attar@amd.com> > Cc: Abner Chang <abner.chang@amd.com> > Cc: Tom Lendacky <thomas.lendacky@amd.com> > Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> > > Jiaxin Wu (13): > UefiCpuPkg: Add SmmRelocationLib class > UefiCpuPkg/SmmRelocationLib: Add SmmRelocationLib library instance > UefiCpuPkg/SmmRelocationLib: Rename global variables > UefiCpuPkg/SmmRelocationLib: Avoid unnecessary memory allocation > UefiCpuPkg/SmmRelocationLib: Remove unnecessary global variable > UefiCpuPkg/SmmRelocationLib: Add library instance for AMD > OvmfPkg/SmmRelocationLib: Add library instance for OVMF > OvmfPkg/PlatformInitLib: Create gEfiSmmSmramMemoryGuid > OvmfPkg: Refine SmmAccess implementation > OvmfPkg/SmmCpuFeaturesLib: Check Smbase Relocation is done or not > OvmfPkg/PlatformPei: Relocate SmBases in PEI phase > UefiPayloadPkg/UefiPayloadPkg.dsc: Include SmmRelocationLib > UefiCpuPkg/PiSmmCpuDxeSmm: Remove SmBases relocation logic > > OvmfPkg/AmdSev/AmdSevX64.dsc | 1 + > OvmfPkg/CloudHv/CloudHvX64.dsc | 1 + > OvmfPkg/Library/PlatformInitLib/MemDetect.c | 104 ++-- > .../Library/PlatformInitLib/PlatformInitLib.inf | 6 +- > .../Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c | 33 +- > .../Library/SmmRelocationLib}/Ia32/Semaphore.c | 13 +- > .../Library/SmmRelocationLib}/Ia32/SmmInit.nasm | 83 +++- > .../SmmRelocationLib/InternalSmmRelocationLib.h | 127 +++++ > .../Library/SmmRelocationLib/SmmRelocationLib.c | 549 > +++++++++++++++++++++ > .../Library/SmmRelocationLib/SmmRelocationLib.inf | 60 +++ > .../SmmRelocationLib/SmramSaveStateConfig.c | 100 ++++ > .../Library/SmmRelocationLib}/X64/Semaphore.c | 13 +- > .../Library/SmmRelocationLib}/X64/SmmInit.nasm | 85 +++- > OvmfPkg/Microvm/MicrovmX64.dsc | 1 + > OvmfPkg/OvmfPkgIa32.dsc | 1 + > OvmfPkg/OvmfPkgIa32X64.dsc | 1 + > OvmfPkg/OvmfPkgX64.dsc | 1 + > OvmfPkg/PlatformPei/Platform.c | 3 + > OvmfPkg/PlatformPei/Platform.h | 5 + > OvmfPkg/PlatformPei/PlatformPei.inf | 5 +- > OvmfPkg/PlatformPei/SmmRelocation.c | 80 +++ > OvmfPkg/SmmAccess/SmmAccess2Dxe.c | 4 +- > OvmfPkg/SmmAccess/SmmAccess2Dxe.inf | 5 + > OvmfPkg/SmmAccess/SmmAccessPei.c | 88 +--- > OvmfPkg/SmmAccess/SmmAccessPei.inf | 7 +- > OvmfPkg/SmmAccess/SmramInternal.c | 73 +-- > OvmfPkg/SmmAccess/SmramInternal.h | 18 +- > UefiCpuPkg/Include/Library/SmmRelocationLib.h | 42 ++ > .../SmmRelocationLib/AmdSmmRelocationLib.inf | 60 +++ > .../SmmRelocationLib/AmdSmramSaveStateConfig.c | 125 +++++ > .../SmmRelocationLib}/Ia32/Semaphore.c | 13 +- > .../SmmRelocationLib}/Ia32/SmmInit.nasm | 83 +++- > .../SmmRelocationLib/InternalSmmRelocationLib.h | 127 +++++ > .../Library/SmmRelocationLib/SmmRelocationLib.c | 549 > +++++++++++++++++++++ > .../Library/SmmRelocationLib/SmmRelocationLib.inf | 61 +++ > .../SmmRelocationLib/SmramSaveStateConfig.c | 136 +++++ > .../SmmRelocationLib}/X64/Semaphore.c | 13 +- > .../SmmRelocationLib}/X64/SmmInit.nasm | 85 +++- > UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 21 +- > UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c | 10 +- > UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c | 331 ++----------- > UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 103 +--- > UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf | 4 - > UefiCpuPkg/PiSmmCpuDxeSmm/SmmMpPerf.h | 2 +- > UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c | 69 --- > UefiCpuPkg/UefiCpuPkg.dec | 3 + > UefiCpuPkg/UefiCpuPkg.dsc | 2 + > UefiPayloadPkg/UefiPayloadPkg.dsc | 2 + > 48 files changed, 2514 insertions(+), 794 deletions(-) > copy {UefiCpuPkg/PiSmmCpuDxeSmm => > OvmfPkg/Library/SmmRelocationLib}/Ia32/Semaphore.c (71%) > copy {UefiCpuPkg/PiSmmCpuDxeSmm => > OvmfPkg/Library/SmmRelocationLib}/Ia32/SmmInit.nasm (47%) > create mode 100644 > OvmfPkg/Library/SmmRelocationLib/InternalSmmRelocationLib.h > create mode 100644 > OvmfPkg/Library/SmmRelocationLib/SmmRelocationLib.c > create mode 100644 > OvmfPkg/Library/SmmRelocationLib/SmmRelocationLib.inf > create mode 100644 > OvmfPkg/Library/SmmRelocationLib/SmramSaveStateConfig.c > copy {UefiCpuPkg/PiSmmCpuDxeSmm => > OvmfPkg/Library/SmmRelocationLib}/X64/Semaphore.c (78%) > copy {UefiCpuPkg/PiSmmCpuDxeSmm => > OvmfPkg/Library/SmmRelocationLib}/X64/SmmInit.nasm (59%) > create mode 100644 OvmfPkg/PlatformPei/SmmRelocation.c > create mode 100644 UefiCpuPkg/Include/Library/SmmRelocationLib.h > create mode 100644 > UefiCpuPkg/Library/SmmRelocationLib/AmdSmmRelocationLib.inf > create mode 100644 > UefiCpuPkg/Library/SmmRelocationLib/AmdSmramSaveStateConfig.c > rename UefiCpuPkg/{PiSmmCpuDxeSmm => > Library/SmmRelocationLib}/Ia32/Semaphore.c (71%) > rename UefiCpuPkg/{PiSmmCpuDxeSmm => > Library/SmmRelocationLib}/Ia32/SmmInit.nasm (47%) > create mode 100644 > UefiCpuPkg/Library/SmmRelocationLib/InternalSmmRelocationLib.h > create mode 100644 > UefiCpuPkg/Library/SmmRelocationLib/SmmRelocationLib.c > create mode 100644 > UefiCpuPkg/Library/SmmRelocationLib/SmmRelocationLib.inf > create mode 100644 > UefiCpuPkg/Library/SmmRelocationLib/SmramSaveStateConfig.c > rename UefiCpuPkg/{PiSmmCpuDxeSmm => > Library/SmmRelocationLib}/X64/Semaphore.c (78%) > rename UefiCpuPkg/{PiSmmCpuDxeSmm => > Library/SmmRelocationLib}/X64/SmmInit.nasm (59%) > > -- > 2.16.2.windows.1 > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#118003): https://edk2.groups.io/g/devel/message/118003 Mute This Topic: https://groups.io/mt/105593568/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- [-- Attachment #2: Type: text/html, Size: 16286 bytes --] ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib 2024-04-19 3:35 ` Ni, Ray @ 2024-04-19 3:47 ` Chang, Abner via groups.io 2024-04-19 3:55 ` Wu, Jiaxin 0 siblings, 1 reply; 17+ messages in thread From: Chang, Abner via groups.io @ 2024-04-19 3:47 UTC (permalink / raw) To: Ni, Ray, Wu, Jiaxin, devel@edk2.groups.io Cc: Zeng, Star, Gerd Hoffmann, Kumar, Rahul R, Dong, Guo, Rhodes, Sean, Lu, James, Guo, Gua, Ard Biesheuvel, Yao, Jiewen, Attar, AbdulLateef (Abdul Lateef), Lendacky, Thomas [-- Attachment #1: Type: text/plain, Size: 10223 bytes --] [AMD Official Use Only - General] Right, Abdul's RB is sufficient! Thanks Abner ________________________________ From: Ni, Ray <ray.ni@intel.com> Sent: Friday, April 19, 2024 11:35:17 AM To: Wu, Jiaxin <jiaxin.wu@intel.com>; devel@edk2.groups.io <devel@edk2.groups.io> Cc: Zeng, Star <star.zeng@intel.com>; Gerd Hoffmann <kraxel@redhat.com>; Kumar, Rahul R <rahul.r.kumar@intel.com>; Dong, Guo <guo.dong@intel.com>; Rhodes, Sean <sean@starlabs.systems>; Lu, James <james.lu@intel.com>; Guo, Gua <gua.guo@intel.com>; Ard Biesheuvel <ardb+tianocore@kernel.org>; Yao, Jiewen <jiewen.yao@intel.com>; Attar, AbdulLateef (Abdul Lateef) <AbdulLateef.Attar@amd.com>; Chang, Abner <Abner.Chang@amd.com>; Lendacky, Thomas <Thomas.Lendacky@amd.com> Subject: Re: [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding. Jiaxin, I see Abdul from AMD has given R-B. I assume that's sufficient for merging this patch. Thanks, Ray ________________________________ From: Wu, Jiaxin <jiaxin.wu@intel.com> Sent: Thursday, April 18, 2024 16:03 To: devel@edk2.groups.io <devel@edk2.groups.io>; Wu, Jiaxin <jiaxin.wu@intel.com> Cc: Ni, Ray <ray.ni@intel.com>; Zeng, Star <star.zeng@intel.com>; Gerd Hoffmann <kraxel@redhat.com>; Kumar, Rahul R <rahul.r.kumar@intel.com>; Dong, Guo <guo.dong@intel.com>; Rhodes, Sean <sean@starlabs.systems>; Lu, James <james.lu@intel.com>; Guo, Gua <gua.guo@intel.com>; Ard Biesheuvel <ardb+tianocore@kernel.org>; Yao, Jiewen <jiewen.yao@intel.com>; Abdul Lateef Attar <AbdulLateef.Attar@amd.com>; Abner Chang <abner.chang@amd.com>; Tom Lendacky <thomas.lendacky@amd.com> Subject: RE: [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib Hi Tom & Abner, Could you help check & review AMD related patch? > UefiCpuPkg/SmmRelocationLib: Add library instance for AMD Thanks, Jiaxin > -----Original Message----- > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Wu, > Jiaxin > Sent: Thursday, April 18, 2024 2:56 PM > To: devel@edk2.groups.io > Cc: Ni, Ray <ray.ni@intel.com>; Zeng, Star <star.zeng@intel.com>; Gerd > Hoffmann <kraxel@redhat.com>; Kumar, Rahul R <rahul.r.kumar@intel.com>; > Dong, Guo <guo.dong@intel.com>; Rhodes, Sean <sean@starlabs.systems>; > Lu, James <james.lu@intel.com>; Guo, Gua <gua.guo@intel.com>; Ard > Biesheuvel <ardb+tianocore@kernel.org>; Yao, Jiewen > <jiewen.yao@intel.com>; Abdul Lateef Attar <AbdulLateef.Attar@amd.com>; > Abner Chang <abner.chang@amd.com>; Tom Lendacky > <thomas.lendacky@amd.com> > Subject: [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib > > PR: https://github.com/tianocore/edk2/pull/5546 > > Intel plans to separate the smbase relocation logic from > PiSmmCpuDxeSmm driver, and the related behavior will be > moved to the new interface defined by the SmmRelocationLib > class. > > The SmmRelocationLib class provides the SmmRelocationInit() > interface for platform to do the smbase relocation, which > shall provide below 2 functionalities: > 1. Relocate smbases for each processor. > 2. Create the gSmmBaseHobGuid HOB. > > With SmmRelocationLib, PiSmmCpuDxeSmm driver (which runs at > a later phase) can be simplfied as below for SMM init: > 1. Consume the gSmmBaseHobGuid HOB for the relocated smbases > for each Processor. > 2. Execute the early SMM Init. > > Cc: Ray Ni <ray.ni@intel.com> > Cc: Zeng Star <star.zeng@intel.com> > Cc: Gerd Hoffmann <kraxel@redhat.com> > Cc: Rahul Kumar <rahul1.kumar@intel.com> > Cc: Guo Dong <guo.dong@intel.com> > Cc: Sean Rhodes <sean@starlabs.systems> > Cc: James Lu <james.lu@intel.com> > Cc: Gua Guo <gua.guo@intel.com> > Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> > Cc: Jiewen Yao <jiewen.yao@intel.com> > Cc: Abdul Lateef Attar <AbdulLateef.Attar@amd.com> > Cc: Abner Chang <abner.chang@amd.com> > Cc: Tom Lendacky <thomas.lendacky@amd.com> > Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> > > Jiaxin Wu (13): > UefiCpuPkg: Add SmmRelocationLib class > UefiCpuPkg/SmmRelocationLib: Add SmmRelocationLib library instance > UefiCpuPkg/SmmRelocationLib: Rename global variables > UefiCpuPkg/SmmRelocationLib: Avoid unnecessary memory allocation > UefiCpuPkg/SmmRelocationLib: Remove unnecessary global variable > UefiCpuPkg/SmmRelocationLib: Add library instance for AMD > OvmfPkg/SmmRelocationLib: Add library instance for OVMF > OvmfPkg/PlatformInitLib: Create gEfiSmmSmramMemoryGuid > OvmfPkg: Refine SmmAccess implementation > OvmfPkg/SmmCpuFeaturesLib: Check Smbase Relocation is done or not > OvmfPkg/PlatformPei: Relocate SmBases in PEI phase > UefiPayloadPkg/UefiPayloadPkg.dsc: Include SmmRelocationLib > UefiCpuPkg/PiSmmCpuDxeSmm: Remove SmBases relocation logic > > OvmfPkg/AmdSev/AmdSevX64.dsc | 1 + > OvmfPkg/CloudHv/CloudHvX64.dsc | 1 + > OvmfPkg/Library/PlatformInitLib/MemDetect.c | 104 ++-- > .../Library/PlatformInitLib/PlatformInitLib.inf | 6 +- > .../Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c | 33 +- > .../Library/SmmRelocationLib}/Ia32/Semaphore.c | 13 +- > .../Library/SmmRelocationLib}/Ia32/SmmInit.nasm | 83 +++- > .../SmmRelocationLib/InternalSmmRelocationLib.h | 127 +++++ > .../Library/SmmRelocationLib/SmmRelocationLib.c | 549 > +++++++++++++++++++++ > .../Library/SmmRelocationLib/SmmRelocationLib.inf | 60 +++ > .../SmmRelocationLib/SmramSaveStateConfig.c | 100 ++++ > .../Library/SmmRelocationLib}/X64/Semaphore.c | 13 +- > .../Library/SmmRelocationLib}/X64/SmmInit.nasm | 85 +++- > OvmfPkg/Microvm/MicrovmX64.dsc | 1 + > OvmfPkg/OvmfPkgIa32.dsc | 1 + > OvmfPkg/OvmfPkgIa32X64.dsc | 1 + > OvmfPkg/OvmfPkgX64.dsc | 1 + > OvmfPkg/PlatformPei/Platform.c | 3 + > OvmfPkg/PlatformPei/Platform.h | 5 + > OvmfPkg/PlatformPei/PlatformPei.inf | 5 +- > OvmfPkg/PlatformPei/SmmRelocation.c | 80 +++ > OvmfPkg/SmmAccess/SmmAccess2Dxe.c | 4 +- > OvmfPkg/SmmAccess/SmmAccess2Dxe.inf | 5 + > OvmfPkg/SmmAccess/SmmAccessPei.c | 88 +--- > OvmfPkg/SmmAccess/SmmAccessPei.inf | 7 +- > OvmfPkg/SmmAccess/SmramInternal.c | 73 +-- > OvmfPkg/SmmAccess/SmramInternal.h | 18 +- > UefiCpuPkg/Include/Library/SmmRelocationLib.h | 42 ++ > .../SmmRelocationLib/AmdSmmRelocationLib.inf | 60 +++ > .../SmmRelocationLib/AmdSmramSaveStateConfig.c | 125 +++++ > .../SmmRelocationLib}/Ia32/Semaphore.c | 13 +- > .../SmmRelocationLib}/Ia32/SmmInit.nasm | 83 +++- > .../SmmRelocationLib/InternalSmmRelocationLib.h | 127 +++++ > .../Library/SmmRelocationLib/SmmRelocationLib.c | 549 > +++++++++++++++++++++ > .../Library/SmmRelocationLib/SmmRelocationLib.inf | 61 +++ > .../SmmRelocationLib/SmramSaveStateConfig.c | 136 +++++ > .../SmmRelocationLib}/X64/Semaphore.c | 13 +- > .../SmmRelocationLib}/X64/SmmInit.nasm | 85 +++- > UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 21 +- > UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c | 10 +- > UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c | 331 ++----------- > UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 103 +--- > UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf | 4 - > UefiCpuPkg/PiSmmCpuDxeSmm/SmmMpPerf.h | 2 +- > UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c | 69 --- > UefiCpuPkg/UefiCpuPkg.dec | 3 + > UefiCpuPkg/UefiCpuPkg.dsc | 2 + > UefiPayloadPkg/UefiPayloadPkg.dsc | 2 + > 48 files changed, 2514 insertions(+), 794 deletions(-) > copy {UefiCpuPkg/PiSmmCpuDxeSmm => > OvmfPkg/Library/SmmRelocationLib}/Ia32/Semaphore.c (71%) > copy {UefiCpuPkg/PiSmmCpuDxeSmm => > OvmfPkg/Library/SmmRelocationLib}/Ia32/SmmInit.nasm (47%) > create mode 100644 > OvmfPkg/Library/SmmRelocationLib/InternalSmmRelocationLib.h > create mode 100644 > OvmfPkg/Library/SmmRelocationLib/SmmRelocationLib.c > create mode 100644 > OvmfPkg/Library/SmmRelocationLib/SmmRelocationLib.inf > create mode 100644 > OvmfPkg/Library/SmmRelocationLib/SmramSaveStateConfig.c > copy {UefiCpuPkg/PiSmmCpuDxeSmm => > OvmfPkg/Library/SmmRelocationLib}/X64/Semaphore.c (78%) > copy {UefiCpuPkg/PiSmmCpuDxeSmm => > OvmfPkg/Library/SmmRelocationLib}/X64/SmmInit.nasm (59%) > create mode 100644 OvmfPkg/PlatformPei/SmmRelocation.c > create mode 100644 UefiCpuPkg/Include/Library/SmmRelocationLib.h > create mode 100644 > UefiCpuPkg/Library/SmmRelocationLib/AmdSmmRelocationLib.inf > create mode 100644 > UefiCpuPkg/Library/SmmRelocationLib/AmdSmramSaveStateConfig.c > rename UefiCpuPkg/{PiSmmCpuDxeSmm => > Library/SmmRelocationLib}/Ia32/Semaphore.c (71%) > rename UefiCpuPkg/{PiSmmCpuDxeSmm => > Library/SmmRelocationLib}/Ia32/SmmInit.nasm (47%) > create mode 100644 > UefiCpuPkg/Library/SmmRelocationLib/InternalSmmRelocationLib.h > create mode 100644 > UefiCpuPkg/Library/SmmRelocationLib/SmmRelocationLib.c > create mode 100644 > UefiCpuPkg/Library/SmmRelocationLib/SmmRelocationLib.inf > create mode 100644 > UefiCpuPkg/Library/SmmRelocationLib/SmramSaveStateConfig.c > rename UefiCpuPkg/{PiSmmCpuDxeSmm => > Library/SmmRelocationLib}/X64/Semaphore.c (78%) > rename UefiCpuPkg/{PiSmmCpuDxeSmm => > Library/SmmRelocationLib}/X64/SmmInit.nasm (59%) > > -- > 2.16.2.windows.1 > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#118004): https://edk2.groups.io/g/devel/message/118004 Mute This Topic: https://groups.io/mt/105593568/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- [-- Attachment #2: Type: text/html, Size: 18302 bytes --] ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib 2024-04-19 3:47 ` Chang, Abner via groups.io @ 2024-04-19 3:55 ` Wu, Jiaxin 0 siblings, 0 replies; 17+ messages in thread From: Wu, Jiaxin @ 2024-04-19 3:55 UTC (permalink / raw) To: Chang, Abner, Ni, Ray, devel@edk2.groups.io Cc: Zeng, Star, Gerd Hoffmann, Kumar, Rahul R, Dong, Guo, Rhodes, Sean, Lu, James, Guo, Gua, Ard Biesheuvel, Yao, Jiewen, Attar, AbdulLateef (Abdul Lateef), Lendacky, Thomas [-- Attachment #1: Type: text/plain, Size: 12809 bytes --] Oh, sorry, I missed the that email. If so, that's great! Thanks Ray & Abner & Abdul. From: Chang, Abner <Abner.Chang@amd.com> Sent: Friday, April 19, 2024 11:47 AM To: Ni, Ray <ray.ni@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>; devel@edk2.groups.io Cc: Zeng, Star <star.zeng@intel.com>; Gerd Hoffmann <kraxel@redhat.com>; Kumar, Rahul R <rahul.r.kumar@intel.com>; Dong, Guo <guo.dong@intel.com>; Rhodes, Sean <sean@starlabs.systems>; Lu, James <james.lu@intel.com>; Guo, Gua <gua.guo@intel.com>; Ard Biesheuvel <ardb+tianocore@kernel.org>; Yao, Jiewen <jiewen.yao@intel.com>; Attar, AbdulLateef (Abdul Lateef) <AbdulLateef.Attar@amd.com>; Lendacky, Thomas <Thomas.Lendacky@amd.com> Subject: Re: [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib [AMD Official Use Only - General] Right, Abdul's RB is sufficient! Thanks Abner ________________________________ From: Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>> Sent: Friday, April 19, 2024 11:35:17 AM To: Wu, Jiaxin <jiaxin.wu@intel.com<mailto:jiaxin.wu@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>> Cc: Zeng, Star <star.zeng@intel.com<mailto:star.zeng@intel.com>>; Gerd Hoffmann <kraxel@redhat.com<mailto:kraxel@redhat.com>>; Kumar, Rahul R <rahul.r.kumar@intel.com<mailto:rahul.r.kumar@intel.com>>; Dong, Guo <guo.dong@intel.com<mailto:guo.dong@intel.com>>; Rhodes, Sean <sean@starlabs.systems<mailto:sean@starlabs.systems>>; Lu, James <james.lu@intel.com<mailto:james.lu@intel.com>>; Guo, Gua <gua.guo@intel.com<mailto:gua.guo@intel.com>>; Ard Biesheuvel <ardb+tianocore@kernel.org<mailto:ardb+tianocore@kernel.org>>; Yao, Jiewen <jiewen.yao@intel.com<mailto:jiewen.yao@intel.com>>; Attar, AbdulLateef (Abdul Lateef) <AbdulLateef.Attar@amd.com<mailto:AbdulLateef.Attar@amd.com>>; Chang, Abner <Abner.Chang@amd.com<mailto:Abner.Chang@amd.com>>; Lendacky, Thomas <Thomas.Lendacky@amd.com<mailto:Thomas.Lendacky@amd.com>> Subject: Re: [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding. Jiaxin, I see Abdul from AMD has given R-B. I assume that's sufficient for merging this patch. Thanks, Ray ________________________________ From: Wu, Jiaxin <jiaxin.wu@intel.com<mailto:jiaxin.wu@intel.com>> Sent: Thursday, April 18, 2024 16:03 To: devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>>; Wu, Jiaxin <jiaxin.wu@intel.com<mailto:jiaxin.wu@intel.com>> Cc: Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>; Zeng, Star <star.zeng@intel.com<mailto:star.zeng@intel.com>>; Gerd Hoffmann <kraxel@redhat.com<mailto:kraxel@redhat.com>>; Kumar, Rahul R <rahul.r.kumar@intel.com<mailto:rahul.r.kumar@intel.com>>; Dong, Guo <guo.dong@intel.com<mailto:guo.dong@intel.com>>; Rhodes, Sean <sean@starlabs.systems<mailto:sean@starlabs.systems>>; Lu, James <james.lu@intel.com<mailto:james.lu@intel.com>>; Guo, Gua <gua.guo@intel.com<mailto:gua.guo@intel.com>>; Ard Biesheuvel <ardb+tianocore@kernel.org<mailto:ardb+tianocore@kernel.org>>; Yao, Jiewen <jiewen.yao@intel.com<mailto:jiewen.yao@intel.com>>; Abdul Lateef Attar <AbdulLateef.Attar@amd.com<mailto:AbdulLateef.Attar@amd.com>>; Abner Chang <abner.chang@amd.com<mailto:abner.chang@amd.com>>; Tom Lendacky <thomas.lendacky@amd.com<mailto:thomas.lendacky@amd.com>> Subject: RE: [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib Hi Tom & Abner, Could you help check & review AMD related patch? > UefiCpuPkg/SmmRelocationLib: Add library instance for AMD Thanks, Jiaxin > -----Original Message----- > From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>> On Behalf Of Wu, > Jiaxin > Sent: Thursday, April 18, 2024 2:56 PM > To: devel@edk2.groups.io<mailto:devel@edk2.groups.io> > Cc: Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>; Zeng, Star <star.zeng@intel.com<mailto:star.zeng@intel.com>>; Gerd > Hoffmann <kraxel@redhat.com<mailto:kraxel@redhat.com>>; Kumar, Rahul R <rahul.r.kumar@intel.com<mailto:rahul.r.kumar@intel.com>>; > Dong, Guo <guo.dong@intel.com<mailto:guo.dong@intel.com>>; Rhodes, Sean <sean@starlabs.systems<mailto:sean@starlabs.systems>>; > Lu, James <james.lu@intel.com<mailto:james.lu@intel.com>>; Guo, Gua <gua.guo@intel.com<mailto:gua.guo@intel.com>>; Ard > Biesheuvel <ardb+tianocore@kernel.org<mailto:ardb+tianocore@kernel.org>>; Yao, Jiewen > <jiewen.yao@intel.com<mailto:jiewen.yao@intel.com>>; Abdul Lateef Attar <AbdulLateef.Attar@amd.com<mailto:AbdulLateef.Attar@amd.com>>; > Abner Chang <abner.chang@amd.com<mailto:abner.chang@amd.com>>; Tom Lendacky > <thomas.lendacky@amd.com<mailto:thomas.lendacky@amd.com>> > Subject: [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib > > PR: https://github.com/tianocore/edk2/pull/5546 > > Intel plans to separate the smbase relocation logic from > PiSmmCpuDxeSmm driver, and the related behavior will be > moved to the new interface defined by the SmmRelocationLib > class. > > The SmmRelocationLib class provides the SmmRelocationInit() > interface for platform to do the smbase relocation, which > shall provide below 2 functionalities: > 1. Relocate smbases for each processor. > 2. Create the gSmmBaseHobGuid HOB. > > With SmmRelocationLib, PiSmmCpuDxeSmm driver (which runs at > a later phase) can be simplfied as below for SMM init: > 1. Consume the gSmmBaseHobGuid HOB for the relocated smbases > for each Processor. > 2. Execute the early SMM Init. > > Cc: Ray Ni <ray.ni@intel.com<mailto:ray.ni@intel.com>> > Cc: Zeng Star <star.zeng@intel.com<mailto:star.zeng@intel.com>> > Cc: Gerd Hoffmann <kraxel@redhat.com<mailto:kraxel@redhat.com>> > Cc: Rahul Kumar <rahul1.kumar@intel.com<mailto:rahul1.kumar@intel.com>> > Cc: Guo Dong <guo.dong@intel.com<mailto:guo.dong@intel.com>> > Cc: Sean Rhodes <sean@starlabs.systems<mailto:sean@starlabs.systems>> > Cc: James Lu <james.lu@intel.com<mailto:james.lu@intel.com>> > Cc: Gua Guo <gua.guo@intel.com<mailto:gua.guo@intel.com>> > Cc: Ard Biesheuvel <ardb+tianocore@kernel.org<mailto:ardb+tianocore@kernel.org>> > Cc: Jiewen Yao <jiewen.yao@intel.com<mailto:jiewen.yao@intel.com>> > Cc: Abdul Lateef Attar <AbdulLateef.Attar@amd.com<mailto:AbdulLateef.Attar@amd.com>> > Cc: Abner Chang <abner.chang@amd.com<mailto:abner.chang@amd.com>> > Cc: Tom Lendacky <thomas.lendacky@amd.com<mailto:thomas.lendacky@amd.com>> > Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com<mailto:jiaxin.wu@intel.com>> > > Jiaxin Wu (13): > UefiCpuPkg: Add SmmRelocationLib class > UefiCpuPkg/SmmRelocationLib: Add SmmRelocationLib library instance > UefiCpuPkg/SmmRelocationLib: Rename global variables > UefiCpuPkg/SmmRelocationLib: Avoid unnecessary memory allocation > UefiCpuPkg/SmmRelocationLib: Remove unnecessary global variable > UefiCpuPkg/SmmRelocationLib: Add library instance for AMD > OvmfPkg/SmmRelocationLib: Add library instance for OVMF > OvmfPkg/PlatformInitLib: Create gEfiSmmSmramMemoryGuid > OvmfPkg: Refine SmmAccess implementation > OvmfPkg/SmmCpuFeaturesLib: Check Smbase Relocation is done or not > OvmfPkg/PlatformPei: Relocate SmBases in PEI phase > UefiPayloadPkg/UefiPayloadPkg.dsc: Include SmmRelocationLib > UefiCpuPkg/PiSmmCpuDxeSmm: Remove SmBases relocation logic > > OvmfPkg/AmdSev/AmdSevX64.dsc | 1 + > OvmfPkg/CloudHv/CloudHvX64.dsc | 1 + > OvmfPkg/Library/PlatformInitLib/MemDetect.c | 104 ++-- > .../Library/PlatformInitLib/PlatformInitLib.inf | 6 +- > .../Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c | 33 +- > .../Library/SmmRelocationLib}/Ia32/Semaphore.c | 13 +- > .../Library/SmmRelocationLib}/Ia32/SmmInit.nasm | 83 +++- > .../SmmRelocationLib/InternalSmmRelocationLib.h | 127 +++++ > .../Library/SmmRelocationLib/SmmRelocationLib.c | 549 > +++++++++++++++++++++ > .../Library/SmmRelocationLib/SmmRelocationLib.inf | 60 +++ > .../SmmRelocationLib/SmramSaveStateConfig.c | 100 ++++ > .../Library/SmmRelocationLib}/X64/Semaphore.c | 13 +- > .../Library/SmmRelocationLib}/X64/SmmInit.nasm | 85 +++- > OvmfPkg/Microvm/MicrovmX64.dsc | 1 + > OvmfPkg/OvmfPkgIa32.dsc | 1 + > OvmfPkg/OvmfPkgIa32X64.dsc | 1 + > OvmfPkg/OvmfPkgX64.dsc | 1 + > OvmfPkg/PlatformPei/Platform.c | 3 + > OvmfPkg/PlatformPei/Platform.h | 5 + > OvmfPkg/PlatformPei/PlatformPei.inf | 5 +- > OvmfPkg/PlatformPei/SmmRelocation.c | 80 +++ > OvmfPkg/SmmAccess/SmmAccess2Dxe.c | 4 +- > OvmfPkg/SmmAccess/SmmAccess2Dxe.inf | 5 + > OvmfPkg/SmmAccess/SmmAccessPei.c | 88 +--- > OvmfPkg/SmmAccess/SmmAccessPei.inf | 7 +- > OvmfPkg/SmmAccess/SmramInternal.c | 73 +-- > OvmfPkg/SmmAccess/SmramInternal.h | 18 +- > UefiCpuPkg/Include/Library/SmmRelocationLib.h | 42 ++ > .../SmmRelocationLib/AmdSmmRelocationLib.inf | 60 +++ > .../SmmRelocationLib/AmdSmramSaveStateConfig.c | 125 +++++ > .../SmmRelocationLib}/Ia32/Semaphore.c | 13 +- > .../SmmRelocationLib}/Ia32/SmmInit.nasm | 83 +++- > .../SmmRelocationLib/InternalSmmRelocationLib.h | 127 +++++ > .../Library/SmmRelocationLib/SmmRelocationLib.c | 549 > +++++++++++++++++++++ > .../Library/SmmRelocationLib/SmmRelocationLib.inf | 61 +++ > .../SmmRelocationLib/SmramSaveStateConfig.c | 136 +++++ > .../SmmRelocationLib}/X64/Semaphore.c | 13 +- > .../SmmRelocationLib}/X64/SmmInit.nasm | 85 +++- > UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 21 +- > UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c | 10 +- > UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c | 331 ++----------- > UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 103 +--- > UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf | 4 - > UefiCpuPkg/PiSmmCpuDxeSmm/SmmMpPerf.h | 2 +- > UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c | 69 --- > UefiCpuPkg/UefiCpuPkg.dec | 3 + > UefiCpuPkg/UefiCpuPkg.dsc | 2 + > UefiPayloadPkg/UefiPayloadPkg.dsc | 2 + > 48 files changed, 2514 insertions(+), 794 deletions(-) > copy {UefiCpuPkg/PiSmmCpuDxeSmm => > OvmfPkg/Library/SmmRelocationLib}/Ia32/Semaphore.c (71%) > copy {UefiCpuPkg/PiSmmCpuDxeSmm => > OvmfPkg/Library/SmmRelocationLib}/Ia32/SmmInit.nasm (47%) > create mode 100644 > OvmfPkg/Library/SmmRelocationLib/InternalSmmRelocationLib.h > create mode 100644 > OvmfPkg/Library/SmmRelocationLib/SmmRelocationLib.c > create mode 100644 > OvmfPkg/Library/SmmRelocationLib/SmmRelocationLib.inf > create mode 100644 > OvmfPkg/Library/SmmRelocationLib/SmramSaveStateConfig.c > copy {UefiCpuPkg/PiSmmCpuDxeSmm => > OvmfPkg/Library/SmmRelocationLib}/X64/Semaphore.c (78%) > copy {UefiCpuPkg/PiSmmCpuDxeSmm => > OvmfPkg/Library/SmmRelocationLib}/X64/SmmInit.nasm (59%) > create mode 100644 OvmfPkg/PlatformPei/SmmRelocation.c > create mode 100644 UefiCpuPkg/Include/Library/SmmRelocationLib.h > create mode 100644 > UefiCpuPkg/Library/SmmRelocationLib/AmdSmmRelocationLib.inf > create mode 100644 > UefiCpuPkg/Library/SmmRelocationLib/AmdSmramSaveStateConfig.c > rename UefiCpuPkg/{PiSmmCpuDxeSmm => > Library/SmmRelocationLib}/Ia32/Semaphore.c (71%) > rename UefiCpuPkg/{PiSmmCpuDxeSmm => > Library/SmmRelocationLib}/Ia32/SmmInit.nasm (47%) > create mode 100644 > UefiCpuPkg/Library/SmmRelocationLib/InternalSmmRelocationLib.h > create mode 100644 > UefiCpuPkg/Library/SmmRelocationLib/SmmRelocationLib.c > create mode 100644 > UefiCpuPkg/Library/SmmRelocationLib/SmmRelocationLib.inf > create mode 100644 > UefiCpuPkg/Library/SmmRelocationLib/SmramSaveStateConfig.c > rename UefiCpuPkg/{PiSmmCpuDxeSmm => > Library/SmmRelocationLib}/X64/Semaphore.c (78%) > rename UefiCpuPkg/{PiSmmCpuDxeSmm => > Library/SmmRelocationLib}/X64/SmmInit.nasm (59%) > > -- > 2.16.2.windows.1 > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#118005): https://edk2.groups.io/g/devel/message/118005 Mute This Topic: https://groups.io/mt/105593568/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- [-- Attachment #2: Type: text/html, Size: 24421 bytes --] ^ permalink raw reply [flat|nested] 17+ messages in thread
* [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib @ 2024-04-18 6:55 Wu, Jiaxin 0 siblings, 0 replies; 17+ messages in thread From: Wu, Jiaxin @ 2024-04-18 6:55 UTC (permalink / raw) To: devel Cc: Ray Ni, Zeng Star, Gerd Hoffmann, Rahul Kumar, Guo Dong, Sean Rhodes, James Lu, Gua Guo, Ard Biesheuvel, Jiewen Yao, Abdul Lateef Attar, Abner Chang, Tom Lendacky PR: https://github.com/tianocore/edk2/pull/5546 Intel plans to separate the smbase relocation logic from PiSmmCpuDxeSmm driver, and the related behavior will be moved to the new interface defined by the SmmRelocationLib class. The SmmRelocationLib class provides the SmmRelocationInit() interface for platform to do the smbase relocation, which shall provide below 2 functionalities: 1. Relocate smbases for each processor. 2. Create the gSmmBaseHobGuid HOB. With SmmRelocationLib, PiSmmCpuDxeSmm driver (which runs at a later phase) can be simplfied as below for SMM init: 1. Consume the gSmmBaseHobGuid HOB for the relocated smbases for each Processor. 2. Execute the early SMM Init. Cc: Ray Ni <ray.ni@intel.com> Cc: Zeng Star <star.zeng@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Rahul Kumar <rahul1.kumar@intel.com> Cc: Guo Dong <guo.dong@intel.com> Cc: Sean Rhodes <sean@starlabs.systems> Cc: James Lu <james.lu@intel.com> Cc: Gua Guo <gua.guo@intel.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Abdul Lateef Attar <AbdulLateef.Attar@amd.com> Cc: Abner Chang <abner.chang@amd.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Jiaxin Wu (13): UefiCpuPkg: Add SmmRelocationLib class UefiCpuPkg/SmmRelocationLib: Add SmmRelocationLib library instance UefiCpuPkg/SmmRelocationLib: Rename global variables UefiCpuPkg/SmmRelocationLib: Avoid unnecessary memory allocation UefiCpuPkg/SmmRelocationLib: Remove unnecessary global variable UefiCpuPkg/SmmRelocationLib: Add library instance for AMD OvmfPkg/SmmRelocationLib: Add library instance for OVMF OvmfPkg/PlatformInitLib: Create gEfiSmmSmramMemoryGuid OvmfPkg: Refine SmmAccess implementation OvmfPkg/SmmCpuFeaturesLib: Check Smbase Relocation is done or not OvmfPkg/PlatformPei: Relocate SmBases in PEI phase UefiPayloadPkg/UefiPayloadPkg.dsc: Include SmmRelocationLib UefiCpuPkg/PiSmmCpuDxeSmm: Remove SmBases relocation logic OvmfPkg/AmdSev/AmdSevX64.dsc | 1 + OvmfPkg/CloudHv/CloudHvX64.dsc | 1 + OvmfPkg/Library/PlatformInitLib/MemDetect.c | 104 ++-- .../Library/PlatformInitLib/PlatformInitLib.inf | 6 +- .../Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c | 33 +- .../Library/SmmRelocationLib}/Ia32/Semaphore.c | 13 +- .../Library/SmmRelocationLib}/Ia32/SmmInit.nasm | 83 +++- .../SmmRelocationLib/InternalSmmRelocationLib.h | 127 +++++ .../Library/SmmRelocationLib/SmmRelocationLib.c | 549 +++++++++++++++++++++ .../Library/SmmRelocationLib/SmmRelocationLib.inf | 60 +++ .../SmmRelocationLib/SmramSaveStateConfig.c | 100 ++++ .../Library/SmmRelocationLib}/X64/Semaphore.c | 13 +- .../Library/SmmRelocationLib}/X64/SmmInit.nasm | 85 +++- OvmfPkg/Microvm/MicrovmX64.dsc | 1 + OvmfPkg/OvmfPkgIa32.dsc | 1 + OvmfPkg/OvmfPkgIa32X64.dsc | 1 + OvmfPkg/OvmfPkgX64.dsc | 1 + OvmfPkg/PlatformPei/Platform.c | 3 + OvmfPkg/PlatformPei/Platform.h | 5 + OvmfPkg/PlatformPei/PlatformPei.inf | 5 +- OvmfPkg/PlatformPei/SmmRelocation.c | 80 +++ OvmfPkg/SmmAccess/SmmAccess2Dxe.c | 4 +- OvmfPkg/SmmAccess/SmmAccess2Dxe.inf | 5 + OvmfPkg/SmmAccess/SmmAccessPei.c | 88 +--- OvmfPkg/SmmAccess/SmmAccessPei.inf | 7 +- OvmfPkg/SmmAccess/SmramInternal.c | 73 +-- OvmfPkg/SmmAccess/SmramInternal.h | 18 +- UefiCpuPkg/Include/Library/SmmRelocationLib.h | 42 ++ .../SmmRelocationLib/AmdSmmRelocationLib.inf | 60 +++ .../SmmRelocationLib/AmdSmramSaveStateConfig.c | 125 +++++ .../SmmRelocationLib}/Ia32/Semaphore.c | 13 +- .../SmmRelocationLib}/Ia32/SmmInit.nasm | 83 +++- .../SmmRelocationLib/InternalSmmRelocationLib.h | 127 +++++ .../Library/SmmRelocationLib/SmmRelocationLib.c | 549 +++++++++++++++++++++ .../Library/SmmRelocationLib/SmmRelocationLib.inf | 61 +++ .../SmmRelocationLib/SmramSaveStateConfig.c | 136 +++++ .../SmmRelocationLib}/X64/Semaphore.c | 13 +- .../SmmRelocationLib}/X64/SmmInit.nasm | 85 +++- UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 21 +- UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c | 10 +- UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c | 331 ++----------- UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 103 +--- UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf | 4 - UefiCpuPkg/PiSmmCpuDxeSmm/SmmMpPerf.h | 2 +- UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c | 69 --- UefiCpuPkg/UefiCpuPkg.dec | 3 + UefiCpuPkg/UefiCpuPkg.dsc | 2 + UefiPayloadPkg/UefiPayloadPkg.dsc | 2 + 48 files changed, 2514 insertions(+), 794 deletions(-) copy {UefiCpuPkg/PiSmmCpuDxeSmm => OvmfPkg/Library/SmmRelocationLib}/Ia32/Semaphore.c (71%) copy {UefiCpuPkg/PiSmmCpuDxeSmm => OvmfPkg/Library/SmmRelocationLib}/Ia32/SmmInit.nasm (47%) create mode 100644 OvmfPkg/Library/SmmRelocationLib/InternalSmmRelocationLib.h create mode 100644 OvmfPkg/Library/SmmRelocationLib/SmmRelocationLib.c create mode 100644 OvmfPkg/Library/SmmRelocationLib/SmmRelocationLib.inf create mode 100644 OvmfPkg/Library/SmmRelocationLib/SmramSaveStateConfig.c copy {UefiCpuPkg/PiSmmCpuDxeSmm => OvmfPkg/Library/SmmRelocationLib}/X64/Semaphore.c (78%) copy {UefiCpuPkg/PiSmmCpuDxeSmm => OvmfPkg/Library/SmmRelocationLib}/X64/SmmInit.nasm (59%) create mode 100644 OvmfPkg/PlatformPei/SmmRelocation.c create mode 100644 UefiCpuPkg/Include/Library/SmmRelocationLib.h create mode 100644 UefiCpuPkg/Library/SmmRelocationLib/AmdSmmRelocationLib.inf create mode 100644 UefiCpuPkg/Library/SmmRelocationLib/AmdSmramSaveStateConfig.c rename UefiCpuPkg/{PiSmmCpuDxeSmm => Library/SmmRelocationLib}/Ia32/Semaphore.c (71%) rename UefiCpuPkg/{PiSmmCpuDxeSmm => Library/SmmRelocationLib}/Ia32/SmmInit.nasm (47%) create mode 100644 UefiCpuPkg/Library/SmmRelocationLib/InternalSmmRelocationLib.h create mode 100644 UefiCpuPkg/Library/SmmRelocationLib/SmmRelocationLib.c create mode 100644 UefiCpuPkg/Library/SmmRelocationLib/SmmRelocationLib.inf create mode 100644 UefiCpuPkg/Library/SmmRelocationLib/SmramSaveStateConfig.c rename UefiCpuPkg/{PiSmmCpuDxeSmm => Library/SmmRelocationLib}/X64/Semaphore.c (78%) rename UefiCpuPkg/{PiSmmCpuDxeSmm => Library/SmmRelocationLib}/X64/SmmInit.nasm (59%) -- 2.16.2.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117945): https://edk2.groups.io/g/devel/message/117945 Mute This Topic: https://groups.io/mt/105593568/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2024-04-26 13:18 UTC | newest] Thread overview: 17+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <17C74D78B0B952AD.15491@groups.io> 2024-04-18 8:02 ` [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib Wu, Jiaxin 2024-04-22 7:57 ` Gerd Hoffmann 2024-04-23 7:31 ` Wu, Jiaxin 2024-04-23 8:43 ` Gerd Hoffmann 2024-04-23 12:16 ` Wu, Jiaxin 2024-04-24 3:56 ` Wu, Jiaxin 2024-04-24 11:29 ` Gerd Hoffmann 2024-04-25 0:54 ` Wu, Jiaxin 2024-04-25 5:50 ` Ni, Ray 2024-04-25 6:58 ` Gerd Hoffmann 2024-04-26 6:07 ` Ni, Ray 2024-04-26 13:18 ` Lendacky, Thomas via groups.io 2024-04-18 8:03 ` Wu, Jiaxin 2024-04-19 3:35 ` Ni, Ray 2024-04-19 3:47 ` Chang, Abner via groups.io 2024-04-19 3:55 ` Wu, Jiaxin 2024-04-18 6:55 Wu, Jiaxin
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox