Re: [edk2-devel] [PATCH v8 00/37] Enable LoongArch virtual machine in edk2

2024-01-25 Thread Chao Li

Hi Ray and Laszlo,

Sorry, I was busy the past few days, so V8 was late.

Ray, I *removed* your review message in patches 11, 12, 24, 15 and 16, 
because our adjusted the folders layout, so please review again, thanks.


Laszlo, I did what you pointed out, please refer the cover letter, 
please review, thanks.



Thanks,
Chao
On 2024/1/26 14:27, Chao Li wrote:

This patch set will enable LoongArch virtual machine in edk2, the new
LoongArch virtual machine is located in OvmfPkg/LoongArchVirt/, it is a
generic platform that dose not require any actual hardware.

Patch1-Patch14: Submit the common library and driver for LoongArch
virtual machine and real hardware. Such as base help functions,
exception handel, MMU library, multiprocessor library etc.

Patch15-Patch16: Add PrePiCpuIoSize for LoongArch64. and move ArmVirtPkg
two PCDs into OvmfPkg for easier use by other architectures.

Patch17-Patch29: LoongArch virtual machine private code, include SEC and
PEI phase code, some library and drivers.

Patch30: Add LoongArchVirt's self introduction-file.

Modfied modues: MdePkg, UefiCpuPkg, EmbeddedPkg, ArmVirtPkg, OvmfPkg.

BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=4584

PR:https://github.com/tianocore/edk2/pull/5208

**Changes from V1 to V2:**
1. Add Ray's Ack signature to patch 13.
2. Add LoongArchVirt's self introduction-file. And made a standalone
patch for this change.

**Changes from V2 to V3:**
Compared with V2, there are 9 more patches, removed 2 libraries and 1
driver from OvmfPkg/LoongArchVrt.

New patches:
MdePkg: Add a new library named PeiServicesTablePointerLibReg
MdePkg: Add method of LoongArch64 to PeiServicesTablePointerLibReg
MdePkg: Add a PCD feature flag named PcdPciIoTranslationIsEnabled
UefiCpuPkg: Add MMIO method in CpuIo2Dxe
ArmVirtPkg: Enable UefiCpuPkg version CpuIo2Dxe
ArmPkg: Remove ArmPciCpuIo2Dxe from ArmPkg
OvmfPkg/RiscVVirt: Enable UefiCpuPkg version CpuIo2Dxe
OvmfPkg/RiscVVirt: Remove PciCpuIo2Dxe from RiscVVirt
ArmVirtPkg: Move the FdtSerialPortAddressLib to OvmfPkg
ArmVirtPkg: Move the PcdTerminalTypeGuidBuffer into OvmfPkg
ArmVirtPkg: Move PlatformBootManagerLib to OvmfPkg

For the review opinions:
1. Add MMIO method to CpuIo2Dxe driver to accommodate more ARCH that
require MMIO method, enable it on ARM, RISCV64 and LOONGARCH64.
Questioner: Gerd, Sunil.

2. Move the FdtSerialProtAddressLib to OvmfPkg and enabled it on ARM and
LOONGARCH64. Questioner: Gerd, Laszlo.

3. Add a new library in MdePkg named PeiServiceTablePointerLibReg for
the Register Mechanism and enabled it on LOONGARCH64. Questioner: Laszlo.

4. Moved the ARM version of PlatformBootManagerLib to OvmfPkg/Library, and
enabled it on ARM and LOONGARCH64. Questioner: Laszlo, Gerd.

5. Adjust the order of some inf file in ArmVirtPkg. Questioner: Sami.

6. Move the CpuMmuLib.h some architecture-specific PTE #defines into
Csr.h. Questioner: Andrei.

**Changes from V3 to V4:**
Compared with V3, 1 patch moving ArmPciCpuIo2Dxe has been removed.
Adjusted the code of the LoongArch64 CPU timer library. Rename
PeiServiceTablePointerLibReg to PeiServiceTablePointerLibKs0. Fixed some
typos. Remove some APIs of CpuMmuLib.

For the review opinions:
1. Removed the patch that removed ArmPciCpuIo2Dxe, there are 15 platforms
in edk2-platforms were affected, so wait for this patch series to be
merged, then submit a patch to remove it. Questioner: Leif.

2. Renamed the PeiServiceTablePointLibReg to PeiServiceTablePointLibKs0.
Currently, this library is specific to LoongArch architecture.
Questioner: Laszlo, Liming.

3. Adjust some logic of LoongArch64 CPU timer library. Using the safe
INT library and adjust the bit width of stable counter. Questioner: Laszlo.

4. Removed some APIs from CpuMmuLib. Change some APIs to private.
Questioner: Ray.

**Changes from V4 to V5:**
Compared with V4, 1 patch adding PcdPciIoTranslationIsEnabled in MdePkg
has been removed.
Copy ArmPciCpuIo2Dxe to UefiCpuPkg and renamed it to CpuMmio2Dxe.
Restore the definitions in MdePkg/Include/Protocol/DebugSupport.h, and
just add some comments.

For the review opinions:
1. Copy ArmPciCpuIo2Dxe to UefiCpuPkg so that more other ARCHs can use
it easily. Questioner: Ray, Ard.

2. Restore the changes of MdePkg/Include/Protocol/DebugSupport.h.
Questioner: Liming.

3. Ia32 X64 and LoongArch64 use a same API definition,
InitializeFloatingPointUnits in CpuLib.h. Questioner: Liming.

4. Adjust API definition in CpuMmuLib.h. Questioner: Ray.

**Changes from V5 to V6:**
1. Added Sunil "Reviewed-by" message to patches 20 and 21.
2. Added Bibo "Reviced-by" message to patches 27, 29, 32 and 34.
3. Added the IPI handler in SEC and PEI stage. Modified patches 11 and
15.
4. Adjust some code styles to suit CI ECC.
5. Adjust the way of AP wakeup from IPI.
6. Adjust the order between setting exceptions and copying exception
handlers.

**Changes from V6 to V7:**
Compared with V6, 1 patch has been added.

Added Bibo "Reviewed-by" message to new patches 26, 27, 29, 31, 32, 36,
37.


[edk2-devel] [PATCH v8 00/37] Enable LoongArch virtual machine in edk2

2024-01-25 Thread Chao Li
This patch set will enable LoongArch virtual machine in edk2, the new
LoongArch virtual machine is located in OvmfPkg/LoongArchVirt/, it is a
generic platform that dose not require any actual hardware.

Patch1-Patch14: Submit the common library and driver for LoongArch
virtual machine and real hardware. Such as base help functions,
exception handel, MMU library, multiprocessor library etc.

Patch15-Patch16: Add PrePiCpuIoSize for LoongArch64. and move ArmVirtPkg
two PCDs into OvmfPkg for easier use by other architectures.

Patch17-Patch29: LoongArch virtual machine private code, include SEC and
PEI phase code, some library and drivers.

Patch30: Add LoongArchVirt's self introduction-file.

Modfied modues: MdePkg, UefiCpuPkg, EmbeddedPkg, ArmVirtPkg, OvmfPkg.

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4584

PR: https://github.com/tianocore/edk2/pull/5208

**Changes from V1 to V2:**
1. Add Ray's Ack signature to patch 13.
2. Add LoongArchVirt's self introduction-file. And made a standalone
patch for this change.

**Changes from V2 to V3:**
Compared with V2, there are 9 more patches, removed 2 libraries and 1
driver from OvmfPkg/LoongArchVrt.

New patches:
MdePkg: Add a new library named PeiServicesTablePointerLibReg
MdePkg: Add method of LoongArch64 to PeiServicesTablePointerLibReg
MdePkg: Add a PCD feature flag named PcdPciIoTranslationIsEnabled
UefiCpuPkg: Add MMIO method in CpuIo2Dxe
ArmVirtPkg: Enable UefiCpuPkg version CpuIo2Dxe
ArmPkg: Remove ArmPciCpuIo2Dxe from ArmPkg
OvmfPkg/RiscVVirt: Enable UefiCpuPkg version CpuIo2Dxe
OvmfPkg/RiscVVirt: Remove PciCpuIo2Dxe from RiscVVirt
ArmVirtPkg: Move the FdtSerialPortAddressLib to OvmfPkg
ArmVirtPkg: Move the PcdTerminalTypeGuidBuffer into OvmfPkg
ArmVirtPkg: Move PlatformBootManagerLib to OvmfPkg

For the review opinions:
1. Add MMIO method to CpuIo2Dxe driver to accommodate more ARCH that
require MMIO method, enable it on ARM, RISCV64 and LOONGARCH64.
Questioner: Gerd, Sunil.

2. Move the FdtSerialProtAddressLib to OvmfPkg and enabled it on ARM and
LOONGARCH64. Questioner: Gerd, Laszlo.

3. Add a new library in MdePkg named PeiServiceTablePointerLibReg for
the Register Mechanism and enabled it on LOONGARCH64. Questioner: Laszlo.

4. Moved the ARM version of PlatformBootManagerLib to OvmfPkg/Library, and
enabled it on ARM and LOONGARCH64. Questioner: Laszlo, Gerd.

5. Adjust the order of some inf file in ArmVirtPkg. Questioner: Sami.

6. Move the CpuMmuLib.h some architecture-specific PTE #defines into
Csr.h. Questioner: Andrei.

**Changes from V3 to V4:**
Compared with V3, 1 patch moving ArmPciCpuIo2Dxe has been removed.
Adjusted the code of the LoongArch64 CPU timer library. Rename
PeiServiceTablePointerLibReg to PeiServiceTablePointerLibKs0. Fixed some
typos. Remove some APIs of CpuMmuLib.

For the review opinions:
1. Removed the patch that removed ArmPciCpuIo2Dxe, there are 15 platforms
in edk2-platforms were affected, so wait for this patch series to be
merged, then submit a patch to remove it. Questioner: Leif.

2. Renamed the PeiServiceTablePointLibReg to PeiServiceTablePointLibKs0.
Currently, this library is specific to LoongArch architecture.
Questioner: Laszlo, Liming.

3. Adjust some logic of LoongArch64 CPU timer library. Using the safe
INT library and adjust the bit width of stable counter. Questioner: Laszlo.

4. Removed some APIs from CpuMmuLib. Change some APIs to private.
Questioner: Ray.

**Changes from V4 to V5:**
Compared with V4, 1 patch adding PcdPciIoTranslationIsEnabled in MdePkg
has been removed.
Copy ArmPciCpuIo2Dxe to UefiCpuPkg and renamed it to CpuMmio2Dxe.
Restore the definitions in MdePkg/Include/Protocol/DebugSupport.h, and
just add some comments.

For the review opinions:
1. Copy ArmPciCpuIo2Dxe to UefiCpuPkg so that more other ARCHs can use
it easily. Questioner: Ray, Ard.

2. Restore the changes of MdePkg/Include/Protocol/DebugSupport.h.
Questioner: Liming.

3. Ia32 X64 and LoongArch64 use a same API definition,
InitializeFloatingPointUnits in CpuLib.h. Questioner: Liming.

4. Adjust API definition in CpuMmuLib.h. Questioner: Ray.

**Changes from V5 to V6:**
1. Added Sunil "Reviewed-by" message to patches 20 and 21.
2. Added Bibo "Reviced-by" message to patches 27, 29, 32 and 34.
3. Added the IPI handler in SEC and PEI stage. Modified patches 11 and
15.
4. Adjust some code styles to suit CI ECC.
5. Adjust the way of AP wakeup from IPI.
6. Adjust the order between setting exceptions and copying exception
handlers.

**Changes from V6 to V7:**
Compared with V6, 1 patch has been added.

Added Bibo "Reviewed-by" message to new patches 26, 27, 29, 31, 32, 36,
37.

Added Liming "Reviewed-by" message to all MdePkg changes.

For the review opinions:
1. Moved the changes to OvmfPkg.dec from old patch 24 to new patch 23.
Questioner: Laszlo.

2. Separate the changes to DebugSupport.h from old patch 11 and
create a new patch 10. Questioner: Liming.

**Changes from V7 to V8:**
Adjusted the folders layout in UefiCpuPkg, most