On 12/08/14 19:21, Ard Biesheuvel wrote:
Hello all,
This series is part of the Xen stuff I am working on, and due to some circumstances particular to my situation (i.e., no easy access to hardware) I have decided to prototype as much as I can on QEMU, which like Xen, uses the kernel boot protocol, as documented in linux/Documentation/arm64/booting.txt
This is a RFC series to probe whether the approach taken here is acceptable. If not, there should be an update to Xen/arm to implement a specific bootloader boot protocol in addition to the kernel boot protocol it supports currently. But if it is, there may be other interesting uses, e.g., as a chainloader so that any platform can easily support UEFI booting if it already supports arm64. This would require a NOR flash in the device tree, and some standard bus type (SATA, PCI) to hold the block device containing the OS, but other than that, it seems that most of what is required is already in place.
Note the hacky use of fixed PCDs: these are supposed to be read-only, obviously, but I am updating them in code regardless. It would probably be more consistent to use PatchableInModule PCDs instead, and I will make the required changes if the overall direction is deemed appropriate.
I have included the QemuKernel.dsc: this is just a proof of concept, it works under 'qemu-system-aarch64 -kernel' whose RAM is at 0x4000_0000 whereas the .DSC puts the RAM at 0x0. The relocatable PrePi and the new lib flavours work together to relocate the PrePi and set the environment according to the device tree before launching the DXE core. From that point, everything operates as before.
Ard Biesheuvel (8): ArmVirtualizationPkg: move early UART discovery to PlatformPeim ArmVirtualizationPkg: use a HOB to store device tree blob ArmPlatformPkg: replace some instances of FixedPcdGetXX() with PcdGetXX() ArmPlatformPkg/PrePi: allow unicore build to execute on mpcore system ArmPlatformPkg/PrePi: add a relocatable version of PrePi ArmVirtualizationPkg: implement a relocatable platformlib instance ArmVirtualizationPkg: implement custom MemoryInitPeiLib ArmVirtualizationPkg: add Qemu -kernel platform description
.../ArmVirtualizationPkg/ArmVirtualizationPkg.dec | 3 +- .../ArmVirtualizationPkg/ArmVirtualizationQemu.dsc | 3 - .../ArmVirtualizationQemuKernel.dsc | 263 ++++++++++++++++ .../ArmVirtualizationQemuKernel.fdf | 334 +++++++++++++++++++++ .../ArmVirtualizationPkg/Include/Guid/FdtHob.h | 26 ++ .../ArmVirtualizationMemoryInitPeiLib.c | 91 ++++++ .../ArmVirtualizationMemoryInitPeiLib.inf | 64 ++++ .../AARCH64/MemnodeParser.S | 224 ++++++++++++++ .../AARCH64/RelocatableVirtHelper.S | 177 +++++++++++ .../ArmVirtRelocatablePlatformLib.inf | 66 ++++ .../ArmVirtualizationPlatformLib.inf | 1 + .../ArmVirtualizationPlatformLib/RelocatableVirt.c | 78 +++++ .../Library/ArmVirtualizationPlatformLib/Virt.c | 46 +-- .../EarlyFdtPL011SerialPortLib.c | 2 +- .../Library/PlatformPeiLib/PlatformPeiLib.c | 60 +++- .../Library/PlatformPeiLib/PlatformPeiLib.inf | 3 - .../ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.c | 10 +- .../ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.inf | 2 +- ArmPlatformPkg/PrePi/AArch64/ModuleEntryPoint.S | 49 ++- ArmPlatformPkg/PrePi/MainMPCore.c | 2 +- ArmPlatformPkg/PrePi/MainUniCore.c | 2 +- ArmPlatformPkg/PrePi/MainUniCoreRelocatable.c | 38 +++ ArmPlatformPkg/PrePi/PeiUniCoreRelocatable.inf | 108 +++++++ ArmPlatformPkg/PrePi/PrePi.c | 25 +- ArmPlatformPkg/PrePi/PrePi.h | 3 +- ArmPlatformPkg/PrePi/Scripts/PrePi-PIE.lds | 28 ++ 26 files changed, 1619 insertions(+), 89 deletions(-) create mode 100644 ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualizationQemuKernel.dsc create mode 100644 ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualizationQemuKernel.fdf create mode 100644 ArmPlatformPkg/ArmVirtualizationPkg/Include/Guid/FdtHob.h create mode 100644 ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationMemoryInitPeiLib/ArmVirtualizationMemoryInitPeiLib.c create mode 100644 ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationMemoryInitPeiLib/ArmVirtualizationMemoryInitPeiLib.inf create mode 100644 ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformLib/AARCH64/MemnodeParser.S create mode 100644 ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformLib/AARCH64/RelocatableVirtHelper.S create mode 100644 ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformLib/ArmVirtRelocatablePlatformLib.inf create mode 100644 ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformLib/RelocatableVirt.c create mode 100644 ArmPlatformPkg/PrePi/MainUniCoreRelocatable.c create mode 100755 ArmPlatformPkg/PrePi/PeiUniCoreRelocatable.inf create mode 100644 ArmPlatformPkg/PrePi/Scripts/PrePi-PIE.lds
All I can offer as "review" is checking against regressions in current code. See the individual emails.
Thanks Laszlo