linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: Matt Fleming <matt@codeblueprint.co.uk>
Cc: "linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	"linux-efi@vger.kernel.org" <linux-efi@vger.kernel.org>,
	Leif Lindholm <leif.lindholm@linaro.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Alexander Kuleshov <kuleshovmail@gmail.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	Ryan Harkin <ryan.harkin@linaro.org>,
	Grant Likely <grant.likely@linaro.org>,
	Roy Franz <roy.franz@linaro.org>,
	Mark Salter <msalter@redhat.com>
Subject: Re: [PATCH v3 13/13] ARM: add UEFI stub support
Date: Fri, 27 Nov 2015 10:38:05 +0100	[thread overview]
Message-ID: <CAKv+Gu_RC5qG=BGPSEf=j7AV4SbjXELjBxmcboj1oVs-Dn87qw@mail.gmail.com> (raw)
In-Reply-To: <20151126104711.GH2765@codeblueprint.co.uk>

On 26 November 2015 at 11:47, Matt Fleming <matt@codeblueprint.co.uk> wrote:
> On Mon, 23 Nov, at 10:06:33AM, Ard Biesheuvel wrote:
>> From: Roy Franz <roy.franz@linaro.org>
>>
>> This patch adds EFI stub support for the ARM Linux kernel.
>>
>> The EFI stub operates similarly to the x86 and arm64 stubs: it is a
>> shim between the EFI firmware and the normal zImage entry point, and
>> sets up the environment that the zImage is expecting. This includes
>> optionally loading the initrd and device tree from the system partition
>> based on the kernel command line.
>>
>> Signed-off-by: Roy Franz <roy.franz@linaro.org>
>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>> ---
>>  arch/arm/Kconfig                          |  19 +++
>>  arch/arm/boot/compressed/Makefile         |   4 +-
>>  arch/arm/boot/compressed/efi-header.S     | 130 ++++++++++++++++++++
>>  arch/arm/boot/compressed/head.S           |  54 +++++++-
>>  arch/arm/boot/compressed/vmlinux.lds.S    |   7 ++
>>  arch/arm/include/asm/efi.h                |  23 ++++
>>  drivers/firmware/efi/libstub/Makefile     |   9 ++
>>  drivers/firmware/efi/libstub/arm-stub.c   |   4 +-
>>  drivers/firmware/efi/libstub/arm32-stub.c |  85 +++++++++++++
>>  9 files changed, 331 insertions(+), 4 deletions(-)
>
> [...]
>
>> +
>> +     /*
>> +      * Relocate the zImage, if required. ARM doesn't have a
>> +      * preferred address, so we set it to 0, as we want to allocate
>> +      * as low in memory as possible.
>> +      */
>> +     *image_size = image->image_size;
>> +     status = efi_relocate_kernel(sys_table, image_addr, *image_size,
>> +                                  *image_size, 0, 0);
>> +     if (status != EFI_SUCCESS) {
>> +             pr_efi_err(sys_table, "Failed to relocate kernel.\n");
>> +             efi_free(sys_table, *reserve_size, *reserve_addr);
>> +             *reserve_size = 0;
>> +             return status;
>> +     }
>
> If efi_relocate_kernel() successfully allocates memory at address 0x0,
> is that going to cause issues with NULL pointer checking?

Actually, it is the reservation done a bit earlier that could
potentially end up at 0x0, and the [compressed] kernel is always at
least 32 MB up in memory, so that it can be decompressed as close to
the base of DRAM as possible.

As far as I can tell, efi_free() deals correctly with allocations at
address 0x0, and that is the only dealing we have with the
reservation. So I don't think there is an issue here.

-- 
Ard.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2015-11-27  9:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-23  9:06 [PATCH v3 00/13] UEFI boot and runtime services support for 32-bit ARM Ard Biesheuvel
2015-11-23  9:06 ` [PATCH v3 01/13] mm/memblock: add MEMBLOCK_NOMAP attribute to memblock memory table Ard Biesheuvel
2015-11-23  9:06 ` [PATCH v3 02/13] arm64: only consider memblocks with NOMAP cleared for linear mapping Ard Biesheuvel
2015-11-23  9:06 ` [PATCH v3 03/13] arm64/efi: mark UEFI reserved regions as MEMBLOCK_NOMAP Ard Biesheuvel
2015-11-23  9:06 ` [PATCH v3 04/13] arm64/efi: split off EFI init and runtime code for reuse by 32-bit ARM Ard Biesheuvel
2015-11-23  9:06 ` [PATCH v3 05/13] arm64/efi: refactor " Ard Biesheuvel
2015-11-23  9:06 ` [PATCH v3 06/13] ARM: add support for generic early_ioremap/early_memremap Ard Biesheuvel
2015-11-23  9:06 ` [PATCH v3 07/13] ARM: split off core mapping logic from create_mapping Ard Biesheuvel
2015-11-23  9:06 ` [PATCH v3 08/13] ARM: factor out allocation routine from __create_mapping() Ard Biesheuvel
2015-11-23  9:06 ` [PATCH v3 09/13] ARM: add support for non-global kernel mappings Ard Biesheuvel
2015-11-23  9:06 ` [PATCH v3 10/13] ARM: implement create_mapping_late() for EFI use Ard Biesheuvel
2015-11-23  9:06 ` [PATCH v3 11/13] ARM: only consider memblocks with NOMAP cleared for linear mapping Ard Biesheuvel
2015-11-23  9:06 ` [PATCH v3 12/13] ARM: wire up UEFI init and runtime support Ard Biesheuvel
2015-11-23  9:06 ` [PATCH v3 13/13] ARM: add UEFI stub support Ard Biesheuvel
2015-11-26 10:47   ` Matt Fleming
2015-11-27  9:38     ` Ard Biesheuvel [this message]
2015-11-27 21:21       ` Matt Fleming
2015-11-27 21:25 ` [PATCH v3 00/13] UEFI boot and runtime services support for 32-bit ARM Matt Fleming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKv+Gu_RC5qG=BGPSEf=j7AV4SbjXELjBxmcboj1oVs-Dn87qw@mail.gmail.com' \
    --to=ard.biesheuvel@linaro.org \
    --cc=akpm@linux-foundation.org \
    --cc=catalin.marinas@arm.com \
    --cc=grant.likely@linaro.org \
    --cc=kuleshovmail@gmail.com \
    --cc=leif.lindholm@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mark.rutland@arm.com \
    --cc=matt@codeblueprint.co.uk \
    --cc=msalter@redhat.com \
    --cc=roy.franz@linaro.org \
    --cc=ryan.harkin@linaro.org \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox