diff options
| author | Tom Rini <[email protected]> | 2025-10-22 14:17:16 -0600 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2025-10-22 16:16:31 -0600 |
| commit | b10c055d4e1b5153a331a61ef82a5b01b5bb4c45 (patch) | |
| tree | 71eed5c423cb81260e92ac32d37e5395d62c9393 /include | |
| parent | 8bc918ed97b4c79eecd56969a2898a8c75886c5a (diff) | |
| parent | 6a56d10fdcf1309d2070b62dc15e80a047da971b (diff) | |
Merge patch series "boot: Support priority for global bootmeths"
Simon Glass <[email protected]> says:
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.
Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'include')
| -rw-r--r-- | include/bootflow.h | 19 | ||||
| -rw-r--r-- | include/bootmeth.h | 4 |
2 files changed, 21 insertions, 2 deletions
diff --git a/include/bootflow.h b/include/bootflow.h index 2ef6eb25cf5..1cfdda403ac 100644 --- a/include/bootflow.h +++ b/include/bootflow.h @@ -11,7 +11,8 @@ #include <bootdev.h> #include <image.h> #include <dm/ofnode_decl.h> -#include <linux/types.h> +#include <linux/list.h> +#include <linux/build_bug.h> struct bootstd_priv; struct expo; @@ -213,6 +214,10 @@ enum bootflow_meth_flags_t { BOOTFLOW_METHF_SINGLE_UCLASS = 1 << 3, }; +enum { + BOOTMETH_MAX_COUNT = 32, +}; + /** * struct bootflow_iter - state for iterating through bootflows * @@ -255,10 +260,16 @@ enum bootflow_meth_flags_t { * @cur_prio: Current priority being scanned * @method_order: List of bootmeth devices to use, in order. The normal methods * appear first, then the global ones, if any + * @have_global: true if we have global bootmeths in @method_order[] * @doing_global: true if we are iterating through the global bootmeths (which - * happens before the normal ones) + * generally happens before the normal ones) * @method_flags: flags controlling which methods should be used for this @dev * (enum bootflow_meth_flags_t) + * @methods_done: indicates which methods have been processed, one bit for + * each method in @method_order[] + * @pending_bootdev: if non-NULL, bootdev which will be used when the global + * bootmeths are done + * @pending_method_flags: method flags which will be used with @pending_bootdev */ struct bootflow_iter { int flags; @@ -278,8 +289,12 @@ struct bootflow_iter { int first_glob_method; enum bootdev_prio_t cur_prio; struct udevice **method_order; + bool have_global; bool doing_global; int method_flags; + uint methods_done; + struct udevice *pending_bootdev; + int pending_method_flags; }; /** diff --git a/include/bootmeth.h b/include/bootmeth.h index 26de593a9a4..2a492dfd73a 100644 --- a/include/bootmeth.h +++ b/include/bootmeth.h @@ -30,10 +30,14 @@ enum bootmeth_flags { * * @desc: A long description of the bootmeth * @flags: Flags for this bootmeth (enum bootmeth_flags) + * @glob_prio: Priority for this bootmeth. If unset (0) the bootmeth is started + * before all other bootmeths. Otherwise it is started before the iteration + * reaches the given priority. */ struct bootmeth_uc_plat { const char *desc; int flags; + enum bootdev_prio_t glob_prio; }; /** struct bootmeth_ops - Operations for boot methods */ |
