]> git.ipfire.org Git - thirdparty/u-boot.git/log
thirdparty/u-boot.git
9 months agoarm64: versal: Enable soft reset support for xspi flashes
Venkatesh Yadav Abbarapu [Thu, 14 Nov 2024 04:26:41 +0000 (09:56 +0530)] 
arm64: versal: Enable soft reset support for xspi flashes

Activate the xSPI Software Reset support, which will be
utilized to transition from octal DTR mode to legacy
mode during shutdown and boot (if enabled).

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20241114042641.22642-1-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
9 months agoarm64: versal: Enable defconfig for Micron octal flashes
Venkatesh Yadav Abbarapu [Thu, 14 Nov 2024 05:10:47 +0000 (10:40 +0530)] 
arm64: versal: Enable defconfig for Micron octal flashes

The Micron MT35 series octal flashes can be activated
through the configuration option CONFIG_SPI_FLASH_MT35XU.
To ensure their detection, enable this option in the
default defconfig for octal flashes.

Signed-off-by: Tejas Bhumkar <tejas.arvind.bhumkar@amd.com>
Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20241114051047.13700-1-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
9 months agospi: cadence_qspi: Fix OSPI boot issue
Venkatesh Yadav Abbarapu [Thu, 14 Nov 2024 06:20:45 +0000 (11:50 +0530)] 
spi: cadence_qspi: Fix OSPI boot issue

Moving the hw_reset function from the controller driver to
the NOR framework has caused the OSPI reset not to be triggered
in the Cadence driver's probe function. As a result, reading the
flash ID during SPI calibration is incorrect, and the
CQSPI_REG_RD_DATA_CAPTURE is set with an invalid value.This makes
it unable to read the flash ID properly.
To solve this problem, it's suggested to skip SPI calibration and
instead retrieve the read_delay directly from the device tree.

Skipping SPI calibration doesn't bring harm since there's no need
for the flash golden values stored during SPI calibration.
Instead, they are now read during the spi_nor_read_id call in the
NOR framework.

Signed-off-by: Tejas Bhumkar <tejas.arvind.bhumkar@amd.com>
Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20241114062045.17581-1-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
9 months agofastboot: properly handle unknown partition type
Caleb Connolly [Wed, 13 Nov 2024 05:05:59 +0000 (06:05 +0100)] 
fastboot: properly handle unknown partition type

In getvar_partition_type() we attempt to find a filesystem driver for
the partition (of the list of driver enabled in U-Boot), on failure we
return the error to fastboot and completely bail out of the operation.

However, this should not be a failure, instead we should just default to
"raw". This allows commands like "fastboot format:ext4 userdata" to work
if userdata didn't already have an ext4 partition table (or if FS_EXT4
is disabled in U-Boot), as failing to determine the current partition
type is not an error in this case.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Link: https://lore.kernel.org/r/20241113050607.1850472-1-caleb.connolly@linaro.org
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
9 months agotest: cmd/hash: check return value of ut_check_console_line
Heinrich Schuchardt [Sat, 16 Nov 2024 20:08:22 +0000 (21:08 +0100)] 
test: cmd/hash: check return value of ut_check_console_line

ut_check_console_line() does include an assert.
Pass the result to ut_assertok().

Addresses-Coverity-ID:  514958 Error handling issues
Fixes: 7dfafcd65ef3 ("test: unit test for hash command")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
9 months agoKconfig: describe NET, NO_NET, LWIP_DEBUG and LWIP_ASSERT
Jerome Forissier [Tue, 12 Nov 2024 15:44:29 +0000 (16:44 +0100)] 
Kconfig: describe NET, NO_NET, LWIP_DEBUG and LWIP_ASSERT

Some Kconfig symbols introduced in commit 8cb330355bd5 ("net: introduce
alternative implementation as net/lwip/") need a full description. The
NET symbol needs one, too.

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
9 months agonet: lwip/wget: correct SERVER_NAME_SIZE
Heinrich Schuchardt [Fri, 8 Nov 2024 17:45:26 +0000 (18:45 +0100)] 
net: lwip/wget: correct SERVER_NAME_SIZE

The maximum length of a domain name is 253 as defined in RFC 1035.
So SERVER_NAME_SIZE should be 254 including NUL.

Fixes: 3c656c928bd7 ("net: lwip: add wget command")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
9 months agoMerge tag 'efi-next-2024-11-18' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Mon, 18 Nov 2024 16:46:06 +0000 (10:46 -0600)] 
Merge tag 'efi-next-2024-11-18' of https://source.denx.de/u-boot/custodians/u-boot-efi into next

CI: https://source.denx.de/u-boot/custodians/u-boot-efi/-/pipelines/23430

- Prepare for implementing the EFI_HTTP_PROTOCOL:
  - Make wget functionality callable even if the wget command is not
    built (add CONFIG_WGET symbol).
  - Ensure that wget_with_dns() works the same with the old network
    stack and with lwIP.
  - Put server_name and port into wget_ctx.
  - Integrate struct wget_info into wget code.
  - Move ip_to_string to lib/net_utils.c

9 months agonet: net_utils: Move ip_to_string to lib/net_utils.c
Adriano Cordova [Mon, 11 Nov 2024 21:09:45 +0000 (18:09 -0300)] 
net: net_utils: Move ip_to_string to lib/net_utils.c

The function string_to_ip is already in net_utils, which is
compiled unconditionally, but ip_to_string is currently only
accessible if the legacy network stack is selected. This
commit puts ip_to_string in net_utils.c and removes it from the
legacy network code.

Signed-off-by: Adriano Cordova <adrianox@gmail.com>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
9 months agoMerge patch series "Fix boot failure due to misaligned DMA buffer"
Tom Rini [Mon, 18 Nov 2024 14:24:06 +0000 (08:24 -0600)] 
Merge patch series "Fix boot failure due to misaligned DMA buffer"

Nam Cao <namcao@linutronix.de> says:

We observed the following sporadic boot failure while booting from MMC
device:

=> boot
CACHE: Misaligned operation at range [9efa25f89efa27f8]
CACHE: Misaligned operation at range [9efa25f89efa27f8]
CACHE: Misaligned operation at range [9efa25f89efa27f8]
CACHE: Misaligned operation at range [9efa25f89efa27f8]
** Booting bootflow 'mmc@2194000.bootdev.part_1' with extlinux
Ignoring unknown command: �D���D��
Boot failed (err=-14)

The reason is because while allocating buffer to read a file from MMC,
alignment of 1 byte is used. Thus, the buffer doesn't work for performing
DMA, and garbage data is read.

While looking at this issue, I also noticed that if no alignment specified
(align=0) then fs_read_alloc() is documented to use the default. But the
default is no alignment. Therefore, other users of fs_read_alloc() which
specify align=0 may be broken as well.

The first patch changes extlinux_read_bootflow() to use proper buffer
alignment for DMA.

The second patch changes the default alignment of fs_read_alloc() to be
DMA-suitable, to fix other potential bugs.

9 months agofs: Use ARCH_DMA_MINALIGN as default alignment for fs_read_alloc()
Nam Cao [Thu, 7 Nov 2024 15:01:06 +0000 (16:01 +0100)] 
fs: Use ARCH_DMA_MINALIGN as default alignment for fs_read_alloc()

The comment above fs_read_alloc() explains:

    @align: Alignment to use for memory allocation (0 for default)

However, in the actual implementation, there is no alignment when @align is
zero.

This current default is probably fine for most cases. But for some block
devices which transfer data via DMA, ARCH_DMA_MINALIGN is needed.

Change the default alignment to ARCH_DMA_MINALIGN.

Fixes: de7b5a8a1ac0 ("fs: Create functions to load and allocate a file")
Signed-off-by: Nam Cao <namcao@linutronix.de>
Tested-by: Javier Fernandez Pastrana <javier.pastrana@linutronix.de>
9 months agoboot: extlinux: Fix unaligned buffer for reading data from file system
Nam Cao [Thu, 7 Nov 2024 15:01:05 +0000 (16:01 +0100)] 
boot: extlinux: Fix unaligned buffer for reading data from file system

extlinux_read_bootflow() allocates a buffer to read from file system
without any alignment.

But for some block devices which transfer data via DMA, ARCH_DMA_MINALIGN
alignment is required. For example, due to misaligned buffer, the below
boot failure is observed.

=> boot
CACHE: Misaligned operation at range [9efa25f89efa27f8]
CACHE: Misaligned operation at range [9efa25f89efa27f8]
CACHE: Misaligned operation at range [9efa25f89efa27f8]
CACHE: Misaligned operation at range [9efa25f89efa27f8]
** Booting bootflow 'mmc@2194000.bootdev.part_1' with extlinux
Ignoring unknown command: �D���D��
Boot failed (err=-14)

Change the buffer alignment to ARCH_DMA_MINALIGN.

Fixes: 31aefaf89a5b ("bootstd: Add an implementation of distro boot")
Signed-off-by: Nam Cao <namcao@linutronix.de>
Tested-by: Javier Fernandez Pastrana <javier.pastrana@linutronix.de>
9 months agotest/py: mmc: Add support for different mmc modes
Love Kumar [Tue, 12 Nov 2024 08:57:56 +0000 (14:27 +0530)] 
test/py: mmc: Add support for different mmc modes

Currently, MMC test runs on default mmc modes, adding a provision to
support multiple mmc modes through user defined parameters.

Signed-off-by: Love Kumar <love.kumar@amd.com>
9 months agotest/py: usb: Distinguish b/w ext2/ext4 partitions
Love Kumar [Tue, 12 Nov 2024 08:57:38 +0000 (14:27 +0530)] 
test/py: usb: Distinguish b/w ext2/ext4 partitions

'usb part' command shows the partition maps and shows the partition type
by displaying number such as 0c, 83 etc. Observed that ext2 and ext4
partitions shows the same number, i.e, 83, so, using the fstype command
to distiniguish between ext2 and ext4 partitions.

Signed-off-by: Love Kumar <love.kumar@amd.com>
9 months agotest/py: mmc: Distinguish b/w ext2/ext4 partitions
Love Kumar [Tue, 12 Nov 2024 08:57:27 +0000 (14:27 +0530)] 
test/py: mmc: Distinguish b/w ext2/ext4 partitions

'mmc part' command shows the partition maps and shows the partition type
by displaying number such as 0c, 83 etc. Observed that ext2 and ext4
partitions shows the same number, i.e, 83, so, using the fstype command
to distiniguish between ext2 and ext4 partitions.

Signed-off-by: Love Kumar <love.kumar@amd.com>
9 months agoconsole: Use printascii for lowlevel debug string
Kever Yang [Fri, 8 Nov 2024 08:36:23 +0000 (16:36 +0800)] 
console: Use printascii for lowlevel debug string

The lowlevel debug with CONFIG_DEBUG_UART has printascii for string
print, and no need to convert to use printch now.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
9 months agoarmv8: cpu: Implement allow_unaligned()
Sam Protsenko [Thu, 7 Nov 2024 02:58:31 +0000 (20:58 -0600)] 
armv8: cpu: Implement allow_unaligned()

Usually ARMv8 platforms allow unaligned access for Normal memory. But
some chips might not allow it by default, having SCTLR.A bit set to 1
before U-Boot execution. One such example is Exynos850 SoC. As
allow_unaligned() is not implemented for ARMv8 at the moment, its __weak
implementation is used, which does nothing. That might lead to unaligned
access abort, for example when running EFI selftest. Fix that by
implementing allow_unaligned() for ARMv8.

The issue was found when running EFI selftest on E850-96 board
(Exynos850 based):

    => bootefi selftest $fdtcontroladdr

    ...
    Executing 'HII database protocols'
    "Synchronous Abort" handler, esr 0x96000021, far 0xbaac0991
    ...
    resetting ...

Unaligned abort happens in u16_strnlen(), which is called from
efi_hii_sibt_string_ucs2_block_next():

    u16_strlen(blk->string_text)

where 'blk' type is struct efi_hii_sibt_string_ucs2_block. Because this
struct is packed, doing "->string_text" makes 'blk' address incremented
by 1 byte, which makes it unaligned. Although allow_unaligned() was
called in efi_init_early() before EFI selftest execution, it wasn't
implemented for ARMv8 CPUs, so data abort happened.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
9 months agoarmv8: Fix get_sctlr() return type
Sam Protsenko [Thu, 7 Nov 2024 02:58:30 +0000 (20:58 -0600)] 
armv8: Fix get_sctlr() return type

SCTLR_EL2 is a 64-bit register [1]. Return its value as long (64 bit)
instead of int (32 bit) in get_sctlr() to make sure it's not trimmed.

[1] https://developer.arm.com/documentation/ddi0595/2021-06/AArch64-Registers/SCTLR-EL2--System-Control-Register--EL2-?lang=en

Fixes: 0ae7653128c8 ("arm64: core support")
Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
9 months agotest: bootm: Ensure tests can be run twice
Andrew Goodbody [Wed, 6 Nov 2024 13:50:17 +0000 (13:50 +0000)] 
test: bootm: Ensure tests can be run twice

Some of the bootm tests rely on state that is assumed to be
correct but is changed by the tests. This means that running
'ut bootm' twice will result in failures on the second run
as the state left by the first run is not what the tests
expect.
Fix this by ensuring the state is as expected by explicitly
setting that state.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
9 months agodm: sysinfo: Shorten the SYSINFO_ID prefix
Simon Glass [Thu, 31 Oct 2024 17:50:23 +0000 (18:50 +0100)] 
dm: sysinfo: Shorten the SYSINFO_ID prefix

We are about to add a large number of new entries. Update the prefix to
be a little shorter.

For SMBIOS items, use SYSID_SM_ (for System Management) which is enough
to distinguish it. For now at least, it seems that most items will be
for SMBIOS.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Raymond Mao <raymond.mao@linaro.org>
9 months agobios_emulator: add missing includes to debug.c
Yuri Zaporozhets [Fri, 8 Nov 2024 13:13:29 +0000 (14:13 +0100)] 
bios_emulator: add missing includes to debug.c

When compiling with X86EMU_DEBUG, the compiler complains that debug.c misses
two include files. Fix that.

Signed-off-by: Yuri Zaporozhets <yuriz@qrv-systems.net>
9 months agobios_emulator: for non-x86, print warnings if PM_{inp, outp}* access is attempted
Yuri Zaporozhets [Tue, 5 Nov 2024 21:30:49 +0000 (22:30 +0100)] 
bios_emulator: for non-x86, print warnings if PM_{inp, outp}* access is attempted

Currently the PM_{inp,outp}* macros are completely broken on non-x86 architectures,
because they will essentially access random memory locations if called (and produce
a lot of rightful compilation warnings too). For now, replace those macros with
warnings (until the code is fixed), so the user at least knows that the emulator
attempted to access some x86 I/O port.

Signed-off-by: Yuri Zaporozhets <yuriz@qrv-systems.net>
9 months agoglobal: Remove bi_sramstart/bi_sramsize
Tom Rini [Sat, 26 Oct 2024 14:09:00 +0000 (08:09 -0600)] 
global: Remove bi_sramstart/bi_sramsize

These fields are currently set on exactly two platforms today, and used
by only one of them. Update pic32mzdask to use CFG_SYS_SRAM* in the one
location it needs it and otherwise drop this field from the bd_info
struct.

Signed-off-by: Tom Rini <trini@konsulko.com>
9 months agodm: button: support remapping phone keys
Caleb Connolly [Sun, 14 Jul 2024 19:49:19 +0000 (21:49 +0200)] 
dm: button: support remapping phone keys

We don't have audio support in U-Boot, but we do have boot menus. Add an
option to re-map the volume and power buttons to up/down/enter so that
in situations where these are the only available buttons (such as on
mobile phones) it's still possible to navigate menus built in U-Boot or
an external EFI app like GRUB or systemd-boot.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
Reviewed-by: Dragan Simic <dsimic@manjaro.org>
9 months agonet/lwip: wget: integrate struct wget_info into wget code
Adriano Cordova [Mon, 11 Nov 2024 21:09:01 +0000 (18:09 -0300)] 
net/lwip: wget: integrate struct wget_info into wget code

Each wget request now fills the struct wget_info. Also, the
efi bootdevice is now set conditionally to the set_bootdevice
variable in wget_info and a buffer size check is performed if
check_buffer_size is set.

Signed-off-by: Adriano Cordova <adrianox@gmail.com>
9 months agonet/lwip: wget: put server_name and port into wget_ctx
Adriano Cordova [Mon, 11 Nov 2024 21:09:00 +0000 (18:09 -0300)] 
net/lwip: wget: put server_name and port into wget_ctx

Currently server_name and port are local variables in wget_loop.
This commit puts them inside ctx, so that they are accessible
from the http callbacks.

Signed-off-by: Adriano Cordova <adrianox@gmail.com>
9 months agonet: wget: make wget_with_dns return value compatible with its lwip version
Adriano Cordova [Mon, 11 Nov 2024 21:08:59 +0000 (18:08 -0300)] 
net: wget: make wget_with_dns return value compatible with its lwip version

There are two wget_with_dns functions, one in the legacy network
stack and one in lwip, but the return values are not compatible.
This commit modifies the legacy version of wget_with_dns so that
the return values are compatible: 0 on success, otherwise a negative
error. This way wget_with_dns can be called in a network stack
agnostic way.

Signed-off-by: Adriano Cordova <adrianox@gmail.com>
9 months agonet: wget: integrate struct wget_info into legacy wget code
Adriano Cordova [Mon, 11 Nov 2024 21:08:58 +0000 (18:08 -0300)] 
net: wget: integrate struct wget_info into legacy wget code

Each wget request now fills the struct wget_info. The efi
bootdevice is now set conditionally to the set_bootdevice
variable in wget_info, and the same holds for lmb memory check.

Signed-off-by: Adriano Cordova <adrianox@gmail.com>
9 months agonet: wget: Add interface to issue wget_requests using wget_http_info
Adriano Cordova [Mon, 11 Nov 2024 21:08:57 +0000 (18:08 -0300)] 
net: wget: Add interface to issue wget_requests using wget_http_info

Declare and define a global default struct wget_http_info
and an interface to issue wget requests providing a custom
struct wget_http_info. This code is common to legacy wget
and lwip wget. The idea is that the command wget should use
the default wget_http_info and other internal u-boot code
can call wget_request with their own wget_http_info struct.

Signed-off-by: Adriano Cordova <adrianox@gmail.com>
9 months agonet: wget: add definition of struct wget_http_info
Adriano Cordova [Mon, 11 Nov 2024 21:08:56 +0000 (18:08 -0300)] 
net: wget: add definition of struct wget_http_info

The struct wget_http_info exposes the HTTP information of the last HTTP
request issued by wget, and it controls whether the efi bootdevice is set,
and whether the buffer size needs to be checked (lwip stack only). This
information is otherwise discarded. The wget_http_info struct can be used
by HTTP drivers to have more control over HTTP requests.

Signed-off-by: Adriano Cordova <adrianox@gmail.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
9 months agonet: Kconfig: add CONFIG_WGET symbol
Adriano Cordova [Mon, 11 Nov 2024 21:08:55 +0000 (18:08 -0300)] 
net: Kconfig: add CONFIG_WGET symbol

Let net/wget.c and net/lwip/wget.c depend on CONFIG_WGET, and
cmd/wget.c depend on CONFIG_CMD_WGET. This way, the wget code
can be used regardless of whether the wget command is available.

Signed-off-by: Adriano Cordova <adrianox@gmail.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
9 months agoMerge tag 'tpm-master-16112024' of https://source.denx.de/u-boot/custodians/u-boot-tpm
Tom Rini [Sat, 16 Nov 2024 19:09:18 +0000 (13:09 -0600)] 
Merge tag 'tpm-master-16112024' of https://source.denx.de/u-boot/custodians/u-boot-tpm

CI: https://source.denx.de/u-boot/custodians/u-boot-tpm/-/pipelines/23393

- Two changes from Heinrich:
  - One is adding some missing TPM files for proper maintenance.
  - The second addresses Coverity-ID: 356664 replacing a mempcy() which
    has undefined behavior with memmove()

9 months agoMAINTAINERS: add lib/tpm* to TPM DRIVERS
Heinrich Schuchardt [Sat, 2 Nov 2024 10:25:46 +0000 (11:25 +0100)] 
MAINTAINERS: add lib/tpm* to TPM DRIVERS

All TPM code should be maintained.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
9 months agotpm: use memmove() for overlapping buffers
Heinrich Schuchardt [Sat, 2 Nov 2024 10:27:37 +0000 (11:27 +0100)] 
tpm: use memmove() for overlapping buffers

The behavior of memcpy() for overlapping buffers is undefined.

Fixes: 4c57ec76b725 ("tpm: Implement state command for Cr50")
Addresses-Coverity-ID: 356664 Overlapping buffer in memory copy
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
9 months agoMerge patch series "teach 'env default' to optionally keep runtime variables"
Tom Rini [Fri, 15 Nov 2024 22:36:24 +0000 (16:36 -0600)] 
Merge patch series "teach 'env default' to optionally keep runtime variables"

Rasmus Villemoes <ravi@prevas.dk> says:

Doing bringup of a board, part of my bootstrap logic is in U-Boot. So
when tweaking that logic, I was bitten by a previous completed
bootstrap having left a copy of the environment on the device, which
was imported and thus overrided the new logic.

So I thought, "ok, I'll just make sure to put 'env default -a' as the
first part of the bootstrap logic so I'm not bitten again". Alas, my
logic also relies on certain variables that are set by C code
(e.g. for detecting board variant), and doing 'env default -a' also
eliminates those.

Looking around, the hashtab code already supports a flag that does
exactly what I need, and exposing that is (morally) a one-liner.

Link: https://lore.kernel.org/r/20241030213404.2894247-1-ravi@prevas.dk
9 months agotest: env: add some test cases for new "env default -k" flag
Rasmus Villemoes [Wed, 30 Oct 2024 21:34:04 +0000 (22:34 +0100)] 
test: env: add some test cases for new "env default -k" flag

Check that the new -k flag works as expected.

This also adds a test of the -a flag, which was previously missing,
and as the comment says, perhaps for a good reason. At least now we
have a test for it in combination with -k (and -f, because the ethaddr
variables otherwise cause complaining).

Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
9 months agotest: env: check that non-mentioned variables to "env default" are preserved
Rasmus Villemoes [Wed, 30 Oct 2024 21:34:03 +0000 (22:34 +0100)] 
test: env: check that non-mentioned variables to "env default" are preserved

Instead of testing the same expected behaviour for both
non_default_varX, test that when var1 is not in the default env but is
mentioned in the "env default" cmdline, it is removed, while var2 is
untouched.

Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
9 months agocmd/nvedit.c: teach 'env default' to optionally keep runtime variables
Rasmus Villemoes [Wed, 30 Oct 2024 21:34:02 +0000 (22:34 +0100)] 
cmd/nvedit.c: teach 'env default' to optionally keep runtime variables

It can be useful to set all variables defined in the default
environment to the value they have there, but without removing
variables that are only defined at runtime. This can sort-of be done
today, by using the "env default var1 var2 ..." variant, but that
requires listing all variables defined in the default
environment. It's much more convenient to be able to say

  env default -k -a

The -k flag is also meaningful in the other case: If var1 is not
defined in the default environment, but var2 is,

  env default var1 var2

would emit a warning about var1 not being in the default env and thus
being deleted. With -k, there's no warning, and var1 is kept as-is.

Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
9 months agokm: disable CMD_JFFS2 for all PPC boards
Holger Brunck [Thu, 14 Nov 2024 18:06:54 +0000 (19:06 +0100)] 
km: disable CMD_JFFS2 for all PPC boards

We don't use this feature, we can remove it therefore in the defconfigs.

Signed-off-by: Holger Brunck <holger.brunck@hitachienergy.com>
9 months agofs: btrfs: hide duplicate 'Cannot lookup file' error on 'load'
Dominique Martinet [Fri, 15 Nov 2024 02:15:47 +0000 (11:15 +0900)] 
fs: btrfs: hide duplicate 'Cannot lookup file' error on 'load'

Running commands such as 'load mmc 2:1 $addr $path' when path does not
exists will print an error twice if the file does not exist, e.g.:
```
Cannot lookup file boot/boot.scr
Failed to load 'boot/boot.scr'
```
(where the first line is printed by btrfs and the second by common fs
code)

Historically other filesystems such as ext4 or fat have not been
printing a message here, so do the same here to avoid duplicate.

The other error messages in this function are also somewhat redundant,
but bring useful diagnostics if they happen somewhere, so have been left
as printf.

Note that if a user wants no message to be printed for optional file
loads, they have to check for file existence first with other commands
such as 'size'.

Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
9 months agotest/py: spi: Rephrase the warning/error messages
Love Kumar [Fri, 15 Nov 2024 13:08:00 +0000 (18:38 +0530)] 
test/py: spi: Rephrase the warning/error messages

Rephrasing the error and warning messages to be more meaningful and
clear.

Signed-off-by: Love Kumar <love.kumar@amd.com>
9 months agoMerge tag 'u-boot-imx-master-20241115' of https://gitlab.denx.de/u-boot/custodians...
Tom Rini [Fri, 15 Nov 2024 19:10:36 +0000 (13:10 -0600)] 
Merge tag 'u-boot-imx-master-20241115' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx

CI: https://source.denx.de/u-boot/custodians/u-boot-imx/-/pipelines/23373

- Fix a missing break for CMD_DCD_SKIP reported by Coverty on imx8image.
- Fix i.MX thermal threshold regression.

9 months agoimx: Fix critical thermal threshold
Francesco Dolcini [Tue, 12 Nov 2024 17:54:27 +0000 (18:54 +0100)] 
imx: Fix critical thermal threshold

Fix the critical thermal threshold for i.MX processors, this was changed
while moving the code from imx8m/imx9 directories into a shared place.

There is no need to keep the critical threshold 5 degrees less than the
SoC maximum temperature threshold, what is actually going to happen in
practice is that we are going to power-off the board when the SoC is
still within its working temperature range.

In addition to that this is a change in the actual behavior, that is
introducing a regression to users, and it was hidden within a software
refactoring.

Fixes: d0fe80890ab1 ("imx: Generalize fixup_thermal_trips")
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
9 months agotools: imx8image: Add missing break for CMD_DCD_SKIP
Fabio Estevam [Tue, 12 Nov 2024 02:38:54 +0000 (23:38 -0300)] 
tools: imx8image: Add missing break for CMD_DCD_SKIP

The CMD_DCD_SKIP case misses a break statement.

Add it.

Fixes: 254c00803b63 ("tools: imx8image: add possibility to skip dcd")
Addresses-Coverity-ID: 514648: Control flow issues (MISSING_BREAK)
Signed-off-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
9 months agodrivers: bootcount: Add ZynqMP specific bootcount support
Vasileios Amoiridis [Tue, 5 Nov 2024 13:27:44 +0000 (14:27 +0100)] 
drivers: bootcount: Add ZynqMP specific bootcount support

Add native support of the bootcount mechanism in the ZynqMP by
utilising internal PMU registers. The Persistent Global Storage
Registers of the Platform Management Unit can keep their value
during reboot cycles unless there is a POR reset, making them
appropriate for the bootcount mechanism.

Signed-off-by: Vasileios Amoiridis <vasileios.amoiridis@cern.ch>
Reviewed-by: Heiko Schocher <hs@denx.de>
Link: https://lore.kernel.org/r/20241105132744.1572759-2-vassilisamir@gmail.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
9 months agoboot/image-board.c: boot_get_fpga(): pass compatible flag to fpga_load()
Peter Korsgaard [Tue, 5 Nov 2024 16:21:36 +0000 (17:21 +0100)] 
boot/image-board.c: boot_get_fpga(): pass compatible flag to fpga_load()

For E.G. signed FPGA bitstreams, similar to how it is done for the FPGA
loading from SPL since commit 71f1a5392aad ("spl: fit: pass real compatible
flags to fpga_load()").

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Link: https://lore.kernel.org/r/20241105162136.839633-1-peter@korsgaard.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
9 months agoarm64: versal: Enable capsule update (SD)
Michal Simek [Fri, 25 Oct 2024 11:56:08 +0000 (13:56 +0200)] 
arm64: versal: Enable capsule update (SD)

Enable capsule update in SD boot mode. For getting it work there is a need
to generate or setup dfu_alt_info and enable sysreset with DFU_MMC.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/cede513de764b99560dc3737457dbc8a5cc71d21.1729857366.git.michal.simek@amd.com
9 months agoarm64: versal: Do not define do_reset() if sysreset is enabled
Michal Simek [Fri, 25 Oct 2024 11:56:07 +0000 (13:56 +0200)] 
arm64: versal: Do not define do_reset() if sysreset is enabled

If sysreset is enabled reset_cpu is defined in sysreset uclass that's why
it can't be in platform/board code.
The same change was done by commit f1bc214b0024 ("arm64: zynqmp: Do not
define do_reset() if sysreset is enabled").

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/8c1a5d6148c5e6c46790b725e8148a4e12d393ba.1729857366.git.michal.simek@amd.com
9 months agoarm64: zynqmp: Fix r5 mode for cpu release command
Padmarao Begari [Mon, 4 Nov 2024 12:27:50 +0000 (17:57 +0530)] 
arm64: zynqmp: Fix r5 mode for cpu release command

The cpu release command for r5 mode (lockstep/split) argument
accepts only string. But the zynqmp tcminit command accepts
string or number for r5 mode (lockstep/split or 0/1) argument.
To fix the r5 mode argument, the common argument (lockstep/split
or 0/1) is used across different u-boot commands. Use the strcmp()
instead of strncmp() to make uniform the r5 mode (lockstep/split
or 0/1) for the zynqmp tcminit and cpu release command.

Signed-off-by: Padmarao Begari <padmarao.begari@amd.com>
Link: https://lore.kernel.org/r/20241104122750.96251-1-padmarao.begari@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
9 months agoarm64: xilinx: Rename SPI_ADVANCE to SPI_STACKED_PARALLEL
Michal Simek [Fri, 1 Nov 2024 08:37:23 +0000 (09:37 +0100)] 
arm64: xilinx: Rename SPI_ADVANCE to SPI_STACKED_PARALLEL

Align defconfigs with the latest Kconfig layout.

Fixes: f896aa656774 ("mtd: spi-nor: Rename SPI_ADVANCE to SPI_STACKED_PARALLEL")
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/fe05a0e542d6117c10956e4a104123e46f956793.1730450241.git.michal.simek@amd.com
9 months agoxilinx: use get_mem_top() to compute ram_top
Sughosh Ganu [Fri, 25 Oct 2024 17:27:24 +0000 (22:57 +0530)] 
xilinx: use get_mem_top() to compute ram_top

Use the get_mem_top function to compute the value of ram_top. This was
earlier done through LMB API's, which are no longer available till
after relocation. Use get_mem_top() instead to compute the ram_top
value.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Michal Simek <michal.simek@amd.com>
Tested-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/20241025172724.195093-3-sughosh.ganu@linaro.org
Signed-off-by: Michal Simek <michal.simek@amd.com>
9 months agocommon: memtop: add logic to detect ram_top
Sughosh Ganu [Fri, 25 Oct 2024 17:27:23 +0000 (22:57 +0530)] 
common: memtop: add logic to detect ram_top

Add generic logic to determine the ram_top value for boards. Earlier,
this was achieved in an indirect manner through a set of LMB API's.
That has since changed so that the LMB code is available only after
relocation. Replace those LMB calls with a single call to
get_mem_top() to determine the value of ram_top.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/20241025172724.195093-2-sughosh.ganu@linaro.org
Signed-off-by: Michal Simek <michal.simek@amd.com>
9 months ago.gitignore: add test overlay .S and u_boot_logo files
Christian Marangi [Sat, 9 Nov 2024 17:48:44 +0000 (18:48 +0100)] 
.gitignore: add test overlay .S and u_boot_logo files

Add test overlay .S and u_boot_logo file to gitignore as these files are
generated and should not be committed but ignored.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
9 months agolmb.c: add missing comma in lmb_dump_region()
Heinrich Schuchardt [Thu, 7 Nov 2024 10:14:42 +0000 (11:14 +0100)] 
lmb.c: add missing comma in lmb_dump_region()

In the message string " %s[%d]\t[0x%llx-0x%llx], 0x%08llx bytes flags: "
a comma is missing before flags.

To avoid increasing the code size replace '0x%' by '%#'.

Printing the size with leading zeros but not the addresses does not really
make sense. Remove the leading zeros from the size output.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
[trini: Fix test/cmd/bdinfo.c for these changes]
Signed-off-by: Tom Rini <trini@konsulko.com>
9 months agotest: use %zd for size_t in mbr_test_run()
Heinrich Schuchardt [Sun, 3 Nov 2024 22:48:11 +0000 (23:48 +0100)] 
test: use %zd for size_t in mbr_test_run()

For printing size_t we must use %zd and not %ld to avoid
a -Wformat error on 32-bit systems.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
9 months agotest: print_printf() must check availability of %ls
Heinrich Schuchardt [Sun, 3 Nov 2024 20:46:42 +0000 (21:46 +0100)] 
test: print_printf() must check availability of %ls

Availability of %ls in printf() depends on having
CONFIG_EFI_LOADER or CONFIG_EFI_APP.

Respect this when testing.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
9 months agotest: cmd/mbr: pass correct buffer size to init_write_buffers
Heinrich Schuchardt [Sat, 2 Nov 2024 15:41:30 +0000 (16:41 +0100)] 
test: cmd/mbr: pass correct buffer size to init_write_buffers

We want to completely initialize the mbr and embr buffers. This requires
passing the buffer size and not the size of a pointer to the buffer.

Addresses-Coverity-ID: 510454 Wrong sizeof argument
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
9 months agoupl: fix parsing of DT property
Heinrich Schuchardt [Sat, 2 Nov 2024 15:04:13 +0000 (16:04 +0100)] 
upl: fix parsing of DT property

When calling decode_addr_size() we must pass the size of the device-tree
property and not sizeof(void *).

Fixes: 90469da3da0d ("upl: Add support for reading a upl handoff")
Addresses-Coverity-ID: 510459 Wrong sizeof argument
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
9 months agocmd: upl: initialize unit test state
Heinrich Schuchardt [Sat, 2 Nov 2024 14:30:20 +0000 (15:30 +0100)] 
cmd: upl: initialize unit test state

do_upl_write() calls upl_get_test_data() which may increment the fail
count in the unit test state. We should initialize it.

Addresses-Coverity-ID: 510465 Uninitialized scalar variable
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
9 months agoxyz-modem: Add missing fallthrough annotation
Heinrich Schuchardt [Sat, 2 Nov 2024 10:41:12 +0000 (11:41 +0100)] 
xyz-modem: Add missing fallthrough annotation

Falltroughs in switch statements should be explicit.

Addresses-Coverity-ID: 131162 Missing break in switch
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
9 months agolmb: do not panic in lmb_print_region_flags
Heinrich Schuchardt [Sat, 2 Nov 2024 06:32:26 +0000 (07:32 +0100)] 
lmb: do not panic in lmb_print_region_flags

Commit c3cf0dc64f1c ("lmb: add a check to prevent memory overrun")
addressed a possible buffer overrun using assert_noisy().

Resetting via panic() in lmb_print_region() while allowing invalid
lmb flags elsewhere is not reasonable.

Instead of panicking print a message indicating the problem.

fls() returns an int. Using a u64 for bitpos does not match.
Use int instead.

fls() takes an int as argument. Using 1ull << bitpos generates a u64.
Use 1u << bitpos instead.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Acked-by: Sughosh Ganu <sughosh.ganu@linaro.org>
9 months agolib: rsa: Set conventional salt length RSA-PSS parameter
Loic Poulain [Thu, 31 Oct 2024 09:15:31 +0000 (10:15 +0100)] 
lib: rsa: Set conventional salt length RSA-PSS parameter

RFC 3447 says that Typical salt length are either 0 or the length
of the output of the digest algorithm, RFC 4055 also recommends
hash value length as the salt length. Moreover, By convention,
most of the signing infrastructures/libraries use the length of
the digest algorithm (such as google cloud kms:
                      https://cloud.google.com/kms/docs/algorithms).

If the salt-length parameter is not set, openssl default to the
maximum allowed value, which is a openssl 'specificity', so this
works well for local signing, but restricts compatibility with
other engines (e.g pkcs11/libkmsp11):

```
returning 0x71 from C_SignInit due to status INVALID_ARGUMENT:
    at rsassa_pss.cc:53: expected salt length for key XX is 32,
    but 478 was supplied in the parameters
Could not obtain signature: error:41000070:PKCS#11 module::Mechanism invalid
```

To improve compatibility, we set the default RSA-PSS salt-length
value to the conventional one. A further improvement could consist
in making it configurable as signature FIT node attribute.

rfc3447: https://datatracker.ietf.org/doc/html/rfc3447
rfc4055: https://datatracker.ietf.org/doc/html/rfc4055

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
9 months agolwip: fix code style issues
Jerome Forissier [Thu, 7 Nov 2024 11:27:57 +0000 (12:27 +0100)] 
lwip: fix code style issues

Fix various code style issues in the lwIP code.

Reported-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
9 months agoMakefile: fix empty MK_ARCH when using ccache
Quentin Schulz [Mon, 11 Nov 2024 13:20:49 +0000 (14:20 +0100)] 
Makefile: fix empty MK_ARCH when using ccache

One can use ccache by prefixing the typical CROSS_COMPILE value with
"ccache " (e.g. "ccache aarch64-gnu-linux-" for Aarch64). This however
makes the MK_ARCH empty because sed won't find a match anymore since it
expects the CROSS_COMPILE value to start with the actual toolchain (with
an unlimited number of white spaces before).

This is failing builds since commit 7506c1566998 ("sandbox: Report host
default-filename in native mode").

Add "ccache" prefix to ignore but participate in the matching regex used
by sed to identify the target architecture.

Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
9 months agoMerge patch series "examples: fix building on arm64"
Tom Rini [Thu, 14 Nov 2024 16:51:13 +0000 (10:51 -0600)] 
Merge patch series "examples: fix building on arm64"

Heinrich Schuchardt <heinrich.schuchardt@canonical.com> says:

Commit f9886bc60f42 ("Added arm64 assembly for examples/api crt0") added
the arm64 architecture but the code does not even build.

With the changes the 'demo' program runs on qemu_arm64_defconfig using

    setenv autostart no
    dhcp demo
    setenv autostart yes
    bootelf $loadaddr

Link: https://lore.kernel.org/r/20241103053551.52715-1-heinrich.schuchardt@canonical.com
9 months agoexamples: make glue and demo code compatible with 64-bit
Heinrich Schuchardt [Sun, 3 Nov 2024 05:35:51 +0000 (06:35 +0100)] 
examples: make glue and demo code compatible with 64-bit

Commit f9886bc60f42 ("Added arm64 assembly for examples/api crt0")
added a 64-bit target for the examples but did not adjust the demo
code to be 64-bit compatible.

Change variable size for pointers.
Use %p to print pointers.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
9 months agoexamples: adjust LOAD_ADDR on arm64
Heinrich Schuchardt [Sun, 3 Nov 2024 05:35:50 +0000 (06:35 +0100)] 
examples: adjust LOAD_ADDR on arm64

Change the load address on arm64 such that it is compatible with the memory
available on qemu_arm64_defconfig.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
9 months agoexamples: fix building on arm64
Heinrich Schuchardt [Sun, 3 Nov 2024 05:35:49 +0000 (06:35 +0100)] 
examples: fix building on arm64

Commit f9886bc60f42 ("Added arm64 assembly for examples/api crt0") tried to
add arm64 support to the examples but crt0.S does not even build for
qemu_arm64_defconfig with CONFIG_API=y, CONFIG_EXAMPLES=y:

    examples/api/crt0.S: Assembler messages:
    examples/api/crt0.S:32: Error:
        expected a register at operand 1 -- `ldr ip,=search_hint'
    examples/api/crt0.S:33: Error:
        unexpected register type at operand 1 -- `str sp,[ip]'
    make[2]: *** [scripts/Makefile.build:292: examples/api/crt0.o] Error 1

Do not define _start twice.
Use valid register names.
Move syscall_ptr and search_hint to the data section to avoid an invalid
relocation.

Fixes: f9886bc60f42 ("Added arm64 assembly for examples/api crt0")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
9 months agoMerge patch series "cmd: hash: correct parameter count check"
Tom Rini [Thu, 14 Nov 2024 16:49:30 +0000 (10:49 -0600)] 
Merge patch series "cmd: hash: correct parameter count check"

Heinrich Schuchardt <heinrich.schuchardt@canonical.com> says:

Since commit 348ea878508d ("cmd: hash: fix param count check") the hash
command cannot be used without the optional variable name parameter if
CONFIG_HASH_VERIFY=y. 'hash sha1 $loadaddr $filesize' returns
CMD_RET_USAGE.

The minimum number of arguments is four no matter if verification is
enabled or not.

Fix the parameter check.

Provide a unit test.

Link: https://lore.kernel.org/r/20241102100836.103005-1-heinrich.schuchardt@canonical.com
9 months agoMerge patch series "Apply SoM overlays on phyCORE-AM6xx SoMs"
Tom Rini [Thu, 14 Nov 2024 16:48:07 +0000 (10:48 -0600)] 
Merge patch series "Apply SoM overlays on phyCORE-AM6xx SoMs"

Wadim Egorov <w.egorov@phytec.de> says:

Our SoMs are available in multiple configurations, managed via device
tree overlays. To determine the specific variant in use, we read the
EEPROM and apply the appropriate overlays during boot to the device tree
used by the OS.

Apply overlays for phyCORE-AM62x and phyCORE-AM64x SoMs.
Future K3 SoMs will be able to reuse this logic and overlays.

Link: https://lore.kernel.org/r/20241030164815.1763506-1-w.egorov@phytec.de
9 months agotest: unit test for hash command
Heinrich Schuchardt [Sat, 2 Nov 2024 10:08:36 +0000 (11:08 +0100)] 
test: unit test for hash command

Provide a unit test testing the hash command.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
9 months agocmd: hash: correct parameter count check
Heinrich Schuchardt [Sat, 2 Nov 2024 10:08:35 +0000 (11:08 +0100)] 
cmd: hash: correct parameter count check

Since commit 348ea878508d ("cmd: hash: fix param count check") the hash
command cannot be used without the optional variable name parameter if
CONFIG_HASH_VERIFY=y. 'hash sha1 $loadaddr $filesize' returns
CMD_RET_USAGE.

The minimum number of arguments is four no matter if verification is
enabled or not.

Fixes: 348ea878508d ("cmd: hash: fix param count check")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@gmail.com>
9 months agoboard: phytec: common: k3: Apply SoM-specific overlays to OS device tree
Wadim Egorov [Wed, 30 Oct 2024 16:48:15 +0000 (17:48 +0100)] 
board: phytec: common: k3: Apply SoM-specific overlays to OS device tree

Our SoMs are available in multiple configurations, managed via device
tree overlays. To determine the specific variant in use, we read the
EEPROM and apply the appropriate overlays during boot to the device tree
used by the OS.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
Acked-by: Neha Malcom Francis <n-francis@ti.com>
9 months agoarm: dts: k3-am642-phycore-som-binman: Add SoM overlays
Wadim Egorov [Wed, 30 Oct 2024 16:48:14 +0000 (17:48 +0100)] 
arm: dts: k3-am642-phycore-som-binman: Add SoM overlays

Include SoM dt-overlays that handle variants of our SoMs into
u-boot's FIT image.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
9 months agoarm: dts: k3-am625-phycore-som-binman: Add SoM overlays
Wadim Egorov [Wed, 30 Oct 2024 16:48:13 +0000 (17:48 +0100)] 
arm: dts: k3-am625-phycore-som-binman: Add SoM overlays

Include SoM dt-overlays that handle variants of our SoMs into
u-boot's FIT image.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
9 months agoconfigs: phycore_am64x_a53_defconfig: Enable PHYTEC_SOM_DETECTION
Wadim Egorov [Wed, 30 Oct 2024 16:48:12 +0000 (17:48 +0100)] 
configs: phycore_am64x_a53_defconfig: Enable PHYTEC_SOM_DETECTION

Enable CONFIG_PHYTEC_SOM_DETECTION to apply SoM overlays
based on EEPROM configuration.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
9 months agoconfigs: phycore_am64x_a53_defconfig: Add SoM overlays to OF_OVERLAY_LIST
Wadim Egorov [Wed, 30 Oct 2024 16:48:11 +0000 (17:48 +0100)] 
configs: phycore_am64x_a53_defconfig: Add SoM overlays to OF_OVERLAY_LIST

Include SoM dt-overlays for DT control so we can include them
into our u-boot FIT image.
While at it also resync after savedefconfig.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
9 months agoconfigs: phycore_am62x_a53_defconfig: Add SoM overlays to OF_OVERLAY_LIST
Wadim Egorov [Wed, 30 Oct 2024 16:48:10 +0000 (17:48 +0100)] 
configs: phycore_am62x_a53_defconfig: Add SoM overlays to OF_OVERLAY_LIST

Include SoM dt-overlays for DT control so we can include them
into our u-boot FIT image.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
9 months agoMerge tag 'u-boot-amlogic-next-20241113' of https://source.denx.de/u-boot/custodians...
Tom Rini [Thu, 14 Nov 2024 16:39:17 +0000 (10:39 -0600)] 
Merge tag 'u-boot-amlogic-next-20241113' of https://source.denx.de/u-boot/custodians/u-boot-amlogic into next

- khadas-vim3{l}: fix userdata size for android config
- drop A1 dtsi and other bindings includes in favor of Upstream ones

9 months agoMerge patch series "labgrid: Provide an integration with Labgrid"
Tom Rini [Wed, 13 Nov 2024 18:05:00 +0000 (12:05 -0600)] 
Merge patch series "labgrid: Provide an integration with Labgrid"

Simon Glass <sjg@chromium.org> says:

Labgrid provides access to a hardware lab in an automated way. It is
possible to boot U-Boot on boards in the lab without physically touching
them. It relies on relays, USB UARTs and SD muxes, among other things.

By way of background, about 4 years ago I wrong a thing called Labman[1]
which allowed my lab of about 30 devices to be operated remotely, using
tbot for the console and build integration. While it worked OK and I
used it for many bisects, I didn't take it any further.

It turns out that there was already an existing program, called Labgrid,
which I did not know about at time (thank you Tom for telling me). It is
more rounded than Labman and has a number of advantages:

- does not need udev rules, mostly
- has several existing users who rely on it
- supports multiple machines exporting their devices

It lacks a 'lab check' feature and a few other things, but these can be
remedied.

On and off over the past several weeks I have been experimenting with
Labgrid. I have managed to create an initial U-Boot integration (this
series) by adding various features to Labgrid[2] and the U-Boot test
hooks.

I hope that this might inspire others to set up boards and run tests
automatically, rather than relying on infrequent, manual test. Perhaps
it may even be possible to have a number of labs available.

Included in the integration are a number of simple scripts which make it
easy to connect to boards and run tests:

ub-int <target>
    Build and boot on a target, starting an interactive session

ub-cli <target>
    Build and boot on a target, ensure U-Boot starts and provide an interactive
    session from there

ub-smoke <target>
    Smoke test U-Boot to check that it boots to a prompt on a target

ub-bisect <target>
    Bisect a git tree to locate a failure on a particular target

ub-pyt <target> <testspec>
    Run U-Boot pytests on a target

Some of these help to provide the same tbot[4] workflow which I have
relied on for several years, albeit much simpler versions.

The goal here is to create some sort of script which can collect
patches from the mailing list, apply them and test them on a selection
of boards. I suspect that script already exists, so please let me know
what you suggest.

I hope you find this interesting and take a look!

[1] https://github.com/sjg20/u-boot/tree/lab6a
[2] https://github.com/labgrid-project/labgrid/pull/1411
[3] https://github.com/sjg20/uboot-test-hooks/tree/labgrid
[4] https://tbot.tools/index.html

Link: https://lore.kernel.org/r/20241112141326.643128-1-sjg@chromium.org
[trini: Move the sjg-lab job to prior to world build, to fix pipeline
        status]
Signed-off-by: Tom Rini <trini@konsulko.com>
9 months agoMerge patch series "test: Tidy up the test/ directory"
Tom Rini [Wed, 13 Nov 2024 17:59:07 +0000 (11:59 -0600)] 
Merge patch series "test: Tidy up the test/ directory"

Simon Glass <sjg@chromium.org> says:

Some tests do not use the unit-test framework. Others are in a suite of
their own, for no obvious reason.

This series tidies this up.

Link: https://lore.kernel.org/r/20241102193715.432529-1-sjg@chromium.org
9 months agosandbox: Add a build without CMDLINE
Simon Glass [Sat, 2 Nov 2024 19:36:11 +0000 (13:36 -0600)] 
sandbox: Add a build without CMDLINE

Sometimes this breaks, so add a build to keep it working. Since sandbox
enables a lot of options, it is a good board to use. The new config is
created simply by copying the existing sandbox and turning off CMDLINE

Once we have tests for non-CMDLINE operation, this can be adjusted to
run those tests.

Create a new build which will be picked up by CI. Update the maintainer
entry as well.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
9 months agoCI: Allow running tests on sjg lab
Simon Glass [Tue, 12 Nov 2024 14:13:26 +0000 (07:13 -0700)] 
CI: Allow running tests on sjg lab

Add a way to run tests on a real hardware lab. This is in the very early
experimental stages. There are only 23 boards and 3 of those are broken!
(bob, ff3399, samus). A fourth fails due to problems with the TPM tests.

To try this, assuming you have gitlab access, set SJG_LAB=1, e.g.:

   git push -o ci.variable="SJG_LAB=1" dm HEAD:try

This relies on the two previous series targeted at -next as well as the
bugfix series for -master

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>
9 months agotest: Correct regex string in test_spi
Simon Glass [Tue, 12 Nov 2024 14:13:25 +0000 (07:13 -0700)] 
test: Correct regex string in test_spi

Use an 'r' string to avoid a warning:

  test/py/tests/test_spi.py:698: DeprecationWarning: invalid escape
     sequence '\s'

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Love Kumar <love.kumar@amd.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
9 months agotest: Support testing with two board-builds
Simon Glass [Tue, 12 Nov 2024 14:13:24 +0000 (07:13 -0700)] 
test: Support testing with two board-builds

The Beagleplay board uses an SoC from the TI K3 family. This has both a
Cortex-R core and a Cortex-A core and the R core needs to come up before
the A core. In both cases we have U-Boot SPL then U-Boot proper being
used.

In practice this means we need two entirely separate builds to produce
an image.

Handle this in test.py by adding more parameters.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 months agotest: Add a section for closing the connection
Simon Glass [Tue, 12 Nov 2024 14:13:23 +0000 (07:13 -0700)] 
test: Add a section for closing the connection

This can take a while and involve multiple steps (e.g. turning the board
back off). Add a section for it and show the output.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
9 months agotest: Try to shut down the lab console gracefully
Simon Glass [Tue, 12 Nov 2024 14:13:22 +0000 (07:13 -0700)] 
test: Try to shut down the lab console gracefully

Send the Labgrid quit characters to ask it to exit gracefully. This
typically allows it to power off the board being used. Only do this when
labgrid is being used (detected with an env var).

If that doesn't work, try the less graceful approach.

The normal approach for pytest is to simply kill the child process. This
makes Labgrid exit immediately. Thus it does not get a chance to execute
the 'off' part of strategy (which may power it off) and release the
device.

Without this, every board disconnect leaves the board in a bad state,
requiring separate steps to recover the board, then power it off.

The action is conditional on since USE_LABGRID_SJG being set, so only
affects operation if the Labgrid-sjg integration is being used.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 months agotest: Avoid double echo when starting up
Simon Glass [Tue, 12 Nov 2024 14:13:21 +0000 (07:13 -0700)] 
test: Avoid double echo when starting up

There is a very annoying bug at present where the terminal echos part
of the first command sent to the board. This happens because the
terminal is still set to echo for a period until Labgrid starts up and
can change this.

Fix this by disabling echo (and other terminal features) as soon as the
spawn happens.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 months agotest: Improve handling of sending commands
Simon Glass [Tue, 12 Nov 2024 14:13:20 +0000 (07:13 -0700)] 
test: Improve handling of sending commands

We expect commands to be echoed and this should happen quite quickly,
since U-Boot is sitting at the prompt waiting for a command.

Reduce the timeout for this situation. Try to produce a more useful
error message when something goes wrong. Also handle the case where the
connection has gone away since the last command was issued.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 months agotest: Introduce lab mode
Simon Glass [Tue, 12 Nov 2024 14:13:19 +0000 (07:13 -0700)] 
test: Introduce lab mode

There is quite a bit of code in pytest to try to start up U-Boot on a
board, with timeouts, expects, etc.

This is tedious to maintain and is peripheral to the test system's
purpose. It seems better to put this logic in the lab itself, where is
can provide such support.

With Labgrid we can use the UbootStrategy class to get the board into a
useful state, however it needs to do it. Then it can report to pytest
by writing a suitable string along with the U-Boot version it detected.

Add support for detecting 'lab mode' and simply assume that all is well
in that case. Collect the version string when Labgrid says it is ready.

This is only used with the Labgrid-sjg integration. When Labgrid starts
the UbootStrategy it checks if U_BOOT_SOURCE_DIR is set. If so it emits
a string '{lab mode}' that tells test.py to simply wait for an
indication that the board is ready. All banner-checking is skipped. The
indication comes in the form of another string 'Lab: Board is ready'
which Labgrid sends once the board is sitting at a prompt ready to run
tests. Then test.py emits 'U-Boot is ready' and continues with testing.

Note that Labgrid has the same kind of "check for a string" logic that
is in test.py, except it's not caring about the correct number / order
of banner prints. This checking could be added, however. If something
fails, the complete output is shown, so it is possible to see what went
wrong.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 months agotest: Introduce the concept of a role
Simon Glass [Tue, 12 Nov 2024 14:13:18 +0000 (07:13 -0700)] 
test: Introduce the concept of a role

In Labgrid there is the concept of a 'role', which is similar to the
U-Boot board ID in U-Boot's pytest subsystem.

The role indicates both the target and information about the U-Boot
build to use. It can also provide any amount of other configuration.
The information is obtained using the 'labgrid-client query' operation.

Using this role, all required configuration for the board is stored
within the Labgrid environment, with pytest simply querying it. This
allows connecting to boards using an interactive console, something that
isn't possible without some kind of mapping. It also means that we don't
need to replicate the pytest functionality in tbot, since Labgrid can
handle the console and kick off builds as needed.

Make use of this in tests, so that only the role is required in gitlab
and other situations. The board type and other things can be queried
as needed.

Use a new 'u-boot-test-getrole' script to obtain the requested
information.

With this it is possible to run lab tests in gitlab with just a single
'ROLE' variable for each board.

Note that, without this feature:
- interactive use of boards with Labgrid-sjg would require repeating the
  id/board in a separate configuration file
- Gitlab yaml file would need to specify both the id and board

This feature is entirely optional, however, with the code gracefully
falling back to using a separate ID and board.

Link: https://tbot.tools
Signed-off-by: Simon Glass <sjg@chromium.org>
9 months agotest: Allow connecting to a running board
Simon Glass [Tue, 12 Nov 2024 14:13:17 +0000 (07:13 -0700)] 
test: Allow connecting to a running board

Sometimes we know that the board is already running the right software,
so provide an option to allow running of tests directly, without first
resetting the board.

This saves time when re-running a test where only the Python code is
changing.

Note that this feature is open to errors, since the user must know that
the board is in a fit state to execute tests. It is useful for repeated
iteration on a particular test, where it can save quite a bit of time.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 months agotest: Release board after tests complete
Simon Glass [Tue, 12 Nov 2024 14:13:16 +0000 (07:13 -0700)] 
test: Release board after tests complete

When a board is finished with, the lab may want to power it off, or
perform some other function. Add a new script which is called when tests
are complete.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
9 months agotest: Allow signaling that U-Boot is ready
Simon Glass [Tue, 12 Nov 2024 14:13:15 +0000 (07:13 -0700)] 
test: Allow signaling that U-Boot is ready

When Labgrid is used, it can get U-Boot ready for running tests. It
prints a message when it has done so.

Add logic to detect this message and accept it.

Note that this does not change pytest, which still (also) looks for the
U-Boot banner. This change merely makes it possible for pytest to
believe Labgrid when it says that the board is ready for use.

In several cases, the board starts up and Labgrid receives some initial
output, then pytest starts and misses some of that output, because it
came in while Labgrid had the console open. Then pytest fails because
it doesn't see the expected banners.

With this change, Labgrid handles getting U-Boot to a prompt, in a
fully reliable manner. Then pytest starts up and can simply start
running its tests.

But, again, this does not prevent pytest from handling a banner if one
is provided (e.g. if not using the Labgrid integration).

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
9 months agotest: Quote test names
Simon Glass [Sat, 2 Nov 2024 19:37:05 +0000 (13:37 -0600)] 
test: Quote test names

When mentioning a test name, add single quotes to make it easier to see.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> # rpi_3, rpi_4, rpi_arm64, am64x_evm_a53, am64-sk
9 months agotest: Correct display of failing test
Simon Glass [Sat, 2 Nov 2024 19:37:04 +0000 (13:37 -0600)] 
test: Correct display of failing test

This should show the test name, not the selected name, since the user
may be running all tests, in which case 'select_name' is NULL

Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> # rpi_3, rpi_4, rpi_arm64, am64x_evm_a53, am64-sk
9 months agotest: Update time tests to use unit-test asserts
Simon Glass [Sat, 2 Nov 2024 19:37:03 +0000 (13:37 -0600)] 
test: Update time tests to use unit-test asserts

Rather than returning various error codes, use assertions to check that
the test passes.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> # rpi_3, rpi_4, rpi_arm64, am64x_evm_a53, am64-sk
9 months agotest: Move time tests into the lib suite
Simon Glass [Sat, 2 Nov 2024 19:37:02 +0000 (13:37 -0600)] 
test: Move time tests into the lib suite

There is no particular need for the time tests to have their own test
command. Move them into the lib suite instead.

Update the test functions to match the normal unit-test signature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> # rpi_3, rpi_4, rpi_arm64, am64x_evm_a53, am64-sk
9 months agotest: Move time_ut test into lib
Simon Glass [Sat, 2 Nov 2024 19:37:01 +0000 (13:37 -0600)] 
test: Move time_ut test into lib

This test doesn't belong at the top level. Move it into the lib/
directory, to match its implementation. Rename it to drop the
unnecessary _ut suffix.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> # rpi_3, rpi_4, rpi_arm64, am64x_evm_a53, am64-sk
9 months agotest: Move unicode tests into the lib suite
Simon Glass [Sat, 2 Nov 2024 19:37:00 +0000 (13:37 -0600)] 
test: Move unicode tests into the lib suite

There is no particular need for the unicode tests to have their own test
suite. Move them into the lib suite instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Tested-by: Tom Rini <trini@konsulko.com> # rpi_3, rpi_4, rpi_arm64, am64x_evm_a53, am64-sk