[PATCH v2 2/3] startup: don't clobber original autoboot state

2020-04-22 Thread Ahmad Fatoum
do_autoboot_countdown changes autoboot state if the user presses m for menu or ctrl+c to abort during count down. This is an internal detail and doesn't need to be reflected in the state of the global variable. This will improve UX when exporting the variable in the follow-up commit, because on a

[PATCH v2 1/3] startup: rename AUTOBOOT_UNKNOWN to more descriptive AUTOBOOT_COUNTDOWN

2020-04-22 Thread Ahmad Fatoum
If we export the autoboot state variable for customization, having unknown as default is not so helpful. Rename it to what actually happens (abortable countdown). Signed-off-by: Ahmad Fatoum --- v1 -> v2: * New commit --- common/startup.c | 4 ++-- include/common.h | 2 +- 2 files changed, 3

[PATCH v2 3/3] startup: add $global.autoboot to make behavior configurable

2020-04-22 Thread Ahmad Fatoum
We already have a global_autoboot_state variable that controls barebox init behavior on startup: * ABORT abort and fall into shell * MENU display boot menu * BOOT boot immediately, only abortable via ctrl+c during init * COUNTDOWN regular boot after count down

[PATCH] kconfig: update to Linux 5.7-rc2

2020-04-22 Thread Masahiro Yamada
The previous sync was Linux 5.5. This updates Kconfig to Linux 5.7-rc2. Highlights: - add yes2modconfig and mod2yesconfig, which are useful for coping with syzbot configs in Linux - remove include/config/tristate.conf - show more precise help - fix various issues of 'make xconfig'

Re: [PATCH 19/19] poller: Allow to run pollers inside of pollers

2020-04-22 Thread Sascha Hauer
Hi Daniel, On Tue, Apr 07, 2020 at 09:28:26PM +0200, Daniel Glöckner wrote: > Hello Sascha, > > Am 03/16/20 um 09:04 schrieb Sascha Hauer: > > On Thu, Mar 12, 2020 at 11:36:15PM +0100, Daniel Glöckner wrote: > >> On Thu, Mar 12, 2020 at 09:35:55AM +0100, Sascha Hauer wrote: > >>> This adds a

[PATCH 06/11] usb: Add a slice to usb host controllers

2020-04-22 Thread Sascha Hauer
Signed-off-by: Sascha Hauer --- drivers/usb/core/usb.c | 6 ++ include/usb/usb.h | 7 +++ 2 files changed, 13 insertions(+) diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index d0a91b9e9f..db86ab4d19 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c @@

[PATCH 08/11] net: Call net_poll() in a poller

2020-04-22 Thread Sascha Hauer
This patch moves the ethernet receive loop into a poller. With this network protocols no longer have to call net_loop() explicitly but can do it implicitly by calling is_timeout() when waiting for packets. Having the network receive loop running in a poller has the advantage that we have it

[PATCH 02/11] poller: Add a poller command

2020-04-22 Thread Sascha Hauer
The poller command allows to print which pollers are registered and also how many times we can run the registered pollers in one second. Signed-off-by: Sascha Hauer --- commands/Kconfig | 9 ++ common/poller.c | 71 2 files changed, 80

[PATCH 03/11] Introduce slices

2020-04-22 Thread Sascha Hauer
slices, the barebox idea of locking barebox has pollers which execute code in the background whenever one of the delay functions (udelay, mdelay, ...) or is_timeout() are called. This introduces resource problems when some device triggers a poller by calling a delay function and then the poller

[PATCH 04/11] net: Add a slice to struct eth_device

2020-04-22 Thread Sascha Hauer
Add ethernet code safe for being called from a poller. Signed-off-by: Sascha Hauer --- include/net.h | 8 net/eth.c | 20 +--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/include/net.h b/include/net.h index 54db8a179a..8d2b4923de 100644 ---

[PATCH 09/11] net: reply to ping requests

2020-04-22 Thread Sascha Hauer
Now that we have the network receive function running in a poller we can reasonably well answer to ping requests. Implement this feature. Signed-off-by: Sascha Hauer --- net/net.c | 46 -- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git

[PATCH v4 00/11] Protect code from pollers

2020-04-22 Thread Sascha Hauer
Changes since v3: - Rebased on current master (v2020.04.0+) Changes since v2: - Use a const char * as name argument and not a struct device_d. A name is more universally available - Also give pollers names for better debugability - Add a poller command to show information about registered

[PATCH 01/11] poller: Give pollers a name

2020-04-22 Thread Sascha Hauer
It helps debugging when pollers have a name, so give them one. Signed-off-by: Sascha Hauer --- common/poller.c| 8 +--- common/ratp/ratp.c | 2 +- drivers/input/gpio_keys.c | 2 +- drivers/input/imx_keypad.c | 2 +- drivers/input/input.c | 2 +-

[PATCH 10/11] usbnet: Be more friendly in the receive path

2020-04-22 Thread Sascha Hauer
To recognize if we have a receive packet pending we must set up a USB bulk transfer. When there's no incoming packet we must wait until the transfer times out. We do this with every poller call which can considerably slow down the system. With this patch we do two things against this: - lower the

[PATCH v2 3/4] kbuild: support ccflags-y, asflags-y, cppflags-y, and ldflags-y

2020-04-22 Thread Masahiro Yamada
Some Makefiles use ccflags-y, but it is not actually supported. Support ccflags-y, asflags-y, cppflags-y, and ldflags-y like Linux. Remove the workaround in drivers/pci/Makefile. Signed-off-by: Masahiro Yamada --- Changes in v2: - add ldflags-y drivers/pci/Makefile | 2 --

Re: [PATCH] startup: add $global.autoboot to make behavior configurable

2020-04-22 Thread Ahmad Fatoum
Hi, On 4/20/20 4:08 PM, Sascha Hauer wrote: >> +globalvar_add_simple_enum("autoboot", >> + _state, >> + autoboot_states, >> + ARRAY_SIZE(autoboot_states)); > > Please add a MAGICVAR description for this.

[PATCH 05/11] net: mdiobus: Add slice

2020-04-22 Thread Sascha Hauer
By adding a slice to the mdio bus we make the mdio code safe for being called in a poller. Signed-off-by: Sascha Hauer --- drivers/net/phy/mdio_bus.c | 41 ++ include/linux/phy.h| 38 ++- 2 files changed, 56

[PATCH 11/11] poller: Allow to run pollers inside of pollers

2020-04-22 Thread Sascha Hauer
This adds a slice to each poller which is acquired before the poller is executed. This allows us to run pollers inside of other pollers. Signed-off-by: Sascha Hauer --- common/poller.c | 15 +++ include/poller.h | 2 ++ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git

[PATCH 07/11] usbnet: Add slice

2020-04-22 Thread Sascha Hauer
Both the ethernet device and the mdio bus of a USB network controller need the USB bus. Add dependencies to it. Signed-off-by: Sascha Hauer --- drivers/net/usb/usbnet.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index

Re: [PATCH 1/2] kbuild: support ccflags-y, asflags-y, and cppflags-y

2020-04-22 Thread Sascha Hauer
On Thu, Apr 16, 2020 at 03:39:45AM +0900, Masahiro Yamada wrote: > Some Makefiles use ccflags-y, but it is not actually supported. > Support ccflags-y, asflags-y, and cppflags-y now. > > Remove the workaround in drivers/pci/Makefile. > > I did not add ldflags-y for now because arch/mips/Makefile

[PATCH v2 1/4] riscv: remove meaningless LDFLAGS addition

2020-04-22 Thread Masahiro Yamada
No one sets ldflags-y. This line is meaningless. Signed-off-by: Masahiro Yamada --- Changes in v2: - new patch arch/riscv/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile index fa8a173d8..b71a52ad1 100644 --- a/arch/riscv/Makefile +++

[PATCH v2 2/4] mips: rename ldflags-y to mips-ldflags-y

2020-04-22 Thread Masahiro Yamada
The next commit will add ldflags-y to scripts/Makefile.lib like Linux, but barebox includes scripts/Makefile.lib from the top Makefile. arch/mips/Makefile uses ldflags-y for a different meaning. To avoid unpleasant side-effect, this commit rename it. Signed-off-by: Masahiro Yamada --- Changes

[PATCH v2 4/4] kbuild: prefix compiler flag variables with KBUILD_

2020-04-22 Thread Masahiro Yamada
In old days, Linux also used to use well-known variables such CFLAGS, CPPFLAGS, etc. They were prefixed with KBUILD_ presumably for preventing users from overriding them accidentally. Rename as follows: CFLAGS -> KBUILD_CFLAGS AFLAGS -> KBUILD_AFLAGS CPPFLAGS->

Re: [PATCH] Documentation: kvx: add first documentation

2020-04-22 Thread Sascha Hauer
On Tue, Apr 21, 2020 at 09:38:59AM +0200, Clement Leger wrote: > Add documentation on kvx architecture and kalray k200 board. > > Signed-off-by: Clement Leger > --- Very nice, thanks. Applied to master. Sascha -- Pengutronix e.K. | |

[PATCH] mach-imx: hab: Unlock CAAM MID for OP-TEE

2020-04-22 Thread Albert Schwarzkopf
The current CSF config used by barebox does not allow a successful bootup of OP-TEE within a closed HAB configuration. As specified in section 2.1 of the application notes [1], OP-TEE requires that the "UNLOCK MID" HAB command is present in the CSF file for this case. This patch adds the

[PATCH 2/6] common: elf: fix warning on 32 bits architectures

2020-04-22 Thread Clement Leger
When pointers are 32 bits wide and we cast a potentially 64 bits value in it, the compiler will yield an error. Cast that value first into a phys_addr_t to match the architecture pointer size and then in a void *. Signed-off-by: Clement Leger --- common/elf.c | 2 +- 1 file changed, 1

[PATCH 1/6] common: elf: add computation of elf boundaries

2020-04-22 Thread Clement Leger
In order to correctly load an initrd or a device tree after an elf file, we need to know its boundaries. This commit adds support for that and allow the bootm implementations to use it for memory loading. Signed-off-by: Clement Leger --- common/elf.c | 7 +++ include/elf.h | 2 ++ 2 files

[PATCH 5/6] common: bootm: add support for elf file loading

2020-04-22 Thread Clement Leger
This will allows elf loader to directly have an elf file available. Thus filetype_elf bootm handlers will be able to use this elf file directly. Signed-off-by: Clement Leger --- common/bootm.c | 27 +++ include/bootm.h | 3 +++ 2 files changed, 30 insertions(+) diff

[PATCH 3/6] common: elf: split init to be reused from other function

2020-04-22 Thread Clement Leger
New elf_open function will also need to initialize an elf file. Split this to avoid missing members initialization. Signed-off-by: Clement Leger --- common/elf.c | 19 +-- 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/common/elf.c b/common/elf.c index

[PATCH 0/6] elf: add better bootm support

2020-04-22 Thread Clement Leger
Currently, when booting an elf file using bootm /dev/mtdx, bootm will simply pass the file to the bootm and the read done on it will read the entire flash partition. This series starts by some cleanup and then add an elf_open function to load the elf size only based on the elf header. A special

[PATCH 4/6] common: elf: add elf_open and elf_close

2020-04-22 Thread Clement Leger
When loading an elf file from a mtd device, this allows to parse the header and load only the needed data according to the elf size. Without that support, loading a elf file from a /dev/mtd would try to read the entire partition. Signed-off-by: Clement Leger --- common/elf.c | 87

[PATCH 6/6] mips: lib: bootm: use new data->elf member

2020-04-22 Thread Clement Leger
Now that the elf file is loaded by the bootm core, use this field directly instead of manually loading the elf file. Signed-off-by: Clement Leger --- arch/mips/lib/bootm.c | 13 ++--- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/arch/mips/lib/bootm.c

[PATCH] common: bootm: Enforce CONFIG_BOOTM_FORCE_SIGNED_IMAGES for TEE bins

2020-04-22 Thread Albert Schwarzkopf
Currently, unsigned TEE binaries can be booted. This patch ensures that CONFIG_BOOTM_FORCE_SIGNED_IMAGES is also enforced for TEE binaries. Signed-off-by: Albert Schwarzkopf --- common/bootm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/common/bootm.c b/common/bootm.c index

Re: [PATCH] mach-imx: hab: Unlock CAAM MID for OP-TEE

2020-04-22 Thread Rouven Czerwinski
Hi, On Wed, 2020-04-22 at 13:44 +0200, Albert Schwarzkopf wrote: > The current CSF config used by barebox does not allow a successful > bootup of OP-TEE within a closed HAB configuration. As specified > in section 2.1 of the application notes [1], OP-TEE requires that > the "UNLOCK MID" HAB