Abner,
I think we Mike’s first email regarding the package structure is a good guideline regarding how to place the modules.
What we are discussing is how to organize the module internal contents for different archs. Do you agree?
I want to clarify this so we have a clear boundary between the two topics.
However, Mike’s proposal also defines the <arch> folder inside a module directory.
Maybe we just work together to refine Mike’s proposal and document it in EDKII coding standard document.
Chao, can you check Mike’s proposal and raise if there is anything not captured?
Thanks,
Ray
From: devel@edk2.groups.io <devel@edk2.groups.io>
On Behalf Of Chang, Abner via groups.io
Sent: Wednesday, September 28, 2022 12:31 PM
To: devel@edk2.groups.io; Ni, Ray <ray.ni@intel.com>
Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Sunil V L <sunilvl@ventanamicro.com>; lichao <lichao@loongson.cn>; Kirkendall, Garrett <Garrett.Kirkendall@amd.com>; Grimes, Paul <Paul.Grimes@amd.com>; He, Jiangang <Jiangang.He@amd.com>; Attar, AbdulLateef
(Abdul Lateef) <AbdulLateef.Attar@amd.com>; Leif Lindholm <quic_llindhol@quicinc.com>; Andrew Fish <afish@apple.com>
Subject: Re: [edk2-devel] The principles of EDK2 module reconstruction for archs
[AMD Official Use Only - General]
From: devel@edk2.groups.io <devel@edk2.groups.io>
On Behalf Of Ni, Ray via groups.io
Sent: Wednesday, September 28, 2022 11:34 AM
To: devel@edk2.groups.io; Chang, Abner <Abner.Chang@amd.com>
Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Sunil V L <sunilvl@ventanamicro.com>; lichao <lichao@loongson.cn>;
Kirkendall, Garrett <Garrett.Kirkendall@amd.com>; Grimes, Paul <Paul.Grimes@amd.com>; He, Jiangang <Jiangang.He@amd.com>; Attar,
AbdulLateef (Abdul Lateef) <AbdulLateef.Attar@amd.com>; Leif Lindholm <quic_llindhol@quicinc.com>; Andrew Fish <afish@apple.com>
Subject: Re: [edk2-devel] The principles of EDK2 module reconstruction for archs
Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
|
The [Arch] refers to the Processor Architecture.
The [Module] refer to the EDK2 module.
The [X86] refers to both IA32 and X64.
The principles to create the X86 folder in the module:
A-1. If the module is obviously used by IA32/X64 only
A-2. If the existing module is expected to accommodate the different archs or the module already has multiple archs:
[Ray] Looks good.
B-1. The module INF metafile
[Ray] “CpuDxe.inf” and “CpuDxeArm.inf”? is that your intention? New developers may be confused that CpuDxe.inf supports only X86 arch.
Do you have an example that one module supporting multiple archs using different INF files? MdeModulePkg/DxeIpl is a module supporting different archs with the same INF file.
Or shall we leave it to be decided between the patch contributor and package/module maintainer?
[Chang, Abner] Here I mean the library module, for example SmmCpuFeatureLib.inf and AmdSmmCpuFeatureLib.inf. Will make the statement clear. The file naming above would be changed to
<arch><OriginalFileName>.inf as Mike suggested.
I am not sure if there is another example having arch-specific INF file. Usually the driver module has the abstract interface and the implementation in the library module. A newly introduced processor architecture driver may create
it’s own module such as ArmCpuDxe if the delta between implementations is huge. However, I would prefer to have arch-specific INF for the module if the module implementation can be leveraged. And yes, this requires the discussion between contributor and module
maintainer if the principles can not perfectly identify the case.
B-2. Source files
The new arch implementation is introduced to the module in order to leverage the source code and the module design architecture, so
<OriginalFileName ><arch>.*
< OriginalFileNaming >Common.*
[Ray] If you check the MpInitLib, most of SEV logic are moved to AmdSev.c. But MpLib.c still contains logic to call functions from AmdSev.c based on some AMD specific check. In my opinion, that’s already good enough.
[Chang, Abner] I am not quite lean to the If-AMD-else in the source file solution. I prefer to separate AMD stuff or vendor feature to a separated file. So we can have the reviewer or maintainer for *Amd* files/module/packages specifically.
This makes the review responsibility clear and efficient.
[Ray] You can take a look at the MpInitLib. There are some code paths that are AMD only. I agree to have dedicated reviewers from different vendors if the implementations are different.
However, if you check MdeModulePkg/DxeIpl, implementations for different archs are in different *folders*.
Can we leave this to the module owner to decide how to place the implementations?
[Ray] Do you move existing arch implementation to that arch folder? It will break existing platforms a lot.
[Chang, Abner] We will move the arch implementation to the arch folder without moving INF. This wont impact the platform DSC and FDF, however this has the impact to the existing overwrite.
[Ray] I might misunderstand your idea as “UefiCpuPkg/CpuDxe -> UefiCpuPkg/X86/CpuDxe”.
Now I guess you tries to say: “UefiCpuPkg/CpuDxe -> UefiCpuPkg/CpuDxe/X86”. That looks good to me.
We need a more clear statement here😊
[Ray] I agree. But if we don’t create arch folder for existing arch implementation, the pkg layout will be a mess.
[Chang, Abner] right, so the first bullet is important.
[Ray] Hard for me to understand all the principles here. Maybe we review existing code including to-be-upstreamed code and decide how to go.
B-1. The module INF metafile
B-2. Source files
The new arch implementation is introduced to this module in order to leverage the source code and the module design architecture, so
< OriginalFileNaming ><arch>.*
<OriginalFileNaming>Common.*
Create a separate module instance. The naming of the module should follow below format,
< OriginalModuleNaming><arch>