Skip to content

Commit 4bf6adb

Browse files
committed
Add variant property for mutually exclusive images
Some platforms include multiple versions of the same firmware component where only one is loaded at runtime based on platform-specific criteria (e.g. device security state). These images typically share the same load address, creating an apparent memory overlap that is intentional. Add a 'variant' property to identify groups of mutually exclusive images. Images sharing the same variant value form a group where at most one will be loaded during any given boot. This allows overlap-detection tools to distinguish intentional address sharing from genuine conflicts. Also add an "Optional properties" section heading to chapter 2, which was missing, and a "Variant images" section to chapter 3 explaining the use case with a detailed example based on TI K3 platforms. Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com>
1 parent 1be2a60 commit 4bf6adb

File tree

2 files changed

+111
-0
lines changed

2 files changed

+111
-0
lines changed

source/chapter2-source-file-format.rst

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,9 @@ load
371371
The compatible here is not derived from the fdt, nor is it used to identify
372372
the fdt. Such usage belongs in the configuration node.
373373

374+
Optional properties
375+
~~~~~~~~~~~~~~~~~~~
376+
374377
.. _prop_phase:
375378

376379
:index:`phase`
@@ -382,6 +385,39 @@ load
382385
"u-boot"
383386
image is a U-Boot image
384387

388+
.. _prop_variant:
389+
390+
:index:`variant`
391+
Identifies a group of :index:`mutually exclusive <pair: images; mutually exclusive>`
392+
images. Images sharing the same variant value will not all be loaded
393+
simultaneously; the boot firmware selects at most one at runtime based on
394+
platform-specific criteria (e.g. device security state).
395+
396+
This property is used by tooling to suppress false-positive overlap warnings
397+
when multiple images in a configuration share the same load address but are
398+
never loaded together.
399+
400+
Example: A platform may include firmware stubs for different security
401+
levels::
402+
403+
tifsstub-hs {
404+
description = "TIFSSTUB for HS devices";
405+
type = "firmware";
406+
load = <0x9dc00000>;
407+
variant = "tifsstub";
408+
};
409+
tifsstub-fs {
410+
description = "TIFSSTUB for FS devices";
411+
type = "firmware";
412+
load = <0x9dc00000>;
413+
variant = "tifsstub";
414+
};
415+
416+
At runtime, the boot firmware loads only the appropriate stub based on the
417+
detected security state. Because both images declare ``variant = "tifsstub"``,
418+
overlap-detection tools understand that the shared load address is
419+
intentional.
420+
385421
Optional nodes
386422
~~~~~~~~~~~~~~
387423

source/chapter3-usage.rst

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,81 @@ before SPL), then TPL will only load images with a phase of "spl". This allows
192192
all images to be provided in a single FIT, with each phase pulling out what is
193193
needed as the boot proceeds.
194194

195+
Variant images
196+
--------------
197+
198+
Some platforms require multiple versions of the same firmware component, where
199+
only one version is loaded at runtime based on platform-specific criteria. A
200+
common example is security-state-dependent firmware: a device may ship with
201+
firmware stubs for different security levels (e.g. high-security, field-
202+
securable, general-purpose), but only one is appropriate for the detected
203+
hardware state.
204+
205+
These images typically share the same load address, since they serve the same
206+
purpose and the hardware expects the firmware at a fixed location. This creates
207+
an apparent memory overlap in the FIT, but it is intentional because the images
208+
are mutually exclusive at runtime.
209+
210+
To express this relationship, images can declare a ``variant`` property (see
211+
:ref:`prop_variant`). Images sharing the same variant value form a mutually
212+
exclusive group: at most one image from the group will be loaded during any
213+
given boot.
214+
215+
Example::
216+
217+
images {
218+
tifsstub-hs {
219+
description = "TIFSSTUB for HS devices";
220+
type = "firmware";
221+
arch = "arm32";
222+
compression = "none";
223+
load = <0x9dc00000>;
224+
entry = <0x9dc00000>;
225+
variant = "tifsstub";
226+
};
227+
tifsstub-fs {
228+
description = "TIFSSTUB for FS devices";
229+
type = "firmware";
230+
arch = "arm32";
231+
compression = "none";
232+
load = <0x9dc00000>;
233+
entry = <0x9dc00000>;
234+
variant = "tifsstub";
235+
};
236+
tifsstub-gp {
237+
description = "TIFSSTUB for GP devices";
238+
type = "firmware";
239+
arch = "arm32";
240+
compression = "none";
241+
load = <0x9dc00000>;
242+
entry = <0x9dc00000>;
243+
variant = "tifsstub";
244+
};
245+
};
246+
247+
configurations {
248+
conf-1 {
249+
firmware = "atf";
250+
loadables = "tee", "tifsstub-hs", "tifsstub-fs", "tifsstub-gp";
251+
fdt = "fdt-1";
252+
};
253+
};
254+
255+
The boot firmware is responsible for selecting the appropriate image from each
256+
variant group. This selection is platform-specific; for example, TI K3 platforms
257+
select based on the device's security state.
258+
259+
Memory-overlap detection
260+
~~~~~~~~~~~~~~~~~~~~~~~~
261+
262+
Tools that validate FIT images (such as ``mkimage``) may check for memory
263+
overlaps between images in a configuration. When images declare the same
264+
``variant`` value, overlap-detection tools should not report conflicts between
265+
them, since they are mutually exclusive by design.
266+
267+
Genuine overlaps (images without a shared variant that would occupy the same
268+
memory simultaneously) remain errors and should be reported.
269+
195270
.. _multi_step:
196271

197272
Multi-step loading

0 commit comments

Comments
 (0)