mbox series

[v2,00/14] efi: improved correctness, arm unification, and cleanup

Message ID 20170803100432.29913-1-leif.lindholm@linaro.org
Headers show
Series efi: improved correctness, arm unification, and cleanup | expand

Message

Leif Lindholm Aug. 3, 2017, 10:04 a.m. UTC
This patch series is really three different ones, but they unite around                                                                                                                                             
the need for (and the implementation) of more flexible control of memory                                                                                                                                            
allocation on UEFI systems.                                                                                                                                                                                         
                                                                                                                                                                                                                    
1: Adding new interfaces                                                                                                                                                                                            
- A function for detecting the start address of RAM                                                                                                                                                                 
  Since ARM platforms have no standardised memory map, implement a                                                                                                                                                  
  function that picks the lowest-address region supporting the                                                                                                                                                      
  write-back cache atribute from the UEFI memory map.                                                                                                                                                               
- Implement and expose a new memory allocation function giving access to                                                                                                                                            
  the allocation type and memory type arguments to the AllocatePages                                                                                                                                                
  boot service.                                                                                                                                                                                                     
                                                                                                                                                                                                                    
2: ARM unification                                                                                                                                                                                                  
- The fdt helper library for arm64-efi is really an efi/fdt function.                                                                                                                                               
  So move it to neutral ground in loader/efi.                                                                                                                                                                       
- The arm64 efi linux loader was written for arm64 only, so clean it up a                                                                                                                                           
  bit with regards to 32/64-bit portability, and abstract out some                                                                                                                                                  
  definitions and function prototypes.                                                                                                                                                                              
- Move the arm efi port to use the arm64 linux loader instead of the one                                                                                                                                            
  shared with the u-boot port. Clean up the u-boot loder by deleting the                                                                                                                                            
  efi-specific bits and other code only used by that.                                                                                                                                                               
                                                                                                                                                                                                                    
3: Correctness improvements                                                                                                                                                                                         
- There are some restrictions on the placement of initrd images in                                                                                                                                                  
  relation to the runtime kernel images, for both arm and arm64 - but the                                                                                                                                           
  arm64 one did not use to be explicitly documented (and only triggerable                                                                                                                                           
  on systems with > 40GB of RAM), and the u-boot loader always placed the                                                                                                                                           
  images nearly adjacent. Use the new interfaces to place the initrd as                                                                                                                                             
  approrpiate for each architecture.                                                                                                                                                                                
- The allocation of memory for the grub heap is done of memory type                                                                                                                                                 
  GRUB_EFI_LOADER_DATA. Since UEFI can return memory with non-executable                                                                                                                                            
  mappings for this request, and modules are loaded onto the heap, change                                                                                                                                           
  this allocation to GRUB_EFI_LOADER_CODE instead.

Changes between v1 and v2:
- Move EFI_PAGE_SHIFT/EFI_BYTES_TO_PAGES first in the series, as
  separate patch.
- Add GRUB_EFI_PAGE_SIZE definition.
- Break out find_efi_mmap_size function from existing code to common 
  code for reuse.
  - Move current users to this version.
- Rename grub_efi_get_dram_base -> grub_efi_get_ram_base.
- Break up commits to better separate logical changes.
- Moved initrd location restrictions description, and the resulting
  macros, to the body of the function that uses them.

Changes between RFC and v1:
- Rebased (to deal with arm coreboot upstream changes).                                                                                                                                                             
- Moved EFI page size definitions to common header.                                                                                                                                                                 
- Moved a few stray 32/64-bit fixes from 3/7 to 4/7.

Leif Lindholm (14):
  arm64/efi: move EFI_PAGE definitions to efi/memory.h
  efi: add central copy of grub_efi_find_mmap_size
  loader: drop local implementations of find_efi_mmap_size
  efi: add grub_efi_get_ram_base() function for arm*
  efi: refactor grub_efi_allocate_pages
  efi: move fdt helper library
  efi: Add GRUB_PE32_MAGIC definition
  arm64 linux loader: improve type portability
  arm64 linux loader: rename functions and macros and move to common
    headers
  loader: switch arm/linux to grub_linux_kernel_header struct
  arm/efi: switch to arm64 linux loader
  arm: delete unused efi support from loader/arm
  efi: restrict arm/arm64 linux loader initrd placement
  efi: change heap allocation type to GRUB_EFI_LOADER_CODE

 grub-core/Makefile.am                 |   1 -
 grub-core/Makefile.core.def           |   6 +-
 grub-core/kern/arm/efi/misc.c         | 202 ----------------------------------
 grub-core/kern/efi/mm.c               | 130 ++++++++++++++++++----
 grub-core/loader/arm/linux.c          |  39 +------
 grub-core/loader/arm64/linux.c        |  73 ++++++++----
 grub-core/loader/arm64/xen_boot.c     |  15 +--
 grub-core/loader/{arm64 => efi}/fdt.c |  11 +-
 grub-core/loader/i386/linux.c         |  51 +--------
 grub-core/loader/multiboot_mbi2.c     |  38 +------
 include/grub/arm/efi/loader.h         |  26 -----
 include/grub/arm/linux.h              |  31 ++----
 include/grub/arm64/linux.h            |  13 +--
 include/grub/efi/efi.h                |  11 ++
 include/grub/{arm64 => efi}/fdtload.h |   3 -
 include/grub/efi/memory.h             |   4 +
 include/grub/efi/pe32.h               |   2 +
 17 files changed, 216 insertions(+), 440 deletions(-)
 delete mode 100644 grub-core/kern/arm/efi/misc.c
 rename grub-core/loader/{arm64 => efi}/fdt.c (93%)
 delete mode 100644 include/grub/arm/efi/loader.h
 rename include/grub/{arm64 => efi}/fdtload.h (89%)

-- 
2.11.0


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel