From: Alexander Graf <agraf@suse.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 4/8] x86: Tidy up selection of building the EFI stub
Date: Thu, 29 Sep 2016 10:06:55 +0200 [thread overview]
Message-ID: <57ECCB9F.7040903@suse.de> (raw)
In-Reply-To: <CAEUhbmWJmXMrFNC+GZ+2QS-g__0+gwZT6PY8KGf2EYzSfOckDQ@mail.gmail.com>
On 09/29/2016 09:28 AM, Bin Meng wrote:
> Hi Alex,
>
> On Thu, Sep 29, 2016 at 3:13 PM, Alexander Graf <agraf@suse.de> wrote:
>> On 09/29/2016 07:37 AM, Bin Meng wrote:
>>> Hi Alex,
>>>
>>> On Thu, Sep 29, 2016 at 1:08 PM, Alexander Graf <agraf@suse.de> wrote:
>>>>
>>>> Am 29.09.2016 um 05:37 schrieb Bin Meng <bmeng.cn@gmail.com>:
>>>>
>>>> Hi Simon,
>>>>
>>>> On Wed, Sep 28, 2016 at 10:43 PM, Simon Glass <sjg@chromium.org> wrote:
>>>>
>>>> Hi Bin,
>>>>
>>>>
>>>> On 27 September 2016 at 19:23, Bin Meng <bmeng.cn@gmail.com> wrote:
>>>>
>>>> Hi Simon,
>>>>
>>>>
>>>> On Wed, Sep 28, 2016 at 1:55 AM, Simon Glass <sjg@chromium.org> wrote:
>>>>
>>>> Hi Bin,
>>>>
>>>>
>>>> On 26 September 2016 at 20:44, Bin Meng <bmeng.cn@gmail.com> wrote:
>>>>
>>>> Hi Simon,
>>>>
>>>>
>>>> On Tue, Sep 27, 2016 at 8:35 AM, Simon Glass <sjg@chromium.org> wrote:
>>>>
>>>> Hi Bin,
>>>>
>>>>
>>>> On 26 September 2016 at 02:50, Bin Meng <bmeng.cn@gmail.com> wrote:
>>>>
>>>> Hi Simon,
>>>>
>>>>
>>>> On Mon, Sep 26, 2016 at 5:27 AM, Simon Glass <sjg@chromium.org> wrote:
>>>>
>>>> At present we use a CONFIG option in efi.h to determine whether we are
>>>>
>>>> building the EFI stub or not. This means that the same header cannot be
>>>>
>>>> used for EFI_LOADER support. The CONFIG option will be enabled for the
>>>>
>>>> whole build, even when not building the stub.
>>>>
>>>>
>>>> Use a different define instead, set up just for the files that make up
>>>> the
>>>>
>>>> stub.
>>>>
>>>>
>>>> Signed-off-by: Simon Glass <sjg@chromium.org>
>>>>
>>>> ---
>>>>
>>>>
>>>> Changes in v2:
>>>>
>>>> - Add new patch to tidy up selection of building the EFI stub
>>>>
>>>>
>>>> include/efi.h | 7 +++++--
>>>>
>>>> lib/efi/Makefile | 4 ++--
>>>>
>>>> 2 files changed, 7 insertions(+), 4 deletions(-)
>>>>
>>>>
>>>> diff --git a/include/efi.h b/include/efi.h
>>>>
>>>> index d07187c..3d58780 100644
>>>>
>>>> --- a/include/efi.h
>>>>
>>>> +++ b/include/efi.h
>>>>
>>>> @@ -30,8 +30,11 @@ struct efi_device_path;
>>>>
>>>>
>>>> #define EFI_BITS_PER_LONG BITS_PER_LONG
>>>>
>>>>
>>>> -/* With 64-bit EFI stub, EFI_BITS_PER_LONG has to be 64 */
>>>>
>>>> -#ifdef CONFIG_EFI_STUB_64BIT
>>>>
>>>> +/*
>>>>
>>>> + * With 64-bit EFI stub, EFI_BITS_PER_LONG has to be 64. EFI_STUB is set
>>>>
>>>> + * in lib/efi/Makefile, when building the stub.
>>>>
>>>> + */
>>>>
>>>> +#if defined(CONFIG_EFI_STUB_64BIT) && defined(EFI_STUB)
>>>>
>>>>
>>>> I don't understand why this is needed?
>>>>
>>>>
>>>> If building the 64-bit EFI stub, we need to use 64-bit ints for the
>>>>
>>>> stub, but 32-bits for the rest of U-Boot. So this header gets used
>>>>
>>>> both ways.
>>>>
>>>>
>>>>
>>>> For 32-bit EFI stub or U-Boot itself, EFI_BITS_PER_LONG is defined as
>>>>
>>>> BITS_PER_LONG which is 32.
>>>>
>>>>
>>>> Yes that's right. But in the case of the stub, it can be different
>>>>
>>>> from U-Boot itself. This case takes care of that.
>>>>
>>>>
>>>>
>>>> Sorry but I still don't get it. What's broken without this change?
>>>>
>>>>
>>>> When building U-Boot with CONFIG_EFI_STUB_64BIT enabled, at present
>>>>
>>>> EFI_BITS_PER_LONG will be 64.
>>>>
>>>>
>>>> This is fine for building the stub.
>>>>
>>>>
>>>>
>>>> Yes
>>>>
>>>> But for building U-Boot, we still want it to be 32.
>>>>
>>>>
>>>>
>>>> Yes
>>>>
>>>> At present the code overrides EFI_BITS_PER_LONG, setting it to 64 if
>>>>
>>>> CONFIG_EFI_STUB_64BIT is enabled.
>>>>
>>>>
>>>> This means that EFI_LOADER support does not build properly, since it
>>>>
>>>> uses 64 instead of 32.
>>>>
>>>>
>>>>
>>>> So you want CONFIG_EFI_STUB_64BIT and CONFIG_EFI_LOADER both be
>>>> defined? I don't think it is a valid configuration.
>>>>
>>>>
>>>> Why not?
>>>>
>>> So the board has a 64-bit UEFI BIOS, and with CONFIG_EFI_STUB_64BIT we
>>> build U-Boot as a 64-bit UEFI payload and let the UEFI BIOS boot the
>>> payload (U-Boot), then with CONFIG_EFI_LOADER we are trying to provide
>>> the UEFI runtime environment within the U-Boot. What value are we
>>> looking for? This is asking for troubles.
>>
>> Why is this asking for trouble? The inner uefi payload has no idea that the
>> outer uefi firmware exists. It only ever talks to u-boot. I would argue the
>> other way around: If we can't make it work, we have a layering problem.
>>
> This shows no value to me. In the end, providing EFI loader in the
> U-Boot is to load some EFI apps. But this can be done from the
> original UEFI BIOS without the need to have the middle-stage U-Boot
> payload.
You could say the same about running U-Boot on EFI. You can as well just
load your payload from the original uEFI firmware :).
> What layering problem do we want to fix here? Are you saying
> testing EFI loader in the U-Boot is not enough, so that we should
> support such configuration for additional testing?
I'm saying that I don't see anything that speaks against it working, so
why should we disable it? At least for prototyping it's a convenient
option to have and in general divergence is a bad thing.
Alex
next prev parent reply other threads:[~2016-09-29 8:06 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-25 21:27 [U-Boot] [PATCH v2 1/8] x86: Add implementations of setjmp() and longjmp() Simon Glass
2016-09-25 21:27 ` [U-Boot] [PATCH v2 2/8] efi: Use asmlinkage for EFIAPI Simon Glass
2016-09-26 8:50 ` Bin Meng
2016-10-13 14:35 ` [U-Boot] [U-Boot,v2,2/8] " Alexander Graf
2016-09-25 21:27 ` [U-Boot] [PATCH v2 3/8] efi: Fix missing EFIAPI specifiers Simon Glass
2016-10-13 14:35 ` [U-Boot] [U-Boot,v2,3/8] " Alexander Graf
2016-09-25 21:27 ` [U-Boot] [PATCH v2 4/8] x86: Tidy up selection of building the EFI stub Simon Glass
2016-09-26 8:50 ` Bin Meng
2016-09-27 0:35 ` Simon Glass
2016-09-27 2:44 ` Bin Meng
2016-09-27 17:55 ` Simon Glass
2016-09-28 1:23 ` Bin Meng
2016-09-28 14:43 ` Simon Glass
2016-09-29 3:37 ` Bin Meng
2016-09-29 5:08 ` Alexander Graf
2016-09-29 5:37 ` Bin Meng
2016-09-29 7:13 ` Alexander Graf
2016-09-29 7:28 ` Bin Meng
2016-09-29 8:06 ` Alexander Graf [this message]
2016-09-29 8:24 ` Bin Meng
2016-09-25 21:27 ` [U-Boot] [PATCH v2 5/8] arm: efi: Add a hello world test program Simon Glass
2016-09-26 7:36 ` Alexander Graf
2016-09-27 21:28 ` Tom Rini
2016-10-03 21:50 ` Simon Glass
2016-10-04 3:15 ` Alexander Graf
2016-10-04 15:37 ` Simon Glass
2016-10-04 15:50 ` Alexander Graf
2016-10-18 20:37 ` Simon Glass
2016-10-19 7:07 ` Alexander Graf
2016-11-07 15:45 ` Simon Glass
2016-09-26 8:50 ` Bin Meng
2016-09-25 21:27 ` [U-Boot] [PATCH v2 6/8] x86: efi: Add EFI loader support for x86 Simon Glass
2016-10-13 14:35 ` [U-Boot] [U-Boot, v2, " Alexander Graf
2016-09-25 21:27 ` [U-Boot] [PATCH v2 7/8] x86: efi: Add a hello world test program Simon Glass
2016-09-25 21:27 ` [U-Boot] [PATCH v2 8/8] x86: Enable EFI loader support Simon Glass
2016-09-26 7:00 ` [U-Boot] [PATCH v2 1/8] x86: Add implementations of setjmp() and longjmp() Bin Meng
2016-09-26 7:05 ` Alexander Graf
2016-09-26 7:21 ` Bin Meng
2016-09-26 7:28 ` Alexander Graf
2016-09-27 0:34 ` Simon Glass
2016-09-27 2:59 ` Bin Meng
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=57ECCB9F.7040903@suse.de \
--to=agraf@suse.de \
--cc=u-boot@lists.denx.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