[PATCH 1/7] ARM: cpu: allow selecting CPU_V7/CPU_V8 directly

2025-09-17 Thread chalianis1
From: Ahmad Fatoum We currently lack a way to build a barebox EFI payload on ARM without enabling some other subarchitecture. As CONFIG_EFI_PAYLOAD has a global effect and adds EFI stubs to all enabled board, an EFI subarchitecture doesn't fit into our current model. Instead, let's make it possi

Re: [PATCH 09/11] boards: enclustra-sa2: enable bridges

2025-09-17 Thread Sascha Hauer
On Wed, Sep 17, 2025 at 05:22:12PM +0200, David Picard wrote: > Enable the lw-fpga2hps and fpga2hps bridges. > > Signed-off-by: David Picard > --- > arch/arm/dts/socfpga_cyclone5_mercury_sa2.dtsi | 10 ++ > 1 file changed, 10 insertions(+) Please squash into the patch adding this file.

Re: [PATCH 07/11] gpio: dw: support numbering via aliases

2025-09-17 Thread Sascha Hauer
On Wed, Sep 17, 2025 at 05:22:10PM +0200, David Picard wrote: > From: Ahmad Fatoum > > This device driver is OF-only, so reflect that in the Kconfig and have > it parse aliases if available to derive its id. > > Signed-off-by: Ahmad Fatoum > --- > drivers/gpio/Kconfig | 1 + > drivers/gpio/g

[PATCH v2 20/24] security: fastboot: add security policy for fastboot oem

2025-09-17 Thread Sascha Hauer
Fastboot OEM commands allow to execute arbitrary commands via fastboot, so add a security policy for it to limit access to this functionality. Signed-off-by: Sascha Hauer --- common/Sconfig| 4 common/fastboot.c | 6 ++ 2 files changed, 10 insertions(+) diff --git a/common/Sconfig

Re: [PATCH 04/11] ARM: dts: socfpga: use upstream SA2 device tree

2025-09-17 Thread Sascha Hauer
On Wed, Sep 17, 2025 at 05:22:07PM +0200, David Picard wrote: > From: Ahmad Fatoum > > The device trees from the Enclustra BSP are outdated and not compatible > with what barebox expects. Drop them and use the upstream SoC device > tree imported from Linux instead. For the board itself, we import

Re: [PATCH 02/11] Add Enclustra Mercury+ SA2 module

2025-09-17 Thread Sascha Hauer
On Wed, Sep 17, 2025 at 05:22:05PM +0200, David Picard wrote: > Signed-off-by: David Picard > --- > arch/arm/boards/Makefile | 1 + > arch/arm/boards/enclustra-sa2/Makefile| 2 ++ > arch/arm/boards/enclustra-sa2/board.c | 32 > +++ >

Re: [PATCH 06/11] boards: enclustra-sa2: read MAC address from EEPROM

2025-09-17 Thread Sascha Hauer
Hi David, On Wed, Sep 17, 2025 at 05:22:09PM +0200, David Picard wrote: > Signed-off-by: David Picard > --- > arch/arm/boards/enclustra-sa2/Makefile| 2 +- > arch/arm/boards/enclustra-sa2/atsha204a.c | 436 > ++ > arch/arm/boards/enclustra-sa2/atsha204a.h | 19

[PATCH] crc-itu-t: fix typo in CRC ITU-T polynomial comment

2025-09-17 Thread Sascha Hauer
Based on Linux commit 77991645952c2 ("crc-itu-t: fix typo in CRC ITU-T polynomial comment"): | The code comment says that the polynomial is x^16 + x^12 + x^15 + 1, but | the correct polynomial is x^16 + x^12 + x^5 + 1. Quoting from page 2 in | the ITU-T V.41 specification [1]: | | 2 Encoding an

Re: [PATCH] drivers: dma: refactor: rename dma_ops to dma_device_ops.

2025-09-17 Thread Ahmad Fatoum
Hi, On 9/14/25 9:32 PM, chalian...@gmail.com wrote: > From: Chali Anis > > This patch is an esthetic cleanup, rename the dma_ops to dma_device_ops > to be sure that the struct in drivers/dma is different from one used in > arch/riscv/cpu. I accidentally faced the issue telling that the struct is

[PATCH] treewide: drop useless casting to void * in of_device_id

2025-09-17 Thread Sascha Hauer
struct of_device_id::data already is a const void *, so drop explicit casting to void * when initialized with something that already is a pointer. Signed-off-by: Sascha Hauer --- drivers/hw_random/rockchip-rng.c | 6 +++--- drivers/pinctrl/pinctrl-rockchip.c | 2 +- drivers/spi/dspi_spi.c

Re: [PATCH] drivers: dma: refactor: rename dma_ops to dma_device_ops.

2025-09-17 Thread Sascha Hauer
On Sun, 14 Sep 2025 15:32:49 -0400, chalian...@gmail.com wrote: > This patch is an esthetic cleanup, rename the dma_ops to dma_device_ops > to be sure that the struct in drivers/dma is different from one used in > arch/riscv/cpu. I accidentally faced the issue telling that the struct is > defined

[PATCH v2 07/24] security: policy: support externally provided configs

2025-09-17 Thread Sascha Hauer
From: Ahmad Fatoum The enforcement of security policies to be up-to-date and removal of implicit syncing nudges users into checking in the actual security policy into version control. To allow the policies to live outside the barebox tree, introduce CONFIG_SECURITY_POLICY_PATH that takes a space-

Re: [PATCH] spi: mvebu: move timekeeping out of hot path

2025-09-17 Thread Sascha Hauer
On Wed, 10 Sep 2025 07:42:25 +0200, Steffen Trumtrar wrote: > The wait_on_timeout uses get_time_ns for timekeeping. It seems that this > considerably decreases transfer speeds, because the wait_on_timeout loop > gets throttled by the timekeeping. > Moving the timekeeping after the hot path result

[PATCH v2] firmware: handle firmware files being links correctly

2025-09-17 Thread Sascha Hauer
Sometimes firmware files can be links. When rebuilding barebox correctly rebuilds the firmware when file the link points to is updated, but the firmware is not rebuilt when the link itself is changed to link to another file. Fix this by including the sha256sum directly in the generated assembly fi

[PATCH v2 10/24] commands: go: add security config option

2025-09-17 Thread Sascha Hauer
From: Ahmad Fatoum The go command doesn't do any signature verification and allows executing arbitrary code. Add a security option, so a policy can disable this command at runtime. Signed-off-by: Ahmad Fatoum --- Sconfig | 1 + commands/Sconfig | 12 commands/go.c|

[PATCH] net: fec_imx: Fix probe failure on i.MX27

2025-09-17 Thread Sascha Hauer
FEC_TYPE_IMX27 is 0 which meands device_get_match_data() returns NULL and the driver bails out on the error check of this function. Start counting the enum at one to pass the error check also on i.MX27. Signed-off-by: Sascha Hauer --- drivers/net/fec_imx.h | 2 +- 1 file changed, 1 insertion(+),

[PATCH v2 24/24] security: console: add security policy for console input

2025-09-17 Thread Sascha Hauer
Disabling the input path of the console is the safest bet to make barebox fully non interactive. Add a security policy for this case. Signed-off-by: Sascha Hauer --- common/Sconfig | 11 ++- common/console.c| 6 ++ common/console_simple.c | 6 ++ 3 files change

Re: [PATCH 06/11] boards: enclustra-sa2: read MAC address from EEPROM

2025-09-17 Thread Alexander Shiyan
Hello. I think we can bring the crc16() procedure into the public location (/crypto?, /lib?). ср, 17 сент. 2025 г. в 18:51, David Picard : > > Signed-off-by: David Picard > --- > arch/arm/boards/enclustra-sa2/Makefile| 2 +- > arch/arm/boards/enclustra-sa2/atsha204a.c | 436 > +++

Re: [PATCH] firmware: handle firmware files being links correctly

2025-09-17 Thread Sascha Hauer
On Wed, Sep 17, 2025 at 12:21:57PM +0200, Ahmad Fatoum wrote: > On 9/17/25 11:58 AM, Sascha Hauer wrote: > > Sometimes firmware files can be links. When rebuilding barebox correctly > > rebuilds the firmware when file the link points to is updated, but the > > firmware is not rebuilt when the link

[PATCH v2 12/24] bootm: support calling bootm_optional_signed_images at any time

2025-09-17 Thread Sascha Hauer
From: Ahmad Fatoum bootm_init is a late initcall and thus the code has the implicit assumption that bootm_force_signed_images is called after it runs. Rework the code to allow calling the function at any time. Signed-off-by: Ahmad Fatoum --- common/bootm.c | 32 +++

[PATCH 09/11] boards: enclustra-sa2: enable bridges

2025-09-17 Thread David Picard
Enable the lw-fpga2hps and fpga2hps bridges. Signed-off-by: David Picard --- arch/arm/dts/socfpga_cyclone5_mercury_sa2.dtsi | 10 ++ 1 file changed, 10 insertions(+) diff --git a/arch/arm/dts/socfpga_cyclone5_mercury_sa2.dtsi b/arch/arm/dts/socfpga_cyclone5_mercury_sa2.dtsi index 52a9

[PATCH 06/11] boards: enclustra-sa2: read MAC address from EEPROM

2025-09-17 Thread David Picard
Signed-off-by: David Picard --- arch/arm/boards/enclustra-sa2/Makefile| 2 +- arch/arm/boards/enclustra-sa2/atsha204a.c | 436 ++ arch/arm/boards/enclustra-sa2/atsha204a.h | 19 ++ arch/arm/boards/enclustra-sa2/board.c | 51 +++- arch/arm/boards/enclustra-s

[PATCH v2 00/24] Add security policy support

2025-09-17 Thread Sascha Hauer
Security policies are a mechanism for barebox to prevent, when so desired, security relevant code from being executed. Security policies are controlled via a second Kconfig menu structure (called Sconfig) which collects security relevant options. While the normal Kconfig menu structure is about f

[PATCH v2 03/24] kbuild: implement loopable loop_cmd

2025-09-17 Thread Sascha Hauer
From: Ahmad Fatoum The normal cmd can not be used in foreach, because it's prefixed by @. Add an optional loopable variant as well as a noop_cmd that's suitable for use in nesten $(call ...) invocations that would otherwise lead to Make aborting due to perceived cycles in log_print. Signed-off-b

[PATCH v2 05/24] kbuild: allow security config use without source tree modification

2025-09-17 Thread Sascha Hauer
From: Ahmad Fatoum A key aspect of security policies is the enforcement of a policy to be complete with no implicit defaults. To make this easier to use, the security_*config targets directly manipulate the specified KPOLICY or all known policies if none were specified. This is at odds with buil

[PATCH v2 04/24] Add security policy support

2025-09-17 Thread Sascha Hauer
From: Ahmad Fatoum Security policies are a mechanism for barebox to prevent, when so desired, security relevant code from being executed. Security policies are controlled via a second Kconfig menu structure (called Sconfig) which collects security relevant options. While the normal Kconfig menu

[PATCH v2 21/24] security: shell: add policy for executing the shell

2025-09-17 Thread Sascha Hauer
Executing shell scripts can be dangerous in secure environments, so add a security policy for it. While shell scripts can be executed securely if made sure that no scripts from unknown sources are executed, executing an interactive shell for sure is not desired in secure environments, so offer two

[PATCH v2 11/24] console: ratp: add security config option

2025-09-17 Thread Sascha Hauer
From: Ahmad Fatoum For secure systems that disable the regular console, RATP should be disabled as well, so add an option to do so. Signed-off-by: Ahmad Fatoum --- Sconfig| 1 + common/Sconfig | 9 + common/console.c | 4 +++- common/ratp/ratp.c | 17 ++

[PATCH v2 14/24] ARM: configs: add virt32_secure_defconfig

2025-09-17 Thread Sascha Hauer
From: Ahmad Fatoum The security policy support does not allow for incomplete configs and thus sconfig files must be refreshed when config options they depend on changes. This means that a security profile that's up-to-date with respect to one .config is often outdated with respect to another. To

[PATCH 04/11] ARM: dts: socfpga: use upstream SA2 device tree

2025-09-17 Thread David Picard
From: Ahmad Fatoum The device trees from the Enclustra BSP are outdated and not compatible with what barebox expects. Drop them and use the upstream SoC device tree imported from Linux instead. For the board itself, we import the device tree in the most recent posting[1] to the kernel mailing lis

[PATCH 00/11] ARM: boards: add support for Enclustra Mercury SA2

2025-09-17 Thread David Picard
Add support for the Enclustra Mercury+ SA2, a Cyclone V based SoC FPGA. https://www.enclustra.com/en/products/system-on-chip-modules/mercury-sa2/ The SoM provides a 64MiB NOR QSPI flash, DDR3, Ethernet PHY, RTC. The Cyclone V features a hardware ARM core (aka HPS) that can boot from SD card (MMC)

[PATCH 02/11] Add Enclustra Mercury+ SA2 module

2025-09-17 Thread David Picard
Signed-off-by: David Picard --- arch/arm/boards/Makefile | 1 + arch/arm/boards/enclustra-sa2/Makefile| 2 ++ arch/arm/boards/enclustra-sa2/board.c | 32 +++ arch/arm/boards/enclustra-sa2/lowlevel.c | 13 +++ arch/arm/con

[PATCH 03/11] Add Enclustra devicetree files

2025-09-17 Thread David Picard
Copied from Enclustra's BSP Signed-off-by: David Picard --- dts/src/arm/intel/socfpga/skeleton.dtsi| 13 + .../intel/socfpga/socfpga_cyclone5_enclustra.dtsi | 69 ++ .../intel/socfpga/socfpga_cyclone5_mercury_sa2.dts | 128 +++ dts/src/arm/intel/socfpga/socfpga_enclustra.dtsi |

[PATCH 08/11] gpio: dw: make deep probe compatible

2025-09-17 Thread David Picard
From: Ahmad Fatoum When deep probing GPIO controller, we expect struct gpio_chip::dev to be bound to a driver. This is currently not the case as the driver for the parent nodes creates devices for the child nodes and never binds a driver to them. As the child nodes have compatibles themselves t

[PATCH 10/11] boards: enclustra-sa2: configure SI5338

2025-09-17 Thread David Picard
Configure the SI5338 clock generator on the ST1 baseboard. Signed-off-by: David Picard --- arch/arm/boards/enclustra-sa2/Makefile | 2 +- .../boards/enclustra-sa2/Si5338-RevB-Registers.h | 433 + arch/arm/boards/enclustra-sa2/board.c | 6 + arch

[PATCH 07/11] gpio: dw: support numbering via aliases

2025-09-17 Thread David Picard
From: Ahmad Fatoum This device driver is OF-only, so reflect that in the Kconfig and have it parse aliases if available to derive its id. Signed-off-by: Ahmad Fatoum --- drivers/gpio/Kconfig | 1 + drivers/gpio/gpio-dw.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a

[PATCH 11/11] boards: enclustra-sa2: enable SI5338

2025-09-17 Thread David Picard
The clock generator SI5338 is not implemented on the SA2 module itself, but on e.g. the ST1 baseboard. Signed-off-by: David Picard --- arch/arm/dts/socfpga_cyclone5_mercury_sa2.dtsi | 6 ++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/dts/socfpga_cyclone5_mercury_sa2.dtsi b/arch/a

[PATCH 05/11] ARM: dts: socfpga: adapt upstream SA2 device tree

2025-09-17 Thread David Picard
Signed-off-by: David Picard --- arch/arm/dts/socfpga_cyclone5_mercury_sa2.dtsi | 25 +++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/arch/arm/dts/socfpga_cyclone5_mercury_sa2.dtsi b/arch/arm/dts/socfpga_cyclone5_mercury_sa2.dtsi index 73bd75fcf224fbf31fc

[PATCH 01/11] Add handoff files

2025-09-17 Thread David Picard
Copy handoff files from Mercury_SA2_ST1_Reference_Design released by Enclustra. Signed-off-by: David Picard --- .../boards/enclustra-sa2/iocsr_config_cyclone5.c | 678 + arch/arm/boards/enclustra-sa2/pinmux_config.c | 241 arch/arm/boards/enclustra-sa2/pll_con

[PATCH v2 22/24] security: add security policy for loading barebox environment

2025-09-17 Thread Sascha Hauer
In secure environments we shouldn't load a persistent and potentially manipulated environment. Add a security policy for it. Signed-off-by: Sascha Hauer --- common/Sconfig | 8 common/environment.c | 6 ++ 2 files changed, 14 insertions(+) diff --git a/common/Sconfig b/common

[PATCH v2 23/24] security: add filesystem security policies

2025-09-17 Thread Sascha Hauer
We don't have any trusted filesystems in barebox and a manipulated filesystem could trick barebox into crashing or loading untrusted data, so add a security policy for the barebox filesystems. With SCONFIG_FS_EXTERNAL set barebox will allow mounting all filesystems whereas with this option disable

[PATCH v2 18/24] usbserial: add inline wrappers

2025-09-17 Thread Sascha Hauer
We'll need static inline wrappers in following patches, let's add them. Signed-off-by: Sascha Hauer --- include/linux/usb/usbserial.h | 11 +++ 1 file changed, 11 insertions(+) diff --git a/include/linux/usb/usbserial.h b/include/linux/usb/usbserial.h index e1375c489a027448c8e75ce1ce05

Re: [PATCH] drivers: treewide: Do not use NULL as driver_data

2025-09-17 Thread Sascha Hauer
On Tue, Sep 16, 2025 at 11:38:48AM +0200, Ahmad Fatoum wrote: > Hello Sascha, > > On 9/16/25 11:32 AM, Sascha Hauer wrote: > > Several drivers in the tree use an enum for the chip type casted to int > > as driver_data. This comes with the problem that device_get_match_data() > > returns NULL for t

[PATCH v2 08/24] commands: implement sconfig command

2025-09-17 Thread Sascha Hauer
The sconfig command provides a convenient interface to test the new security policy support. It allows inspecting available policies and optionally switching between them and enabling/disabling them piecewise for interactive testing of code that is gated behind these security options. Signed-off-b

[PATCH v2 09/24] docs: security-policies: add documentation

2025-09-17 Thread Sascha Hauer
From: Ahmad Fatoum Let's add some first documentation for the newly added security policy support. Signed-off-by: Ahmad Fatoum --- Documentation/devel/devel.rst | 1 + Documentation/devel/security-policies.rst | 96 ++ Documentation/user/security-policies.rst

[PATCH v2 06/24] defaultenv: update PS1 according to security policy

2025-09-17 Thread Sascha Hauer
From: Ahmad Fatoum This nifty optional feature makes it easy to see what security policy is currently active. Signed-off-by: Ahmad Fatoum --- Documentation/user/defaultenv-2.rst | 2 ++ common/Kconfig | 5 + defaultenv/Makefile

[PATCH v2 02/24] scripts: include scripts/include for all host tools

2025-09-17 Thread Sascha Hauer
From: Ahmad Fatoum We already have one implementation of list.h, so we do not need to replicate it of Kconfig specially. Make use of scripts/include for all host tools to align us with what Linux is doing. Signed-off-by: Ahmad Fatoum --- Makefile | 6 ++- scripts/Makefile

[PATCH] hush: fix last_return_code when PROMPT_COMMAND is used

2025-09-17 Thread Sascha Hauer
Wenn PROMPT_COMMAND is used then a "echo $?" shows the result of the PROMPT_COMMAND instead of the result of the last command. Fix this by restoring the previous value after PROMPT_COMMAND has been executed. Signed-off-by: Sascha Hauer --- common/hush.c | 4 1 file changed, 4 insertions(+)

Re: [PATCH] firmware: handle firmware files being links correctly

2025-09-17 Thread Sascha Hauer
On Wed, Sep 17, 2025 at 11:58:34AM +0200, Sascha Hauer wrote: > Sometimes firmware files can be links. When rebuilding barebox correctly > rebuilds the firmware when file the link points to is updated, but the > firmware is not rebuilt when the link itself is changed to link to > another file. > >

Re: [PATCH] firmware: handle firmware files being links correctly

2025-09-17 Thread Ahmad Fatoum
On 9/17/25 11:58 AM, Sascha Hauer wrote: > Sometimes firmware files can be links. When rebuilding barebox correctly > rebuilds the firmware when file the link points to is updated, but the > firmware is not rebuilt when the link itself is changed to link to > another file. This is surprising. I th

[PATCH] firmware: handle firmware files being links correctly

2025-09-17 Thread Sascha Hauer
Sometimes firmware files can be links. When rebuilding barebox correctly rebuilds the firmware when file the link points to is updated, but the firmware is not rebuilt when the link itself is changed to link to another file. Fix this by including the sha256sum directly in the generated assembly fi

[PATCH] riscv: dma: rename dma_ops to dma_map_ops.

2025-09-17 Thread chalianis1
From: Chali Anis rename dma_ops to dma_map_ops for more consistence. Signed-off-by: Chali Anis --- arch/riscv/cpu/dma.c | 6 +++--- arch/riscv/include/asm/dma.h | 4 ++-- drivers/soc/starfive/jh7100_dma.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/