All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
To: Matt Fleming <matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
Cc: James Morse <james.morse-5wv7dgnIgG8@public.gmane.org>,
	"linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
	Jeff Hugo <jhugo-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
Subject: Re: [PATCH v2] efi/libstub: arm*: Pass latest memory map to the kernel
Date: Tue, 20 Dec 2016 22:33:28 +0000	[thread overview]
Message-ID: <CAKv+Gu9OM5e+vxPiYB=i5uvthMDg3OkKfiZPaNJz2og0JWGOLQ@mail.gmail.com> (raw)
In-Reply-To: <CAKv+Gu8_8+GdaV86_ctf=PzKxPvT3tbUOcuz5OkyBya5OC+ekw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On 20 December 2016 at 22:32, Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
> On 19 December 2016 at 21:38, Matt Fleming <matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org> wrote:
>> On Mon, 19 Dec, at 02:24:19PM, James Morse wrote:
>>> From: Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
>>>
>>> As reported by James, the current libstub code involving the annotated
>>> memory map only works somewhat correctly by accident, due to the fact
>>> that a pool allocation happens to be reused immediately, retaining its
>>> former contents.
>>>
>>> Instead of juggling memory maps, which makes the code more complex than
>>> it needs to be, simply put a placholder value into the FDT, and only
>>> write the actual value after ExitBootServices() has been called.
>>>
>>> Reported-by: James Morse <james.morse-5wv7dgnIgG8@public.gmane.org>
>>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
>>> [Update mmap-size too, remove updated_fdt()s unused params and header entry]
>>> Signed-off-by: James Morse <james.morse-5wv7dgnIgG8@public.gmane.org>
>>> ---
>>> Hi Ard,
>>>
>>> This is a v2 of your patch that updates the mmap-size too. This solves the
>>> truncated memmap problem I saw with v1 on Seattle.
>>>
>>> The original patch was CC-stable, so I think this should also have:
>>> Cc: <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
>>> Fixes: ed9cc156c42f ("efi/libstub: Use efi_exit_boot_services() in FDT")
>>>
>>>
>>> Thanks,
>>>
>>> James
>>>
>>>  drivers/firmware/efi/libstub/efistub.h |  8 ----
>>>  drivers/firmware/efi/libstub/fdt.c     | 75 +++++++++++++++++++++-------------
>>>  2 files changed, 47 insertions(+), 36 deletions(-)
>>
>> Thanks James. I've queued this one up in the 'urgent' queue and tagged
>> it for stable. I'll send it to tip before the end of the week.
>
> Could we fold the hunk below, please?
>
> diff --git a/drivers/firmware/efi/libstub/fdt.c
> b/drivers/firmware/efi/libstub/fdt.c
> index 9b11b0559a23..90ab96845937 100644
> --- a/drivers/firmware/efi/libstub/fdt.c
> +++ b/drivers/firmware/efi/libstub/fdt.c
> @@ -149,26 +149,25 @@ static efi_status_t
> update_fdt(efi_system_table_t *sys_table, void *orig_fdt,
>  static efi_status_t update_fdt_memmap(void *fdt, u64 memmap, u32 map_size)
>  {
>         int node = fdt_path_offset(fdt, "/chosen");
> -       efi_status_t status;
> +       int err;
>
>         if (node < 0)
>                 return EFI_LOAD_ERROR;
>
>         memmap = cpu_to_fdt64(memmap);
> -       status = fdt_setprop_inplace(fdt, node, "linux,uefi-mmap-start",
> -                                    &memmap, sizeof(memmap));
> +       err = fdt_setprop_inplace(fdt, node, "linux,uefi-mmap-start",
> +                                 &memmap, sizeof(memmap));
>
>         if (status)
>                 return EFI_LOAD_ERROR;
>
>         map_size = cpu_to_fdt32(map_size);
> -       status = fdt_setprop_inplace(fdt, node, "linux,uefi-mmap-size",
> -                                    &map_size, sizeof(map_size));
> +       err = fdt_setprop_inplace(fdt, node, "linux,uefi-mmap-size",
> +                                 &map_size, sizeof(map_size));
>
>         if (status)
>                 return EFI_LOAD_ERROR;
>
> -
>         return EFI_SUCCESS;
>  }
>
> My mistake, and harmless in practice, but sloppy nonetheless

... but with the 'if (status)' replaced as well, of course (2x)

WARNING: multiple messages have this Message-ID (diff)
From: ard.biesheuvel@linaro.org (Ard Biesheuvel)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] efi/libstub: arm*: Pass latest memory map to the kernel
Date: Tue, 20 Dec 2016 22:33:28 +0000	[thread overview]
Message-ID: <CAKv+Gu9OM5e+vxPiYB=i5uvthMDg3OkKfiZPaNJz2og0JWGOLQ@mail.gmail.com> (raw)
In-Reply-To: <CAKv+Gu8_8+GdaV86_ctf=PzKxPvT3tbUOcuz5OkyBya5OC+ekw@mail.gmail.com>

On 20 December 2016 at 22:32, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> On 19 December 2016 at 21:38, Matt Fleming <matt@codeblueprint.co.uk> wrote:
>> On Mon, 19 Dec, at 02:24:19PM, James Morse wrote:
>>> From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>>>
>>> As reported by James, the current libstub code involving the annotated
>>> memory map only works somewhat correctly by accident, due to the fact
>>> that a pool allocation happens to be reused immediately, retaining its
>>> former contents.
>>>
>>> Instead of juggling memory maps, which makes the code more complex than
>>> it needs to be, simply put a placholder value into the FDT, and only
>>> write the actual value after ExitBootServices() has been called.
>>>
>>> Reported-by: James Morse <james.morse@arm.com>
>>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>>> [Update mmap-size too, remove updated_fdt()s unused params and header entry]
>>> Signed-off-by: James Morse <james.morse@arm.com>
>>> ---
>>> Hi Ard,
>>>
>>> This is a v2 of your patch that updates the mmap-size too. This solves the
>>> truncated memmap problem I saw with v1 on Seattle.
>>>
>>> The original patch was CC-stable, so I think this should also have:
>>> Cc: <stable@vger.kernel.org>
>>> Fixes: ed9cc156c42f ("efi/libstub: Use efi_exit_boot_services() in FDT")
>>>
>>>
>>> Thanks,
>>>
>>> James
>>>
>>>  drivers/firmware/efi/libstub/efistub.h |  8 ----
>>>  drivers/firmware/efi/libstub/fdt.c     | 75 +++++++++++++++++++++-------------
>>>  2 files changed, 47 insertions(+), 36 deletions(-)
>>
>> Thanks James. I've queued this one up in the 'urgent' queue and tagged
>> it for stable. I'll send it to tip before the end of the week.
>
> Could we fold the hunk below, please?
>
> diff --git a/drivers/firmware/efi/libstub/fdt.c
> b/drivers/firmware/efi/libstub/fdt.c
> index 9b11b0559a23..90ab96845937 100644
> --- a/drivers/firmware/efi/libstub/fdt.c
> +++ b/drivers/firmware/efi/libstub/fdt.c
> @@ -149,26 +149,25 @@ static efi_status_t
> update_fdt(efi_system_table_t *sys_table, void *orig_fdt,
>  static efi_status_t update_fdt_memmap(void *fdt, u64 memmap, u32 map_size)
>  {
>         int node = fdt_path_offset(fdt, "/chosen");
> -       efi_status_t status;
> +       int err;
>
>         if (node < 0)
>                 return EFI_LOAD_ERROR;
>
>         memmap = cpu_to_fdt64(memmap);
> -       status = fdt_setprop_inplace(fdt, node, "linux,uefi-mmap-start",
> -                                    &memmap, sizeof(memmap));
> +       err = fdt_setprop_inplace(fdt, node, "linux,uefi-mmap-start",
> +                                 &memmap, sizeof(memmap));
>
>         if (status)
>                 return EFI_LOAD_ERROR;
>
>         map_size = cpu_to_fdt32(map_size);
> -       status = fdt_setprop_inplace(fdt, node, "linux,uefi-mmap-size",
> -                                    &map_size, sizeof(map_size));
> +       err = fdt_setprop_inplace(fdt, node, "linux,uefi-mmap-size",
> +                                 &map_size, sizeof(map_size));
>
>         if (status)
>                 return EFI_LOAD_ERROR;
>
> -
>         return EFI_SUCCESS;
>  }
>
> My mistake, and harmless in practice, but sloppy nonetheless

... but with the 'if (status)' replaced as well, of course (2x)

  parent reply	other threads:[~2016-12-20 22:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-19 14:24 [PATCH v2] efi/libstub: arm*: Pass latest memory map to the kernel James Morse
2016-12-19 14:24 ` James Morse
     [not found] ` <20161219142419.16780-1-james.morse-5wv7dgnIgG8@public.gmane.org>
2016-12-19 21:38   ` Matt Fleming
2016-12-19 21:38     ` Matt Fleming
     [not found]     ` <20161219213859.GA2225-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2016-12-20 22:32       ` Ard Biesheuvel
2016-12-20 22:32         ` Ard Biesheuvel
     [not found]         ` <CAKv+Gu8_8+GdaV86_ctf=PzKxPvT3tbUOcuz5OkyBya5OC+ekw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-12-20 22:33           ` Ard Biesheuvel [this message]
2016-12-20 22:33             ` Ard Biesheuvel

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+Gu9OM5e+vxPiYB=i5uvthMDg3OkKfiZPaNJz2og0JWGOLQ@mail.gmail.com' \
    --to=ard.biesheuvel-qsej5fyqhm4dnm+yrofe0a@public.gmane.org \
    --cc=james.morse-5wv7dgnIgG8@public.gmane.org \
    --cc=jhugo-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.