public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Simon Glass <sjg@chromium.org>,
	AKASHI Takahiro <takahiro.akashi@linaro.org>,
	U-Boot Mailing List <u-boot@lists.denx.de>
Subject: Re: [PATCH v3 22/32] efi: Update EFI_LOADER to depend on DM_ETH
Date: Sun, 22 Oct 2023 19:53:13 -0400	[thread overview]
Message-ID: <20231022235313.GF496310@bill-the-cat> (raw)
In-Reply-To: <3b87bf3f-a909-4020-8d67-ace84c7ca90c@gmx.de>

[-- Attachment #1: Type: text/plain, Size: 7465 bytes --]

On Mon, Oct 23, 2023 at 12:55:34AM +0200, Heinrich Schuchardt wrote:
> On 10/22/23 23:55, Simon Glass wrote:
> > Hi,
> > 
> > On Sun, 22 Oct 2023 at 07:59, Tom Rini <trini@konsulko.com> wrote:
> > > 
> > > On Sun, Oct 22, 2023 at 10:29:22AM -0400, Tom Rini wrote:
> > > > On Sun, Oct 22, 2023 at 08:08:11AM +0200, Heinrich Schuchardt wrote:
> > > > > On 10/21/23 20:26, Tom Rini wrote:
> > > > > > On Sat, Oct 21, 2023 at 08:43:08AM -0700, Simon Glass wrote:
> > > > > > > Hi,
> > > > > > > 
> > > > > > > On Thu, 19 Oct 2023 at 17:30, AKASHI Takahiro
> > > > > > > <takahiro.akashi@linaro.org> wrote:
> > > > > > > > 
> > > > > > > > On Thu, Oct 19, 2023 at 08:01:11AM -0600, Simon Glass wrote:
> > > > > > > > > Hi Heinrich,
> > > > > > > > > 
> > > > > > > > > On Wed, 18 Oct 2023 at 06:55, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
> > > > > > > > > > 
> > > > > > > > > > On 10/17/23 16:09, Tom Rini wrote:
> > > > > > > > > > > On Mon, Oct 16, 2023 at 04:28:13PM -0600, Simon Glass wrote:
> > > > > > > > > > > 
> > > > > > > > > > > > Since efi_device_path.c calls eth_get_dev() and assumes that Ethernet is
> > > > > > > > > > > > available, add it as an explicit dependency.
> > > > > > > > > > > > 
> > > > > > > > > > > > Signed-off-by: Simon Glass <sjg@chromium.org>
> > > > > > > > > > > > ---
> > > > > > > > > > > > 
> > > > > > > > > > > > (no changes since v2)
> > > > > > > > > > > > 
> > > > > > > > > > > > Changes in v2:
> > > > > > > > > > > > - Add new patch to update EFI_LOADER to depend on DM_ETH
> > > > > > > > > > > > 
> > > > > > > > > > > >     lib/efi_loader/Kconfig | 1 +
> > > > > > > > > > > >     1 file changed, 1 insertion(+)
> > > > > > > > > > > > 
> > > > > > > > > > > > diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
> > > > > > > > > > > > index 13cad6342c36..fca4b3eef270 100644
> > > > > > > > > > > > --- a/lib/efi_loader/Kconfig
> > > > > > > > > > > > +++ b/lib/efi_loader/Kconfig
> > > > > > > > > > > > @@ -11,6 +11,7 @@ config EFI_LOADER
> > > > > > > > > > > >        # We need EFI_STUB_32BIT to be set on x86_32 with EFI_STUB
> > > > > > > > > > > >        depends on !EFI_STUB || !X86 || X86_64 || EFI_STUB_32BIT
> > > > > > > > > > > >        depends on BLK
> > > > > > > > > > > > +    depends on DM_ETH
> > > > > > > > > > > >        depends on !EFI_APP
> > > > > > > > > > > >        default y if !ARM || SYS_CPU = armv7 || SYS_CPU = armv8
> > > > > > > > > > > >        select CHARSET
> > > > > > > > > > > 
> > > > > > > > > > > Does this work for you Heinrich, or do you want to clarify the
> > > > > > > > > > > dependencies (and re-organize the code as needed) around networking?
> > > > > > > > > > > 
> > > > > > > > > > 
> > > > > > > > > > We should be able to boot via EFI on devices without U-Boot network support.
> > > > > > > > > > 
> > > > > > > > > > We already use IS_ENABLED(CONFIG_NETDEVICES) to avoid invoking
> > > > > > > > > > eth_get_dev() if there is no network. CONFIG_NETDEVICES=y selects
> > > > > > > > > > CONFIG_DM_ETH.
> > > > > > > > > > 
> > > > > > > > > > Why is this not sufficient?
> > > > > > > > > > Is there a configuration that does not build?
> > > > > > > > > 
> > > > > > > > > The point of this series is to disable CMDLINE and fix up what breaks.
> > > > > > > > > 
> > > > > > > > > In this case we have some sort of breakage...perhaps Tom has already
> > > > > > > > > found it, but otherwise could you take a look?
> > > > > > > > > 
> > > > > > > > > We should be able to disable NET and LTO in sandbox and still build.
> > > > > > > > > But this fails at present[1]. You can try it on -master
> > > > > > > > 
> > > > > > > > Obviously, it would be necessary to enclose efi_dp_from_eth()
> > > > > > > > with "if defined(CONFIG_NETDEVICES)" (or DM_ETH).
> > > > > > > > Then, we could drop "depends on DM_ETH".
> > > > > > > 
> > > > > > > Strange that it only happens on the non-LTO board, though?
> > > > > > 
> > > > > > There's two issues. The first of which is that I think you need to
> > > > > > re-check your error exactly? With my series, and LTO also disabled the
> > > > > > problem is a call to efi_get_image_parameters() as that's defined in
> > > > > > cmd/bootefi.c, but also only used with cmdline invocations. So we can
> > > > > > fix that CMDLINE=n && LTO=n case with a IS_ENABLED(CONFIG_CMDLINE)
> > > > > > around that, and then discard efi_dp_from_name() entirely.
> > > > > > 
> > > > > > The second issue is that with LTO we more completely find the cases
> > > > > > where if x() calls y() and y() is undefined but nothing calls x() we can
> > > > > > just discard x() and not care that y() is undefined.
> > > > > > 
> > > > > 
> > > > > I will send a patch for function efi_dp_from_eth().
> > > > 
> > > > There's no problem with efi_dp_from_eth as far as I can tell.
> > > > 
> > > > > @Simon
> > > > > 
> > > > > One thing that I don't understand is why we don't let the linker
> > > > > eliminate the unused functions on the sandbox.
> > > > > 
> > > > > On other architectures we put each function into a separate text section
> > > > > and let the linker eliminate the unused text sections:
> > > > > 
> > > > > arch/riscv/config.mk:29:
> > > > > PLATFORM_RELFLAGS       += -fno-common -ffunction-sections -fdata-sections
> > > > > LDFLAGS_u-boot          += --gc-sections -static -pie
> > > > > 
> > > > > Shouldn't we keep the sandbox close to what other architectures do?
> > > > 
> > > > Oh my, I didn't realize that sandbox was missing the garbage collection
> > > > stuff.  Yes, that needs to be fixed first, then we can see what's next
> > > > to change, as there are some issues (my series first fixed CMDLINE=n on
> > > > qemu_arm64).
> > > 
> > > My super quick pass at enabling
> > > function-sections/data-sections/gc-sections shows there's nothing
> > > further needed for CMDLINE=n and LTO=n on sandbox, not even the part I
> > > was looking at before.
> > 
> > I am not sure about the original reason, but sandbox probably
> > pre-dates wholesale enabling of gc-sections (I haven't looked). There
> > is also the issue of whether the host toolchain supports it. Sandbox
> > is supposed to run on a variety of OS types.
> > 
> > I am also not sure of the point ot it...since it is normally pretty
> > easy to use Kconfig to control features.
> > 
> > At least for me 'u-boot -D' doesn't work with Heinrich's patch. Do we
> > really need to make this change? It will rapidly devolve to the point
> > that coming back would be extremely painful.
> 
> It just shows where the code is not clean.
> 
> Linker generated lists referenced by the corresponding macros are
> compiled in (as shows up in u-boot.map). But you have decided not to use
> those macros to access the sandbox command line options. Now they are
> removed as unreferenced garbage.
> 
> Can't we use the linker generated list macros instead of duplicating code?
> 
> * define SANDBOX_CMDLINE_OPT via ll_entry_declare().
> * replace ll_entry_count() instead of __u_boot_sandbox_option_count()
> * use ll_start(), ll_end() for iterating

Oh, it comes down to something like this?  I don't recall if we had
__used the first time we put this on sandbox, but we do now and we use
it for cases where LTO thinks it knows best.  We should be able to do
that too for sandbox.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

  reply	other threads:[~2023-10-22 23:53 UTC|newest]

Thread overview: 98+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-16 22:27 [PATCH v3 00/32] Tidy up use of CONFIG_CMDLINE Simon Glass
2023-10-16 22:27 ` [PATCH v3 01/32] buildman: Use oldconfig when adjusting the config Simon Glass
2023-10-16 22:27 ` [PATCH v3 02/32] bootstd: Correct dependencies on CMDLINE Simon Glass
2023-10-17 13:32   ` Tom Rini
2023-10-18  3:30     ` Simon Glass
2023-10-18 13:25       ` Tom Rini
2023-10-18 14:42   ` Tom Rini
2023-10-18 15:25     ` Simon Glass
2023-10-16 22:27 ` [PATCH v3 03/32] autoboot: " Simon Glass
2023-10-16 22:27 ` [PATCH v3 04/32] cmd: Add a few more " Simon Glass
2023-10-17 13:32   ` Tom Rini
2023-10-18  3:30     ` Simon Glass
2023-10-18 12:56       ` Tom Rini
2023-10-18 13:14   ` Heinrich Schuchardt
2023-10-19 13:59     ` Simon Glass
2023-10-16 22:27 ` [PATCH v3 05/32] test: Make UNIT_TEST depend " Simon Glass
2023-10-16 22:27 ` [PATCH v3 06/32] sifive: Drop an unnecessary #ifdef Simon Glass
2023-10-18 13:51   ` Heinrich Schuchardt
2023-10-18 17:23     ` Sean Anderson
2023-10-18 23:57       ` Tom Rini
2023-10-16 22:27 ` [PATCH v3 07/32] fastboot: Declare a dependency on CMDLINE Simon Glass
2023-10-16 22:27 ` [PATCH v3 08/32] cli: Always build cli_getch Simon Glass
2023-10-16 22:28 ` [PATCH v3 09/32] cmd: Use an #ifdef around run_commandf() Simon Glass
2023-10-17 13:35   ` Tom Rini
2023-10-16 22:28 ` [PATCH v3 10/32] Move bootmenu_conv_key() into its own file Simon Glass
2023-10-16 22:28 ` [PATCH v3 11/32] pxe: Depend on CMDLINE Simon Glass
2023-10-16 22:28 ` [PATCH v3 12/32] env: Split out non-command code into a new file Simon Glass
2023-10-17 13:40   ` Tom Rini
2023-10-18  3:30     ` Simon Glass
2023-10-16 22:28 ` [PATCH v3 13/32] console: Move SYS_PBSIZE into common/ Simon Glass
2023-10-16 22:28 ` [PATCH v3 14/32] bootm: Allow building when cleanup functions are missing Simon Glass
2023-10-17 14:02   ` Tom Rini
2023-10-18  3:31     ` Simon Glass
2023-10-18 12:39       ` Tom Rini
2023-10-19 13:59         ` Simon Glass
2023-10-19 14:54           ` Tom Rini
2023-10-16 22:28 ` [PATCH v3 15/32] fdt: Move working_fdt into fdt_support Simon Glass
2023-10-16 22:28 ` [PATCH v3 16/32] net: Depend on CONFIG_CMDLINE Simon Glass
2023-10-17 14:03   ` Tom Rini
2023-10-18  3:31     ` Simon Glass
2023-10-16 22:28 ` [PATCH v3 17/32] log: Allow use without CONFIG_CMDLINE Simon Glass
2023-10-17 14:05   ` Tom Rini
2023-10-16 22:28 ` [PATCH v3 18/32] video: " Simon Glass
2023-10-17 14:07   ` Tom Rini
2023-10-18  3:31     ` Simon Glass
2023-10-18 12:40       ` Tom Rini
2023-10-16 22:28 ` [PATCH v3 19/32] video: Dont require the font command Simon Glass
2023-10-17 14:07   ` Tom Rini
2023-10-18  3:31     ` Simon Glass
2023-10-18 12:42       ` Tom Rini
2023-10-16 22:28 ` [PATCH v3 20/32] efi: Make commands depend on CMDLINE Simon Glass
2023-10-16 22:28 ` [PATCH v3 21/32] efi: Rearrange the Kconfig for CMD_BOOTEFI_BOOTMGR Simon Glass
2023-10-17  0:50   ` AKASHI Takahiro
2023-10-17 14:13   ` Tom Rini
2023-10-18  3:31     ` Simon Glass
2023-10-16 22:28 ` [PATCH v3 22/32] efi: Update EFI_LOADER to depend on DM_ETH Simon Glass
2023-10-17 14:09   ` Tom Rini
2023-10-18  3:31     ` Simon Glass
2023-10-18 12:43       ` Tom Rini
2023-10-18 12:55     ` Heinrich Schuchardt
2023-10-19 14:01       ` Simon Glass
2023-10-20  0:30         ` AKASHI Takahiro
2023-10-21 15:43           ` Simon Glass
2023-10-21 18:26             ` Tom Rini
2023-10-22  6:08               ` Heinrich Schuchardt
2023-10-22 14:29                 ` Tom Rini
2023-10-22 14:58                   ` Tom Rini
2023-10-22 21:55                     ` Simon Glass
2023-10-22 22:55                       ` Heinrich Schuchardt
2023-10-22 23:53                         ` Tom Rini [this message]
2023-10-22 23:45                       ` Tom Rini
2023-10-23  7:05                         ` Simon Glass
2023-10-23 13:16                           ` Tom Rini
2023-10-23 17:13                             ` Simon Glass
2023-10-23 17:45                               ` Tom Rini
2023-10-24 18:02                                 ` Simon Glass
2023-10-18 13:37   ` Tom Rini
2023-10-18 15:23     ` Simon Glass
2023-10-18 15:27       ` Tom Rini
2023-10-18 16:36         ` Simon Glass
2023-10-19 10:39       ` Peter Robinson
2023-10-19 13:39         ` Tom Rini
2023-10-19 14:01         ` Simon Glass
2023-10-16 22:28 ` [PATCH v3 23/32] cli: Split command-line-editing into its own file Simon Glass
2023-10-16 22:28 ` [PATCH v3 24/32] Add a new Kconfig for command-line entry Simon Glass
2023-10-16 22:28 ` [PATCH v3 25/32] Add a new Kconfig for command-line history Simon Glass
2023-10-16 22:28 ` [PATCH v3 26/32] sandbox: Disable CONFIG_DISTRO_DEFAULTS Simon Glass
2023-10-16 22:28 ` [PATCH v3 27/32] cmd: Make all commands depend on CMDLINE Simon Glass
2023-10-16 22:28 ` [PATCH v3 28/32] sandbox: Avoid requiring cmdline Simon Glass
2023-10-16 22:28 ` [PATCH v3 29/32] arm: x86: Drop discarding of command linker-lists Simon Glass
2023-10-16 22:28 ` [PATCH v3 30/32] mmc: env: Unify the U_BOOT_ENV_LOCATION conditions Simon Glass
2023-10-16 22:28 ` [PATCH v3 31/32] treewide: Tidy up semicolon after command macros Simon Glass
2023-10-16 22:28 ` [PATCH v3 32/32] sandbox: Add a test for disabling CONFIG_CMDLINE Simon Glass
2023-10-17 14:11   ` Tom Rini
2023-10-19  2:32   ` Tom Rini
2023-10-19 14:00     ` Simon Glass
2023-10-19 14:57       ` Tom Rini
2023-10-21 15:44         ` Simon Glass

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=20231022235313.GF496310@bill-the-cat \
    --to=trini@konsulko.com \
    --cc=sjg@chromium.org \
    --cc=takahiro.akashi@linaro.org \
    --cc=u-boot@lists.denx.de \
    --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