[RFC PATCH] arm64/efi: efistub: reuse EFI mapping for Image if it is lower

2014-07-15 Thread Ard Biesheuvel
The EFI loader may load Image at any available offset. This means Image may reside very close to or at the base of DRAM, in which case the relocation done by efi_entry() results in Image being moved up in memory, which is undesirable (memory below the kernel is currently not usable). To work aroun

Re: [PATCH] x86, eboot: Support initrd loaded above 4G

2014-07-15 Thread H. Peter Anvin
On 07/15/2014 08:10 AM, Matt Fleming wrote: > > Going forward, I suspect any attempts to use the EFI File Protocol are > going to result in this kind of breakage, and that the only thing that > can be relied upon is the Disk I/O Protocol. > Do we know what the Windows bootloader does? I thought

Re: [PATCH] efi/arm64: efistub: don't abort if base of DRAM is occupied

2014-07-15 Thread Leif Lindholm
On Tue, Jul 15, 2014 at 11:04:37AM -0400, Mark Salter wrote: > On Tue, 2014-07-15 at 15:49 +0100, Leif Lindholm wrote: > > On Tue, Jul 15, 2014 at 10:23:26AM -0400, Mark Salter wrote: > > > On Tue, 2014-07-15 at 14:54 +0100, Leif Lindholm wrote: > > > > On Tue, Jul 15, 2014 at 09:11:00AM -0400, Mar

Re: [PATCH] x86, eboot: Support initrd loaded above 4G

2014-07-15 Thread Michael Brown
On 15/07/14 16:10, Matt Fleming wrote: Going forward, I suspect any attempts to use the EFI File Protocol are going to result in this kind of breakage, and that the only thing that can be relied upon is the Disk I/O Protocol. But doing Disk I/O would necessitate adding the in-kernel FAT driver t

Re: [PATCH] x86, eboot: Support initrd loaded above 4G

2014-07-15 Thread Matt Fleming
On Fri, 11 Jul, at 08:40:29AM, Matt Fleming wrote: > > I'm not exactly sure what's wrong with the buffer - whether it's a case > of not being able to access it properly or somehing buggy in the EFI > code for reading files. No fault occurs when reading into it, it just > doesn't contain the correc

Re: [PATCH] efi/arm64: efistub: don't abort if base of DRAM is occupied

2014-07-15 Thread Mark Salter
On Tue, 2014-07-15 at 15:49 +0100, Leif Lindholm wrote: > On Tue, Jul 15, 2014 at 10:23:26AM -0400, Mark Salter wrote: > > On Tue, 2014-07-15 at 14:54 +0100, Leif Lindholm wrote: > > > On Tue, Jul 15, 2014 at 09:11:00AM -0400, Mark Salter wrote: > > > > On Tue, 2014-07-15 at 11:02 +0100, Leif Lindh

Re: [PATCH] efi/arm64: efistub: don't abort if base of DRAM is occupied

2014-07-15 Thread Leif Lindholm
On Tue, Jul 15, 2014 at 10:23:26AM -0400, Mark Salter wrote: > On Tue, 2014-07-15 at 14:54 +0100, Leif Lindholm wrote: > > On Tue, Jul 15, 2014 at 09:11:00AM -0400, Mark Salter wrote: > > > On Tue, 2014-07-15 at 11:02 +0100, Leif Lindholm wrote: > > > > > @@ -273,6 +282,10 @@ static void __init fre

Re: [PATCH] efi/arm64: efistub: don't abort if base of DRAM is occupied

2014-07-15 Thread Mark Rutland
On Tue, Jul 15, 2014 at 03:23:26PM +0100, Mark Salter wrote: > On Tue, 2014-07-15 at 14:54 +0100, Leif Lindholm wrote: > > On Tue, Jul 15, 2014 at 09:11:00AM -0400, Mark Salter wrote: > > > On Tue, 2014-07-15 at 11:02 +0100, Leif Lindholm wrote: > > > > > @@ -273,6 +282,10 @@ static void __init fre

Re: [PATCH] efi/arm64: efistub: don't abort if base of DRAM is occupied

2014-07-15 Thread Mark Salter
On Tue, 2014-07-15 at 14:54 +0100, Leif Lindholm wrote: > On Tue, Jul 15, 2014 at 09:11:00AM -0400, Mark Salter wrote: > > On Tue, 2014-07-15 at 11:02 +0100, Leif Lindholm wrote: > > > > @@ -273,6 +282,10 @@ static void __init free_boot_services(void) > > > > continue; > > > >

Re: [PATCH] efi/arm64: efistub: don't abort if base of DRAM is occupied

2014-07-15 Thread Leif Lindholm
On Tue, Jul 15, 2014 at 09:11:00AM -0400, Mark Salter wrote: > On Tue, 2014-07-15 at 11:02 +0100, Leif Lindholm wrote: > > > @@ -273,6 +282,10 @@ static void __init free_boot_services(void) > > > continue; > > > } > > > > > > + /* Don't free anythin

Re: [PATCH] efi/arm64: efistub: don't abort if base of DRAM is occupied

2014-07-15 Thread Mark Salter
On Tue, 2014-07-15 at 11:02 +0100, Leif Lindholm wrote: > > @@ -273,6 +282,10 @@ static void __init free_boot_services(void) > > continue; > > } > > > > + /* Don't free anything below kernel */ > > + if (md->phys_addr < PHYS_OFFSET) > >

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

2014-07-15 Thread Mark Rutland
On Tue, Jul 15, 2014 at 12:49:07PM +0100, Ard Biesheuvel wrote: > On 15 July 2014 13:31, Mark Rutland wrote: > >> >> diff --git a/arch/arm64/kernel/efi-entry.S > >> >> b/arch/arm64/kernel/efi-entry.S > >> >> index 619b1dd7bcde..6ef541731d9e 100644 > >> >> --- a/arch/arm64/kernel/efi-entry.S > >>

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

2014-07-15 Thread Ard Biesheuvel
On 15 July 2014 13:31, Mark Rutland wrote: >> >> diff --git a/arch/arm64/kernel/efi-entry.S b/arch/arm64/kernel/efi-entry.S >> >> index 619b1dd7bcde..6ef541731d9e 100644 >> >> --- a/arch/arm64/kernel/efi-entry.S >> >> +++ b/arch/arm64/kernel/efi-entry.S >> >> @@ -61,7 +61,7 @@ ENTRY(efi_stub_entry

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

2014-07-15 Thread Mark Rutland
> >> diff --git a/arch/arm64/kernel/efi-entry.S b/arch/arm64/kernel/efi-entry.S > >> index 619b1dd7bcde..6ef541731d9e 100644 > >> --- a/arch/arm64/kernel/efi-entry.S > >> +++ b/arch/arm64/kernel/efi-entry.S > >> @@ -61,7 +61,7 @@ ENTRY(efi_stub_entry) > >>*/ > >> mov x20, x0

Re: [PATCH] efi/arm64: efistub: don't abort if base of DRAM is occupied

2014-07-15 Thread Mark Rutland
On Tue, Jul 15, 2014 at 11:02:22AM +0100, Leif Lindholm wrote: > On Mon, Jul 14, 2014 at 02:40:48PM -0400, Mark Salter wrote: > > On Mon, 2014-07-14 at 17:25 +0200, Ard Biesheuvel wrote: > > > If we fail to relocate the kernel Image to its preferred offset of > > > TEXT_OFFSET > > > bytes above th

Re: [PATCH] efi/arm64: efistub: don't abort if base of DRAM is occupied

2014-07-15 Thread Mark Rutland
On Mon, Jul 14, 2014 at 07:40:48PM +0100, Mark Salter wrote: > On Mon, 2014-07-14 at 17:25 +0200, Ard Biesheuvel wrote: > > If we fail to relocate the kernel Image to its preferred offset of > > TEXT_OFFSET > > bytes above the base of DRAM, accept the lowest alternative mapping > > available > >

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

2014-07-15 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 de

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

2014-07-15 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 lo

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

2014-07-15 Thread Ard Biesheuvel
On 15 July 2014 11:57, Mark Rutland wrote: > Hi Ard, > > On Tue, Jul 15, 2014 at 10:10:02AM +0100, Ard Biesheuvel wrote: >> 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 >> c

Re: [PATCH] efi/arm64: efistub: don't abort if base of DRAM is occupied

2014-07-15 Thread Leif Lindholm
On Mon, Jul 14, 2014 at 02:40:48PM -0400, Mark Salter wrote: > On Mon, 2014-07-14 at 17:25 +0200, Ard Biesheuvel wrote: > > If we fail to relocate the kernel Image to its preferred offset of > > TEXT_OFFSET > > bytes above the base of DRAM, accept the lowest alternative mapping > > available > >

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

2014-07-15 Thread Mark Rutland
Hi Ard, On Tue, Jul 15, 2014 at 10:10:02AM +0100, Ard Biesheuvel wrote: > 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

Re: [PATCH 2/2] arm64/efi: efistub: get text offset and image size from the Image header

2014-07-15 Thread Mark Rutland
Hi Ard, [...] > >> >> diff --git a/arch/arm64/kernel/efi-stub.c b/arch/arm64/kernel/efi-stub.c > >> >> index 9b61d66e2d20..4ba90b2ef677 100644 > >> >> --- a/arch/arm64/kernel/efi-stub.c > >> >> +++ b/arch/arm64/kernel/efi-stub.c > >> >> @@ -11,8 +11,7 @@ > >> >> */ > >> >> #include > >> >> #

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

2014-07-15 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 loa

Re: [PATCH 2/2] arm64/efi: efistub: get text offset and image size from the Image header

2014-07-15 Thread Ard Biesheuvel
On 14 July 2014 20:29, Mark Rutland wrote: > On Mon, Jul 14, 2014 at 06:35:32PM +0100, Ard Biesheuvel wrote: >> On 14 July 2014 18:54, Mark Rutland wrote: >> > Hi Ard, >> > >> > On Mon, Jul 14, 2014 at 05:17:51PM +0100, Ard Biesheuvel wrote: >> >> The EFI stub for arm64 needs to behave like an or

Re: [PATCH] efi: Request desired alignment via the PE/COFF headers

2014-07-15 Thread Matt Fleming
On Mon, 14 Jul, at 01:56:09PM, H. Peter Anvin wrote: > > That's good. So will you apply it, or should I? I've queued it up for v3.17. -- Matt Fleming, Intel Open Source Technology Center -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majord.