linux-efi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ardb@kernel.org>
To: Randy Dunlap <rdunlap@infradead.org>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>,
	linux-efi <linux-efi@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/1] efi/libstub: describe efi_relocate_kernel()
Date: Thu, 20 Feb 2020 08:52:48 +0100	[thread overview]
Message-ID: <CAKv+Gu8ZvxPdgz9d2ZrbO1vaCrUZs8WW8Bc2sxsrvrCtXtviqg@mail.gmail.com> (raw)
In-Reply-To: <9687832d-e9a9-ca47-34d5-7b912b2f718a@infradead.org>

On Thu, 20 Feb 2020 at 08:02, Randy Dunlap <rdunlap@infradead.org> wrote:
>
> Hi,
> Mostly looks good.  One comment below:
>
> On 2/19/20 10:53 PM, Heinrich Schuchardt wrote:
> > Update the description of of efi_relocate_kernel() to match Sphinx style.
> >
> > Update parameter references in the description of other memory functions
> > to use @param style.
> >
> > Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> > ---
> >  drivers/firmware/efi/libstub/mem.c | 38 +++++++++++++++++++-----------
> >  1 file changed, 24 insertions(+), 14 deletions(-)
> >
> > diff --git a/drivers/firmware/efi/libstub/mem.c b/drivers/firmware/efi/libstub/mem.c
> > index 0d57078e5e62..7efe3ed2d5a6 100644
> > --- a/drivers/firmware/efi/libstub/mem.c
> > +++ b/drivers/firmware/efi/libstub/mem.c
> > @@ -86,7 +86,7 @@ efi_status_t efi_get_memory_map(struct efi_boot_memmap *map)
> >   *
> >   * Allocate pages as EFI_LOADER_DATA. The allocated pages are aligned according
> >   * to EFI_ALLOC_ALIGN. The last allocated page will not exceed the address
> > - * given by 'max'.
> > + * given by @max.
> >   *
> >   * Return:   status code
> >   */
> > @@ -126,10 +126,10 @@ efi_status_t efi_allocate_pages(unsigned long size, unsigned long *addr,
> >   * @addr:    on exit the address of the allocated memory
> >   * @min:     minimum address to used for the memory allocation
> >   *
> > - * Allocate at the lowest possible address that is not below 'min' as
> > - * EFI_LOADER_DATA. The allocated pages are aligned according to 'align' but at
> > + * Allocate at the lowest possible address that is not below @min as
> > + * EFI_LOADER_DATA. The allocated pages are aligned according to @align but at
> >   * least EFI_ALLOC_ALIGN. The first allocated page will not below the address
> > - * given by 'min'.
> > + * given by @min.
> >   *
> >   * Return:   status code
> >   */
> > @@ -214,7 +214,7 @@ efi_status_t efi_low_alloc_above(unsigned long size, unsigned long align,
> >   * @addr:    start of the memory area to free (must be EFI_PAGE_SIZE
> >   *           aligned)
> >   *
> > - * 'size' is rounded up to a multiple of EFI_ALLOC_ALIGN which is an
> > + * @size is rounded up to a multiple of EFI_ALLOC_ALIGN which is an
> >   * architecture specific multiple of EFI_PAGE_SIZE. So this function should
> >   * only be used to return pages allocated with efi_allocate_pages() or
> >   * efi_low_alloc_above().
> > @@ -230,15 +230,25 @@ void efi_free(unsigned long size, unsigned long addr)
> >       efi_bs_call(free_pages, addr, nr_pages);
> >  }
> >
> > -/*
> > - * Relocate a kernel image, either compressed or uncompressed.
> > - * In the ARM64 case, all kernel images are currently
> > - * uncompressed, and as such when we relocate it we need to
> > - * allocate additional space for the BSS segment. Any low
> > - * memory that this function should avoid needs to be
> > - * unavailable in the EFI memory map, as if the preferred
> > - * address is not available the lowest available address will
> > - * be used.
> > +/**
> > + * efi_relocate_kernel() - copy memory area
> > + * @image_addr:              address of memory area to copy, on exit target address
>
> The "on exit target address" is a little bit confusing IMO.
> Is it like this?
>
>   On exit, @image_addr is updated to the target copy address that was used.
>

Agreed.

> ?  or some other better description?
>
> Thanks.
>
> Acked-by: Randy Dunlap <rdunlap@infradead.org>
>

Applied to efi/next with Randy's suggestion folded in

Heinrich: I folded the first few hunks into the respective changes of
yours that were already queued up

Thanks,


>
> > + * @image_size:              size of memory area to copy
> > + * @alloc_size:              minimum size of memory to allocate, must be greater or
> > + *                   equal to image_size
> > + * @preferred_addr:  preferred target address
> > + * @alignment:               minimum alignment of the allocated memory area. It
> > + *                   should be a power of two.
> > + * @min_addr:                minimum target address
> > + *
> > + * Copy a memory area to a newly allocated memory area aligned according
> > + * to @alignment but at least EFI_ALLOC_ALIGN. If the preferred address
> > + * is not available, the allocated address will not be below @min_addr.
> > + *
> > + * This function is used to copy the Linux kernel verbatim. It does not apply
> > + * any relocation changes.
> > + *
> > + * Return:           status code
> >   */
> >  efi_status_t efi_relocate_kernel(unsigned long *image_addr,
> >                                unsigned long image_size,
> > --
> > 2.25.0
> >
>
>
> --
> ~Randy
>

      reply	other threads:[~2020-02-20  7:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-20  6:53 [PATCH 1/1] efi/libstub: describe efi_relocate_kernel() Heinrich Schuchardt
2020-02-20  7:02 ` Randy Dunlap
2020-02-20  7:52   ` Ard Biesheuvel [this message]

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+Gu8ZvxPdgz9d2ZrbO1vaCrUZs8WW8Bc2sxsrvrCtXtviqg@mail.gmail.com \
    --to=ardb@kernel.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=xypron.glpk@gmx.de \
    /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;
as well as URLs for NNTP newsgroup(s).