All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Fleming <matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
To: Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	andy.shevchenko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	pure.logic-SyKdqv6vbfZdzvEItQ6vdLNAH6kLmebB@public.gmane.org,
	hock.leong.kweh-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	bp-Gina5bIWoIWzQB+pC5nmwQ@public.gmane.org,
	sascha.weisenberger-kv7WeFo6aLtBDgjK7y7TUQ@public.gmane.org,
	jan.kiszka-kv7WeFo6aLtBDgjK7y7TUQ@public.gmane.org
Subject: Re: [PATCH 6/8] efi/capsule-loader: indirect calls to efi_capsule_setup_info via weak alias
Date: Tue, 18 Apr 2017 13:44:29 +0100	[thread overview]
Message-ID: <20170418124429.GG24360@codeblueprint.co.uk> (raw)
In-Reply-To: <20170405092317.27921-7-ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

On Wed, 05 Apr, at 10:23:15AM, Ard Biesheuvel wrote:
> To allow platform specific code to hook into the capsule loading
> routines, indirect calls to efi_capsule_setup_info() via a weak alias
> of __efi_capsule_setup_info(), allowing platforms to redefine the former
> but still use the latter.
> 
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> ---
>  drivers/firmware/efi/capsule-loader.c | 52 +++++++++-----------
>  include/linux/efi.h                   | 12 +++++
>  2 files changed, 35 insertions(+), 29 deletions(-)

[...]

> @@ -97,6 +71,26 @@ static int efi_capsule_setup_info(struct capsule_info *cap_info,
>  }
>  
>  /**
> + * efi_capsule_setup_info - obtain the efi capsule header in the binary and
> + *			    setup capsule_info structure
> + * @cap_info: pointer to current instance of capsule_info structure
> + * @kbuff: a mapped first page buffer pointer
> + * @hdr_bytes: the total received number of bytes for efi header
> + **/
> +int __weak efi_capsule_setup_info(struct capsule_info *cap_info, void *kbuff,
> +				  size_t hdr_bytes)
> +{
> +	/* Only process data block that is larger than efi header size */
> +	if (hdr_bytes < sizeof(efi_capsule_header_t))
> +		return 0;
> +
> +	memcpy(&cap_info->header, kbuff, sizeof(cap_info->header));
> +	cap_info->total_size = cap_info->header.imagesize;
> +
> +	return __efi_capsule_setup_info(cap_info);
> +}

It would be good if you provided a little bit of blurb in the function
comment describing why someone might want to override this __weak
function.

Perhaps just something like,

 "Platforms with non-standard capsule update mechanisms can override
  this __weak function so they can perform any required capsule
  image munging. See quark_quirk_function() for an example."

  parent reply	other threads:[~2017-04-18 12:44 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-05  9:23 [PATCH 0/8] efi: add support for non-standard capsule headers Ard Biesheuvel
     [not found] ` <20170405092317.27921-1-ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2017-04-05  9:23   ` [PATCH 1/8] efi/capsule: Fix return code on failing kmap/vmap Ard Biesheuvel
     [not found]     ` <20170405092317.27921-2-ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2017-04-18 12:30       ` Matt Fleming
2017-04-05  9:23   ` [PATCH 2/8] efi/capsule: Remove pr_debug on ENOMEM or EFAULT Ard Biesheuvel
     [not found]     ` <20170405092317.27921-3-ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2017-04-18 12:30       ` Matt Fleming
2017-04-05  9:23   ` [PATCH 3/8] efi/capsule: Clean up pr_err/info messages Ard Biesheuvel
     [not found]     ` <20170405092317.27921-4-ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2017-04-18 12:32       ` Matt Fleming
2017-04-05  9:23   ` [PATCH 4/8] efi/capsule: Adjust return type of efi_capsule_setup_info Ard Biesheuvel
     [not found]     ` <20170405092317.27921-5-ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2017-04-18 12:33       ` Matt Fleming
2017-04-05  9:23   ` [PATCH 5/8] efi/capsule-loader: use cached copy of capsule header Ard Biesheuvel
     [not found]     ` <20170405092317.27921-6-ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2017-04-18 12:34       ` Matt Fleming
2017-04-05  9:23   ` [PATCH 6/8] efi/capsule-loader: indirect calls to efi_capsule_setup_info via weak alias Ard Biesheuvel
     [not found]     ` <20170405092317.27921-7-ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2017-04-18 12:44       ` Matt Fleming [this message]
2017-04-05  9:23   ` [PATCH 7/8] efi/capsule-loader: use page addresses rather than struct page pointers Ard Biesheuvel
     [not found]     ` <20170405092317.27921-8-ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2017-04-18 12:56       ` Matt Fleming
     [not found]         ` <20170418125631.GI24360-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2017-04-18 13:01           ` Ard Biesheuvel
     [not found]             ` <CAKv+Gu9kz89EVh3s0e+uaQ6AZd_5U6xzos+cXdsGvXyR4aogJQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-04-18 13:42               ` Matt Fleming
2017-04-05  9:23   ` [PATCH 8/8] efi/capsule: Add support for Quark security header Ard Biesheuvel
     [not found]     ` <20170405092317.27921-9-ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2017-04-18 12:48       ` Matt Fleming
     [not found]         ` <20170418124853.GH24360-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2017-04-18 12:55           ` Andy Shevchenko
     [not found]             ` <CAHp75VdqSim86_B=h9vu6veT3t8T8FAdOBfGDov-W9B5GNENwg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-04-18 12:59               ` Jan Kiszka
     [not found]                 ` <4daca591-8937-8256-d7f5-a1075ad7714a-kv7WeFo6aLtBDgjK7y7TUQ@public.gmane.org>
2017-04-18 13:44                   ` Matt Fleming
     [not found]                     ` <20170418134426.GK24360-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2017-04-18 13:46                       ` Ard Biesheuvel
     [not found]                         ` <CAKv+Gu_wM-TaZn9jgOW4yCwyjh4cTbszOagKmJdrAdov+3GCsQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-04-18 17:10                           ` Ard Biesheuvel
     [not found]                             ` <CAKv+Gu-uXd30gcUvi_9dErj2bzvTpwVzGR7yiZMgm1KcQHz0dw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-04-18 18:11                               ` Jan Kiszka
2017-04-10 16:34   ` [PATCH 0/8] efi: add support for non-standard capsule headers Jan Kiszka
2017-04-18 16:26   ` Bryan O'Donoghue
     [not found]     ` <f417e914-7b95-9886-fb8f-bca79d5456a3-SyKdqv6vbfZdzvEItQ6vdLNAH6kLmebB@public.gmane.org>
2017-04-18 16:23       ` Ard Biesheuvel
     [not found]         ` <CAKv+Gu9b7ELU4RtcojrSwCmZg8p-oqXzmdTSVqzAhma1Rg+jQQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-04-18 16:28           ` Jan Kiszka
2017-04-18 16:31           ` Bryan O'Donoghue

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=20170418124429.GG24360@codeblueprint.co.uk \
    --to=matt-mf/unelci9gs6ibeejttw/xrex20p6io@public.gmane.org \
    --cc=andy.shevchenko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=bp-Gina5bIWoIWzQB+pC5nmwQ@public.gmane.org \
    --cc=hock.leong.kweh-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=jan.kiszka-kv7WeFo6aLtBDgjK7y7TUQ@public.gmane.org \
    --cc=linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=pure.logic-SyKdqv6vbfZdzvEItQ6vdLNAH6kLmebB@public.gmane.org \
    --cc=sascha.weisenberger-kv7WeFo6aLtBDgjK7y7TUQ@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.