[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH RFC 00/19] arm64 EFI stub

This patch series is an RFC series that 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.

The first 14 patches refactor and move x86 EFI code so that it can be 
shared with the arm64 EFI stub.  The remaining 5 patches add the new
arm64 EFI stub.

One significant omission from this series is proper EFI memory map 
handling in XEN itself.  This patch instead creates FDT memory nodes based 
on the EFI memory map.  This is functional, but not how we want to do 
it long term.  The XEN kernel updates for this will be largely
disjoint from this series, and I will be starting on that next.  I wanted 
to get this portion out for review without waiting for that portion of the 
code to be done.  The ADD_EFI_MEMORY_TO_FDT macro isolates code that will 
change when the proper EFI memory map handling is added to XEN.

I have some some simple tests booting from the EFI shell on arm64 (FVP 
base model) and x86_64 (vmware.)

This patch series is available on my git tree:
tag: xen-efi-stub-rfc-20140627

There are a few open issues in this patch series that I would appreciate 
feedback/suggestions on:

1) Build system changes.  The 'efi-shared.c' file should be properly 
shared, rather than symbolicly linked.  One complication is that the EFI 
code (for both archs) needs to be compiled with "-fshort-wchar".  I also 
likely need to create an efi subdir for arm64.

2) Is it valid to start XEN with a device tree that only contains 
multi-boot and EFI info? (As would be the case if the stub doesn't get a 
device tree as input.)  Currently this isn't supported, some libfdt 
functions are missing, so I'm checking if this is desired before I add 

3) I'm not sure arm64 needs it's own copy of efibind.h.  The x86_64 
version worked fine as is, but has some Microsoft related defines in 
there.  The arm64 version I created is a proper subset with the exception 
of the EFI_STUB_ERROR define.

(I am on vacation the week of June 30th-July 4th, so my responses will be 

Roy Franz (19):
  HACK: Add -fshort-wchar to global build
  Create efi-shared.[ch], and move string functions
  Move more functions from boot.c to efi-shared.c
  rename printErrMsg to PrintErrMesgExit
  Add PrintErrMesg function that doesn't exit
  Refactor read_file() so it can be shared.
  move read_file() to efi-shared.c
  Move removal of leading spaces from split_value to get_value()
  replace split_value() with truncate_string()
  move truncate_string() to efi-shared.c
  add read_config_file() function for XEN EFI config file
  create handle_cmdline() function
  Refactor get_argv() for sharing
  Move get_argv() and handle_cmdline() to efi-shared.c
  Add PE/COFF header in head.S
  create ARM EFI headers, based on x86
  Remove x86 specific defintions from efibind.h
  Add assembler use support for efibind.h
  Add EFI stub for ARM64

 Config.mk                           |   2 +
 xen/arch/arm/Makefile               |   2 +
 xen/arch/arm/arm64/head.S           | 178 +++++++++-
 xen/arch/arm/efi-shared.c           |   1 +
 xen/arch/arm/efi.c                  | 686 ++++++++++++++++++++++++++++++++++++
 xen/arch/arm/efi.h                  |  11 +
 xen/arch/arm/xen.lds.S              |   1 +
 xen/arch/x86/Makefile               |   4 +-
 xen/arch/x86/efi/Makefile           |   2 +-
 xen/arch/x86/efi/boot.c             | 614 +++-----------------------------
 xen/arch/x86/efi/efi-shared.c       | 620 ++++++++++++++++++++++++++++++++
 xen/include/asm-arm/arm64/efibind.h | 206 +++++++++++
 xen/include/asm-arm/efibind.h       |   2 +
 xen/include/efi/efi-shared.h        |  71 ++++
 14 files changed, 1832 insertions(+), 568 deletions(-)
 create mode 120000 xen/arch/arm/efi-shared.c
 create mode 100644 xen/arch/arm/efi.c
 create mode 100644 xen/arch/arm/efi.h
 create mode 100644 xen/arch/x86/efi/efi-shared.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


Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.