From: "Chang, Abner" <abner.chang@amd.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
"ray.ni@intel.com" <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
Date: Wed, 28 Sep 2022 04:30:49 +0000 [thread overview]
Message-ID: <CH2PR12MB395707957F140E403D604524EA549@CH2PR12MB3957.namprd12.prod.outlook.com> (raw)
In-Reply-To: <MWHPR11MB16319AA74D5CD0051CA8ED7E8C549@MWHPR11MB1631.namprd11.prod.outlook.com>
[-- Attachment #1: Type: text/plain, Size: 7628 bytes --]
[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:
1. When X86-vendor's implementation is introduced to the existing module:
1. The folder reconstruction:
A-1. If the module is obviously used by IA32/X64 only
* No need to create X86 folder
* Create X86-vendor's stuff under the root directory of module
A-2. If the existing module is expected to accommodate the different archs or the module already has multiple archs:
* Create X86 folder
* Create X86-vendor's stuff under X86 folder
[Ray] Looks good.
1. The files reconstruction:
B-1. The module INF metafile
* The existing INF metafile should be kept without relocation. Should not have the impacts to the existing DSC/FDF file.
* The new introduced INF metafile should be located under the root directory of module with the file naming format as below. This keeps the consistent module file structure.
* <OriginalFileName><arch>.inf
[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
* That is contributor's responsibility to review the source code and strip the arch-dependent code away and put it into the arch-specific file. Leave the common code in the original file if there is no arch-specific and arch-specific-feature wordings in the file name. Create a common file for the common implementation otherwise.
* The file naming for the arch-specific file
<OriginalFileName ><arch>.*
* The file naming for the common implementation
< OriginalFileNaming >Common.*
* That is contributor's responsibility to relocate the arch-specific source files to the arch-specific folder.
* That is contributor's responsibility to make sure the original INF metafile can properly pull-in the source file from arch-specific folder after the source file reconstruction.
* The common source files should be located under the root directory of module
[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.
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?
1. When a new arch's implementation is introduced to the existing module which was developed for the specific arch:
1. The folder reconstruction:
* Create arch folder for the existing arch implementation
[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.
* Create the arch folder for the new introduced arch
[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.
1. The files reconstruction:
B-1. The module INF metafile
* The existing INF file should be kept without the relocation. Should not have the impacts to the existing DSC/FDF file.
* The new introduced INF metafile should be located under the root directory of module with the file naming format as below. This keeps the consistent module file structure.
* < OriginalFileNaming><arch>.inf
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
* That is contributor's responsibility to review the source code and strip the arch-dependent code away and put it into the arch-specific file. Leave the common code in the original file if there is no arch-specific wording in the file name. Create a common file for the common implementation otherwise.
* The file naming for the arch-specific source file
< OriginalFileNaming ><arch>.*
* The file naming for the common implementation
<OriginalFileNaming>Common.*
* That is contributor's responsibility to relocate the arch-specific source files to the arch-specific folder.
* That is contributor's responsibility to make sure the original INF metafile can properly pull-in the source file from arch-specific folder after the source file reconstruction.
* The common source files should be located under the root directory of module
1. When a new arch implementation has a huge delta with the original implementation
Create a separate module instance. The naming of the module should follow below format,
* Add the arch prefix with the original module name:
< OriginalModuleNaming><arch>
[-- Attachment #2: Type: text/html, Size: 25779 bytes --]
next prev parent reply other threads:[~2022-09-28 4:31 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-23 15:38 The principles of EDK2 module reconstruction for archs Chang, Abner
2022-09-23 18:00 ` Michael D Kinney
2022-09-26 7:33 ` Chang, Abner
2022-09-26 15:44 ` [edk2-devel] " Michael D Kinney
2022-09-27 9:25 ` Chang, Abner
2022-09-28 3:56 ` Ni, Ray
2022-09-28 4:35 ` Chang, Abner
2022-09-28 3:33 ` Ni, Ray
2022-09-28 4:30 ` Chang, Abner [this message]
2022-09-28 5:42 ` [edk2-devel] " Ni, Ray
2022-09-28 5:54 ` Chang, Abner
2022-09-28 7:34 ` Sunil V L
2022-09-28 15:00 ` Chang, Abner
2022-09-29 7:10 ` Attar, AbdulLateef (Abdul Lateef)
2022-09-29 7:42 ` Ni, Ray
2022-09-30 7:10 ` Chang, Abner
2022-09-30 15:28 ` Michael D Kinney
2022-09-30 16:08 ` Leif Lindholm
2022-09-30 18:52 ` Michael D Kinney
2022-10-03 3:13 ` Chang, Abner
2022-10-03 5:17 ` Michael D Kinney
2022-10-03 5:36 ` Chang, Abner
2022-10-03 16:54 ` Michael D Kinney
2022-10-04 14:05 ` Chang, Abner
2022-10-04 14:17 ` Michael D Kinney
2022-10-05 5:38 ` Chang, Abner
2022-10-06 8:37 ` Chang, Abner
2022-10-11 1:51 ` Ni, Ray
2022-10-11 2:20 ` Chang, Abner
2022-10-11 20:16 ` Michael D Kinney
2022-10-12 0:52 ` Chang, Abner
2022-10-12 1:09 ` Michael D Kinney
2022-10-12 1:26 ` Chang, Abner
2022-09-30 9:15 ` The principles of EDK2 module reconstruction for archs (wiki page on tianocore.github.io) Chang, Abner
2022-09-29 7:47 ` [edk2-devel] The principles of EDK2 module reconstruction for archs Ni, Ray
2022-09-29 14:54 ` Chang, Abner
2022-09-29 15:22 ` Sunil V L
2022-09-30 0:20 ` Chang, Abner
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=CH2PR12MB395707957F140E403D604524EA549@CH2PR12MB3957.namprd12.prod.outlook.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