Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 3D8EFC7618A for ; Sun, 19 Mar 2023 16:31:20 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 998CB83CB4; Sun, 19 Mar 2023 17:31:17 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (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 (2048-bit key; secure) header.d=gmx.de header.i=xypron.glpk@gmx.de header.b="CuW19vHS"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 93FF684F3E; Sun, 19 Mar 2023 17:31:16 +0100 (CET) Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) (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 045EE83AA4 for ; Sun, 19 Mar 2023 17:31:13 +0100 (CET) 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.de; s=s31663417; t=1679243472; i=xypron.glpk@gmx.de; bh=PS+zs/5qj0X/NINa5uEo+Grq409AqMKmtMBQ7WMSfMw=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=CuW19vHS41g4qhSQNZUr5o8bWlP/st9Oxs7SiUJSkuZ9S5ym5zrELLORWE/ttWKni LIkeig6g92WsqAGXhXfNBQpeRejyWnaMGJlsg4XxdJ6UoMFkEzo4zTdI7aJrvTS2rN BY9YWG1zET7v797n3RHcqhFigpZbWuHnM3H4GRSpYniEvaehW652hXy/64W1kyF0G3 MPBGpWh3TcpOC8/i6rP1d8YXC45ofYXwLlW6NQH+JUcfzPBQxnrtqWmvM09+HCeXu3 +Bo6ztP4l+yj52WwUYp5TZGGhssrCh2AYgbUmo8FrfEJCjXLJxg/oc56hTdDv6TIQG Zx4ePcUp0EYKg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.123.94] ([88.152.145.137]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MUGeB-1q3XoB1Ls3-00RGkW; Sun, 19 Mar 2023 17:31:12 +0100 Message-ID: Date: Sun, 19 Mar 2023 17:31:11 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH v2 05/12] x86: Exit EFI boot services before starting kernel Content-Language: en-US To: Simon Glass Cc: Bin Meng , U-Boot Mailing List References: <20230310204903.416969-1-sjg@chromium.org> <20230310204903.416969-6-sjg@chromium.org> From: Heinrich Schuchardt In-Reply-To: <20230310204903.416969-6-sjg@chromium.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:zAMjljCmTohyQXzPGn8Jr8vMptmfpxksrKsXzYmIuA6t+4T7LKx s8w9l2nfi2aUo/JygDHIVlWCOqGEaaf0yp6eBNFA6WPJSXkSc/cn+t7LmzKhFNxS6wU/7GK f3I6of2pYQG4fDlZ6vZNBL8vt4oybsZrBOudu4oAMK1Keoo9zmOT0bkd1a4VGwwQLREK8sp E847r9Z0aS6aznUZgBYvQ== UI-OutboundReport: notjunk:1;M01:P0:IPTwI26GxnQ=;nNg60KJuUvjIoivB+DqpbYcCzx3 d7jrQMJI1rKQYQ/rvwtb5MlnHsYlGX0phJMA/kO/Mbw2CTVhGAsLgEVmGMFBP2Tk5HK8j+hX3 di4TXZLWcvVwPVp+PkDWfsSfC+XCvGpWSimLqC7Jw1N6nlxnVI+2tWvy/NERyZJu7PX/JKIgR PnakX5jhF1KO6axHIyac8CVVqWxmEO629jXvZyRXrbyc8bOHAH9EbiyeZWp6qlql1J//dERxl yq9tIag5b4yjv83Nj8efX2HSWapQZ2qV6siVX8fWkS0srV1X4i3EhLut+Ku2YFPGwPpvxYqlY fGnkZSj9D9C5N5LloRGa7g5uA+HnGncuIzVtR2aTOG4eYWJItvPZ7QfiCvO/yWN0EUFqeYneS r1a1Ts+rXeLfwLAv4CeY1En30OHdOB9MEddBAULn61Z8e5Zr66/6i5IpDacslBI+WZFiJlQ8f 4U7D1o66tSuvDlMQ9rFDpnFmSevjLATkFSOhIqW9zlsgjoKY4N2lyVgLWov79+azhbEFX68Cp Qcvo/xR9FjdTG9zKjpaFAxd7EHXsuziy637j56bWdKBgZCSpKbIIb56ImSyYutViNnSdPQpip 5HCU8dKqGCx3CT3oVSR7YHiA/bvuOrnEfmKkyNk+ErkeBgf7Fq8d5mwTk2d6K12ZtUkbGCRqJ xvHwZ4RGGZQ02e0ddIfqcPNI+RJI3mks0SdFi9+EswFp5OG8MubB9aHWWHD4pu/Sw33CXS1ls ztatVwZayRq6hLDiRR3VE1w5gAMtYc5qNfoP7pBf1AL1TcZ7HjHu7WBaL9YmlRIUYpjbsBKZ9 E/ZeX4YazmVWmCk/KRHdmaAhmy3LsmS1m6F5apFp8Rv4HAnRxvUo77d1ab6GLcJ+l3AU+eHLv sl/X0/v/nwi2+53Frz4dCEIj1LI69eDZFa0Q+D/myt0u+e0s+K12CVIBZ2J/GnOpKEoIV1c0p 5eWsfhVpDGHForLVIBYx6hJq1wk= X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean On 3/10/23 21:48, Simon Glass wrote: > When running the EFI app, we need to exit boot services before jumping > to Linux. > > At some point it may be possible to jump to Linux and pass on the boot > services, so that the Linux efistub can be used. For now, this is not > implemented. The EFI entry point expects the handle and system table. The system table contains more then a pointer to boot services. If you respin the series, consider updating the comment. If you are running with CONFIG_EFI_API=3Dy, you would have to * install the device-tree as configuration table * use LoadImage() to load the kernel image (e.g. from memory) * start the image with StartImage(). Best regards Heinrich > > Signed-off-by: Simon Glass > --- > > (no changes since v1) > > arch/x86/lib/bootm.c | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > > diff --git a/arch/x86/lib/bootm.c b/arch/x86/lib/bootm.c > index 9beb376bb9c..61cb7bc6116 100644 > --- a/arch/x86/lib/bootm.c > +++ b/arch/x86/lib/bootm.c > @@ -10,6 +10,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -156,6 +157,23 @@ int boot_linux_kernel(ulong setup_base, ulong entry= , bool image_64bit) > #ifdef CONFIG_SYS_COREBOOT > timestamp_add_now(TS_U_BOOT_START_KERNEL); > #endif > + > + /* > + * Exit EFI boot services just before jumping, after all console > + * output, since the console won't be available afterwards. > + */ > + if (IS_ENABLED(CONFIG_EFI_APP)) { > + int ret; > + > + ret =3D efi_store_memory_map(efi_get_priv()); > + if (ret) > + return ret; > + printf("Exiting EFI boot services\n"); > + ret =3D efi_call_exit_boot_services(); > + if (ret) > + return ret; > + } > + > if (image_64bit) { > if (!cpu_has_64bit()) { > puts("Cannot boot 64-bit kernel on 32-bit machine\n");