platform/kernel/u-boot.git
11 months agoarm_ffa: efi: introduce FF-A MM communication
Abdellatif El Khlifi [Thu, 13 Jul 2023 13:28:46 +0000 (14:28 +0100)]
arm_ffa: efi: introduce FF-A MM communication

Add MM communication support using FF-A transport

This feature allows accessing MM partitions services through
EFI MM communication protocol. MM partitions such as StandAlonneMM
or smm-gateway secure partitions which reside in secure world.

An MM shared buffer and a door bell event are used to exchange
the data.

The data is used by EFI services such as GetVariable()/SetVariable()
and copied from the communication buffer to the MM shared buffer.

The secure partition is notified about availability of data in the
MM shared buffer by an FF-A message (door bell).

On such event, MM SP can read the data and updates the MM shared
buffer with the response data.

The response data is copied back to the communication buffer and
consumed by the EFI subsystem.

MM communication protocol supports FF-A 64-bit direct messaging.

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Tested-by: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Jens Wiklander <jens.wiklander@linaro.org>
11 months agoarm_ffa: introduce armffa command Sandbox test
Abdellatif El Khlifi [Thu, 13 Jul 2023 13:28:45 +0000 (14:28 +0100)]
arm_ffa: introduce armffa command Sandbox test

Add Sandbox test for the armffa command

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Jens Wiklander <jens.wiklander@linaro.org>
11 months agoarm_ffa: introduce sandbox test cases for UCLASS_FFA
Abdellatif El Khlifi [Thu, 13 Jul 2023 13:28:44 +0000 (14:28 +0100)]
arm_ffa: introduce sandbox test cases for UCLASS_FFA

Add functional test cases for the FF-A support

These tests rely on the FF-A sandbox emulator and FF-A
sandbox driver which help in inspecting the FF-A communication.

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Jens Wiklander <jens.wiklander@linaro.org>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
11 months agoarm_ffa: introduce sandbox FF-A support
Abdellatif El Khlifi [Thu, 13 Jul 2023 13:28:43 +0000 (14:28 +0100)]
arm_ffa: introduce sandbox FF-A support

Emulate Secure World's FF-A ABIs and allow testing U-Boot FF-A support

Features of the sandbox FF-A support:

- Introduce an FF-A emulator
- Introduce an FF-A device driver for FF-A comms with emulated Secure World
- Provides test methods allowing to read the status of the inspected ABIs

The sandbox FF-A emulator supports only 64-bit direct messaging.

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Jens Wiklander <jens.wiklander@linaro.org>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
11 months agoarm_ffa: introduce armffa command
Abdellatif El Khlifi [Thu, 13 Jul 2023 13:28:42 +0000 (14:28 +0100)]
arm_ffa: introduce armffa command

Provide armffa command showcasing the use of the U-Boot FF-A support

armffa is a command showcasing how to invoke FF-A operations.
This provides a guidance to the client developers on how to
call the FF-A bus interfaces. The command also allows to gather secure
partitions information and ping these  partitions. The command is also
helpful in testing the communication with secure partitions.

For more details please refer to the command documentation [1].

[1]: doc/usage/cmd/armffa.rst

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Jens Wiklander <jens.wiklander@linaro.org>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
11 months agoarm_ffa: introduce Arm FF-A support
Abdellatif El Khlifi [Thu, 13 Jul 2023 13:28:41 +0000 (14:28 +0100)]
arm_ffa: introduce Arm FF-A support

Add Arm FF-A support implementing Arm Firmware Framework for Armv8-A v1.0

The Firmware Framework for Arm A-profile processors (FF-A v1.0) [1]
describes interfaces (ABIs) that standardize communication
between the Secure World and Normal World leveraging TrustZone
technology.

This driver uses 64-bit registers as per SMCCCv1.2 spec and comes
on top of the SMCCC layer. The driver provides the FF-A ABIs needed for
querying the FF-A framework from the secure world.

The driver uses SMC32 calling convention which means using the first
32-bit data of the Xn registers.

All supported ABIs come with their 32-bit version except FFA_RXTX_MAP
which has 64-bit version supported.

Both 32-bit and 64-bit direct messaging are supported which allows both
32-bit and 64-bit clients to use the FF-A bus.

FF-A is a discoverable bus and similar to architecture features.
FF-A bus is discovered using ARM_SMCCC_FEATURES mechanism performed
by the PSCI driver.

Clients are able to probe then use the FF-A bus by calling the DM class
searching APIs (e.g: uclass_first_device).

The Secure World is considered as one entity to communicate with
using the FF-A bus. FF-A communication is handled by one device and
one instance (the bus). This FF-A driver takes care of all the
interactions between Normal world and Secure World.

The driver exports its operations to be used by upper layers.

Exported operations:

- ffa_partition_info_get
- ffa_sync_send_receive
- ffa_rxtx_unmap

Generic FF-A methods are implemented in the Uclass (arm-ffa-uclass.c).
Arm specific methods are implemented in the Arm driver (arm-ffa.c).

For more details please refer to the driver documentation [2].

[1]: https://developer.arm.com/documentation/den0077/latest/
[2]: doc/arch/arm64.ffa.rst

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Jens Wiklander <jens.wiklander@linaro.org>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
11 months agolib: uuid: introduce testcase for uuid_str_to_le_bin
Abdellatif El Khlifi [Thu, 13 Jul 2023 13:28:40 +0000 (14:28 +0100)]
lib: uuid: introduce testcase for uuid_str_to_le_bin

provide a test case

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
11 months agolib: uuid: introduce uuid_str_to_le_bin function
Abdellatif El Khlifi [Thu, 13 Jul 2023 13:28:39 +0000 (14:28 +0100)]
lib: uuid: introduce uuid_str_to_le_bin function

convert UUID string to little endian binary data

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Jens Wiklander <jens.wiklander@linaro.org>
11 months agoarm64: smccc: add support for SMCCCv1.2 x0-x17 registers
Abdellatif El Khlifi [Thu, 13 Jul 2023 13:28:38 +0000 (14:28 +0100)]
arm64: smccc: add support for SMCCCv1.2 x0-x17 registers

add support for x0-x17 registers used by the SMC calls

In SMCCC v1.2 [1] arguments are passed in registers x1-x17.
Results are returned in x0-x17.

This work is inspired from the following kernel commit:

arm64: smccc: Add support for SMCCCv1.2 extended input/output registers

[1]: https://documentation-service.arm.com/static/5f8edaeff86e16515cdbe4c6?token=

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
11 months agoMerge tag 'dm-pull-24jul23' of https://source.denx.de/u-boot/custodians/u-boot-dm
Tom Rini [Mon, 24 Jul 2023 18:55:56 +0000 (14:55 -0400)]
Merge tag 'dm-pull-24jul23' of https://source.denx.de/u-boot/custodians/u-boot-dm

buildman refactoring and --maintainer-check
binman TI support
binman cipher support

11 months agoMerge branch '2023-07-22-TI-K3-improvements'
Tom Rini [Mon, 24 Jul 2023 17:55:59 +0000 (13:55 -0400)]
Merge branch '2023-07-22-TI-K3-improvements'

- Actually merge the assorted K3 platform improvements that were
  supposed to be in commit 247aa5a19115 ("Merge branch
  '2023-07-21-assorted-TI-platform-updates'")

11 months agobuildman: Enable test coverage
Simon Glass [Wed, 19 Jul 2023 23:49:31 +0000 (17:49 -0600)]
buildman: Enable test coverage

Enable measuring test coverage for buildman so we can see the gaps. It is
currently at 68%.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Add an option to check maintainers and targets
Simon Glass [Wed, 19 Jul 2023 23:49:30 +0000 (17:49 -0600)]
buildman: Add an option to check maintainers and targets

In poking around it seems that many boards don't define a CONFIG_TARGET
Kconfig variable. This is not strictly necessary, but add an option to
buildman so these can be viewed.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Use -D for --debug
Simon Glass [Wed, 19 Jul 2023 23:49:29 +0000 (17:49 -0600)]
buildman: Use -D for --debug

Change -D to mean --debug for consistency with other tools. This is not a
commonly used option, so the impact should be minimal.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Add a way to print the architecture for a board
Simon Glass [Wed, 19 Jul 2023 23:49:28 +0000 (17:49 -0600)]
buildman: Add a way to print the architecture for a board

This is useful for some tools and is easily available for buildman. Add
a new --print-arch option.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Move copy_files() out ot BuilderThread class
Simon Glass [Wed, 19 Jul 2023 23:49:27 +0000 (17:49 -0600)]
buildman: Move copy_files() out ot BuilderThread class

This does not need to be in the class. Move it out to avoid a pylint
warning.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Tidy up some comments in builderthread
Simon Glass [Wed, 19 Jul 2023 23:49:26 +0000 (17:49 -0600)]
buildman: Tidy up some comments in builderthread

Make sure all functions have full argument documentation.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Tidy up reporting of a toolchain error
Simon Glass [Wed, 19 Jul 2023 23:49:25 +0000 (17:49 -0600)]
buildman: Tidy up reporting of a toolchain error

Provide the text of the exception when something goes wrong.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Avoid passing result into _read_done_file()
Simon Glass [Wed, 19 Jul 2023 23:49:24 +0000 (17:49 -0600)]
buildman: Avoid passing result into _read_done_file()

Move the creating of the result object into the function which sets it
up, to simplify the code.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Create a function to handle config and build
Simon Glass [Wed, 19 Jul 2023 23:49:23 +0000 (17:49 -0600)]
buildman: Create a function to handle config and build

Move this code into a _config_and_build() function, so reduce the size of
run_commit().

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Move checkout code to a separate function
Simon Glass [Wed, 19 Jul 2023 23:49:22 +0000 (17:49 -0600)]
buildman: Move checkout code to a separate function

Put this in its own function to reduce the size of the run_commit()
function

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Move code to decide output dirs
Simon Glass [Wed, 19 Jul 2023 23:49:21 +0000 (17:49 -0600)]
buildman: Move code to decide output dirs

Put this in its own function to reduce the size of the run_commit()
function.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Move code to remove old outputs
Simon Glass [Wed, 19 Jul 2023 23:49:20 +0000 (17:49 -0600)]
buildman: Move code to remove old outputs

Put this in its own function to reduce the size of the run_commit()
function.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Move reading of the done file into a function
Simon Glass [Wed, 19 Jul 2023 23:49:19 +0000 (17:49 -0600)]
buildman: Move reading of the done file into a function

Move this logic into its own function to reduce the size of the
run_commt() function.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Move bulid code into its own function
Simon Glass [Wed, 19 Jul 2023 23:49:18 +0000 (17:49 -0600)]
buildman: Move bulid code into its own function

Split this into its own function so reduce the size of run_commit().

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Move reconfigure code into its own function
Simon Glass [Wed, 19 Jul 2023 23:49:17 +0000 (17:49 -0600)]
buildman: Move reconfigure code into its own function

Split this into its own function so reduce the size of run_commit().

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Convert config_out to string IO
Simon Glass [Wed, 19 Jul 2023 23:49:16 +0000 (17:49 -0600)]
buildman: Convert config_out to string IO

This is probably a little more efficient and it allows passing the object
to another function to write data. Convert config_out to use a string I/O
device.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Move more things into _build_args()
Simon Glass [Wed, 19 Jul 2023 23:49:15 +0000 (17:49 -0600)]
buildman: Move more things into _build_args()

Move more of the argument-building code into this function. Fix a missing
assignment for out_rel_dir too.

Rename the function since it now builds all the arguments.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Move setting of toolchain arguments to _build_args()
Simon Glass [Wed, 19 Jul 2023 23:49:14 +0000 (17:49 -0600)]
buildman: Move setting of toolchain arguments to _build_args()

Move a few more pieces to this new function.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Start a function to set up the make arguments
Simon Glass [Wed, 19 Jul 2023 23:49:13 +0000 (17:49 -0600)]
buildman: Start a function to set up the make arguments

Move some of this code into a new funciion, to help reduce the size of the
run_commits() function.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Drop unnecessary assignment of config_out
Simon Glass [Wed, 19 Jul 2023 23:49:12 +0000 (17:49 -0600)]
buildman: Drop unnecessary assignment of config_out

This is already set up earlier in the function, so drop the extra
assignment.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Correct invalid use of out_dir variable
Simon Glass [Wed, 19 Jul 2023 23:49:11 +0000 (17:49 -0600)]
buildman: Correct invalid use of out_dir variable

This variable has a different meaning in the outer scope. Use a different
name to avoid confusion, or bugs.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Export _get_output_dir() to avoid warnings
Simon Glass [Wed, 19 Jul 2023 23:49:10 +0000 (17:49 -0600)]
buildman: Export _get_output_dir() to avoid warnings

Make this a public memory since it is used outside the class.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Correct most pylint warnings in builderthread
Simon Glass [Wed, 19 Jul 2023 23:49:09 +0000 (17:49 -0600)]
buildman: Correct most pylint warnings in builderthread

Fix the easy warnings in this file.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Convert camel case in builderthread.py
Simon Glass [Wed, 19 Jul 2023 23:49:08 +0000 (17:49 -0600)]
buildman: Convert camel case in builderthread.py

Convert this file to snake case and update all files which use it.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Split parser creation in two
Simon Glass [Wed, 19 Jul 2023 23:49:07 +0000 (17:49 -0600)]
buildman: Split parser creation in two

Split this into two functions to avoid a warning about too many
statements.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Convert camel case in builder.py
Simon Glass [Wed, 19 Jul 2023 23:49:06 +0000 (17:49 -0600)]
buildman: Convert camel case in builder.py

Convert this file to snake case and update all files which use it.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Convert camel case in bsettings.py
Simon Glass [Wed, 19 Jul 2023 23:49:05 +0000 (17:49 -0600)]
buildman: Convert camel case in bsettings.py

Convert this file to snake case and update all files which use it.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Convert to argparse
Simon Glass [Wed, 19 Jul 2023 23:49:04 +0000 (17:49 -0600)]
buildman: Convert to argparse

Use argparse to parse the arguments, since OptionParser is deprecated now.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Add a test for --boards
Simon Glass [Wed, 19 Jul 2023 23:49:03 +0000 (17:49 -0600)]
buildman: Add a test for --boards

Add a simple functional test for the --boards option. Fix the example in
the docs while we are here. Also improve the docs for Builder.count so it
is clearer what it contains.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Correct most pylint warnings in cmdline
Simon Glass [Wed, 19 Jul 2023 23:49:02 +0000 (17:49 -0600)]
buildman: Correct most pylint warnings in cmdline

Tidu up warnings in this file.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Convert camel case in cmdline.py
Simon Glass [Wed, 19 Jul 2023 23:49:01 +0000 (17:49 -0600)]
buildman: Convert camel case in cmdline.py

Convert this file to snake case and update all files which use it.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Create a function to get number of built commits
Simon Glass [Wed, 19 Jul 2023 23:49:00 +0000 (17:49 -0600)]
buildman: Create a function to get number of built commits

Move this code into a function. This removes the last pylint error in
the control module.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Use get_alow_missing() directly to avoid var
Simon Glass [Wed, 19 Jul 2023 23:48:59 +0000 (17:48 -0600)]
buildman: Use get_alow_missing() directly to avoid var

Avoid an unnecessary local variable by moving this code to a function.
This fixes the pylint warning about too many local variables.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Move getting the adjust_cfg into run_builder()
Simon Glass [Wed, 19 Jul 2023 23:48:58 +0000 (17:48 -0600)]
buildman: Move getting the adjust_cfg into run_builder()

Move this into its own function to reduce the size of do_buildman().

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Move checking for make into run_builder()
Simon Glass [Wed, 19 Jul 2023 23:48:57 +0000 (17:48 -0600)]
buildman: Move checking for make into run_builder()

This is not needed until the builder is run. Move it there to reduce the
size of the do_buildman() function.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Adjust show_toolchain_prefix() to not return
Simon Glass [Wed, 19 Jul 2023 23:48:56 +0000 (17:48 -0600)]
buildman: Adjust show_toolchain_prefix() to not return

This function does not need to return. Simplify the code by exiting
immediately.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Drop some unnecessary variables
Simon Glass [Wed, 19 Jul 2023 23:48:55 +0000 (17:48 -0600)]
buildman: Drop some unnecessary variables

Drop some variables at the end of the do_bulidman() function.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Moving running of the builder into a function
Simon Glass [Wed, 19 Jul 2023 23:48:54 +0000 (17:48 -0600)]
buildman: Moving running of the builder into a function

Move this code into a new function. This removes the pylint warning about
too many branches.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Tweak commits and show_bloat
Simon Glass [Wed, 19 Jul 2023 23:48:53 +0000 (17:48 -0600)]
buildman: Tweak commits and show_bloat

Move setting of show_bloat to adjust_options() and adjust how the commits
variable is set. Together these remove the pylint warning about too many
statements.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Move remaining builder properties to constructor
Simon Glass [Wed, 19 Jul 2023 23:48:52 +0000 (17:48 -0600)]
buildman: Move remaining builder properties to constructor

Do these all in the constructor, so it is consistent.

Move the stray builder comment into the correct place.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Avoid too many returns in do_buildman()
Simon Glass [Wed, 19 Jul 2023 23:48:51 +0000 (17:48 -0600)]
buildman: Avoid too many returns in do_buildman()

Fix the pylint warning by using a variable instead of lots of 'return'
statements.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Move commit numbering into determine_series()
Simon Glass [Wed, 19 Jul 2023 23:48:50 +0000 (17:48 -0600)]
buildman: Move commit numbering into determine_series()

Commits are numbered for use in tests. Do this in determine_series() since
it is already dealing with the series.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Move setting up the output dir into a function
Simon Glass [Wed, 19 Jul 2023 23:48:49 +0000 (17:48 -0600)]
buildman: Move setting up the output dir into a function

Move this code into a separate function to reduce the size of the main
do_buildman() directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Move counting of commits into a function
Simon Glass [Wed, 19 Jul 2023 23:48:48 +0000 (17:48 -0600)]
buildman: Move counting of commits into a function

Move this code into a separate function to avoid a pylint warning in
determine_series().

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Build option-adjusting into a function
Simon Glass [Wed, 19 Jul 2023 23:48:47 +0000 (17:48 -0600)]
buildman: Build option-adjusting into a function

Create a separate function to adjust options. Also move show_actions() up
as far as we can in the function.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Pass option values to show_actions()
Simon Glass [Wed, 19 Jul 2023 23:48:46 +0000 (17:48 -0600)]
buildman: Pass option values to show_actions()

Pass in the individual values rather than the whole options object, so we
can see what is needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Pass option values to get_action_summary()
Simon Glass [Wed, 19 Jul 2023 23:48:45 +0000 (17:48 -0600)]
buildman: Pass option values to get_action_summary()

Pass in the individual values rather than the whole options object, so we
can see what is needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Move output-file setup into one place
Simon Glass [Wed, 19 Jul 2023 23:48:44 +0000 (17:48 -0600)]
buildman: Move output-file setup into one place

Collect the two parts of the output-file handling into single place.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobulldman: Set up output_dir earlier
Simon Glass [Wed, 19 Jul 2023 23:48:43 +0000 (17:48 -0600)]
bulldman: Set up output_dir earlier

Set up output_dir at the start of the main function, instead of updating
the options.output_dir option.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobulidman: Move toolchain handling to a function
Simon Glass [Wed, 19 Jul 2023 23:48:42 +0000 (17:48 -0600)]
bulidman: Move toolchain handling to a function

Move the code for dealing with toolchains out into its own function, to
reduce the size of the main function.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Move Boards-object code into a function
Simon Glass [Wed, 19 Jul 2023 23:48:41 +0000 (17:48 -0600)]
buildman: Move Boards-object code into a function

Move the code which obtains a Boards object into its own function, to
reduce the size of the main function.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobulidman: Move more code to determine_series()
Simon Glass [Wed, 19 Jul 2023 23:48:40 +0000 (17:48 -0600)]
bulidman: Move more code to determine_series()

Move some more series-related code here, to reduce the size of the main
function.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Move board-selection code into a function
Simon Glass [Wed, 19 Jul 2023 23:48:39 +0000 (17:48 -0600)]
buildman: Move board-selection code into a function

Create a new determine_boards() function to hold the code which selects
which boards to build.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Add tests for excluding things
Simon Glass [Wed, 19 Jul 2023 23:48:38 +0000 (17:48 -0600)]
buildman: Add tests for excluding things

Add some tests for the -x flag.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Move dry-run handling higher in do_buildman()
Simon Glass [Wed, 19 Jul 2023 23:48:37 +0000 (17:48 -0600)]
buildman: Move dry-run handling higher in do_buildman()

Move this up above where the builder is created, since it no-longer makes
use of the builder.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Drop use of builder in show_actions()
Simon Glass [Wed, 19 Jul 2023 23:48:36 +0000 (17:48 -0600)]
buildman: Drop use of builder in show_actions()

This function only needs the output directory from the builder. This is
passed into the builder, so just pass the same value to show_actions().
The avoids needing a builder to call show_actions().

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Add a test for the -A option
Simon Glass [Wed, 19 Jul 2023 23:48:35 +0000 (17:48 -0600)]
buildman: Add a test for the -A option

This lacks a test at present. Add one.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Move fetch-arch code into a separate function
Simon Glass [Wed, 19 Jul 2023 23:48:34 +0000 (17:48 -0600)]
buildman: Move fetch-arch code into a separate function

Reduce the size of the do_buildman() function a little by moving the code
that handles --fetch-arch into a separate function.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Move series calculations into a separate function
Simon Glass [Wed, 19 Jul 2023 23:48:33 +0000 (17:48 -0600)]
buildman: Move series calculations into a separate function

Reduce the size of the do_buildman() function a little by moving the code
that figures out the series into a separate function.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Move full-help processing to main
Simon Glass [Wed, 19 Jul 2023 23:48:32 +0000 (17:48 -0600)]
buildman: Move full-help processing to main

This does not need any of the control features. Move it out of main to
reduce the size of the do_buildman() function.

For Python 3.6 the -H feature will not work, but this does not seem to be
a huge problem, as it dates from 2016.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Fix most pylint warnings in control
Simon Glass [Wed, 19 Jul 2023 23:48:31 +0000 (17:48 -0600)]
buildman: Fix most pylint warnings in control

Tidy up the easier-to-fix pylint warnings in module 'control'.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Convert camel case in control.py
Simon Glass [Wed, 19 Jul 2023 23:48:30 +0000 (17:48 -0600)]
buildman: Convert camel case in control.py

Convert this file to snake case and update all files which use it.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Tidy up pylint warnings in main
Simon Glass [Wed, 19 Jul 2023 23:48:29 +0000 (17:48 -0600)]
buildman: Tidy up pylint warnings in main

Tidy up the various pylint warnings in module 'main'.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Provide an argument to the -R option
Simon Glass [Wed, 19 Jul 2023 23:48:28 +0000 (17:48 -0600)]
buildman: Provide an argument to the -R option

Allow writing the file to a selected location, since otherwise this is
controlled by the buildman configuration, so cannot be determined by the
caller.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: https://source.denx.de/u-boot/u-boot/-/issues/17

11 months agobuildman: Add an option to check maintainers
Simon Glass [Wed, 19 Jul 2023 23:48:27 +0000 (17:48 -0600)]
buildman: Add an option to check maintainers

Rather than using the -R option to get this report as a side effect, add
a dedicated option for it.

Disable CI for now as there are some missing maintainers, unfortunately.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Correct logic for missing maintainers
Simon Glass [Wed, 19 Jul 2023 23:48:26 +0000 (17:48 -0600)]
buildman: Correct logic for missing maintainers

An orphaned board should produce a warning, as should a missing name for
the maintainer (when '-' is provided). Add these cases.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Sort the maintainer warnings
Simon Glass [Wed, 19 Jul 2023 23:48:25 +0000 (17:48 -0600)]
buildman: Sort the maintainer warnings

Sort the warnings into alphabetical order, for easier reading. Also make
sure that the buildman test files are ignored.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Just display a single line for missing maintainers
Simon Glass [Wed, 19 Jul 2023 23:48:24 +0000 (17:48 -0600)]
buildman: Just display a single line for missing maintainers

At present we get multiple lines of output when a board has no MAINTAINERS
entry:

   WARNING: no status info for 'bananapi-m2-pro'
   WARNING: no maintainers for 'bananapi-m2-pro'

Suppress the 'status' one since it is implied by the other.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Correct operation of MAINTAINERS N:
Simon Glass [Wed, 19 Jul 2023 23:48:23 +0000 (17:48 -0600)]
buildman: Correct operation of MAINTAINERS N:

This doesn't work as intended. Instead it scans every defconfig file
in the source tree.

Fix it and add a test.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Detect boards with no CONFIG_TARGET defined
Simon Glass [Wed, 19 Jul 2023 23:48:22 +0000 (17:48 -0600)]
buildman: Detect boards with no CONFIG_TARGET defined

We generally expected exactly one of these. Add a check for it.

Note: This warning is not displayed by default. An option will be added
to enable it.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Detect boards with multiple CONFIG_TARGETs defined
Simon Glass [Wed, 19 Jul 2023 23:48:21 +0000 (17:48 -0600)]
buildman: Detect boards with multiple CONFIG_TARGETs defined

The TARGET_xxx options are special in that they refer to a single target.
Exactly one should be enabled for each target, corresponding to a
defconfig file.

Detect configs which result in two TARGET_xxx options being set. For
example, at present, TARGET_POLEG and TARET_POLEG_EVB are enabled for the
same board.

Note: This warning is not displayed by default. An option will be added
to enable it.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Refactor target handling in Boards.scan()
Simon Glass [Wed, 19 Jul 2023 23:48:20 +0000 (17:48 -0600)]
buildman: Refactor target handling in Boards.scan()

Move the assert to the top of the function and provide an explicit
variables for the target name and base name.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Warn about dangling maintainer entries
Simon Glass [Wed, 19 Jul 2023 23:48:19 +0000 (17:48 -0600)]
buildman: Warn about dangling maintainer entries

Other than the top-level MAINTAINERS file, all maintainer entries should
actually reference a target. Add a warning to detect those that do not.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Tidy up common code in parse_file()
Simon Glass [Wed, 19 Jul 2023 23:48:18 +0000 (17:48 -0600)]
buildman: Tidy up common code in parse_file()

Use a function to add to the maintainers database, to avoid duplicating
the same code twice.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Add a partial test for ensure_board_list()
Simon Glass [Wed, 19 Jul 2023 23:48:17 +0000 (17:48 -0600)]
buildman: Add a partial test for ensure_board_list()

Create a new function which has the non-UI parts of ensure_board_list().
Add some tests for everything except the N: tag.

While we are here, fix the confusing usage of fname inside a loops that
also uses fname.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Add a test for Boards.output_is_new()
Simon Glass [Wed, 19 Jul 2023 23:48:16 +0000 (17:48 -0600)]
buildman: Add a test for Boards.output_is_new()

Add a test for this code, adjusting the timestamp on various files to
check each use case.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Add a test for Boards.scan_defconfigs()
Simon Glass [Wed, 19 Jul 2023 23:48:15 +0000 (17:48 -0600)]
buildman: Add a test for Boards.scan_defconfigs()

Add a test for this code. It requires some defconfig files and a test
Kconfig to work with, so copy these into the temporary directory at the
start.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Avoid globals in leaf functions
Simon Glass [Wed, 19 Jul 2023 23:48:14 +0000 (17:48 -0600)]
buildman: Avoid globals in leaf functions

Rather than using the global thoughout each function, pass in these
values. This allows tests to use different values when testing the same
functions.

Improve a few comments while we are here.

No functional change is intended.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Drop dead code to handle :CONFIG_ construct
Simon Glass [Wed, 19 Jul 2023 23:48:13 +0000 (17:48 -0600)]
buildman: Drop dead code to handle :CONFIG_ construct

This is not needed anymore, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 252ed872 ("kconfig: remove meaningless prefixes in defconfig files")

11 months agobuildman: Rename the ARM boards
Simon Glass [Wed, 19 Jul 2023 23:48:12 +0000 (17:48 -0600)]
buildman: Rename the ARM boards

Use names consistent with their target names.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Exit with the return code consistently
Simon Glass [Wed, 19 Jul 2023 23:48:11 +0000 (17:48 -0600)]
buildman: Exit with the return code consistently

Test should return a suitable exit code when they fail. Fix this and tidy
up the code a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Allow --debug to enable debugging
Simon Glass [Wed, 19 Jul 2023 23:48:10 +0000 (17:48 -0600)]
buildman: Allow --debug to enable debugging

The -D option is used, but plumb it through --debug to enable a full
traceback when something goes wrong.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: Fix verboose typo and add comment
Simon Glass [Wed, 19 Jul 2023 23:48:09 +0000 (17:48 -0600)]
buildman: Fix verboose typo and add comment

Fix the typo in the RunTests() function, adding comments while we are
here.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobinman: ftest: Add test for u_boot_spl_pubkey_dtb
Lukas Funke [Tue, 18 Jul 2023 11:53:13 +0000 (13:53 +0200)]
binman: ftest: Add test for u_boot_spl_pubkey_dtb

Add test for u_boot_spl_pubkey_dtb. The test adds a public key to the
dtb and checks if the required nodes will be added to the images dtb.

Signed-off-by: Lukas Funke <lukas.funke@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agobinman: doc: Add documentation for Xilinx Bootgen bintool
Lukas Funke [Tue, 18 Jul 2023 11:53:16 +0000 (13:53 +0200)]
binman: doc: Add documentation for Xilinx Bootgen bintool

Add documentation for the 'bootgen' bintool

Signed-off-by: Lukas Funke <lukas.funke@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agobinman: etype: Add u-boot-spl-pubkey-dtb etype
Lukas Funke [Tue, 18 Jul 2023 11:53:15 +0000 (13:53 +0200)]
binman: etype: Add u-boot-spl-pubkey-dtb etype

This adds a new etype 'u-boot-spl-pubkey-dtb'. The etype adds the public
key from a certificate to the dtb. This creates a '/signature' node which
is turn contains the fields which make up the public key. Usually this
is done by 'mkimage -K'. However, 'binman sign' does not add the public
key to the SPL. This is why the pubkey is added using this etype.

The etype calls the underlying 'fdt_add_pubkey' tool.

Signed-off-by: Lukas Funke <lukas.funke@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agobinman: btool: Add fdt_add_pubkey as btool
Lukas Funke [Tue, 18 Jul 2023 11:53:14 +0000 (13:53 +0200)]
binman: btool: Add fdt_add_pubkey as btool

Add btool which calls 'fdt_add_pubkey'

Signed-off-by: Lukas Funke <lukas.funke@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agobinman: doc: Add documentation for fdt_add_pubkey bintool
Lukas Funke [Tue, 18 Jul 2023 11:53:12 +0000 (13:53 +0200)]
binman: doc: Add documentation for fdt_add_pubkey bintool

Add documentation for btool which calls 'fdt_add_pubkey'

Signed-off-by: Lukas Funke <lukas.funke@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agobinman: blob_dtb: Add fake_size argument to ObtainContents()
Lukas Funke [Tue, 18 Jul 2023 11:53:11 +0000 (13:53 +0200)]
binman: blob_dtb: Add fake_size argument to ObtainContents()

The method 'connect_contents_to_file()' calls ObtainsContents() with
'fake_size' argument. Without providing the argument in the blob_dtb
we are not able to call this method without error.

Signed-off-by: Lukas Funke <lukas.funke@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>