From patchwork Tue Sep 30 00:51:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 451 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=1759193563; bh=Su6xXjAHKkxnkP2koUV3MiB96Q11AkyHnzty1jYz2Os=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=iEDQxbcA/TsV0dTTfJyQPd+Go2A2HFccFjFuWQWj86RY7SGeuP/L124skuA+hNxRB bb0eNsnsAw9DxCCGJVruTgya9/0f69wpwQ47AHuUvz5M0q9MttGpUTMwsnh1KYigi3 wIhptIdYOR+QNOSAXRb1ay1OtwLjYU0AqztBEAfBGQlu17Cp3m6avGDvFoqv7KIwrM K7emHW/els55ZM9ti19/Ji37GcFqIXOOcGSw/VmJ6+DO9y67vlw/DLlcATvSRnwD6o gCzLTHOtDWglL4kvmH+yD5enOKDo6DjykzZNw/Y6Gav0HSmZGylQM6KZlWY0q+poSJ HdJWRLhCv+52Q== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 65A5B67B49 for ; Mon, 29 Sep 2025 18:52:43 -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 HGY52dOowOJ3 for ; Mon, 29 Sep 2025 18:52:43 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759193563; bh=Su6xXjAHKkxnkP2koUV3MiB96Q11AkyHnzty1jYz2Os=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=iEDQxbcA/TsV0dTTfJyQPd+Go2A2HFccFjFuWQWj86RY7SGeuP/L124skuA+hNxRB bb0eNsnsAw9DxCCGJVruTgya9/0f69wpwQ47AHuUvz5M0q9MttGpUTMwsnh1KYigi3 wIhptIdYOR+QNOSAXRb1ay1OtwLjYU0AqztBEAfBGQlu17Cp3m6avGDvFoqv7KIwrM K7emHW/els55ZM9ti19/Ji37GcFqIXOOcGSw/VmJ6+DO9y67vlw/DLlcATvSRnwD6o gCzLTHOtDWglL4kvmH+yD5enOKDo6DjykzZNw/Y6Gav0HSmZGylQM6KZlWY0q+poSJ HdJWRLhCv+52Q== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 537D767E00 for ; Mon, 29 Sep 2025 18:52:43 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759193561; bh=ucf7UGWOAeVEFhPNX2lEaLsyIM3T351wjNPu9lwKfrw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MPiBEbC1qE4KkIYRVF8wJG55rb9khAurYMfkypjUWZvju+B2UFjFhriaq2fVWLspM NjuIzqasyjvETtphXYtaXKcveckGXCmRRRRmLkC/lhs5S5UtWJMb2168XdY4N3kxJW 8vLTwyKYMkhyI2HkpFHHMNCapoSQGVSnUc0C1Ir5IgvPfVuvEEEBeQWL7LiBbDtySQ 31Xy7G3GxCTkLNd66hVVdzsTfmrCQ6+Q/EEgdnsbaX/q2oOnhKm5Yp0tmnSATv9tFK PfzhM4DI6DXMMHdzsskBzFNVf0pMxvhE7fhBmyC0KJO9YR0e8x3ca0yuQBuP/gKJHB C4BIQbeZL8BCA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2999E67B49; Mon, 29 Sep 2025 18:52:41 -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 rOWX1aU3xMBp; Mon, 29 Sep 2025 18:52:41 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759193556; bh=Jj1dEnuPEOoVQSoRUSf/VROoDGooG2bvI+t39SQl0iU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EpqdBt55ZX4ikuBNMsm5bnSgJ9mUD9tFpG1igqFPljQ1woWu7TxDdxtmE4UKZCX2n /+y/Bl90OSbvtpTaMGg2TIYmqSPUMbRIUMXnCCx7aqjj3VpSl/WbTL1e8bcEAiZOAj LO6svfr4oOFLT8G++eoAFGjY6HUTN2vap8GLwWpFf9Kd7BVy2t4XZSfSEInRvSenac k8yfOhBC77i/GIdq88DIEq5Ll/qUvL4G/VHHR8UPI+ToXX5mcbriwJW1/QbXz5yKMg OKrMSKrXZnakRlsL3BxRn23XOD3iiBn/JfYV+5vB6V4N4keId7thS+YSWfKeZ3eRnk AH/x5D4hxanmg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id AA50C5FE1A; Mon, 29 Sep 2025 18:52:36 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 29 Sep 2025 18:51:31 -0600 Message-ID: <20250930005137.3650600-16-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250930005137.3650600-1-sjg@u-boot.org> References: <20250930005137.3650600-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: O5QN3RBJWS3CI2LNJ642NWKHJ7ZOJC4A X-Message-ID-Hash: O5QN3RBJWS3CI2LNJ642NWKHJ7ZOJC4A 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 15/15] boot: doc: Update for new global-bootmeth features 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 Provide some developer documentation on the priority feature for global bootmeths. Signed-off-by: Simon Glass --- doc/develop/bootstd/overview.rst | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/doc/develop/bootstd/overview.rst b/doc/develop/bootstd/overview.rst index ca76bad7bca..4c924e2eb21 100644 --- a/doc/develop/bootstd/overview.rst +++ b/doc/develop/bootstd/overview.rst @@ -133,7 +133,8 @@ which scans for available bootflows, optionally listing each find it finds (-l) and trying to boot it (-b). When global bootmeths are available, these are typically checked before the -above bootdev scanning. +above bootdev scanning, but it is possible provide a priority to make them +run later, by setting the glob_prio field in the driver's bind() method. Controlling ordering @@ -614,9 +615,9 @@ simply copied into the iterator. Either way, the `method_order` array it set up, along with `num_methods`. Note that global bootmeths are always put at the end of the ordering. If any are -present, `cur_method` is set to the first one, so that global bootmeths are done -first. Once all have been used, these bootmeths are dropped from the iteration. -When there are no global bootmeths, `cur_method` is set to 0. +present, `cur_method` is set to the first one, so that global bootmeths are +processed first, so long as their priority allows it. Bootstd keeps track of +which global bootmeths have been used, to make sure they are only used once. At this point the iterator is ready to use, with the first bootmeth selected. Most of the other fields are 0. This means that the current partition @@ -719,6 +720,23 @@ When it sees `BF_NO_MORE_DEVICES` it knows that there is nothing more it can do so it should immediately return. The caller of `iter_incr()` is responsible for updating the `err` field, based on the return value it sees. +Global bootmeths can have a non-zero priority, which indicates where in the +iteration sequence they should run. Each time a new bootdev is produced by a +hunter, all of the global bootmeths are first checked to see if they should run +before this new bootdev. For example, if the bootdev was produced by a hunter +with priority BOOTDEVP_6_NET_BASE, then a quick check is made for global +bootmeths with that priority or less. If there are any, they run before the new +bootdev is processed. + +Assuming they are enabled and the iteration sequence runs right to the end, all +global bootmeths will be used. This is handled by a special case at the end of +iter_incr(), where it processes amy so-far-unused global bootmeths. + +Of course if a specific bootmeth ordering is provided, then this overrides the +default ordering. Global bootmeths must be listed at the end, reflecting their +hybrid nature (they are bootmeths but operate on the system as a whole, not on +a particular bootdev). + The above describes the iteration process at a high level. It is basically a very simple increment function with a checker called `bootflow_check()` that checks the result of each iteration generated, to determine whether it can