From patchwork Tue Sep 30 00:51:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 31 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759193515; bh=mid0qsVMqClkCl6hTzcNSpUTlHpDfz+Qsr9xkmN4rr8=; h=From:To:Date:CC:Subject:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=uypztMsVNlkaIcAQkvr/LSU7w6pRJDIN9DBIaAWEAEE1ktHl7p3+7nEbQbTpKdROL mWHzgkZlh02XnX1bqTfsic7pvEDmsbKBPDpQCJdwnOvlmPtftFfvb5tcSw5E5QCY60 9tZLbXS1J85qQfw5P1v7aBD3Gg5t7DQ+NH4XemV1eq64mFUCHKSS8G7wVk2k0Yu3fI GU9+1ncT0z0Jf+WcCJLuDf8QE3KtN1eZpv6jdHTx/Z38qoG4FRlas3vB+KwZIaF2On eHdeEN3bw6O4AyRl84DyVBw3kbTEroRZHZ3mUlnpJ70MVXH6E8BZfSnLR9qRpNvzzA klC732usgipaA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 396EA67E59 for ; Mon, 29 Sep 2025 18:51:55 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 7UEFTwcbJfqj for ; Mon, 29 Sep 2025 18:51:55 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759193515; bh=mid0qsVMqClkCl6hTzcNSpUTlHpDfz+Qsr9xkmN4rr8=; h=From:To:Date:CC:Subject:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=uypztMsVNlkaIcAQkvr/LSU7w6pRJDIN9DBIaAWEAEE1ktHl7p3+7nEbQbTpKdROL mWHzgkZlh02XnX1bqTfsic7pvEDmsbKBPDpQCJdwnOvlmPtftFfvb5tcSw5E5QCY60 9tZLbXS1J85qQfw5P1v7aBD3Gg5t7DQ+NH4XemV1eq64mFUCHKSS8G7wVk2k0Yu3fI GU9+1ncT0z0Jf+WcCJLuDf8QE3KtN1eZpv6jdHTx/Z38qoG4FRlas3vB+KwZIaF2On eHdeEN3bw6O4AyRl84DyVBw3kbTEroRZHZ3mUlnpJ70MVXH6E8BZfSnLR9qRpNvzzA klC732usgipaA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2664467E03 for ; Mon, 29 Sep 2025 18:51:55 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759193509; bh=vhQPBb2r2kniPrScj1dRIZj39Ui9qvFYl7zRr+WU6fs=; h=From:To:Cc:Subject:Date:From; b=nyvwcKKWPYnKjDDBoceQMTu47lK1gXYKZofytxYY1p5Vr1PNGyd7HvE7oDS04NPkw P/3BoU65ZJaul9LV1jtj7bZmjSmPiDcdNLhfXnYx/szvHWYVmIW349gRIzsAOCGJP3 JKq4woALkV7Ua1RCbueJfikdWk4/g4zlbVZdIRDSN1pIWeG1WbxSQcBsmWUGY6at0J q2rErvCh/eUzWgWcVnTfHjdepiVpzITUwEWB/UxsF5lgya1kRbnIEsrm5iftJKjfkZ c2hR33q6wwHqUx+jHnkJgt/TroRQ2cDXxvw/aseNPQJqViL/rc/mg/67EbvKlh7h76 lhH9/M+tTuYTA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id F326F67E15; Mon, 29 Sep 2025 18:51:49 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id 66hWr_V6Bmxp; Mon, 29 Sep 2025 18:51:49 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759193504; bh=CGCBDwKE4AHs1SZ7LKV8FsgagmUWauW/1qiH5v2gkvA=; h=From:To:Cc:Subject:Date:From; b=oPj1BkHfr5phgwmHWIUo8st1gSHd/2vbPxtog5bisyUlPxVAxNurdoZuX7cfgwM2x zUhHfGDSar9X+IY37d8mOHyR/lmW3KPfLYta77avF+QbyZ7q5Tq1NyGYU3jj6c7dJV pU0nePSavOpnrBdrVLFYWAUA0R+DPNR0/osUYu6pIC9cMmbYk2Y8gZpNgdIAfoGjVw 0twQ6F+lqT17OCCyltQP/vUg/NOA6UKs+tNPVDvE7zrdqTfGoJ5lK18uAl9w0TL9Mq l3H6/EA6vkhozs6KdwEmwCvDBYIVgVyoGURQlNwSZlYM2/Ipk6LAssshjgd9W4ZQkh KrNqJxB6Tx1lQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 65CAC67B49; Mon, 29 Sep 2025 18:51:44 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 29 Sep 2025 18:51:16 -0600 Message-ID: <20250930005137.3650600-1-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Message-ID-Hash: NTYO4PGJFCUY5ULC5FQPCAMQCAJ5PTUK X-Message-ID-Hash: NTYO4PGJFCUY5ULC5FQPCAMQCAJ5PTUK X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 00/15] boot: Support priority for global bootmeths List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass At present global bootmeths always run first, before all other bootmeths. Optimisations in the code take advantage of this, putting them at the end, so they can be used once and then forgotten. In some cases it is useful to run global bootmeths later in the boot. For example, the EFI-bootmgr bootmeth may itself scan devices and the network, so running it first can hold up the boot significantly for boards not actually relying on EFI-bootmgr to boot. This series introduces a new field in global bootmeths which indicates the priority, using the same scheme as is used with bootdev hunters. Thus it is possible to insert the EFI-bootmgr bootmeth just before the hunter for network bootdevs is invoked. Despite the simplicity of the concept and the relatively small series, this is a fairly significant enhancement. It is also quite tricky to implement, largely due to the way the original code was written, with global bootmeths being a small, size-optimised add-on to the original bootstd implementation. For now we only allow each global bootmeth to run at most once, but this implementation is written in a way that we could relax that if needed. Then the bootmeth itself could decide whether to run at any particular point in the bootflow iteration. Size growth is about 390 bytes on Thumb2 (e.g. firefly-rk3288) if CONFIG_BOOTMETH_GLOBAL is enabled, which it normally is. With that disabled (which saves about 4K on the same platform), there is no growth. Simon Glass (15): boot: Improve comments related to global bootmeths boot: Add more debugging to iter_incr() boot: Move showing of bootflows out of the command boot: Add a new test for global bootmeths boot: Update first_glob_method when dropping a bootmeth boot: Add a flag for whether there are global bootmeths boot: Keep track of which bootmeths have been used boot: Move preparing bootdev into a function boot: Support rescanning the global bootmeths boot: Only run global bootmeths once each boot: Implement a priority for global bootmeths boot: Don't change the method count after global bootmeths boot: Run global bootmeths after all bootdevs are exhausted boot: Run the EFI bootmgr just before network devices boot: doc: Update for new global-bootmeth features boot/bootflow.c | 275 +++++++++++++++++++++++++++++-- boot/bootmeth-uclass.c | 15 +- boot/bootmeth_efi_mgr.c | 1 + cmd/bootflow.c | 68 +------- doc/develop/bootstd/overview.rst | 26 ++- include/bootflow.h | 29 +++- include/bootmeth.h | 4 + test/boot/bootflow.c | 73 +++++++- 8 files changed, 397 insertions(+), 94 deletions(-)