[RFC PATCH 02/10] arm64/efi: efistub: cover entire static mem footprint in PE/COFF .text

2014-07-21 Thread Ard Biesheuvel
The static memory footprint of a kernel Image at boot is larger than the Image file itself. Things like .bss data and initial page tables are allocated statically but populated dynamically so their content is not contained in the Image file. However, if EFI has loaded the Image at precisely the

[RFC PATCH 04/10] arm64: add EFI little endian constants to linker script

2014-07-21 Thread Ard Biesheuvel
Similar to how text offset and kernel size are mangled to produce little endian constants for the Image header regardless of the endianness of the kernel, this adds a number of constants used in the EFI PE/COFF header which can only be calculated (and byte swapped) by the linker. Signed-off-by:

[RFC PATCH 03/10] arm64: add macros to emit little endian ASM constants

2014-07-21 Thread Ard Biesheuvel
The Image header contains many constants that should be emitted in little endian regardless of the endianness of the kernel. Add helper macros le16, le32 and le64 to asm/assembler.h to aid with this. Signed-off-by: Ard Biesheuvel ard.biesheu...@linaro.org --- arch/arm64/include/asm/assembler.h |

[RFC PATCH 00/10] arm64: boot BE kernels from UEFI

2014-07-21 Thread Ard Biesheuvel
This series adds support for booting BE kernels from UEFI. As UEFI is defined to be strictly little endian, some workarounds are required to combine a little endian EFI stub with a big endian kernel. Also, runtime services need to be wrapped so they can be executed in little endian mode. Patches

[RFC PATCH 01/10] arm64/efi: efistub: jump to 'stext' directly, not through the header

2014-07-21 Thread Ard Biesheuvel
After the EFI stub has done its business, it jumps into the kernel by branching to offset #0 of the loaded Image, which is where it expects to find the header containing a 'branch to stext' instruction. However, the header is not covered by any PE/COFF section, so the header may not actually be

[RFC PATCH 09/10] arm64/efi: enable minimal UEFI Runtime Services for big endian

2014-07-21 Thread Ard Biesheuvel
This enables the UEFI Runtime Services needed to manipulate the non-volatile variable store when running under a BE kernel. Signed-off-by: Ard Biesheuvel ard.biesheu...@linaro.org --- arch/arm64/include/asm/efi.h | 2 + arch/arm64/kernel/efi-be-call.S| 55

[RFC PATCH 05/10] arm64/efi: update the PE/COFF header to be endian agnostic

2014-07-21 Thread Ard Biesheuvel
Update the PE/COFF header to use explicit little endian constants and use explicit little endian linker symbols so that the PE/COFF header is always emitted in little endian regardless of the endiannes of the kernel. Signed-off-by: Ard Biesheuvel ard.biesheu...@linaro.org ---

[RFC PATCH 10/10] arm64: Kconfig: enable UEFI on BE kernels

2014-07-21 Thread Ard Biesheuvel
This changes the Kconfig logic to allow EFI to be enabled on a BE kernel build. Signed-off-by: Ard Biesheuvel ard.biesheu...@linaro.org --- arch/arm64/Kconfig | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index

[RFC PATCH 07/10] arm64/efi: efistub: add support for booting a BE kernel

2014-07-21 Thread Ard Biesheuvel
This adds support to boot a big endian kernel from UEFI firmware, which is always little endian. The EFI stub itself is built as little endian, and embedded into a big endian kernel image. To enable this, we need to build all the stub's dependencies as little endian, including FDT parsing code

Re: [PATCH v2] arm64/efi: efistub: jump to 'stext' directly, not through the header

2014-07-21 Thread Ard Biesheuvel
On 17 July 2014 16:09, Mark Salter msal...@redhat.com wrote: On Wed, 2014-07-16 at 23:13 +0200, Ard Biesheuvel wrote: On 16 July 2014 23:03, Mark Salter msal...@redhat.com wrote: On Wed, 2014-07-16 at 22:38 +0200, Ard Biesheuvel wrote: On 16 July 2014 21:45, Mark Salter msal...@redhat.com