Commit graph

89955 commits

Author SHA1 Message Date
Hector Martin
75aabe595f usb: storage: Use the correct CBW lengths
USB UFI uses fixed 12-byte commands (as does RBC, which is not
supported), but SCSI does not have this limitation. Use the correct
command block lengths depending on the subclass.

Signed-off-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Marek Vasut <marex@denx.de>
2023-12-01 14:06:12 +01:00
Hector Martin
b5999f8f6c usb: hub: Add missing reset recovery delay
Some devices like YubiKeys need more time before SET_ADDRESS. The spec
says we need to wait 10ms.

Signed-off-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Marek Vasut <marex@denx.de>
2023-12-01 14:06:12 +01:00
Hector Martin
a14843fdac usb: xhci: Fix DMA address calculation in queue_trb
We need to get the DMA address before incrementing the pointer, as that
might move us onto another segment.

Signed-off-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Marek Vasut <marex@denx.de>
2023-12-01 14:06:04 +01:00
Hector Martin
2fd7037122 usb: xhci: Do not panic on event timeouts
Now that we always check the return value, just return NULL on timeouts.
We can still log the error since this is a problem, but it's not reason
to panic.

Signed-off-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Marek Vasut <marex@denx.de>
2023-12-01 14:06:04 +01:00
Hector Martin
fb5502be25 usb: xhci: Fail on attempt to queue TRBs to a halted endpoint
This isn't going to work, don't pretend it will and then end up timing
out.

Signed-off-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Marek Vasut <marex@denx.de>
2023-12-01 14:06:04 +01:00
Hector Martin
9d88bd4dcf usb: xhci: Recover from halted bulk endpoints
There is currently no codepath to recover from this case. In principle
we could require that the upper layer do this explicitly, but let's just
do it in xHCI when the next bulk transfer is started, since that
reasonably implies whatever caused the problem has been dealt with.

Signed-off-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Marek Vasut <marex@denx.de>
2023-12-01 14:06:04 +01:00
Hector Martin
6f64f0ae23 usb: xhci: Allow context state errors when halting an endpoint
There is a race where an endpoint may halt by itself while we are trying
to halt it, which results in a context state error. See xHCI 4.6.9 which
mentions this case.

This also avoids BUGging when we attempt to stop an endpoint which was
already stopped to begin with, which is probably a bug elsewhere but
not a good reason to crash.

Signed-off-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Marek Vasut <marex@denx.de>
2023-12-01 14:06:04 +01:00
Hector Martin
2526cd9932 usb: xhci: Better error handling in abort_td()
If the xHC has a problem with our STOP ENDPOINT command, it is likely to
return a completion directly instead of first a transfer event for the
in-progress transfer. Handle that more gracefully.

We still BUG() on the error code, but at least we don't end up timing
out on the event and ending up with unexpected event errors.

Signed-off-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Marek Vasut <marex@denx.de>
2023-12-01 14:06:04 +01:00
Hector Martin
8d1e03f984 usb: xhci: Guard all calls to xhci_wait_for_event
xhci_wait_for_event returns NULL on timeout, so the caller always has to
check for that. This addresses immediate explosions in this part
of the code when timeouts happen, but not the root cause for the
timeout.

Signed-off-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Marek Vasut <marex@denx.de>
2023-12-01 14:06:04 +01:00
Svyatoslav Ryhel
43f2873fa9 MAINTAINERS: Step up as co-maintainer of Tegra SOC platform
Update maintainers for Tegra SoC platform. Include device trees
and drivers which contain tegra in the name.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
2023-11-28 11:23:02 -05:00
Tom Rini
b2bf18d5e5 Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-samsung 2023-11-28 10:05:25 -05:00
Philip Oberfichtner
acae7eb5fe i2c: Bugfix in i2c_get_chip_by_phandle()
The "i2cbcdev" sneaked in when implementing this function for the
bootcounter use case. Obviously the intention was to use prop_name
instead.

Fixes: b483552773 (i2c: Implement i2c_get_chip_by_phandle())

Signed-off-by: Philip Oberfichtner <pro@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>
2023-11-27 18:54:56 -05:00
Sam Protsenko
470682ace1 configs: Remove unneeded SYS_CONFIG_NAME from a*y17lte defconfigs
As correct default SYS_CONFIG_NAME value is now set in
board/samsung/axy17lte/Kconfig (in commit "board: samsung: Fix
SYS_CONFIG_NAME configs in axy17lte Kconfig"), the SYS_CONFIG_NAME
option can be safely removed from all a*y17lte defconfigs. That removal
doesn't change resulting .config files.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2023-11-27 18:57:35 +09:00
Sam Protsenko
6219b47c4d board: samsung: Fix SYS_CONFIG_NAME configs in axy17lte Kconfig
There is a couple of issues related to SYS_CONFIG_NAME config in
axy17lte Kconfig.

1. The global SYS_CONFIG_NAME in axy17lte Kconfig overrides
   SYS_CONFIG_NAME for all boards specified after this line in
   arch/arm/mach-exynos/Kconfig:

       source "board/samsung/axy17lte/Kconfig"

   Right now it's the last 'source' line there, so the issue is not
   reproducible. But once some board is moved or added after this line
   the next build error will happen:

       GEN     include/autoconf.mk.dep
     In file included from ./include/common.h:16:
     include/config.h:3:10: fatal error: configs/exynos78x0-common.h.h:
                            No such file or directory
         3 | #include <configs/exynos78x0-common.h.h>
           |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     compilation terminated.

   That's happening because axy17lte Kconfig defines SYS_CONFIG_NAME
   option in global namespace (not guarded with any "if TARGET_..."), so
   it basically rewrites the correct SYS_CONFIG_NAME defined in the
   hypothetical boards which might appear after axy17lte in mach-exynos
   Kconfig.

2. Another side of the issue is that SYS_CONFIG_NAME is defined
   incorrectly in axy17lte Kconfig:

       config SYS_CONFIG_NAME
           default "exynos78x0-common.h"

   The .h extension should not have been specified there. It's leading
   to a build error, as the generated include file has a double '.h'
   extension.

3. Each target in axy17lte/Kconfig defines its own SYS_CONFIG_NAME. But
   all of those in fact incorrect, as corresponding
   include/configs/<CONFIG_SYS_CONFIG_NAME>.h header files don't exist.

4. The global SYS_CONFIG_NAME pretty much repeats the help description
   from arch/Kconfig and doc/README.kconfig.

Corresponding defconfig files (a*y17lte_defconfig) fix above issues by
overriding SYS_CONFIG_NAME and correctly setting it to
"exynos78x0-common".

Fix all mentioned issues by removing the incorrect global
SYS_CONFIG_NAME and instead specifying it (correctly) in SYS_CONFIG_NAME
options for each target instead.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Fixes: 3e2095e960 ("board: samsung: add support for Galaxy A series of 2017 (a5y17lte)")
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2023-11-27 18:57:35 +09:00
Sam Protsenko
33e7ca5a9b serial: s5p: Use dev_read_addr_ptr() to get base address
As the address read from device tree is being cast to a pointer, it's
better to use dev_read_addr_ptr() API for getting that address. The more
detailed explanation can be found in commit a12a73b664 ("drivers: use
dev_read_addr_ptr when cast to pointer").

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2023-11-27 18:04:11 +09:00
Tom Rini
1fcf078f54 Merge tag 'u-boot-dfu-20231124' of https://source.denx.de/u-boot/custodians/u-boot-dfu
u-boot-dfu-20231124

- Fix reinit for ChipIdea controller
- Add missing newline in fastboot error handling
2023-11-25 17:38:43 -05:00
Sam Protsenko
a627f2802a serial: s5p: Improve coding style
Just some minor style fixes. No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2023-11-23 15:24:18 +09:00
Sam Protsenko
e79f630dbf serial: s5p: Use named constants for register values
Get rid of magic numbers in s5p_serial_init() when writing to UART
registers. While at it, use BIT() macro for existing constants when
appropriate.

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2023-11-23 15:24:18 +09:00
Sam Protsenko
5ad21de6ba serial: s5p: Use livetree API to get "id" property
Use dev_read_u8_default() instead of fdtdec_get_int() to read the "id"
property from device tree, as suggested in [1]. dev_* API is already
used in this driver, so there is no reason to stick to fdtdec_* API.
This also fixes checkpatch warning:

    WARNING: Use the livetree API (dev_read_...)

[1] doc/develop/driver-model/livetree.rst

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2023-11-23 15:24:18 +09:00
Sam Protsenko
a0615ffc99 serial: s5p: Remove common.h inclusion
It's not really needed here anymore. Remove it, as common.h is going
away at some point.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2023-11-23 15:24:18 +09:00
Tom Rini
9e53e45292 Pull request efi-2024-01-rc4
Documentation
 
 * Add HiSilicon board documentation to HTML docs
 * Fix building with Sphinx 6.0
 
 UEFI
 
 * Increase default variable store size to 128K
 * Check return value of efi_append_scrtm version
 * Create shortened boot options in eficonfig command
 
 Other
 
 * Avoid incorrect error message in mkimage
 -----BEGIN PGP SIGNATURE-----
 
 iQJWBAABCABAFiEEK7wKXt3/btL6/yA+hO4vgnE3U0sFAmVboTQiHGhlaW5yaWNo
 LnNjaHVjaGFyZHRAY2Fub25pY2FsLmNvbQAKCRCE7i+CcTdTS+kxD/4hA6vqXYaJ
 WosHmnq/gnBNSrhmdY/t7U++CDAzDw7DO8qDUMDb0LeeJAfxWJyNnmrE/kGV7qEr
 1vV8AJMHdQdCt4khcV53UOjiGpXFYhSUUVEsxh7k1TrGLc0ZQpFrEdVvoF40YA3R
 vjzgdHpF+dtFnxmqcNovcfbdSmv2BP1RLwxOEUKqK1maAf1Qk77s2UgOpROzhaRF
 TTsNq2/tt0oMqH9I99EiHX63225CQy/v5YktLLfcmdY3KprpNZEdwa+XoveUSpf+
 6PZQuNXOdgqIOgHcl6TG/E2tzkip2U61AVDXSUbXSoDDoeohWNlE4u5yhLrI4X05
 9/gVGb/YpKheHV4qGTrntFyWMNGhobLsg/bSDUlJdUpTXbSetZm3E7hWQ0mIkvwP
 a1iNSlPAdgRemEuYA9MJqAKbgZnFqS1Bue086nWrcQj1Ie9U1vMhwXbizJwwVHz3
 4ys2c4tvaG6KpuJuNASxk4eEQaBo/xajDrf7ydIRdukILfx4IW9y8yTwUtAlNU8V
 wl59zMOz3H0qVJuNPio5LyYBRtcAkA1qomR6GHRdb5PBy/+alQrhffuEQMgX0ms2
 yTfKbWFzMlL/38+PMmQvwfP+MHrUy2XBThHmU9rIq9aLD+LNDd9PoF1vqwHjpo9v
 KMw5l4ZIStdkNuo1Tx6+hCNeibN4jcHlIg==
 =gw5U
 -----END PGP SIGNATURE-----

Merge tag 'efi-2024-01-rc4' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request efi-2024-01-rc4

Documentation

* Add HiSilicon board documentation to HTML docs
* Fix building with Sphinx 6.0

UEFI

* Increase default variable store size to 128K
* Check return value of efi_append_scrtm version
* Create shortened boot options in eficonfig command

Other

* Avoid incorrect error message in mkimage
2023-11-21 09:10:15 -05:00
Simon Holesch
6f68dcd025 usb: fastboot: Add missing newline in pr_err
Add missing newline in pr_err.

Signed-off-by: Simon Holesch <simon@holesch.de>
Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Link: https://lore.kernel.org/r/20231120002024.32865-2-simon@holesch.de
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2023-11-21 09:19:48 +01:00
Simon Holesch
b272c87925 usb: ci: Fix gadget reinit
The ChipIdea device controller wasn't properly cleaned up when disabled.
So enabling it again left it in a broken state. The problem occurred for
example when the host unbinds the driver and binds it again.

During the first setup, when the out request is queued, the endpoint is
primed (`epprime`). If the endpoint is then disabled, it stayed primed
with the initial buffer. So after the endpoint is re-enabled, the device
controller and device driver were out of sync: the new out request was
in the driver queue head, yet not submitted, but the "complete" function
was still called, since the endpoint was primed with the old buffer.

With the fastboot function this error led to the (rather confusing)
error message "buffer overflow".

Fixed by clearing the primed buffers with the `epflush` (`ENDPTFLUSH`)
register.

Signed-off-by: Simon Holesch <simon@holesch.de>
Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Link: https://lore.kernel.org/r/20231120002024.32865-1-simon@holesch.de
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2023-11-21 09:19:48 +01:00
Heinrich Schuchardt
64658007f3 cmd: eficonfig: create shortened boot options
The boot options created by eficonfig should use shortened device-paths to
avoid problems if drives are enumerated in a different sequence.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2023-11-20 19:06:22 +01:00
Heinrich Schuchardt
ce68a25448 efi_loader: improve efi_var_from_file() description
It is unclear to developers why efi_var_from_file() returns EFI_SUCCESS if
file ubootefi.var is missing or corrupted. Improve the description.

Reported-by: Weizhao Ouyang <o451686892@gmail.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Weizhao Ouyang <o451686892@gmail.com>
2023-11-20 19:06:22 +01:00
Ilias Apalodimas
229f9e77fe efi_loader: Correctly account the SCRTM event creation
The result of efi_append_scrtm_version() is overwritten before anyone
checks its result. Check it and exit the function on failures

Addresses-Coverity-ID: 467399 Code maintainability issues (UNUSED_VALUE)
Fixes: commit 97707f12fd ("tpm: Support boot measurements")
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-11-20 19:06:22 +01:00
Ilias Apalodimas
a8062549d6 efi_loader: Increase default variable store size to 128K
In commit 9fd3f881c6 ("efi_loader: Increase default variable store size to 64KiB")
Alper has a detailed explanation of why the size needs to be bumped to at
least 64K.  However enabling Secure boot, writing db, KEK, PK etc keys
will further increase the size so bump it to 128K.

It's worth noting that when U-Boot stores the EFI variables in an RPMB the
available storage is defined statically in StandAloneMM at build time.
The U-Boot code is detecting the available true size on the fly during
writes. When StandAloneMM is present this size defines the reserved
memory U-Boot can use to copy any runtime variables, before booting an
OS.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-11-20 19:06:22 +01:00
Heinrich Schuchardt
9781ec9840 doc: typo fdtaddr_addr_r
%s/fdtaddr_addr_r/fdt_addr_r/

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-11-20 19:06:22 +01:00
Jonathan Corbet
dc23eb8e0e docs: Fix the docs build with Sphinx 6.0
Sphinx 6.0 removed the execfile_() function, which we use as part of the
configuration process.  They *did* warn us...  Just open-code the
functionality as is done in Sphinx itself.

Tested (using SPHINX_CONF, since this code is only executed with an
alternative config file) on various Sphinx versions from 2.5 through 6.0.

Reported-by: Martin Liška <mliska@suse.cz>
Cc: stable@vger.kernel.org
Signed-off-by: Jonathan Corbet <corbet@lwn.net>

Rebased for U-Boot
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-11-20 19:06:22 +01:00
Heinrich Schuchardt
63e41659f2 doc: add HiSilicon board documentation to HTML docs
Add the README files for the HiSilicon boards to the HTML documentation.
This required a bit of reformatting.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-11-20 19:06:22 +01:00
Heinrich Schuchardt
2b3b3511bd mkimage: do not write incorrect error message
When running 'mkimage -l' is called for a valid StarFive file an error
message "Error: invalid marker bytes" is written by the Renesas SPKG
driver.

mkimage -l may be invoked without specifying an image type. In this case
mkimage iterates over all image type drivers to find the one that matches.
None of the non-matching drivers should write an error message.

Fix the Renesas SPKG driver.

Fixes: afdfcb11f9 ("tools: spkgimage: add Renesas SPKG format")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-11-20 19:06:22 +01:00
Tom Rini
24ca49b33a Prepare v2024.01-rc3
Signed-off-by: Tom Rini <trini@konsulko.com>
2023-11-20 08:43:46 -05:00
Tom Rini
f629d50419 configs: Resync with savedefconfig
Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
2023-11-20 08:37:27 -05:00
Nikita Yushchenko
beeb91aa64 scsi: set dma direction to NONE for TEST UNIT READY
SCSI device scan code was executing TEST UNIT READY command without
explicitly setting dma direction in struct scsi_cmd to NONE, so command
was passed to driver with dma direction set to DMA_FROM_DEVICE,
inherited from older usage.

With WDC SDINDDH6-64G ufs device, that caused TEST UNIT READY to
return error.

Fix that, by explicitly setting dma direction to NONE for
TEST UNIT READY, and restoring it back DMA_FROM_DEVICE for the
following READ CAPACITY.

Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
Reviewed-by: Marek Vasut <marex@denx.de>
2023-11-20 08:34:08 -05:00
Tom Rini
d5ff806cb5 Merge branch 'master-mmc-clock' of https://source.denx.de/u-boot/custodians/u-boot-sh 2023-11-18 10:25:48 -05:00
Tom Rini
cc7bc8237a Merge branch '2023-11-17-assorted-important-fixes'
- Revert HAFDBS changes, correct spl_imx_romapi for eMMC, fix the virtio
  rng in one case, fix bootstd in one case, and correct a Kconfig
  description.
2023-11-17 13:15:33 -05:00
Chris Packham
0585c28fda Revert "arm64: Use FEAT_HAFDBS to track dirty pages when available"
This reverts commit 6cdf6b7a34. This is
part of a series trying to make use of the arm64 hardware features for
tracking dirty pages. Unfortunately this series causes problems for the
AC5/AC5X SoCs. Having exhausted other options the consensus seems to be
reverting this series is the best course of action.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
2023-11-17 11:58:26 -05:00
Chris Packham
eed8294b75 Revert "arm64: Use level-2 for largest block mappings when FEAT_HAFDBS is present"
This reverts commit 836b8d4b20. This is
part of a series trying to make use of the arm64 hardware features for
tracking dirty pages. Unfortunately this series causes problems for the
AC5/AC5X SoCs. Having exhausted other options the consensus seems to be
reverting this series is the best course of action.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
2023-11-17 11:58:26 -05:00
Chris Packham
ee23d7466c Revert "armv8: enable HAFDBS for other ELx when FEAT_HAFDBS is present"
This reverts commit c1da6fdb5c. This is
part of a series trying to make use of the arm64 hardware features for
tracking dirty pages. Unfortunately this series causes problems for the
AC5/AC5X SoCs. Having exhausted other options the consensus seems to be
reverting this series is the best course of action.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
2023-11-17 11:58:26 -05:00
Marcel Ziswiler
ac33a7976a imx: spl_imx_romapi: fix emmc fast boot mode case
This fixes a regression in the eMMC fast boot mode case where the buffer
was missing 464 bytes.

The code figures out how many bytes must at least be fetched to honor
the current read, rounds that up to the ss->pagesize [which is a no-op
in the USB download case because that has ->pagesize==1], fetches that
many bytes, but then recorded the original upper bound as the new end of
the valid data. However, this did not take into account the rounding up
to the ss->pagesize. Fix this by recording the actual bytes downloaded.

Fixes: 4b4472438f ("imx: spl_imx_romapi: avoid tricky use of spl_load_simple_fit() to get full FIT size")
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2023-11-17 11:58:26 -05:00
Marcel Ziswiler
e2dcadbba4 imx: spl_imx_romapi: fix comment about stream(usb) download failure
Fix comment about Stream(USB) download failure.

Fixes: 1cbebc7862 ("imx: add rom api support")
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2023-11-17 11:58:26 -05:00
John Keeping
e319ef02fb spl: fix TPL_SYS_MALLOC_F description
This config option enables the malloc() pool in TPL not the SPL.  Fix
the description to accurately reflect this.

Fixes: fd8497dae5 (spl: Create proper symbols for enabling the malloc() pool)
Signed-off-by: John Keeping <jkeeping@inmusicbrands.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-11-17 11:58:26 -05:00
Andre Przywara
45c4b276f0 virtio: rng: gracefully handle 0 byte returns
According to the virtio v1.x "entropy device" specification, a virtio-rng
device is supposed to always return at least one byte of entropy.
However the virtio v0.9 spec does not mention such a requirement.

The Arm Fixed Virtual Platform (FVP) implementation of virtio-rng always
returns 8 bytes less of entropy than requested. If 8 bytes or less are
requested, it will return 0 bytes.
This behaviour makes U-Boot's virtio_rng_read() implementation go into an
endless loop, hanging the system.

Work around this problem by always requesting 8 bytes more than needed,
but only if a previous call to virtqueue_get_buf() returned 0 bytes.

This should never trigger on a v1.x spec compliant implementation, but
fixes the hang on the Arm FVP.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reported-by: Peter Hoyes <peter.hoyes@arm.com>
2023-11-17 11:58:26 -05:00
Simon Glass
741d1e9d3f bootstd: Avoid freeing a non-allocated buffer
EFI applications can be very large and thus used to cause boot failures
when malloc() space was exhausted.

A recent changed fixed this by using the kernel_addr_r environment var
as the address of the buffer. However, it still frees the buffer when
the bootflow is discarded.

Fix this by introducing a flag to indicate whether the buffer was
allocated, or not.

Note that kernel_addr_r is not the last word here. It might be better
to use lmb to place images. But there is a lot of refactoring to do
before we can remove the environment variables. The distro scripts rely
on them so it is safe for bootstd to do so too.

Fixes: 6a8c2f9781 bootstd: Avoid allocating memory for the EFI file

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported by: Simon Glass <sjg@chromium.org>
Reported by: Shantur Rathore <i@shantur.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Tested-by: Shantur Rathore <i@shantur.com>
2023-11-17 11:58:26 -05:00
Tom Rini
169c3cc49e patman correct import of u_boot_pylib
correct long-standing EFI framebuffer bug
 minor test refactor
 -----BEGIN PGP SIGNATURE-----
 
 iQFFBAABCgAvFiEEslwAIq+Gp8wWVbYnfxc6PpAIreYFAmVUxF0RHHNqZ0BjaHJv
 bWl1bS5vcmcACgkQfxc6PpAIreandwgAkAhSYyADGMtGzbGbWK1t4EvYryaRCKvk
 KwbAWjbAfK3xOr8lUviRDDNEn2T1UQKYLPf64h6e1ivMrpS1M9JW8N0dEttagk1R
 O4KLMFkbBZXbbVA/ovhBvEDSBVWCnj0bRSq5nKnoCRCZAtQJnRpQXAZlUz9WT+js
 zJqgVoNua44akYtqulpgX4O6/8SvecQBJoP0yIyQCbXSNSOr7zcADIxq9yJJ0KrC
 4nFQ/qCvLsfrfeRX/NoSbEftX480fjyzpTFsp9XqvJPvtFQbzDUSaXSQ5QSUWNNl
 DrjNjUElqJv7cGSj73mm6yarVyRDygNyu49T/vgAvq3LwgNwdLuUqA==
 =tbfh
 -----END PGP SIGNATURE-----

Merge tag 'dm-pull-15nov23' of https://source.denx.de/u-boot/custodians/u-boot-dm

patman correct import of u_boot_pylib
correct long-standing EFI framebuffer bug
minor test refactor
2023-11-15 14:15:21 -05:00
Simon Glass
0d4d9f94c5 bootstage: Correct exhasuted typo
Correct this typo in the warning message shown when no more bootstage
records can be added.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-11-14 20:04:01 -07:00
Sean Anderson
f6d76e6878 sandbox: Close file after mmaping it
After opening pathname, we must close ifd once we are done with it.

Fixes: b9274095c2 ("sandbox: Add a way to map a file into memory")
Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-11-14 20:04:01 -07:00
Heinrich Schuchardt
2c61c0eb14 dm: Do not enable debug messages by default
CONFIG_DM_WARN has a text indicating that these messages should only
provided when debugging. This implies that the setting must be default no.

We should still create debug messages.

Reported-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-11-14 20:04:01 -07:00
Simon Glass
abf7004321 patman: Correct Python 3.6 behaviour
The importlib_resources import is not actually used. Fix this so that
patman can run on Python 3.6 to some extent, once
'pip3 install importlib-resources' has been run.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-11-14 20:04:01 -07:00
Simon Glass
dfdf621ff2 patman: Avoid using func_test at top level
Import this only when it is needed, since it is not present when
installed via 'pip install'.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: https://source.denx.de/u-boot/u-boot/-/issues/26
2023-11-14 20:04:01 -07:00