[PATCH 2/6] fs: implement O_DIRECTORY

2025-03-19 Thread Ahmad Fatoum
We already had O_DIRECTORY defined, but only used it as one of the bits for O_TMPFILE. Fix the O_TMPFILE branch, so it checks both bits and implement O_DIRECTORY, so it causes an error when opening a file that's not a directory. This is useful for use with openat. Signed-off-by: Ahmad Fatoum --

[PATCH master 6/8] net: phy: fix of_get_phy_mode for XLGMII and beyond

2025-03-19 Thread Ahmad Fatoum
The phy_modes array needs to be kept in-sync with the enum phy_interface_t, but this was violated by the most recent sync of the enum type with Linux. Th addition of new enumeration constants between existing ones resulted in phy_modes having NULL-valued gaps, which would panic when passed to strc

[PATCH master 2/8] include: asm-generic/pointer.h: fix ASM_PTR definition for i386

2025-03-19 Thread Ahmad Fatoum
For GNU as on i386, a .word is 16-bit wide, unlikes ARM, where it's 32-bit. The code in asm-generic/pointer.h expects .word to be 32-bit wide though, therefore to switch to .long. Unlike C's long, an assembly .long is always 32-bit (and thus identical to .int). Signed-off-by: Ahmad Fatoum --- v1

[PATCH 0/6] fs: implement tree and truncate

2025-03-19 Thread Ahmad Fatoum
Turn opendir inside out, so it uses directory fds internally. This is an important change, because it means that the inode iterate operation will now operate on a real struct file. This is a prerequisite for porting 9pfs from Linux as it expects directories to be openend before iteration. To aid

[PATCH master 3/8] sandbox: do not enable SANDBOX_LINUX_I386 in allyesconfig

2025-03-19 Thread Ahmad Fatoum
On sandbox, CONFIG_32BIT and CONFIG_64BIT are determined by the used compiler. As special case, building sandbox on x86_64 allows selecting a 32-bit build via CONFIG_SANDBOX_LINUX_I386 if the compiler supports it. This option is disabled by default, but allyesconfig turns it on, alongside drivers

[PATCH v2 2/2] booti: sanity check image magic before parsing header

2025-03-19 Thread Ahmad Fatoum
booti_load_image is called directly for kernels in FIT images. Let's have a simple check that the payload is indeed a booti image before parsing it. Signed-off-by: Ahmad Fatoum --- v1 -> v2: - no change --- common/booti.c | 11 +-- common/filetype.c | 6 +++--- include/filetype.h

[PATCH v2 1/2] scripts: define le32_to_cpup and friends for host/target tools

2025-03-19 Thread Ahmad Fatoum
We already define le32_to_cpu and friends, but were missing so far the p-suffixed variant, which accepts a pointer. This is easily implemented with a bit of macro boilerplate, so let's do that. Signed-off-by: Ahmad Fatoum --- v1 -> v2: - new patch --- scripts/compiler.h | 21 +

[PATCH v2 2/3] env: add envvar_for_each helper for variable iteration

2025-03-19 Thread Ahmad Fatoum
Instead of opencoding the iteration where needed, implement a helper invokes a callback on every variable. Signed-off-by: Ahmad Fatoum --- v1 -> v2: - new patch --- common/env.c | 37 + include/environment.h | 7 +++ 2 files changed, 44 inserti

[PATCH v2 3/3] commands: add varinfo command

2025-03-19 Thread Ahmad Fatoum
Tab completion is very helpful, but it's not sufficient for enum-typed global variables. To know what the permissible values are, devinfo global must be consulted, which can have a lot of output. As alternative, let's add a varinfo command that can be used together with parameter tab completion an

[PATCH v2 1/3] complete: give device_param_complete a flags parameter

2025-03-19 Thread Ahmad Fatoum
We currently always complete device parameters with either a dollar sign in front or an equal sign after. In preparation for allowing completions with neither, give env_param_complete() a flag. Signed-off-by: Ahmad Fatoum --- v1 -> v2: - new patch --- common/complete.c | 30 ++-

[PATCH 4/6] commands: implement tree command

2025-03-19 Thread Ahmad Fatoum
This is a very simple tree command inspired by busybox. We already have ls -R for recursive directory listings, but tree uses indentation to make it easier to see the directory structure. Signed-off-by: Ahmad Fatoum --- commands/Kconfig | 9 +++ commands/Makefile | 1 + commands/tree.c |

[PATCH] driver: base: class: remove device from class on registration

2025-03-19 Thread Ahmad Fatoum
class_remove_device is the exception and normally, a device class doesn't change for the lifetime of a device after it's set the first time and removal from a class is done alongside removal of the device itself. Let's therefore move the removal from class into core driver code. Signed-off-by: Ah

[PATCH 3/6] fs: implement opendir in terms of fdopendir

2025-03-19 Thread Ahmad Fatoum
While struct filep (FILE) and struct file have been merged, we still have two different ways the files are created: Regularly in open and irregularly in an incomplete manner inside opendir. This breaks file systems that expect the struct file passed to iterate to have been opened before. To allow

[PATCH 6/6] Documentation: devel: add short section on file systems

2025-03-19 Thread Ahmad Fatoum
barebox has a lot of commands that can be used to exercise different aspects of a file system. Add some documentation for that. Signed-off-by: Ahmad Fatoum --- Documentation/devel/background-execution.rst | 2 + Documentation/devel/devel.rst| 1 + Documentation/devel/filesystem

[PATCH 1/6] fs: use filename_create/filename_lookup instead of open-coding

2025-03-19 Thread Ahmad Fatoum
By reusing the existing file lookup code, open can open all directories, e.g. / and /tmp/., which so far wasn't possible. We need to be able to open these paths for directory FDs to work as one would expect. Signed-off-by: Ahmad Fatoum --- fs/fs.c | 55

[PATCH master 1/8] firmware: disable MISSING_FIRMWARE_ERROR for COMPILE_TEST builds

2025-03-19 Thread Ahmad Fatoum
An allyes build will enable all options possible and thus usually fail to build, because it enables CONFIG_MISSING_FIRMWARE_ERROR along with DRIVER_NET_FSL_FMAN, which requires firmware to function at runtime. Fix this by disabling MISSING_FIRMWARE_ERROR if COMPILE_TEST is enabled. This works, bec

[PATCH master 8/8] test: self: printf: add tests for formatting wide strings

2025-03-19 Thread Ahmad Fatoum
Let's repeat the same string tests we already have, but with wide (%ls) strings instead of our normal ones. Signed-off-by: Ahmad Fatoum --- v1 -> v2: - new patch --- test/self/printf.c | 15 +++ 1 file changed, 15 insertions(+) diff --git a/test/self/printf.c b/test/self/printf.c

[PATCH master 5/8] ARM: mvebu: kwb_bbu: add missing header

2025-03-19 Thread Ahmad Fatoum
The file uses xzalloc, but it's not defined any longer in the currently included headers. Include the relevant header to fix this. Signed-off-by: Ahmad Fatoum --- v1 -> v2: - new patch --- arch/arm/mach-mvebu/kwb_bbu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-mvebu/kw

[PATCH master 4/8] Documentation: devicetree: fix Sphinx warnings

2025-03-19 Thread Ahmad Fatoum
Building the barebox documentation results in an number of warnings predominantly in the autogenerated docs from command help text. Outside of that, there is warnings only in the DT bindings: bindings/barebox/virtual-reg.rst:25: WARNING: Inline emphasis start-string without end-string. bin

[PATCH master 7/8] vsprintf: fix left indentation when formatting wide string arguments

2025-03-19 Thread Ahmad Fatoum
leading_spaces will advance the buf pointer as needed, but currently buf is never reassigned, breaking formatting of wchar arrays. Signed-off-by: Ahmad Fatoum --- v1 -> v2: - new patch --- lib/vsprintf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/vsprintf.c b/lib

[PATCH master 0/8] treewide: misc fixes

2025-03-19 Thread Ahmad Fatoum
Just a loose collection of fixes for master. Ahmad Fatoum (8): firmware: disable MISSING_FIRMWARE_ERROR for COMPILE_TEST builds include: asm-generic/pointer.h: fix ASM_PTR definition for i386 sandbox: do not enable SANDBOX_LINUX_I386 in allyesconfig Documentation: devicetree: fix Sphinx wa

[PATCH master 1/3] firmware: disable MISSING_FIRMWARE_ERROR for COMPILE_TEST builds

2025-03-19 Thread Ahmad Fatoum
An allyes build will enable all options possible and thus usually fail to build, because it enables CONFIG_MISSING_FIRMWARE_ERROR along with DRIVER_NET_FSL_FMAN, which requires firmware to function at runtime. Fix this by disabling MISSING_FIRMWARE_ERROR if COMPILE_TEST is enabled. This works, bec

[PATCH 0/2] arm64: rockchip: Two more additions to rockchip_v8_defconfig

2025-03-19 Thread Uwe Kleine-König
Hello, while working to support the Qnap TS-433 NAS I found the config items enabled here quite useful. I'm not entirely sure that enabling generic fit image is useful in general (also because it comes with a build dependency on python3-libfdt), still here comes a suggestion to enable it. Best re

[PATCH master 2/3] sandbox: do not enable SANDBOX_LINUX_I386 in allyesconfig

2025-03-19 Thread Ahmad Fatoum
On sandbox, CONFIG_32BIT and CONFIG_64BIT are determined by the used compiler. As special case, building sandbox on x86_64 allows selecting a 32-bit build via CONFIG_SANDBOX_LINUX_I386 if the compiler supports it. This option is disabled by default, but allyesconfig turns it on, alongside drivers

[PATCH] fixup! commands: ubsan: hide zero division in test

2025-03-19 Thread Ahmad Fatoum
GCC complains that we pass the address of the variable instead of the variable itself: commands/ubsan.c: In function ‘test_ubsan_divrem_overflow’: error: lvalue required in ‘asm’ statement 63 | __asm__ ("" : "=r" (var) : "0" (var)) | ^~~ ./comm

[PATCH master 3/3] Documentation: devicetree: fix Sphinx warnings

2025-03-19 Thread Ahmad Fatoum
Building the barebox documentation results in an number of warnings predominantly in the autogenerated docs from command help text. Outside of that, there is warnings only in the DT bindings: bindings/barebox/virtual-reg.rst:25: WARNING: Inline emphasis start-string without end-string. bin

Re: [PATCH v2 04/10] mci: add RPMB support

2025-03-19 Thread Ahmad Fatoum
On 3/19/25 16:30, Sascha Hauer wrote: > This implements the MMC specific part to access RPMB partitions: > > - Provide a function to find a RPMB capable eMMC > - partition switching to the RPMB partition > - Dissecting the OP-TEE requests into the correspnding MMC read/write > multiblock comm

Re: [PATCH 4/9] mci: add RPMB support

2025-03-19 Thread Ahmad Fatoum
On 3/19/25 16:34, Ahmad Fatoum wrote: > > > On 3/19/25 16:29, Sascha Hauer wrote: >> On Tue, Mar 18, 2025 at 12:33:05PM +0100, Sascha Hauer wrote: >>> On Mon, Mar 17, 2025 at 04:18:32PM +0100, Ahmad Fatoum wrote: Hello Sascha, On 3/12/25 13:16, Sascha Hauer wrote: > + >

[PATCH v2 08/10] tee: optee: implement AVB named persistent values support

2025-03-19 Thread Sascha Hauer
Android Verified Boot (AVB) 2.0 spec. revision 1.1 introduces support for named persistent values that must be tamper evident and allows AVB to store arbitrary key-value pairs. While AVB itself is not implemented in barebox. this patch allows barebox to access the persistent value store. This is u

[PATCH v2 01/10] mci: implement mci_set_blockcount()

2025-03-19 Thread Sascha Hauer
This adds a function to send a MMC_CMD_SET_BLOCK_COUNT command. This is not yet needed by barebox as we use open end multiblock transfers, but will be needed by upcoming RPMB support. Signed-off-by: Sascha Hauer --- drivers/mci/mci-core.c | 9 + include/mci.h | 5 + 2 files

Re: [PATCH 4/9] mci: add RPMB support

2025-03-19 Thread Ahmad Fatoum
On 3/19/25 16:29, Sascha Hauer wrote: > On Tue, Mar 18, 2025 at 12:33:05PM +0100, Sascha Hauer wrote: >> On Mon, Mar 17, 2025 at 04:18:32PM +0100, Ahmad Fatoum wrote: >>> Hello Sascha, >>> >>> On 3/12/25 13:16, Sascha Hauer wrote: + +int mci_rpmb_route_frames(struct mci *mci, void *req

[PATCH v2 04/10] mci: add RPMB support

2025-03-19 Thread Sascha Hauer
This implements the MMC specific part to access RPMB partitions: - Provide a function to find a RPMB capable eMMC - partition switching to the RPMB partition - Dissecting the OP-TEE requests into the correspnding MMC read/write multiblock commands For now we only support a single eMMC RPMB part

[PATCH v2 06/10] tee: optee: implement shared mem alloc/free RPC commands

2025-03-19 Thread Sascha Hauer
This implements the OPTEE_RPC_CMD_SHM_ALLOC and OPTEE_RPC_CMD_SHM_FREE commands to let the secure world allocate and free shared memory. When OP-TEE calls into the nonsecure world in order to allocate shared memory we'll need a list of pages returned to the secure world. This is needed in two case

[PATCH v2 10/10] ARM: omap: remove unused file

2025-03-19 Thread Sascha Hauer
Signed-off-by: Sascha Hauer --- include/mach/omap/omap4-devices.h | 93 --- 1 file changed, 93 deletions(-) diff --git a/include/mach/omap/omap4-devices.h b/include/mach/omap/omap4-devices.h deleted file mode 100644 index de73062bc5..00 --- a/include/

[PATCH v2 00/10] Add RPMB support

2025-03-19 Thread Sascha Hauer
This series adds the necessary pieces to provide OP-TEE access to RPMB partitions under barebox. With this OP-TEE can issue RPMB requests to barebox and barebox will answer them accordingly. OP-TEE will only access the RPMB when triggered by barebox. For this purpose I implemented access to the A

[PATCH v2 05/10] tee: optee: probe successfully even when no devices are found

2025-03-19 Thread Sascha Hauer
OP-TEE iterates over the devices and when none are found the OP-TEE driver returns with an error. Return successfully instead because for example RPMB support doesn't require any devices exported from OP-TEE. Signed-off-by: Sascha Hauer --- drivers/tee/optee/device.c | 1 + 1 file changed, 1 ins

[PATCH v2 02/10] mci: export some functions for RPMB support

2025-03-19 Thread Sascha Hauer
Export mci_send_cmd() and mci_blk_part_switch() in preparation for adding RPMB support. Signed-off-by: Sascha Hauer --- drivers/mci/mci-core.c | 4 ++-- include/mci.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c i

Re: [PATCH 0/7] filetype: Some size reduction patches

2025-03-19 Thread Sascha Hauer
On Tue, 18 Mar 2025 15:41:41 +0100, Sascha Hauer wrote: > The am335x_mlo_defconfig is very size constrained and doesn't build > within these constraint anymore for some time. The filetype detection > code has become quite big and offers some opportunities for size > reduction. Specifically file_d

Re: [PATCH 4/9] mci: add RPMB support

2025-03-19 Thread Sascha Hauer
On Tue, Mar 18, 2025 at 12:33:05PM +0100, Sascha Hauer wrote: > On Mon, Mar 17, 2025 at 04:18:32PM +0100, Ahmad Fatoum wrote: > > Hello Sascha, > > > > On 3/12/25 13:16, Sascha Hauer wrote: > > > + > > > +int mci_rpmb_route_frames(struct mci *mci, void *req, unsigned long > > > reqlen, > > > +

Re: [PATCH] serial: omap: make Linux console name configurable

2025-03-19 Thread Sascha Hauer
On Wed, 19 Mar 2025 11:22:28 +0100, Sascha Hauer wrote: > Depending on the configuration Linux on OMAP SoCs either needs ttyO or > ttyS as console name. We used to pass ttyO, but c1c0d18973 > ("serial: omap: Use ttyS as Linux console name") recently changed this > to ttyS which breaks setups that

Re: [PATCH] serial: omap: make Linux console name configurable

2025-03-19 Thread Ahmad Fatoum
Hi, On 3/19/25 12:16, Sascha Hauer wrote: > On Wed, Mar 19, 2025 at 12:03:31PM +0100, Ahmad Fatoum wrote: >> >> >> On 3/19/25 12:01, Sascha Hauer wrote: >>> On Wed, Mar 19, 2025 at 11:55:53AM +0100, Ahmad Fatoum wrote: Hello Sascha, On 3/19/25 11:22, Sascha Hauer wrote: > Depend

Re: [PATCH] serial: omap: make Linux console name configurable

2025-03-19 Thread Sascha Hauer
On Wed, Mar 19, 2025 at 12:03:31PM +0100, Ahmad Fatoum wrote: > > > On 3/19/25 12:01, Sascha Hauer wrote: > > On Wed, Mar 19, 2025 at 11:55:53AM +0100, Ahmad Fatoum wrote: > >> Hello Sascha, > >> > >> On 3/19/25 11:22, Sascha Hauer wrote: > >>> Depending on the configuration Linux on OMAP SoCs ei

Re: [PATCH] serial: omap: make Linux console name configurable

2025-03-19 Thread Ahmad Fatoum
On 3/19/25 12:01, Sascha Hauer wrote: > On Wed, Mar 19, 2025 at 11:55:53AM +0100, Ahmad Fatoum wrote: >> Hello Sascha, >> >> On 3/19/25 11:22, Sascha Hauer wrote: >>> Depending on the configuration Linux on OMAP SoCs either needs ttyO or >>> ttyS as console name. We used to pass ttyO, but c1c0d1

Re: [PATCH] serial: omap: make Linux console name configurable

2025-03-19 Thread Ahmad Fatoum
Hello Sascha, On 3/19/25 11:22, Sascha Hauer wrote: > Depending on the configuration Linux on OMAP SoCs either needs ttyO or > ttyS as console name. We used to pass ttyO, but c1c0d18973 > ("serial: omap: Use ttyS as Linux console name") recently changed this > to ttyS which breaks setups that used

[PATCH] serial: omap: make Linux console name configurable

2025-03-19 Thread Sascha Hauer
Depending on the configuration Linux on OMAP SoCs either needs ttyO or ttyS as console name. We used to pass ttyO, but c1c0d18973 ("serial: omap: Use ttyS as Linux console name") recently changed this to ttyS which breaks setups that used to work earlier. Make the name configurable to allow for set

Re: [PATCH] ARM: am335x_mlo_defconfig: disable unnecessary options

2025-03-19 Thread Sascha Hauer
On Wed, 19 Mar 2025 09:36:23 +0100, Sascha Hauer wrote: > - disable CONFIG_BOARD_GENERIC_DT which is not needed for the MLO > defconfig > - disable CONFIG_MTD_NAND_ECC_SW_HAMMING. AM335x uses hardware ECC > - disable CONFIG_BANNER. Saves another few bytes > > Applied, thanks! [1/1] ARM: am3

Re: [PATCH 0/6] mci: some cleanups

2025-03-19 Thread Sascha Hauer
On Mon, 17 Mar 2025 10:34:32 +0100, Sascha Hauer wrote: > This cleans up some stuff in the mci layer and its drivers. > > Applied, thanks! [1/6] mci: use struct cid https://git.pengutronix.de/cgit/barebox/commit/?id=a4a78c4f321a (link may not be stable) [2/6] mmc: merge block read/writ

[PATCH] ARM: am335x_mlo_defconfig: disable unnecessary options

2025-03-19 Thread Sascha Hauer
- disable CONFIG_BOARD_GENERIC_DT which is not needed for the MLO defconfig - disable CONFIG_MTD_NAND_ECC_SW_HAMMING. AM335x uses hardware ECC - disable CONFIG_BANNER. Saves another few bytes Signed-off-by: Sascha Hauer --- arch/arm/configs/am335x_mlo_defconfig | 7 --- 1 file changed, 4 i

Re: [PATCH 0/7] filetype: Some size reduction patches

2025-03-19 Thread Sascha Hauer
Hi Alexander, On Tue, Mar 18, 2025 at 06:01:19PM +0300, Alexander Shiyan wrote: > Hello Sascha! > > I've been using a separate config for this board for a long time :) > Maybe you can take something from my working configuration that > has been working for several years: > https://github.com/shcg