public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [PATCH v1 00/29] Enable LoongArch virtual machine in edk2
@ 2023-11-03  1:03 Chao Li
  2023-11-03  5:10 ` Ni, Ray
  2023-11-03  7:07 ` Laszlo Ersek
  0 siblings, 2 replies; 9+ messages in thread
From: Chao Li @ 2023-11-03  1:03 UTC (permalink / raw)
  To: devel
  Cc: Michael D Kinney, Liming Gao, Zhiguang Liu, Eric Dong, Ray Ni,
	Rahul Kumar, Gerd Hoffmann, Leif Lindholm, Ard Biesheuvel,
	Abner Chang, Daniel Schaefer, Sami Mujawar, Jiewen Yao,
	Jordan Justen

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.

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

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

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Daniel Schaefer <git@danielschaefer.me>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>

Chao Li (29):
  MdePkg: Add the header file named Csr.h for LoongArch64
  MdePkg: Add LoongArch64 FPU function set into BaseCpuLib
  MdePkg: Add LoongArch64 exception function set into BaseLib
  MdePkg: Add LoongArch64 local interrupt function set into BaseLib
  MdePkg: Add LoongArch Cpucfg function
  MdePkg: Add read stable counter operation for LoongArch
  MdePkg: Add CSR operation for LoongArch
  MdePkg: Add IOCSR operation for LoongArch
  UefiCpuPkg: Add LoongArch64 CPU Timer library
  UefiCpuPkg: Add CPU exception library for LoongArch
  UefiCpuPkg: Add CpuMmuLib.h to UefiCpuPkg
  UefiCpuPkg: Add LoongArch64CpuMmuLib to UefiCpuPkg
  UefiCpuPkg: Add multiprocessor library for LoongArch64
  UefiCpuPkg: Add CpuDxe driver for LoongArch64
  EmbeddedPkg: Add PcdPrePiCpuIoSize width for LOONGARCH64
  ArmVirtPkg: Move PCD of FDT base address and FDT padding to OvmfPkg
  OvmfPkg/LoongArchVirt: Add PciCpuIo2Dxe module
  OvmfPkg/LoongArchVirt: Add stable timer driver
  OvmfPkg/LoongArchVirt: Add a NULL library named
    CollectApResouceLibNull
  OvmfPkg/LoongArchVirt: Add serial port library
  OvmfPkg/LoongArchVirt: Add real time clock library
  OvmfPkg/LoongArchVirt: Add NorFlashQemuLib
  OvmfPkg/LoongArchVirt: Add PeiServiceTablePointerLib
  OvmfPkg/LoongArchVirt: Add platform boot manager library
  OvmfPkg/LoongArchVirt: Add FdtQemuFwCfgLib
  OvmfPkg/LoongArchVirt: Add reset system library
  OvmfPkg/LoongArchVirt: Support SEC phase
  OvmfPkg/LoongArchVirt: Support PEI phase
  OvmfPkg/LoongArchVirt: Add build file

 ArmVirtPkg/ArmVirtCloudHv.dsc                 |    2 +-
 ArmVirtPkg/ArmVirtKvmTool.dsc                 |    2 +-
 ArmVirtPkg/ArmVirtPkg.dec                     |   14 -
 ArmVirtPkg/ArmVirtQemu.dsc                    |    2 +-
 ArmVirtPkg/ArmVirtQemuKernel.dsc              |    2 +-
 ArmVirtPkg/ArmVirtXen.dsc                     |    2 +-
 .../ArmVirtPsciResetSystemPeiLib.inf          |    3 +-
 .../CloudHvVirtMemInfoPeiLib.inf              |    3 +-
 .../DebugLibFdtPL011UartFlash.inf             |    3 +-
 .../EarlyFdt16550SerialPortHookLib.inf        |    3 +-
 .../EarlyFdtPL011SerialPortLib.inf            |    3 +-
 .../KvmtoolPlatformPeiLib.inf                 |    5 +-
 .../Library/PlatformPeiLib/PlatformPeiLib.inf |   10 +-
 .../QemuVirtMemInfoPeiLib.inf                 |    3 +-
 .../PrePi/ArmVirtPrePiUniCoreRelocatable.inf  |    3 +-
 EmbeddedPkg/EmbeddedPkg.dec                   |    3 +
 MdePkg/Include/Library/BaseLib.h              |  221 +++
 MdePkg/Include/Library/CpuLib.h               |   37 +-
 MdePkg/Include/Protocol/DebugSupport.h        |   76 +-
 MdePkg/Include/Register/LoongArch64/Cpucfg.h  |  565 ++++++
 MdePkg/Include/Register/LoongArch64/Csr.h     |  221 +++
 MdePkg/Library/BaseCpuLib/BaseCpuLib.inf      |    7 +-
 .../Library/BaseCpuLib/LoongArch/DisableFpu.S |   17 +
 .../Library/BaseCpuLib/LoongArch/EnableFpu.S  |   17 +
 .../BaseCpuLib/LoongArch/InitializeFpu.S      |   51 +
 MdePkg/Library/BaseLib/BaseLib.inf            |    6 +
 MdePkg/Library/BaseLib/LoongArch64/AsmCsr.S   |  422 +++++
 MdePkg/Library/BaseLib/LoongArch64/Cpucfg.S   |   26 +
 MdePkg/Library/BaseLib/LoongArch64/Csr.c      |   81 +
 .../BaseLib/LoongArch64/DisableInterrupts.S   |   22 +-
 .../BaseLib/LoongArch64/EnableInterrupts.S    |   22 +-
 .../BaseLib/LoongArch64/ExceptionBase.S       |   41 +
 MdePkg/Library/BaseLib/LoongArch64/IoCsr.S    |  120 ++
 .../BaseLib/LoongArch64/ReadStableCounter.S   |   24 +
 MdePkg/MdePkg.ci.yaml                         |    3 +-
 .../Drivers/PciCpuIo2Dxe/PciCpuIo2Dxe.c       |  547 ++++++
 .../Drivers/PciCpuIo2Dxe/PciCpuIo2Dxe.inf     |   45 +
 .../Drivers/StableTimerDxe/Timer.c            |  381 ++++
 .../Drivers/StableTimerDxe/Timer.h            |  127 ++
 .../Drivers/StableTimerDxe/TimerDxe.inf       |   41 +
 .../CollectApResourceLibNull.c                |   35 +
 .../CollectApResourceLibNull.inf              |   32 +
 .../CollectApResourceLibNull.uni              |    9 +
 .../EarlyFdtSerialPortLib16550.c              |  824 +++++++++
 .../EarlyFdtSerialPortLib16550.inf            |   47 +
 .../EarlyFdt16550SerialPortHookLib.c          |  136 ++
 .../EarlyFdt16550SerialPortHookLib.inf        |   36 +
 .../Fdt16550SerialPortHookLib.c               |   41 +
 .../Fdt16550SerialPortHookLib.inf             |   33 +
 .../Fdt16550SerialPortHookLib.uni             |   13 +
 .../FdtQemuFwCfgLib/FdtQemuFwCfgPeiLib.c      |  505 ++++++
 .../FdtQemuFwCfgLib/FdtQemuFwCfgPeiLib.inf    |   42 +
 .../FdtQemuFwCfgLib/QemuFwCfgLibInternal.h    |   73 +
 .../Library/FdtQemuFwCfgLib/QemuFwCfgPei.c    |  117 ++
 .../DxeLsRealTimeClockLib.c                   |  333 ++++
 .../DxeLsRealTimeClockLib.inf                 |   42 +
 .../LsRealTimeClockLib/LsRealTimeClock.h      |   47 +
 .../PeiLsRealTimeClockLib.c                   |   31 +
 .../PeiLsRealTimeClockLib.inf                 |   29 +
 .../Library/NorFlashQemuLib/NorFlashQemuLib.c |  140 ++
 .../NorFlashQemuLib/NorFlashQemuLib.inf       |   43 +
 .../PeiServicesTablePointer.c                 |   75 +
 .../PeiServicesTablePointerLib.inf            |   31 +
 .../PlatformBootManagerLib/PlatformBm.c       |  829 +++++++++
 .../PlatformBootManagerLib/PlatformBm.h       |  112 ++
 .../PlatformBootManagerLib.inf                |   73 +
 .../PlatformBootManagerLib/QemuKernel.c       |   81 +
 .../BaseResetSystemAcpiGed.c                  |  148 ++
 .../BaseResetSystemAcpiGedLib.inf             |   37 +
 .../DxeResetSystemAcpiGed.c                   |  259 +++
 .../DxeResetSystemAcpiGedLib.inf              |   41 +
 .../ResetSystemAcpiLib/ResetSystemAcpiGed.c   |  128 ++
 .../ResetSystemAcpiLib/ResetSystemAcpiGed.h   |   23 +
 OvmfPkg/LoongArchVirt/LoongArchVirt.fdf.inc   |   34 +
 OvmfPkg/LoongArchVirt/LoongArchVirtQemu.dsc   |  675 +++++++
 OvmfPkg/LoongArchVirt/LoongArchVirtQemu.fdf   |  313 ++++
 OvmfPkg/LoongArchVirt/PlatformPei/Fv.c        |   40 +
 OvmfPkg/LoongArchVirt/PlatformPei/MemDetect.c |  203 +++
 OvmfPkg/LoongArchVirt/PlatformPei/Platform.c  |  393 ++++
 OvmfPkg/LoongArchVirt/PlatformPei/Platform.h  |  128 ++
 .../LoongArchVirt/PlatformPei/PlatformPei.inf |   72 +
 OvmfPkg/LoongArchVirt/Sec/LoongArch64/Start.S |  176 ++
 OvmfPkg/LoongArchVirt/Sec/SecMain.c           |  507 ++++++
 OvmfPkg/LoongArchVirt/Sec/SecMain.inf         |   53 +
 OvmfPkg/LoongArchVirt/VarStore.fdf.inc        |   67 +
 OvmfPkg/OvmfPkg.dec                           |   15 +
 UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.c         |  440 +++++
 UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.h         |  261 +++
 UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.inf       |   60 +
 UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.uni       |   15 +
 UefiCpuPkg/CpuDxeLoongArch64/CpuMp.c          |  544 ++++++
 UefiCpuPkg/CpuDxeLoongArch64/CpuMp.h          |  471 +++++
 UefiCpuPkg/CpuDxeLoongArch64/Exception.c      |  150 ++
 UefiCpuPkg/Include/Library/CpuMmuLib.h        |  194 ++
 .../BaseLoongArch64CpuTimerLib.inf            |   30 +
 .../BaseLoongArch64CpuTimerLib.uni            |   15 +
 .../BaseLoongArch64CpuTimerLib/CpuTimerLib.c  |  226 +++
 .../DxeCpuExceptionHandlerLib.inf             |   45 +
 .../DxeCpuExceptionHandlerLib.uni             |   15 +
 .../DxeExceptionLib.c                         |  202 +++
 .../ExceptionCommon.c                         |  170 ++
 .../ExceptionCommon.h                         |  111 ++
 .../LoongArch64/ArchExceptionHandler.c        |  214 +++
 .../LoongArch64/ExceptionHandlerAsm.S         |  320 ++++
 .../SecPeiCpuExceptionHandlerLib.inf          |   45 +
 .../SecPeiCpuExceptionHandlerLib.uni          |   15 +
 .../SecPeiExceptionLib.c                      |   90 +
 .../LoongArch64CpuMmuLib/CommonMmuLib.c       |  963 ++++++++++
 .../LoongArch64CpuMmuLib/CommonMmuLib.h       |   43 +
 .../LoongArch64CpuMmuLib/DxeCpuMmuLib.inf     |   37 +
 .../LoongArch64CpuMmuLib/DxeCpuMmuLib.uni     |   14 +
 .../Library/LoongArch64CpuMmuLib/Page.h       |  279 +++
 .../LoongArch64CpuMmuLib/PeiCpuMmuLib.c       |  165 ++
 .../LoongArch64CpuMmuLib/PeiCpuMmuLib.inf     |   44 +
 .../LoongArch64CpuMmuLib/PeiCpuMmuLib.uni     |   14 +
 UefiCpuPkg/Library/LoongArch64CpuMmuLib/Tlb.h |   48 +
 .../LoongArch64CpuMmuLib/TlbOperation.S       |   44 +
 .../LoongArch64MpInitLib/DxeMpInitLib.inf     |   45 +
 .../LoongArch64MpInitLib/DxeMpInitLib.uni     |   15 +
 .../Library/LoongArch64MpInitLib/DxeMpLib.c   |  481 +++++
 .../Library/LoongArch64MpInitLib/MpLib.c      | 1596 +++++++++++++++++
 .../Library/LoongArch64MpInitLib/MpLib.h      |  361 ++++
 .../LoongArch64MpInitLib/PeiMpInitLib.inf     |   37 +
 .../LoongArch64MpInitLib/PeiMpInitLib.uni     |   15 +
 .../Library/LoongArch64MpInitLib/PeiMpLib.c   |  404 +++++
 UefiCpuPkg/UefiCpuPkg.dec                     |   10 +
 UefiCpuPkg/UefiCpuPkg.dsc                     |   10 +
 127 files changed, 18478 insertions(+), 84 deletions(-)
 create mode 100644 MdePkg/Include/Register/LoongArch64/Cpucfg.h
 create mode 100644 MdePkg/Include/Register/LoongArch64/Csr.h
 create mode 100644 MdePkg/Library/BaseCpuLib/LoongArch/DisableFpu.S
 create mode 100644 MdePkg/Library/BaseCpuLib/LoongArch/EnableFpu.S
 create mode 100644 MdePkg/Library/BaseCpuLib/LoongArch/InitializeFpu.S
 create mode 100644 MdePkg/Library/BaseLib/LoongArch64/AsmCsr.S
 create mode 100644 MdePkg/Library/BaseLib/LoongArch64/Cpucfg.S
 create mode 100644 MdePkg/Library/BaseLib/LoongArch64/Csr.c
 create mode 100644 MdePkg/Library/BaseLib/LoongArch64/ExceptionBase.S
 create mode 100644 MdePkg/Library/BaseLib/LoongArch64/IoCsr.S
 create mode 100644 MdePkg/Library/BaseLib/LoongArch64/ReadStableCounter.S
 create mode 100644 OvmfPkg/LoongArchVirt/Drivers/PciCpuIo2Dxe/PciCpuIo2Dxe.c
 create mode 100644 OvmfPkg/LoongArchVirt/Drivers/PciCpuIo2Dxe/PciCpuIo2Dxe.inf
 create mode 100644 OvmfPkg/LoongArchVirt/Drivers/StableTimerDxe/Timer.c
 create mode 100644 OvmfPkg/LoongArchVirt/Drivers/StableTimerDxe/Timer.h
 create mode 100644 OvmfPkg/LoongArchVirt/Drivers/StableTimerDxe/TimerDxe.inf
 create mode 100644 OvmfPkg/LoongArchVirt/Library/CollectApResouceLibNull/CollectApResourceLibNull.c
 create mode 100644 OvmfPkg/LoongArchVirt/Library/CollectApResouceLibNull/CollectApResourceLibNull.inf
 create mode 100644 OvmfPkg/LoongArchVirt/Library/CollectApResouceLibNull/CollectApResourceLibNull.uni
 create mode 100644 OvmfPkg/LoongArchVirt/Library/EarlyFdtSerialPortLib16550/EarlyFdtSerialPortLib16550.c
 create mode 100644 OvmfPkg/LoongArchVirt/Library/EarlyFdtSerialPortLib16550/EarlyFdtSerialPortLib16550.inf
 create mode 100644 OvmfPkg/LoongArchVirt/Library/Fdt16550SerialPortHookLib/EarlyFdt16550SerialPortHookLib.c
 create mode 100644 OvmfPkg/LoongArchVirt/Library/Fdt16550SerialPortHookLib/EarlyFdt16550SerialPortHookLib.inf
 create mode 100644 OvmfPkg/LoongArchVirt/Library/Fdt16550SerialPortHookLib/Fdt16550SerialPortHookLib.c
 create mode 100644 OvmfPkg/LoongArchVirt/Library/Fdt16550SerialPortHookLib/Fdt16550SerialPortHookLib.inf
 create mode 100644 OvmfPkg/LoongArchVirt/Library/Fdt16550SerialPortHookLib/Fdt16550SerialPortHookLib.uni
 create mode 100644 OvmfPkg/LoongArchVirt/Library/FdtQemuFwCfgLib/FdtQemuFwCfgPeiLib.c
 create mode 100644 OvmfPkg/LoongArchVirt/Library/FdtQemuFwCfgLib/FdtQemuFwCfgPeiLib.inf
 create mode 100644 OvmfPkg/LoongArchVirt/Library/FdtQemuFwCfgLib/QemuFwCfgLibInternal.h
 create mode 100644 OvmfPkg/LoongArchVirt/Library/FdtQemuFwCfgLib/QemuFwCfgPei.c
 create mode 100644 OvmfPkg/LoongArchVirt/Library/LsRealTimeClockLib/DxeLsRealTimeClockLib.c
 create mode 100644 OvmfPkg/LoongArchVirt/Library/LsRealTimeClockLib/DxeLsRealTimeClockLib.inf
 create mode 100644 OvmfPkg/LoongArchVirt/Library/LsRealTimeClockLib/LsRealTimeClock.h
 create mode 100644 OvmfPkg/LoongArchVirt/Library/LsRealTimeClockLib/PeiLsRealTimeClockLib.c
 create mode 100644 OvmfPkg/LoongArchVirt/Library/LsRealTimeClockLib/PeiLsRealTimeClockLib.inf
 create mode 100644 OvmfPkg/LoongArchVirt/Library/NorFlashQemuLib/NorFlashQemuLib.c
 create mode 100644 OvmfPkg/LoongArchVirt/Library/NorFlashQemuLib/NorFlashQemuLib.inf
 create mode 100644 OvmfPkg/LoongArchVirt/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c
 create mode 100644 OvmfPkg/LoongArchVirt/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf
 create mode 100644 OvmfPkg/LoongArchVirt/Library/PlatformBootManagerLib/PlatformBm.c
 create mode 100644 OvmfPkg/LoongArchVirt/Library/PlatformBootManagerLib/PlatformBm.h
 create mode 100644 OvmfPkg/LoongArchVirt/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
 create mode 100644 OvmfPkg/LoongArchVirt/Library/PlatformBootManagerLib/QemuKernel.c
 create mode 100644 OvmfPkg/LoongArchVirt/Library/ResetSystemAcpiLib/BaseResetSystemAcpiGed.c
 create mode 100644 OvmfPkg/LoongArchVirt/Library/ResetSystemAcpiLib/BaseResetSystemAcpiGedLib.inf
 create mode 100644 OvmfPkg/LoongArchVirt/Library/ResetSystemAcpiLib/DxeResetSystemAcpiGed.c
 create mode 100644 OvmfPkg/LoongArchVirt/Library/ResetSystemAcpiLib/DxeResetSystemAcpiGedLib.inf
 create mode 100644 OvmfPkg/LoongArchVirt/Library/ResetSystemAcpiLib/ResetSystemAcpiGed.c
 create mode 100644 OvmfPkg/LoongArchVirt/Library/ResetSystemAcpiLib/ResetSystemAcpiGed.h
 create mode 100644 OvmfPkg/LoongArchVirt/LoongArchVirt.fdf.inc
 create mode 100644 OvmfPkg/LoongArchVirt/LoongArchVirtQemu.dsc
 create mode 100644 OvmfPkg/LoongArchVirt/LoongArchVirtQemu.fdf
 create mode 100644 OvmfPkg/LoongArchVirt/PlatformPei/Fv.c
 create mode 100644 OvmfPkg/LoongArchVirt/PlatformPei/MemDetect.c
 create mode 100644 OvmfPkg/LoongArchVirt/PlatformPei/Platform.c
 create mode 100644 OvmfPkg/LoongArchVirt/PlatformPei/Platform.h
 create mode 100644 OvmfPkg/LoongArchVirt/PlatformPei/PlatformPei.inf
 create mode 100644 OvmfPkg/LoongArchVirt/Sec/LoongArch64/Start.S
 create mode 100644 OvmfPkg/LoongArchVirt/Sec/SecMain.c
 create mode 100644 OvmfPkg/LoongArchVirt/Sec/SecMain.inf
 create mode 100644 OvmfPkg/LoongArchVirt/VarStore.fdf.inc
 create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.c
 create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.h
 create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.inf
 create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.uni
 create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/CpuMp.c
 create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/CpuMp.h
 create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/Exception.c
 create mode 100644 UefiCpuPkg/Include/Library/CpuMmuLib.h
 create mode 100644 UefiCpuPkg/Library/BaseLoongArch64CpuTimerLib/BaseLoongArch64CpuTimerLib.inf
 create mode 100644 UefiCpuPkg/Library/BaseLoongArch64CpuTimerLib/BaseLoongArch64CpuTimerLib.uni
 create mode 100644 UefiCpuPkg/Library/BaseLoongArch64CpuTimerLib/CpuTimerLib.c
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.uni
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/DxeExceptionLib.c
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/ExceptionCommon.c
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/ExceptionCommon.h
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/LoongArch64/ArchExceptionHandler.c
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/LoongArch64/ExceptionHandlerAsm.S
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.uni
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/SecPeiExceptionLib.c
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuMmuLib/CommonMmuLib.c
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuMmuLib/CommonMmuLib.h
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuMmuLib/DxeCpuMmuLib.inf
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuMmuLib/DxeCpuMmuLib.uni
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuMmuLib/Page.h
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuMmuLib/PeiCpuMmuLib.c
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuMmuLib/PeiCpuMmuLib.inf
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuMmuLib/PeiCpuMmuLib.uni
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuMmuLib/Tlb.h
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuMmuLib/TlbOperation.S
 create mode 100644 UefiCpuPkg/Library/LoongArch64MpInitLib/DxeMpInitLib.inf
 create mode 100644 UefiCpuPkg/Library/LoongArch64MpInitLib/DxeMpInitLib.uni
 create mode 100644 UefiCpuPkg/Library/LoongArch64MpInitLib/DxeMpLib.c
 create mode 100644 UefiCpuPkg/Library/LoongArch64MpInitLib/MpLib.c
 create mode 100644 UefiCpuPkg/Library/LoongArch64MpInitLib/MpLib.h
 create mode 100644 UefiCpuPkg/Library/LoongArch64MpInitLib/PeiMpInitLib.inf
 create mode 100644 UefiCpuPkg/Library/LoongArch64MpInitLib/PeiMpInitLib.uni
 create mode 100644 UefiCpuPkg/Library/LoongArch64MpInitLib/PeiMpLib.c

-- 
2.27.0



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



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [edk2-devel] [PATCH v1 00/29] Enable LoongArch virtual machine in edk2
  2023-11-03  1:03 [edk2-devel] [PATCH v1 00/29] Enable LoongArch virtual machine in edk2 Chao Li
@ 2023-11-03  5:10 ` Ni, Ray
  2023-11-03  7:08   ` Chao Li
  2023-11-03  7:07 ` Laszlo Ersek
  1 sibling, 1 reply; 9+ messages in thread
From: Ni, Ray @ 2023-11-03  5:10 UTC (permalink / raw)
  To: Chao Li, devel@edk2.groups.io
  Cc: Kinney, Michael D, Gao, Liming, Liu, Zhiguang, Dong, Eric,
	Kumar, Rahul R, Gerd Hoffmann, Leif Lindholm, Ard Biesheuvel,
	Abner Chang, Daniel Schaefer, Sami Mujawar, Yao, Jiewen,
	Justen, Jordan L

[-- Attachment #1: Type: text/plain, Size: 20049 bytes --]

Chao,
MpInitLib is to avoid code duplication between CpuMpPeim and CpuDxe.
If you only need MP protocol but not MP PPI, do you still need to add MpInitLib?
Can MpInitLib code be included in CpuDxe folder?

Thanks,
Ray
________________________________
From: Chao Li <lichao@loongson.cn>
Sent: Friday, November 3, 2023 9:03 AM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>; Liu, Zhiguang <zhiguang.liu@intel.com>; Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Kumar, Rahul R <rahul.r.kumar@intel.com>; Gerd Hoffmann <kraxel@redhat.com>; Leif Lindholm <quic_llindhol@quicinc.com>; Ard Biesheuvel <ardb+tianocore@kernel.org>; Abner Chang <abner.chang@amd.com>; Daniel Schaefer <git@danielschaefer.me>; Sami Mujawar <sami.mujawar@arm.com>; Yao, Jiewen <jiewen.yao@intel.com>; Justen, Jordan L <jordan.l.justen@intel.com>
Subject: [PATCH v1 00/29] Enable LoongArch virtual machine in edk2

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.

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

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

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Daniel Schaefer <git@danielschaefer.me>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>

Chao Li (29):
  MdePkg: Add the header file named Csr.h for LoongArch64
  MdePkg: Add LoongArch64 FPU function set into BaseCpuLib
  MdePkg: Add LoongArch64 exception function set into BaseLib
  MdePkg: Add LoongArch64 local interrupt function set into BaseLib
  MdePkg: Add LoongArch Cpucfg function
  MdePkg: Add read stable counter operation for LoongArch
  MdePkg: Add CSR operation for LoongArch
  MdePkg: Add IOCSR operation for LoongArch
  UefiCpuPkg: Add LoongArch64 CPU Timer library
  UefiCpuPkg: Add CPU exception library for LoongArch
  UefiCpuPkg: Add CpuMmuLib.h to UefiCpuPkg
  UefiCpuPkg: Add LoongArch64CpuMmuLib to UefiCpuPkg
  UefiCpuPkg: Add multiprocessor library for LoongArch64
  UefiCpuPkg: Add CpuDxe driver for LoongArch64
  EmbeddedPkg: Add PcdPrePiCpuIoSize width for LOONGARCH64
  ArmVirtPkg: Move PCD of FDT base address and FDT padding to OvmfPkg
  OvmfPkg/LoongArchVirt: Add PciCpuIo2Dxe module
  OvmfPkg/LoongArchVirt: Add stable timer driver
  OvmfPkg/LoongArchVirt: Add a NULL library named
    CollectApResouceLibNull
  OvmfPkg/LoongArchVirt: Add serial port library
  OvmfPkg/LoongArchVirt: Add real time clock library
  OvmfPkg/LoongArchVirt: Add NorFlashQemuLib
  OvmfPkg/LoongArchVirt: Add PeiServiceTablePointerLib
  OvmfPkg/LoongArchVirt: Add platform boot manager library
  OvmfPkg/LoongArchVirt: Add FdtQemuFwCfgLib
  OvmfPkg/LoongArchVirt: Add reset system library
  OvmfPkg/LoongArchVirt: Support SEC phase
  OvmfPkg/LoongArchVirt: Support PEI phase
  OvmfPkg/LoongArchVirt: Add build file

 ArmVirtPkg/ArmVirtCloudHv.dsc                 |    2 +-
 ArmVirtPkg/ArmVirtKvmTool.dsc                 |    2 +-
 ArmVirtPkg/ArmVirtPkg.dec                     |   14 -
 ArmVirtPkg/ArmVirtQemu.dsc                    |    2 +-
 ArmVirtPkg/ArmVirtQemuKernel.dsc              |    2 +-
 ArmVirtPkg/ArmVirtXen.dsc                     |    2 +-
 .../ArmVirtPsciResetSystemPeiLib.inf          |    3 +-
 .../CloudHvVirtMemInfoPeiLib.inf              |    3 +-
 .../DebugLibFdtPL011UartFlash.inf             |    3 +-
 .../EarlyFdt16550SerialPortHookLib.inf        |    3 +-
 .../EarlyFdtPL011SerialPortLib.inf            |    3 +-
 .../KvmtoolPlatformPeiLib.inf                 |    5 +-
 .../Library/PlatformPeiLib/PlatformPeiLib.inf |   10 +-
 .../QemuVirtMemInfoPeiLib.inf                 |    3 +-
 .../PrePi/ArmVirtPrePiUniCoreRelocatable.inf  |    3 +-
 EmbeddedPkg/EmbeddedPkg.dec                   |    3 +
 MdePkg/Include/Library/BaseLib.h              |  221 +++
 MdePkg/Include/Library/CpuLib.h               |   37 +-
 MdePkg/Include/Protocol/DebugSupport.h        |   76 +-
 MdePkg/Include/Register/LoongArch64/Cpucfg.h  |  565 ++++++
 MdePkg/Include/Register/LoongArch64/Csr.h     |  221 +++
 MdePkg/Library/BaseCpuLib/BaseCpuLib.inf      |    7 +-
 .../Library/BaseCpuLib/LoongArch/DisableFpu.S |   17 +
 .../Library/BaseCpuLib/LoongArch/EnableFpu.S  |   17 +
 .../BaseCpuLib/LoongArch/InitializeFpu.S      |   51 +
 MdePkg/Library/BaseLib/BaseLib.inf            |    6 +
 MdePkg/Library/BaseLib/LoongArch64/AsmCsr.S   |  422 +++++
 MdePkg/Library/BaseLib/LoongArch64/Cpucfg.S   |   26 +
 MdePkg/Library/BaseLib/LoongArch64/Csr.c      |   81 +
 .../BaseLib/LoongArch64/DisableInterrupts.S   |   22 +-
 .../BaseLib/LoongArch64/EnableInterrupts.S    |   22 +-
 .../BaseLib/LoongArch64/ExceptionBase.S       |   41 +
 MdePkg/Library/BaseLib/LoongArch64/IoCsr.S    |  120 ++
 .../BaseLib/LoongArch64/ReadStableCounter.S   |   24 +
 MdePkg/MdePkg.ci.yaml                         |    3 +-
 .../Drivers/PciCpuIo2Dxe/PciCpuIo2Dxe.c       |  547 ++++++
 .../Drivers/PciCpuIo2Dxe/PciCpuIo2Dxe.inf     |   45 +
 .../Drivers/StableTimerDxe/Timer.c            |  381 ++++
 .../Drivers/StableTimerDxe/Timer.h            |  127 ++
 .../Drivers/StableTimerDxe/TimerDxe.inf       |   41 +
 .../CollectApResourceLibNull.c                |   35 +
 .../CollectApResourceLibNull.inf              |   32 +
 .../CollectApResourceLibNull.uni              |    9 +
 .../EarlyFdtSerialPortLib16550.c              |  824 +++++++++
 .../EarlyFdtSerialPortLib16550.inf            |   47 +
 .../EarlyFdt16550SerialPortHookLib.c          |  136 ++
 .../EarlyFdt16550SerialPortHookLib.inf        |   36 +
 .../Fdt16550SerialPortHookLib.c               |   41 +
 .../Fdt16550SerialPortHookLib.inf             |   33 +
 .../Fdt16550SerialPortHookLib.uni             |   13 +
 .../FdtQemuFwCfgLib/FdtQemuFwCfgPeiLib.c      |  505 ++++++
 .../FdtQemuFwCfgLib/FdtQemuFwCfgPeiLib.inf    |   42 +
 .../FdtQemuFwCfgLib/QemuFwCfgLibInternal.h    |   73 +
 .../Library/FdtQemuFwCfgLib/QemuFwCfgPei.c    |  117 ++
 .../DxeLsRealTimeClockLib.c                   |  333 ++++
 .../DxeLsRealTimeClockLib.inf                 |   42 +
 .../LsRealTimeClockLib/LsRealTimeClock.h      |   47 +
 .../PeiLsRealTimeClockLib.c                   |   31 +
 .../PeiLsRealTimeClockLib.inf                 |   29 +
 .../Library/NorFlashQemuLib/NorFlashQemuLib.c |  140 ++
 .../NorFlashQemuLib/NorFlashQemuLib.inf       |   43 +
 .../PeiServicesTablePointer.c                 |   75 +
 .../PeiServicesTablePointerLib.inf            |   31 +
 .../PlatformBootManagerLib/PlatformBm.c       |  829 +++++++++
 .../PlatformBootManagerLib/PlatformBm.h       |  112 ++
 .../PlatformBootManagerLib.inf                |   73 +
 .../PlatformBootManagerLib/QemuKernel.c       |   81 +
 .../BaseResetSystemAcpiGed.c                  |  148 ++
 .../BaseResetSystemAcpiGedLib.inf             |   37 +
 .../DxeResetSystemAcpiGed.c                   |  259 +++
 .../DxeResetSystemAcpiGedLib.inf              |   41 +
 .../ResetSystemAcpiLib/ResetSystemAcpiGed.c   |  128 ++
 .../ResetSystemAcpiLib/ResetSystemAcpiGed.h   |   23 +
 OvmfPkg/LoongArchVirt/LoongArchVirt.fdf.inc   |   34 +
 OvmfPkg/LoongArchVirt/LoongArchVirtQemu.dsc   |  675 +++++++
 OvmfPkg/LoongArchVirt/LoongArchVirtQemu.fdf   |  313 ++++
 OvmfPkg/LoongArchVirt/PlatformPei/Fv.c        |   40 +
 OvmfPkg/LoongArchVirt/PlatformPei/MemDetect.c |  203 +++
 OvmfPkg/LoongArchVirt/PlatformPei/Platform.c  |  393 ++++
 OvmfPkg/LoongArchVirt/PlatformPei/Platform.h  |  128 ++
 .../LoongArchVirt/PlatformPei/PlatformPei.inf |   72 +
 OvmfPkg/LoongArchVirt/Sec/LoongArch64/Start.S |  176 ++
 OvmfPkg/LoongArchVirt/Sec/SecMain.c           |  507 ++++++
 OvmfPkg/LoongArchVirt/Sec/SecMain.inf         |   53 +
 OvmfPkg/LoongArchVirt/VarStore.fdf.inc        |   67 +
 OvmfPkg/OvmfPkg.dec                           |   15 +
 UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.c         |  440 +++++
 UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.h         |  261 +++
 UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.inf       |   60 +
 UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.uni       |   15 +
 UefiCpuPkg/CpuDxeLoongArch64/CpuMp.c          |  544 ++++++
 UefiCpuPkg/CpuDxeLoongArch64/CpuMp.h          |  471 +++++
 UefiCpuPkg/CpuDxeLoongArch64/Exception.c      |  150 ++
 UefiCpuPkg/Include/Library/CpuMmuLib.h        |  194 ++
 .../BaseLoongArch64CpuTimerLib.inf            |   30 +
 .../BaseLoongArch64CpuTimerLib.uni            |   15 +
 .../BaseLoongArch64CpuTimerLib/CpuTimerLib.c  |  226 +++
 .../DxeCpuExceptionHandlerLib.inf             |   45 +
 .../DxeCpuExceptionHandlerLib.uni             |   15 +
 .../DxeExceptionLib.c                         |  202 +++
 .../ExceptionCommon.c                         |  170 ++
 .../ExceptionCommon.h                         |  111 ++
 .../LoongArch64/ArchExceptionHandler.c        |  214 +++
 .../LoongArch64/ExceptionHandlerAsm.S         |  320 ++++
 .../SecPeiCpuExceptionHandlerLib.inf          |   45 +
 .../SecPeiCpuExceptionHandlerLib.uni          |   15 +
 .../SecPeiExceptionLib.c                      |   90 +
 .../LoongArch64CpuMmuLib/CommonMmuLib.c       |  963 ++++++++++
 .../LoongArch64CpuMmuLib/CommonMmuLib.h       |   43 +
 .../LoongArch64CpuMmuLib/DxeCpuMmuLib.inf     |   37 +
 .../LoongArch64CpuMmuLib/DxeCpuMmuLib.uni     |   14 +
 .../Library/LoongArch64CpuMmuLib/Page.h       |  279 +++
 .../LoongArch64CpuMmuLib/PeiCpuMmuLib.c       |  165 ++
 .../LoongArch64CpuMmuLib/PeiCpuMmuLib.inf     |   44 +
 .../LoongArch64CpuMmuLib/PeiCpuMmuLib.uni     |   14 +
 UefiCpuPkg/Library/LoongArch64CpuMmuLib/Tlb.h |   48 +
 .../LoongArch64CpuMmuLib/TlbOperation.S       |   44 +
 .../LoongArch64MpInitLib/DxeMpInitLib.inf     |   45 +
 .../LoongArch64MpInitLib/DxeMpInitLib.uni     |   15 +
 .../Library/LoongArch64MpInitLib/DxeMpLib.c   |  481 +++++
 .../Library/LoongArch64MpInitLib/MpLib.c      | 1596 +++++++++++++++++
 .../Library/LoongArch64MpInitLib/MpLib.h      |  361 ++++
 .../LoongArch64MpInitLib/PeiMpInitLib.inf     |   37 +
 .../LoongArch64MpInitLib/PeiMpInitLib.uni     |   15 +
 .../Library/LoongArch64MpInitLib/PeiMpLib.c   |  404 +++++
 UefiCpuPkg/UefiCpuPkg.dec                     |   10 +
 UefiCpuPkg/UefiCpuPkg.dsc                     |   10 +
 127 files changed, 18478 insertions(+), 84 deletions(-)
 create mode 100644 MdePkg/Include/Register/LoongArch64/Cpucfg.h
 create mode 100644 MdePkg/Include/Register/LoongArch64/Csr.h
 create mode 100644 MdePkg/Library/BaseCpuLib/LoongArch/DisableFpu.S
 create mode 100644 MdePkg/Library/BaseCpuLib/LoongArch/EnableFpu.S
 create mode 100644 MdePkg/Library/BaseCpuLib/LoongArch/InitializeFpu.S
 create mode 100644 MdePkg/Library/BaseLib/LoongArch64/AsmCsr.S
 create mode 100644 MdePkg/Library/BaseLib/LoongArch64/Cpucfg.S
 create mode 100644 MdePkg/Library/BaseLib/LoongArch64/Csr.c
 create mode 100644 MdePkg/Library/BaseLib/LoongArch64/ExceptionBase.S
 create mode 100644 MdePkg/Library/BaseLib/LoongArch64/IoCsr.S
 create mode 100644 MdePkg/Library/BaseLib/LoongArch64/ReadStableCounter.S
 create mode 100644 OvmfPkg/LoongArchVirt/Drivers/PciCpuIo2Dxe/PciCpuIo2Dxe.c
 create mode 100644 OvmfPkg/LoongArchVirt/Drivers/PciCpuIo2Dxe/PciCpuIo2Dxe.inf
 create mode 100644 OvmfPkg/LoongArchVirt/Drivers/StableTimerDxe/Timer.c
 create mode 100644 OvmfPkg/LoongArchVirt/Drivers/StableTimerDxe/Timer.h
 create mode 100644 OvmfPkg/LoongArchVirt/Drivers/StableTimerDxe/TimerDxe.inf
 create mode 100644 OvmfPkg/LoongArchVirt/Library/CollectApResouceLibNull/CollectApResourceLibNull.c
 create mode 100644 OvmfPkg/LoongArchVirt/Library/CollectApResouceLibNull/CollectApResourceLibNull.inf
 create mode 100644 OvmfPkg/LoongArchVirt/Library/CollectApResouceLibNull/CollectApResourceLibNull.uni
 create mode 100644 OvmfPkg/LoongArchVirt/Library/EarlyFdtSerialPortLib16550/EarlyFdtSerialPortLib16550.c
 create mode 100644 OvmfPkg/LoongArchVirt/Library/EarlyFdtSerialPortLib16550/EarlyFdtSerialPortLib16550.inf
 create mode 100644 OvmfPkg/LoongArchVirt/Library/Fdt16550SerialPortHookLib/EarlyFdt16550SerialPortHookLib.c
 create mode 100644 OvmfPkg/LoongArchVirt/Library/Fdt16550SerialPortHookLib/EarlyFdt16550SerialPortHookLib.inf
 create mode 100644 OvmfPkg/LoongArchVirt/Library/Fdt16550SerialPortHookLib/Fdt16550SerialPortHookLib.c
 create mode 100644 OvmfPkg/LoongArchVirt/Library/Fdt16550SerialPortHookLib/Fdt16550SerialPortHookLib.inf
 create mode 100644 OvmfPkg/LoongArchVirt/Library/Fdt16550SerialPortHookLib/Fdt16550SerialPortHookLib.uni
 create mode 100644 OvmfPkg/LoongArchVirt/Library/FdtQemuFwCfgLib/FdtQemuFwCfgPeiLib.c
 create mode 100644 OvmfPkg/LoongArchVirt/Library/FdtQemuFwCfgLib/FdtQemuFwCfgPeiLib.inf
 create mode 100644 OvmfPkg/LoongArchVirt/Library/FdtQemuFwCfgLib/QemuFwCfgLibInternal.h
 create mode 100644 OvmfPkg/LoongArchVirt/Library/FdtQemuFwCfgLib/QemuFwCfgPei.c
 create mode 100644 OvmfPkg/LoongArchVirt/Library/LsRealTimeClockLib/DxeLsRealTimeClockLib.c
 create mode 100644 OvmfPkg/LoongArchVirt/Library/LsRealTimeClockLib/DxeLsRealTimeClockLib.inf
 create mode 100644 OvmfPkg/LoongArchVirt/Library/LsRealTimeClockLib/LsRealTimeClock.h
 create mode 100644 OvmfPkg/LoongArchVirt/Library/LsRealTimeClockLib/PeiLsRealTimeClockLib.c
 create mode 100644 OvmfPkg/LoongArchVirt/Library/LsRealTimeClockLib/PeiLsRealTimeClockLib.inf
 create mode 100644 OvmfPkg/LoongArchVirt/Library/NorFlashQemuLib/NorFlashQemuLib.c
 create mode 100644 OvmfPkg/LoongArchVirt/Library/NorFlashQemuLib/NorFlashQemuLib.inf
 create mode 100644 OvmfPkg/LoongArchVirt/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c
 create mode 100644 OvmfPkg/LoongArchVirt/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf
 create mode 100644 OvmfPkg/LoongArchVirt/Library/PlatformBootManagerLib/PlatformBm.c
 create mode 100644 OvmfPkg/LoongArchVirt/Library/PlatformBootManagerLib/PlatformBm.h
 create mode 100644 OvmfPkg/LoongArchVirt/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
 create mode 100644 OvmfPkg/LoongArchVirt/Library/PlatformBootManagerLib/QemuKernel.c
 create mode 100644 OvmfPkg/LoongArchVirt/Library/ResetSystemAcpiLib/BaseResetSystemAcpiGed.c
 create mode 100644 OvmfPkg/LoongArchVirt/Library/ResetSystemAcpiLib/BaseResetSystemAcpiGedLib.inf
 create mode 100644 OvmfPkg/LoongArchVirt/Library/ResetSystemAcpiLib/DxeResetSystemAcpiGed.c
 create mode 100644 OvmfPkg/LoongArchVirt/Library/ResetSystemAcpiLib/DxeResetSystemAcpiGedLib.inf
 create mode 100644 OvmfPkg/LoongArchVirt/Library/ResetSystemAcpiLib/ResetSystemAcpiGed.c
 create mode 100644 OvmfPkg/LoongArchVirt/Library/ResetSystemAcpiLib/ResetSystemAcpiGed.h
 create mode 100644 OvmfPkg/LoongArchVirt/LoongArchVirt.fdf.inc
 create mode 100644 OvmfPkg/LoongArchVirt/LoongArchVirtQemu.dsc
 create mode 100644 OvmfPkg/LoongArchVirt/LoongArchVirtQemu.fdf
 create mode 100644 OvmfPkg/LoongArchVirt/PlatformPei/Fv.c
 create mode 100644 OvmfPkg/LoongArchVirt/PlatformPei/MemDetect.c
 create mode 100644 OvmfPkg/LoongArchVirt/PlatformPei/Platform.c
 create mode 100644 OvmfPkg/LoongArchVirt/PlatformPei/Platform.h
 create mode 100644 OvmfPkg/LoongArchVirt/PlatformPei/PlatformPei.inf
 create mode 100644 OvmfPkg/LoongArchVirt/Sec/LoongArch64/Start.S
 create mode 100644 OvmfPkg/LoongArchVirt/Sec/SecMain.c
 create mode 100644 OvmfPkg/LoongArchVirt/Sec/SecMain.inf
 create mode 100644 OvmfPkg/LoongArchVirt/VarStore.fdf.inc
 create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.c
 create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.h
 create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.inf
 create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.uni
 create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/CpuMp.c
 create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/CpuMp.h
 create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/Exception.c
 create mode 100644 UefiCpuPkg/Include/Library/CpuMmuLib.h
 create mode 100644 UefiCpuPkg/Library/BaseLoongArch64CpuTimerLib/BaseLoongArch64CpuTimerLib.inf
 create mode 100644 UefiCpuPkg/Library/BaseLoongArch64CpuTimerLib/BaseLoongArch64CpuTimerLib.uni
 create mode 100644 UefiCpuPkg/Library/BaseLoongArch64CpuTimerLib/CpuTimerLib.c
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.uni
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/DxeExceptionLib.c
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/ExceptionCommon.c
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/ExceptionCommon.h
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/LoongArch64/ArchExceptionHandler.c
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/LoongArch64/ExceptionHandlerAsm.S
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.uni
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/SecPeiExceptionLib.c
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuMmuLib/CommonMmuLib.c
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuMmuLib/CommonMmuLib.h
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuMmuLib/DxeCpuMmuLib.inf
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuMmuLib/DxeCpuMmuLib.uni
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuMmuLib/Page.h
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuMmuLib/PeiCpuMmuLib.c
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuMmuLib/PeiCpuMmuLib.inf
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuMmuLib/PeiCpuMmuLib.uni
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuMmuLib/Tlb.h
 create mode 100644 UefiCpuPkg/Library/LoongArch64CpuMmuLib/TlbOperation.S
 create mode 100644 UefiCpuPkg/Library/LoongArch64MpInitLib/DxeMpInitLib.inf
 create mode 100644 UefiCpuPkg/Library/LoongArch64MpInitLib/DxeMpInitLib.uni
 create mode 100644 UefiCpuPkg/Library/LoongArch64MpInitLib/DxeMpLib.c
 create mode 100644 UefiCpuPkg/Library/LoongArch64MpInitLib/MpLib.c
 create mode 100644 UefiCpuPkg/Library/LoongArch64MpInitLib/MpLib.h
 create mode 100644 UefiCpuPkg/Library/LoongArch64MpInitLib/PeiMpInitLib.inf
 create mode 100644 UefiCpuPkg/Library/LoongArch64MpInitLib/PeiMpInitLib.uni
 create mode 100644 UefiCpuPkg/Library/LoongArch64MpInitLib/PeiMpLib.c

--
2.27.0



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



[-- Attachment #2: Type: text/html, Size: 31689 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [edk2-devel] [PATCH v1 00/29] Enable LoongArch virtual machine in edk2
  2023-11-03  1:03 [edk2-devel] [PATCH v1 00/29] Enable LoongArch virtual machine in edk2 Chao Li
  2023-11-03  5:10 ` Ni, Ray
@ 2023-11-03  7:07 ` Laszlo Ersek
  2023-11-03  7:32   ` Chao Li
  1 sibling, 1 reply; 9+ messages in thread
From: Laszlo Ersek @ 2023-11-03  7:07 UTC (permalink / raw)
  To: devel, lichao
  Cc: Michael D Kinney, Liming Gao, Zhiguang Liu, Eric Dong, Ray Ni,
	Rahul Kumar, Gerd Hoffmann, Leif Lindholm, Ard Biesheuvel,
	Abner Chang, Daniel Schaefer, Sami Mujawar, Jiewen Yao,
	Jordan Justen

On 11/3/23 02:03, 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.
> 
> Modfied modues: MdePkg, UefiCpuPkg, EmbeddedPkg, ArmVirtPkg, OvmfPkg.
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4584
> 

[...]

>  127 files changed, 18478 insertions(+), 84 deletions(-)

18478 lines seem overkill... Probably too much code added / duplicated
under UefiCpuPkg, as Ray says.

Also:

- Please make sure you post the patches with the "sendemail.thread" git
config item set to "true". "BaseTools/Scripts/SetupGit.py" takes care of
that. Otherwise, just as it has now happened, your patches are not
threaded under the cover letter; they fly apart as independent messages.

- Whenever you post a (new or initial) version of a patch set, please
link the URL of the cover letter (from the mailing list archive) into
the Bugzilla ticket, in a new comment.

Thanks
Laszlo



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



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [edk2-devel] [PATCH v1 00/29] Enable LoongArch virtual machine in edk2
  2023-11-03  5:10 ` Ni, Ray
@ 2023-11-03  7:08   ` Chao Li
  2023-11-03  7:51     ` maobibo
  0 siblings, 1 reply; 9+ messages in thread
From: Chao Li @ 2023-11-03  7:08 UTC (permalink / raw)
  To: devel, ray.ni
  Cc: Kinney, Michael D, Gao, Liming, Liu, Zhiguang, Dong, Eric,
	Kumar, Rahul R, Gerd Hoffmann, Leif Lindholm, Ard Biesheuvel,
	Abner Chang, Daniel Schaefer, Sami Mujawar, Yao, Jiewen,
	Justen, Jordan L

[-- Attachment #1: Type: text/plain, Size: 23024 bytes --]

Hi Ray,

Thanks for review.


I think the MpInitLib is necessary, because this library will serve PEI 
and DEX phases. In LoongArch, the MP initialization function will be  
called first in the PEI phase. It will wake up all of AP, collect 
accurate online cores, and all APs will fill in their self information 
to prepare for next wakeup.

The second time the MP initialization function is called will in DXE 
phase, usually located CpuDxe, I guess you are checked this code. This 
time the MP service HOB will be brought from PEI to DXE phase, and the 
MP protocal will be registered to prepare for service DXE phase.

Like you saied, why not use the MP PPI? I think it's just that the code 
hasn't been added yet, and I think LoongArch will definitely need the MP 
PPI in the future, like memory trainning, configure APs local registers, 
etc.


Thanks,
Chao
在 2023/11/3 13:10, Ni, Ray 写道:
> Chao,
> MpInitLib is to avoid code duplication between CpuMpPeim and CpuDxe.
> If you only need MP protocol but not MP PPI, do you still need to add 
> MpInitLib?
> Can MpInitLib code be included in CpuDxe folder?
>
> Thanks,
> Ray
> ------------------------------------------------------------------------
> *From:* Chao Li <lichao@loongson.cn>
> *Sent:* Friday, November 3, 2023 9:03 AM
> *To:* devel@edk2.groups.io <devel@edk2.groups.io>
> *Cc:* Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming 
> <gaoliming@byosoft.com.cn>; Liu, Zhiguang <zhiguang.liu@intel.com>; 
> Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Kumar, 
> Rahul R <rahul.r.kumar@intel.com>; Gerd Hoffmann <kraxel@redhat.com>; 
> Leif Lindholm <quic_llindhol@quicinc.com>; Ard Biesheuvel 
> <ardb+tianocore@kernel.org>; Abner Chang <abner.chang@amd.com>; Daniel 
> Schaefer <git@danielschaefer.me>; Sami Mujawar <sami.mujawar@arm.com>; 
> Yao, Jiewen <jiewen.yao@intel.com>; Justen, Jordan L 
> <jordan.l.justen@intel.com>
> *Subject:* [PATCH v1 00/29] Enable LoongArch virtual machine in edk2
> 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.
>
> Modfied modues: MdePkg, UefiCpuPkg, EmbeddedPkg, ArmVirtPkg, OvmfPkg.
>
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4584
>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Rahul Kumar <rahul1.kumar@intel.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Leif Lindholm <quic_llindhol@quicinc.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Abner Chang <abner.chang@amd.com>
> Cc: Daniel Schaefer <git@danielschaefer.me>
> Cc: Sami Mujawar <sami.mujawar@arm.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
>
> Chao Li (29):
>   MdePkg: Add the header file named Csr.h for LoongArch64
>   MdePkg: Add LoongArch64 FPU function set into BaseCpuLib
>   MdePkg: Add LoongArch64 exception function set into BaseLib
>   MdePkg: Add LoongArch64 local interrupt function set into BaseLib
>   MdePkg: Add LoongArch Cpucfg function
>   MdePkg: Add read stable counter operation for LoongArch
>   MdePkg: Add CSR operation for LoongArch
>   MdePkg: Add IOCSR operation for LoongArch
>   UefiCpuPkg: Add LoongArch64 CPU Timer library
>   UefiCpuPkg: Add CPU exception library for LoongArch
>   UefiCpuPkg: Add CpuMmuLib.h to UefiCpuPkg
>   UefiCpuPkg: Add LoongArch64CpuMmuLib to UefiCpuPkg
>   UefiCpuPkg: Add multiprocessor library for LoongArch64
>   UefiCpuPkg: Add CpuDxe driver for LoongArch64
>   EmbeddedPkg: Add PcdPrePiCpuIoSize width for LOONGARCH64
>   ArmVirtPkg: Move PCD of FDT base address and FDT padding to OvmfPkg
>   OvmfPkg/LoongArchVirt: Add PciCpuIo2Dxe module
>   OvmfPkg/LoongArchVirt: Add stable timer driver
>   OvmfPkg/LoongArchVirt: Add a NULL library named
>     CollectApResouceLibNull
>   OvmfPkg/LoongArchVirt: Add serial port library
>   OvmfPkg/LoongArchVirt: Add real time clock library
>   OvmfPkg/LoongArchVirt: Add NorFlashQemuLib
>   OvmfPkg/LoongArchVirt: Add PeiServiceTablePointerLib
>   OvmfPkg/LoongArchVirt: Add platform boot manager library
>   OvmfPkg/LoongArchVirt: Add FdtQemuFwCfgLib
>   OvmfPkg/LoongArchVirt: Add reset system library
>   OvmfPkg/LoongArchVirt: Support SEC phase
>   OvmfPkg/LoongArchVirt: Support PEI phase
>   OvmfPkg/LoongArchVirt: Add build file
>
>  ArmVirtPkg/ArmVirtCloudHv.dsc                 |    2 +-
>  ArmVirtPkg/ArmVirtKvmTool.dsc                 |    2 +-
>  ArmVirtPkg/ArmVirtPkg.dec                     |   14 -
>  ArmVirtPkg/ArmVirtQemu.dsc                    |    2 +-
>  ArmVirtPkg/ArmVirtQemuKernel.dsc              |    2 +-
>  ArmVirtPkg/ArmVirtXen.dsc                     |    2 +-
>  .../ArmVirtPsciResetSystemPeiLib.inf          |    3 +-
>  .../CloudHvVirtMemInfoPeiLib.inf              |    3 +-
>  .../DebugLibFdtPL011UartFlash.inf             |    3 +-
>  .../EarlyFdt16550SerialPortHookLib.inf        |    3 +-
>  .../EarlyFdtPL011SerialPortLib.inf            |    3 +-
>  .../KvmtoolPlatformPeiLib.inf                 |    5 +-
>  .../Library/PlatformPeiLib/PlatformPeiLib.inf |   10 +-
>  .../QemuVirtMemInfoPeiLib.inf                 |    3 +-
>  .../PrePi/ArmVirtPrePiUniCoreRelocatable.inf  |    3 +-
>  EmbeddedPkg/EmbeddedPkg.dec                   |    3 +
>  MdePkg/Include/Library/BaseLib.h              |  221 +++
>  MdePkg/Include/Library/CpuLib.h               |   37 +-
>  MdePkg/Include/Protocol/DebugSupport.h        |   76 +-
>  MdePkg/Include/Register/LoongArch64/Cpucfg.h  |  565 ++++++
>  MdePkg/Include/Register/LoongArch64/Csr.h     |  221 +++
>  MdePkg/Library/BaseCpuLib/BaseCpuLib.inf      |    7 +-
>  .../Library/BaseCpuLib/LoongArch/DisableFpu.S |   17 +
>  .../Library/BaseCpuLib/LoongArch/EnableFpu.S  |   17 +
>  .../BaseCpuLib/LoongArch/InitializeFpu.S      |   51 +
>  MdePkg/Library/BaseLib/BaseLib.inf            |    6 +
>  MdePkg/Library/BaseLib/LoongArch64/AsmCsr.S   |  422 +++++
>  MdePkg/Library/BaseLib/LoongArch64/Cpucfg.S   |   26 +
>  MdePkg/Library/BaseLib/LoongArch64/Csr.c      |   81 +
>  .../BaseLib/LoongArch64/DisableInterrupts.S   |   22 +-
>  .../BaseLib/LoongArch64/EnableInterrupts.S    |   22 +-
>  .../BaseLib/LoongArch64/ExceptionBase.S       |   41 +
>  MdePkg/Library/BaseLib/LoongArch64/IoCsr.S    |  120 ++
>  .../BaseLib/LoongArch64/ReadStableCounter.S   |   24 +
>  MdePkg/MdePkg.ci.yaml                         |    3 +-
>  .../Drivers/PciCpuIo2Dxe/PciCpuIo2Dxe.c       |  547 ++++++
>  .../Drivers/PciCpuIo2Dxe/PciCpuIo2Dxe.inf     |   45 +
>  .../Drivers/StableTimerDxe/Timer.c            |  381 ++++
>  .../Drivers/StableTimerDxe/Timer.h            |  127 ++
>  .../Drivers/StableTimerDxe/TimerDxe.inf       |   41 +
>  .../CollectApResourceLibNull.c                |   35 +
>  .../CollectApResourceLibNull.inf              |   32 +
>  .../CollectApResourceLibNull.uni              |    9 +
>  .../EarlyFdtSerialPortLib16550.c              |  824 +++++++++
>  .../EarlyFdtSerialPortLib16550.inf            |   47 +
>  .../EarlyFdt16550SerialPortHookLib.c          |  136 ++
>  .../EarlyFdt16550SerialPortHookLib.inf        |   36 +
>  .../Fdt16550SerialPortHookLib.c               |   41 +
>  .../Fdt16550SerialPortHookLib.inf             |   33 +
>  .../Fdt16550SerialPortHookLib.uni             |   13 +
>  .../FdtQemuFwCfgLib/FdtQemuFwCfgPeiLib.c      |  505 ++++++
>  .../FdtQemuFwCfgLib/FdtQemuFwCfgPeiLib.inf    |   42 +
>  .../FdtQemuFwCfgLib/QemuFwCfgLibInternal.h    |   73 +
>  .../Library/FdtQemuFwCfgLib/QemuFwCfgPei.c    |  117 ++
>  .../DxeLsRealTimeClockLib.c                   |  333 ++++
>  .../DxeLsRealTimeClockLib.inf                 |   42 +
>  .../LsRealTimeClockLib/LsRealTimeClock.h      |   47 +
>  .../PeiLsRealTimeClockLib.c                   |   31 +
>  .../PeiLsRealTimeClockLib.inf                 |   29 +
>  .../Library/NorFlashQemuLib/NorFlashQemuLib.c |  140 ++
>  .../NorFlashQemuLib/NorFlashQemuLib.inf       |   43 +
>  .../PeiServicesTablePointer.c                 |   75 +
>  .../PeiServicesTablePointerLib.inf            |   31 +
>  .../PlatformBootManagerLib/PlatformBm.c       |  829 +++++++++
>  .../PlatformBootManagerLib/PlatformBm.h       |  112 ++
>  .../PlatformBootManagerLib.inf                |   73 +
>  .../PlatformBootManagerLib/QemuKernel.c       |   81 +
>  .../BaseResetSystemAcpiGed.c                  |  148 ++
>  .../BaseResetSystemAcpiGedLib.inf             |   37 +
>  .../DxeResetSystemAcpiGed.c                   |  259 +++
>  .../DxeResetSystemAcpiGedLib.inf              |   41 +
>  .../ResetSystemAcpiLib/ResetSystemAcpiGed.c   |  128 ++
>  .../ResetSystemAcpiLib/ResetSystemAcpiGed.h   |   23 +
>  OvmfPkg/LoongArchVirt/LoongArchVirt.fdf.inc   |   34 +
>  OvmfPkg/LoongArchVirt/LoongArchVirtQemu.dsc   |  675 +++++++
>  OvmfPkg/LoongArchVirt/LoongArchVirtQemu.fdf   |  313 ++++
>  OvmfPkg/LoongArchVirt/PlatformPei/Fv.c        |   40 +
>  OvmfPkg/LoongArchVirt/PlatformPei/MemDetect.c |  203 +++
>  OvmfPkg/LoongArchVirt/PlatformPei/Platform.c  |  393 ++++
>  OvmfPkg/LoongArchVirt/PlatformPei/Platform.h  |  128 ++
>  .../LoongArchVirt/PlatformPei/PlatformPei.inf |   72 +
>  OvmfPkg/LoongArchVirt/Sec/LoongArch64/Start.S |  176 ++
>  OvmfPkg/LoongArchVirt/Sec/SecMain.c           |  507 ++++++
>  OvmfPkg/LoongArchVirt/Sec/SecMain.inf         |   53 +
>  OvmfPkg/LoongArchVirt/VarStore.fdf.inc        |   67 +
>  OvmfPkg/OvmfPkg.dec                           |   15 +
>  UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.c         |  440 +++++
>  UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.h         |  261 +++
>  UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.inf       |   60 +
>  UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.uni       |   15 +
>  UefiCpuPkg/CpuDxeLoongArch64/CpuMp.c          |  544 ++++++
>  UefiCpuPkg/CpuDxeLoongArch64/CpuMp.h          |  471 +++++
>  UefiCpuPkg/CpuDxeLoongArch64/Exception.c      |  150 ++
>  UefiCpuPkg/Include/Library/CpuMmuLib.h        |  194 ++
>  .../BaseLoongArch64CpuTimerLib.inf            |   30 +
>  .../BaseLoongArch64CpuTimerLib.uni            |   15 +
>  .../BaseLoongArch64CpuTimerLib/CpuTimerLib.c  |  226 +++
>  .../DxeCpuExceptionHandlerLib.inf             |   45 +
>  .../DxeCpuExceptionHandlerLib.uni             |   15 +
>  .../DxeExceptionLib.c                         |  202 +++
>  .../ExceptionCommon.c                         |  170 ++
>  .../ExceptionCommon.h                         |  111 ++
>  .../LoongArch64/ArchExceptionHandler.c        |  214 +++
>  .../LoongArch64/ExceptionHandlerAsm.S         |  320 ++++
>  .../SecPeiCpuExceptionHandlerLib.inf          |   45 +
>  .../SecPeiCpuExceptionHandlerLib.uni          |   15 +
>  .../SecPeiExceptionLib.c                      |   90 +
>  .../LoongArch64CpuMmuLib/CommonMmuLib.c       |  963 ++++++++++
>  .../LoongArch64CpuMmuLib/CommonMmuLib.h       |   43 +
>  .../LoongArch64CpuMmuLib/DxeCpuMmuLib.inf     |   37 +
>  .../LoongArch64CpuMmuLib/DxeCpuMmuLib.uni     |   14 +
>  .../Library/LoongArch64CpuMmuLib/Page.h       |  279 +++
>  .../LoongArch64CpuMmuLib/PeiCpuMmuLib.c       |  165 ++
>  .../LoongArch64CpuMmuLib/PeiCpuMmuLib.inf     |   44 +
>  .../LoongArch64CpuMmuLib/PeiCpuMmuLib.uni     |   14 +
>  UefiCpuPkg/Library/LoongArch64CpuMmuLib/Tlb.h |   48 +
>  .../LoongArch64CpuMmuLib/TlbOperation.S       |   44 +
>  .../LoongArch64MpInitLib/DxeMpInitLib.inf     |   45 +
>  .../LoongArch64MpInitLib/DxeMpInitLib.uni     |   15 +
>  .../Library/LoongArch64MpInitLib/DxeMpLib.c   |  481 +++++
>  .../Library/LoongArch64MpInitLib/MpLib.c      | 1596 +++++++++++++++++
>  .../Library/LoongArch64MpInitLib/MpLib.h      |  361 ++++
>  .../LoongArch64MpInitLib/PeiMpInitLib.inf     |   37 +
>  .../LoongArch64MpInitLib/PeiMpInitLib.uni     |   15 +
>  .../Library/LoongArch64MpInitLib/PeiMpLib.c   |  404 +++++
>  UefiCpuPkg/UefiCpuPkg.dec                     |   10 +
>  UefiCpuPkg/UefiCpuPkg.dsc                     |   10 +
>  127 files changed, 18478 insertions(+), 84 deletions(-)
>  create mode 100644 MdePkg/Include/Register/LoongArch64/Cpucfg.h
>  create mode 100644 MdePkg/Include/Register/LoongArch64/Csr.h
>  create mode 100644 MdePkg/Library/BaseCpuLib/LoongArch/DisableFpu.S
>  create mode 100644 MdePkg/Library/BaseCpuLib/LoongArch/EnableFpu.S
>  create mode 100644 MdePkg/Library/BaseCpuLib/LoongArch/InitializeFpu.S
>  create mode 100644 MdePkg/Library/BaseLib/LoongArch64/AsmCsr.S
>  create mode 100644 MdePkg/Library/BaseLib/LoongArch64/Cpucfg.S
>  create mode 100644 MdePkg/Library/BaseLib/LoongArch64/Csr.c
>  create mode 100644 MdePkg/Library/BaseLib/LoongArch64/ExceptionBase.S
>  create mode 100644 MdePkg/Library/BaseLib/LoongArch64/IoCsr.S
>  create mode 100644 MdePkg/Library/BaseLib/LoongArch64/ReadStableCounter.S
>  create mode 100644 
> OvmfPkg/LoongArchVirt/Drivers/PciCpuIo2Dxe/PciCpuIo2Dxe.c
>  create mode 100644 
> OvmfPkg/LoongArchVirt/Drivers/PciCpuIo2Dxe/PciCpuIo2Dxe.inf
>  create mode 100644 OvmfPkg/LoongArchVirt/Drivers/StableTimerDxe/Timer.c
>  create mode 100644 OvmfPkg/LoongArchVirt/Drivers/StableTimerDxe/Timer.h
>  create mode 100644 
> OvmfPkg/LoongArchVirt/Drivers/StableTimerDxe/TimerDxe.inf
>  create mode 100644 
> OvmfPkg/LoongArchVirt/Library/CollectApResouceLibNull/CollectApResourceLibNull.c
>  create mode 100644 
> OvmfPkg/LoongArchVirt/Library/CollectApResouceLibNull/CollectApResourceLibNull.inf
>  create mode 100644 
> OvmfPkg/LoongArchVirt/Library/CollectApResouceLibNull/CollectApResourceLibNull.uni
>  create mode 100644 
> OvmfPkg/LoongArchVirt/Library/EarlyFdtSerialPortLib16550/EarlyFdtSerialPortLib16550.c
>  create mode 100644 
> OvmfPkg/LoongArchVirt/Library/EarlyFdtSerialPortLib16550/EarlyFdtSerialPortLib16550.inf
>  create mode 100644 
> OvmfPkg/LoongArchVirt/Library/Fdt16550SerialPortHookLib/EarlyFdt16550SerialPortHookLib.c
>  create mode 100644 
> OvmfPkg/LoongArchVirt/Library/Fdt16550SerialPortHookLib/EarlyFdt16550SerialPortHookLib.inf
>  create mode 100644 
> OvmfPkg/LoongArchVirt/Library/Fdt16550SerialPortHookLib/Fdt16550SerialPortHookLib.c
>  create mode 100644 
> OvmfPkg/LoongArchVirt/Library/Fdt16550SerialPortHookLib/Fdt16550SerialPortHookLib.inf
>  create mode 100644 
> OvmfPkg/LoongArchVirt/Library/Fdt16550SerialPortHookLib/Fdt16550SerialPortHookLib.uni
>  create mode 100644 
> OvmfPkg/LoongArchVirt/Library/FdtQemuFwCfgLib/FdtQemuFwCfgPeiLib.c
>  create mode 100644 
> OvmfPkg/LoongArchVirt/Library/FdtQemuFwCfgLib/FdtQemuFwCfgPeiLib.inf
>  create mode 100644 
> OvmfPkg/LoongArchVirt/Library/FdtQemuFwCfgLib/QemuFwCfgLibInternal.h
>  create mode 100644 
> OvmfPkg/LoongArchVirt/Library/FdtQemuFwCfgLib/QemuFwCfgPei.c
>  create mode 100644 
> OvmfPkg/LoongArchVirt/Library/LsRealTimeClockLib/DxeLsRealTimeClockLib.c
>  create mode 100644 
> OvmfPkg/LoongArchVirt/Library/LsRealTimeClockLib/DxeLsRealTimeClockLib.inf
>  create mode 100644 
> OvmfPkg/LoongArchVirt/Library/LsRealTimeClockLib/LsRealTimeClock.h
>  create mode 100644 
> OvmfPkg/LoongArchVirt/Library/LsRealTimeClockLib/PeiLsRealTimeClockLib.c
>  create mode 100644 
> OvmfPkg/LoongArchVirt/Library/LsRealTimeClockLib/PeiLsRealTimeClockLib.inf
>  create mode 100644 
> OvmfPkg/LoongArchVirt/Library/NorFlashQemuLib/NorFlashQemuLib.c
>  create mode 100644 
> OvmfPkg/LoongArchVirt/Library/NorFlashQemuLib/NorFlashQemuLib.inf
>  create mode 100644 
> OvmfPkg/LoongArchVirt/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c
>  create mode 100644 
> OvmfPkg/LoongArchVirt/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf
>  create mode 100644 
> OvmfPkg/LoongArchVirt/Library/PlatformBootManagerLib/PlatformBm.c
>  create mode 100644 
> OvmfPkg/LoongArchVirt/Library/PlatformBootManagerLib/PlatformBm.h
>  create mode 100644 
> OvmfPkg/LoongArchVirt/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
>  create mode 100644 
> OvmfPkg/LoongArchVirt/Library/PlatformBootManagerLib/QemuKernel.c
>  create mode 100644 
> OvmfPkg/LoongArchVirt/Library/ResetSystemAcpiLib/BaseResetSystemAcpiGed.c
>  create mode 100644 
> OvmfPkg/LoongArchVirt/Library/ResetSystemAcpiLib/BaseResetSystemAcpiGedLib.inf
>  create mode 100644 
> OvmfPkg/LoongArchVirt/Library/ResetSystemAcpiLib/DxeResetSystemAcpiGed.c
>  create mode 100644 
> OvmfPkg/LoongArchVirt/Library/ResetSystemAcpiLib/DxeResetSystemAcpiGedLib.inf
>  create mode 100644 
> OvmfPkg/LoongArchVirt/Library/ResetSystemAcpiLib/ResetSystemAcpiGed.c
>  create mode 100644 
> OvmfPkg/LoongArchVirt/Library/ResetSystemAcpiLib/ResetSystemAcpiGed.h
>  create mode 100644 OvmfPkg/LoongArchVirt/LoongArchVirt.fdf.inc
>  create mode 100644 OvmfPkg/LoongArchVirt/LoongArchVirtQemu.dsc
>  create mode 100644 OvmfPkg/LoongArchVirt/LoongArchVirtQemu.fdf
>  create mode 100644 OvmfPkg/LoongArchVirt/PlatformPei/Fv.c
>  create mode 100644 OvmfPkg/LoongArchVirt/PlatformPei/MemDetect.c
>  create mode 100644 OvmfPkg/LoongArchVirt/PlatformPei/Platform.c
>  create mode 100644 OvmfPkg/LoongArchVirt/PlatformPei/Platform.h
>  create mode 100644 OvmfPkg/LoongArchVirt/PlatformPei/PlatformPei.inf
>  create mode 100644 OvmfPkg/LoongArchVirt/Sec/LoongArch64/Start.S
>  create mode 100644 OvmfPkg/LoongArchVirt/Sec/SecMain.c
>  create mode 100644 OvmfPkg/LoongArchVirt/Sec/SecMain.inf
>  create mode 100644 OvmfPkg/LoongArchVirt/VarStore.fdf.inc
>  create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.c
>  create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.h
>  create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.inf
>  create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.uni
>  create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/CpuMp.c
>  create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/CpuMp.h
>  create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/Exception.c
>  create mode 100644 UefiCpuPkg/Include/Library/CpuMmuLib.h
>  create mode 100644 
> UefiCpuPkg/Library/BaseLoongArch64CpuTimerLib/BaseLoongArch64CpuTimerLib.inf
>  create mode 100644 
> UefiCpuPkg/Library/BaseLoongArch64CpuTimerLib/BaseLoongArch64CpuTimerLib.uni
>  create mode 100644 
> UefiCpuPkg/Library/BaseLoongArch64CpuTimerLib/CpuTimerLib.c
>  create mode 100644 
> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
>  create mode 100644 
> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.uni
>  create mode 100644 
> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/DxeExceptionLib.c
>  create mode 100644 
> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/ExceptionCommon.c
>  create mode 100644 
> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/ExceptionCommon.h
>  create mode 100644 
> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/LoongArch64/ArchExceptionHandler.c
>  create mode 100644 
> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/LoongArch64/ExceptionHandlerAsm.S
>  create mode 100644 
> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
>  create mode 100644 
> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.uni
>  create mode 100644 
> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/SecPeiExceptionLib.c
>  create mode 100644 UefiCpuPkg/Library/LoongArch64CpuMmuLib/CommonMmuLib.c
>  create mode 100644 UefiCpuPkg/Library/LoongArch64CpuMmuLib/CommonMmuLib.h
>  create mode 100644 
> UefiCpuPkg/Library/LoongArch64CpuMmuLib/DxeCpuMmuLib.inf
>  create mode 100644 
> UefiCpuPkg/Library/LoongArch64CpuMmuLib/DxeCpuMmuLib.uni
>  create mode 100644 UefiCpuPkg/Library/LoongArch64CpuMmuLib/Page.h
>  create mode 100644 UefiCpuPkg/Library/LoongArch64CpuMmuLib/PeiCpuMmuLib.c
>  create mode 100644 
> UefiCpuPkg/Library/LoongArch64CpuMmuLib/PeiCpuMmuLib.inf
>  create mode 100644 
> UefiCpuPkg/Library/LoongArch64CpuMmuLib/PeiCpuMmuLib.uni
>  create mode 100644 UefiCpuPkg/Library/LoongArch64CpuMmuLib/Tlb.h
>  create mode 100644 UefiCpuPkg/Library/LoongArch64CpuMmuLib/TlbOperation.S
>  create mode 100644 
> UefiCpuPkg/Library/LoongArch64MpInitLib/DxeMpInitLib.inf
>  create mode 100644 
> UefiCpuPkg/Library/LoongArch64MpInitLib/DxeMpInitLib.uni
>  create mode 100644 UefiCpuPkg/Library/LoongArch64MpInitLib/DxeMpLib.c
>  create mode 100644 UefiCpuPkg/Library/LoongArch64MpInitLib/MpLib.c
>  create mode 100644 UefiCpuPkg/Library/LoongArch64MpInitLib/MpLib.h
>  create mode 100644 
> UefiCpuPkg/Library/LoongArch64MpInitLib/PeiMpInitLib.inf
>  create mode 100644 
> UefiCpuPkg/Library/LoongArch64MpInitLib/PeiMpInitLib.uni
>  create mode 100644 UefiCpuPkg/Library/LoongArch64MpInitLib/PeiMpLib.c
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#110611): https://edk2.groups.io/g/devel/message/110611
Mute This Topic: https://groups.io/mt/102355705/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: 34682 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [edk2-devel] [PATCH v1 00/29] Enable LoongArch virtual machine in edk2
  2023-11-03  7:07 ` Laszlo Ersek
@ 2023-11-03  7:32   ` Chao Li
  2023-11-03  7:40     ` Laszlo Ersek
  0 siblings, 1 reply; 9+ messages in thread
From: Chao Li @ 2023-11-03  7:32 UTC (permalink / raw)
  To: Laszlo Ersek, devel
  Cc: Michael D Kinney, Liming Gao, Zhiguang Liu, Eric Dong, Ray Ni,
	Rahul Kumar, Gerd Hoffmann, Leif Lindholm, Ard Biesheuvel,
	Abner Chang, Daniel Schaefer, Sami Mujawar, Jiewen Yao,
	Jordan Justen

[-- Attachment #1: Type: text/plain, Size: 2645 bytes --]

Hi Laszlo,

Sorry, the reason of some mail is not under cover letter is found, I 
will fix it at the V2.

I don't think the code is **duplicated** since most code is architecture 
related, and maybe some code is referenced from others ARCH. As  the 
cover letter saied, most code is distributed in MdePkg, UefiCpuPkg, 
OvmfPkg. MdePkg is added some help functions for LoongArch. UefCpuPkg is 
added CpuTimerLib, CpuExceptionLib, CpuMmuLib, MpInitLib, CpuDxe. Each 
library and driver is not small. OvmfPkg adds the private code for 
LoongArch QEMU virtual machine instances, it override some architecture 
related library that cannot use the publice libraries, mostly for the 
PEI phase.


Thanks,
Chao
在 2023/11/3 15:07, Laszlo Ersek 写道:
> On 11/3/23 02:03, 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.
>>
>> Modfied modues: MdePkg, UefiCpuPkg, EmbeddedPkg, ArmVirtPkg, OvmfPkg.
>>
>> BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=4584
>>
> [...]
>
>>   127 files changed, 18478 insertions(+), 84 deletions(-)
> 18478 lines seem overkill... Probably too much code added / duplicated
> under UefiCpuPkg, as Ray says.
>
> Also:
>
> - Please make sure you post the patches with the "sendemail.thread" git
> config item set to "true". "BaseTools/Scripts/SetupGit.py" takes care of
> that. Otherwise, just as it has now happened, your patches are not
> threaded under the cover letter; they fly apart as independent messages.
>
> - Whenever you post a (new or initial) version of a patch set, please
> link the URL of the cover letter (from the mailing list archive) into
> the Bugzilla ticket, in a new comment.
>
> Thanks
> Laszlo


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#110613): https://edk2.groups.io/g/devel/message/110613
Mute This Topic: https://groups.io/mt/102355705/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: 4144 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [edk2-devel] [PATCH v1 00/29] Enable LoongArch virtual machine in edk2
  2023-11-03  7:32   ` Chao Li
@ 2023-11-03  7:40     ` Laszlo Ersek
  0 siblings, 0 replies; 9+ messages in thread
From: Laszlo Ersek @ 2023-11-03  7:40 UTC (permalink / raw)
  To: Chao Li, devel
  Cc: Michael D Kinney, Liming Gao, Zhiguang Liu, Eric Dong, Ray Ni,
	Rahul Kumar, Gerd Hoffmann, Leif Lindholm, Ard Biesheuvel,
	Abner Chang, Daniel Schaefer, Sami Mujawar, Jiewen Yao,
	Jordan Justen

On 11/3/23 08:32, Chao Li wrote:
> Hi Laszlo,
> 
> Sorry, the reason of some mail is not under cover letter is found, I
> will fix it at the V2.
> 
> I don't think the code is **duplicated** since most code is architecture
> related, and maybe some code is referenced from others ARCH. As  the
> cover letter saied, most code is distributed in MdePkg, UefiCpuPkg,
> OvmfPkg. MdePkg is added some help functions for LoongArch. UefCpuPkg is
> added CpuTimerLib, CpuExceptionLib, CpuMmuLib, MpInitLib, CpuDxe. Each
> library and driver is not small. OvmfPkg adds the private code for
> LoongArch QEMU virtual machine instances, it override some architecture
> related library that cannot use the publice  libraries, mostly for the
> PEI phase.

Thanks for the explanation!
Laszlo



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



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [edk2-devel] [PATCH v1 00/29] Enable LoongArch virtual machine in edk2
  2023-11-03  7:08   ` Chao Li
@ 2023-11-03  7:51     ` maobibo
  2023-11-03  8:09       ` Chao Li
  0 siblings, 1 reply; 9+ messages in thread
From: maobibo @ 2023-11-03  7:51 UTC (permalink / raw)
  To: devel, lichao, ray.ni
  Cc: Kinney, Michael D, Gao, Liming, Liu, Zhiguang, Dong, Eric,
	Kumar, Rahul R, Gerd Hoffmann, Leif Lindholm, Ard Biesheuvel,
	Abner Chang, Daniel Schaefer, Sami Mujawar, Yao, Jiewen,
	Justen, Jordan L



On 2023/11/3 下午3:08, Chao Li wrote:
> Hi Ray,
> 
> Thanks for review.
> 
> 
> I think the MpInitLib is necessary, because this library will serve PEI 
> and DEX phases. In LoongArch, the MP initialization function will be  
> called first in the PEI phase. It will wake up all of AP, collect 
> accurate online cores, and all APs will fill in their self information 
> to prepare for next wakeup.
> 
> The second time the MP initialization function is called will in DXE 
> phase, usually located CpuDxe, I guess you are checked this code. This 
> time the MP service HOB will be brought from PEI to DXE phase, and the 
> MP protocal will be registered to prepare for service DXE phase.
> 
> Like you saied, why not use the MP PPI? I think it's just that the code 
> hasn't been added yet, and I think LoongArch will definitely need the MP 
> PPI in the future, like memory trainning, configure APs local registers, 
> etc.

It is necessary for physical machine like memory trainning/configure APs 
local register etc, however I doubt whether it is useful for LoongArch 
virt-machine, I do not see the advantages for wakeup APs in UEFI BIOS. 
ACPI FADT table is prepared in qemu side rather than BIOS side.

Regards
Bibo Mao
> 
> 
> Thanks,
> Chao
> 在 2023/11/3 13:10, Ni, Ray 写道:
>> Chao,
>> MpInitLib is to avoid code duplication between CpuMpPeim and CpuDxe.
>> If you only need MP protocol but not MP PPI, do you still need to add 
>> MpInitLib?
>> Can MpInitLib code be included in CpuDxe folder?
>>
>> Thanks,
>> Ray
>> ------------------------------------------------------------------------
>> *From:* Chao Li <lichao@loongson.cn>
>> *Sent:* Friday, November 3, 2023 9:03 AM
>> *To:* devel@edk2.groups.io <devel@edk2.groups.io>
>> *Cc:* Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming 
>> <gaoliming@byosoft.com.cn>; Liu, Zhiguang <zhiguang.liu@intel.com>; 
>> Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Kumar, 
>> Rahul R <rahul.r.kumar@intel.com>; Gerd Hoffmann <kraxel@redhat.com>; 
>> Leif Lindholm <quic_llindhol@quicinc.com>; Ard Biesheuvel 
>> <ardb+tianocore@kernel.org>; Abner Chang <abner.chang@amd.com>; Daniel 
>> Schaefer <git@danielschaefer.me>; Sami Mujawar <sami.mujawar@arm.com>; 
>> Yao, Jiewen <jiewen.yao@intel.com>; Justen, Jordan L 
>> <jordan.l.justen@intel.com>
>> *Subject:* [PATCH v1 00/29] Enable LoongArch virtual machine in edk2
>> 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.
>>
>> Modfied modues: MdePkg, UefiCpuPkg, EmbeddedPkg, ArmVirtPkg, OvmfPkg.
>>
>> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4584
>>
>> Cc: Michael D Kinney <michael.d.kinney@intel.com>
>> Cc: Liming Gao <gaoliming@byosoft.com.cn>
>> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
>> Cc: Eric Dong <eric.dong@intel.com>
>> Cc: Ray Ni <ray.ni@intel.com>
>> Cc: Rahul Kumar <rahul1.kumar@intel.com>
>> Cc: Gerd Hoffmann <kraxel@redhat.com>
>> Cc: Leif Lindholm <quic_llindhol@quicinc.com>
>> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
>> Cc: Abner Chang <abner.chang@amd.com>
>> Cc: Daniel Schaefer <git@danielschaefer.me>
>> Cc: Sami Mujawar <sami.mujawar@arm.com>
>> Cc: Jiewen Yao <jiewen.yao@intel.com>
>> Cc: Jordan Justen <jordan.l.justen@intel.com>
>>
>> Chao Li (29):
>>   MdePkg: Add the header file named Csr.h for LoongArch64
>>   MdePkg: Add LoongArch64 FPU function set into BaseCpuLib
>>   MdePkg: Add LoongArch64 exception function set into BaseLib
>>   MdePkg: Add LoongArch64 local interrupt function set into BaseLib
>>   MdePkg: Add LoongArch Cpucfg function
>>   MdePkg: Add read stable counter operation for LoongArch
>>   MdePkg: Add CSR operation for LoongArch
>>   MdePkg: Add IOCSR operation for LoongArch
>>   UefiCpuPkg: Add LoongArch64 CPU Timer library
>>   UefiCpuPkg: Add CPU exception library for LoongArch
>>   UefiCpuPkg: Add CpuMmuLib.h to UefiCpuPkg
>>   UefiCpuPkg: Add LoongArch64CpuMmuLib to UefiCpuPkg
>>   UefiCpuPkg: Add multiprocessor library for LoongArch64
>>   UefiCpuPkg: Add CpuDxe driver for LoongArch64
>>   EmbeddedPkg: Add PcdPrePiCpuIoSize width for LOONGARCH64
>>   ArmVirtPkg: Move PCD of FDT base address and FDT padding to OvmfPkg
>>   OvmfPkg/LoongArchVirt: Add PciCpuIo2Dxe module
>>   OvmfPkg/LoongArchVirt: Add stable timer driver
>>   OvmfPkg/LoongArchVirt: Add a NULL library named
>>     CollectApResouceLibNull
>>   OvmfPkg/LoongArchVirt: Add serial port library
>>   OvmfPkg/LoongArchVirt: Add real time clock library
>>   OvmfPkg/LoongArchVirt: Add NorFlashQemuLib
>>   OvmfPkg/LoongArchVirt: Add PeiServiceTablePointerLib
>>   OvmfPkg/LoongArchVirt: Add platform boot manager library
>>   OvmfPkg/LoongArchVirt: Add FdtQemuFwCfgLib
>>   OvmfPkg/LoongArchVirt: Add reset system library
>>   OvmfPkg/LoongArchVirt: Support SEC phase
>>   OvmfPkg/LoongArchVirt: Support PEI phase
>>   OvmfPkg/LoongArchVirt: Add build file
>>
>>  ArmVirtPkg/ArmVirtCloudHv.dsc                 |    2 +-
>>  ArmVirtPkg/ArmVirtKvmTool.dsc                 |    2 +-
>>  ArmVirtPkg/ArmVirtPkg.dec                     |   14 -
>>  ArmVirtPkg/ArmVirtQemu.dsc                    |    2 +-
>>  ArmVirtPkg/ArmVirtQemuKernel.dsc              |    2 +-
>>  ArmVirtPkg/ArmVirtXen.dsc                     |    2 +-
>>  .../ArmVirtPsciResetSystemPeiLib.inf          |    3 +-
>>  .../CloudHvVirtMemInfoPeiLib.inf              |    3 +-
>>  .../DebugLibFdtPL011UartFlash.inf             |    3 +-
>>  .../EarlyFdt16550SerialPortHookLib.inf        |    3 +-
>>  .../EarlyFdtPL011SerialPortLib.inf            |    3 +-
>>  .../KvmtoolPlatformPeiLib.inf                 |    5 +-
>>  .../Library/PlatformPeiLib/PlatformPeiLib.inf |   10 +-
>>  .../QemuVirtMemInfoPeiLib.inf                 |    3 +-
>>  .../PrePi/ArmVirtPrePiUniCoreRelocatable.inf  |    3 +-
>>  EmbeddedPkg/EmbeddedPkg.dec                   |    3 +
>>  MdePkg/Include/Library/BaseLib.h              |  221 +++
>>  MdePkg/Include/Library/CpuLib.h               |   37 +-
>>  MdePkg/Include/Protocol/DebugSupport.h        |   76 +-
>>  MdePkg/Include/Register/LoongArch64/Cpucfg.h  |  565 ++++++
>>  MdePkg/Include/Register/LoongArch64/Csr.h     |  221 +++
>>  MdePkg/Library/BaseCpuLib/BaseCpuLib.inf      |    7 +-
>>  .../Library/BaseCpuLib/LoongArch/DisableFpu.S |   17 +
>>  .../Library/BaseCpuLib/LoongArch/EnableFpu.S  |   17 +
>>  .../BaseCpuLib/LoongArch/InitializeFpu.S      |   51 +
>>  MdePkg/Library/BaseLib/BaseLib.inf            |    6 +
>>  MdePkg/Library/BaseLib/LoongArch64/AsmCsr.S   |  422 +++++
>>  MdePkg/Library/BaseLib/LoongArch64/Cpucfg.S   |   26 +
>>  MdePkg/Library/BaseLib/LoongArch64/Csr.c      |   81 +
>>  .../BaseLib/LoongArch64/DisableInterrupts.S   |   22 +-
>>  .../BaseLib/LoongArch64/EnableInterrupts.S    |   22 +-
>>  .../BaseLib/LoongArch64/ExceptionBase.S       |   41 +
>>  MdePkg/Library/BaseLib/LoongArch64/IoCsr.S    |  120 ++
>>  .../BaseLib/LoongArch64/ReadStableCounter.S   |   24 +
>>  MdePkg/MdePkg.ci.yaml                         |    3 +-
>>  .../Drivers/PciCpuIo2Dxe/PciCpuIo2Dxe.c       |  547 ++++++
>>  .../Drivers/PciCpuIo2Dxe/PciCpuIo2Dxe.inf     |   45 +
>>  .../Drivers/StableTimerDxe/Timer.c            |  381 ++++
>>  .../Drivers/StableTimerDxe/Timer.h            |  127 ++
>>  .../Drivers/StableTimerDxe/TimerDxe.inf       |   41 +
>>  .../CollectApResourceLibNull.c                |   35 +
>>  .../CollectApResourceLibNull.inf              |   32 +
>>  .../CollectApResourceLibNull.uni              |    9 +
>>  .../EarlyFdtSerialPortLib16550.c              |  824 +++++++++
>>  .../EarlyFdtSerialPortLib16550.inf            |   47 +
>>  .../EarlyFdt16550SerialPortHookLib.c          |  136 ++
>>  .../EarlyFdt16550SerialPortHookLib.inf        |   36 +
>>  .../Fdt16550SerialPortHookLib.c               |   41 +
>>  .../Fdt16550SerialPortHookLib.inf             |   33 +
>>  .../Fdt16550SerialPortHookLib.uni             |   13 +
>>  .../FdtQemuFwCfgLib/FdtQemuFwCfgPeiLib.c      |  505 ++++++
>>  .../FdtQemuFwCfgLib/FdtQemuFwCfgPeiLib.inf    |   42 +
>>  .../FdtQemuFwCfgLib/QemuFwCfgLibInternal.h    |   73 +
>>  .../Library/FdtQemuFwCfgLib/QemuFwCfgPei.c    |  117 ++
>>  .../DxeLsRealTimeClockLib.c                   |  333 ++++
>>  .../DxeLsRealTimeClockLib.inf                 |   42 +
>>  .../LsRealTimeClockLib/LsRealTimeClock.h      |   47 +
>>  .../PeiLsRealTimeClockLib.c                   |   31 +
>>  .../PeiLsRealTimeClockLib.inf                 |   29 +
>>  .../Library/NorFlashQemuLib/NorFlashQemuLib.c |  140 ++
>>  .../NorFlashQemuLib/NorFlashQemuLib.inf       |   43 +
>>  .../PeiServicesTablePointer.c                 |   75 +
>>  .../PeiServicesTablePointerLib.inf            |   31 +
>>  .../PlatformBootManagerLib/PlatformBm.c       |  829 +++++++++
>>  .../PlatformBootManagerLib/PlatformBm.h       |  112 ++
>>  .../PlatformBootManagerLib.inf                |   73 +
>>  .../PlatformBootManagerLib/QemuKernel.c       |   81 +
>>  .../BaseResetSystemAcpiGed.c                  |  148 ++
>>  .../BaseResetSystemAcpiGedLib.inf             |   37 +
>>  .../DxeResetSystemAcpiGed.c                   |  259 +++
>>  .../DxeResetSystemAcpiGedLib.inf              |   41 +
>>  .../ResetSystemAcpiLib/ResetSystemAcpiGed.c   |  128 ++
>>  .../ResetSystemAcpiLib/ResetSystemAcpiGed.h   |   23 +
>>  OvmfPkg/LoongArchVirt/LoongArchVirt.fdf.inc   |   34 +
>>  OvmfPkg/LoongArchVirt/LoongArchVirtQemu.dsc   |  675 +++++++
>>  OvmfPkg/LoongArchVirt/LoongArchVirtQemu.fdf   |  313 ++++
>>  OvmfPkg/LoongArchVirt/PlatformPei/Fv.c        |   40 +
>>  OvmfPkg/LoongArchVirt/PlatformPei/MemDetect.c |  203 +++
>>  OvmfPkg/LoongArchVirt/PlatformPei/Platform.c  |  393 ++++
>>  OvmfPkg/LoongArchVirt/PlatformPei/Platform.h  |  128 ++
>>  .../LoongArchVirt/PlatformPei/PlatformPei.inf |   72 +
>>  OvmfPkg/LoongArchVirt/Sec/LoongArch64/Start.S |  176 ++
>>  OvmfPkg/LoongArchVirt/Sec/SecMain.c           |  507 ++++++
>>  OvmfPkg/LoongArchVirt/Sec/SecMain.inf         |   53 +
>>  OvmfPkg/LoongArchVirt/VarStore.fdf.inc        |   67 +
>>  OvmfPkg/OvmfPkg.dec                           |   15 +
>>  UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.c         |  440 +++++
>>  UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.h         |  261 +++
>>  UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.inf       |   60 +
>>  UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.uni       |   15 +
>>  UefiCpuPkg/CpuDxeLoongArch64/CpuMp.c          |  544 ++++++
>>  UefiCpuPkg/CpuDxeLoongArch64/CpuMp.h          |  471 +++++
>>  UefiCpuPkg/CpuDxeLoongArch64/Exception.c      |  150 ++
>>  UefiCpuPkg/Include/Library/CpuMmuLib.h        |  194 ++
>>  .../BaseLoongArch64CpuTimerLib.inf            |   30 +
>>  .../BaseLoongArch64CpuTimerLib.uni            |   15 +
>>  .../BaseLoongArch64CpuTimerLib/CpuTimerLib.c  |  226 +++
>>  .../DxeCpuExceptionHandlerLib.inf             |   45 +
>>  .../DxeCpuExceptionHandlerLib.uni             |   15 +
>>  .../DxeExceptionLib.c                         |  202 +++
>>  .../ExceptionCommon.c                         |  170 ++
>>  .../ExceptionCommon.h                         |  111 ++
>>  .../LoongArch64/ArchExceptionHandler.c        |  214 +++
>>  .../LoongArch64/ExceptionHandlerAsm.S         |  320 ++++
>>  .../SecPeiCpuExceptionHandlerLib.inf          |   45 +
>>  .../SecPeiCpuExceptionHandlerLib.uni          |   15 +
>>  .../SecPeiExceptionLib.c                      |   90 +
>>  .../LoongArch64CpuMmuLib/CommonMmuLib.c       |  963 ++++++++++
>>  .../LoongArch64CpuMmuLib/CommonMmuLib.h       |   43 +
>>  .../LoongArch64CpuMmuLib/DxeCpuMmuLib.inf     |   37 +
>>  .../LoongArch64CpuMmuLib/DxeCpuMmuLib.uni     |   14 +
>>  .../Library/LoongArch64CpuMmuLib/Page.h       |  279 +++
>>  .../LoongArch64CpuMmuLib/PeiCpuMmuLib.c       |  165 ++
>>  .../LoongArch64CpuMmuLib/PeiCpuMmuLib.inf     |   44 +
>>  .../LoongArch64CpuMmuLib/PeiCpuMmuLib.uni     |   14 +
>>  UefiCpuPkg/Library/LoongArch64CpuMmuLib/Tlb.h |   48 +
>>  .../LoongArch64CpuMmuLib/TlbOperation.S       |   44 +
>>  .../LoongArch64MpInitLib/DxeMpInitLib.inf     |   45 +
>>  .../LoongArch64MpInitLib/DxeMpInitLib.uni     |   15 +
>>  .../Library/LoongArch64MpInitLib/DxeMpLib.c   |  481 +++++
>>  .../Library/LoongArch64MpInitLib/MpLib.c      | 1596 +++++++++++++++++
>>  .../Library/LoongArch64MpInitLib/MpLib.h      |  361 ++++
>>  .../LoongArch64MpInitLib/PeiMpInitLib.inf     |   37 +
>>  .../LoongArch64MpInitLib/PeiMpInitLib.uni     |   15 +
>>  .../Library/LoongArch64MpInitLib/PeiMpLib.c   |  404 +++++
>>  UefiCpuPkg/UefiCpuPkg.dec                     |   10 +
>>  UefiCpuPkg/UefiCpuPkg.dsc                     |   10 +
>>  127 files changed, 18478 insertions(+), 84 deletions(-)
>>  create mode 100644 MdePkg/Include/Register/LoongArch64/Cpucfg.h
>>  create mode 100644 MdePkg/Include/Register/LoongArch64/Csr.h
>>  create mode 100644 MdePkg/Library/BaseCpuLib/LoongArch/DisableFpu.S
>>  create mode 100644 MdePkg/Library/BaseCpuLib/LoongArch/EnableFpu.S
>>  create mode 100644 MdePkg/Library/BaseCpuLib/LoongArch/InitializeFpu.S
>>  create mode 100644 MdePkg/Library/BaseLib/LoongArch64/AsmCsr.S
>>  create mode 100644 MdePkg/Library/BaseLib/LoongArch64/Cpucfg.S
>>  create mode 100644 MdePkg/Library/BaseLib/LoongArch64/Csr.c
>>  create mode 100644 MdePkg/Library/BaseLib/LoongArch64/ExceptionBase.S
>>  create mode 100644 MdePkg/Library/BaseLib/LoongArch64/IoCsr.S
>>  create mode 100644 MdePkg/Library/BaseLib/LoongArch64/ReadStableCounter.S
>>  create mode 100644 
>> OvmfPkg/LoongArchVirt/Drivers/PciCpuIo2Dxe/PciCpuIo2Dxe.c
>>  create mode 100644 
>> OvmfPkg/LoongArchVirt/Drivers/PciCpuIo2Dxe/PciCpuIo2Dxe.inf
>>  create mode 100644 OvmfPkg/LoongArchVirt/Drivers/StableTimerDxe/Timer.c
>>  create mode 100644 OvmfPkg/LoongArchVirt/Drivers/StableTimerDxe/Timer.h
>>  create mode 100644 
>> OvmfPkg/LoongArchVirt/Drivers/StableTimerDxe/TimerDxe.inf
>>  create mode 100644 
>> OvmfPkg/LoongArchVirt/Library/CollectApResouceLibNull/CollectApResourceLibNull.c
>>  create mode 100644 
>> OvmfPkg/LoongArchVirt/Library/CollectApResouceLibNull/CollectApResourceLibNull.inf
>>  create mode 100644 
>> OvmfPkg/LoongArchVirt/Library/CollectApResouceLibNull/CollectApResourceLibNull.uni
>>  create mode 100644 
>> OvmfPkg/LoongArchVirt/Library/EarlyFdtSerialPortLib16550/EarlyFdtSerialPortLib16550.c
>>  create mode 100644 
>> OvmfPkg/LoongArchVirt/Library/EarlyFdtSerialPortLib16550/EarlyFdtSerialPortLib16550.inf
>>  create mode 100644 
>> OvmfPkg/LoongArchVirt/Library/Fdt16550SerialPortHookLib/EarlyFdt16550SerialPortHookLib.c
>>  create mode 100644 
>> OvmfPkg/LoongArchVirt/Library/Fdt16550SerialPortHookLib/EarlyFdt16550SerialPortHookLib.inf
>>  create mode 100644 
>> OvmfPkg/LoongArchVirt/Library/Fdt16550SerialPortHookLib/Fdt16550SerialPortHookLib.c
>>  create mode 100644 
>> OvmfPkg/LoongArchVirt/Library/Fdt16550SerialPortHookLib/Fdt16550SerialPortHookLib.inf
>>  create mode 100644 
>> OvmfPkg/LoongArchVirt/Library/Fdt16550SerialPortHookLib/Fdt16550SerialPortHookLib.uni
>>  create mode 100644 
>> OvmfPkg/LoongArchVirt/Library/FdtQemuFwCfgLib/FdtQemuFwCfgPeiLib.c
>>  create mode 100644 
>> OvmfPkg/LoongArchVirt/Library/FdtQemuFwCfgLib/FdtQemuFwCfgPeiLib.inf
>>  create mode 100644 
>> OvmfPkg/LoongArchVirt/Library/FdtQemuFwCfgLib/QemuFwCfgLibInternal.h
>>  create mode 100644 
>> OvmfPkg/LoongArchVirt/Library/FdtQemuFwCfgLib/QemuFwCfgPei.c
>>  create mode 100644 
>> OvmfPkg/LoongArchVirt/Library/LsRealTimeClockLib/DxeLsRealTimeClockLib.c
>>  create mode 100644 
>> OvmfPkg/LoongArchVirt/Library/LsRealTimeClockLib/DxeLsRealTimeClockLib.inf
>>  create mode 100644 
>> OvmfPkg/LoongArchVirt/Library/LsRealTimeClockLib/LsRealTimeClock.h
>>  create mode 100644 
>> OvmfPkg/LoongArchVirt/Library/LsRealTimeClockLib/PeiLsRealTimeClockLib.c
>>  create mode 100644 
>> OvmfPkg/LoongArchVirt/Library/LsRealTimeClockLib/PeiLsRealTimeClockLib.inf
>>  create mode 100644 
>> OvmfPkg/LoongArchVirt/Library/NorFlashQemuLib/NorFlashQemuLib.c
>>  create mode 100644 
>> OvmfPkg/LoongArchVirt/Library/NorFlashQemuLib/NorFlashQemuLib.inf
>>  create mode 100644 
>> OvmfPkg/LoongArchVirt/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c
>>  create mode 100644 
>> OvmfPkg/LoongArchVirt/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf
>>  create mode 100644 
>> OvmfPkg/LoongArchVirt/Library/PlatformBootManagerLib/PlatformBm.c
>>  create mode 100644 
>> OvmfPkg/LoongArchVirt/Library/PlatformBootManagerLib/PlatformBm.h
>>  create mode 100644 
>> OvmfPkg/LoongArchVirt/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
>>  create mode 100644 
>> OvmfPkg/LoongArchVirt/Library/PlatformBootManagerLib/QemuKernel.c
>>  create mode 100644 
>> OvmfPkg/LoongArchVirt/Library/ResetSystemAcpiLib/BaseResetSystemAcpiGed.c
>>  create mode 100644 
>> OvmfPkg/LoongArchVirt/Library/ResetSystemAcpiLib/BaseResetSystemAcpiGedLib.inf
>>  create mode 100644 
>> OvmfPkg/LoongArchVirt/Library/ResetSystemAcpiLib/DxeResetSystemAcpiGed.c
>>  create mode 100644 
>> OvmfPkg/LoongArchVirt/Library/ResetSystemAcpiLib/DxeResetSystemAcpiGedLib.inf
>>  create mode 100644 
>> OvmfPkg/LoongArchVirt/Library/ResetSystemAcpiLib/ResetSystemAcpiGed.c
>>  create mode 100644 
>> OvmfPkg/LoongArchVirt/Library/ResetSystemAcpiLib/ResetSystemAcpiGed.h
>>  create mode 100644 OvmfPkg/LoongArchVirt/LoongArchVirt.fdf.inc
>>  create mode 100644 OvmfPkg/LoongArchVirt/LoongArchVirtQemu.dsc
>>  create mode 100644 OvmfPkg/LoongArchVirt/LoongArchVirtQemu.fdf
>>  create mode 100644 OvmfPkg/LoongArchVirt/PlatformPei/Fv.c
>>  create mode 100644 OvmfPkg/LoongArchVirt/PlatformPei/MemDetect.c
>>  create mode 100644 OvmfPkg/LoongArchVirt/PlatformPei/Platform.c
>>  create mode 100644 OvmfPkg/LoongArchVirt/PlatformPei/Platform.h
>>  create mode 100644 OvmfPkg/LoongArchVirt/PlatformPei/PlatformPei.inf
>>  create mode 100644 OvmfPkg/LoongArchVirt/Sec/LoongArch64/Start.S
>>  create mode 100644 OvmfPkg/LoongArchVirt/Sec/SecMain.c
>>  create mode 100644 OvmfPkg/LoongArchVirt/Sec/SecMain.inf
>>  create mode 100644 OvmfPkg/LoongArchVirt/VarStore.fdf.inc
>>  create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.c
>>  create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.h
>>  create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.inf
>>  create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.uni
>>  create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/CpuMp.c
>>  create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/CpuMp.h
>>  create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/Exception.c
>>  create mode 100644 UefiCpuPkg/Include/Library/CpuMmuLib.h
>>  create mode 100644 
>> UefiCpuPkg/Library/BaseLoongArch64CpuTimerLib/BaseLoongArch64CpuTimerLib.inf
>>  create mode 100644 
>> UefiCpuPkg/Library/BaseLoongArch64CpuTimerLib/BaseLoongArch64CpuTimerLib.uni
>>  create mode 100644 
>> UefiCpuPkg/Library/BaseLoongArch64CpuTimerLib/CpuTimerLib.c
>>  create mode 100644 
>> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
>>  create mode 100644 
>> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.uni
>>  create mode 100644 
>> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/DxeExceptionLib.c
>>  create mode 100644 
>> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/ExceptionCommon.c
>>  create mode 100644 
>> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/ExceptionCommon.h
>>  create mode 100644 
>> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/LoongArch64/ArchExceptionHandler.c
>>  create mode 100644 
>> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/LoongArch64/ExceptionHandlerAsm.S
>>  create mode 100644 
>> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
>>  create mode 100644 
>> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.uni
>>  create mode 100644 
>> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/SecPeiExceptionLib.c
>>  create mode 100644 UefiCpuPkg/Library/LoongArch64CpuMmuLib/CommonMmuLib.c
>>  create mode 100644 UefiCpuPkg/Library/LoongArch64CpuMmuLib/CommonMmuLib.h
>>  create mode 100644 
>> UefiCpuPkg/Library/LoongArch64CpuMmuLib/DxeCpuMmuLib.inf
>>  create mode 100644 
>> UefiCpuPkg/Library/LoongArch64CpuMmuLib/DxeCpuMmuLib.uni
>>  create mode 100644 UefiCpuPkg/Library/LoongArch64CpuMmuLib/Page.h
>>  create mode 100644 UefiCpuPkg/Library/LoongArch64CpuMmuLib/PeiCpuMmuLib.c
>>  create mode 100644 
>> UefiCpuPkg/Library/LoongArch64CpuMmuLib/PeiCpuMmuLib.inf
>>  create mode 100644 
>> UefiCpuPkg/Library/LoongArch64CpuMmuLib/PeiCpuMmuLib.uni
>>  create mode 100644 UefiCpuPkg/Library/LoongArch64CpuMmuLib/Tlb.h
>>  create mode 100644 UefiCpuPkg/Library/LoongArch64CpuMmuLib/TlbOperation.S
>>  create mode 100644 
>> UefiCpuPkg/Library/LoongArch64MpInitLib/DxeMpInitLib.inf
>>  create mode 100644 
>> UefiCpuPkg/Library/LoongArch64MpInitLib/DxeMpInitLib.uni
>>  create mode 100644 UefiCpuPkg/Library/LoongArch64MpInitLib/DxeMpLib.c
>>  create mode 100644 UefiCpuPkg/Library/LoongArch64MpInitLib/MpLib.c
>>  create mode 100644 UefiCpuPkg/Library/LoongArch64MpInitLib/MpLib.h
>>  create mode 100644 
>> UefiCpuPkg/Library/LoongArch64MpInitLib/PeiMpInitLib.inf
>>  create mode 100644 
>> UefiCpuPkg/Library/LoongArch64MpInitLib/PeiMpInitLib.uni
>>  create mode 100644 UefiCpuPkg/Library/LoongArch64MpInitLib/PeiMpLib.c
>>
> 



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



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [edk2-devel] [PATCH v1 00/29] Enable LoongArch virtual machine in edk2
  2023-11-03  7:51     ` maobibo
@ 2023-11-03  8:09       ` Chao Li
  2023-11-03  8:16         ` maobibo
  0 siblings, 1 reply; 9+ messages in thread
From: Chao Li @ 2023-11-03  8:09 UTC (permalink / raw)
  To: maobibo, devel, ray.ni
  Cc: Kinney, Michael D, Gao, Liming, Liu, Zhiguang, Dong, Eric,
	Kumar, Rahul R, Gerd Hoffmann, Leif Lindholm, Ard Biesheuvel,
	Abner Chang, Daniel Schaefer, Sami Mujawar, Yao, Jiewen,
	Justen, Jordan L

[-- Attachment #1: Type: text/plain, Size: 24642 bytes --]

Hi Bibo,

Yes, you are right, MpInitLib is most used on the physical machines, but 
in LoongArch, this library is a public library, so it is the minimum 
requirement that it can worke on physical machines and virtual machines. 
This library has been tested on the actual and virtual machines to 
ensure it works right.


Thanks,
Chao
在 2023/11/3 15:51, maobibo 写道:
>
>
> On 2023/11/3 下午3:08, Chao Li wrote:
>> Hi Ray,
>>
>> Thanks for review.
>>
>>
>> I think the MpInitLib is necessary, because this library will serve 
>> PEI and DEX phases. In LoongArch, the MP initialization function will 
>> be  called first in the PEI phase. It will wake up all of AP, collect 
>> accurate online cores, and all APs will fill in their self 
>> information to prepare for next wakeup.
>>
>> The second time the MP initialization function is called will in DXE 
>> phase, usually located CpuDxe, I guess you are checked this code. 
>> This time the MP service HOB will be brought from PEI to DXE phase, 
>> and the MP protocal will be registered to prepare for service DXE phase.
>>
>> Like you saied, why not use the MP PPI? I think it's just that the 
>> code hasn't been added yet, and I think LoongArch will definitely 
>> need the MP PPI in the future, like memory trainning, configure APs 
>> local registers, etc.
>
> It is necessary for physical machine like memory trainning/configure 
> APs local register etc, however I doubt whether it is useful for 
> LoongArch virt-machine, I do not see the advantages for wakeup APs in 
> UEFI BIOS. ACPI FADT table is prepared in qemu side rather than BIOS 
> side.
>
> Regards
> Bibo Mao
>>
>>
>> Thanks,
>> Chao
>> 在 2023/11/3 13:10, Ni, Ray 写道:
>>> Chao,
>>> MpInitLib is to avoid code duplication between CpuMpPeim and CpuDxe.
>>> If you only need MP protocol but not MP PPI, do you still need to 
>>> add MpInitLib?
>>> Can MpInitLib code be included in CpuDxe folder?
>>>
>>> Thanks,
>>> Ray
>>> ------------------------------------------------------------------------ 
>>>
>>> *From:* Chao Li <lichao@loongson.cn>
>>> *Sent:* Friday, November 3, 2023 9:03 AM
>>> *To:* devel@edk2.groups.io <devel@edk2.groups.io>
>>> *Cc:* Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming 
>>> <gaoliming@byosoft.com.cn>; Liu, Zhiguang <zhiguang.liu@intel.com>; 
>>> Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Kumar, 
>>> Rahul R <rahul.r.kumar@intel.com>; Gerd Hoffmann 
>>> <kraxel@redhat.com>; Leif Lindholm <quic_llindhol@quicinc.com>; Ard 
>>> Biesheuvel <ardb+tianocore@kernel.org>; Abner Chang 
>>> <abner.chang@amd.com>; Daniel Schaefer <git@danielschaefer.me>; Sami 
>>> Mujawar <sami.mujawar@arm.com>; Yao, Jiewen <jiewen.yao@intel.com>; 
>>> Justen, Jordan L <jordan.l.justen@intel.com>
>>> *Subject:* [PATCH v1 00/29] Enable LoongArch virtual machine in edk2
>>> 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.
>>>
>>> Modfied modues: MdePkg, UefiCpuPkg, EmbeddedPkg, ArmVirtPkg, OvmfPkg.
>>>
>>> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4584
>>>
>>> Cc: Michael D Kinney <michael.d.kinney@intel.com>
>>> Cc: Liming Gao <gaoliming@byosoft.com.cn>
>>> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
>>> Cc: Eric Dong <eric.dong@intel.com>
>>> Cc: Ray Ni <ray.ni@intel.com>
>>> Cc: Rahul Kumar <rahul1.kumar@intel.com>
>>> Cc: Gerd Hoffmann <kraxel@redhat.com>
>>> Cc: Leif Lindholm <quic_llindhol@quicinc.com>
>>> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
>>> Cc: Abner Chang <abner.chang@amd.com>
>>> Cc: Daniel Schaefer <git@danielschaefer.me>
>>> Cc: Sami Mujawar <sami.mujawar@arm.com>
>>> Cc: Jiewen Yao <jiewen.yao@intel.com>
>>> Cc: Jordan Justen <jordan.l.justen@intel.com>
>>>
>>> Chao Li (29):
>>>   MdePkg: Add the header file named Csr.h for LoongArch64
>>>   MdePkg: Add LoongArch64 FPU function set into BaseCpuLib
>>>   MdePkg: Add LoongArch64 exception function set into BaseLib
>>>   MdePkg: Add LoongArch64 local interrupt function set into BaseLib
>>>   MdePkg: Add LoongArch Cpucfg function
>>>   MdePkg: Add read stable counter operation for LoongArch
>>>   MdePkg: Add CSR operation for LoongArch
>>>   MdePkg: Add IOCSR operation for LoongArch
>>>   UefiCpuPkg: Add LoongArch64 CPU Timer library
>>>   UefiCpuPkg: Add CPU exception library for LoongArch
>>>   UefiCpuPkg: Add CpuMmuLib.h to UefiCpuPkg
>>>   UefiCpuPkg: Add LoongArch64CpuMmuLib to UefiCpuPkg
>>>   UefiCpuPkg: Add multiprocessor library for LoongArch64
>>>   UefiCpuPkg: Add CpuDxe driver for LoongArch64
>>>   EmbeddedPkg: Add PcdPrePiCpuIoSize width for LOONGARCH64
>>>   ArmVirtPkg: Move PCD of FDT base address and FDT padding to OvmfPkg
>>>   OvmfPkg/LoongArchVirt: Add PciCpuIo2Dxe module
>>>   OvmfPkg/LoongArchVirt: Add stable timer driver
>>>   OvmfPkg/LoongArchVirt: Add a NULL library named
>>>     CollectApResouceLibNull
>>>   OvmfPkg/LoongArchVirt: Add serial port library
>>>   OvmfPkg/LoongArchVirt: Add real time clock library
>>>   OvmfPkg/LoongArchVirt: Add NorFlashQemuLib
>>>   OvmfPkg/LoongArchVirt: Add PeiServiceTablePointerLib
>>>   OvmfPkg/LoongArchVirt: Add platform boot manager library
>>>   OvmfPkg/LoongArchVirt: Add FdtQemuFwCfgLib
>>>   OvmfPkg/LoongArchVirt: Add reset system library
>>>   OvmfPkg/LoongArchVirt: Support SEC phase
>>>   OvmfPkg/LoongArchVirt: Support PEI phase
>>>   OvmfPkg/LoongArchVirt: Add build file
>>>
>>>  ArmVirtPkg/ArmVirtCloudHv.dsc                 |    2 +-
>>>  ArmVirtPkg/ArmVirtKvmTool.dsc                 |    2 +-
>>>  ArmVirtPkg/ArmVirtPkg.dec                     |   14 -
>>>  ArmVirtPkg/ArmVirtQemu.dsc                    |    2 +-
>>>  ArmVirtPkg/ArmVirtQemuKernel.dsc              |    2 +-
>>>  ArmVirtPkg/ArmVirtXen.dsc                     |    2 +-
>>>  .../ArmVirtPsciResetSystemPeiLib.inf          |    3 +-
>>>  .../CloudHvVirtMemInfoPeiLib.inf              |    3 +-
>>>  .../DebugLibFdtPL011UartFlash.inf             |    3 +-
>>>  .../EarlyFdt16550SerialPortHookLib.inf        |    3 +-
>>>  .../EarlyFdtPL011SerialPortLib.inf            |    3 +-
>>>  .../KvmtoolPlatformPeiLib.inf                 |    5 +-
>>>  .../Library/PlatformPeiLib/PlatformPeiLib.inf |   10 +-
>>>  .../QemuVirtMemInfoPeiLib.inf                 |    3 +-
>>>  .../PrePi/ArmVirtPrePiUniCoreRelocatable.inf  |    3 +-
>>>  EmbeddedPkg/EmbeddedPkg.dec                   |    3 +
>>>  MdePkg/Include/Library/BaseLib.h              |  221 +++
>>>  MdePkg/Include/Library/CpuLib.h               |   37 +-
>>>  MdePkg/Include/Protocol/DebugSupport.h        |   76 +-
>>>  MdePkg/Include/Register/LoongArch64/Cpucfg.h  |  565 ++++++
>>>  MdePkg/Include/Register/LoongArch64/Csr.h     |  221 +++
>>>  MdePkg/Library/BaseCpuLib/BaseCpuLib.inf      |    7 +-
>>>  .../Library/BaseCpuLib/LoongArch/DisableFpu.S |   17 +
>>>  .../Library/BaseCpuLib/LoongArch/EnableFpu.S  |   17 +
>>>  .../BaseCpuLib/LoongArch/InitializeFpu.S      |   51 +
>>>  MdePkg/Library/BaseLib/BaseLib.inf            |    6 +
>>>  MdePkg/Library/BaseLib/LoongArch64/AsmCsr.S   |  422 +++++
>>>  MdePkg/Library/BaseLib/LoongArch64/Cpucfg.S   |   26 +
>>>  MdePkg/Library/BaseLib/LoongArch64/Csr.c      |   81 +
>>>  .../BaseLib/LoongArch64/DisableInterrupts.S   |   22 +-
>>>  .../BaseLib/LoongArch64/EnableInterrupts.S    |   22 +-
>>>  .../BaseLib/LoongArch64/ExceptionBase.S       |   41 +
>>>  MdePkg/Library/BaseLib/LoongArch64/IoCsr.S    |  120 ++
>>>  .../BaseLib/LoongArch64/ReadStableCounter.S   |   24 +
>>>  MdePkg/MdePkg.ci.yaml                         |    3 +-
>>>  .../Drivers/PciCpuIo2Dxe/PciCpuIo2Dxe.c       |  547 ++++++
>>>  .../Drivers/PciCpuIo2Dxe/PciCpuIo2Dxe.inf     |   45 +
>>>  .../Drivers/StableTimerDxe/Timer.c            |  381 ++++
>>>  .../Drivers/StableTimerDxe/Timer.h            |  127 ++
>>>  .../Drivers/StableTimerDxe/TimerDxe.inf       |   41 +
>>>  .../CollectApResourceLibNull.c                |   35 +
>>>  .../CollectApResourceLibNull.inf              |   32 +
>>>  .../CollectApResourceLibNull.uni              |    9 +
>>>  .../EarlyFdtSerialPortLib16550.c              |  824 +++++++++
>>>  .../EarlyFdtSerialPortLib16550.inf            |   47 +
>>>  .../EarlyFdt16550SerialPortHookLib.c          |  136 ++
>>>  .../EarlyFdt16550SerialPortHookLib.inf        |   36 +
>>>  .../Fdt16550SerialPortHookLib.c               |   41 +
>>>  .../Fdt16550SerialPortHookLib.inf             |   33 +
>>>  .../Fdt16550SerialPortHookLib.uni             |   13 +
>>>  .../FdtQemuFwCfgLib/FdtQemuFwCfgPeiLib.c      |  505 ++++++
>>>  .../FdtQemuFwCfgLib/FdtQemuFwCfgPeiLib.inf    |   42 +
>>>  .../FdtQemuFwCfgLib/QemuFwCfgLibInternal.h    |   73 +
>>>  .../Library/FdtQemuFwCfgLib/QemuFwCfgPei.c    |  117 ++
>>>  .../DxeLsRealTimeClockLib.c                   |  333 ++++
>>>  .../DxeLsRealTimeClockLib.inf                 |   42 +
>>>  .../LsRealTimeClockLib/LsRealTimeClock.h      |   47 +
>>>  .../PeiLsRealTimeClockLib.c                   |   31 +
>>>  .../PeiLsRealTimeClockLib.inf                 |   29 +
>>>  .../Library/NorFlashQemuLib/NorFlashQemuLib.c |  140 ++
>>>  .../NorFlashQemuLib/NorFlashQemuLib.inf       |   43 +
>>>  .../PeiServicesTablePointer.c                 |   75 +
>>>  .../PeiServicesTablePointerLib.inf            |   31 +
>>>  .../PlatformBootManagerLib/PlatformBm.c       |  829 +++++++++
>>>  .../PlatformBootManagerLib/PlatformBm.h       |  112 ++
>>>  .../PlatformBootManagerLib.inf                |   73 +
>>>  .../PlatformBootManagerLib/QemuKernel.c       |   81 +
>>>  .../BaseResetSystemAcpiGed.c                  |  148 ++
>>>  .../BaseResetSystemAcpiGedLib.inf             |   37 +
>>>  .../DxeResetSystemAcpiGed.c                   |  259 +++
>>>  .../DxeResetSystemAcpiGedLib.inf              |   41 +
>>>  .../ResetSystemAcpiLib/ResetSystemAcpiGed.c   |  128 ++
>>>  .../ResetSystemAcpiLib/ResetSystemAcpiGed.h   |   23 +
>>>  OvmfPkg/LoongArchVirt/LoongArchVirt.fdf.inc   |   34 +
>>>  OvmfPkg/LoongArchVirt/LoongArchVirtQemu.dsc   |  675 +++++++
>>>  OvmfPkg/LoongArchVirt/LoongArchVirtQemu.fdf   |  313 ++++
>>>  OvmfPkg/LoongArchVirt/PlatformPei/Fv.c        |   40 +
>>>  OvmfPkg/LoongArchVirt/PlatformPei/MemDetect.c |  203 +++
>>>  OvmfPkg/LoongArchVirt/PlatformPei/Platform.c  |  393 ++++
>>>  OvmfPkg/LoongArchVirt/PlatformPei/Platform.h  |  128 ++
>>>  .../LoongArchVirt/PlatformPei/PlatformPei.inf |   72 +
>>>  OvmfPkg/LoongArchVirt/Sec/LoongArch64/Start.S |  176 ++
>>>  OvmfPkg/LoongArchVirt/Sec/SecMain.c           |  507 ++++++
>>>  OvmfPkg/LoongArchVirt/Sec/SecMain.inf         |   53 +
>>>  OvmfPkg/LoongArchVirt/VarStore.fdf.inc        |   67 +
>>>  OvmfPkg/OvmfPkg.dec                           |   15 +
>>>  UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.c         |  440 +++++
>>>  UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.h         |  261 +++
>>>  UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.inf       |   60 +
>>>  UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.uni       |   15 +
>>>  UefiCpuPkg/CpuDxeLoongArch64/CpuMp.c          |  544 ++++++
>>>  UefiCpuPkg/CpuDxeLoongArch64/CpuMp.h          |  471 +++++
>>>  UefiCpuPkg/CpuDxeLoongArch64/Exception.c      |  150 ++
>>>  UefiCpuPkg/Include/Library/CpuMmuLib.h        |  194 ++
>>>  .../BaseLoongArch64CpuTimerLib.inf            |   30 +
>>>  .../BaseLoongArch64CpuTimerLib.uni            |   15 +
>>>  .../BaseLoongArch64CpuTimerLib/CpuTimerLib.c  |  226 +++
>>>  .../DxeCpuExceptionHandlerLib.inf             |   45 +
>>>  .../DxeCpuExceptionHandlerLib.uni             |   15 +
>>>  .../DxeExceptionLib.c                         |  202 +++
>>>  .../ExceptionCommon.c                         |  170 ++
>>>  .../ExceptionCommon.h                         |  111 ++
>>>  .../LoongArch64/ArchExceptionHandler.c        |  214 +++
>>>  .../LoongArch64/ExceptionHandlerAsm.S         |  320 ++++
>>>  .../SecPeiCpuExceptionHandlerLib.inf          |   45 +
>>>  .../SecPeiCpuExceptionHandlerLib.uni          |   15 +
>>>  .../SecPeiExceptionLib.c                      |   90 +
>>>  .../LoongArch64CpuMmuLib/CommonMmuLib.c       |  963 ++++++++++
>>>  .../LoongArch64CpuMmuLib/CommonMmuLib.h       |   43 +
>>>  .../LoongArch64CpuMmuLib/DxeCpuMmuLib.inf     |   37 +
>>>  .../LoongArch64CpuMmuLib/DxeCpuMmuLib.uni     |   14 +
>>>  .../Library/LoongArch64CpuMmuLib/Page.h       |  279 +++
>>>  .../LoongArch64CpuMmuLib/PeiCpuMmuLib.c       |  165 ++
>>>  .../LoongArch64CpuMmuLib/PeiCpuMmuLib.inf     |   44 +
>>>  .../LoongArch64CpuMmuLib/PeiCpuMmuLib.uni     |   14 +
>>>  UefiCpuPkg/Library/LoongArch64CpuMmuLib/Tlb.h |   48 +
>>>  .../LoongArch64CpuMmuLib/TlbOperation.S       |   44 +
>>>  .../LoongArch64MpInitLib/DxeMpInitLib.inf     |   45 +
>>>  .../LoongArch64MpInitLib/DxeMpInitLib.uni     |   15 +
>>>  .../Library/LoongArch64MpInitLib/DxeMpLib.c   |  481 +++++
>>>  .../Library/LoongArch64MpInitLib/MpLib.c      | 1596 +++++++++++++++++
>>>  .../Library/LoongArch64MpInitLib/MpLib.h      |  361 ++++
>>>  .../LoongArch64MpInitLib/PeiMpInitLib.inf     |   37 +
>>>  .../LoongArch64MpInitLib/PeiMpInitLib.uni     |   15 +
>>>  .../Library/LoongArch64MpInitLib/PeiMpLib.c   |  404 +++++
>>>  UefiCpuPkg/UefiCpuPkg.dec                     |   10 +
>>>  UefiCpuPkg/UefiCpuPkg.dsc                     |   10 +
>>>  127 files changed, 18478 insertions(+), 84 deletions(-)
>>>  create mode 100644 MdePkg/Include/Register/LoongArch64/Cpucfg.h
>>>  create mode 100644 MdePkg/Include/Register/LoongArch64/Csr.h
>>>  create mode 100644 MdePkg/Library/BaseCpuLib/LoongArch/DisableFpu.S
>>>  create mode 100644 MdePkg/Library/BaseCpuLib/LoongArch/EnableFpu.S
>>>  create mode 100644 MdePkg/Library/BaseCpuLib/LoongArch/InitializeFpu.S
>>>  create mode 100644 MdePkg/Library/BaseLib/LoongArch64/AsmCsr.S
>>>  create mode 100644 MdePkg/Library/BaseLib/LoongArch64/Cpucfg.S
>>>  create mode 100644 MdePkg/Library/BaseLib/LoongArch64/Csr.c
>>>  create mode 100644 MdePkg/Library/BaseLib/LoongArch64/ExceptionBase.S
>>>  create mode 100644 MdePkg/Library/BaseLib/LoongArch64/IoCsr.S
>>>  create mode 100644 
>>> MdePkg/Library/BaseLib/LoongArch64/ReadStableCounter.S
>>>  create mode 100644 
>>> OvmfPkg/LoongArchVirt/Drivers/PciCpuIo2Dxe/PciCpuIo2Dxe.c
>>>  create mode 100644 
>>> OvmfPkg/LoongArchVirt/Drivers/PciCpuIo2Dxe/PciCpuIo2Dxe.inf
>>>  create mode 100644 
>>> OvmfPkg/LoongArchVirt/Drivers/StableTimerDxe/Timer.c
>>>  create mode 100644 
>>> OvmfPkg/LoongArchVirt/Drivers/StableTimerDxe/Timer.h
>>>  create mode 100644 
>>> OvmfPkg/LoongArchVirt/Drivers/StableTimerDxe/TimerDxe.inf
>>>  create mode 100644 
>>> OvmfPkg/LoongArchVirt/Library/CollectApResouceLibNull/CollectApResourceLibNull.c
>>>  create mode 100644 
>>> OvmfPkg/LoongArchVirt/Library/CollectApResouceLibNull/CollectApResourceLibNull.inf
>>>  create mode 100644 
>>> OvmfPkg/LoongArchVirt/Library/CollectApResouceLibNull/CollectApResourceLibNull.uni
>>>  create mode 100644 
>>> OvmfPkg/LoongArchVirt/Library/EarlyFdtSerialPortLib16550/EarlyFdtSerialPortLib16550.c
>>>  create mode 100644 
>>> OvmfPkg/LoongArchVirt/Library/EarlyFdtSerialPortLib16550/EarlyFdtSerialPortLib16550.inf
>>>  create mode 100644 
>>> OvmfPkg/LoongArchVirt/Library/Fdt16550SerialPortHookLib/EarlyFdt16550SerialPortHookLib.c
>>>  create mode 100644 
>>> OvmfPkg/LoongArchVirt/Library/Fdt16550SerialPortHookLib/EarlyFdt16550SerialPortHookLib.inf
>>>  create mode 100644 
>>> OvmfPkg/LoongArchVirt/Library/Fdt16550SerialPortHookLib/Fdt16550SerialPortHookLib.c
>>>  create mode 100644 
>>> OvmfPkg/LoongArchVirt/Library/Fdt16550SerialPortHookLib/Fdt16550SerialPortHookLib.inf
>>>  create mode 100644 
>>> OvmfPkg/LoongArchVirt/Library/Fdt16550SerialPortHookLib/Fdt16550SerialPortHookLib.uni
>>>  create mode 100644 
>>> OvmfPkg/LoongArchVirt/Library/FdtQemuFwCfgLib/FdtQemuFwCfgPeiLib.c
>>>  create mode 100644 
>>> OvmfPkg/LoongArchVirt/Library/FdtQemuFwCfgLib/FdtQemuFwCfgPeiLib.inf
>>>  create mode 100644 
>>> OvmfPkg/LoongArchVirt/Library/FdtQemuFwCfgLib/QemuFwCfgLibInternal.h
>>>  create mode 100644 
>>> OvmfPkg/LoongArchVirt/Library/FdtQemuFwCfgLib/QemuFwCfgPei.c
>>>  create mode 100644 
>>> OvmfPkg/LoongArchVirt/Library/LsRealTimeClockLib/DxeLsRealTimeClockLib.c 
>>>
>>>  create mode 100644 
>>> OvmfPkg/LoongArchVirt/Library/LsRealTimeClockLib/DxeLsRealTimeClockLib.inf
>>>  create mode 100644 
>>> OvmfPkg/LoongArchVirt/Library/LsRealTimeClockLib/LsRealTimeClock.h
>>>  create mode 100644 
>>> OvmfPkg/LoongArchVirt/Library/LsRealTimeClockLib/PeiLsRealTimeClockLib.c 
>>>
>>>  create mode 100644 
>>> OvmfPkg/LoongArchVirt/Library/LsRealTimeClockLib/PeiLsRealTimeClockLib.inf
>>>  create mode 100644 
>>> OvmfPkg/LoongArchVirt/Library/NorFlashQemuLib/NorFlashQemuLib.c
>>>  create mode 100644 
>>> OvmfPkg/LoongArchVirt/Library/NorFlashQemuLib/NorFlashQemuLib.inf
>>>  create mode 100644 
>>> OvmfPkg/LoongArchVirt/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c
>>>  create mode 100644 
>>> OvmfPkg/LoongArchVirt/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf
>>>  create mode 100644 
>>> OvmfPkg/LoongArchVirt/Library/PlatformBootManagerLib/PlatformBm.c
>>>  create mode 100644 
>>> OvmfPkg/LoongArchVirt/Library/PlatformBootManagerLib/PlatformBm.h
>>>  create mode 100644 
>>> OvmfPkg/LoongArchVirt/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
>>>  create mode 100644 
>>> OvmfPkg/LoongArchVirt/Library/PlatformBootManagerLib/QemuKernel.c
>>>  create mode 100644 
>>> OvmfPkg/LoongArchVirt/Library/ResetSystemAcpiLib/BaseResetSystemAcpiGed.c
>>>  create mode 100644 
>>> OvmfPkg/LoongArchVirt/Library/ResetSystemAcpiLib/BaseResetSystemAcpiGedLib.inf
>>>  create mode 100644 
>>> OvmfPkg/LoongArchVirt/Library/ResetSystemAcpiLib/DxeResetSystemAcpiGed.c 
>>>
>>>  create mode 100644 
>>> OvmfPkg/LoongArchVirt/Library/ResetSystemAcpiLib/DxeResetSystemAcpiGedLib.inf
>>>  create mode 100644 
>>> OvmfPkg/LoongArchVirt/Library/ResetSystemAcpiLib/ResetSystemAcpiGed.c
>>>  create mode 100644 
>>> OvmfPkg/LoongArchVirt/Library/ResetSystemAcpiLib/ResetSystemAcpiGed.h
>>>  create mode 100644 OvmfPkg/LoongArchVirt/LoongArchVirt.fdf.inc
>>>  create mode 100644 OvmfPkg/LoongArchVirt/LoongArchVirtQemu.dsc
>>>  create mode 100644 OvmfPkg/LoongArchVirt/LoongArchVirtQemu.fdf
>>>  create mode 100644 OvmfPkg/LoongArchVirt/PlatformPei/Fv.c
>>>  create mode 100644 OvmfPkg/LoongArchVirt/PlatformPei/MemDetect.c
>>>  create mode 100644 OvmfPkg/LoongArchVirt/PlatformPei/Platform.c
>>>  create mode 100644 OvmfPkg/LoongArchVirt/PlatformPei/Platform.h
>>>  create mode 100644 OvmfPkg/LoongArchVirt/PlatformPei/PlatformPei.inf
>>>  create mode 100644 OvmfPkg/LoongArchVirt/Sec/LoongArch64/Start.S
>>>  create mode 100644 OvmfPkg/LoongArchVirt/Sec/SecMain.c
>>>  create mode 100644 OvmfPkg/LoongArchVirt/Sec/SecMain.inf
>>>  create mode 100644 OvmfPkg/LoongArchVirt/VarStore.fdf.inc
>>>  create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.c
>>>  create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.h
>>>  create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.inf
>>>  create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.uni
>>>  create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/CpuMp.c
>>>  create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/CpuMp.h
>>>  create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/Exception.c
>>>  create mode 100644 UefiCpuPkg/Include/Library/CpuMmuLib.h
>>>  create mode 100644 
>>> UefiCpuPkg/Library/BaseLoongArch64CpuTimerLib/BaseLoongArch64CpuTimerLib.inf
>>>  create mode 100644 
>>> UefiCpuPkg/Library/BaseLoongArch64CpuTimerLib/BaseLoongArch64CpuTimerLib.uni
>>>  create mode 100644 
>>> UefiCpuPkg/Library/BaseLoongArch64CpuTimerLib/CpuTimerLib.c
>>>  create mode 100644 
>>> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
>>>  create mode 100644 
>>> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.uni
>>>  create mode 100644 
>>> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/DxeExceptionLib.c
>>>  create mode 100644 
>>> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/ExceptionCommon.c
>>>  create mode 100644 
>>> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/ExceptionCommon.h
>>>  create mode 100644 
>>> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/LoongArch64/ArchExceptionHandler.c
>>>  create mode 100644 
>>> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/LoongArch64/ExceptionHandlerAsm.S
>>>  create mode 100644 
>>> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
>>>  create mode 100644 
>>> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.uni
>>>  create mode 100644 
>>> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/SecPeiExceptionLib.c
>>>  create mode 100644 
>>> UefiCpuPkg/Library/LoongArch64CpuMmuLib/CommonMmuLib.c
>>>  create mode 100644 
>>> UefiCpuPkg/Library/LoongArch64CpuMmuLib/CommonMmuLib.h
>>>  create mode 100644 
>>> UefiCpuPkg/Library/LoongArch64CpuMmuLib/DxeCpuMmuLib.inf
>>>  create mode 100644 
>>> UefiCpuPkg/Library/LoongArch64CpuMmuLib/DxeCpuMmuLib.uni
>>>  create mode 100644 UefiCpuPkg/Library/LoongArch64CpuMmuLib/Page.h
>>>  create mode 100644 
>>> UefiCpuPkg/Library/LoongArch64CpuMmuLib/PeiCpuMmuLib.c
>>>  create mode 100644 
>>> UefiCpuPkg/Library/LoongArch64CpuMmuLib/PeiCpuMmuLib.inf
>>>  create mode 100644 
>>> UefiCpuPkg/Library/LoongArch64CpuMmuLib/PeiCpuMmuLib.uni
>>>  create mode 100644 UefiCpuPkg/Library/LoongArch64CpuMmuLib/Tlb.h
>>>  create mode 100644 
>>> UefiCpuPkg/Library/LoongArch64CpuMmuLib/TlbOperation.S
>>>  create mode 100644 
>>> UefiCpuPkg/Library/LoongArch64MpInitLib/DxeMpInitLib.inf
>>>  create mode 100644 
>>> UefiCpuPkg/Library/LoongArch64MpInitLib/DxeMpInitLib.uni
>>>  create mode 100644 UefiCpuPkg/Library/LoongArch64MpInitLib/DxeMpLib.c
>>>  create mode 100644 UefiCpuPkg/Library/LoongArch64MpInitLib/MpLib.c
>>>  create mode 100644 UefiCpuPkg/Library/LoongArch64MpInitLib/MpLib.h
>>>  create mode 100644 
>>> UefiCpuPkg/Library/LoongArch64MpInitLib/PeiMpInitLib.inf
>>>  create mode 100644 
>>> UefiCpuPkg/Library/LoongArch64MpInitLib/PeiMpInitLib.uni
>>>  create mode 100644 UefiCpuPkg/Library/LoongArch64MpInitLib/PeiMpLib.c
>>>
>> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#110616): https://edk2.groups.io/g/devel/message/110616
Mute This Topic: https://groups.io/mt/102355705/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: 35260 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [edk2-devel] [PATCH v1 00/29] Enable LoongArch virtual machine in edk2
  2023-11-03  8:09       ` Chao Li
@ 2023-11-03  8:16         ` maobibo
  0 siblings, 0 replies; 9+ messages in thread
From: maobibo @ 2023-11-03  8:16 UTC (permalink / raw)
  To: Chao Li, devel, ray.ni
  Cc: Kinney, Michael D, Gao, Liming, Liu, Zhiguang, Dong, Eric,
	Kumar, Rahul R, Gerd Hoffmann, Leif Lindholm, Ard Biesheuvel,
	Abner Chang, Daniel Schaefer, Sami Mujawar, Yao, Jiewen,
	Justen, Jordan L



On 2023/11/3 下午4:09, Chao Li wrote:
> Hi Bibo,
> 
> Yes, you are right, MpInitLib is most used on the physical machines, but 
> in LoongArch, this library is a public library, so it is the minimum 
> requirement that it can worke on physical machines and virtual machines. 
> This library has been tested on the actual and virtual machines to 
> ensure it works right.
If so, it is ok for me-:)

Regards
Bibo Mao
> 
> 
> Thanks,
> Chao
> 在 2023/11/3 15:51, maobibo 写道:
>>
>>
>> On 2023/11/3 下午3:08, Chao Li wrote:
>>> Hi Ray,
>>>
>>> Thanks for review.
>>>
>>>
>>> I think the MpInitLib is necessary, because this library will serve 
>>> PEI and DEX phases. In LoongArch, the MP initialization function will 
>>> be  called first in the PEI phase. It will wake up all of AP, collect 
>>> accurate online cores, and all APs will fill in their self 
>>> information to prepare for next wakeup.
>>>
>>> The second time the MP initialization function is called will in DXE 
>>> phase, usually located CpuDxe, I guess you are checked this code. 
>>> This time the MP service HOB will be brought from PEI to DXE phase, 
>>> and the MP protocal will be registered to prepare for service DXE phase.
>>>
>>> Like you saied, why not use the MP PPI? I think it's just that the 
>>> code hasn't been added yet, and I think LoongArch will definitely 
>>> need the MP PPI in the future, like memory trainning, configure APs 
>>> local registers, etc.
>>
>> It is necessary for physical machine like memory trainning/configure 
>> APs local register etc, however I doubt whether it is useful for 
>> LoongArch virt-machine, I do not see the advantages for wakeup APs in 
>> UEFI BIOS. ACPI FADT table is prepared in qemu side rather than BIOS 
>> side.
>>
>> Regards
>> Bibo Mao
>>>
>>>
>>> Thanks,
>>> Chao
>>> 在 2023/11/3 13:10, Ni, Ray 写道:
>>>> Chao,
>>>> MpInitLib is to avoid code duplication between CpuMpPeim and CpuDxe.
>>>> If you only need MP protocol but not MP PPI, do you still need to 
>>>> add MpInitLib?
>>>> Can MpInitLib code be included in CpuDxe folder?
>>>>
>>>> Thanks,
>>>> Ray
>>>> ------------------------------------------------------------------------ 
>>>>
>>>> *From:* Chao Li <lichao@loongson.cn>
>>>> *Sent:* Friday, November 3, 2023 9:03 AM
>>>> *To:* devel@edk2.groups.io <devel@edk2.groups.io>
>>>> *Cc:* Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming 
>>>> <gaoliming@byosoft.com.cn>; Liu, Zhiguang <zhiguang.liu@intel.com>; 
>>>> Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Kumar, 
>>>> Rahul R <rahul.r.kumar@intel.com>; Gerd Hoffmann 
>>>> <kraxel@redhat.com>; Leif Lindholm <quic_llindhol@quicinc.com>; Ard 
>>>> Biesheuvel <ardb+tianocore@kernel.org>; Abner Chang 
>>>> <abner.chang@amd.com>; Daniel Schaefer <git@danielschaefer.me>; Sami 
>>>> Mujawar <sami.mujawar@arm.com>; Yao, Jiewen <jiewen.yao@intel.com>; 
>>>> Justen, Jordan L <jordan.l.justen@intel.com>
>>>> *Subject:* [PATCH v1 00/29] Enable LoongArch virtual machine in edk2
>>>> 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.
>>>>
>>>> Modfied modues: MdePkg, UefiCpuPkg, EmbeddedPkg, ArmVirtPkg, OvmfPkg.
>>>>
>>>> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4584
>>>>
>>>> Cc: Michael D Kinney <michael.d.kinney@intel.com>
>>>> Cc: Liming Gao <gaoliming@byosoft.com.cn>
>>>> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
>>>> Cc: Eric Dong <eric.dong@intel.com>
>>>> Cc: Ray Ni <ray.ni@intel.com>
>>>> Cc: Rahul Kumar <rahul1.kumar@intel.com>
>>>> Cc: Gerd Hoffmann <kraxel@redhat.com>
>>>> Cc: Leif Lindholm <quic_llindhol@quicinc.com>
>>>> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
>>>> Cc: Abner Chang <abner.chang@amd.com>
>>>> Cc: Daniel Schaefer <git@danielschaefer.me>
>>>> Cc: Sami Mujawar <sami.mujawar@arm.com>
>>>> Cc: Jiewen Yao <jiewen.yao@intel.com>
>>>> Cc: Jordan Justen <jordan.l.justen@intel.com>
>>>>
>>>> Chao Li (29):
>>>>   MdePkg: Add the header file named Csr.h for LoongArch64
>>>>   MdePkg: Add LoongArch64 FPU function set into BaseCpuLib
>>>>   MdePkg: Add LoongArch64 exception function set into BaseLib
>>>>   MdePkg: Add LoongArch64 local interrupt function set into BaseLib
>>>>   MdePkg: Add LoongArch Cpucfg function
>>>>   MdePkg: Add read stable counter operation for LoongArch
>>>>   MdePkg: Add CSR operation for LoongArch
>>>>   MdePkg: Add IOCSR operation for LoongArch
>>>>   UefiCpuPkg: Add LoongArch64 CPU Timer library
>>>>   UefiCpuPkg: Add CPU exception library for LoongArch
>>>>   UefiCpuPkg: Add CpuMmuLib.h to UefiCpuPkg
>>>>   UefiCpuPkg: Add LoongArch64CpuMmuLib to UefiCpuPkg
>>>>   UefiCpuPkg: Add multiprocessor library for LoongArch64
>>>>   UefiCpuPkg: Add CpuDxe driver for LoongArch64
>>>>   EmbeddedPkg: Add PcdPrePiCpuIoSize width for LOONGARCH64
>>>>   ArmVirtPkg: Move PCD of FDT base address and FDT padding to OvmfPkg
>>>>   OvmfPkg/LoongArchVirt: Add PciCpuIo2Dxe module
>>>>   OvmfPkg/LoongArchVirt: Add stable timer driver
>>>>   OvmfPkg/LoongArchVirt: Add a NULL library named
>>>>     CollectApResouceLibNull
>>>>   OvmfPkg/LoongArchVirt: Add serial port library
>>>>   OvmfPkg/LoongArchVirt: Add real time clock library
>>>>   OvmfPkg/LoongArchVirt: Add NorFlashQemuLib
>>>>   OvmfPkg/LoongArchVirt: Add PeiServiceTablePointerLib
>>>>   OvmfPkg/LoongArchVirt: Add platform boot manager library
>>>>   OvmfPkg/LoongArchVirt: Add FdtQemuFwCfgLib
>>>>   OvmfPkg/LoongArchVirt: Add reset system library
>>>>   OvmfPkg/LoongArchVirt: Support SEC phase
>>>>   OvmfPkg/LoongArchVirt: Support PEI phase
>>>>   OvmfPkg/LoongArchVirt: Add build file
>>>>
>>>>  ArmVirtPkg/ArmVirtCloudHv.dsc                 |    2 +-
>>>>  ArmVirtPkg/ArmVirtKvmTool.dsc                 |    2 +-
>>>>  ArmVirtPkg/ArmVirtPkg.dec                     |   14 -
>>>>  ArmVirtPkg/ArmVirtQemu.dsc                    |    2 +-
>>>>  ArmVirtPkg/ArmVirtQemuKernel.dsc              |    2 +-
>>>>  ArmVirtPkg/ArmVirtXen.dsc                     |    2 +-
>>>>  .../ArmVirtPsciResetSystemPeiLib.inf          |    3 +-
>>>>  .../CloudHvVirtMemInfoPeiLib.inf              |    3 +-
>>>>  .../DebugLibFdtPL011UartFlash.inf             |    3 +-
>>>>  .../EarlyFdt16550SerialPortHookLib.inf        |    3 +-
>>>>  .../EarlyFdtPL011SerialPortLib.inf            |    3 +-
>>>>  .../KvmtoolPlatformPeiLib.inf                 |    5 +-
>>>>  .../Library/PlatformPeiLib/PlatformPeiLib.inf |   10 +-
>>>>  .../QemuVirtMemInfoPeiLib.inf                 |    3 +-
>>>>  .../PrePi/ArmVirtPrePiUniCoreRelocatable.inf  |    3 +-
>>>>  EmbeddedPkg/EmbeddedPkg.dec                   |    3 +
>>>>  MdePkg/Include/Library/BaseLib.h              |  221 +++
>>>>  MdePkg/Include/Library/CpuLib.h               |   37 +-
>>>>  MdePkg/Include/Protocol/DebugSupport.h        |   76 +-
>>>>  MdePkg/Include/Register/LoongArch64/Cpucfg.h  |  565 ++++++
>>>>  MdePkg/Include/Register/LoongArch64/Csr.h     |  221 +++
>>>>  MdePkg/Library/BaseCpuLib/BaseCpuLib.inf      |    7 +-
>>>>  .../Library/BaseCpuLib/LoongArch/DisableFpu.S |   17 +
>>>>  .../Library/BaseCpuLib/LoongArch/EnableFpu.S  |   17 +
>>>>  .../BaseCpuLib/LoongArch/InitializeFpu.S      |   51 +
>>>>  MdePkg/Library/BaseLib/BaseLib.inf            |    6 +
>>>>  MdePkg/Library/BaseLib/LoongArch64/AsmCsr.S   |  422 +++++
>>>>  MdePkg/Library/BaseLib/LoongArch64/Cpucfg.S   |   26 +
>>>>  MdePkg/Library/BaseLib/LoongArch64/Csr.c      |   81 +
>>>>  .../BaseLib/LoongArch64/DisableInterrupts.S   |   22 +-
>>>>  .../BaseLib/LoongArch64/EnableInterrupts.S    |   22 +-
>>>>  .../BaseLib/LoongArch64/ExceptionBase.S       |   41 +
>>>>  MdePkg/Library/BaseLib/LoongArch64/IoCsr.S    |  120 ++
>>>>  .../BaseLib/LoongArch64/ReadStableCounter.S   |   24 +
>>>>  MdePkg/MdePkg.ci.yaml                         |    3 +-
>>>>  .../Drivers/PciCpuIo2Dxe/PciCpuIo2Dxe.c       |  547 ++++++
>>>>  .../Drivers/PciCpuIo2Dxe/PciCpuIo2Dxe.inf     |   45 +
>>>>  .../Drivers/StableTimerDxe/Timer.c            |  381 ++++
>>>>  .../Drivers/StableTimerDxe/Timer.h            |  127 ++
>>>>  .../Drivers/StableTimerDxe/TimerDxe.inf       |   41 +
>>>>  .../CollectApResourceLibNull.c                |   35 +
>>>>  .../CollectApResourceLibNull.inf              |   32 +
>>>>  .../CollectApResourceLibNull.uni              |    9 +
>>>>  .../EarlyFdtSerialPortLib16550.c              |  824 +++++++++
>>>>  .../EarlyFdtSerialPortLib16550.inf            |   47 +
>>>>  .../EarlyFdt16550SerialPortHookLib.c          |  136 ++
>>>>  .../EarlyFdt16550SerialPortHookLib.inf        |   36 +
>>>>  .../Fdt16550SerialPortHookLib.c               |   41 +
>>>>  .../Fdt16550SerialPortHookLib.inf             |   33 +
>>>>  .../Fdt16550SerialPortHookLib.uni             |   13 +
>>>>  .../FdtQemuFwCfgLib/FdtQemuFwCfgPeiLib.c      |  505 ++++++
>>>>  .../FdtQemuFwCfgLib/FdtQemuFwCfgPeiLib.inf    |   42 +
>>>>  .../FdtQemuFwCfgLib/QemuFwCfgLibInternal.h    |   73 +
>>>>  .../Library/FdtQemuFwCfgLib/QemuFwCfgPei.c    |  117 ++
>>>>  .../DxeLsRealTimeClockLib.c                   |  333 ++++
>>>>  .../DxeLsRealTimeClockLib.inf                 |   42 +
>>>>  .../LsRealTimeClockLib/LsRealTimeClock.h      |   47 +
>>>>  .../PeiLsRealTimeClockLib.c                   |   31 +
>>>>  .../PeiLsRealTimeClockLib.inf                 |   29 +
>>>>  .../Library/NorFlashQemuLib/NorFlashQemuLib.c |  140 ++
>>>>  .../NorFlashQemuLib/NorFlashQemuLib.inf       |   43 +
>>>>  .../PeiServicesTablePointer.c                 |   75 +
>>>>  .../PeiServicesTablePointerLib.inf            |   31 +
>>>>  .../PlatformBootManagerLib/PlatformBm.c       |  829 +++++++++
>>>>  .../PlatformBootManagerLib/PlatformBm.h       |  112 ++
>>>>  .../PlatformBootManagerLib.inf                |   73 +
>>>>  .../PlatformBootManagerLib/QemuKernel.c       |   81 +
>>>>  .../BaseResetSystemAcpiGed.c                  |  148 ++
>>>>  .../BaseResetSystemAcpiGedLib.inf             |   37 +
>>>>  .../DxeResetSystemAcpiGed.c                   |  259 +++
>>>>  .../DxeResetSystemAcpiGedLib.inf              |   41 +
>>>>  .../ResetSystemAcpiLib/ResetSystemAcpiGed.c   |  128 ++
>>>>  .../ResetSystemAcpiLib/ResetSystemAcpiGed.h   |   23 +
>>>>  OvmfPkg/LoongArchVirt/LoongArchVirt.fdf.inc   |   34 +
>>>>  OvmfPkg/LoongArchVirt/LoongArchVirtQemu.dsc   |  675 +++++++
>>>>  OvmfPkg/LoongArchVirt/LoongArchVirtQemu.fdf   |  313 ++++
>>>>  OvmfPkg/LoongArchVirt/PlatformPei/Fv.c        |   40 +
>>>>  OvmfPkg/LoongArchVirt/PlatformPei/MemDetect.c |  203 +++
>>>>  OvmfPkg/LoongArchVirt/PlatformPei/Platform.c  |  393 ++++
>>>>  OvmfPkg/LoongArchVirt/PlatformPei/Platform.h  |  128 ++
>>>>  .../LoongArchVirt/PlatformPei/PlatformPei.inf |   72 +
>>>>  OvmfPkg/LoongArchVirt/Sec/LoongArch64/Start.S |  176 ++
>>>>  OvmfPkg/LoongArchVirt/Sec/SecMain.c           |  507 ++++++
>>>>  OvmfPkg/LoongArchVirt/Sec/SecMain.inf         |   53 +
>>>>  OvmfPkg/LoongArchVirt/VarStore.fdf.inc        |   67 +
>>>>  OvmfPkg/OvmfPkg.dec                           |   15 +
>>>>  UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.c         |  440 +++++
>>>>  UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.h         |  261 +++
>>>>  UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.inf       |   60 +
>>>>  UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.uni       |   15 +
>>>>  UefiCpuPkg/CpuDxeLoongArch64/CpuMp.c          |  544 ++++++
>>>>  UefiCpuPkg/CpuDxeLoongArch64/CpuMp.h          |  471 +++++
>>>>  UefiCpuPkg/CpuDxeLoongArch64/Exception.c      |  150 ++
>>>>  UefiCpuPkg/Include/Library/CpuMmuLib.h        |  194 ++
>>>>  .../BaseLoongArch64CpuTimerLib.inf            |   30 +
>>>>  .../BaseLoongArch64CpuTimerLib.uni            |   15 +
>>>>  .../BaseLoongArch64CpuTimerLib/CpuTimerLib.c  |  226 +++
>>>>  .../DxeCpuExceptionHandlerLib.inf             |   45 +
>>>>  .../DxeCpuExceptionHandlerLib.uni             |   15 +
>>>>  .../DxeExceptionLib.c                         |  202 +++
>>>>  .../ExceptionCommon.c                         |  170 ++
>>>>  .../ExceptionCommon.h                         |  111 ++
>>>>  .../LoongArch64/ArchExceptionHandler.c        |  214 +++
>>>>  .../LoongArch64/ExceptionHandlerAsm.S         |  320 ++++
>>>>  .../SecPeiCpuExceptionHandlerLib.inf          |   45 +
>>>>  .../SecPeiCpuExceptionHandlerLib.uni          |   15 +
>>>>  .../SecPeiExceptionLib.c                      |   90 +
>>>>  .../LoongArch64CpuMmuLib/CommonMmuLib.c       |  963 ++++++++++
>>>>  .../LoongArch64CpuMmuLib/CommonMmuLib.h       |   43 +
>>>>  .../LoongArch64CpuMmuLib/DxeCpuMmuLib.inf     |   37 +
>>>>  .../LoongArch64CpuMmuLib/DxeCpuMmuLib.uni     |   14 +
>>>>  .../Library/LoongArch64CpuMmuLib/Page.h       |  279 +++
>>>>  .../LoongArch64CpuMmuLib/PeiCpuMmuLib.c       |  165 ++
>>>>  .../LoongArch64CpuMmuLib/PeiCpuMmuLib.inf     |   44 +
>>>>  .../LoongArch64CpuMmuLib/PeiCpuMmuLib.uni     |   14 +
>>>>  UefiCpuPkg/Library/LoongArch64CpuMmuLib/Tlb.h |   48 +
>>>>  .../LoongArch64CpuMmuLib/TlbOperation.S       |   44 +
>>>>  .../LoongArch64MpInitLib/DxeMpInitLib.inf     |   45 +
>>>>  .../LoongArch64MpInitLib/DxeMpInitLib.uni     |   15 +
>>>>  .../Library/LoongArch64MpInitLib/DxeMpLib.c   |  481 +++++
>>>>  .../Library/LoongArch64MpInitLib/MpLib.c      | 1596 +++++++++++++++++
>>>>  .../Library/LoongArch64MpInitLib/MpLib.h      |  361 ++++
>>>>  .../LoongArch64MpInitLib/PeiMpInitLib.inf     |   37 +
>>>>  .../LoongArch64MpInitLib/PeiMpInitLib.uni     |   15 +
>>>>  .../Library/LoongArch64MpInitLib/PeiMpLib.c   |  404 +++++
>>>>  UefiCpuPkg/UefiCpuPkg.dec                     |   10 +
>>>>  UefiCpuPkg/UefiCpuPkg.dsc                     |   10 +
>>>>  127 files changed, 18478 insertions(+), 84 deletions(-)
>>>>  create mode 100644 MdePkg/Include/Register/LoongArch64/Cpucfg.h
>>>>  create mode 100644 MdePkg/Include/Register/LoongArch64/Csr.h
>>>>  create mode 100644 MdePkg/Library/BaseCpuLib/LoongArch/DisableFpu.S
>>>>  create mode 100644 MdePkg/Library/BaseCpuLib/LoongArch/EnableFpu.S
>>>>  create mode 100644 MdePkg/Library/BaseCpuLib/LoongArch/InitializeFpu.S
>>>>  create mode 100644 MdePkg/Library/BaseLib/LoongArch64/AsmCsr.S
>>>>  create mode 100644 MdePkg/Library/BaseLib/LoongArch64/Cpucfg.S
>>>>  create mode 100644 MdePkg/Library/BaseLib/LoongArch64/Csr.c
>>>>  create mode 100644 MdePkg/Library/BaseLib/LoongArch64/ExceptionBase.S
>>>>  create mode 100644 MdePkg/Library/BaseLib/LoongArch64/IoCsr.S
>>>>  create mode 100644 
>>>> MdePkg/Library/BaseLib/LoongArch64/ReadStableCounter.S
>>>>  create mode 100644 
>>>> OvmfPkg/LoongArchVirt/Drivers/PciCpuIo2Dxe/PciCpuIo2Dxe.c
>>>>  create mode 100644 
>>>> OvmfPkg/LoongArchVirt/Drivers/PciCpuIo2Dxe/PciCpuIo2Dxe.inf
>>>>  create mode 100644 
>>>> OvmfPkg/LoongArchVirt/Drivers/StableTimerDxe/Timer.c
>>>>  create mode 100644 
>>>> OvmfPkg/LoongArchVirt/Drivers/StableTimerDxe/Timer.h
>>>>  create mode 100644 
>>>> OvmfPkg/LoongArchVirt/Drivers/StableTimerDxe/TimerDxe.inf
>>>>  create mode 100644 
>>>> OvmfPkg/LoongArchVirt/Library/CollectApResouceLibNull/CollectApResourceLibNull.c
>>>>  create mode 100644 
>>>> OvmfPkg/LoongArchVirt/Library/CollectApResouceLibNull/CollectApResourceLibNull.inf
>>>>  create mode 100644 
>>>> OvmfPkg/LoongArchVirt/Library/CollectApResouceLibNull/CollectApResourceLibNull.uni
>>>>  create mode 100644 
>>>> OvmfPkg/LoongArchVirt/Library/EarlyFdtSerialPortLib16550/EarlyFdtSerialPortLib16550.c
>>>>  create mode 100644 
>>>> OvmfPkg/LoongArchVirt/Library/EarlyFdtSerialPortLib16550/EarlyFdtSerialPortLib16550.inf
>>>>  create mode 100644 
>>>> OvmfPkg/LoongArchVirt/Library/Fdt16550SerialPortHookLib/EarlyFdt16550SerialPortHookLib.c
>>>>  create mode 100644 
>>>> OvmfPkg/LoongArchVirt/Library/Fdt16550SerialPortHookLib/EarlyFdt16550SerialPortHookLib.inf
>>>>  create mode 100644 
>>>> OvmfPkg/LoongArchVirt/Library/Fdt16550SerialPortHookLib/Fdt16550SerialPortHookLib.c
>>>>  create mode 100644 
>>>> OvmfPkg/LoongArchVirt/Library/Fdt16550SerialPortHookLib/Fdt16550SerialPortHookLib.inf
>>>>  create mode 100644 
>>>> OvmfPkg/LoongArchVirt/Library/Fdt16550SerialPortHookLib/Fdt16550SerialPortHookLib.uni
>>>>  create mode 100644 
>>>> OvmfPkg/LoongArchVirt/Library/FdtQemuFwCfgLib/FdtQemuFwCfgPeiLib.c
>>>>  create mode 100644 
>>>> OvmfPkg/LoongArchVirt/Library/FdtQemuFwCfgLib/FdtQemuFwCfgPeiLib.inf
>>>>  create mode 100644 
>>>> OvmfPkg/LoongArchVirt/Library/FdtQemuFwCfgLib/QemuFwCfgLibInternal.h
>>>>  create mode 100644 
>>>> OvmfPkg/LoongArchVirt/Library/FdtQemuFwCfgLib/QemuFwCfgPei.c
>>>>  create mode 100644 
>>>> OvmfPkg/LoongArchVirt/Library/LsRealTimeClockLib/DxeLsRealTimeClockLib.c 
>>>>
>>>>  create mode 100644 
>>>> OvmfPkg/LoongArchVirt/Library/LsRealTimeClockLib/DxeLsRealTimeClockLib.inf
>>>>  create mode 100644 
>>>> OvmfPkg/LoongArchVirt/Library/LsRealTimeClockLib/LsRealTimeClock.h
>>>>  create mode 100644 
>>>> OvmfPkg/LoongArchVirt/Library/LsRealTimeClockLib/PeiLsRealTimeClockLib.c 
>>>>
>>>>  create mode 100644 
>>>> OvmfPkg/LoongArchVirt/Library/LsRealTimeClockLib/PeiLsRealTimeClockLib.inf
>>>>  create mode 100644 
>>>> OvmfPkg/LoongArchVirt/Library/NorFlashQemuLib/NorFlashQemuLib.c
>>>>  create mode 100644 
>>>> OvmfPkg/LoongArchVirt/Library/NorFlashQemuLib/NorFlashQemuLib.inf
>>>>  create mode 100644 
>>>> OvmfPkg/LoongArchVirt/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c
>>>>  create mode 100644 
>>>> OvmfPkg/LoongArchVirt/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf
>>>>  create mode 100644 
>>>> OvmfPkg/LoongArchVirt/Library/PlatformBootManagerLib/PlatformBm.c
>>>>  create mode 100644 
>>>> OvmfPkg/LoongArchVirt/Library/PlatformBootManagerLib/PlatformBm.h
>>>>  create mode 100644 
>>>> OvmfPkg/LoongArchVirt/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
>>>>  create mode 100644 
>>>> OvmfPkg/LoongArchVirt/Library/PlatformBootManagerLib/QemuKernel.c
>>>>  create mode 100644 
>>>> OvmfPkg/LoongArchVirt/Library/ResetSystemAcpiLib/BaseResetSystemAcpiGed.c
>>>>  create mode 100644 
>>>> OvmfPkg/LoongArchVirt/Library/ResetSystemAcpiLib/BaseResetSystemAcpiGedLib.inf
>>>>  create mode 100644 
>>>> OvmfPkg/LoongArchVirt/Library/ResetSystemAcpiLib/DxeResetSystemAcpiGed.c 
>>>>
>>>>  create mode 100644 
>>>> OvmfPkg/LoongArchVirt/Library/ResetSystemAcpiLib/DxeResetSystemAcpiGedLib.inf
>>>>  create mode 100644 
>>>> OvmfPkg/LoongArchVirt/Library/ResetSystemAcpiLib/ResetSystemAcpiGed.c
>>>>  create mode 100644 
>>>> OvmfPkg/LoongArchVirt/Library/ResetSystemAcpiLib/ResetSystemAcpiGed.h
>>>>  create mode 100644 OvmfPkg/LoongArchVirt/LoongArchVirt.fdf.inc
>>>>  create mode 100644 OvmfPkg/LoongArchVirt/LoongArchVirtQemu.dsc
>>>>  create mode 100644 OvmfPkg/LoongArchVirt/LoongArchVirtQemu.fdf
>>>>  create mode 100644 OvmfPkg/LoongArchVirt/PlatformPei/Fv.c
>>>>  create mode 100644 OvmfPkg/LoongArchVirt/PlatformPei/MemDetect.c
>>>>  create mode 100644 OvmfPkg/LoongArchVirt/PlatformPei/Platform.c
>>>>  create mode 100644 OvmfPkg/LoongArchVirt/PlatformPei/Platform.h
>>>>  create mode 100644 OvmfPkg/LoongArchVirt/PlatformPei/PlatformPei.inf
>>>>  create mode 100644 OvmfPkg/LoongArchVirt/Sec/LoongArch64/Start.S
>>>>  create mode 100644 OvmfPkg/LoongArchVirt/Sec/SecMain.c
>>>>  create mode 100644 OvmfPkg/LoongArchVirt/Sec/SecMain.inf
>>>>  create mode 100644 OvmfPkg/LoongArchVirt/VarStore.fdf.inc
>>>>  create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.c
>>>>  create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.h
>>>>  create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.inf
>>>>  create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/CpuDxe.uni
>>>>  create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/CpuMp.c
>>>>  create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/CpuMp.h
>>>>  create mode 100644 UefiCpuPkg/CpuDxeLoongArch64/Exception.c
>>>>  create mode 100644 UefiCpuPkg/Include/Library/CpuMmuLib.h
>>>>  create mode 100644 
>>>> UefiCpuPkg/Library/BaseLoongArch64CpuTimerLib/BaseLoongArch64CpuTimerLib.inf
>>>>  create mode 100644 
>>>> UefiCpuPkg/Library/BaseLoongArch64CpuTimerLib/BaseLoongArch64CpuTimerLib.uni
>>>>  create mode 100644 
>>>> UefiCpuPkg/Library/BaseLoongArch64CpuTimerLib/CpuTimerLib.c
>>>>  create mode 100644 
>>>> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
>>>>  create mode 100644 
>>>> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.uni
>>>>  create mode 100644 
>>>> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/DxeExceptionLib.c
>>>>  create mode 100644 
>>>> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/ExceptionCommon.c
>>>>  create mode 100644 
>>>> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/ExceptionCommon.h
>>>>  create mode 100644 
>>>> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/LoongArch64/ArchExceptionHandler.c
>>>>  create mode 100644 
>>>> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/LoongArch64/ExceptionHandlerAsm.S
>>>>  create mode 100644 
>>>> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
>>>>  create mode 100644 
>>>> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.uni
>>>>  create mode 100644 
>>>> UefiCpuPkg/Library/LoongArch64CpuExceptionHandlerLib/SecPeiExceptionLib.c
>>>>  create mode 100644 
>>>> UefiCpuPkg/Library/LoongArch64CpuMmuLib/CommonMmuLib.c
>>>>  create mode 100644 
>>>> UefiCpuPkg/Library/LoongArch64CpuMmuLib/CommonMmuLib.h
>>>>  create mode 100644 
>>>> UefiCpuPkg/Library/LoongArch64CpuMmuLib/DxeCpuMmuLib.inf
>>>>  create mode 100644 
>>>> UefiCpuPkg/Library/LoongArch64CpuMmuLib/DxeCpuMmuLib.uni
>>>>  create mode 100644 UefiCpuPkg/Library/LoongArch64CpuMmuLib/Page.h
>>>>  create mode 100644 
>>>> UefiCpuPkg/Library/LoongArch64CpuMmuLib/PeiCpuMmuLib.c
>>>>  create mode 100644 
>>>> UefiCpuPkg/Library/LoongArch64CpuMmuLib/PeiCpuMmuLib.inf
>>>>  create mode 100644 
>>>> UefiCpuPkg/Library/LoongArch64CpuMmuLib/PeiCpuMmuLib.uni
>>>>  create mode 100644 UefiCpuPkg/Library/LoongArch64CpuMmuLib/Tlb.h
>>>>  create mode 100644 
>>>> UefiCpuPkg/Library/LoongArch64CpuMmuLib/TlbOperation.S
>>>>  create mode 100644 
>>>> UefiCpuPkg/Library/LoongArch64MpInitLib/DxeMpInitLib.inf
>>>>  create mode 100644 
>>>> UefiCpuPkg/Library/LoongArch64MpInitLib/DxeMpInitLib.uni
>>>>  create mode 100644 UefiCpuPkg/Library/LoongArch64MpInitLib/DxeMpLib.c
>>>>  create mode 100644 UefiCpuPkg/Library/LoongArch64MpInitLib/MpLib.c
>>>>  create mode 100644 UefiCpuPkg/Library/LoongArch64MpInitLib/MpLib.h
>>>>  create mode 100644 
>>>> UefiCpuPkg/Library/LoongArch64MpInitLib/PeiMpInitLib.inf
>>>>  create mode 100644 
>>>> UefiCpuPkg/Library/LoongArch64MpInitLib/PeiMpInitLib.uni
>>>>  create mode 100644 UefiCpuPkg/Library/LoongArch64MpInitLib/PeiMpLib.c
>>>>
>>> 



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



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-11-03  8:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-03  1:03 [edk2-devel] [PATCH v1 00/29] Enable LoongArch virtual machine in edk2 Chao Li
2023-11-03  5:10 ` Ni, Ray
2023-11-03  7:08   ` Chao Li
2023-11-03  7:51     ` maobibo
2023-11-03  8:09       ` Chao Li
2023-11-03  8:16         ` maobibo
2023-11-03  7:07 ` Laszlo Ersek
2023-11-03  7:32   ` Chao Li
2023-11-03  7:40     ` Laszlo Ersek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox