]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
5 months agobuildman: Fix a few typos in toolchain code
Simon Glass [Sun, 23 Jun 2024 17:56:19 +0000 (11:56 -0600)]
buildman: Fix a few typos in toolchain code

Fix 'Thie' and capitalise 'unicode'.

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 months agobuildman: Add python3-pycryptodome
Simon Glass [Sun, 23 Jun 2024 17:56:18 +0000 (11:56 -0600)]
buildman: Add python3-pycryptodome

This is used by some Binman entry types, so add it to allow more tests
to pass.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 months agobuildman: Add python3-coverage
Simon Glass [Sun, 23 Jun 2024 17:56:17 +0000 (11:56 -0600)]
buildman: Add python3-coverage

Add this package so we can run code-coverage tests for Binman.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 months agobuildman: Add a way to limit the number of buildmans
Simon Glass [Sun, 23 Jun 2024 17:55:15 +0000 (11:55 -0600)]
buildman: Add a way to limit the number of buildmans

Buildman uses all available CPUs by default, so running more than one or
two concurrent processes is not normally useful.

However in some CI cases we want to be able to run several jobs at once
to save time. For example, in a lab situation we may want to run a test
on 20 boards at a time, since only the build step actually takes much
CPU.

Add an option which allows such a limit. When buildman starts up, it
waits until the number of running processes goes below the limit, then
claims a spot in the list. The list is maintained with a temporary file.

Note that the temp file is user-specific, since it is hard to create a
locked temporary file which can be accessed by any user. In most cases,
only one user is running jobs on a machine, so this should not matter.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 months agobuildman: Add a flag to force mrproper on failure
Simon Glass [Sun, 23 Jun 2024 17:55:13 +0000 (11:55 -0600)]
buildman: Add a flag to force mrproper on failure

When a file is removed by a commit (e.g. include/common.h yay!) it can
cause incremental build failures since one of the dependency files from
a previous build may mention the file.

Add an option to run 'make mrproper' automatically when a build fails.
This can be used to automatically resolve the problem, without always
adding the large overhead of 'make mrproper' to every build.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 months agobuildman: Avoid rebuilding when --mrproper is used
Simon Glass [Sun, 23 Jun 2024 17:55:12 +0000 (11:55 -0600)]
buildman: Avoid rebuilding when --mrproper is used

When this flag is enabled, 'make mrproper' is always used when
reconfiguring, so there is no point in doing it again.

Update this.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 months agobuildman: Make mrproper an argument to run_commit()
Simon Glass [Sun, 23 Jun 2024 17:55:11 +0000 (11:55 -0600)]
buildman: Make mrproper an argument to run_commit()

Pass this in so the caller can change it independently of the member
variable.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 months agobuildman: Make mrproper an argument to _config_and_build()
Simon Glass [Sun, 23 Jun 2024 17:55:10 +0000 (11:55 -0600)]
buildman: Make mrproper an argument to _config_and_build()

Pass this in so the caller can change it independently of the member
variable.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 months agobuildman: Make mrproper an argument to _reconfigure()
Simon Glass [Sun, 23 Jun 2024 17:55:09 +0000 (11:55 -0600)]
buildman: Make mrproper an argument to _reconfigure()

Pass this in so the caller can change it independently of the member
variable.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 months agox86: Set up some assumed sizes for binary blobs
Simon Glass [Sun, 23 Jun 2024 17:55:08 +0000 (11:55 -0600)]
x86: Set up some assumed sizes for binary blobs

Add assumed sizes so that Binman can check that the U-Boot binaries do
not grow too large.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 months agobinman: Make Intel ME default to position 0x1000
Simon Glass [Sun, 23 Jun 2024 17:55:07 +0000 (11:55 -0600)]
binman: Make Intel ME default to position 0x1000

This cannot ever go at offset 0 since the descriptor is there. Use a
better offset for the ME, as used by link and coral, for example.

This matters when we start using assumed sizes for missing blobs.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 months agobinman: Support an assumed size for missing binaries
Simon Glass [Sun, 23 Jun 2024 17:55:06 +0000 (11:55 -0600)]
binman: Support an assumed size for missing binaries

Binman has a the useful feature of handling missing external blobs
gracefully, including allowing them to be missing, deciding whether the
resulting image is functional or not and faking blobs when this is
necessary for particular tools (e.g. mkimage).

This feature is widely used in CI. One drawback is that if U-Boot grows
too large to fit along with the required blobs, then this is not
discovered until someone does a 'real' build which includes the blobs.

Add a 'assume-size' property to entries to allow Binman to reserve a
given size for missing external blobs.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 months agobinman: Update the entrydocs header
Simon Glass [Sun, 23 Jun 2024 17:55:05 +0000 (11:55 -0600)]
binman: Update the entrydocs header

Reduce the length of the underline for this header, to match the
heading itself.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 months agobinman: ti: Regenerate entry docs
Simon Glass [Sun, 23 Jun 2024 17:55:04 +0000 (11:55 -0600)]
binman: ti: Regenerate entry docs

Correct formatting errors in the documentation.

Regenerate the entries.rst file to include this recent addition.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 months agobinman: Regenerate nxp docs
Simon Glass [Sun, 23 Jun 2024 17:55:03 +0000 (11:55 -0600)]
binman: Regenerate nxp docs

Regenerate the entries.rst file to include this recent addition.

Note that more docs are needed here, to actually describe the entry
type.

Note also that the entry type needs Binman tests added.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 months agobinman: efi: Correct entry docs
Simon Glass [Sun, 23 Jun 2024 17:55:02 +0000 (11:55 -0600)]
binman: efi: Correct entry docs

Somehow the class documentation has got out of sync with the generated
entries.rst file. Regenerating it causes errors, so correct these and
regenerate the entries.rst file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 809f28e7213 ("binman: capsule: Use dumped capsule header...")
5 months agoconfigs: enable setvariable at runtime on sandbox
Ilias Apalodimas [Tue, 18 Jun 2024 17:28:20 +0000 (20:28 +0300)]
configs: enable setvariable at runtime on sandbox

We currently don't have any boards enabling CONFIG_EFI_RT_VOLATILE_STORE.
We do have EFI selftests testing the feature though, so enable it in
all the sandbox platforms and test the functionality properly

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
5 months agosandbox: cleanup linker scripts and sections
Ilias Apalodimas [Mon, 17 Jun 2024 15:14:18 +0000 (18:14 +0300)]
sandbox: cleanup linker scripts and sections

commit 6e2228fb052b ("Merge patch series "Clean up arm linker scripts"")
was cleaning up linker scripts for armv7 and v8 in a similar fashion.

Several commits in the past -- e.g
commit d0b5d9da5de2 ("arm: make _end compiler-generated")
was moving symbols to be compiler generated. They were defined as c
variables in its own section to force the compiler emit relative a
reference. However, defining those in the linker script will do the
same thing since [0].

So let's remove the special sections from the linker scripts, the
variable definitions from sections.c, and define them as a symbols.
It's worth noting that the linker was discarding the symbols in the
older binary completely since the symbol definition had an extra _.

- new binary
$~ aarch64-linux-gnu-readelf -sW u-boot | grep efi_runtim
   246: 000000000004acbe    13 FUNC    LOCAL  DEFAULT   14 vbe_req_efi_runtime_rand
  3198: 0000000000318690    16 OBJECT  LOCAL  DEFAULT   29 efi_runtime_mmio
  6359: 00000000000dedff   217 FUNC    LOCAL  DEFAULT   14 efi_runtime_relocate
  7942: 00000000003074c0   136 OBJECT  GLOBAL HIDDEN    29 efi_runtime_services
  8869: 0000000000305e20     0 NOTYPE  GLOBAL DEFAULT   27 __efi_runtime_rel_stop
  9159: 0000000000305e20     0 NOTYPE  GLOBAL DEFAULT   27 __efi_runtime_stop
  9410: 0000000000305e20     0 NOTYPE  GLOBAL DEFAULT   27 __efi_runtime_start
 10137: 00000000005981bd     0 NOTYPE  WEAK   HIDDEN    33 efi_runtime.c.de5bed54
 10470: 0000000000305e20     0 NOTYPE  GLOBAL DEFAULT   27 __efi_runtime_rel_start

- old binary
$~ aarch64-linux-gnu-readelf -sW u-boot.old | grep efi_runtim
   246: 000000000004acbe    13 FUNC    LOCAL  DEFAULT   14 vbe_req_efi_runtime_rand
  3198: 0000000000318690    16 OBJECT  LOCAL  DEFAULT   29 efi_runtime_mmio
  6359: 00000000000dedff   221 FUNC    LOCAL  DEFAULT   14 efi_runtime_relocate
  7942: 00000000003074c0   136 OBJECT  GLOBAL HIDDEN    29 efi_runtime_services
 10135: 0000000000598320     0 NOTYPE  WEAK   HIDDEN    33 efi_runtime.c.de5bed54

$~ bloat-o-meter u-bool.old u-boot
add/remove: 0/0 grow/shrink: 1/1 up/down: 7/-4 (3)
Function                                     old     new   delta
efi_memory_init                              343     350      +7
efi_runtime_relocate                         221     217      -4
Total: Before=2009902, After=2009905, chg +0.00%

[0] binutils commit 6b3b0ab89663 ("Make linker assigned symbol dynamic only for shared object")

Tested-by: Heinrich Schuchardt <xypron.glpk@gmx.de> # sandbox_defconfig on amd64, arm64, riscv64
Reviewed-by: Simon Glass <sjg@chromium.org>
Fixes: commit aac53d3d96a2 ("sandbox: Rename EFI runtime sections")
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
5 months agodm: core: fix typo in SPL_DM_WARN prompt text
Quentin Schulz [Tue, 11 Jun 2024 13:04:27 +0000 (15:04 +0200)]
dm: core: fix typo in SPL_DM_WARN prompt text

It should read "in SPL" and not "wuth SPL".

Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 months agodm: core: migrate debug() messages to use dm_warn
Quentin Schulz [Tue, 11 Jun 2024 13:04:26 +0000 (15:04 +0200)]
dm: core: migrate debug() messages to use dm_warn

Prior to that, seeing the debug() messages required to enable DM_DEBUG
which defines DEBUG (and then _DEBUG) which in turn makes failing
assert() calls reset U-Boot which isn't necessarily what is desired.

Instead, let's migrate to dm_warn which is using log_debug when unset or
log_warn when set.

While at it, reword the DM_DEBUG symbol in Kconfig to explain what it
now actually does.

Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 months agodm: core: fix signedness in debug messages
Quentin Schulz [Tue, 11 Jun 2024 13:04:25 +0000 (15:04 +0200)]
dm: core: fix signedness in debug messages

outp always point to an unsigned type in ofnode_read_u* functions but
the format specifier is currently always using signed type.

This is an issue since the signed type can only contain half of the
unsigned type values above 0.

However, this now breaks another usecase. Indeed,
ofnode_read_s32_default is actually passing an s32 but it'll be printed
as a u32 instead. But since the function is called u32, it makes more
sense to have it print an unsigned value.

This was discovered because arm,smc-id = <0x82000010>; on RK3588S is
above the max signed value and therefore would return a negative signed
decimal value instead of its proper unsigned one.

Fixes: fa12dfa08a7b ("dm: core: support reading a single indexed u64 value")
Fixes: 4bb7075c830c ("dm: core: support reading a single indexed u32 value")
Fixes: 7e5196c409f1 ("dm: core: Add ofnode function to read a 64-bit int")
Fixes: 9e51204527dc ("dm: core: Add operations on device tree references")
Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 months agodm: core: fix misleading debug message when matching compatible
Quentin Schulz [Tue, 11 Jun 2024 13:04:24 +0000 (15:04 +0200)]
dm: core: fix misleading debug message when matching compatible

A driver can have multiple compatible. When the id->compatible matches
for that driver, the first compatible supported by the driver is
currently returned, which gives the following confusing message:

   - found match at 'rk3588_syscon': 'rockchip,rk3588-sys-grf' matches 'rockchip,rk3588-pmugrf'

Considering that the compatible passed in argument is necessarily the
one that exactly matched to enter this code path, there's no need to do
some elaborate logic, just print the driver name and the compatible
passed in argument.

Fixes: d3e773613b6d ("dm: core: Use U-Boot logging instead of pr_debug()")
Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 months agotools: patman: fix deprecated Python ConfigParser methods
Brandon Maier [Tue, 4 Jun 2024 16:16:07 +0000 (16:16 +0000)]
tools: patman: fix deprecated Python ConfigParser methods

The method `ConfigParser.readfp()` is marked deprecated[1].

In Python 3.12 this method have been removed, so replace it with
`ConfigParser.read_file()`.

[1] https://docs.python.org/3.11/library/configparser.html#configparser.ConfigParser.readfp

Signed-off-by: Brandon Maier <brandon.maier@collins.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 months agotools: binman: fix deprecated Python ConfigParser methods
Brandon Maier [Tue, 4 Jun 2024 16:16:06 +0000 (16:16 +0000)]
tools: binman: fix deprecated Python ConfigParser methods

The method `ConfigParser.readfp()` is marked deprecated[1].

In Python 3.12 this method have been removed, so replace it with
`ConfigParser.read_file()`.

[1] https://docs.python.org/3.11/library/configparser.html#configparser.ConfigParser.readfp

Signed-off-by: Brandon Maier <brandon.maier@collins.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 months agotools: binman: fix deprecated Python unittest methods
Brandon Maier [Tue, 4 Jun 2024 16:16:05 +0000 (16:16 +0000)]
tools: binman: fix deprecated Python unittest methods

The methods `unittest.assertEquals()` and
`unittest.assertRegexpMatches()` are marked deprecated[1].

In Python 3.12 these aliases have been removed, so do a sed to replace
them with their new names.

[1] https://docs.python.org/3.11/library/unittest.html#deprecated-aliases

Signed-off-by: Brandon Maier <brandon.maier@collins.com>
CC: Simon Glass <sjg@chromium.org>
CC: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 months agoglobal_data.h: drop write-only field dm_root_f
Rasmus Villemoes [Mon, 27 May 2024 20:04:17 +0000 (22:04 +0200)]
global_data.h: drop write-only field dm_root_f

The dm_root_f field seems to be entirely write-only and hence
redundant, unless 'git grep' fails to find some access generated via
preprocessor token concatenation or similar.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 months agosandbox: enable support for the unlz4 command
Jonathan Liu [Sat, 25 May 2024 08:10:53 +0000 (18:10 +1000)]
sandbox: enable support for the unlz4 command

This does not work with sandbox at present. Fix it up to use map_sysmem()
to convert an address to a pointer.

Signed-off-by: Jonathan Liu <net147@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix conflict and reformat to 80cols:
Signed-off-by: Simon Glass <sjg@chromium.org>
5 months agopatman: Add a tag for when a patch gets added to a series
Sean Anderson [Fri, 19 Apr 2024 02:36:32 +0000 (22:36 -0400)]
patman: Add a tag for when a patch gets added to a series

When a patch is added to a series after the initial version, there are no
changes to note except that it is new. This is typically done to suppress
the "(no changes in vN)" message. It's also nice to add a change to the
cover letter so reviewers know there is an additional patch. Add a tag to
automate this process a bit.

There are two nits with the current approach:

- It favors '-' as a bullet point, but some people may prefer '*' (or
  something else)
- Tags (e.g. 'patman: ' in 'patman: foo bar') are not stripped. They are
  probably just noise in most series, but they may be useful for treewide
  series to distinguish 'gpio: frobnicate' from 'reset: frobnicate', so
  I've left them in.

Suggestions for the above appreciated.

Suggested-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
5 months agopatman: Add Commit-cc as an alias for Patch-cc
Sean Anderson [Fri, 19 Apr 2024 02:36:31 +0000 (22:36 -0400)]
patman: Add Commit-cc as an alias for Patch-cc

Most tags referring to commits (or patches) are named Commit-something. The
exception is Patch-cc. Add a Commit-cc alias so we can use whichever one is
convenient.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
5 months agopatman: Fix tests if add_maintainers is set to False
Sean Anderson [Fri, 19 Apr 2024 02:36:30 +0000 (22:36 -0400)]
patman: Fix tests if add_maintainers is set to False

If add_maintainers is set to False in the user's ~/.patman config, it will
cause the custom_get_maintainer_script to fail since that test expects
maintainers to be added. Set add_maintainer to True in the .patman config
to prevent this.

Fixes: 8c042fb7f9f ("patman: add '--get-maintainer-script' argument")
Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 months agoacpi: set creator_revision in acpi_fill_header
Heinrich Schuchardt [Thu, 18 Apr 2024 03:11:13 +0000 (05:11 +0200)]
acpi: set creator_revision in acpi_fill_header

We should have a single place where we write the default value to the
creator revision field. If we ever will have any table created by another
tool, we can overwrite the value afterwards.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
5 months agosandbox: use sane access rights for files
Heinrich Schuchardt [Wed, 10 Apr 2024 08:38:28 +0000 (10:38 +0200)]
sandbox: use sane access rights for files

When writing an executable, allowing other users to modify it introduces
a security issue.

Generally we should avoid giving other users write access to our files by
default.

Replace chmod(777) by chmod(755) and chmod(644).

Fixes: 47f5fcfb4169 ("sandbox: Add os_jump_to_image() to run another executable")
Fixes: d9165153caea ("sandbox: add flags for open() call")
Fixes: 5c2859cdc302 ("sandbox: Allow reading/writing of RAM buffer")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
5 months agoMerge branch 'next'
Tom Rini [Mon, 1 Jul 2024 19:17:56 +0000 (13:17 -0600)]
Merge branch 'next'

5 months agoPrepare v2024.07
Tom Rini [Mon, 1 Jul 2024 18:07:18 +0000 (12:07 -0600)]
Prepare v2024.07

Signed-off-by: Tom Rini <trini@konsulko.com>
5 months agoconfigs: Resync with savedefconfig
Tom Rini [Mon, 1 Jul 2024 14:49:37 +0000 (08:49 -0600)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
5 months agoMerge tag 'u-boot-amlogic-20240701' of https://source.denx.de/u-boot/custodians/u...
Tom Rini [Mon, 1 Jul 2024 14:44:28 +0000 (08:44 -0600)]
Merge tag 'u-boot-amlogic-20240701' of https://source.denx.de/u-boot/custodians/u-boot-amlogic into next

- Switch meson dwc3/usb PHY to set_mode callback for switching USB mode

5 months agoRevert "Merge patch series "zlib: Address CVE-2016-9841""
Tom Rini [Mon, 1 Jul 2024 01:03:14 +0000 (19:03 -0600)]
Revert "Merge patch series "zlib: Address CVE-2016-9841""

This series brings our zlib code more up to date. However, it drops an
important performance improvement that is required on some of our
supported platforms in order to boot Linux before the watchdog resets
the system. Furthermore, the "post increment" version of this
performance loop was not tested, so while we can fix it, it would then
require re-testing all platforms. At this point in time, we will revert
updating zlib (which has had a potential security issue since 2016) and
fix this in the v2024.10 release.

This reverts commit 4914263c9a14315390d3ccc4816cf3a94cfd156d, reversing
changes made to ef8ef5f77c9a998f76a48277a883af1645b54117.

Reported-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Tom Rini <trini@konsulko.com>
5 months agoMerge tag 'efi-2024-10-rc1' of https://source.denx.de/u-boot/custodians/u-boot-efi...
Tom Rini [Sun, 30 Jun 2024 16:59:42 +0000 (10:59 -0600)]
Merge tag 'efi-2024-10-rc1' of https://source.denx.de/u-boot/custodians/u-boot-efi into next

Pull request efi-2024-10-rc1

Documentation:
      Update requirements.txt to use current Python module versions
      Add a page describing debugging U-Boot with GDB
      FIT: describe data-size as a conditionally mandatory property
      Correct link to FIT specification in SPL code.
      Correct kaslrseed command long text description

UEFI:
      Add unit test checking that don't have kaslr-seed when measuring boot
      Deduplicate code for measured boot.

Other:
      Print size information in fwu command

5 months agodoc: develop: Add a general section on gdb usage
Alexander Dahl [Wed, 26 Jun 2024 10:47:18 +0000 (12:47 +0200)]
doc: develop: Add a general section on gdb usage

Mashed up from different sources linked below, including the now gone
Wiki and doc/README.arm-relocation file.  Tested on a custom board with
AT91 SAMA5D2 SoC and Segger J-Link Base adapter.  This is only generic
advice here, the usage is not board specific.  Some board docs have more
specific instructions on using gdb with a particular board.

Link: https://www.slideshare.net/slideshow/embedded-recipes-2019-introduction-to-jtag-debugging/177511981
Link: https://boundarydevices.com/debugging-using-segger-j-link-jtag/
Link: https://web.archive.org/web/20141224200032/http://www.denx.de/wiki/view/DULG/DebuggingUBoot
Link: https://web.archive.org/web/20141206064148/http://www.denx.de/wiki/view/DULG/GDBScripts1
Suggested-by: Marek Vasut <marex@denx.de>
Signed-off-by: Alexander Dahl <ada@thorsis.com>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
5 months agodoc: fit: Make data-size a conditionally mandatory property
Bastian Germann [Mon, 24 Jun 2024 17:00:38 +0000 (19:00 +0200)]
doc: fit: Make data-size a conditionally mandatory property

Before 9d0750064e (doc: Move external FIT docs into the main body), the
FIT property data-size was not a mandatory property and still it is not
expected to be set alongside the data property.

Move the data-size property to the "Conditionally mandatory property"
section, where it actually belongs.

Signed-off-by: Bastian Germann <bage@debian.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 months agotpm: allow the user to select the compiled algorithms
Ilias Apalodimas [Sun, 23 Jun 2024 11:48:18 +0000 (14:48 +0300)]
tpm: allow the user to select the compiled algorithms

Simon reports that after enabling all algorithms on the TPM some boards
fail since they don't have enough storage to accommodate the ~5KB growth.

The choice of hash algorithms is determined by the platform and the TPM
configuration. Failing to cap a PCR in a bank which the platform left
active is a security vulnerability. It might allow  unsealing of secrets
if an attacker can replay a good set of measurements into an unused bank.

If MEASURED_BOOT or EFI_TCG2_PROTOCOL is enabled our Kconfig will enable
all supported hashing algorithms. We still want to allow users to add a
TPM and not enable measured boot via EFI or bootm though and at the same
time, control the compiled algorithms for size reasons.

So let's add a function tpm2_allow_extend() which checks the TPM active
PCRs banks against the one U-Boot was compiled with. We only allow
extending PCRs if the algorithms selected during build match the TPM
configuration.

It's worth noting that this is only added for TPM2.0, since TPM1.2 is
lacking a lot of code at the moment to read the available PCR banks.
We unconditionally enable SHA1 when a TPM is selected, which is the only
hashing algorithm v1.2 supports.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org> # chromebook-link
5 months agotpm: Untangle tpm2_get_pcr_info()
Ilias Apalodimas [Sun, 23 Jun 2024 11:48:17 +0000 (14:48 +0300)]
tpm: Untangle tpm2_get_pcr_info()

This function was used on measured boot to retrieve the number of active
PCR banks and was designed to work with the TCG protocols.
Since we now have the need to retrieve the active PCRs outside the
measured boot context -- e.g use the in the command line, decouple the
function.

Create one that will only adheres to TCG TSS2.0 [0] specification called
tpm2_get_pcr_info() which can be used by the TPM2.0 APIs and a new one that
is called from the measured boot context called tcg2_get_pcr_info()

[0] https://trustedcomputinggroup.org/wp-content/uploads/TSS_Overview_Common_Structures_Version-0.9_Revision-03_Review_030918.pdf

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
5 months agoefi_loader: remove unneeded header files
Ilias Apalodimas [Sun, 23 Jun 2024 11:48:16 +0000 (14:48 +0300)]
efi_loader: remove unneeded header files

efi_tcg2.h already includes tpm-v2.h. Remove it

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
5 months agotpm: Move TCG functions into a separate file
Ilias Apalodimas [Sun, 23 Jun 2024 11:48:15 +0000 (14:48 +0300)]
tpm: Move TCG functions into a separate file

The previous patch is moving the TPM TCG headers in their own file for
a cleaner API. Move the functions in their own file as well.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
5 months agotpm: Move TCG headers into a separate file
Ilias Apalodimas [Sun, 23 Jun 2024 11:48:14 +0000 (14:48 +0300)]
tpm: Move TCG headers into a separate file

commit 97707f12fdab ("tpm: Support boot measurements") moved out code
from the EFI subsystem into the TPM one to support measurements when
booting with !EFI.

Those were moved directly into the TPM subsystem and in the tpm-v2.c
library. In hindsight, it would have been better to move it in new
files since the TCG2 is governed by its own spec, it's overeall cleaner
and also easier to enable certain parts of the TPM functionality.

So let's start moving the headers in a new file containing the TCG
specific bits.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
5 months agoefi_loader: remove unused TCG algo definitions
Ilias Apalodimas [Sun, 23 Jun 2024 11:48:13 +0000 (14:48 +0300)]
efi_loader: remove unused TCG algo definitions

commit 97707f12fdab ("tpm: Support boot measurements") moved some of the
EFI TCG code to the TPM subsystem. Those definitions are now in tpm-v2.h.
Let's remove the stale entries

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
5 months agocmd: correct kaslrseed description
Heinrich Schuchardt [Tue, 18 Jun 2024 12:29:13 +0000 (14:29 +0200)]
cmd: correct kaslrseed description

The number of random bytes generated is hard coded as 8.
The command takes no argument.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
5 months agoefi_selftest: can't have measured device-tree with kaslr-seed
Heinrich Schuchardt [Tue, 18 Jun 2024 12:23:48 +0000 (14:23 +0200)]
efi_selftest: can't have measured device-tree with kaslr-seed

Test that we don't have a /chosen/kaslr-seed property if we measure the
device-tree.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
5 months agospl: correct link to FIT specification
Heinrich Schuchardt [Tue, 18 Jun 2024 06:32:30 +0000 (08:32 +0200)]
spl: correct link to FIT specification

Replace the invalid link to the FIT file format specification.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
5 months agodoc: update requirements.txt
Heinrich Schuchardt [Sun, 16 Jun 2024 08:59:48 +0000 (10:59 +0200)]
doc: update requirements.txt

Update all required Python packages to current release.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 months agocmd: fwu: Also print information about size
Michal Simek [Wed, 5 Jun 2024 14:58:27 +0000 (16:58 +0200)]
cmd: fwu: Also print information about size

It is useful when structure is also used for saving vendor data covered
by CRC32.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
5 months agoMerge patch series "automatically add /chosen/kaslr-seed and deduplicate code"
Tom Rini [Fri, 28 Jun 2024 23:31:28 +0000 (17:31 -0600)]
Merge patch series "automatically add /chosen/kaslr-seed and deduplicate code"

Tim Harvey <tharvey@gateworks.com> says:

This series will automatically add /chosen/kaslr-seed to the dt if
DM_RNG is enabled
during the boot process.

If RANDOMIZE_BASE is enabled in the Linux kernel instructing it to
randomize the virtual address at which the kernel image is loaded, it
expects entropy to be provided by the bootloader by populating
/chosen/kaslr-seed with a 64-bit value from source of entropy at boot.

If we have DM_RNG enabled populate this value automatically when
fdt_chosen is called. We skip this if ARMV8_SEC_FIRMWARE_SUPPORT
is enabled as its implementation uses a different source of entropy
that is not yet implemented as DM_RNG. We also skip this if
MEASURED_BOOT is enabled as in that case any modifications to the
dt will cause measured boot to fail (although there are many other
places the dt is altered).

As this fdt node is added elsewhere create a library function and
use it to deduplicate code. We will provide a parameter to overwrite
the node if present.

For our automatic injection, we will use the first rng device and
not overwrite if already present with a non-zero value (which may
have been populated by an earlier boot stage). This way if a board
specific ft_board_setup() function wants to customize this behavior
it can call fdt_kaslrseed with a rng device index of its choosing and
set overwrite true.

Note that the kalsrseed command (CMD_KASLRSEED) is likely pointless now
but left in place in case boot scripts exist that rely on this command
existing and returning success. An informational message is printed to
alert users of this command that it is likely no longer needed.

Note that the Kernel's EFI STUB only relies on EFI_RNG_PROTOCOL for
randomization and completely ignores the kaslr-seed for its own
randomness needs (i.e the randomization of the physical placement of
the kernel). It gets weeded out from the DTB that gets handed over via
efi_install_fdt() as it would also mess up the measured boot DTB TPM
measurements as well.

5 months agotest: cmd: fdt: fix chosen test for DM_RNG
Tim Harvey [Tue, 18 Jun 2024 21:06:09 +0000 (14:06 -0700)]
test: cmd: fdt: fix chosen test for DM_RNG

Now that kaslr-seed is automatically added to the chosen node if DM_RNG
is enabled, adjust the test to expect this.

Take care not to expect kaslr-seed for CONFIG_MEASURED_BOOT and
CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT as we do not add it for those.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Cc: Michal Simek <michal.simek@amd.com>
Cc: Andy Yan <andy.yan@rock-chips.com>
Cc: Akash Gajjar <gajjar04akash@gmail.com>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Devarsh Thakkar <devarsht@ti.com>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Hugo Villeneuve <hvilleneuve@dimonoff.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Cc: Chris Morgan <macromorgan@hotmail.com>
5 months agouse fdt_kaslrseed function to de-duplicate code
Tim Harvey [Tue, 18 Jun 2024 21:06:08 +0000 (14:06 -0700)]
use fdt_kaslrseed function to de-duplicate code

Use the fdt_kaslrseed function to deduplicate code doing the same thing.

Note that the kalsrseed command (CMD_KASLRSEED) is likely pointless now
but left in place in case boot scripts exist that rely on this command
existing and returning success. An informational message is printed to
alert users of this command that it is likely no longer needed.

Note that the Kernel's EFI STUB only relies on EFI_RNG_PROTOCOL for
randomization and completely ignores the kaslr-seed for its own
randomness needs (i.e the randomization of the physical placement of
the kernel). It gets weeded out from the DTB that gets handed over via
efi_install_fdt() as it would also mess up the measured boot DTB TPM
measurements as well.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Michal Simek <michal.simek@amd.com>
Cc: Andy Yan <andy.yan@rock-chips.com>
Cc: Akash Gajjar <gajjar04akash@gmail.com>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Devarsh Thakkar <devarsht@ti.com>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Hugo Villeneuve <hvilleneuve@dimonoff.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Cc: Chris Morgan <macromorgan@hotmail.com>
Acked-by: Michal Simek <michal.simek@amd.com>
5 months agofdt: automatically add /chosen/kaslr-seed if DM_RNG is enabled
Tim Harvey [Tue, 18 Jun 2024 21:06:07 +0000 (14:06 -0700)]
fdt: automatically add /chosen/kaslr-seed if DM_RNG is enabled

If RANDOMIZE_BASE is enabled in the Linux kernel instructing it to
randomize the virtual address at which the kernel image is loaded, it
expects entropy to be provided by the bootloader by populating
/chosen/kaslr-seed with a 64-bit value from source of entropy at boot.

If we have DM_RNG enabled populate this value automatically when
fdt_chosen is called. We skip this if ARMV8_SEC_FIRMWARE_SUPPORT
is enabled as its implementation uses a different source of entropy
that is not yet implemented as DM_RNG. We also skip this if
MEASURED_BOOT is enabled as in that case any modifications to the
dt will cause measured boot to fail (although there are many other
places the dt is altered).

Note that the Kernel's EFI STUB only relies on EFI_RNG_PROTOCOL for
randomization and completely ignores the kaslr-seed for its own
randomness needs (i.e the randomization of the physical placement of
the kernel). It gets weeded out from the DTB that gets handed over via
efi_install_fdt() as it would also mess up the measured boot DTB TPM
measurements as well.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Michal Simek <michal.simek@amd.com>
Cc: Andy Yan <andy.yan@rock-chips.com>
Cc: Akash Gajjar <gajjar04akash@gmail.com>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Devarsh Thakkar <devarsht@ti.com>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Hugo Villeneuve <hvilleneuve@dimonoff.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Cc: Chris Morgan <macromorgan@hotmail.com>
5 months agoAdd fdt_kaslrseed function to add kaslr-seed to chosen node
Tim Harvey [Tue, 18 Jun 2024 21:06:06 +0000 (14:06 -0700)]
Add fdt_kaslrseed function to add kaslr-seed to chosen node

If RANDOMIZE_BASE is enabled in the Linux kernel instructing it to
randomize the virtual address at which the kernel image is loaded, it
expects entropy to be provided by the bootloader by populating
/chosen/kaslr-seed with a 64-bit value from source of entropy at boot.

Add a fdt_kaslrseed function to accommodate this allowing an existing
node to be overwritten if present. For now use the first rng device
but it would be good to enhance this in the future to allow some sort
of selection or policy in choosing the rng device used.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Michal Simek <michal.simek@amd.com>
Cc: Andy Yan <andy.yan@rock-chips.com>
Cc: Akash Gajjar <gajjar04akash@gmail.com>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Devarsh Thakkar <devarsht@ti.com>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Hugo Villeneuve <hvilleneuve@dimonoff.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Cc: Chris Morgan <macromorgan@hotmail.com>
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org>
5 months agoMerge patch series "Bug-fixes for a few boards (reduced series)"
Tom Rini [Fri, 28 Jun 2024 19:55:10 +0000 (13:55 -0600)]
Merge patch series "Bug-fixes for a few boards (reduced series)"

Simon Glass <sjg@chromium.org> says:

This series includes fixes to get some rockchip and nvidia boards
working again. It also drops the broken Beaglebone Black config and
provides a devicetree fix for coral (x86).

5 months agoDrop the special am335x_boneblack_vboot target
Simon Glass [Thu, 27 Jun 2024 08:29:49 +0000 (09:29 +0100)]
Drop the special am335x_boneblack_vboot target

Now that am335x_evm boots OK on the Beaglebone black, drop the latter
and update the docs to cover the change.

Also add a few updates about 'make fit' and drop the note about the
security review, as U-Boot's verified boot has had quite extensive
review now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 months agorockchip: bob: kevin: Disable dcache in SPL
Simon Glass [Thu, 27 Jun 2024 08:29:48 +0000 (09:29 +0100)]
rockchip: bob: kevin: Disable dcache in SPL

This causes a hang, so disable it. Unfortunately the RAM-size fix does
not resolve the problem and I am unsure what is wrong. As soon as the
cache is enabled the board appears to hang.

Fixes: 6d8cdfd1536 ("rockchip: spl: Enable caches to speed up checksum validation")
Signed-off-by: Simon Glass <sjg@chromium.org>
5 months agospl: Allow ATF to work when dcache is disabled
Simon Glass [Thu, 27 Jun 2024 08:29:47 +0000 (09:29 +0100)]
spl: Allow ATF to work when dcache is disabled

The dcache may not be enabled in SPL. Add a check to avoid trying to
use an undefined function.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 months agopower: regulator: Handle autoset in regulators_enable_boot_on()
Simon Glass [Thu, 27 Jun 2024 08:29:46 +0000 (09:29 +0100)]
power: regulator: Handle autoset in regulators_enable_boot_on()

With a recent change, regulators_enable_boot_on() returns an error if a
regulator is already set. Check for and handle this situation.

Fixes: d99fb64a98a power: regulator: Only run autoset once for each regulator
Reviewed-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Reviewed-by: Jonas Karlman <jonas@kwiboo.se>
5 months agorockchip: veyron: Add logging for power init
Simon Glass [Thu, 27 Jun 2024 08:29:45 +0000 (09:29 +0100)]
rockchip: veyron: Add logging for power init

Add better logging for power init so that CONFIG_LOG_ERROR_RETURN can
be enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
5 months agox86: Set a board-size limit for chromebook_link
Simon Glass [Thu, 27 Jun 2024 08:29:44 +0000 (09:29 +0100)]
x86: Set a board-size limit for chromebook_link

Set a size limit for this board so that we get a build error if it grows
too much.

Note that the limit is approximately, since it does not include the FDT,
microcode and fdtmap, which can change in size. However this board is
fairly stable, so overflowing this limit will likely result in the image
not fitting in the ROM space available for U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 months agotpm: Avoid code bloat when not using EFI_TCG2_PROTOCOL
Simon Glass [Thu, 27 Jun 2024 08:29:43 +0000 (09:29 +0100)]
tpm: Avoid code bloat when not using EFI_TCG2_PROTOCOL

It does not make sense to enable all SHA algorithms unless they are
needed. It bloats the code and in this case, causes chromebook_link to
fail to build. That board does use the TPM, but not with measured boot,
nor EFI.

Since EFI_TCG2_PROTOCOL already selects these options, we just need to
add them to MEASURED_BOOT as well.

Note that the original commit combines refactoring and new features,
which makes it hard to see what is going on.

Fixes: 97707f12fda tpm: Support boot measurements
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
5 months agonvidia: nyan-big: Disable debug UART
Simon Glass [Thu, 27 Jun 2024 08:29:42 +0000 (09:29 +0100)]
nvidia: nyan-big: Disable debug UART

This cannot be enabled early in boot since some other init is needed.
At this point it is unclear exactly what init is needed, so disable
the debug UART to avoid a hang.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 months agoarm: mediatek: fix ram init for mt7622 (decrease to 1G)
Frank Wunderlich [Sat, 15 Jun 2024 09:34:56 +0000 (11:34 +0200)]
arm: mediatek: fix ram init for mt7622 (decrease to 1G)

RAM init on mt7622 based bananapi R64 is broken since v2023.10.

Increasing the mem-map does not help here, so i reduced the maximum
available ram in get_ram_size call from 2G to 1G (board has only 1G).

Fixes: 5fd6d4c7b3ad ("arm: mediatek: retrieve ram_base from dts node for armv8 platform")
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
5 months agoboard: mpfs_icicle: change maintainer to Conor
Conor Dooley [Sat, 22 Jun 2024 20:18:31 +0000 (21:18 +0100)]
board: mpfs_icicle: change maintainer to Conor

Padmarao is leaving Microchip soon, and suggested that I should take
over maintaining the Icicle in U-Boot in his stead.

Suggested-by: Padmarao Begari <padmarao.begari@microchip.com>
Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
5 months agoMerge patch series "pxe: Add debugging for booting"
Tom Rini [Wed, 26 Jun 2024 15:58:25 +0000 (09:58 -0600)]
Merge patch series "pxe: Add debugging for booting"

5 months agozboot: Correct use of state_mask argument
Simon Glass [Wed, 19 Jun 2024 12:34:52 +0000 (06:34 -0600)]
zboot: Correct use of state_mask argument

There is confusion in this function between the flag and state_mask
parameters, which prevents the boot from actually happening. Correct
this by using state_mask instead of flag for deciding which states to go
through.

This fixes booting of some 32-bit Debian kernels.

Note: Some sort of CI for this is in the works.

Fixes: 228c6722d44 ("x86: zboot: Avoid iteration in do_zboot_states()")
Signed-off-by: Simon Glass <sjg@chromium.org>
5 months agozboot: Add debugging for booting
Simon Glass [Wed, 19 Jun 2024 12:34:51 +0000 (06:34 -0600)]
zboot: Add debugging for booting

Show the boot arguments and the state mask, to aid debugging.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 months agocmd: gpt: Fix freeing gpt_pte in gpt_verify()
Sam Protsenko [Wed, 19 Jun 2024 21:23:30 +0000 (16:23 -0500)]
cmd: gpt: Fix freeing gpt_pte in gpt_verify()

In case when either gpt_verify_headers() or gpt_verify_partitions()
fails, the memory allocated for gpt_pte will be freed in those functions
internally, but gpt_pte will still contain non-NULL dangling pointer.
The attempt to free it in those cases in gpt_verify() leads to "use
after free" error, which leads to a "Synchronous abort" exception.

This issue was found by running the next command on the device with
incorrect partition table:

    => gpt verify mmc 0 $partitions

which results to:

    No partition list provided - only basic check
    "Synchronous Abort" handler, esr 0x96000021, far 0xba247bff
    ....

Fix the issue by only freeing gpt_pte if none of those functions failed.

Fixes: bbb9ffac6066 ("gpt: command: Extend gpt command to support GPT table verification")
Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
5 months agopxe: Add debugging for booting
Simon Glass [Wed, 19 Jun 2024 12:34:50 +0000 (06:34 -0600)]
pxe: Add debugging for booting

Show which boot protocol is being used.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
5 months agocmd: Make use of U_BOOT_LONGHELP when missing
Tom Rini [Wed, 19 Jun 2024 16:09:44 +0000 (10:09 -0600)]
cmd: Make use of U_BOOT_LONGHELP when missing

After adding the U_BOOT_LONGHELP macro some new commands came in still
that were not making use if it. Switch these cases over and in a few
places add missing newlines as well.

Signed-off-by: Tom Rini <trini@konsulko.com>
5 months agoscripts/Makefile.lib: remove bootph-some-ram property from VPL/TPL/SPL
Quentin Schulz [Wed, 19 Jun 2024 11:33:28 +0000 (13:33 +0200)]
scripts/Makefile.lib: remove bootph-some-ram property from VPL/TPL/SPL

The property isn't useful in VPL/SPL/TPL as it is only for U-Boot proper
pre-reloc, which has its own DTB.

Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 months agoarm: davinci: remove unused defines
Emil Kronborg [Wed, 19 Jun 2024 11:00:01 +0000 (11:00 +0000)]
arm: davinci: remove unused defines

The last usage of the DV_TIMER_ and DV_WDT_ definitions were removed in
commits 8d7757637138 ("ARM: davinci: remove support for cam_enc_4xx")
and cef443c1666c ("arm: davinci: remove leftover code for dm* SoCs"),
respectively.

Signed-off-by: Emil Kronborg <emil.kronborg@protonmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
5 months agoarm: davinci: remove unused watchdog functions
Emil Kronborg [Wed, 19 Jun 2024 10:57:49 +0000 (10:57 +0000)]
arm: davinci: remove unused watchdog functions

The davinci_hw_watchdog_ functions are defined but never called from
anywhere. Commit 881ae794b93b ("calimain: remove board") eliminated the
last call to these functions.

Signed-off-by: Emil Kronborg <emil.kronborg@protonmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
5 months agofs: btrfs: fix out of bounds write
Alex Shumsky [Tue, 18 Jun 2024 21:41:38 +0000 (00:41 +0300)]
fs: btrfs: fix out of bounds write

Fix btrfs_read/read_and_truncate_page write out of bounds of destination
buffer. Old behavior break bootstd malloc'd buffers of exact file size.
Previously this OOB write have not been noticed because distroboot usually
read files into huge static memory areas.

Signed-off-by: Alex Shumsky <alexthreed@gmail.com>
Fixes: e342718 ("fs: btrfs: Implement btrfs_file_read()")
Reviewed-by: Qu Wenruo <wqu@suse.com>
5 months agoMerge patch series "k3-am625-beagleplay: Add symlinks for tiboot3 and tispl"
Tom Rini [Wed, 26 Jun 2024 15:55:29 +0000 (09:55 -0600)]
Merge patch series "k3-am625-beagleplay: Add symlinks for tiboot3 and tispl"

Dhruva Gole <d-gole@ti.com> says:

Add symlinks for both tiboot3.bin and tispl.bin because a user has to
anyway rename these files to get the platform to boot up.
Also update the documentation to reflect above change.

5 months agodoc: beagle: am62x_beagleplay: Rename the boot bins
Dhruva Gole [Tue, 18 Jun 2024 04:49:46 +0000 (10:19 +0530)]
doc: beagle: am62x_beagleplay: Rename the boot bins

Rename the boot bins as the _unsigned postfixes are not longer
required. We have symlinks in place for having generic names for all the
boot bins now.

Signed-off-by: Dhruva Gole <d-gole@ti.com>
5 months agoarm: dts: k3-am625-beagleplay: Add symlinks for tiboot3 and tispl
Dhruva Gole [Tue, 18 Jun 2024 04:49:45 +0000 (10:19 +0530)]
arm: dts: k3-am625-beagleplay: Add symlinks for tiboot3 and tispl

Add symlinks for both tiboot3.bin and tispl.bin because a user has to
anyway rename these files to get the platform to boot up.
This just makes it more intuitive and convenient.

Reviewed-by: Manorit Chawdhry <m-chawdhry@ti.com>
Signed-off-by: Dhruva Gole <d-gole@ti.com>
5 months agoboard: beagleplay: Fix the bootpart to pick from root partition
Dhruva Gole [Tue, 18 Jun 2024 04:53:18 +0000 (10:23 +0530)]
board: beagleplay: Fix the bootpart to pick from root partition

The Kernel Image and DTB files are supposed to be picked from the rootfs
of the SD Card, this fails in legacy boot flow because bootpart is set
to 1:1. Fix it.

Fixes: a200f428b5b21 ("board: ti: am62x: Add am62x_beagleplay_* defconfigs and env file")
Reviewed-by: Nishanth Menon <nm@ti.com>
Acked-by: Chirag Shilwant <c-shilwant@ti.com>
Signed-off-by: Dhruva Gole <d-gole@ti.com>
5 months agoarm: mach-k3: j784s4: Fix MCU_CLKOUT0 parent clock mux
Emanuele Ghidoli [Mon, 17 Jun 2024 09:22:01 +0000 (11:22 +0200)]
arm: mach-k3: j784s4: Fix MCU_CLKOUT0 parent clock mux

MCU_CLKOUT0 output can be driven by two different clock inputs:
one at 25 MHz and another at 50 MHz. Currently, the 25 MHz input
clock is not selectable due to a duplication of the 50 MHz clock input
in the mux configuration. This commit corrects the parent clock mux
configuration, making the 25 MHz input clock selectable.

Signed-off-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>
Reviewed-by: Bryan Brattlof <bb@ti.com>
5 months agoMerge patch series "Azure: Correct comment about the strategy in the world matrix...
Tom Rini [Wed, 26 Jun 2024 15:31:05 +0000 (09:31 -0600)]
Merge patch series "Azure: Correct comment about the strategy in the world matrix build"

Tom Rini <trini@konsulko.com> says:

This fixes a number of small issues with the structure of the Azure jobs
and then ensures that we will build all of the possible boards that we
know about, in this CI run.

5 months agoAzure: Count all of the machines we would build
Tom Rini [Tue, 18 Jun 2024 14:18:51 +0000 (08:18 -0600)]
Azure: Count all of the machines we would build

Now that we have each stage of the world build using variables to define
what it will attempt to build, and that we have added in missing
machines, add a job to make sure that we would always be building
everything.

Signed-off-by: Tom Rini <trini@konsulko.com>
5 months agoAzure: Update some job breakdowns so we build the world again
Tom Rini [Tue, 18 Jun 2024 14:18:50 +0000 (08:18 -0600)]
Azure: Update some job breakdowns so we build the world again

As part of commit 9aeac898da66 ("Azure: Rework build the world jobs") I
made a few mistakes. An errant '_' meant that we built neither at91 nor
kirkwood platforms. Further, the non-freescale (NXP) "LS1xxx" platforms
were also not being built. Adjust some jobs to have these be built
again.

Fixes: 9aeac898da66 ("Azure: Rework build the world jobs")
Signed-off-by: Tom Rini <trini@konsulko.com>
5 months agoAzure: Spell out the "everything" job
Tom Rini [Tue, 18 Jun 2024 14:18:49 +0000 (08:18 -0600)]
Azure: Spell out the "everything" job

In order to get the list of boards that will be done in a "dry run"
build we need to have something listed and not just an exclude list.
Populate the job with all architecture directories except arm and
powerpc.

Signed-off-by: Tom Rini <trini@konsulko.com>
5 months agoAzure: Rework how we define what to build in the world build
Tom Rini [Tue, 18 Jun 2024 14:18:48 +0000 (08:18 -0600)]
Azure: Rework how we define what to build in the world build

Instead of defining BUILDMAN to the value we'll build in each part of
the matrix job, define a variable with that name and have it list what
to build. This will allow us to reference these multiple times
consistently later on.

Signed-off-by: Tom Rini <trini@konsulko.com>
5 months agoAzure: Correct comment about the strategy in the world matrix build
Tom Rini [Tue, 18 Jun 2024 14:18:47 +0000 (08:18 -0600)]
Azure: Correct comment about the strategy in the world matrix build

At this point noting that we have a split in our job similar to TravisCI
(which we have not used in years) isn't helpful, and is also not true
anymore either. Instead, explain that we split the world up in to 10
jobs as that's the maximum we can have going in parallel on the free
tier of Azure.

Signed-off-by: Tom Rini <trini@konsulko.com>
5 months agoMerge patch series "arm64: add a software pagetable walker"
Tom Rini [Tue, 25 Jun 2024 23:22:36 +0000 (17:22 -0600)]
Merge patch series "arm64: add a software pagetable walker"

Caleb Connolly <caleb.connolly@linaro.org> says:

MMU issues are some of the most frustrating to debug. To make this
slightly less unbearable, introduce a software pagetable walker for
ARMv8. This can be called to dump a pagetable with the default
formatter, or a custom callback can be provided to implement more
complicated parsing.

This can also be useful to dump the pagetable used by a previous
bootloader stage (by reading out the ttbr register).

Here is an example of the output when walking U-Boot's own memory map
on a Qualcomm RB3 board:

Walking pagetable at 000000017df90000, va_bits: 36. Using 3 levels
[0x17df91000]                   |  Table |               |
  [0x17df92000]                 |  Table |               |
    [0x000001000 - 0x000200000] |  Pages | Device-nGnRnE | Non-shareable
  [0x000200000 - 0x040000000]   |  Block | Device-nGnRnE | Non-shareable
[0x040000000 - 0x080000000]     |  Block | Device-nGnRnE | Non-shareable
[0x080000000 - 0x140000000]     |  Block | Normal        | Inner-shareable
[0x17df93000]                   |  Table |               |
  [0x140000000 - 0x17de00000]   |  Block | Normal        | Inner-shareable
  [0x17df94000]                 |  Table |               |
    [0x17de00000 - 0x17dfa0000] |  Pages | Normal        | Inner-shareable

5 months agomeson: Correct driver declaration for meson_axg_gpio
Simon Glass [Sun, 23 Jun 2024 20:30:26 +0000 (14:30 -0600)]
meson: Correct driver declaration for meson_axg_gpio

This should use the driver macros so that the driver appears in the
linker list. Fix this.

Fixes: 8587839f19d ("pinctrl: meson: add axg support")
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20240623203033.1566505-8-sjg@chromium.org
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
5 months agodoc: arch: arm64: describe pagetable debugging
Caleb Connolly [Mon, 17 Jun 2024 08:03:49 +0000 (10:03 +0200)]
doc: arch: arm64: describe pagetable debugging

Add some brief documentation on using dump_pagetables() to print out
U-Boot's pagetables during boot.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
5 months agoarm64: add software pagetable walker
Caleb Connolly [Mon, 17 Jun 2024 08:03:48 +0000 (10:03 +0200)]
arm64: add software pagetable walker

Add a basic software implementation of the ARM64 pagetable walker. This
can be used for debugging U-Boot's pagetable, as well as dumping the
pagetable from the previous bootloader stage if it used one (by reading
out the ttbr address).

One can either call dump_pagetable() to print the pagetable to the
console with the default formatter, or implement their own pagetable
handler using walke_pagetable() with a custom pte_walker_cb_t callback.

All of the added code is discarded when unused, hence there is no need
to add an additional Kconfig option for this.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
5 months agoarm64: mmu.h: fix PTE_TABLE_AP
Caleb Connolly [Mon, 17 Jun 2024 08:03:47 +0000 (10:03 +0200)]
arm64: mmu.h: fix PTE_TABLE_AP

The APTable attribute is two bits wide according to the ARMv8-A
architecture reference manual. Fix the macro accordingly.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
5 months agousb: dwc3: meson-g12a: drop usb.h and make dwc3_meson_g12a_force_mode static
Neil Armstrong [Thu, 20 Jun 2024 07:42:54 +0000 (09:42 +0200)]
usb: dwc3: meson-g12a: drop usb.h and make dwc3_meson_g12a_force_mode static

Drop this useless usb.h and now make dwc3_meson_g12a_force_mode
static since only used in the dwc3-meson-g12a.c file.

Reviewed-by: Marek Vasut <marex@denx.de>
Link: https://lore.kernel.org/r/20240620-u-boot-usb-gxl-phy-set-mode-v2-5-b81c027bc02c@linaro.org
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
5 months agousb: dwc3: meson-gxl: drop usb-gx.h and make dwc3_meson_gxl_force_mode static
Neil Armstrong [Thu, 20 Jun 2024 07:42:53 +0000 (09:42 +0200)]
usb: dwc3: meson-gxl: drop usb-gx.h and make dwc3_meson_gxl_force_mode static

Drop this useless usb-gx.h and now make dwc3_meson_gxl_force_mode
static since only used in the dwc3-meson-gxl.c file.

Reviewed-by: Marek Vasut <marex@denx.de>
Link: https://lore.kernel.org/r/20240620-u-boot-usb-gxl-phy-set-mode-v2-4-b81c027bc02c@linaro.org
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
5 months agophy: meson-gxl-usb2: remove phy_meson_gxl_usb2_set_mode
Neil Armstrong [Thu, 20 Jun 2024 07:42:52 +0000 (09:42 +0200)]
phy: meson-gxl-usb2: remove phy_meson_gxl_usb2_set_mode

Remove the public phy_meson_gxl_usb2_set_mode and move
the implementation in the the set_mode callback.

Reviewed-by: Marek Vasut <marex@denx.de>
Link: https://lore.kernel.org/r/20240620-u-boot-usb-gxl-phy-set-mode-v2-3-b81c027bc02c@linaro.org
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
5 months agousb: dwc3: meson-gxl: switch to generic_phy_set_mode
Neil Armstrong [Thu, 20 Jun 2024 07:42:51 +0000 (09:42 +0200)]
usb: dwc3: meson-gxl: switch to generic_phy_set_mode

Use the PHY set_mode call instead of calling directly in the
PHY shared function.

Reviewed-by: Marek Vasut <marex@denx.de>
Link: https://lore.kernel.org/r/20240620-u-boot-usb-gxl-phy-set-mode-v2-2-b81c027bc02c@linaro.org
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
5 months agophy: meson-gxl-usb2: add set_mode callback
Neil Armstrong [Thu, 20 Jun 2024 07:42:50 +0000 (09:42 +0200)]
phy: meson-gxl-usb2: add set_mode callback

Implement set_mode callback by calling the current public
function, use a temporary function name that will be removed
when the public phy_meson_gxl_usb2_set_mode is finally removed
in a following change.

Reviewed-by: Marek Vasut <marex@denx.de>
Link: https://lore.kernel.org/r/20240620-u-boot-usb-gxl-phy-set-mode-v2-1-b81c027bc02c@linaro.org
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
5 months agoboard: beagle: beagleplay: enable OF_SYSTEM_SETUP
Bryan Brattlof [Wed, 19 Jun 2024 19:12:30 +0000 (14:12 -0500)]
board: beagle: beagleplay: enable OF_SYSTEM_SETUP

Unfortunately when enabling FDT fixups for the AM62x family of SoCs and
moving TF-A to the bottom of RAM we missed the BeaglePlay. This is
causing Linux's memory allocator to clobber TF-A and break its boot.

Enable OF_SYSTEM_SETUP to fixup the kernel's FDT to inform it of the
actual location of the firmware

CC: Andrew Davis <afd@ti.com>
CC: Nishanth Menon <nm@ti.com>
CC: Robert Nelson <robertcnelson@gmail.com>
Reported-by: Dhruva Gole <d-gole@ti.com>
Signed-off-by: Bryan Brattlof <bb@ti.com>
Acked-by: Andrew Davis <afd@ti.com>
Tested-by: Robert Nelson <robertcnelson@gmail.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
Acked-by: Chirag Shilwant <c-shilwant@ti.com>
Tested-by: Dhruva Gole <d-gole@ti.com>
5 months agoMerge tag 'v2024.07-rc5' into next
Tom Rini [Mon, 24 Jun 2024 19:34:52 +0000 (13:34 -0600)]
Merge tag 'v2024.07-rc5' into next

Prepare v2024.07-rc5