pandora-u-boot.git
2 months agoarm: gic-v3: Scan for subnodes
Patrick Rudolph [Thu, 20 Mar 2025 12:51:56 +0000 (13:51 +0100)]
arm: gic-v3: Scan for subnodes

According to the binding [1] the ITS node should be a subnode of the
GICv3 node. Since the ITS node has it's own driver, manually probe for
possible subnodes after binding since dm_scan_fdt() is not recursive.

1: https://www.kernel.org/doc/Documentation/devicetree/bindings/interrupt-controller/arm%2Cgic-v3.txt

Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
2 months agotiny-printf: Improve %X formatting
Christoph Niedermaier [Thu, 20 Mar 2025 19:01:47 +0000 (20:01 +0100)]
tiny-printf: Improve %X formatting

If tiny printf is used with 0x%08X (upper case X) the output is
always 0x00000000. It could be confusing if upper case instead
of lower case is used intentionally or accidentally because the
actual value is not output. To avoid this confusion, treat output
of %X as %x. As a compromise for tiny printf, the hex value is
then output correctly, but in lower case. This is done to keep it
tiny printf small.

Signed-off-by: Christoph Niedermaier <cniedermaier@dh-electronics.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Marek Vasut <marex@denx.de>
2 months agoMerge tag 'ubifixes-for-2025.07-rc1' of https://source.denx.de/u-boot/custodians...
Tom Rini [Tue, 8 Apr 2025 21:07:23 +0000 (15:07 -0600)]
Merge tag 'ubifixes-for-2025.07-rc1' of https://source.denx.de/u-boot/custodians/u-boot-ubi

ubi fixes for v2025.07-rc1

- ubi: fix bug creating partitions for non-existent volumes
  from Oskar Nilsson

2 months agoMerge patch series "Improve pytest runtime"
Tom Rini [Tue, 8 Apr 2025 19:54:50 +0000 (13:54 -0600)]
Merge patch series "Improve pytest runtime"

Tom Rini <trini@konsulko.com> says:

One thing that Simon Glass has noted is that our pytest run time keeps
getting longer. Looking at:
https://source.denx.de/u-boot/u-boot/-/pipelines/25011/test_report?job_name=sandbox%20test.py%3A%20%5Bfast%20amd64%5D
we can see that some of the longest running tests are a little puzzling.
It turns out that we have two ways of making filesystem images without
requiring root access and one of them is significantly slower than the
other. This series changes us from using virt-make-fs to only using the
mk_fs helper that currently resides in test_ut.py which uses standard
userspace tools. The final result can be seen at:
https://source.denx.de/u-boot/u-boot/-/pipelines/25015/test_report?job_name=sandbox%20test.py%3A%20%5Bfast%20amd64%5D
and the tests changed here now run much quicker.

Link: https://lore.kernel.org/r/20250320140030.2052434-1-trini@konsulko.com
2 months agoDockerfile: Update to drop virt-make-fs packages
Tom Rini [Thu, 20 Mar 2025 13:59:31 +0000 (07:59 -0600)]
Dockerfile: Update to drop virt-make-fs packages

Now that we do not need nor want people to use virt-make-fs for
filesystem tests, remove the related packages from the installation
list.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 months agodoc/develop/py_testing.rst: Update section on filesystem images
Tom Rini [Thu, 20 Mar 2025 13:59:30 +0000 (07:59 -0600)]
doc/develop/py_testing.rst: Update section on filesystem images

Now that we have no users of "virt-make-fs" nor users of "sudo" for
creating disk images update the documentation. We remove packages that
are no longer required (and related text) as well as be firm in our
wording around not using "sudo".

Signed-off-by: Tom Rini <trini@konsulko.com>
2 months agotest/py: Rework test_efi_secboot to not use virt-make-fs
Tom Rini [Thu, 20 Mar 2025 13:59:29 +0000 (07:59 -0600)]
test/py: Rework test_efi_secboot to not use virt-make-fs

The problem with using "virt-make-fs" to make a filesystem image is that
it is extremely slow. Switch to using the fs_helper functions we have
instead from the filesystem tests as these can add files to images and
are significantly faster and still do not require root access.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 months agotest/py: Rework test_efi_capsule to not use virt-make-fs
Tom Rini [Thu, 20 Mar 2025 13:59:28 +0000 (07:59 -0600)]
test/py: Rework test_efi_capsule to not use virt-make-fs

FIXME: Reword more

The problem with using "virt-make-fs" to make a filesystem image is that
it is extremely slow. Switch to using the fs_helper functions we have
instead from the filesystem tests as these can add files to images and
are significantly faster and still do not require root access.

The main change here is that our mount point directory has changed from
"test_efi_capsule" to "scratch" and so we need to update other functions
too. As the disk image that we get created doesn't have a GPT, invoke
sgdisk to do a conversion first.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 months agotest/py: Rework test_eficonfig to not use virt-make-fs
Tom Rini [Thu, 20 Mar 2025 13:59:27 +0000 (07:59 -0600)]
test/py: Rework test_eficonfig to not use virt-make-fs

The problem with using "virt-make-fs" to make a filesystem image is that
it is extremely slow. Switch to using the fs_helper functions we have
instead from the filesystem tests as these can add files to images and
are significantly faster and still do not require root access.

As this test already had a number of internal functions, add a
prepare_image function to do this part of the test.

Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
2 months agotest/py: Rework test_efi_bootmgr to not use virt-make-fs
Tom Rini [Thu, 20 Mar 2025 13:59:26 +0000 (07:59 -0600)]
test/py: Rework test_efi_bootmgr to not use virt-make-fs

The problem with using "virt-make-fs" to make a filesystem image is that
it is extremely slow. Switch to using the fs_helper functions we have
instead from the filesystem tests as these can add files to images and
are significantly faster and still do not require root access.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 months agotest/py: Fix a problem with setup_image
Tom Rini [Thu, 20 Mar 2025 13:59:25 +0000 (07:59 -0600)]
test/py: Fix a problem with setup_image

While we can be passed an image size to use, we always called qemu-img
with 20M as the size. Fix this by using the size parameter.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 months agotest/py/tests: Move "setup_image" from test_ut.py to fs_helper.py
Tom Rini [Thu, 20 Mar 2025 13:59:24 +0000 (07:59 -0600)]
test/py/tests: Move "setup_image" from test_ut.py to fs_helper.py

The generic function in test_ut.py to create a disk image with partition
table can be useful outside of test_ut.py so move it to be available
more clearly.

To make this a bit more easily used library function, make use of
check_call directly rather than calling things though u_boot_utils. In
turn, to more easily handle stdin here, use the shell "printf" utility
to pass sfdisk the specification to create as we do not have an actual
file descriptor to use here.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 months agotest/py: Rework test_xxd to not use virt-make-fs
Tom Rini [Thu, 20 Mar 2025 13:59:23 +0000 (07:59 -0600)]
test/py: Rework test_xxd to not use virt-make-fs

The problem with using "virt-make-fs" to make a filesystem image is that
it is extremely slow. Switch to using the fs_helper functions we have
instead from the filesystem tests as these can add files to images and
are significantly faster and still do not require root access.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 months agotest/py: Rework test_cat to not use virt-make-fs
Tom Rini [Thu, 20 Mar 2025 13:59:22 +0000 (07:59 -0600)]
test/py: Rework test_cat to not use virt-make-fs

The problem with using "virt-make-fs" to make a filesystem image is that
it is extremely slow. Switch to using the fs_helper functions we have
instead from the filesystem tests as these can add files to images and
are significantly faster and still do not require root access.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 months agodoc: release_cycle: fix next release version
Dario Binacchi [Tue, 8 Apr 2025 06:28:28 +0000 (08:28 +0200)]
doc: release_cycle: fix next release version

The release commit for version v2025.04 forgot to update the next
version (i. e. v2025.07) in the section where information about the
merge window is provided.

Fixes: 34820924edbc ("Prepare v2025.04")
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 months agoMerge branch 'next'
Tom Rini [Mon, 7 Apr 2025 22:40:02 +0000 (16:40 -0600)]
Merge branch 'next'

Note that this undoes the changes of commit cf6d4535cc4c ("x86:
emulation: Disable bloblist for now") as that was intended only for the
release due to time.

2 months agoubi: fix bug creating partitions for non-existent volumes
Oskar Nilsson [Wed, 26 Mar 2025 09:22:44 +0000 (10:22 +0100)]
ubi: fix bug creating partitions for non-existent volumes

The part_get_info_ubi() function was incorrectly returning 0 (success)
when a UBI volume was not found for a given partition index. This caused
the part_create_block_devices() function in blk-uclass.c to continue
creating devices for non-existent partitions up to MAX_SEARCH_PARTITIONS

Fix the issue by returning -1 when a volume is not found, signaling to
the part_create_block_devices() function that no more valid volumes
exist.

Before patch, 128 blk_partition are created:
Class   Index  Probed  Driver        Name
-------------------------------------------------
root        0  [ + ]  root_driver    root_driver
thermal     0  [   ]  imx_thermal    |-- imx_thermal
simple_bus  0  [ + ]  simple_bus     |-- soc
mtd         0  [ + ]  mxs-nand-dt    |   |-- nand-controller@1806000
blk         0  [   ]  ubi_blk        |   |   `-- nand-controller@1806000.blk
partition   0  [   ]  blk_partition  |   |       |-- nand-controller@1806000.blk:1
...
partition 127  [   ]  blk_partition  |   |       `-- nand-controller@1806000.blk:128

After patch, the expected blk_partition are created:
Class   Index  Probed  Driver        Name
-------------------------------------------------
root        0  [ + ]  root_driver    root_driver
thermal     0  [   ]  imx_thermal    |-- imx_thermal
simple_bus  0  [ + ]  simple_bus     |-- soc
mtd         0  [ + ]  mxs-nand-dt    |   |-- nand-controller@1806000
blk         0  [   ]  ubi_blk        |   |   `-- nand-controller@1806000.blk
partition   0  [   ]  blk_partition  |   |       |-- nand-controller@1806000.blk:1
partition   1  [   ]  blk_partition  |   |       |-- nand-controller@1806000.blk:2
partition   2  [   ]  blk_partition  |   |       |-- nand-controller@1806000.blk:3
partition   3  [   ]  blk_partition  |   |       `-- nand-controller@1806000.blk:4
simple_bus  1  [ + ]  simple_bus     |   |-- bus@2000000

Signed-off-by: Oskar Nilsson <onilsson@rums.se>
Cc: Kyungmin Park <kmpark@infradead.org>
Cc: Heiko Schocher <hs@denx.de>
Cc: Alexey Romanov <avromanov@salutedevices.com>
Changed in v2:
 - Change return from -1 to -ENOENT
Reviewed-by: Heiko Schocher <hs@denx.de>
2 months agoRevert "Merge patch series "pxe: Precursor series for supporting read_all() in extlin...
Tom Rini [Mon, 7 Apr 2025 18:35:13 +0000 (12:35 -0600)]
Revert "Merge patch series "pxe: Precursor series for supporting read_all() in extlinux / PXE""

This reverts commit 8bc3542384e3a1219e5ffb62b79d16dddc1b1fb9, reversing
changes made to 698edd63eca090a2e299cd3facf90a0b97bed677.

There are still problems with this series to work out.

Link: https://lore.kernel.org/u-boot/CAFLszTjw_MJbK9tpzVYi3XKGazcv55auBAdgVzcAVUta7dRqcg@mail.gmail.com/
Signed-off-by: Tom Rini <trini@konsulko.com>
2 months agoPrepare v2025.04 v2025.04
Tom Rini [Mon, 7 Apr 2025 21:57:55 +0000 (15:57 -0600)]
Prepare v2025.04

Signed-off-by: Tom Rini <trini@konsulko.com>
2 months agobuildman: update PyYAML requirement
Heinrich Schuchardt [Mon, 7 Apr 2025 06:47:12 +0000 (08:47 +0200)]
buildman: update PyYAML requirement

On Ubuntu 25.04 installing the dependency pyyaml 6.0 fails with

    License classifiers are deprecated

Update PyYAML to the current release.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 months agoefi_loader: stop network in EXIT_BOOT_SERVICES
Heinrich Schuchardt [Sat, 5 Apr 2025 06:58:12 +0000 (08:58 +0200)]
efi_loader: stop network in EXIT_BOOT_SERVICES

It has been reported that memory corruption can occurred because network
packages where received after EXIT_BOOT_SERVICES. See the thread
starting at [1].

We try to remove all drivers when EXIT_BOOT_SERVICES is called. But

* Some network drivers don't call their own stop method when removed.
* Some network drivers don't have a remove method.
* Some devices have CONFIG_DM_DEVICE_REMOVE=n.

Let's call eth_halt() in EXIT_BOOT_SERVICES explicitly.

[1]
https://lore.kernel.org/all/C101B675-EEE6-44CB-8A44-83F72182FBD6@kohlschutter.com/

Cc: Michael Brown <mcb30@ipxe.org>
Reported-by: Christian Kohlschütter <christian@kohlschutter.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Michael Brown <mcb30@ipxe.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Tested-by: Christian Kohlschütter <christian@kohlschutter.com>
2 months agoboot: call dhcp_run in pxe bootmethod
Heiko Stuebner [Wed, 2 Apr 2025 21:50:25 +0000 (23:50 +0200)]
boot: call dhcp_run in pxe bootmethod

A recent change tried to speed up EFI booting by not calling dhcp_run
from eth_bootdev_hunt() every time. PXE so far relied on that dhcp_run
call to get an IP address.

Fix that by adding a dhcp_run call to the pxe bootflow, with autoload
disabled to only get the ip address and nothing else.

Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Fixes: 1f68057e0320 ("net: eth_bootdev_hunt() should not run DHCP")
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
2 months agombedtls: remove incorrect attribute type checker
Raymond Mao [Fri, 4 Apr 2025 14:05:25 +0000 (07:05 -0700)]
mbedtls: remove incorrect attribute type checker

S/MIME Capabilities (OID: 1.2.840.113549.1.9.15) attributes are
expected to be algorithms but neither data nor MS Inderect Data,
thus the checker for data type is incorrect.

This patch fixes a capsule authentication failure with PKCS#7
message that contains S/MIME capabilities, which formed by the EDK2
GenerateCapsule tool.

S/MIME Capabilities are not common attributes in an EFI capsule,
thus this failure cannot be reproduced with the capsules generated
via mkeficapsule.

Fixes: 7de0d155cce7 ("mbedtls: add PKCS7 parser porting layer")
Reported-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
2 months agox86: emulation: Disable bloblist for now
Tom Rini [Fri, 4 Apr 2025 16:36:17 +0000 (10:36 -0600)]
x86: emulation: Disable bloblist for now

As reported by Niklas Sombert, enabling bloblist on these platforms
means that we currently don't pass SMBIOS tables on to later stages. For
the v2025.04 release, disable bloblists as that is sufficient to restore
functionality and we will address the underlying problem for the next
release.

Link: https://lore.kernel.org/u-boot/c1dc7446-d1d0-4ef2-b201-09fc612aa8db@uni-duesseldorf.de
Reported-by: Niklas Sombert <niklas.sombert@uni-duesseldorf.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
2 months agoMerge patch series "Enable MUX_MMIO at SPL stage"
Tom Rini [Sat, 5 Apr 2025 15:35:30 +0000 (09:35 -0600)]
Merge patch series "Enable MUX_MMIO at SPL stage"

Anurag Dutta <a-dutta@ti.com> says:

This series enables MUX_MMIO at SPL stage for j7200 and j721e
as it is required for successful hyperflash boot.

Test logs :
https://gist.github.com/anuragdutta731/b4c79ef8da56d8c50b38d953c9da4d45

Link: https://lore.kernel.org/r/20250320063004.1069653-1-a-dutta@ti.com
2 months agoarm: mach-k3: k3-ddr.h: Include spl.h
Neha Malcom Francis [Thu, 20 Mar 2025 06:27:33 +0000 (11:57 +0530)]
arm: mach-k3: k3-ddr.h: Include spl.h

Include spl.h to avoid definition errors in custom builds.

Fixes: commit bc07851897bd ("board: ti: Pull redundant DDR functions to a common location and Fixup DDR size when ECC is enabled")
Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
2 months agoarm: mach-k3: j721e: Split out J7200 SoC support from J721e
Andrew Davis [Wed, 19 Mar 2025 18:54:58 +0000 (13:54 -0500)]
arm: mach-k3: j721e: Split out J7200 SoC support from J721e

Currently in j721e_init.c we check which firewalls to remove using
the board configuration (e.g CONFIG_TARGET_J721E_R5_EVM). We do this
as J721e and J7200 have different IP and firewalls but use the same
SoC definition (SOC_K3_J721E) even though they are different SoCs.

The idea was they would be similar enough that they both could use
the same SoC config to help with common code sharing. Board checks
would then be used differentiate.

This has grown far too messy to maintain any more, especially now
that there is more than one board using J721e (EVM, SK, Beagle AI64).
As differentiation is done based on board, every one of these boards
would have to have checks added for them. Instead let's split J7200
support out from J721e like how normal new SoC support is done.

This patch touches several subsystems and could not be split much better
as when we add SOC_K3_J7200 we want to make use of it in all spots that
once used the combined SOC_K3_J721E so we can turn off SOC_K3_J721E when
building for J7200 boards.

Signed-off-by: Andrew Davis <afd@ti.com>
2 months agoarm: dts: k3: Remove leftover file after OF_UPSTREAM
Andrew Davis [Wed, 19 Mar 2025 15:15:50 +0000 (10:15 -0500)]
arm: dts: k3: Remove leftover file after OF_UPSTREAM

The file k3-am62a7.dtsi is part of upstream DT and should
have been removed when migrating to OF_UPSTREAM but must
have been missed. Do this here.

Signed-off-by: Andrew Davis <afd@ti.com>
2 months agoconfigs: j721e_evm_a72_defconfig: Enable MUX_MMIO at SPL
Anurag Dutta [Thu, 20 Mar 2025 06:30:04 +0000 (12:00 +0530)]
configs: j721e_evm_a72_defconfig: Enable MUX_MMIO at SPL

MUX_MMIO is required in SPL stage in order to boot hyperflash
successfully. Add configs to enable MUX_MMIO in SPL stage.

Signed-off-by: Anurag Dutta <a-dutta@ti.com>
2 months agoconfigs: j7200_evm_a72_defconfig: Enable MUX_MMIO at SPL
Anurag Dutta [Thu, 20 Mar 2025 06:30:03 +0000 (12:00 +0530)]
configs: j7200_evm_a72_defconfig: Enable MUX_MMIO at SPL

MUX_MMIO is required in SPL stage in order to boot hyperflash
successfully. Add configs to enable MUX_MMIO in SPL stage.

Signed-off-by: Anurag Dutta <a-dutta@ti.com>
2 months agomux: Kconfig: Add Kconfig options for MUX_MMIO
Anurag Dutta [Thu, 20 Mar 2025 06:30:02 +0000 (12:00 +0530)]
mux: Kconfig: Add Kconfig options for MUX_MMIO

Add Kconfig options for MUX_MMIO so that it can be enabled
in SPL stage.

Signed-off-by: Anurag Dutta <a-dutta@ti.com>
2 months agoMerge patch series "64-bit U-Boot configuration without SPL"
Tom Rini [Fri, 4 Apr 2025 18:26:50 +0000 (12:26 -0600)]
Merge patch series "64-bit U-Boot configuration without SPL"

Jeremy Compostella <jeremy.compostella@intel.com> says:

Introduces a new configuration option X86_RUN_64BIT_NO_SPL to allow
building U-Boot as a 64-bit binary without using the SPL (Secondary
Program Loader). The motivation is to simplify the boot process for
specific x86-based platforms that do not require SPL, such as those
booting directly from a 64-bit coreboot firmware.

Link: https://lore.kernel.org/r/87bjtyutkp.fsf@jcompost-mobl.amr.corp.intel.com
2 months agoconfigs: Add coreboot64-no-spl_defconfig for 64-bit X86 without SPL
Jeremy Compostella [Tue, 18 Mar 2025 17:42:06 +0000 (10:42 -0700)]
configs: Add coreboot64-no-spl_defconfig for 64-bit X86 without SPL

Create a new defconfig file called `coreboot64-no-spl_defconfig`,
tailored specifically for 64-bit X86 architecture systems that operate
without the Secondary Program Loader (SPL). This configuration takes its
inspiration from `coreboot64_defconfig`..

Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 months agoFix EFI boot file name definition for 64-bit x86
Jeremy Compostella [Tue, 18 Mar 2025 17:41:38 +0000 (10:41 -0700)]
Fix EFI boot file name definition for 64-bit x86

This change aligns the preprocessor directive with the standard
configuration flag used for detecting 64-bit x86 architecture.

Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 months agoarch/x86/lib: Fix CONFIG_X86_64 usage in zimage.c
Jeremy Compostella [Tue, 18 Mar 2025 17:40:34 +0000 (10:40 -0700)]
arch/x86/lib: Fix CONFIG_X86_64 usage in zimage.c

Correct the preprocessor directive used to check for 64-bit kernel
support in the `zboot_go` function. The code previously checked for
`CONFIG_X86_RUN_64BIT`, which is not the correct configuration option
for determining if the kernel should run in 64-bit mode. The correct
option is `CONFIG_X86_64`.

Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 months agoarch/x86/cpu: Call x86_cpu_reinit_f for 64-bits
Jeremy Compostella [Tue, 18 Mar 2025 17:40:03 +0000 (10:40 -0700)]
arch/x86/cpu: Call x86_cpu_reinit_f for 64-bits

As both CONFIG_X86_RUN_64BIT and X86_RUN_64BIT_NO_SPL cases run U-Boot
in 64-bit mode with the CPU fully initialized already.

Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 months agoarch/x86: Add 64-bit U-Boot configuration without SPL
Jeremy Compostella [Tue, 18 Mar 2025 17:39:40 +0000 (10:39 -0700)]
arch/x86: Add 64-bit U-Boot configuration without SPL

This commit introduces a new configuration option X86_RUN_64BIT_NO_SPL
to allow building U-Boot as a 64-bit binary without using the SPL
(Secondary Program Loader). The motivation is to simplify the boot
process for certain x86-based platforms that do not require SPL, such as
those booting directly from a 64-bit coreboot firmware.

This update revises the `X86_RUN_64BIT` configuration to more accurately
describe its role as "32-bit SPL followed by 64-bit U-Boot." It
clarifies the sequence of operations during the boot process, where the
system transitions from a 32-bit SPL (Secondary Program Loader) to the
main 64-bit U-Boot.

Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 months agoMerge patch series "cmd: fuse: Introduce fuse writebuff sub-system and clean up"
Tom Rini [Fri, 4 Apr 2025 18:25:11 +0000 (12:25 -0600)]
Merge patch series "cmd: fuse: Introduce fuse writebuff sub-system and clean up"

Harsha Vardhan V M <h-vm@ti.com> says:

This patch series introduces the fuse writebuff sub-system command and
makes improvements to the existing fuse implementation by removing the
custom string functions. The patches are required to be applied in
sequence.

The series consists of the following changes:
Patch 1 removes custom string functions and replaces them with standard
string functions.
Patch 2 introduces fuse.rst documentation for fuse commands.
Patch 3 introduces the fuse writebuff sub-system command, allowing to
write a structured buffer in memory to fuses, and implementing the
necessary function calls.
Patch 4 enables the fuse sub-system in the K3 platform.
Patch 5 updates the fuse.rst documentation to include details about the
new fuse writebuff command.

These changes aim to improve the fuse sub-system by the removal of
custom string functions and the addition of the fuse writebuff
command improves fuse programming workflows by allowing to write a
structured buffer in memory to efuses.

Link: https://lore.kernel.org/r/20250319084714.335777-1-h-vm@ti.com
2 months agodoc: cmd: Add fuse writebuff cmd documentation
Harsha Vardhan V M [Wed, 19 Mar 2025 08:47:14 +0000 (14:17 +0530)]
doc: cmd: Add fuse writebuff cmd documentation

Add fuse writebuff sub-system command documentation.

Signed-off-by: Harsha Vardhan V M <h-vm@ti.com>
2 months agodrivers: k3_fuse: Add fuse sub-system func calls
Harsha Vardhan V M [Wed, 19 Mar 2025 08:47:13 +0000 (14:17 +0530)]
drivers: k3_fuse: Add fuse sub-system func calls

Add K3_FUSE config option to add and enable fuse sub-system
implementation function calls.

Signed-off-by: Harsha Vardhan V M <h-vm@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 months agocmd: fuse: Add fuse writebuff sub-system command
Harsha Vardhan V M [Wed, 19 Mar 2025 08:47:12 +0000 (14:17 +0530)]
cmd: fuse: Add fuse writebuff sub-system command

Add CMD_FUSE_WRITEBUFF config option to add and enable fuse writebuff
sub-system command. Add fuse_writebuff function to be invoked on
writebuff command.

Signed-off-by: Harsha Vardhan V M <h-vm@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 months agodoc: cmd: Add documentation for fuse command
Harsha Vardhan V M [Wed, 19 Mar 2025 08:47:11 +0000 (14:17 +0530)]
doc: cmd: Add documentation for fuse command

Add documentation for the 'fuse' sub-system commands in
doc/usage/cmd/fuse.rst file.
Remove doc/README.fuse file.

Signed-off-by: Harsha Vardhan V M <h-vm@ti.com>
2 months agocmd: fuse: Remove custom string functions
Harsha Vardhan V M [Wed, 19 Mar 2025 08:47:10 +0000 (14:17 +0530)]
cmd: fuse: Remove custom string functions

Remove custom string functions and replace them with normal string
functions. Remove the custom strtou32 and replace it with
simple_strtoul.

Signed-off-by: Harsha Vardhan V M <h-vm@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 months agoarm64: Fix page permissions for platforms running at EL2
Ilias Apalodimas [Wed, 19 Mar 2025 07:22:02 +0000 (09:22 +0200)]
arm64: Fix page permissions for platforms running at EL2

We currently set both and print both PXN and UXN bits when removing
execution for pages. This happens even in the existing per platform
definitions of 'struct mm_region'.

That's not entirely correct though. For stage-1 translations, if a
platform runs on a translation regime with a single privilege level or the
the translation regime supports two privilege levels and we are not
in EL1&0 with HCR_EL2.{NV, NV1} = {1, 1} only BIT54 (XN) is needed
and BIT53(PXN) is reserved 0.

Currently we support Non-Secure EL2, Non-secure EL2&0 and Non-secure
EL1&0.

We already have get_effective_el() which returns 1 if we are
- Running in EL1 so we assume an EL1 translation regime but without
  checking HCR_EL2.{NV, NV1} != {1,1}
- Running in EL2 with HCR_EL2.E2H = 1

The only problem with the above is that if we are in EL1&0 and
HCR_EL2.{NV1, NV} == {1, 1}, then
- Bit[54] holds the PXN instead of the UXN
- The Effective value of UXN is 0
- Bit[53] is RES0

So let's re-use that function and set PXN only when we are in
and EL[2|1]&0 translation regime.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agoMerge tag 'u-boot-amlogic-20250404' of https://source.denx.de/u-boot/custodians/u...
Tom Rini [Fri, 4 Apr 2025 15:02:37 +0000 (09:02 -0600)]
Merge tag 'u-boot-amlogic-20250404' of https://source.denx.de/u-boot/custodians/u-boot-amlogic

- Check interface before comparing it in set_dfu_alt_info() to avoid
  hard crash on capsule update

2 months agoboard: libre-computer: check interface before comparing it in set_dfu_alt_info()
Neil Armstrong [Thu, 3 Apr 2025 16:03:21 +0000 (18:03 +0200)]
board: libre-computer: check interface before comparing it in set_dfu_alt_info()

When set_dfu_alt_info() is called, interface can be NULL when called for
the EFI capsule, so check it before calling it with strcmp().

Fixes: 12ea40d29dc ("ARM: meson: add support for Libre Computer aml-s905d3-cc")
Fixes: 9e6e6b034b1 ("ARM: meson: add support for Libre Computer aml-a311d-cc")
Fixes: 75c87c6cbc0 ("board: libre-computer: aml-s805x-cc: Enable capsule updates")
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Link: https://lore.kernel.org/r/20250403-u-boot-fix-set-dfu-alt-info-interface-v1-1-1fdd12463186@linaro.org
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2 months agoMerge patch series "membuff: Add tests and update to support a flag for empty/full"
Tom Rini [Thu, 3 Apr 2025 22:54:59 +0000 (16:54 -0600)]
Merge patch series "membuff: Add tests and update to support a flag for empty/full"

Simon Glass <sjg@chromium.org> says:

The membuff implementation curently has no tests. It also assumes that
head and tail can never correspond unless the buffer is empty.

This series provides a compile-time flag to support a 'full' flag. It
also adds some tests of the main routines.

The data structure is also renamed to membuf which fits better with
U-Boot.

There may be some cases in the code which could be optimised a little,
but the implementation is functional.

Link: https://lore.kernel.org/r/20250318152059.1464369-1-sjg@chromium.org
2 months agomembuf: Minor code-style improvements
Simon Glass [Tue, 18 Mar 2025 15:20:48 +0000 (16:20 +0100)]
membuf: Minor code-style improvements

Show the start in end in the comment. Comment a missing variable in
membuf_readline() and fix its line length.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agomembuf: Add some tests
Simon Glass [Tue, 18 Mar 2025 15:20:47 +0000 (16:20 +0100)]
membuf: Add some tests

Add tests for the membuf implementation.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agomembuf: Correct implementation of membuf_dispose()
Simon Glass [Tue, 18 Mar 2025 15:20:46 +0000 (16:20 +0100)]
membuf: Correct implementation of membuf_dispose()

This should free the pointer, not the address of the pointer. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agomembuf: Include stdbool
Simon Glass [Tue, 18 Mar 2025 15:20:45 +0000 (16:20 +0100)]
membuf: Include stdbool

This uses a bool type so include the required header.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agomembuf: Rename struct
Simon Glass [Tue, 18 Mar 2025 15:20:44 +0000 (16:20 +0100)]
membuf: Rename struct

Rename the struct to match the function prefix and filenames.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agomembuff: Rename the files to membuf
Simon Glass [Tue, 18 Mar 2025 15:20:43 +0000 (16:20 +0100)]
membuff: Rename the files to membuf

Rename the C and header files to use the membuf basename, to match the
functions.

Add a MAINTAINERS entry while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agomembuff: Rename functions to have membuf_ prefix
Simon Glass [Tue, 18 Mar 2025 15:20:42 +0000 (16:20 +0100)]
membuff: Rename functions to have membuf_ prefix

The double 'f' is not necessary and is a bit annoying as elsewhere in
U-Boot we use 'buf'. Rename all the functions before it is used more
widely.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agoMerge patch series "x86: Improve operation under QEMU"
Tom Rini [Thu, 3 Apr 2025 17:43:38 +0000 (11:43 -0600)]
Merge patch series "x86: Improve operation under QEMU"

Simon Glass <sjg@chromium.org> says:

U-Boot can start and boot an OS in both qemu-x86 and qemu-x86_64 but it
is not perfect.

With both builds, executing the VESA ROM causes an intermittent hang, at
least on some AMD CPUs.

With qemu-x86_64 kvm cannot be used since the move to long mode (64-bit)
is done in a way that works on real hardware but not with QEMU. This
means that performance is 4-5x slower than it could be, at least on my
CPU.

We can work around the first problem by using Bochs, which is anyway a
better choice than VESA for QEMU. The second can be addressed by using
the same descriptor across the jump to long mode.

With an MTRR fix this allows booting into Ubuntu on qemu-x86_64

In v3 some e820 patches are included to make booting reliable and avoid
ACPI tables being dropped. Also, several MTTR problems are addressed, to
support memory sizes above 4GB reliably.

Link: https://lore.kernel.org/all/20250315142643.2600605-1-sjg@chromium.org/
2 months agotest: Add a test for booting Ubuntu 24.04
Simon Glass [Sat, 15 Mar 2025 14:26:06 +0000 (14:26 +0000)]
test: Add a test for booting Ubuntu 24.04

Now that U-Boot can boot this quickly, using kvm, add a test that the
installer starts up correctly.

Use the qemu-x86_64 board in the SJG lab.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agoacpi: Support checking checksums
Simon Glass [Sat, 15 Mar 2025 14:26:05 +0000 (14:26 +0000)]
acpi: Support checking checksums

When the ACPI tables come from an earlier bootloader it is helpful to
see whether the checksums are correct or not. Add a -c flag to the
'acpi list' command to support that.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agotest: acpi: Correct memory leaks
Simon Glass [Sat, 15 Mar 2025 14:26:04 +0000 (14:26 +0000)]
test: acpi: Correct memory leaks

Free the memory used in tests to avoid a leak. Also unmap the addresses
for sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2 months agoacpi: Add a checksum to the DMAR table
Simon Glass [Sat, 15 Mar 2025 14:26:03 +0000 (14:26 +0000)]
acpi: Add a checksum to the DMAR table

This table lacks a correct checksum at present, so fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2 months agosandbox: acpi: Correct mapping in FADT
Simon Glass [Sat, 15 Mar 2025 14:26:02 +0000 (14:26 +0000)]
sandbox: acpi: Correct mapping in FADT

The values in the FADT are pointers so should not go through sandbox's
normal addr<->pointer mapping. Fix this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agosandbox: acpi: Avoid a warning about FADT
Simon Glass [Sat, 15 Mar 2025 14:26:01 +0000 (14:26 +0000)]
sandbox: acpi: Avoid a warning about FADT

Add a condition for sandbox, to match that of x86, to avoid the warning
"FADT not ACPI-hardware-reduced-compliant".

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agoboot: Support IO UARTs for earlycon and console
Simon Glass [Sat, 15 Mar 2025 14:26:00 +0000 (14:26 +0000)]
boot: Support IO UARTs for earlycon and console

Update the string to take account of UARTs which are connected on I/O
ports, as on x86.

Fix a typo in an error message in the same command, while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agoboot: Handle running out of labels
Simon Glass [Sat, 15 Mar 2025 14:25:59 +0000 (14:25 +0000)]
boot: Handle running out of labels

If only a single label is provided in the list, bootdev_next_label()
does not operate correctly and reads beyond the end of the pointer list.

Fix this by adding a new check. Also add a note to convert this array
to an alist

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agoboot: Consider non-bootable partitions
Simon Glass [Sat, 15 Mar 2025 14:25:58 +0000 (14:25 +0000)]
boot: Consider non-bootable partitions

Any 'bootable' flag in a DOS partition causes boostd to only scan
bootable partitions for that media. This can mean that extlinux.conf
files on the root disk are missed.

Put this logic behind a flag and update the documentation.

For now, the flag is enabled, to preserve the existing behaviour of
bootstd which is to ignore non-bootable partitions so long as there is
at least one bootable partition on the disk.  Future work may provide a
command (or some other mechanism) to control this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agoacpi: Mark struct acpi_rsdp as packed
Simon Glass [Sat, 15 Mar 2025 14:25:57 +0000 (14:25 +0000)]
acpi: Mark struct acpi_rsdp as packed

At present the size of this struct is too large on 64-bit machines.
Annotate it with __packed to fix this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agox86: Support a 64-bit ramdisk address
Simon Glass [Sat, 15 Mar 2025 14:25:56 +0000 (14:25 +0000)]
x86: Support a 64-bit ramdisk address

Add some missing pieces to bootparams so that a 64-bit ramdisk address
can be used. Tidy up the logging while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agox86: emulation: Support BLOBLIST_TABLES properly
Simon Glass [Sat, 15 Mar 2025 14:25:55 +0000 (14:25 +0000)]
x86: emulation: Support BLOBLIST_TABLES properly

The existing QEMU implementation mostly ignored BLOBLIST_TABLES and
allocates the bulk of the tables with malloc(). Update it to place all
tables in the bloblist. Since QEMU declares a size of 128KB regardless
of the size of its tables, this requires a larger bloblist.

Fix up the e820 table to handle this, keeping the old code as an option
for now, to assist with any future bug-fixing.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agox86: qemu: Use the new e820 API
Simon Glass [Sat, 15 Mar 2025 14:25:54 +0000 (14:25 +0000)]
x86: qemu: Use the new e820 API

Move over to use this API before making the code even more complicated.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agox86: Add a new API for e820
Simon Glass [Sat, 15 Mar 2025 14:25:53 +0000 (14:25 +0000)]
x86: Add a new API for e820

The existing mechanism is pretty painful as it requires manual
calculations for anything but a trivial setup.

Add a new API for adding e820 entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agox86: e820: Add a function to dump the e820 table
Simon Glass [Sat, 15 Mar 2025 14:25:52 +0000 (14:25 +0000)]
x86: e820: Add a function to dump the e820 table

There is already code for this in zimage. Move it to the e820 file so
it can be used elsewhere.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agotest/py: Allow tests to be filtered by role
Simon Glass [Sat, 15 Mar 2025 14:25:51 +0000 (14:25 +0000)]
test/py: Allow tests to be filtered by role

Some test can only be run by a particular board in a lab, e.g. because
they are loaded with an OS image used by the test. Add a way to specify
this in tests.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agotest/py: Add a helper to send characters
Simon Glass [Sat, 15 Mar 2025 14:25:50 +0000 (14:25 +0000)]
test/py: Add a helper to send characters

The existing run_command() method is not great for sending things other
than U-Boot commands. Add a helper for sending arbitrary strings as well
as control characters.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 months agotest/py: Correct sizing of created disks
Simon Glass [Sat, 15 Mar 2025 14:25:49 +0000 (14:25 +0000)]
test/py: Correct sizing of created disks

At present the disks end up being 1MB shorter than they should be,
since dd truncates by default.

Move the code into a function and update it to avoid truncation.

This resolves various warnings when running sandbox tests, of the form:

   mmc_bread() MMC: block number 0x9801 exceeds max(0x9800)

caused by the FAT partition being scanning.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agox86: qemu: Support environment and cat command
Simon Glass [Sat, 15 Mar 2025 14:25:48 +0000 (14:25 +0000)]
x86: qemu: Support environment and cat command

Add support for an environment stored in the first partition of the
disk, which is assumed to hold a FAT filesystem.

Support the 'cat' command as it is useful for looking at extlinux.conf
files.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agox86: emulation: Set an MTRR for the RAM
Simon Glass [Sat, 15 Mar 2025 14:25:47 +0000 (14:25 +0000)]
x86: emulation: Set an MTRR for the RAM

QEMU likes to have an MTRR set up, just like real machines. Add an MTRR
which covers the total RAM size.

This does nothing on machines without MTRRs.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agox86: Allow adding non-aligned size for MTRR
Simon Glass [Sat, 15 Mar 2025 14:25:46 +0000 (14:25 +0000)]
x86: Allow adding non-aligned size for MTRR

At present mtrr_add_request() requires that the size is a power of two.
This is too limiting for machines with 4GB (or more) of RAM, since they
often must take account of a memory hole at 3GB.

Update the function to automatically deal with an unaligned size, using
more MTRRs as required.

The algorithm is taken from coreboot commit 60bce10750

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agox86: Correct msr operation on amd64
Simon Glass [Sat, 15 Mar 2025 14:25:45 +0000 (14:25 +0000)]
x86: Correct msr operation on amd64

The CONFIG option is no-longer correct since we can have SPL and PPL
with different bitness.

Fix this and sync up with Linux 6.13 in this area, since this is where
the code came from many years ago.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agox86: Update cpuid_eax et al to work on amd64
Simon Glass [Sat, 15 Mar 2025 14:25:44 +0000 (14:25 +0000)]
x86: Update cpuid_eax et al to work on amd64

The existing functions work but the register clobbers are wrong, so
strange bugs results.

The original functions were taken from a very old version of Linux.
Update them from Linux 6.13

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agox86: Update mtrr command to support 64-bit values
Simon Glass [Sat, 15 Mar 2025 14:25:43 +0000 (14:25 +0000)]
x86: Update mtrr command to support 64-bit values

The MTRR registers have 64-bit values. Update the command to use 64-bit
values so that memory larger than 4GB can be handled.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agox86: Add functions to convert between mtrr size and mask
Simon Glass [Sat, 15 Mar 2025 14:25:42 +0000 (14:25 +0000)]
x86: Add functions to convert between mtrr size and mask

Rather than repeating the same code in several places, add some
functions which can do the conversion.

Use the cpu_phys_address_size() function to obtain the physical-address
size, since it is more reliable with kvm, where the host CPU may have a
different value from the emulation CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agox86: Support CPU functions in long mode
Simon Glass [Sat, 15 Mar 2025 14:25:41 +0000 (14:25 +0000)]
x86: Support CPU functions in long mode

At present it is not possible to find out the physical-address size in
long mode, so a predefined value is used.

Update the macros to support this properly, since it is important when
programming MTRRs.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agox86: Rename the _D dirty flag
Simon Glass [Sat, 15 Mar 2025 14:25:40 +0000 (14:25 +0000)]
x86: Rename the _D dirty flag

This value happens to be used by ctype.h so chose a different name.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agox86: Use a simple jump into long mode
Simon Glass [Sat, 15 Mar 2025 14:25:39 +0000 (14:25 +0000)]
x86: Use a simple jump into long mode

With the 64-bit descriptor we can use a jump instruction, rather than
pushing things on the stack.

Since the processor is in 64-bit mode by this point, pop a 64-bit value
from the stack, containing the target address.

This simplifies the code slightly, in particular its use of the stack.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agox86: Use the same GDT when jumping to long mode
Simon Glass [Sat, 15 Mar 2025 14:25:38 +0000 (14:25 +0000)]
x86: Use the same GDT when jumping to long mode

Make use the existing GDT which now includes entries for 64-bit code.
Leave the interrupt descriptors alone. They can be tidied up once U-Boot
starts up.

With this, kvm mode works with QEMU.

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

2 months agox86: Disable paging before changing to long mode
Simon Glass [Sat, 15 Mar 2025 14:25:37 +0000 (14:25 +0000)]
x86: Disable paging before changing to long mode

This is required as part of the procedure. The existing code works
because it changes the GDT at the same time, but this makes kvm
unhappy.

Update the algorithm to disable and then re-enable paging.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agox86: Tidy up the GDT size in start/16.S
Simon Glass [Sat, 15 Mar 2025 14:25:36 +0000 (14:25 +0000)]
x86: Tidy up the GDT size in start/16.S

Use a symbol to select the size of the GDT, rather than hard-coding a
value. This matches how it is done in start64

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agox86: Include stdbool.h in interrupt header
Simon Glass [Sat, 15 Mar 2025 14:25:35 +0000 (14:25 +0000)]
x86: Include stdbool.h in interrupt header

This makes use of a 'bool' type, so include the required header.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agox86: Drop the message about features missing in 64-bit
Simon Glass [Sat, 15 Mar 2025 14:25:34 +0000 (14:25 +0000)]
x86: Drop the message about features missing in 64-bit

This functions normally and has done for a while, so drop this scary
message.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agox86: spl: Drop duplicate CPU init
Simon Glass [Sat, 15 Mar 2025 14:25:33 +0000 (14:25 +0000)]
x86: spl: Drop duplicate CPU init

x86_cpu_init_f() is called by arch_cpu_init() a few lines below this
code. Drop the duplicate call.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agox86: Use defines for the cache flags
Simon Glass [Sat, 15 Mar 2025 14:25:32 +0000 (14:25 +0000)]
x86: Use defines for the cache flags

Use some named flags when setting up the cache, so it is easier to see
what is going on.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agox86: Add 64-bit entries to the GDT
Simon Glass [Sat, 15 Mar 2025 14:25:31 +0000 (14:25 +0000)]
x86: Add 64-bit entries to the GDT

At present it is not possible to execution 64-bit code without
installing an entire new Global Descriptor Table. This is inconvenient
since kvm does not seem to like switching into long mode with a new
table.

It isn't actually necessary, since we can just extend the existing
table. Add some new entries to this effect.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agox86: Avoid clearing the VESA display
Simon Glass [Sat, 15 Mar 2025 14:25:30 +0000 (14:25 +0000)]
x86: Avoid clearing the VESA display

U-Boot clears the display when it starts up, so there is no need to ask
the VESA driver to do this. Fix this and add a comment explaining the
flags.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agox86: Drop use of CONFIG_REALMODE_DEBUG
Simon Glass [Sat, 15 Mar 2025 14:25:29 +0000 (14:25 +0000)]
x86: Drop use of CONFIG_REALMODE_DEBUG

This option is not actually defined in Kconfig anymore. Use a normal
debug print instead, which has a similar effect.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 months agox86: Add some log categories
Simon Glass [Sat, 15 Mar 2025 14:25:28 +0000 (14:25 +0000)]
x86: Add some log categories

Add categories for i8259 and bios files, so that log statements have the
right category.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agox86: Drop mpspec from the SPL build
Simon Glass [Sat, 15 Mar 2025 14:25:27 +0000 (14:25 +0000)]
x86: Drop mpspec from the SPL build

This is not needed in SPL, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agox86: qemu: Avoid accessing BSS too early
Simon Glass [Sat, 15 Mar 2025 14:25:26 +0000 (14:25 +0000)]
x86: qemu: Avoid accessing BSS too early

BSS is placed in DRAM which is actually available early with QEMU. But
it is cleared by the init sequence, so values stored there are lost.

Move the system-type flag into a function, instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agox86: qemu: Enable dhrystone
Simon Glass [Sat, 15 Mar 2025 14:25:25 +0000 (14:25 +0000)]
x86: qemu: Enable dhrystone

Provide the 'dhry' command, which helps to check that kvm is being used
properly with QEMU.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agox86: qemu: Switch to bochs display
Simon Glass [Sat, 15 Mar 2025 14:25:24 +0000 (14:25 +0000)]
x86: qemu: Switch to bochs display

The vesa display is widely used on hardware, but it is a bit of a pain
with QEMU. It requires executing option ROMs, which either doesn't work
with kvm, or is difficult to do in a kvm/QEMU-friendly way.

THe bochs display is probably better anyway, so switch to that. It works
fine with kvm as it doesn't need an option ROM.

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

2 months agox86: Expand x86_64 early memory
Simon Glass [Sat, 15 Mar 2025 14:25:23 +0000 (14:25 +0000)]
x86: Expand x86_64 early memory

The SPL and pre-reloc malloc()-space is not large enough to start up
with a display. Expand it.

Switch the order of SPL_SYS_MALLOC_F_LEN and SPL_TEXT_BASE since this
matches what 'savedefconfig' gives us.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agosandbox: Correct a typo in mapmem
Simon Glass [Sat, 15 Mar 2025 14:25:22 +0000 (14:25 +0000)]
sandbox: Correct a typo in mapmem

This should say 'cast', not 'case', so fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>