From mboxrd@z Thu Jan 1 00:00:00 1970 From: Roy Franz Subject: [PATCH V2 00/12] arm64 EFI stub Date: Mon, 21 Jul 2014 17:43:23 -0700 Message-ID: <1405989815-25236-1-git-send-email-roy.franz@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org, ian.campbell@citrix.com, stefano.stabellini@citrix.com, tim@xen.org, jbeulich@suse.com, keir@xen.org Cc: Roy Franz , fu.wei@linaro.org, linaro-uefi@lists.linaro.org List-Id: xen-devel@lists.xenproject.org I think this patchset is in good shape, with the exception of the usage of the EFI memory map, which I am looking for some suggestions on. The current implementation populates the bootinfo memory bank list from the EFI memory map, rather than from the device tree, and doesn't use any reserved ranges. This works, however the EFI memory map can contain a lot of entries, many of which are small. Depending on the layout, this could trigger the code that sets up the frametable to discard most of memory. Also, as a side effect of some memory being ignored to manage the frametable size, the EFI stub needs to ensure that it loads modules into memory that XEN is going to map. The FVP model has 2GBytes of DRAM at 0x80000000 and another 2 at 0x800000000, so the disjoint case is common. It seems that both these problems go largely away if sparse frametable mappings are supported, but I'm not sure how much effort that would be. I think most of the work done to handle things robustly with the non-sparse frametable would not apply once a sparse frametable is supported. Does adding support for a sparse frametable mapping seem like a reasonable way forward on this? This patch series adds EFI support for arm64 in the form of a EFI stub in similar fashion to the linux kernel EFI support. A PE/COFF header is created in head.S, as there is no toolchain support for PE/COFF on arm64. This also has the advantage that the file is both an "Image" file and a PE/COFF executable - the same binary can be loaded and run either way. The EFI 'stub' code is a shim layer that serves as the loader for the XEN kernel in the EFI environment. The stub loads the dom0 kernel and initrd if required, and adds entries for them as well as for the EFI data structures into the device tree passed to XEN. Once the device tree is constructed, EFI boot services are exited, and the stub transfers control to the normal XEN entry point. The only indication XEN has that it was loaded via the stub is that the device tree contains EFI properties. This is all very similar to the arm/arm64 Linux kernel EFI stubs. This patchset is based on the staging branch to get Ian's multiboot/device tree patches. This series is also available at: git://git.linaro.org/people/roy.franz/xen.git arm64-efi-stub-v2 Changes since v1: (I have tried to address all feedback on v1) * Added common/efi directory for shared EFI code, and arch/arm/efi for arm-specfic code. Global build hacking of -fshort-wchar removed. arm32, arm64, and x86 with/without EFI enabled toolchain all build. The x86 build previously autodetected whether the EFI version should be built or not based on toolchain support. I couldn't get this working nicely with the common code, so for x86 I have the common code always build, and the EFI autodection works as normal for building the EFI version. * Basic use of the EFI memory map instead of FDT based memory description. More work needed to resolve differences between FDT description of a small number of large memory banks with reserved regions, and EFI's potentially long list of available regions, which can be long. * More refactoring of common EFI code to not directly exit using blexit(), as this broke the pre-linking targets. All shared code returns status, and it is up to the caller to exit and clean up. * Reduced the number of patches. Refactoring of x86 code first, then moving all code to efi-shared.c in one patch. * Fixed formatting/tab issues in new files, added Emacs footer. * Fixed efi_get_memory_map to return NULL map pointer on error in addition to failed status. * Added comments in head.S regarding PE/COFF specification, and 1:1 mapping used by EFI code. * Updated device tree bindings to use new multiboot bindings. Since the stub is always built into XEN, we don't have to support older bindings. Roy Franz (12): Create efi-shared.[ch], and move string functions rename printErrMsg to PrintErrMesgExit Refactor get_parent_handle for sharing Refactor read_file() so it can be shared. replace split_value() with truncate_string() add read_config_file() function for XEN EFI config file create handle_cmdline() function Refactor get_argv() for sharing Move shared EFI functions to efi-shared.c add arm64 cache flushing code from linux Add fdt_create_empty_tree() function. Add EFI stub for arm64 xen/arch/arm/Makefile | 5 + xen/arch/arm/Rules.mk | 1 + xen/arch/arm/arm64/Makefile | 1 + xen/arch/arm/arm64/cache.S | 100 +++++ xen/arch/arm/arm64/head.S | 185 +++++++++- xen/arch/arm/efi/Makefile | 2 + xen/arch/arm/efi/efi.c | 714 ++++++++++++++++++++++++++++++++++++ xen/arch/arm/xen.lds.S | 1 + xen/arch/x86/Rules.mk | 1 + xen/arch/x86/efi/boot.c | 625 ++++--------------------------- xen/common/Makefile | 2 + xen/common/efi/Makefile | 3 + xen/common/efi/efi-shared.c | 648 ++++++++++++++++++++++++++++++++ xen/common/libfdt/Makefile.libfdt | 2 +- xen/common/libfdt/fdt_empty_tree.c | 84 +++++ xen/include/asm-arm/arm64/efibind.h | 216 +++++++++++ xen/include/asm-arm/efibind.h | 2 + xen/include/asm-arm/setup.h | 2 +- xen/include/efi/efi-shared.h | 72 ++++ xen/include/xen/libfdt/libfdt.h | 1 + 20 files changed, 2101 insertions(+), 566 deletions(-) create mode 100644 xen/arch/arm/arm64/cache.S create mode 100644 xen/arch/arm/efi/Makefile create mode 100644 xen/arch/arm/efi/efi.c create mode 100644 xen/common/efi/Makefile create mode 100644 xen/common/efi/efi-shared.c create mode 100644 xen/common/libfdt/fdt_empty_tree.c create mode 100644 xen/include/asm-arm/arm64/efibind.h create mode 100644 xen/include/asm-arm/efibind.h create mode 100644 xen/include/efi/efi-shared.h -- 2.0.0