From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A01EC433EF for ; Wed, 8 Sep 2021 17:37:30 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9F34B60F13 for ; Wed, 8 Sep 2021 17:37:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9F34B60F13 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmx.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 089A78340C; Wed, 8 Sep 2021 19:37:28 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="L9OvQwsP"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8FB3783409; Wed, 8 Sep 2021 19:37:25 +0200 (CEST) Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2F11E83409 for ; Wed, 8 Sep 2021 19:37:22 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=xypron.glpk@gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1631122637; bh=DynLx6pUjCKoR9PdX/8xs1jZrfu0xH3aVT+yFHcnLYY=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=L9OvQwsPmJN7fme2cezSY+Od2sgwKl/iR7DaMiv9/BBG6rSCHORi8RkpML9O6HIBp FK4Uby6yZZLqQ09V+Cj5OGvVUCoR8M52jbZd7hKeIoSxkTGd7PNNBKgYcJqn9cUGNs j0PTp+cOkQ3FRjNPTEMdZ9fyMNnjOypbenI/qOb0= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.123.55] ([88.152.144.157]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MEFzr-1mGYrg0HG1-00AEaB; Wed, 08 Sep 2021 19:37:17 +0200 Subject: Re: [PATCH 07/35] efi: Create a 64-bit app To: Simon Glass , U-Boot Mailing List Cc: Ilias Apalodimas , Bin Meng , Tom Rini , Christian Melki , Alexander Graf References: <20210908133405.696481-1-sjg@chromium.org> <20210908073355.7.I3c79fe51d252ee73f31b0eec9887362ef361e3f8@changeid> From: Heinrich Schuchardt Message-ID: <8a8943dc-4868-6eba-c6d4-80695dc8b18a@gmx.de> Date: Wed, 8 Sep 2021 19:37:16 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <20210908073355.7.I3c79fe51d252ee73f31b0eec9887362ef361e3f8@changeid> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:RcZVZ+BWlkTTTmMmljoLs67l3qQdkNAzezC5HWICL/G1ufe6hpD nG82HZnZTdY0HuwYidSMZ0SpzAQX3yMBWNuoKy08XtRPV993WQLo8k3CiVD0kfxeTA44Dj6 0trRzIaA1IuCCXBgFC9b0I+fNj/6C+B31bc91hav8CgrdzB+x5NDhVGb4r7y3JyruNLHvVA o/MzL/uSWxW8VAfHd6G2A== X-UI-Out-Filterresults: notjunk:1;V03:K0:Vv0h4SGjaSs=:bSkcjsGZ5jC8scSo20pbRU 0egPkvT0YQzMY7rTXT//KySLQPWkSnHT05nJQHkQPtROMpEa3fLMvmzbt1QDkh6Cv4oERPnw9 5+J34MgDbXm2MdvXbtA8aRHQoQwPaOdCKZ6q81YkoWw4t6TySYv5H3ISoXREywd27BeD+ZqzM ayNFXB7XfbYUoS/BRlqN2+j0psBB96u8x7tGFaz/Q+QCM1VpBYkSdDwZMbDi+I5lKxSupaNvf fdllDrHktW64LOgt3AL4Qvv3SqzI2OaY6MkFhE4JGAhQxcY8jQGCwlsKNgRyVQsidgAtCaKrS CQw0priQl+pH86LCaQs5LyoGcY0EfJx8d4aBqca7fYtOFjREaple7+SN0TC8cHIW4YCXLmXBm l/IWa8jT6sYwxYWs8/XvDkTtN3ezlzzAOWVxrqJSGGXta9arUEvCQ5byyQ96yfG+bsLmvkoYZ GugdRN69B/63vuqcOTbAwtMZr9paVonvZAEQE+aceqD3msyuWn+5stVOVsCALq4Wuc8wW2A5E fNWrrERAkXvjCzMWZiu855WqeDOvIE48pOcFMiENCdG66+Fv7UkQOWC8wA/ze9nIHJQJD0eWX q4lzEtbylATA6AgYwEqYGXOtgKEDC8c3juHX1thA3PI4zqdbs5p+7PJnvur1/ZRhi6bfKiDTs YkZHFIdfHTDbYxq3MMXN5Sktd23JphCVzM4jZVZUCBRMF3acJniH0seHaX5mKgyNcXuvDmWHY tGGLAuRRUAx0rn9kXqXdWI1gRqVVoTdeXY/Vny5ncIUOMz/zO2Zo5r9XNYVqtxlnnJh+xa3tI 7OP5xh0ApoZXybbhh6vsorwR9Seya4UT5+cxxrnhv4ihVjjUQikPaQhhzTd20CfD2vZt5IP7B QB4cDULLlGbAiikacTxva5dlhGXM7AToGaviQXpD0qYGZiXRaBoPMTuK54IVWQw04acFOK1Mo 67XfVOWH8vCsr/rHLrIQCA+KlAtI07MAaXF545Cd/T4SKiCNGi5aUwjHk1zNJZ8il5Vr72iM2 kqeD9986XJOfz9YbaFjC+eGHD6iKCkjibHgf6zQIqkb8HImFMj9ZbRN0FRPAj2PTqb9yYLGZz KJNxQzwYB0+dgw= X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean On 9/8/21 3:33 PM, Simon Glass wrote: > Most modern platforms use 64-bit EFI so it is useful to have a U-Boot ap= p > that runs under that. Add a (non-functional) build for this. > > Note that --whole-archive causes the gcc 9.2 linker to crash, so disable > this for now. Once this is resolved, things should work. > > For now, avoid meantioning the documentation for the 64-bit app, since i= t %s/meantioning/mentioning/ > does not work. > > Signed-off-by: Simon Glass > --- > > arch/x86/cpu/u-boot-64.lds | 2 + > arch/x86/cpu/x86_64/Makefile | 4 ++ > arch/x86/cpu/x86_64/cpu.c | 17 -------- > arch/x86/cpu/x86_64/misc.c | 25 ++++++++++++ > board/efi/Kconfig | 15 ++++++- > board/efi/efi-x86_app/Kconfig | 2 +- > board/efi/efi-x86_app/MAINTAINERS | 11 +++++- > ..._app_defconfig =3D> efi-x86_app32_defconfig} | 2 +- > configs/efi-x86_app64_defconfig | 39 +++++++++++++++++++ > doc/develop/uefi/u-boot_on_efi.rst | 4 +- > 10 files changed, 96 insertions(+), 25 deletions(-) > create mode 100644 arch/x86/cpu/x86_64/misc.c > rename configs/{efi-x86_app_defconfig =3D> efi-x86_app32_defconfig} (9= 7%) > create mode 100644 configs/efi-x86_app64_defconfig > > diff --git a/arch/x86/cpu/u-boot-64.lds b/arch/x86/cpu/u-boot-64.lds > index ee0812aefbc..92a30c2a387 100644 > --- a/arch/x86/cpu/u-boot-64.lds > +++ b/arch/x86/cpu/u-boot-64.lds > @@ -15,7 +15,9 @@ SECTIONS > /DISCARD/ : { *(.u_boot_list_2_cmd_*) } > #endif > > +#ifdef CONFIG_SYS_TEXT_BASE > . =3D CONFIG_SYS_TEXT_BASE; /* Location of bootcode in flash */ > +#endif > __text_start =3D .; > > .text.start : { *(.text.start); } > diff --git a/arch/x86/cpu/x86_64/Makefile b/arch/x86/cpu/x86_64/Makefile > index 400f0ffe397..e929563b2c1 100644 > --- a/arch/x86/cpu/x86_64/Makefile > +++ b/arch/x86/cpu/x86_64/Makefile > @@ -4,3 +4,7 @@ > # > > obj-y +=3D cpu.o interrupts.o setjmp.o > + > +ifndef CONFIG_EFI > +obj-y +=3D misc.o > +endif > diff --git a/arch/x86/cpu/x86_64/cpu.c b/arch/x86/cpu/x86_64/cpu.c > index e090b1b478a..fb501218e25 100644 > --- a/arch/x86/cpu/x86_64/cpu.c > +++ b/arch/x86/cpu/x86_64/cpu.c > @@ -52,23 +52,6 @@ int x86_mp_init(void) > return 0; > } > > -int misc_init_r(void) > -{ > - return 0; > -} > - > -#ifndef CONFIG_SYS_COREBOOT > -int checkcpu(void) > -{ > - return 0; > -} > - > -int print_cpuinfo(void) > -{ > - return 0; > -} > -#endif > - > int x86_cpu_reinit_f(void) > { > return 0; > diff --git a/arch/x86/cpu/x86_64/misc.c b/arch/x86/cpu/x86_64/misc.c > new file mode 100644 > index 00000000000..02587ff0c50 > --- /dev/null > +++ b/arch/x86/cpu/x86_64/misc.c > @@ -0,0 +1,25 @@ > +// SPDX-License-Identifier: GPL-2.0+ > +/* > + * (C) Copyright 2016 Google, Inc > + * Written by Simon Glass > + */ > + > +#include > +#include > + > +int misc_init_r(void) > +{ > + return 0; > +} > + > +#ifndef CONFIG_SYS_COREBOOT > +int checkcpu(void) > +{ > + return 0; > +} > + > +int print_cpuinfo(void) > +{ > + return 0; > +} > +#endif > diff --git a/board/efi/Kconfig b/board/efi/Kconfig > index 291bd2ca154..3df6e31c8ba 100644 > --- a/board/efi/Kconfig > +++ b/board/efi/Kconfig > @@ -4,14 +4,25 @@ choice > prompt "Mainboard model" > optional > > -config TARGET_EFI_APP > - bool "efi application" > +config TARGET_EFI_APP32 > + bool "32-bit efi application" > + select EFI_APP > help > This target is used for running U-Boot on top of EFI. In > this case EFI does the early initialisation, and U-Boot > takes over once the RAM, video and CPU are fully running. > U-Boot is loaded as an application from EFI. > > +config TARGET_EFI_APP64 > + bool "64-bit efi application" > + select EFI_APP > + select X86_64 > + help > + This target is used for running U-Boot on top of EFI in 64-bit mode. > + In this case EFI does the early initialisation, and U-Boot > + takes over once the RAM, video and CPU are fully running. > + U-Boot is loaded as an application from EFI. > + > config TARGET_EFI_PAYLOAD > bool "efi payload" > help > diff --git a/board/efi/efi-x86_app/Kconfig b/board/efi/efi-x86_app/Kconf= ig > index ae87bf34d37..e412702eed7 100644 > --- a/board/efi/efi-x86_app/Kconfig > +++ b/board/efi/efi-x86_app/Kconfig > @@ -1,4 +1,4 @@ > -if TARGET_EFI_APP > +if EFI_APP > > config SYS_BOARD > default "efi-x86_app" > diff --git a/board/efi/efi-x86_app/MAINTAINERS b/board/efi/efi-x86_app/M= AINTAINERS > index fb8a6b1c2fa..b292811a8f0 100644 > --- a/board/efi/efi-x86_app/MAINTAINERS > +++ b/board/efi/efi-x86_app/MAINTAINERS > @@ -1,6 +1,13 @@ > -EFI-X86_APP BOARD > +EFI-X86_APP32 BOARD > M: Simon Glass > S: Maintained > F: board/efi/efi-x86_app/ > F: include/configs/efi-x86_app.h > -F: configs/efi-x86_app_defconfig > +F: configs/efi-x86_app32_defconfig > + > +EFI-X86_APP64 BOARD > +M: Simon Glass > +S: Maintained > +F: board/efi/efi-x86_app/ > +F: include/configs/efi-x86_app.h > +F: configs/efi-x86_app64_defconfig > diff --git a/configs/efi-x86_app_defconfig b/configs/efi-x86_app32_defco= nfig > similarity index 97% > rename from configs/efi-x86_app_defconfig > rename to configs/efi-x86_app32_defconfig > index e9ee66250cf..43ab3fb99c7 100644 > --- a/configs/efi-x86_app_defconfig > +++ b/configs/efi-x86_app32_defconfig > @@ -5,7 +5,7 @@ CONFIG_DEFAULT_DEVICE_TREE=3D"efi-x86_app" > CONFIG_DEBUG_UART_BASE=3D0 > CONFIG_DEBUG_UART_CLOCK=3D0 > CONFIG_VENDOR_EFI=3Dy > -CONFIG_TARGET_EFI_APP=3Dy > +CONFIG_TARGET_EFI_APP32=3Dy > CONFIG_DEBUG_UART=3Dy > CONFIG_FIT=3Dy > CONFIG_SHOW_BOOT_PROGRESS=3Dy > diff --git a/configs/efi-x86_app64_defconfig b/configs/efi-x86_app64_def= config > new file mode 100644 > index 00000000000..a395d3eb27b > --- /dev/null > +++ b/configs/efi-x86_app64_defconfig > @@ -0,0 +1,39 @@ > +CONFIG_X86=3Dy > +CONFIG_NR_DRAM_BANKS=3D8 > +CONFIG_ENV_SIZE=3D0x1000 > +CONFIG_DEFAULT_DEVICE_TREE=3D"efi-x86_app" > +CONFIG_DEBUG_UART_BASE=3D0 > +CONFIG_DEBUG_UART_CLOCK=3D0 > +CONFIG_VENDOR_EFI=3Dy > +CONFIG_TARGET_EFI_APP64=3Dy > +CONFIG_DEBUG_UART=3Dy > +CONFIG_FIT=3Dy > +CONFIG_SHOW_BOOT_PROGRESS=3Dy > +CONFIG_USE_BOOTARGS=3Dy > +CONFIG_BOOTARGS=3D"root=3D/dev/sdb3 init=3D/sbin/init rootwait ro" > +CONFIG_SYS_CONSOLE_INFO_QUIET=3Dy > +CONFIG_DISPLAY_BOARDINFO_LATE=3Dy > +CONFIG_LAST_STAGE_INIT=3Dy > +CONFIG_HUSH_PARSER=3Dy > +# CONFIG_CMD_BOOTM is not set > +CONFIG_CMD_PART=3Dy > +# CONFIG_CMD_NET is not set > +CONFIG_CMD_TIME=3Dy > +CONFIG_CMD_EXT2=3Dy > +CONFIG_CMD_EXT4=3Dy > +CONFIG_CMD_EXT4_WRITE=3Dy > +CONFIG_CMD_FAT=3Dy > +CONFIG_CMD_FS_GENERIC=3Dy > +CONFIG_MAC_PARTITION=3Dy > +CONFIG_ISO_PARTITION=3Dy > +CONFIG_EFI_PARTITION=3Dy > +CONFIG_OF_EMBED=3Dy > +CONFIG_ENV_OVERWRITE=3Dy > +CONFIG_SYS_RELOC_GD_ENV_ADDR=3Dy > +CONFIG_REGMAP=3Dy > +CONFIG_SYSCON=3Dy > +# CONFIG_DM_ETH is not set > +# CONFIG_REGEX is not set > +# CONFIG_GZIP is not set > +CONFIG_EFI=3Dy > +# CONFIG_EFI_LOADER is not set > diff --git a/doc/develop/uefi/u-boot_on_efi.rst b/doc/develop/uefi/u-boo= t_on_efi.rst > index 59ee3885295..5de7215f6d1 100644 > --- a/doc/develop/uefi/u-boot_on_efi.rst > +++ b/doc/develop/uefi/u-boot_on_efi.rst > @@ -48,10 +48,10 @@ for that board. It will be either 32-bit or 64-bit. = Alternatively, you can > opt for using QEMU [1] and the OVMF [2], as detailed below. > > To build U-Boot as an EFI application (32-bit EFI required), enable CO= NFIG_EFI > -and CONFIG_EFI_APP. The efi-x86_app config (efi-x86_app_defconfig) is s= et up > +and CONFIG_EFI_APP. The efi-x86_app config (efi-x86_app32_defconfig) is= set up > for this. Just build U-Boot as normal, e.g.:: > > - make efi-x86_app_defconfig > + make efi-x86_app32_defconfig > make > > To build U-Boot as an EFI payload (32-bit or 64-bit EFI can be used), = enable >