Add SIMATIC IOT2050 board support
Subsystems (3)
v2 cover Add SIMATIC IOT2050 board support
This is the baseline support for the SIMATIC IOT2050 devices.
Changes in v2:
- rebased
- sync with upstream-accepted DT
- add boot switch
- include watchdog support
Allows to boot mainline 5.10 kernels, but not the original BSP-derived kernel we currently ship as reference. This is due to the TI sysfw ABI breakages between 2.x and 3.x. We will soon provide a transitional kernel that allows booting both firmware ABIs - as long as full upstream kernel support is work in progress.
Note that this baseline support lacks Ethernet drivers. We are working closely with TI to ensure that the to-be-upstreamed icssg-prueth driver will work both with new SR2.0 AM65x silicon as well as with SR1.0 which is used in the currently shipped IOT2050 devices.
A staging tree for complete IOT2050 support can be found at [1]. Full image integration is available via [2].
Regarding patch 4: There has been some doubts on the proposed approach, but there has been also no suggestion provided for a similarly lightweight and secure embedding method. Therefore, I'm proposing our solution once again.
Jan
[1] https://github.com/siemens/u-boot/commits/jan/iot2050
[2] https://github.com/siemens/meta-iot2050
Jan Kiszka (5):
arm: dts: Add IOT2050 device tree files
board: siemens: Add support for SIMATIC IOT2050 devices
arm64: dts: ti: k3-am65-mcu: Add RTI watchdog entry
watchdog: rti_wdt: Add support for loading firmware
configs: iot2050: Enable watchdog support, but do not auto-start it
arch/arm/dts/Makefile | 7 +- arch/arm/dts/k3-am65-iot2050-boot-image.dtsi | 105 +++ .../dts/k3-am65-iot2050-common-u-boot.dtsi | 103 +++ arch/arm/dts/k3-am65-iot2050-common.dtsi | 655 ++++++++++++++++++ arch/arm/dts/k3-am65-iot2050-spl.dts | 16 + arch/arm/dts/k3-am65-mcu.dtsi | 9 + arch/arm/dts/k3-am6528-iot2050-basic.dts | 67 ++ arch/arm/dts/k3-am6548-iot2050-advanced.dts | 66 ++ arch/arm/mach-k3/Kconfig | 1 + board/siemens/iot2050/Kconfig | 32 + board/siemens/iot2050/MAINTAINERS | 8 + board/siemens/iot2050/Makefile | 10 + board/siemens/iot2050/README | 65 ++ board/siemens/iot2050/board.c | 278 ++++++++ board/siemens/iot2050/config.mk | 8 + configs/iot2050_defconfig | 146 ++++ drivers/watchdog/Kconfig | 20 + drivers/watchdog/Makefile | 5 + drivers/watchdog/rti_wdt.c | 58 +- drivers/watchdog/rti_wdt_fw.S | 20 + include/configs/iot2050.h | 60 ++ 21 files changed, 1737 insertions(+), 2 deletions(-) create mode 100644 arch/arm/dts/k3-am65-iot2050-boot-image.dtsi create mode 100644 arch/arm/dts/k3-am65-iot2050-common-u-boot.dtsi create mode 100644 arch/arm/dts/k3-am65-iot2050-common.dtsi create mode 100644 arch/arm/dts/k3-am65-iot2050-spl.dts create mode 100644 arch/arm/dts/k3-am6528-iot2050-basic.dts create mode 100644 arch/arm/dts/k3-am6548-iot2050-advanced.dts create mode 100644 board/siemens/iot2050/Kconfig create mode 100644 board/siemens/iot2050/MAINTAINERS create mode 100644 board/siemens/iot2050/Makefile create mode 100644 board/siemens/iot2050/README create mode 100644 board/siemens/iot2050/board.c create mode 100644 board/siemens/iot2050/config.mk create mode 100644 configs/iot2050_defconfig create mode 100644 drivers/watchdog/rti_wdt_fw.S create mode 100644 include/configs/iot2050.h
Signature · 1 line
2.26.2
PATCH v2 1/5 arm: dts: Add IOT2050 device tree files
From: Jan Kiszka <[email protected]>
Prepares for the addition of the IOT2050 board which is based on the TI AM65x. The board comes in two variants, Basic and Advanced, so there are separate dts files. Furthermore, the SPL has its own device tree.
Based on original board support by Le Jin, Gao Nian and Chao Zeng.
--- arch/arm/dts/Makefile | 7 +- arch/arm/dts/k3-am65-iot2050-boot-image.dtsi | 105 +++ .../dts/k3-am65-iot2050-common-u-boot.dtsi | 103 +++ arch/arm/dts/k3-am65-iot2050-common.dtsi | 655 ++++++++++++++++++ arch/arm/dts/k3-am65-iot2050-spl.dts | 16 + arch/arm/dts/k3-am6528-iot2050-basic.dts | 67 ++ arch/arm/dts/k3-am6548-iot2050-advanced.dts | 66 ++ 7 files changed, 1018 insertions(+), 1 deletion(-) create mode 100644 arch/arm/dts/k3-am65-iot2050-boot-image.dtsi create mode 100644 arch/arm/dts/k3-am65-iot2050-common-u-boot.dtsi create mode 100644 arch/arm/dts/k3-am65-iot2050-common.dtsi create mode 100644 arch/arm/dts/k3-am65-iot2050-spl.dts create mode 100644 arch/arm/dts/k3-am6528-iot2050-basic.dts create mode 100644 arch/arm/dts/k3-am6548-iot2050-advanced.dts
arch/arm/dts/Makefile +6 -1
@@ -1065,7 +1065,12 @@ dtb-$(CONFIG_STM32MP15x) += \ stm32mp15xx-dhcom-picoitx.dtb \ stm32mp15xx-dhcor-avenger96.dtb -dtb-$(CONFIG_SOC_K3_AM6) += k3-am654-base-board.dtb k3-am654-r5-base-board.dtb +dtb-$(CONFIG_SOC_K3_AM6) += \ + k3-am654-base-board.dtb \ + k3-am654-r5-base-board.dtb \ + k3-am65-iot2050-spl.dtb \ + k3-am6528-iot2050-basic.dtb \ + k3-am6548-iot2050-advanced.dtb dtb-$(CONFIG_SOC_K3_J721E) += k3-j721e-common-proc-board.dtb \ k3-j721e-r5-common-proc-board.dtb \ k3-j7200-common-proc-board.dtb \
arch/arm/dts/k3-am65-iot2050-boot-image.dtsi new file +105 -0
105 lines not on this page · raw message
arch/arm/dts/k3-am65-iot2050-common-u-boot.dtsi new file +103 -0
103 lines not on this page · raw message
arch/arm/dts/k3-am65-iot2050-common.dtsi new file +655 -0
655 lines not on this page · raw message
arch/arm/dts/k3-am65-iot2050-spl.dts new file +16 -0
@@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) Siemens AG, 2018-2021 + * + * Authors: + * Jan Kiszka <[email protected]> + */ + +/dts-v1/; + +#include "k3-am65-iot2050-common-u-boot.dtsi" + +/ { + compatible = "siemens,iot2050", "ti,am654"; + model = "Siemens IOT2050"; +};
arch/arm/dts/k3-am6528-iot2050-basic.dts new file +67 -0
67 lines not on this page · raw message
arch/arm/dts/k3-am6548-iot2050-advanced.dts new file +66 -0
66 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH v2 2/5 board: siemens: Add support for SIMATIC IOT2050 devices
In reply to Jan KiszkaFrom: Jan Kiszka <[email protected]>
This adds support for the IOT2050 Basic and Advanced devices. The Basic used the dual-core AM6528 GP processor, the Advanced one the AM6548 HS quad-core version.
Both variants are booted via a Siemens-provided FSBL that runs on the R5 cores. Consequently, U-Boot support is targeting the A53 cores. U-Boot SPL, ATF and TEE have to reside in SPI flash.
Full integration into a bootable image can be found on
https://github.com/siemens/meta-iot2050
Based on original board support by Le Jin, Gao Nian and Chao Zeng.
--- arch/arm/mach-k3/Kconfig | 1 + board/siemens/iot2050/Kconfig | 32 ++++ board/siemens/iot2050/MAINTAINERS | 8 + board/siemens/iot2050/Makefile | 10 ++ board/siemens/iot2050/README | 65 +++++++ board/siemens/iot2050/board.c | 278 ++++++++++++++++++++++++++++++ board/siemens/iot2050/config.mk | 8 + configs/iot2050_defconfig | 140 +++++++++++++++ include/configs/iot2050.h | 60 +++++++ 9 files changed, 602 insertions(+) create mode 100644 board/siemens/iot2050/Kconfig create mode 100644 board/siemens/iot2050/MAINTAINERS create mode 100644 board/siemens/iot2050/Makefile create mode 100644 board/siemens/iot2050/README create mode 100644 board/siemens/iot2050/board.c create mode 100644 board/siemens/iot2050/config.mk create mode 100644 configs/iot2050_defconfig create mode 100644 include/configs/iot2050.h
arch/arm/mach-k3/Kconfig +1 -0
@@ -150,4 +150,5 @@ config SYS_K3_SPL_ATF source "board/ti/am65x/Kconfig" source "board/ti/am64x/Kconfig" source "board/ti/j721e/Kconfig" +source "board/siemens/iot2050/Kconfig" endif
board/siemens/iot2050/Kconfig new file +32 -0
@@ -0,0 +1,32 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (c) Siemens AG, 2018-2021 +# +# Authors: +# Le Jin <[email protected]> +# Jan Kiszka <[email protected]> + +config TARGET_IOT2050_A53 + bool "IOT2050 running on A53" + select ARM64 + select SOC_K3_AM6 + select BOARD_LATE_INIT + select SYS_DISABLE_DCACHE_OPS + select BINMAN + +if TARGET_IOT2050_A53 + +config SYS_BOARD + default "iot2050" + +config SYS_VENDOR + default "siemens" + +config SYS_CONFIG_NAME + default "iot2050" + +config IOT2050_BOOT_SWITCH + bool "Disable eMMC boot via USER button (Advanced version only)" + default y + +endif
board/siemens/iot2050/MAINTAINERS new file +8 -0
@@ -0,0 +1,8 @@ +IOT2050 BOARD +M: Le Jin <[email protected]> +M: Jan Kiszka <[email protected]> +S: Maintained +F: board/siemens/iot2050/ +F: include/configs/iot2050.h +F: configs/iot2050_defconfig +F: arch/arm/dts/iot2050-*
board/siemens/iot2050/Makefile new file +10 -0
@@ -0,0 +1,10 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Makefile for Siemens IOT2050 board +# Copyright (c) Siemens AG, 2018-2021 +# +# Authors: +# Le Jin <[email protected]> +# + +obj-y += board.o
board/siemens/iot2050/README new file +65 -0
65 lines not on this page · raw message
board/siemens/iot2050/board.c new file +278 -0
278 lines not on this page · raw message
board/siemens/iot2050/config.mk new file +8 -0
@@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (c) Siemens AG, 2020-2021 +# +# Authors: +# Jan Kiszka <[email protected]> + +flash.bin: all
configs/iot2050_defconfig new file +140 -0
140 lines not on this page · raw message
include/configs/iot2050.h new file +60 -0
60 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH v2 3/5 arm64: dts: ti: k3-am65-mcu: Add RTI watchdog entry
In reply to Jan KiszkaFrom: Jan Kiszka <[email protected]>
Add the DT entry for a watchdog based on RTI1. It requires additional firmware on the MCU R5F cores to handle the expiry, e.g.
https://github.com/siemens/k3-rti-wdt. As this firmware will also lock the power domain to protect it against premature shutdown, mark it shared.
Aligns us to the kernel's DT in this regard.
--- arch/arm/dts/k3-am65-mcu.dtsi | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/arm/dts/k3-am65-mcu.dtsi +9 -0
@@ -308,4 +308,13 @@ ti,loczrama = <1>; }; }; + + mcu_rti1: rti@40610000 { + compatible = "ti,j7-rti-wdt"; + reg = <0x0 0x40610000 0x0 0x100>; + clocks = <&k3_clks 135 0>; + power-domains = <&k3_pds 135 TI_SCI_PD_SHARED>; + assigned-clocks = <&k3_clks 135 0>; + assigned-clock-parents = <&k3_clks 135 4>; + }; };
Signature · 1 line
2.26.2
PATCH v2 4/5 watchdog: rti_wdt: Add support for loading firmware
In reply to Jan KiszkaFrom: Jan Kiszka <[email protected]>
To avoid the need of extra boot scripting on AM65x for loading a watchdog firmware, add the required rproc init and loading logic for the first R5F core to the watchdog start handler. In case the R5F cluster is in lock-step mode, also initialize the second core. The firmware itself is embedded into U-Boot binary to ease access to it and ensure it is properly hashed in case of secure boot.
One possible firmware source is https://github.com/siemens/k3-rti-wdt.
--- drivers/watchdog/Kconfig | 20 ++++++++++++ drivers/watchdog/Makefile | 5 +++ drivers/watchdog/rti_wdt.c | 58 ++++++++++++++++++++++++++++++++++- drivers/watchdog/rti_wdt_fw.S | 20 ++++++++++++ 4 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 drivers/watchdog/rti_wdt_fw.S
drivers/watchdog/Kconfig +20 -0
@@ -209,6 +209,26 @@ config WDT_K3_RTI Say Y here if you want to include support for the K3 watchdog timer (RTI module) available in the K3 generation of processors. +if WDT_K3_RTI + +config WDT_K3_RTI_LOAD_FW + bool "Load watchdog firmware" + depends on REMOTEPROC + help + Automatically load the specified firmware image into the MCU R5F + core 0. On the AM65x, this firmware is supposed to handle the expiry + of the watchdog timer, typically by resetting the system. + +config WDT_K3_RTI_FW_FILE + string "Watchdog firmware image file" + default "k3-rti-wdt.fw" + depends on WDT_K3_RTI_LOAD_FW + help + Firmware image to be embedded into U-Boot and loaded on watchdog + start. + +endif + config WDT_SANDBOX bool "Enable Watchdog Timer support for Sandbox" depends on SANDBOX && WDT
drivers/watchdog/Makefile +5 -0
@@ -33,7 +33,12 @@ obj-$(CONFIG_WDT_OCTEONTX) += octeontx_wdt.o obj-$(CONFIG_WDT_OMAP3) += omap_wdt.o obj-$(CONFIG_WDT_SBSA) += sbsa_gwdt.o obj-$(CONFIG_WDT_K3_RTI) += rti_wdt.o +obj-$(CONFIG_WDT_K3_RTI_LOAD_FW) += rti_wdt_fw.o obj-$(CONFIG_WDT_SP805) += sp805_wdt.o obj-$(CONFIG_WDT_STM32MP) += stm32mp_wdt.o obj-$(CONFIG_WDT_TANGIER) += tangier_wdt.o obj-$(CONFIG_WDT_XILINX) += xilinx_wwdt.o + +ifeq ($(CONFIG_WDT_K3_RTI_LOAD_FW),y) +$(obj)/rti_wdt_fw.o: $(shell readlink -f $(CONFIG_WDT_K3_RTI_FW_FILE)) FORCE +endif
drivers/watchdog/rti_wdt.c +57 -1
81 lines not on this page · raw message
drivers/watchdog/rti_wdt_fw.S new file +20 -0
@@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (c) Siemens AG, 2020 + * + * Authors: + * Jan Kiszka <[email protected]> + */ + +.section .rodata + +.global rti_wdt_fw +.global rti_wdt_fw_size + +rti_wdt_fw: +.align 4 +.incbin CONFIG_WDT_K3_RTI_FW_FILE +rti_wdt_fw_end: + +rti_wdt_fw_size: +.int rti_wdt_fw_end - rti_wdt_fw
Signature · 1 line
2.26.2
Re: [PATCH v2 4/5] watchdog: rti_wdt: Add support for loading firmware
+Tom,
Hi Tom,
Quoted 35 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
To avoid the need of extra boot scripting on AM65x for loading a watchdog firmware, add the required rproc init and loading logic for the first R5F core to the watchdog start handler. In case the R5F cluster is in lock-step mode, also initialize the second core. The firmware itself is embedded into U-Boot binary to ease access to it and ensure it is properly hashed in case of secure boot.
One possible firmware source is https://github.com/siemens/k3-rti-wdt.
Signed-off-by Jan Kiszka <[email protected]>--- drivers/watchdog/Kconfig | 20 ++++++++++++ drivers/watchdog/Makefile | 5 +++ drivers/watchdog/rti_wdt.c | 58 ++++++++++++++++++++++++++++++++++- drivers/watchdog/rti_wdt_fw.S | 20 ++++++++++++ 4 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 drivers/watchdog/rti_wdt_fw.Sdrivers/watchdog/Kconfig +7
-0@@ -209,6 +209,26 @@ config WDT_K3_RTI Say Y here if you want to include support for the K3 watchdog timer (RTI module) available in the K3 generation of processors. +if WDT_K3_RTI + +config WDT_K3_RTI_LOAD_FW + bool "Load watchdog firmware" + depends on REMOTEPROC + help + Automatically load the specified firmware image into the MCU R5F
drivers/watchdog/Kconfig config WDT_K3_RTI · line 228
Quoted 10 lines
drivers/watchdog/Kconfig +10
-0+ core 0. On the AM65x, this firmware is supposed to handle the expiry + of the watchdog timer, typically by resetting the system. + +config WDT_K3_RTI_FW_FILE + string "Watchdog firmware image file" + default "k3-rti-wdt.fw" + depends on WDT_K3_RTI_LOAD_FW + help + Firmware image to be embedded into U-Boot and loaded on watchdog + start.
I need your input on this proach. Is it okay to include the linker file unders drivers?
Quoted 20 lines
drivers/watchdog/Kconfig +3
-0+ +endif + config WDT_SANDBOX bool "Enable Watchdog Timer support for Sandbox" depends on SANDBOX && WDTdrivers/watchdog/Makefile +2
-0@@ -33,7 +33,12 @@ obj-$(CONFIG_WDT_OCTEONTX) += octeontx_wdt.o obj-$(CONFIG_WDT_OMAP3) += omap_wdt.o obj-$(CONFIG_WDT_SBSA) += sbsa_gwdt.o obj-$(CONFIG_WDT_K3_RTI) += rti_wdt.o +obj-$(CONFIG_WDT_K3_RTI_LOAD_FW) += rti_wdt_fw.o obj-$(CONFIG_WDT_SP805) += sp805_wdt.o obj-$(CONFIG_WDT_STM32MP) += stm32mp_wdt.o obj-$(CONFIG_WDT_TANGIER) += tangier_wdt.o obj-$(CONFIG_WDT_XILINX) += xilinx_wwdt.o +
[...snip..]
drivers/watchdog/rti_wdt_fw.S
Quoted 8 lines
drivers/watchdog/Makefile +0
-0timer_margin = timeout_ms * priv->clk_khz / 1000; timer_margin >>= WDT_PRELOAD_SHIFT; if (timer_margin > WDT_PRELOAD_MAX)drivers/watchdog/rti_wdt_fw.S new file +0
-0
Isn't this usecase specific? IMHO, drivers might not be the right place. Did I misunderstand something?
Thanks and regards,
Lokesh
Quoted 22 lines
drivers/watchdog/rti_wdt_fw.S new file +20
-0@@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (c) Siemens AG, 2020 + * + * Authors: + * Jan Kiszka <[email protected]> + */ + +.section .rodata + +.global rti_wdt_fw +.global rti_wdt_fw_size + +rti_wdt_fw: +.align 4 +.incbin CONFIG_WDT_K3_RTI_FW_FILE +rti_wdt_fw_end: + +rti_wdt_fw_size: +.int rti_wdt_fw_end - rti_wdt_fw
Re: [PATCH v2 4/5] watchdog: rti_wdt: Add support for loading firmware
Quoted 77 lines · Lokesh Vutla
+Tom,
Hi Tom,
Quoted 35 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
To avoid the need of extra boot scripting on AM65x for loading a watchdog firmware, add the required rproc init and loading logic for the first R5F core to the watchdog start handler. In case the R5F cluster is in lock-step mode, also initialize the second core. The firmware itself is embedded into U-Boot binary to ease access to it and ensure it is properly hashed in case of secure boot.
One possible firmware source is https://github.com/siemens/k3-rti-wdt.
Signed-off-by Jan Kiszka <[email protected]>--- drivers/watchdog/Kconfig | 20 ++++++++++++ drivers/watchdog/Makefile | 5 +++ drivers/watchdog/rti_wdt.c | 58 ++++++++++++++++++++++++++++++++++- drivers/watchdog/rti_wdt_fw.S | 20 ++++++++++++ 4 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 drivers/watchdog/rti_wdt_fw.Sdrivers/watchdog/Kconfig +7
-0@@ -209,6 +209,26 @@ config WDT_K3_RTI Say Y here if you want to include support for the K3 watchdog timer (RTI module) available in the K3 generation of processors. +if WDT_K3_RTI + +config WDT_K3_RTI_LOAD_FW + bool "Load watchdog firmware" + depends on REMOTEPROC + help + Automatically load the specified firmware image into the MCU R5Fdrivers/watchdog/Kconfig config WDT_K3_RTI · line 228
Quoted 10 lines
drivers/watchdog/Kconfig +10
-0+ core 0. On the AM65x, this firmware is supposed to handle the expiry + of the watchdog timer, typically by resetting the system. + +config WDT_K3_RTI_FW_FILE + string "Watchdog firmware image file" + default "k3-rti-wdt.fw" + depends on WDT_K3_RTI_LOAD_FW + help + Firmware image to be embedded into U-Boot and loaded on watchdog + start.I need your input on this proach. Is it okay to include the linker file unders drivers?
Quoted 20 lines
drivers/watchdog/Kconfig +3
-0+ +endif + config WDT_SANDBOX bool "Enable Watchdog Timer support for Sandbox" depends on SANDBOX && WDTdrivers/watchdog/Makefile +2
-0@@ -33,7 +33,12 @@ obj-$(CONFIG_WDT_OCTEONTX) += octeontx_wdt.o obj-$(CONFIG_WDT_OMAP3) += omap_wdt.o obj-$(CONFIG_WDT_SBSA) += sbsa_gwdt.o obj-$(CONFIG_WDT_K3_RTI) += rti_wdt.o +obj-$(CONFIG_WDT_K3_RTI_LOAD_FW) += rti_wdt_fw.o obj-$(CONFIG_WDT_SP805) += sp805_wdt.o obj-$(CONFIG_WDT_STM32MP) += stm32mp_wdt.o obj-$(CONFIG_WDT_TANGIER) += tangier_wdt.o obj-$(CONFIG_WDT_XILINX) += xilinx_wwdt.o +[...snip..]
Quoted 12 lines
drivers/watchdog/rti_wdt_fw.S
Quoted 8 lines
drivers/watchdog/Makefile +0
-0timer_margin = timeout_ms * priv->clk_khz / 1000; timer_margin >>= WDT_PRELOAD_SHIFT; if (timer_margin > WDT_PRELOAD_MAX)drivers/watchdog/rti_wdt_fw.S new file +0
-0Isn't this usecase specific? IMHO, drivers might not be the right place. Did I misunderstand something?
It's specific to this driver - on a subset of supported hardware platforms, namely AM65x SR1.0.
Jan
Signature · 2 lines
Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux
Re: [PATCH v2 4/5] watchdog: rti_wdt: Add support for loading firmware
In reply to Lokesh VutlaQuoted 45 lines · Lokesh Vutla
+Tom,
Hi Tom,
Quoted 40 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
To avoid the need of extra boot scripting on AM65x for loading a watchdog firmware, add the required rproc init and loading logic for the first R5F core to the watchdog start handler. In case the R5F cluster is in lock-step mode, also initialize the second core. The firmware itself is embedded into U-Boot binary to ease access to it and ensure it is properly hashed in case of secure boot.
One possible firmware source is https://github.com/siemens/k3-rti-wdt.
Signed-off-by Jan Kiszka <[email protected]>--- drivers/watchdog/Kconfig | 20 ++++++++++++ drivers/watchdog/Makefile | 5 +++ drivers/watchdog/rti_wdt.c | 58 ++++++++++++++++++++++++++++++++++- drivers/watchdog/rti_wdt_fw.S | 20 ++++++++++++ 4 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 drivers/watchdog/rti_wdt_fw.Sdrivers/watchdog/Kconfig +12
-0@@ -209,6 +209,26 @@ config WDT_K3_RTI Say Y here if you want to include support for the K3 watchdog timer (RTI module) available in the K3 generation of processors. +if WDT_K3_RTI + +config WDT_K3_RTI_LOAD_FW + bool "Load watchdog firmware" + depends on REMOTEPROC + help + Automatically load the specified firmware image into the MCU R5F + core 0. On the AM65x, this firmware is supposed to handle the expiry + of the watchdog timer, typically by resetting the system. + +config WDT_K3_RTI_FW_FILE + string "Watchdog firmware image file"
Quoted 8 lines
drivers/watchdog/Kconfig config WDT_K3_RTI · line 228
Quoted 5 lines
drivers/watchdog/Kconfig +5
-0+ default "k3-rti-wdt.fw" + depends on WDT_K3_RTI_LOAD_FW + help + Firmware image to be embedded into U-Boot and loaded on watchdog + start.I need your input on this proach. Is it okay to include the linker file unders drivers?
Maybe? I suppose the first thing that springs to mind is why aren't we using binman and including this blob (which I happily see is GPLv2) similar to how we do things with x86 for one example.
Signature · 1 line
Tom
Re: [PATCH v2 4/5] watchdog: rti_wdt: Add support for loading firmware
Quoted 55 lines · Tom Rini
Quoted 45 lines · Lokesh Vutla
+Tom,
Hi Tom,
Quoted 40 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
To avoid the need of extra boot scripting on AM65x for loading a watchdog firmware, add the required rproc init and loading logic for the first R5F core to the watchdog start handler. In case the R5F cluster is in lock-step mode, also initialize the second core. The firmware itself is embedded into U-Boot binary to ease access to it and ensure it is properly hashed in case of secure boot.
One possible firmware source is https://github.com/siemens/k3-rti-wdt.
Signed-off-by Jan Kiszka <[email protected]>--- drivers/watchdog/Kconfig | 20 ++++++++++++ drivers/watchdog/Makefile | 5 +++ drivers/watchdog/rti_wdt.c | 58 ++++++++++++++++++++++++++++++++++- drivers/watchdog/rti_wdt_fw.S | 20 ++++++++++++ 4 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 drivers/watchdog/rti_wdt_fw.Sdrivers/watchdog/Kconfig +12
-0@@ -209,6 +209,26 @@ config WDT_K3_RTI Say Y here if you want to include support for the K3 watchdog timer (RTI module) available in the K3 generation of processors. +if WDT_K3_RTI + +config WDT_K3_RTI_LOAD_FW + bool "Load watchdog firmware" + depends on REMOTEPROC + help + Automatically load the specified firmware image into the MCU R5F + core 0. On the AM65x, this firmware is supposed to handle the expiry + of the watchdog timer, typically by resetting the system. + +config WDT_K3_RTI_FW_FILE + string "Watchdog firmware image file"Quoted 8 lines
drivers/watchdog/Kconfig config WDT_K3_RTI · line 228
Quoted 5 lines
drivers/watchdog/Kconfig +5
-0+ default "k3-rti-wdt.fw" + depends on WDT_K3_RTI_LOAD_FW + help + Firmware image to be embedded into U-Boot and loaded on watchdog + start.I need your input on this proach. Is it okay to include the linker file unders drivers?
Quoted 4 lines
Maybe? I suppose the first thing that springs to mind is why aren't we using binman and including this blob (which I happily see is GPLv2) similar to how we do things with x86 for one example.
See https://www.mail-archive.com/[email protected]/msg377894.html
Jan
Signature · 2 lines
Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux
Re: [PATCH v2 4/5] watchdog: rti_wdt: Add support for loading firmware
Quoted 56 lines · Jan Kiszka
Quoted 55 lines · Tom Rini
Quoted 53 lines · Lokesh Vutla
+Tom,
Hi Tom,
Quoted 35 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
To avoid the need of extra boot scripting on AM65x for loading a watchdog firmware, add the required rproc init and loading logic for the first R5F core to the watchdog start handler. In case the R5F cluster is in lock-step mode, also initialize the second core. The firmware itself is embedded into U-Boot binary to ease access to it and ensure it is properly hashed in case of secure boot.
One possible firmware source is https://github.com/siemens/k3-rti-wdt.
Signed-off-by Jan Kiszka <[email protected]>--- drivers/watchdog/Kconfig | 20 ++++++++++++ drivers/watchdog/Makefile | 5 +++ drivers/watchdog/rti_wdt.c | 58 ++++++++++++++++++++++++++++++++++- drivers/watchdog/rti_wdt_fw.S | 20 ++++++++++++ 4 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 drivers/watchdog/rti_wdt_fw.Sdrivers/watchdog/Kconfig +7
-0@@ -209,6 +209,26 @@ config WDT_K3_RTI Say Y here if you want to include support for the K3 watchdog timer (RTI module) available in the K3 generation of processors. +if WDT_K3_RTI + +config WDT_K3_RTI_LOAD_FW + bool "Load watchdog firmware" + depends on REMOTEPROC + help + Automatically load the specified firmware image into the MCU R5Fdrivers/watchdog/Kconfig config WDT_K3_RTI · line 228
Quoted 10 lines
drivers/watchdog/Kconfig +10
-0+ core 0. On the AM65x, this firmware is supposed to handle the expiry + of the watchdog timer, typically by resetting the system. + +config WDT_K3_RTI_FW_FILE + string "Watchdog firmware image file" + default "k3-rti-wdt.fw" + depends on WDT_K3_RTI_LOAD_FW + help + Firmware image to be embedded into U-Boot and loaded on watchdog + start.I need your input on this proach. Is it okay to include the linker file unders drivers?
Quoted 9 lines
Quoted 4 lines
Maybe? I suppose the first thing that springs to mind is why aren't we using binman and including this blob (which I happily see is GPLv2) similar to how we do things with x86 for one example.
See https://www.mail-archive.com/[email protected]/msg377894.html
Jan
Did this help to answer open questions? Otherwise, please let me know.
I'd also like to avoid that his patch alone blocks 1-3 of the series needless - but I would also not mind getting everything in at once.
Thanks,
Jan
Signature · 2 lines
Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux
Re: [PATCH v2 4/5] watchdog: rti_wdt: Add support for loading firmware
Hi Tom,
Quoted 64 lines · Jan Kiszka
Quoted 63 lines · Jan Kiszka
Quoted 55 lines · Tom Rini
Quoted 45 lines · Lokesh Vutla
+Tom,
Hi Tom,
Quoted 40 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
To avoid the need of extra boot scripting on AM65x for loading a watchdog firmware, add the required rproc init and loading logic for the first R5F core to the watchdog start handler. In case the R5F cluster is in lock-step mode, also initialize the second core. The firmware itself is embedded into U-Boot binary to ease access to it and ensure it is properly hashed in case of secure boot.
One possible firmware source is https://github.com/siemens/k3-rti-wdt.
Signed-off-by Jan Kiszka <[email protected]>--- drivers/watchdog/Kconfig | 20 ++++++++++++ drivers/watchdog/Makefile | 5 +++ drivers/watchdog/rti_wdt.c | 58 ++++++++++++++++++++++++++++++++++- drivers/watchdog/rti_wdt_fw.S | 20 ++++++++++++ 4 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 drivers/watchdog/rti_wdt_fw.Sdrivers/watchdog/Kconfig +12
-0@@ -209,6 +209,26 @@ config WDT_K3_RTI Say Y here if you want to include support for the K3 watchdog timer (RTI module) available in the K3 generation of processors. +if WDT_K3_RTI + +config WDT_K3_RTI_LOAD_FW + bool "Load watchdog firmware" + depends on REMOTEPROC + help + Automatically load the specified firmware image into the MCU R5F + core 0. On the AM65x, this firmware is supposed to handle the expiry + of the watchdog timer, typically by resetting the system. + +config WDT_K3_RTI_FW_FILE + string "Watchdog firmware image file"Quoted 8 lines
drivers/watchdog/Kconfig config WDT_K3_RTI · line 228
Quoted 5 lines
drivers/watchdog/Kconfig +5
-0+ default "k3-rti-wdt.fw" + depends on WDT_K3_RTI_LOAD_FW + help + Firmware image to be embedded into U-Boot and loaded on watchdog + start.I need your input on this proach. Is it okay to include the linker file unders drivers?
Quoted 4 lines
Maybe? I suppose the first thing that springs to mind is why aren't we using binman and including this blob (which I happily see is GPLv2) similar to how we do things with x86 for one example.
See https://www.mail-archive.com/[email protected]/msg377894.html
Quoted 7 lines
Quoted 2 lines
Jan
Did this help to answer open questions? Otherwise, please let me know.
I'd also like to avoid that his patch alone blocks 1-3 of the series needless - but I would also not mind getting everything in at once.
Can you provide your reviewed-by if you are okay with this approach?
Thanks and regards,
Lokesh
Quoted 4 lines
Thanks,
Jan
Tom Rini
Reviewed-byRe: [PATCH v2 4/5] watchdog: rti_wdt: Add support for loading firmware
Quoted 70 lines · Lokesh Vutla
Hi Tom,
Quoted 67 lines · Jan Kiszka
Quoted 65 lines · Jan Kiszka
Quoted 55 lines · Tom Rini
Quoted 45 lines · Lokesh Vutla
+Tom,
Hi Tom,
Quoted 40 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
To avoid the need of extra boot scripting on AM65x for loading a watchdog firmware, add the required rproc init and loading logic for the first R5F core to the watchdog start handler. In case the R5F cluster is in lock-step mode, also initialize the second core. The firmware itself is embedded into U-Boot binary to ease access to it and ensure it is properly hashed in case of secure boot.
One possible firmware source is https://github.com/siemens/k3-rti-wdt.
Signed-off-by Jan Kiszka <[email protected]>--- drivers/watchdog/Kconfig | 20 ++++++++++++ drivers/watchdog/Makefile | 5 +++ drivers/watchdog/rti_wdt.c | 58 ++++++++++++++++++++++++++++++++++- drivers/watchdog/rti_wdt_fw.S | 20 ++++++++++++ 4 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 drivers/watchdog/rti_wdt_fw.Sdrivers/watchdog/Kconfig +12
-0@@ -209,6 +209,26 @@ config WDT_K3_RTI Say Y here if you want to include support for the K3 watchdog timer (RTI module) available in the K3 generation of processors. +if WDT_K3_RTI + +config WDT_K3_RTI_LOAD_FW + bool "Load watchdog firmware" + depends on REMOTEPROC + help + Automatically load the specified firmware image into the MCU R5F + core 0. On the AM65x, this firmware is supposed to handle the expiry + of the watchdog timer, typically by resetting the system. + +config WDT_K3_RTI_FW_FILE + string "Watchdog firmware image file"Quoted 8 lines
drivers/watchdog/Kconfig config WDT_K3_RTI · line 228
Quoted 5 lines
drivers/watchdog/Kconfig +5
-0+ default "k3-rti-wdt.fw" + depends on WDT_K3_RTI_LOAD_FW + help + Firmware image to be embedded into U-Boot and loaded on watchdog + start.I need your input on this proach. Is it okay to include the linker file unders drivers?
Quoted 4 lines
Maybe? I suppose the first thing that springs to mind is why aren't we using binman and including this blob (which I happily see is GPLv2) similar to how we do things with x86 for one example.
See https://www.mail-archive.com/[email protected]/msg377894.html
Jan
Quoted 6 lines
Quoted 4 lines
Did this help to answer open questions? Otherwise, please let me know.
I'd also like to avoid that his patch alone blocks 1-3 of the series needless - but I would also not mind getting everything in at once.
Can you provide your reviewed-by if you are okay with this approach?
I was kind of hoping Simon would chime in here on binman usage. So, re-re-reading the above URL, yes, fsloader wouldn't be the right choice for watchdog firmware. But I think binman_entry_find() and related could work, in general, for this case of "need firmware blob embedded in to image". That said, this isn't just any firmware blob, it's the watchdog firmware. The less reliance on other things the safer it is. That means this would be an exception to the general firmware blob loading rule and yeah, OK, we can do it this way. Sorry for the delay.
Signature · 1 line
Tom
Re: [PATCH v2 4/5] watchdog: rti_wdt: Add support for loading firmware
Hi,
Quoted 79 lines · Tom Rini
Quoted 70 lines · Lokesh Vutla
Hi Tom,
Quoted 67 lines · Jan Kiszka
Quoted 65 lines · Jan Kiszka
Quoted 55 lines · Tom Rini
Quoted 45 lines · Lokesh Vutla
+Tom,
Hi Tom,
Quoted 40 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
To avoid the need of extra boot scripting on AM65x for loading a watchdog firmware, add the required rproc init and loading logic for the first R5F core to the watchdog start handler. In case the R5F cluster is in lock-step mode, also initialize the second core. The firmware itself is embedded into U-Boot binary to ease access to it and ensure it is properly hashed in case of secure boot.
One possible firmware source is https://github.com/siemens/k3-rti-wdt.
Signed-off-by Jan Kiszka <[email protected]>--- drivers/watchdog/Kconfig | 20 ++++++++++++ drivers/watchdog/Makefile | 5 +++ drivers/watchdog/rti_wdt.c | 58 ++++++++++++++++++++++++++++++++++- drivers/watchdog/rti_wdt_fw.S | 20 ++++++++++++ 4 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 drivers/watchdog/rti_wdt_fw.Sdrivers/watchdog/Kconfig +12
-0@@ -209,6 +209,26 @@ config WDT_K3_RTI Say Y here if you want to include support for the K3 watchdog timer (RTI module) available in the K3 generation of processors. +if WDT_K3_RTI + +config WDT_K3_RTI_LOAD_FW + bool "Load watchdog firmware" + depends on REMOTEPROC + help + Automatically load the specified firmware image into the MCU R5F + core 0. On the AM65x, this firmware is supposed to handle the expiry + of the watchdog timer, typically by resetting the system. + +config WDT_K3_RTI_FW_FILE + string "Watchdog firmware image file"Quoted 8 lines
drivers/watchdog/Kconfig config WDT_K3_RTI · line 228
Quoted 5 lines
drivers/watchdog/Kconfig +5
-0+ default "k3-rti-wdt.fw" + depends on WDT_K3_RTI_LOAD_FW + help + Firmware image to be embedded into U-Boot and loaded on watchdog + start.I need your input on this proach. Is it okay to include the linker file unders drivers?
Quoted 4 lines
Maybe? I suppose the first thing that springs to mind is why aren't we using binman and including this blob (which I happily see is GPLv2) similar to how we do things with x86 for one example.
See https://www.mail-archive.com/[email protected]/msg377894.html
Jan
Quoted 6 lines
Quoted 4 lines
Did this help to answer open questions? Otherwise, please let me know.
I'd also like to avoid that his patch alone blocks 1-3 of the series needless - but I would also not mind getting everything in at once.
Can you provide your reviewed-by if you are okay with this approach?
Quoted 8 lines
I was kind of hoping Simon would chime in here on binman usage. So, re-re-reading the above URL, yes, fsloader wouldn't be the right choice for watchdog firmware. But I think
binman_entry_find()and related could work, in general, for this case of "need firmware blob embedded in to image". That said, this isn't just any firmware blob, it's the watchdog firmware. The less reliance on other things the safer it is. That means this would be an exception to the general firmware blob loading rule and yeah, OK, we can do it this way. Sorry for the delay.
Yes I've been a little tied up recently. But I think this should use binman. We really don't want to be building binary firmware into U-Boot itself!
Also Tom says, see x86 for a load of binaries of different types and how they are accessed at runttime. This is what binman is for.
Quoted 5 lines
Reviewed-by Tom Rini <[email protected]>--
Tom
Regards,
Simon
Re: [PATCH v2 4/5] watchdog: rti_wdt: Add support for loading firmware
Quoted 91 lines · Simon Glass
Hi,
Quoted 79 lines · Tom Rini
Quoted 70 lines · Lokesh Vutla
Hi Tom,
Quoted 67 lines · Jan Kiszka
Quoted 65 lines · Jan Kiszka
Quoted 55 lines · Tom Rini
Quoted 45 lines · Lokesh Vutla
+Tom,
Hi Tom,
Quoted 40 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
To avoid the need of extra boot scripting on AM65x for loading a watchdog firmware, add the required rproc init and loading logic for the first R5F core to the watchdog start handler. In case the R5F cluster is in lock-step mode, also initialize the second core. The firmware itself is embedded into U-Boot binary to ease access to it and ensure it is properly hashed in case of secure boot.
One possible firmware source is https://github.com/siemens/k3-rti-wdt.
Signed-off-by Jan Kiszka <[email protected]>--- drivers/watchdog/Kconfig | 20 ++++++++++++ drivers/watchdog/Makefile | 5 +++ drivers/watchdog/rti_wdt.c | 58 ++++++++++++++++++++++++++++++++++- drivers/watchdog/rti_wdt_fw.S | 20 ++++++++++++ 4 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 drivers/watchdog/rti_wdt_fw.Sdrivers/watchdog/Kconfig +12
-0@@ -209,6 +209,26 @@ config WDT_K3_RTI Say Y here if you want to include support for the K3 watchdog timer (RTI module) available in the K3 generation of processors. +if WDT_K3_RTI + +config WDT_K3_RTI_LOAD_FW + bool "Load watchdog firmware" + depends on REMOTEPROC + help + Automatically load the specified firmware image into the MCU R5F + core 0. On the AM65x, this firmware is supposed to handle the expiry + of the watchdog timer, typically by resetting the system. + +config WDT_K3_RTI_FW_FILE + string "Watchdog firmware image file"Quoted 8 lines
drivers/watchdog/Kconfig config WDT_K3_RTI · line 228
Quoted 5 lines
drivers/watchdog/Kconfig +5
-0+ default "k3-rti-wdt.fw" + depends on WDT_K3_RTI_LOAD_FW + help + Firmware image to be embedded into U-Boot and loaded on watchdog + start.I need your input on this proach. Is it okay to include the linker file unders drivers?
Quoted 4 lines
Maybe? I suppose the first thing that springs to mind is why aren't we using binman and including this blob (which I happily see is GPLv2) similar to how we do things with x86 for one example.
See https://www.mail-archive.com/[email protected]/msg377894.html
Jan
Quoted 6 lines
Quoted 4 lines
Did this help to answer open questions? Otherwise, please let me know.
I'd also like to avoid that his patch alone blocks 1-3 of the series needless - but I would also not mind getting everything in at once.
Can you provide your reviewed-by if you are okay with this approach?
Quoted 8 lines
I was kind of hoping Simon would chime in here on binman usage. So, re-re-reading the above URL, yes, fsloader wouldn't be the right choice for watchdog firmware. But I think
binman_entry_find()and related could work, in general, for this case of "need firmware blob embedded in to image". That said, this isn't just any firmware blob, it's the watchdog firmware. The less reliance on other things the safer it is. That means this would be an exception to the general firmware blob loading rule and yeah, OK, we can do it this way. Sorry for the delay.
Quoted 7 lines
Yes I've been a little tied up recently. But I think this should use binman. We really don't want to be building binary firmware into U-Boot itself!
Also Tom says, see x86 for a load of binaries of different types and how they are accessed at runttime. This is what binman is for.
Please take the time and study my arguments. I'm open for better proposals, but they need to be concrete and addressing my points.
Thanks,
Jan
Signature · 2 lines
Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux
Re: [PATCH v2 4/5] watchdog: rti_wdt: Add support for loading firmware
Hi Jan,
Quoted 97 lines · Jan Kiszka
Quoted 95 lines · Simon Glass
Hi,
Quoted 79 lines · Tom Rini
Quoted 70 lines · Lokesh Vutla
Hi Tom,
Quoted 67 lines · Jan Kiszka
Quoted 65 lines · Jan Kiszka
Quoted 55 lines · Tom Rini
Quoted 45 lines · Lokesh Vutla
+Tom,
Hi Tom,
Quoted 40 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
To avoid the need of extra boot scripting on AM65x for loading a watchdog firmware, add the required rproc init and loading logic for the first R5F core to the watchdog start handler. In case the R5F cluster is in lock-step mode, also initialize the second core. The firmware itself is embedded into U-Boot binary to ease access to it and ensure it is properly hashed in case of secure boot.
One possible firmware source is https://github.com/siemens/k3-rti-wdt.
Signed-off-by Jan Kiszka <[email protected]>--- drivers/watchdog/Kconfig | 20 ++++++++++++ drivers/watchdog/Makefile | 5 +++ drivers/watchdog/rti_wdt.c | 58 ++++++++++++++++++++++++++++++++++- drivers/watchdog/rti_wdt_fw.S | 20 ++++++++++++ 4 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 drivers/watchdog/rti_wdt_fw.Sdrivers/watchdog/Kconfig +12
-0@@ -209,6 +209,26 @@ config WDT_K3_RTI Say Y here if you want to include support for the K3 watchdog timer (RTI module) available in the K3 generation of processors. +if WDT_K3_RTI + +config WDT_K3_RTI_LOAD_FW + bool "Load watchdog firmware" + depends on REMOTEPROC + help + Automatically load the specified firmware image into the MCU R5F + core 0. On the AM65x, this firmware is supposed to handle the expiry + of the watchdog timer, typically by resetting the system. + +config WDT_K3_RTI_FW_FILE + string "Watchdog firmware image file"Quoted 8 lines
drivers/watchdog/Kconfig config WDT_K3_RTI · line 228
Quoted 5 lines
drivers/watchdog/Kconfig +5
-0+ default "k3-rti-wdt.fw" + depends on WDT_K3_RTI_LOAD_FW + help + Firmware image to be embedded into U-Boot and loaded on watchdog + start.I need your input on this proach. Is it okay to include the linker file unders drivers?
Quoted 4 lines
Maybe? I suppose the first thing that springs to mind is why aren't we using binman and including this blob (which I happily see is GPLv2) similar to how we do things with x86 for one example.
See https://www.mail-archive.com/[email protected]/msg377894.html
Jan
Quoted 6 lines
Quoted 4 lines
Did this help to answer open questions? Otherwise, please let me know.
I'd also like to avoid that his patch alone blocks 1-3 of the series needless - but I would also not mind getting everything in at once.
Can you provide your reviewed-by if you are okay with this approach?
Quoted 8 lines
I was kind of hoping Simon would chime in here on binman usage. So, re-re-reading the above URL, yes, fsloader wouldn't be the right choice for watchdog firmware. But I think
binman_entry_find()and related could work, in general, for this case of "need firmware blob embedded in to image". That said, this isn't just any firmware blob, it's the watchdog firmware. The less reliance on other things the safer it is. That means this would be an exception to the general firmware blob loading rule and yeah, OK, we can do it this way. Sorry for the delay.Yes I've been a little tied up recently. But I think this should use binman. We really don't want to be building binary firmware into U-Boot itself!
Quoted 6 lines
Quoted 3 lines
Also Tom says, see x86 for a load of binaries of different types and how they are accessed at runttime. This is what binman is for.
Please take the time and study my arguments. I'm open for better proposals, but they need to be concrete and addressing my points.
Do you mean 'properly hashed' and 'easy access', or something else? What can binman not do?
Regards,
Simon
Re: [PATCH v2 4/5] watchdog: rti_wdt: Add support for loading firmware
Quoted 104 lines · Simon Glass
Hi Jan,
Quoted 101 lines · Jan Kiszka
Quoted 98 lines · Simon Glass
Hi,
Quoted 79 lines · Tom Rini
Quoted 70 lines · Lokesh Vutla
Hi Tom,
Quoted 67 lines · Jan Kiszka
Quoted 65 lines · Jan Kiszka
Quoted 55 lines · Tom Rini
Quoted 45 lines · Lokesh Vutla
+Tom,
Hi Tom,
Quoted 40 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
To avoid the need of extra boot scripting on AM65x for loading a watchdog firmware, add the required rproc init and loading logic for the first R5F core to the watchdog start handler. In case the R5F cluster is in lock-step mode, also initialize the second core. The firmware itself is embedded into U-Boot binary to ease access to it and ensure it is properly hashed in case of secure boot.
One possible firmware source is https://github.com/siemens/k3-rti-wdt.
Signed-off-by Jan Kiszka <[email protected]>--- drivers/watchdog/Kconfig | 20 ++++++++++++ drivers/watchdog/Makefile | 5 +++ drivers/watchdog/rti_wdt.c | 58 ++++++++++++++++++++++++++++++++++- drivers/watchdog/rti_wdt_fw.S | 20 ++++++++++++ 4 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 drivers/watchdog/rti_wdt_fw.Sdrivers/watchdog/Kconfig +12
-0@@ -209,6 +209,26 @@ config WDT_K3_RTI Say Y here if you want to include support for the K3 watchdog timer (RTI module) available in the K3 generation of processors. +if WDT_K3_RTI + +config WDT_K3_RTI_LOAD_FW + bool "Load watchdog firmware" + depends on REMOTEPROC + help + Automatically load the specified firmware image into the MCU R5F + core 0. On the AM65x, this firmware is supposed to handle the expiry + of the watchdog timer, typically by resetting the system. + +config WDT_K3_RTI_FW_FILE + string "Watchdog firmware image file"Quoted 8 lines
drivers/watchdog/Kconfig config WDT_K3_RTI · line 228
Quoted 5 lines
drivers/watchdog/Kconfig +5
-0+ default "k3-rti-wdt.fw" + depends on WDT_K3_RTI_LOAD_FW + help + Firmware image to be embedded into U-Boot and loaded on watchdog + start.I need your input on this proach. Is it okay to include the linker file unders drivers?
Quoted 4 lines
Maybe? I suppose the first thing that springs to mind is why aren't we using binman and including this blob (which I happily see is GPLv2) similar to how we do things with x86 for one example.
See https://www.mail-archive.com/[email protected]/msg377894.html
Jan
Quoted 6 lines
Quoted 4 lines
Did this help to answer open questions? Otherwise, please let me know.
I'd also like to avoid that his patch alone blocks 1-3 of the series needless - but I would also not mind getting everything in at once.
Can you provide your reviewed-by if you are okay with this approach?
Quoted 8 lines
I was kind of hoping Simon would chime in here on binman usage. So, re-re-reading the above URL, yes, fsloader wouldn't be the right choice for watchdog firmware. But I think
binman_entry_find()and related could work, in general, for this case of "need firmware blob embedded in to image". That said, this isn't just any firmware blob, it's the watchdog firmware. The less reliance on other things the safer it is. That means this would be an exception to the general firmware blob loading rule and yeah, OK, we can do it this way. Sorry for the delay.Yes I've been a little tied up recently. But I think this should use binman. We really don't want to be building binary firmware into U-Boot itself!
Also Tom says, see x86 for a load of binaries of different types and how they are accessed at runttime. This is what binman is for.
Quoted 5 lines
Quoted 2 lines
Please take the time and study my arguments. I'm open for better proposals, but they need to be concrete and addressing my points.
Do you mean 'properly hashed' and 'easy access', or something else? What can binman not do?
Well, as I said when ack'ing this, we're also talking about making sure the system watchdog works. It needs to be as dead simple as possible.
Signature · 1 line
Tom
Re: [PATCH v2 4/5] watchdog: rti_wdt: Add support for loading firmware
Hi Tom,
Quoted 106 lines · Tom Rini
Quoted 104 lines · Simon Glass
Hi Jan,
Quoted 101 lines · Jan Kiszka
Quoted 98 lines · Simon Glass
Hi,
Quoted 79 lines · Tom Rini
Quoted 70 lines · Lokesh Vutla
Hi Tom,
Quoted 67 lines · Jan Kiszka
Quoted 65 lines · Jan Kiszka
Quoted 55 lines · Tom Rini
Quoted 45 lines · Lokesh Vutla
+Tom,
Hi Tom,
Quoted 40 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
To avoid the need of extra boot scripting on AM65x for loading a watchdog firmware, add the required rproc init and loading logic for the first R5F core to the watchdog start handler. In case the R5F cluster is in lock-step mode, also initialize the second core. The firmware itself is embedded into U-Boot binary to ease access to it and ensure it is properly hashed in case of secure boot.
One possible firmware source is https://github.com/siemens/k3-rti-wdt.
Signed-off-by Jan Kiszka <[email protected]>--- drivers/watchdog/Kconfig | 20 ++++++++++++ drivers/watchdog/Makefile | 5 +++ drivers/watchdog/rti_wdt.c | 58 ++++++++++++++++++++++++++++++++++- drivers/watchdog/rti_wdt_fw.S | 20 ++++++++++++ 4 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 drivers/watchdog/rti_wdt_fw.Sdrivers/watchdog/Kconfig +12
-0@@ -209,6 +209,26 @@ config WDT_K3_RTI Say Y here if you want to include support for the K3 watchdog timer (RTI module) available in the K3 generation of processors. +if WDT_K3_RTI + +config WDT_K3_RTI_LOAD_FW + bool "Load watchdog firmware" + depends on REMOTEPROC + help + Automatically load the specified firmware image into the MCU R5F + core 0. On the AM65x, this firmware is supposed to handle the expiry + of the watchdog timer, typically by resetting the system. + +config WDT_K3_RTI_FW_FILE + string "Watchdog firmware image file"Quoted 8 lines
drivers/watchdog/Kconfig config WDT_K3_RTI · line 228
Quoted 5 lines
drivers/watchdog/Kconfig +5
-0+ default "k3-rti-wdt.fw" + depends on WDT_K3_RTI_LOAD_FW + help + Firmware image to be embedded into U-Boot and loaded on watchdog + start.I need your input on this proach. Is it okay to include the linker file unders drivers?
Quoted 4 lines
Maybe? I suppose the first thing that springs to mind is why aren't we using binman and including this blob (which I happily see is GPLv2) similar to how we do things with x86 for one example.
See https://www.mail-archive.com/[email protected]/msg377894.html
Jan
Quoted 6 lines
Quoted 4 lines
Did this help to answer open questions? Otherwise, please let me know.
I'd also like to avoid that his patch alone blocks 1-3 of the series needless - but I would also not mind getting everything in at once.
Can you provide your reviewed-by if you are okay with this approach?
Quoted 8 lines
I was kind of hoping Simon would chime in here on binman usage. So, re-re-reading the above URL, yes, fsloader wouldn't be the right choice for watchdog firmware. But I think
binman_entry_find()and related could work, in general, for this case of "need firmware blob embedded in to image". That said, this isn't just any firmware blob, it's the watchdog firmware. The less reliance on other things the safer it is. That means this would be an exception to the general firmware blob loading rule and yeah, OK, we can do it this way. Sorry for the delay.Yes I've been a little tied up recently. But I think this should use binman. We really don't want to be building binary firmware into U-Boot itself!
Also Tom says, see x86 for a load of binaries of different types and how they are accessed at runttime. This is what binman is for.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Please take the time and study my arguments. I'm open for better proposals, but they need to be concrete and addressing my points.
Do you mean 'properly hashed' and 'easy access', or something else? What can binman not do?
Well, as I said when ack'ing this, we're also talking about making sure the system watchdog works. It needs to be as dead simple as possible.
Another option would be for the system to fail to boot if the watchdog could not be enabled.
Anyway, I'll leave it to you.
Regards,
Simon
Re: [PATCH v2 4/5] watchdog: rti_wdt: Add support for loading firmware
In reply to Simon GlassQuoted 104 lines · Simon Glass
Hi Jan,
Quoted 101 lines · Jan Kiszka
Quoted 98 lines · Simon Glass
Hi,
Quoted 79 lines · Tom Rini
Quoted 70 lines · Lokesh Vutla
Hi Tom,
Quoted 67 lines · Jan Kiszka
Quoted 65 lines · Jan Kiszka
Quoted 55 lines · Tom Rini
Quoted 45 lines · Lokesh Vutla
+Tom,
Hi Tom,
Quoted 40 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
To avoid the need of extra boot scripting on AM65x for loading a watchdog firmware, add the required rproc init and loading logic for the first R5F core to the watchdog start handler. In case the R5F cluster is in lock-step mode, also initialize the second core. The firmware itself is embedded into U-Boot binary to ease access to it and ensure it is properly hashed in case of secure boot.
One possible firmware source is https://github.com/siemens/k3-rti-wdt.
Signed-off-by Jan Kiszka <[email protected]>--- drivers/watchdog/Kconfig | 20 ++++++++++++ drivers/watchdog/Makefile | 5 +++ drivers/watchdog/rti_wdt.c | 58 ++++++++++++++++++++++++++++++++++- drivers/watchdog/rti_wdt_fw.S | 20 ++++++++++++ 4 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 drivers/watchdog/rti_wdt_fw.Sdrivers/watchdog/Kconfig +12
-0@@ -209,6 +209,26 @@ config WDT_K3_RTI Say Y here if you want to include support for the K3 watchdog timer (RTI module) available in the K3 generation of processors. +if WDT_K3_RTI + +config WDT_K3_RTI_LOAD_FW + bool "Load watchdog firmware" + depends on REMOTEPROC + help + Automatically load the specified firmware image into the MCU R5F + core 0. On the AM65x, this firmware is supposed to handle the expiry + of the watchdog timer, typically by resetting the system. + +config WDT_K3_RTI_FW_FILE + string "Watchdog firmware image file"Quoted 8 lines
drivers/watchdog/Kconfig config WDT_K3_RTI · line 228
Quoted 5 lines
drivers/watchdog/Kconfig +5
-0+ default "k3-rti-wdt.fw" + depends on WDT_K3_RTI_LOAD_FW + help + Firmware image to be embedded into U-Boot and loaded on watchdog + start.I need your input on this proach. Is it okay to include the linker file unders drivers?
Quoted 4 lines
Maybe? I suppose the first thing that springs to mind is why aren't we using binman and including this blob (which I happily see is GPLv2) similar to how we do things with x86 for one example.
See https://www.mail-archive.com/[email protected]/msg377894.html
Jan
Quoted 6 lines
Quoted 4 lines
Did this help to answer open questions? Otherwise, please let me know.
I'd also like to avoid that his patch alone blocks 1-3 of the series needless - but I would also not mind getting everything in at once.
Can you provide your reviewed-by if you are okay with this approach?
Quoted 8 lines
I was kind of hoping Simon would chime in here on binman usage. So, re-re-reading the above URL, yes, fsloader wouldn't be the right choice for watchdog firmware. But I think
binman_entry_find()and related could work, in general, for this case of "need firmware blob embedded in to image". That said, this isn't just any firmware blob, it's the watchdog firmware. The less reliance on other things the safer it is. That means this would be an exception to the general firmware blob loading rule and yeah, OK, we can do it this way. Sorry for the delay.Yes I've been a little tied up recently. But I think this should use binman. We really don't want to be building binary firmware into U-Boot itself!
Also Tom says, see x86 for a load of binaries of different types and how they are accessed at runttime. This is what binman is for.
Quoted 5 lines
Quoted 2 lines
Please take the time and study my arguments. I'm open for better proposals, but they need to be concrete and addressing my points.
Do you mean 'properly hashed' and 'easy access', or something else? What can binman not do?
Binman itself can stick things into binary images. But that is at most half of the tasks needed here. I would need concrete guidance how to
- access that binary from u-boot proper in a reasonably simple way
- make sure the binary can be signed and the signature is evaluated before using it
Jan
Signature · 2 lines
Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux
Re: [PATCH v2 4/5] watchdog: rti_wdt: Add support for loading firmware
Hi Jan,
Quoted 109 lines · Jan Kiszka
Quoted 107 lines · Simon Glass
Hi Jan,
Quoted 103 lines · Jan Kiszka
Quoted 91 lines · Simon Glass
Hi,
Quoted 79 lines · Tom Rini
Quoted 70 lines · Lokesh Vutla
Hi Tom,
Quoted 67 lines · Jan Kiszka
Quoted 65 lines · Jan Kiszka
Quoted 55 lines · Tom Rini
Quoted 45 lines · Lokesh Vutla
+Tom,
Hi Tom,
Quoted 40 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
To avoid the need of extra boot scripting on AM65x for loading a watchdog firmware, add the required rproc init and loading logic for the first R5F core to the watchdog start handler. In case the R5F cluster is in lock-step mode, also initialize the second core. The firmware itself is embedded into U-Boot binary to ease access to it and ensure it is properly hashed in case of secure boot.
One possible firmware source is https://github.com/siemens/k3-rti-wdt.
Signed-off-by Jan Kiszka <[email protected]>--- drivers/watchdog/Kconfig | 20 ++++++++++++ drivers/watchdog/Makefile | 5 +++ drivers/watchdog/rti_wdt.c | 58 ++++++++++++++++++++++++++++++++++- drivers/watchdog/rti_wdt_fw.S | 20 ++++++++++++ 4 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 drivers/watchdog/rti_wdt_fw.Sdrivers/watchdog/Kconfig +12
-0@@ -209,6 +209,26 @@ config WDT_K3_RTI Say Y here if you want to include support for the K3 watchdog timer (RTI module) available in the K3 generation of processors. +if WDT_K3_RTI + +config WDT_K3_RTI_LOAD_FW + bool "Load watchdog firmware" + depends on REMOTEPROC + help + Automatically load the specified firmware image into the MCU R5F + core 0. On the AM65x, this firmware is supposed to handle the expiry + of the watchdog timer, typically by resetting the system. + +config WDT_K3_RTI_FW_FILE + string "Watchdog firmware image file"Quoted 8 lines
drivers/watchdog/Kconfig config WDT_K3_RTI · line 228
Quoted 5 lines
drivers/watchdog/Kconfig +5
-0+ default "k3-rti-wdt.fw" + depends on WDT_K3_RTI_LOAD_FW + help + Firmware image to be embedded into U-Boot and loaded on watchdog + start.I need your input on this proach. Is it okay to include the linker file unders drivers?
Quoted 4 lines
Maybe? I suppose the first thing that springs to mind is why aren't we using binman and including this blob (which I happily see is GPLv2) similar to how we do things with x86 for one example.
See https://www.mail-archive.com/[email protected]/msg377894.html
Jan
Quoted 6 lines
Quoted 4 lines
Did this help to answer open questions? Otherwise, please let me know.
I'd also like to avoid that his patch alone blocks 1-3 of the series needless - but I would also not mind getting everything in at once.
Can you provide your reviewed-by if you are okay with this approach?
Quoted 8 lines
I was kind of hoping Simon would chime in here on binman usage. So, re-re-reading the above URL, yes, fsloader wouldn't be the right choice for watchdog firmware. But I think
binman_entry_find()and related could work, in general, for this case of "need firmware blob embedded in to image". That said, this isn't just any firmware blob, it's the watchdog firmware. The less reliance on other things the safer it is. That means this would be an exception to the general firmware blob loading rule and yeah, OK, we can do it this way. Sorry for the delay.Quoted 7 lines
Yes I've been a little tied up recently. But I think this should use binman. We really don't want to be building binary firmware into U-Boot itself!
Also Tom says, see x86 for a load of binaries of different types and how they are accessed at runttime. This is what binman is for.
Please take the time and study my arguments. I'm open for better proposals, but they need to be concrete and addressing my points.
Quoted 7 lines
Quoted 2 lines
Do you mean 'properly hashed' and 'easy access', or something else? What can binman not do?
Binman itself can stick things into binary images. But that is at most half of the tasks needed here. I would need concrete guidance how to
- access that binary from u-boot proper in a reasonably simple way
I thought you wanted to access it from SPL. For that you would use linker symbols. See 'Access to binman entry offsets at run time (symbols)' in the binman docs for that.
But for U-Boot proper, the section is 'Access to binman entry offsets at run time (fdt)'. There is no mention of the runtime library that now exists (binman.h) so I will send a patch for that. But basically you call binman_entry_find("name", &entry) and it returns the offset and size for you.
Quoted 2 lines
- make sure the binary can be signed and the signature is evaluated before using it
Do you mean signed or hashed? I think you mean hashed. If you trust the U-Boot binary then presumably you can put the firmware in a similar place do you can trust that as well. After all, you seem happy enough to link it into U-Boot.
If not, you can ask binman to add a hash:
my-firmware {
type = "blob";
hash {
algo = "sha256";
};
};Then you can add support for that to some sort of helper function in binman.c, e.g.:
ofnode node, hashnode;
const u8 *hash;
int size;
node = binman_section_find_node("name"); if (!ofnode_valid(node))
...return error
hashnode = ofnode_read_prop(node, "hash"); if (!ofnode_valid(hashnode))
...return error
hash = ofnode_read_prop(hashnode, "value", &size);
/* Hash the firmware...need to read it from flash into fwdata/fwlen using binman_entry_find() ...then: */
u8 digest[SHA256_SUM_LEN];
ret = hash_block("sha256", fwdata, fwlen, digest, sizeof(digest); if (ret)
return log_msg_ret("hash", ret);
/* compare the hashes */
if (size != sizeof(digest) || memcmp(hash, digest))
return log_msg_ret("cmp", ret);
Regards,
Simon
Re: [PATCH v2 4/5] watchdog: rti_wdt: Add support for loading firmware
Quoted 169 lines · Simon Glass
Hi Jan,
Quoted 109 lines · Jan Kiszka
Quoted 107 lines · Simon Glass
Hi Jan,
Quoted 103 lines · Jan Kiszka
Quoted 91 lines · Simon Glass
Hi,
Quoted 79 lines · Tom Rini
Quoted 70 lines · Lokesh Vutla
Hi Tom,
Quoted 67 lines · Jan Kiszka
Quoted 65 lines · Jan Kiszka
Quoted 55 lines · Tom Rini
Quoted 45 lines · Lokesh Vutla
+Tom,
Hi Tom,
Quoted 40 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
To avoid the need of extra boot scripting on AM65x for loading a watchdog firmware, add the required rproc init and loading logic for the first R5F core to the watchdog start handler. In case the R5F cluster is in lock-step mode, also initialize the second core. The firmware itself is embedded into U-Boot binary to ease access to it and ensure it is properly hashed in case of secure boot.
One possible firmware source is https://github.com/siemens/k3-rti-wdt.
Signed-off-by Jan Kiszka <[email protected]>--- drivers/watchdog/Kconfig | 20 ++++++++++++ drivers/watchdog/Makefile | 5 +++ drivers/watchdog/rti_wdt.c | 58 ++++++++++++++++++++++++++++++++++- drivers/watchdog/rti_wdt_fw.S | 20 ++++++++++++ 4 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 drivers/watchdog/rti_wdt_fw.Sdrivers/watchdog/Kconfig +12
-0@@ -209,6 +209,26 @@ config WDT_K3_RTI Say Y here if you want to include support for the K3 watchdog timer (RTI module) available in the K3 generation of processors. +if WDT_K3_RTI + +config WDT_K3_RTI_LOAD_FW + bool "Load watchdog firmware" + depends on REMOTEPROC + help + Automatically load the specified firmware image into the MCU R5F + core 0. On the AM65x, this firmware is supposed to handle the expiry + of the watchdog timer, typically by resetting the system. + +config WDT_K3_RTI_FW_FILE + string "Watchdog firmware image file"Quoted 8 lines
drivers/watchdog/Kconfig config WDT_K3_RTI · line 228
Quoted 5 lines
drivers/watchdog/Kconfig +5
-0+ default "k3-rti-wdt.fw" + depends on WDT_K3_RTI_LOAD_FW + help + Firmware image to be embedded into U-Boot and loaded on watchdog + start.I need your input on this proach. Is it okay to include the linker file unders drivers?
Quoted 4 lines
Maybe? I suppose the first thing that springs to mind is why aren't we using binman and including this blob (which I happily see is GPLv2) similar to how we do things with x86 for one example.
See https://www.mail-archive.com/[email protected]/msg377894.html
Jan
Quoted 6 lines
Quoted 4 lines
Did this help to answer open questions? Otherwise, please let me know.
I'd also like to avoid that his patch alone blocks 1-3 of the series needless - but I would also not mind getting everything in at once.
Can you provide your reviewed-by if you are okay with this approach?
Quoted 8 lines
I was kind of hoping Simon would chime in here on binman usage. So, re-re-reading the above URL, yes, fsloader wouldn't be the right choice for watchdog firmware. But I think
binman_entry_find()and related could work, in general, for this case of "need firmware blob embedded in to image". That said, this isn't just any firmware blob, it's the watchdog firmware. The less reliance on other things the safer it is. That means this would be an exception to the general firmware blob loading rule and yeah, OK, we can do it this way. Sorry for the delay.Quoted 7 lines
Yes I've been a little tied up recently. But I think this should use binman. We really don't want to be building binary firmware into U-Boot itself!
Also Tom says, see x86 for a load of binaries of different types and how they are accessed at runttime. This is what binman is for.
Please take the time and study my arguments. I'm open for better proposals, but they need to be concrete and addressing my points.
Quoted 7 lines
Quoted 2 lines
Do you mean 'properly hashed' and 'easy access', or something else? What can binman not do?
Binman itself can stick things into binary images. But that is at most half of the tasks needed here. I would need concrete guidance how to
- access that binary from u-boot proper in a reasonably simple way
I thought you wanted to access it from SPL. For that you would use linker symbols. See 'Access to binman entry offsets at run time (symbols)' in the binman docs for that.
But for U-Boot proper, the section is 'Access to binman entry offsets at run time (fdt)'. There is no mention of the runtime library that now exists (
binman.h) so I will send a patch for that. But basically you callbinman_entry_find("name", &entry)and it returns the offset and size for you.Quoted 2 lines
- make sure the binary can be signed and the signature is evaluated before using it
Do you mean signed or hashed? I think you mean hashed. If you trust the U-Boot binary then presumably you can put the firmware in a similar place do you can trust that as well. After all, you seem happy enough to link it into U-Boot.
If not, you can ask binman to add a hash:
my-firmware { type = "blob"; hash { algo = "sha256"; }; };Then you can add support for that to some sort of helper function in
binman.c, e.g.:ofnode node, hashnode;
const u8 *hash;
int size;node =
binman_section_find_node("name"); if (!ofnode_valid(node))
...return error
hashnode =ofnode_read_prop(node, "hash"); if (!ofnode_valid(hashnode))
...return error
hash =ofnode_read_prop(hashnode, "value", &size);/* Hash the firmware...need to read it from flash into fwdata/fwlen using
binman_entry_find()...then: */
u8 digest[SHA256_SUM_LEN];
ret = hash_block("sha256", fwdata, fwlen, digest, sizeof(digest); if (ret)
returnlog_msg_ret("hash", ret);
Quoted 4 lines
/* compare the hashes */
if (size != sizeof(digest) ||memcmp(hash, digest))
returnlog_msg_ret("cmp", ret);
Yes, it will likely be a hash that will be signed, and all that will be checked by SPL when loading proper. The infrastructure for that should be there, just not yet plugged for the way of loading things like we do (one of my todos).
Obviously, what would be simplest for that is to have the watchdog blob embedded, rather than separately hashed, as that would Just Work. I didn't fully grasp yet what you propose, but it seems right now it will complicate things. I'm not saying it will make it impossible, just harder.
Jan
Signature · 2 lines
Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux
Re: [PATCH v2 4/5] watchdog: rti_wdt: Add support for loading firmware
Hi Jan,
Quoted 181 lines · Jan Kiszka
Quoted 169 lines · Simon Glass
Hi Jan,
Quoted 109 lines · Jan Kiszka
Quoted 107 lines · Simon Glass
Hi Jan,
Quoted 103 lines · Jan Kiszka
Quoted 91 lines · Simon Glass
Hi,
Quoted 79 lines · Tom Rini
Quoted 70 lines · Lokesh Vutla
Hi Tom,
Quoted 67 lines · Jan Kiszka
Quoted 65 lines · Jan Kiszka
Quoted 55 lines · Tom Rini
Quoted 45 lines · Lokesh Vutla
+Tom,
Hi Tom,
Quoted 40 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
To avoid the need of extra boot scripting on AM65x for loading a
watchdog firmware, add the required rproc init and loading logic for the
first R5F core to the watchdog start handler. In case the R5F cluster is
in lock-step mode, also initialize the second core. The firmware itself
is embedded into U-Boot binary to ease access to it and ensure it is
properly hashed in case of secure boot.One possible firmware source is https://github.com/siemens/k3-rti-wdt.
Signed-off-by: Jan Kiszka <[email protected]>
---
drivers/watchdog/Kconfig | 20 ++++++++++++
drivers/watchdog/Makefile | 5 +++
drivers/watchdog/rti_wdt.c | 58 ++++++++++++++++++++++++++++++++++-
drivers/watchdog/rti_wdt_fw.S | 20 ++++++++++++
4 files changed, 102 insertions(+), 1 deletion(-)
create mode 100644 drivers/watchdog/rti_wdt_fw.Sdiff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index f0ff2612a6..1a1fddfe9f 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -209,6 +209,26 @@ config WDT_K3_RTI
Say Y here if you want to include support for the K3 watchdog
timer (RTI module) available in the K3 generation of processors.+if WDT_K3_RTI
+
+config WDT_K3_RTI_LOAD_FW
+ bool "Load watchdog firmware"
+ depends on REMOTEPROC
+ help
+ Automatically load the specified firmware image into the MCU R5F
+ core 0. On the AM65x, this firmware is supposed to handle the expiry
+ of the watchdog timer, typically by resetting the system.
+
+config WDT_K3_RTI_FW_FILE
+ string "Watchdog firmware image file"Quoted 8 lines
Quoted 5 lines
+ default "k3-rti-wdt.fw"
+ depends on WDT_K3_RTI_LOAD_FW
+ help
+ Firmware image to be embedded into U-Boot and loaded on watchdog
+ start.I need your input on this proach. Is it okay to include the linker file unders drivers?
Quoted 4 lines
Maybe? I suppose the first thing that springs to mind is why aren't we using binman and including this blob (which I happily see is GPLv2) similar to how we do things with x86 for one example.
See https://www.mail-archive.com/[email protected]/msg377894.html
Jan
Quoted 6 lines
Quoted 4 lines
Did this help to answer open questions? Otherwise, please let me know.
I'd also like to avoid that his patch alone blocks 1-3 of the series needless - but I would also not mind getting everything in at once.
Can you provide your reviewed-by if you are okay with this approach?
Quoted 8 lines
I was kind of hoping Simon would chime in here on binman usage. So, re-re-reading the above URL, yes, fsloader wouldn't be the right choice for watchdog firmware. But I think
binman_entry_find()and related could work, in general, for this case of "need firmware blob embedded in to image". That said, this isn't just any firmware blob, it's the watchdog firmware. The less reliance on other things the safer it is. That means this would be an exception to the general firmware blob loading rule and yeah, OK, we can do it this way. Sorry for the delay.Quoted 7 lines
Yes I've been a little tied up recently. But I think this should use binman. We really don't want to be building binary firmware into U-Boot itself!
Also Tom says, see x86 for a load of binaries of different types and how they are accessed at runttime. This is what binman is for.
Please take the time and study my arguments. I'm open for better proposals, but they need to be concrete and addressing my points.
Quoted 7 lines
Quoted 2 lines
Do you mean 'properly hashed' and 'easy access', or something else? What can binman not do?
Binman itself can stick things into binary images. But that is at most half of the tasks needed here. I would need concrete guidance how to
- access that binary from u-boot proper in a reasonably simple way
I thought you wanted to access it from SPL. For that you would use linker symbols. See 'Access to binman entry offsets at run time (symbols)' in the binman docs for that.
But for U-Boot proper, the section is 'Access to binman entry offsets at run time (fdt)'. There is no mention of the runtime library that now exists (
binman.h) so I will send a patch for that. But basically you callbinman_entry_find("name", &entry)and it returns the offset and size for you.Quoted 2 lines
- make sure the binary can be signed and the signature is evaluated before using it
Do you mean signed or hashed? I think you mean hashed. If you trust the U-Boot binary then presumably you can put the firmware in a similar place do you can trust that as well. After all, you seem happy enough to link it into U-Boot.
If not, you can ask binman to add a hash:
my-firmware { type = "blob"; hash { algo = "sha256"; }; };Then you can add support for that to some sort of helper function in
binman.c, e.g.:ofnode node, hashnode;
const u8 *hash;
int size;node =
binman_section_find_node("name"); if (!ofnode_valid(node))
...return error
hashnode =ofnode_read_prop(node, "hash"); if (!ofnode_valid(hashnode))
...return error
hash =ofnode_read_prop(hashnode, "value", &size);/* Hash the firmware...need to read it from flash into fwdata/fwlen using
binman_entry_find()...then: */
u8 digest[SHA256_SUM_LEN];
ret = hash_block("sha256", fwdata, fwlen, digest, sizeof(digest); if (ret)
returnlog_msg_ret("hash", ret);Quoted 4 lines
/* compare the hashes */
if (size != sizeof(digest) ||memcmp(hash, digest))
returnlog_msg_ret("cmp", ret);Yes, it will likely be a hash that will be signed, and all that will be checked by SPL when loading proper. The infrastructure for that should be there, just not yet plugged for the way of loading things like we do (one of my todos).
Quoted 4 lines
Obviously, what would be simplest for that is to have the watchdog blob embedded, rather than separately hashed, as that would Just Work. I didn't fully grasp yet what you propose, but it seems right now it will complicate things. I'm not saying it will make it impossible, just harder.
I'm not even sure that is true. In binman, add the entry:
watchdog-firmware {
type = "blob";
filename = "...";
};
In the C code, declare a symbol that will get the image position of the entry:
binman_sym_declare(unsigned long, watchdog_firmware, image_pos);
then read that value when you need it:
int check_it(..)
{
ulong pos = binman_sym(ulong, watchdog_firmware, image_pos);
// read from flash offset @pos into a buffer
// check the hash
};
This is one of the key features of binman. It seems a shame to bring in linker magic instead, when it is already there.
But my point was really that if you combine the watchdog firmware into the image with binman, you should be able to avoid verifying it, or at least rely on the same mechanism you use to verify U-Boot.
Feel free to come along and discuss this at one of the contributor calls if that would be easier.
Regards,
Simon
Re: [PATCH v2 4/5] watchdog: rti_wdt: Add support for loading firmware
Quoted 202 lines · Simon Glass
Hi Jan,
Quoted 181 lines · Jan Kiszka
Quoted 169 lines · Simon Glass
Hi Jan,
Quoted 109 lines · Jan Kiszka
Quoted 107 lines · Simon Glass
Hi Jan,
Quoted 103 lines · Jan Kiszka
Quoted 91 lines · Simon Glass
Hi,
Quoted 79 lines · Tom Rini
Quoted 70 lines · Lokesh Vutla
Hi Tom,
Quoted 67 lines · Jan Kiszka
Quoted 65 lines · Jan Kiszka
Quoted 55 lines · Tom Rini
Quoted 53 lines · Lokesh Vutla
+Tom,
Hi Tom,
On 02/06/21 3:07 pm, Jan Kiszka wrote:
From: Jan Kiszka <[email protected]>To avoid the need of extra boot scripting on AM65x for loading a
watchdog firmware, add the required rproc init and loading logic for the
first R5F core to the watchdog start handler. In case the R5F cluster is
in lock-step mode, also initialize the second core. The firmware itself
is embedded into U-Boot binary to ease access to it and ensure it is
properly hashed in case of secure boot.One possible firmware source is https://github.com/siemens/k3-rti-wdt.
Signed-off-by: Jan Kiszka <[email protected]>
---
drivers/watchdog/Kconfig | 20 ++++++++++++
drivers/watchdog/Makefile | 5 +++
drivers/watchdog/rti_wdt.c | 58 ++++++++++++++++++++++++++++++++++-
drivers/watchdog/rti_wdt_fw.S | 20 ++++++++++++
4 files changed, 102 insertions(+), 1 deletion(-)
create mode 100644 drivers/watchdog/rti_wdt_fw.Sdiff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index f0ff2612a6..1a1fddfe9f 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -209,6 +209,26 @@ config WDT_K3_RTI
Say Y here if you want to include support for the K3 watchdog
timer (RTI module) available in the K3 generation of processors.+if WDT_K3_RTI
+
+config WDT_K3_RTI_LOAD_FW
+ bool "Load watchdog firmware"
+ depends on REMOTEPROC
+ help
+ Automatically load the specified firmware image into the MCU R5F
+ core 0. On the AM65x, this firmware is supposed to handle the expiry
+ of the watchdog timer, typically by resetting the system.
+
+config WDT_K3_RTI_FW_FILE
+ string "Watchdog firmware image file"
+ default "k3-rti-wdt.fw"
+ depends on WDT_K3_RTI_LOAD_FW
+ help
+ Firmware image to be embedded into U-Boot and loaded on watchdog
+ start.I need your input on this proach. Is it okay to include the linker file unders
drivers?Quoted 4 lines
Maybe? I suppose the first thing that springs to mind is why aren't we using binman and including this blob (which I happily see is GPLv2) similar to how we do things with x86 for one example.
See https://www.mail-archive.com/[email protected]/msg377894.html
Jan
Quoted 6 lines
Quoted 4 lines
Did this help to answer open questions? Otherwise, please let me know.
I'd also like to avoid that his patch alone blocks 1-3 of the series needless - but I would also not mind getting everything in at once.
Can you provide your reviewed-by if you are okay with this approach?
Quoted 8 lines
I was kind of hoping Simon would chime in here on binman usage. So, re-re-reading the above URL, yes, fsloader wouldn't be the right choice for watchdog firmware. But I think
binman_entry_find()and related could work, in general, for this case of "need firmware blob embedded in to image". That said, this isn't just any firmware blob, it's the watchdog firmware. The less reliance on other things the safer it is. That means this would be an exception to the general firmware blob loading rule and yeah, OK, we can do it this way. Sorry for the delay.Quoted 7 lines
Yes I've been a little tied up recently. But I think this should use binman. We really don't want to be building binary firmware into U-Boot itself!
Also Tom says, see x86 for a load of binaries of different types and how they are accessed at runttime. This is what binman is for.
Please take the time and study my arguments. I'm open for better proposals, but they need to be concrete and addressing my points.
Quoted 7 lines
Quoted 2 lines
Do you mean 'properly hashed' and 'easy access', or something else? What can binman not do?
Binman itself can stick things into binary images. But that is at most half of the tasks needed here. I would need concrete guidance how to
- access that binary from u-boot proper in a reasonably simple way
I thought you wanted to access it from SPL. For that you would use linker symbols. See 'Access to binman entry offsets at run time (symbols)' in the binman docs for that.
But for U-Boot proper, the section is 'Access to binman entry offsets at run time (fdt)'. There is no mention of the runtime library that now exists (
binman.h) so I will send a patch for that. But basically you callbinman_entry_find("name", &entry)and it returns the offset and size for you.Quoted 2 lines
- make sure the binary can be signed and the signature is evaluated before using it
Do you mean signed or hashed? I think you mean hashed. If you trust the U-Boot binary then presumably you can put the firmware in a similar place do you can trust that as well. After all, you seem happy enough to link it into U-Boot.
If not, you can ask binman to add a hash:
my-firmware { type = "blob"; hash { algo = "sha256"; }; };Then you can add support for that to some sort of helper function in
binman.c, e.g.:ofnode node, hashnode;
const u8 *hash;
int size;node =
binman_section_find_node("name"); if (!ofnode_valid(node))
...return error
hashnode =ofnode_read_prop(node, "hash"); if (!ofnode_valid(hashnode))
...return error
hash =ofnode_read_prop(hashnode, "value", &size);/* Hash the firmware...need to read it from flash into fwdata/fwlen using
binman_entry_find()...then: */
u8 digest[SHA256_SUM_LEN];
ret = hash_block("sha256", fwdata, fwlen, digest, sizeof(digest); if (ret)
returnlog_msg_ret("hash", ret);Quoted 4 lines
/* compare the hashes */
if (size != sizeof(digest) ||memcmp(hash, digest))
returnlog_msg_ret("cmp", ret);Yes, it will likely be a hash that will be signed, and all that will be checked by SPL when loading proper. The infrastructure for that should be there, just not yet plugged for the way of loading things like we do (one of my todos).
Quoted 4 lines
Obviously, what would be simplest for that is to have the watchdog blob embedded, rather than separately hashed, as that would Just Work. I didn't fully grasp yet what you propose, but it seems right now it will complicate things. I'm not saying it will make it impossible, just harder.
I'm not even sure that is true. In binman, add the entry:
watchdog-firmware { type = "blob"; filename = "..."; };In the C code, declare a symbol that will get the image position of the entry:
binman_sym_declare(unsigned long, watchdog_firmware, image_pos);then read that value when you need it:
Quoted 8 lines
int
check_it(..){ ulong pos = binman_sym(ulong, watchdog_firmware, image_pos); // read from flash offset @pos into a buffer // check the hash };
This function is the extra boilerplate code that is not needed when the blob is simply part of the U-Boot binary that is loaded and checked by SPL. The worst part of this: It requires special handling of different storage media. We currently only have OSPI for out board, but you may also imagine versions that load U-Boot from filesystems (the TI EVM does that). So this is the extra complexity without extra value I'm always talking about.
But I'm happy to take concrete suggestions where to add the firmware into our board and where to add the necessary code in a simple way.
What we do so far: U-Boot proper and DTBs go into a fit image that SPL will load (and later also validate). It would be simple to do
arch/arm/dts/k3-am65-iot2050-boot-image.dtsi +5 -0
@@ -60,6 +60,11 @@ filename = "arch/arm/dts/k3-am6548-iot2050-advanced.dtb"; }; }; + + k3-rti-firmware { + type = "blob"; + filename = CONFIG_WDT_K3_RTI_FW_FILE; + }; }; configurations {
in [1] (used by [2]).
But now: How do I communicate that blob address from SPL to U-Boot proper so that I can skip the extra medium-specific loading part and also reuse the fit image validation of SPL? If there is a simple way for that, I could indeed switch the model.
Jan
[1] https://patchwork.ozlabs.org/project/uboot/patch/f7cf19b1fd2ce52d74c25e590aee452d30a6f1e4.1622626660.git.jan.kiszka@siemens.com/
[2] https://patchwork.ozlabs.org/project/uboot/patch/a83aa9023ea9c49cf1efd4a72d85bedb1e388478.1623440557.git.jan.kiszka@siemens.com/
Signature · 2 lines
Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux
Re: [PATCH v2 4/5] watchdog: rti_wdt: Add support for loading firmware
Quoted 243 lines · Jan Kiszka
Quoted 202 lines · Simon Glass
Hi Jan,
Quoted 181 lines · Jan Kiszka
Quoted 169 lines · Simon Glass
Hi Jan,
Quoted 109 lines · Jan Kiszka
Quoted 107 lines · Simon Glass
Hi Jan,
Quoted 103 lines · Jan Kiszka
Quoted 91 lines · Simon Glass
Hi,
Quoted 79 lines · Tom Rini
Quoted 70 lines · Lokesh Vutla
Hi Tom,
Quoted 67 lines · Jan Kiszka
Quoted 65 lines · Jan Kiszka
Quoted 59 lines · Tom Rini
On Mon, Jun 07, 2021 at 03:33:52PM +0530, Lokesh Vutla wrote:
+Tom,Hi Tom,
On 02/06/21 3:07 pm, Jan Kiszka wrote:
From: Jan Kiszka <[email protected]>To avoid the need of extra boot scripting on AM65x for loading a
watchdog firmware, add the required rproc init and loading logic for the
first R5F core to the watchdog start handler. In case the R5F cluster is
in lock-step mode, also initialize the second core. The firmware itself
is embedded into U-Boot binary to ease access to it and ensure it is
properly hashed in case of secure boot.One possible firmware source is https://github.com/siemens/k3-rti-wdt.
Signed-off-by: Jan Kiszka <[email protected]>
---
drivers/watchdog/Kconfig | 20 ++++++++++++
drivers/watchdog/Makefile | 5 +++
drivers/watchdog/rti_wdt.c | 58 ++++++++++++++++++++++++++++++++++-
drivers/watchdog/rti_wdt_fw.S | 20 ++++++++++++
4 files changed, 102 insertions(+), 1 deletion(-)
create mode 100644 drivers/watchdog/rti_wdt_fw.Sdiff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index f0ff2612a6..1a1fddfe9f 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -209,6 +209,26 @@ config WDT_K3_RTI
Say Y here if you want to include support for the K3 watchdog
timer (RTI module) available in the K3 generation of processors.+if WDT_K3_RTI
+
+config WDT_K3_RTI_LOAD_FW
+ bool "Load watchdog firmware"
+ depends on REMOTEPROC
+ help
+ Automatically load the specified firmware image into the MCU R5F
+ core 0. On the AM65x, this firmware is supposed to handle the expiry
+ of the watchdog timer, typically by resetting the system.
+
+config WDT_K3_RTI_FW_FILE
+ string "Watchdog firmware image file"
+ default "k3-rti-wdt.fw"
+ depends on WDT_K3_RTI_LOAD_FW
+ help
+ Firmware image to be embedded into U-Boot and loaded on watchdog
+ start.I need your input on this proach. Is it okay to include the linker file unders
drivers?Maybe? I suppose the first thing that springs to mind is why aren't we
using binman and including this blob (which I happily see is GPLv2)
similar to how we do things with x86 for one example.See https://www.mail-archive.com/[email protected]/msg377894.html
Jan
Quoted 6 lines
Quoted 4 lines
Did this help to answer open questions? Otherwise, please let me know.
I'd also like to avoid that his patch alone blocks 1-3 of the series needless - but I would also not mind getting everything in at once.
Can you provide your reviewed-by if you are okay with this approach?
Quoted 8 lines
I was kind of hoping Simon would chime in here on binman usage. So, re-re-reading the above URL, yes, fsloader wouldn't be the right choice for watchdog firmware. But I think
binman_entry_find()and related could work, in general, for this case of "need firmware blob embedded in to image". That said, this isn't just any firmware blob, it's the watchdog firmware. The less reliance on other things the safer it is. That means this would be an exception to the general firmware blob loading rule and yeah, OK, we can do it this way. Sorry for the delay.Quoted 7 lines
Yes I've been a little tied up recently. But I think this should use binman. We really don't want to be building binary firmware into U-Boot itself!
Also Tom says, see x86 for a load of binaries of different types and how they are accessed at runttime. This is what binman is for.
Please take the time and study my arguments. I'm open for better proposals, but they need to be concrete and addressing my points.
Quoted 7 lines
Quoted 2 lines
Do you mean 'properly hashed' and 'easy access', or something else? What can binman not do?
Binman itself can stick things into binary images. But that is at most half of the tasks needed here. I would need concrete guidance how to
- access that binary from u-boot proper in a reasonably simple way
I thought you wanted to access it from SPL. For that you would use linker symbols. See 'Access to binman entry offsets at run time (symbols)' in the binman docs for that.
But for U-Boot proper, the section is 'Access to binman entry offsets at run time (fdt)'. There is no mention of the runtime library that now exists (
binman.h) so I will send a patch for that. But basically you callbinman_entry_find("name", &entry)and it returns the offset and size for you.Quoted 2 lines
- make sure the binary can be signed and the signature is evaluated before using it
Do you mean signed or hashed? I think you mean hashed. If you trust the U-Boot binary then presumably you can put the firmware in a similar place do you can trust that as well. After all, you seem happy enough to link it into U-Boot.
If not, you can ask binman to add a hash:
my-firmware { type = "blob"; hash { algo = "sha256"; }; };Then you can add support for that to some sort of helper function in
binman.c, e.g.:ofnode node, hashnode;
const u8 *hash;
int size;node =
binman_section_find_node("name"); if (!ofnode_valid(node))
...return error
hashnode =ofnode_read_prop(node, "hash"); if (!ofnode_valid(hashnode))
...return error
hash =ofnode_read_prop(hashnode, "value", &size);/* Hash the firmware...need to read it from flash into fwdata/fwlen using
binman_entry_find()...then: */
u8 digest[SHA256_SUM_LEN];
ret = hash_block("sha256", fwdata, fwlen, digest, sizeof(digest); if (ret)
returnlog_msg_ret("hash", ret);Quoted 4 lines
/* compare the hashes */
if (size != sizeof(digest) ||memcmp(hash, digest))
returnlog_msg_ret("cmp", ret);Yes, it will likely be a hash that will be signed, and all that will be checked by SPL when loading proper. The infrastructure for that should be there, just not yet plugged for the way of loading things like we do (one of my todos).
Quoted 4 lines
Obviously, what would be simplest for that is to have the watchdog blob embedded, rather than separately hashed, as that would Just Work. I didn't fully grasp yet what you propose, but it seems right now it will complicate things. I'm not saying it will make it impossible, just harder.
I'm not even sure that is true. In binman, add the entry:
watchdog-firmware { type = "blob"; filename = "..."; };In the C code, declare a symbol that will get the image position of the entry:
binman_sym_declare(unsigned long, watchdog_firmware, image_pos);then read that value when you need it:
Quoted 8 lines
int
check_it(..){ ulong pos = binman_sym(ulong, watchdog_firmware, image_pos); // read from flash offset @pos into a buffer // check the hash };This function is the extra boilerplate code that is not needed when the blob is simply part of the U-Boot binary that is loaded and checked by SPL. The worst part of this: It requires special handling of different storage media. We currently only have OSPI for out board, but you may also imagine versions that load U-Boot from filesystems (the TI EVM does that). So this is the extra complexity without extra value I'm always talking about.
But I'm happy to take concrete suggestions where to add the firmware into our board and where to add the necessary code in a simple way.
What we do so far: U-Boot proper and DTBs go into a fit image that SPL will load (and later also validate). It would be simple to do
arch/arm/dts/k3-am65-iot2050-boot-image.dtsi +5
-0@@ -60,6 +60,11 @@ filename = "arch/arm/dts/k3-am6548-iot2050-advanced.dtb"; }; }; + + k3-rti-firmware { + type = "blob"; + filename = CONFIG_WDT_K3_RTI_FW_FILE; + }; }; configurations {
Quoted 7 lines
in [1] (used by [2]).
But now: How do I communicate that blob address from SPL to U-Boot proper so that I can skip the extra medium-specific loading part and also reuse the fit image validation of SPL? If there is a simple way for that, I could indeed switch the model.
OK, I think I found a trick (outside of binman): Making the firmware an additional loadable in the u-boot fit image, and then picking its location up from /fit-images/k3-rti-wdt-firmware in rti_wdt_load_fw(). That should be nicer then object embedded - without requiring the complexity of separate image loading and validating.
Jan
Signature · 2 lines
Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux
Re: [PATCH v2 4/5] watchdog: rti_wdt: Add support for loading firmware
In reply to Jan KiszkaHi Jan,
Quoted 213 lines · Jan Kiszka
Quoted 202 lines · Simon Glass
Hi Jan,
Quoted 181 lines · Jan Kiszka
Quoted 169 lines · Simon Glass
Hi Jan,
Quoted 109 lines · Jan Kiszka
Quoted 107 lines · Simon Glass
Hi Jan,
Quoted 103 lines · Jan Kiszka
Quoted 91 lines · Simon Glass
Hi,
Quoted 79 lines · Tom Rini
Quoted 70 lines · Lokesh Vutla
Hi Tom,
Quoted 67 lines · Jan Kiszka
Quoted 65 lines · Jan Kiszka
Quoted 59 lines · Tom Rini
On Mon, Jun 07, 2021 at 03:33:52PM +0530, Lokesh Vutla wrote:
+Tom,Hi Tom,
On 02/06/21 3:07 pm, Jan Kiszka wrote:
From: Jan Kiszka <[email protected]>To avoid the need of extra boot scripting on AM65x for loading a
watchdog firmware, add the required rproc init and loading logic for the
first R5F core to the watchdog start handler. In case the R5F cluster is
in lock-step mode, also initialize the second core. The firmware itself
is embedded into U-Boot binary to ease access to it and ensure it is
properly hashed in case of secure boot.One possible firmware source is https://github.com/siemens/k3-rti-wdt.
Signed-off-by: Jan Kiszka <[email protected]>
---
drivers/watchdog/Kconfig | 20 ++++++++++++
drivers/watchdog/Makefile | 5 +++
drivers/watchdog/rti_wdt.c | 58 ++++++++++++++++++++++++++++++++++-
drivers/watchdog/rti_wdt_fw.S | 20 ++++++++++++
4 files changed, 102 insertions(+), 1 deletion(-)
create mode 100644 drivers/watchdog/rti_wdt_fw.Sdiff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index f0ff2612a6..1a1fddfe9f 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -209,6 +209,26 @@ config WDT_K3_RTI
Say Y here if you want to include support for the K3 watchdog
timer (RTI module) available in the K3 generation of processors.+if WDT_K3_RTI
+
+config WDT_K3_RTI_LOAD_FW
+ bool "Load watchdog firmware"
+ depends on REMOTEPROC
+ help
+ Automatically load the specified firmware image into the MCU R5F
+ core 0. On the AM65x, this firmware is supposed to handle the expiry
+ of the watchdog timer, typically by resetting the system.
+
+config WDT_K3_RTI_FW_FILE
+ string "Watchdog firmware image file"
+ default "k3-rti-wdt.fw"
+ depends on WDT_K3_RTI_LOAD_FW
+ help
+ Firmware image to be embedded into U-Boot and loaded on watchdog
+ start.I need your input on this proach. Is it okay to include the linker file unders
drivers?Maybe? I suppose the first thing that springs to mind is why aren't we
using binman and including this blob (which I happily see is GPLv2)
similar to how we do things with x86 for one example.See https://www.mail-archive.com/[email protected]/msg377894.html
Jan
Quoted 6 lines
Quoted 4 lines
Did this help to answer open questions? Otherwise, please let me know.
I'd also like to avoid that his patch alone blocks 1-3 of the series needless - but I would also not mind getting everything in at once.
Can you provide your reviewed-by if you are okay with this approach?
Quoted 8 lines
I was kind of hoping Simon would chime in here on binman usage. So, re-re-reading the above URL, yes, fsloader wouldn't be the right choice for watchdog firmware. But I think
binman_entry_find()and related could work, in general, for this case of "need firmware blob embedded in to image". That said, this isn't just any firmware blob, it's the watchdog firmware. The less reliance on other things the safer it is. That means this would be an exception to the general firmware blob loading rule and yeah, OK, we can do it this way. Sorry for the delay.Quoted 7 lines
Yes I've been a little tied up recently. But I think this should use binman. We really don't want to be building binary firmware into U-Boot itself!
Also Tom says, see x86 for a load of binaries of different types and how they are accessed at runttime. This is what binman is for.
Please take the time and study my arguments. I'm open for better proposals, but they need to be concrete and addressing my points.
Quoted 7 lines
Quoted 2 lines
Do you mean 'properly hashed' and 'easy access', or something else? What can binman not do?
Binman itself can stick things into binary images. But that is at most half of the tasks needed here. I would need concrete guidance how to
- access that binary from u-boot proper in a reasonably simple way
I thought you wanted to access it from SPL. For that you would use linker symbols. See 'Access to binman entry offsets at run time (symbols)' in the binman docs for that.
But for U-Boot proper, the section is 'Access to binman entry offsets at run time (fdt)'. There is no mention of the runtime library that now exists (
binman.h) so I will send a patch for that. But basically you callbinman_entry_find("name", &entry)and it returns the offset and size for you.Quoted 2 lines
- make sure the binary can be signed and the signature is evaluated before using it
Do you mean signed or hashed? I think you mean hashed. If you trust the U-Boot binary then presumably you can put the firmware in a similar place do you can trust that as well. After all, you seem happy enough to link it into U-Boot.
If not, you can ask binman to add a hash:
my-firmware { type = "blob"; hash { algo = "sha256"; }; };Then you can add support for that to some sort of helper function in
binman.c, e.g.:ofnode node, hashnode;
const u8 *hash;
int size;node =
binman_section_find_node("name"); if (!ofnode_valid(node))
...return error
hashnode =ofnode_read_prop(node, "hash"); if (!ofnode_valid(hashnode))
...return error
hash =ofnode_read_prop(hashnode, "value", &size);/* Hash the firmware...need to read it from flash into fwdata/fwlen using
binman_entry_find()...then: */
u8 digest[SHA256_SUM_LEN];
ret = hash_block("sha256", fwdata, fwlen, digest, sizeof(digest); if (ret)
returnlog_msg_ret("hash", ret);Quoted 4 lines
/* compare the hashes */
if (size != sizeof(digest) ||memcmp(hash, digest))
returnlog_msg_ret("cmp", ret);Yes, it will likely be a hash that will be signed, and all that will be checked by SPL when loading proper. The infrastructure for that should be there, just not yet plugged for the way of loading things like we do (one of my todos).
Quoted 4 lines
Obviously, what would be simplest for that is to have the watchdog blob embedded, rather than separately hashed, as that would Just Work. I didn't fully grasp yet what you propose, but it seems right now it will complicate things. I'm not saying it will make it impossible, just harder.
I'm not even sure that is true. In binman, add the entry:
watchdog-firmware { type = "blob"; filename = "..."; };In the C code, declare a symbol that will get the image position of the entry:
binman_sym_declare(unsigned long, watchdog_firmware, image_pos);then read that value when you need it:
Quoted 8 lines
int
check_it(..){ ulong pos = binman_sym(ulong, watchdog_firmware, image_pos); // read from flash offset @pos into a buffer // check the hash };
Quoted 7 lines
This function is the extra boilerplate code that is not needed when the blob is simply part of the U-Boot binary that is loaded and checked by SPL. The worst part of this: It requires special handling of different storage media. We currently only have OSPI for out board, but you may also imagine versions that load U-Boot from filesystems (the TI EVM does that). So this is the extra complexity without extra value I'm always talking about.
Well you should load the whole thing (including U-Boot and the watchdog-firmware) in one go, i.e. put everything into a section called u-boot and SPL should load everything. My 'read from flash offset' could just be 'locate flash offset and determine where it has been loaded already'.
But yes if you have to load it separately it is more complicated. Also that defeats the original goal I think, since the idea was to enable the watchdog fairly early.
Quoted 24 lines
But I'm happy to take concrete suggestions where to add the firmware into our board and where to add the necessary code in a simple way.
What we do so far: U-Boot proper and DTBs go into a fit image that SPL will load (and later also validate). It would be simple to do
arch/arm/dts/k3-am65-iot2050-boot-image.dtsi +5
-0@@ -60,6 +60,11 @@ filename = "arch/arm/dts/k3-am6548-iot2050-advanced.dtb"; }; }; + + k3-rti-firmware { + type = "blob"; + filename = CONFIG_WDT_K3_RTI_FW_FILE; + }; }; configurations {
Quoted 6 lines
in [1] (used by [2]).
But now: How do I communicate that blob address from SPL to U-Boot proper so that I can skip the extra medium-specific loading part and also reuse the fit image validation of SPL? If there is a simple way for that, I could indeed switch the model.
The easiest way might be to put everything in a section:
u-boot { // name this so that SPL locates the image_pos/size symbols
type = "section";
u-boot {
};
k3-rti-firmware {
};
};
But I suppose you could also do things with a special SPL loader if necessary.
Regards,
Simon
PATCH v2 5/5 configs: iot2050: Enable watchdog support, but do not auto-start it
In reply to Jan KiszkaFrom: Jan Kiszka <[email protected]>
This allows to use the watchdog in custom scripts but does not enforce that the OS has to support it as well.
--- configs/iot2050_defconfig | 6 ++++++ 1 file changed, 6 insertions(+)
configs/iot2050_defconfig +6 -0
@@ -52,6 +52,7 @@ CONFIG_CMD_MMC=y CONFIG_CMD_PCI=y CONFIG_CMD_REMOTEPROC=y CONFIG_CMD_USB=y +CONFIG_CMD_WDT=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_TIME=y # CONFIG_ISO_PARTITION is not set
@@ -136,5 +137,10 @@ CONFIG_USB_XHCI_DWC3=y CONFIG_USB_DWC3=y CONFIG_USB_DWC3_GENERIC=y CONFIG_USB_KEYBOARD=y +# CONFIG_WATCHDOG is not set +# CONFIG_WATCHDOG_AUTOSTART is not set +CONFIG_WDT=y +CONFIG_WDT_K3_RTI=y +CONFIG_WDT_K3_RTI_LOAD_FW=y CONFIG_FAT_WRITE=y CONFIG_OF_LIBFDT_OVERLAY=y
Signature · 1 line
2.26.2
Quoted 19 lines · Jan Kiszka
This is the baseline support for the SIMATIC IOT2050 devices.
Changes in v2:
- rebased
- sync with upstream-accepted DT
- add boot switch
- include watchdog supportAllows to boot mainline 5.10 kernels, but not the original BSP-derived kernel we currently ship as reference. This is due to the TI sysfw ABI breakages between 2.x and 3.x. We will soon provide a transitional kernel that allows booting both firmware ABIs - as long as full upstream kernel support is work in progress.
Note that this baseline support lacks Ethernet drivers. We are working closely with TI to ensure that the to-be-upstreamed icssg-prueth driver will work both with new SR2.0 AM65x silicon as well as with SR1.0 which is used in the currently shipped IOT2050 devices.
Quoted 7 lines
A staging tree for complete IOT2050 support can be found at [1]. Full image integration is available via [2].
Regarding patch 4: There has been some doubts on the proposed approach, but there has been also no suggestion provided for a similarly lightweight and secure embedding method. Therefore, I'm proposing our solution once again.
There are multiple checkpatch issues with this series. Can you fix them where ever possible?
➜ u-boot-ti git:(for-next) ./scripts/checkpatch.pl --strict siemens/*.patch
--------------------------------------------------------siemens/0001-arm-dts-Add-IOT2050-device-tree-files.patch
--------------------------------------------------------
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #50:
new file mode 100644
WARNING: line length of 102 exceeds 100 columns #103: FILE: arch/arm/dts/k3-am65-iot2050-boot-image.dtsi:49:
+ filename = "arch/arm/dts/k3-am6528-iot2050-basic.dtb";
WARNING: line length of 105 exceeds 100 columns #113: FILE: arch/arm/dts/k3-am65-iot2050-boot-image.dtsi:59:
+ filename = "arch/arm/dts/k3-am6548-iot2050-advanced.dtb";
total: 0 errors, 3 warnings, 0 checks, 1025 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
siemens/0001-arm-dts-Add-IOT2050-device-tree-files.patch has style problems, please review.
-----------------------------------------------------------------------siemens/0002-board-siemens-Add-support-for-SIMATIC-IOT2050-device.patch
-----------------------------------------------------------------------
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #53:
new file mode 100644
WARNING: Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible #282: FILE: board/siemens/iot2050/board.c:86:
+#ifdef CONFIG_NET
WARNING: Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible #338: FILE: board/siemens/iot2050/board.c:142:
+#ifdef CONFIG_SPL_LOAD_FIT
WARNING: Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible #361: FILE: board/siemens/iot2050/board.c:165:
+#ifdef CONFIG_IOT2050_BOOT_SWITCH
WARNING: Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible #404: FILE: board/siemens/iot2050/board.c:208:
+#ifdef CONFIG_IOT2050_BOOT_SWITCH
WARNING: Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible #413: FILE: board/siemens/iot2050/board.c:217:
+#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
WARNING: Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible #458: FILE: board/siemens/iot2050/board.c:262:
+#if CONFIG_IS_ENABLED(LED)
CHECK: Macro argument reuse 'func' - possible side-effects? #683: FILE: include/configs/iot2050.h:43:
+#define BOOT_TARGET_DEVICES(func) \
+ func(MMC, mmc, 1) \
+ func(MMC, mmc, 0) \
+ func(USB, usb, 0) \
+ func(USB, usb, 1) \
+ func(USB, usb, 2)
total: 0 errors, 7 warnings, 1 checks, 606 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
siemens/0002-board-siemens-Add-support-for-SIMATIC-IOT2050-device.patch has style problems, please review.
------------------------------------------------------------------siemens/0003-arm64-dts-ti-k3-am65-mcu-Add-RTI-watchdog-entry.patch
------------------------------------------------------------------
total: 0 errors, 0 warnings, 0 checks, 13 lines checked
siemens/0003-arm64-dts-ti-k3-am65-mcu-Add-RTI-watchdog-entry.patch has no obvious style problems and is ready for submission.
--------------------------------------------------------------------siemens/0004-watchdog-rti_wdt-Add-support-for-loading-firmware.patch
--------------------------------------------------------------------
WARNING: externs should be avoided in .c files
#95: FILE: drivers/watchdog/rti_wdt.c:47:
+extern const u32 rti_wdt_fw[];
WARNING: externs should be avoided in .c files
#96: FILE: drivers/watchdog/rti_wdt.c:48:
+extern const int rti_wdt_fw_size;
WARNING: Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible #100: FILE: drivers/watchdog/rti_wdt.c:52:
+#ifdef CONFIG_WDT_K3_RTI_LOAD_FW
WARNING: Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible #113: FILE: drivers/watchdog/rti_wdt.c:64:
+#ifdef CONFIG_WDT_K3_RTI_LOAD_FW
WARNING: labels should not be indented
#116: FILE: drivers/watchdog/rti_wdt.c:67:
+ dt_error:
WARNING: labels should not be indented
#137: FILE: drivers/watchdog/rti_wdt.c:88:
+ fw_error:
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #163:
new file mode 100644
WARNING: Improper SPDX comment style for 'drivers/watchdog/rti_wdt_fw.S', please use '/*' instead
#168: FILE: drivers/watchdog/rti_wdt_fw.S:1:
+// SPDX-License-Identifier: GPL-2.0+
WARNING: Missing or malformed SPDX-License-Identifier tag in line 1 #168: FILE: drivers/watchdog/rti_wdt_fw.S:1:
+// SPDX-License-Identifier: GPL-2.0+
total: 0 errors, 9 warnings, 0 checks, 139 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
siemens/0004-watchdog-rti_wdt-Add-support-for-loading-firmware.patch has style problems, please review.
-----------------------------------------------------------------------siemens/0005-configs-iot2050-Enable-watchdog-support-but-do-not-a.patch
-----------------------------------------------------------------------
Thanks and regards,
Lokesh
Quoted 152 lines · Lokesh Vutla
Quoted 19 lines · Jan Kiszka
This is the baseline support for the SIMATIC IOT2050 devices.
Changes in v2:
- rebased
- sync with upstream-accepted DT
- add boot switch
- include watchdog supportAllows to boot mainline 5.10 kernels, but not the original BSP-derived kernel we currently ship as reference. This is due to the TI sysfw ABI breakages between 2.x and 3.x. We will soon provide a transitional kernel that allows booting both firmware ABIs - as long as full upstream kernel support is work in progress.
Note that this baseline support lacks Ethernet drivers. We are working closely with TI to ensure that the to-be-upstreamed icssg-prueth driver will work both with new SR2.0 AM65x silicon as well as with SR1.0 which is used in the currently shipped IOT2050 devices.
Quoted 7 lines
A staging tree for complete IOT2050 support can be found at [1]. Full image integration is available via [2].
Regarding patch 4: There has been some doubts on the proposed approach, but there has been also no suggestion provided for a similarly lightweight and secure embedding method. Therefore, I'm proposing our solution once again.
There are multiple checkpatch issues with this series. Can you fix them where ever possible?
➜ u-boot-ti git:(for-next)
./scripts/checkpatch.pl--strict siemens/*.patch
--------------------------------------------------------siemens/0001-arm-dts-Add-IOT2050-device-tree-files.patch
--------------------------------------------------------
WARNING: added, moved or deleted file(s), doesMAINTAINERSneed updating? #50:
new file mode 100644WARNING: line length of 102 exceeds 100 columns #103: FILE:
arch/arm/dts/k3-am65-iot2050-boot-image.dtsi:49:(quoted diff) +1
-0+ filename = "arch/arm/dts/k3-am6528-iot2050-basic.dtb";WARNING: line length of 105 exceeds 100 columns #113: FILE:
arch/arm/dts/k3-am65-iot2050-boot-image.dtsi:59:(quoted diff) +1
-0+ filename = "arch/arm/dts/k3-am6548-iot2050-advanced.dtb";total: 0 errors, 3 warnings, 0 checks, 1025 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
siemens/0001-arm-dts-Add-IOT2050-device-tree-files.patchhas style problems, please review.
-----------------------------------------------------------------------siemens/0002-board-siemens-Add-support-for-SIMATIC-IOT2050-device.patch
-----------------------------------------------------------------------
WARNING: added, moved or deleted file(s), doesMAINTAINERSneed updating? #53:
new file mode 100644WARNING: Use 'if (
IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible #282: FILE:board/siemens/iot2050/board.c:86:
+#ifdefCONFIG_NETWARNING: Use 'if (
IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible #338: FILE:board/siemens/iot2050/board.c:142:
+#ifdefCONFIG_SPL_LOAD_FITWARNING: Use 'if (
IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible #361: FILE:board/siemens/iot2050/board.c:165:
+#ifdefCONFIG_IOT2050_BOOT_SWITCHWARNING: Use 'if (
IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible #404: FILE:board/siemens/iot2050/board.c:208:
+#ifdefCONFIG_IOT2050_BOOT_SWITCHWARNING: Use 'if (
IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible #413: FILE:board/siemens/iot2050/board.c:217:
+#ifdefined(CONFIG_OF_LIBFDT)&&defined(CONFIG_OF_BOARD_SETUP)WARNING: Use 'if (
IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible #458: FILE:board/siemens/iot2050/board.c:262:
+#ifCONFIG_IS_ENABLED(LED)CHECK: Macro argument reuse 'func' - possible side-effects? #683: FILE:
include/configs/iot2050.h:43:(quoted diff) +6
-0+#define BOOT_TARGET_DEVICES(func) \ + func(MMC, mmc, 1) \ + func(MMC, mmc, 0) \ + func(USB, usb, 0) \ + func(USB, usb, 1) \ + func(USB, usb, 2)total: 0 errors, 7 warnings, 1 checks, 606 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
siemens/0002-board-siemens-Add-support-for-SIMATIC-IOT2050-device.patchhas style problems, please review.
------------------------------------------------------------------siemens/0003-arm64-dts-ti-k3-am65-mcu-Add-RTI-watchdog-entry.patch
------------------------------------------------------------------
total: 0 errors, 0 warnings, 0 checks, 13 lines checked
siemens/0003-arm64-dts-ti-k3-am65-mcu-Add-RTI-watchdog-entry.patchhas no obvious style problems and is ready for submission.
--------------------------------------------------------------------siemens/0004-watchdog-rti_wdt-Add-support-for-loading-firmware.patch
--------------------------------------------------------------------
WARNING: externs should be avoided in .c files
#95: FILE:drivers/watchdog/rti_wdt.c:47:
+extern const u32 rti_wdt_fw[];WARNING: externs should be avoided in .c files
#96: FILE:drivers/watchdog/rti_wdt.c:48:
+extern const intrti_wdt_fw_size;WARNING: Use 'if (
IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible #100: FILE:drivers/watchdog/rti_wdt.c:52:
+#ifdefCONFIG_WDT_K3_RTI_LOAD_FWWARNING: Use 'if (
IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible #113: FILE:drivers/watchdog/rti_wdt.c:64:
+#ifdefCONFIG_WDT_K3_RTI_LOAD_FWWARNING: labels should not be indented
#116: FILE:drivers/watchdog/rti_wdt.c:67:(quoted diff) +1
-0+ dt_error:WARNING: labels should not be indented
#137: FILE:drivers/watchdog/rti_wdt.c:88:(quoted diff) +1
-0+ fw_error:WARNING: added, moved or deleted file(s), does
MAINTAINERSneed updating? #163:
new file mode 100644WARNING: Improper SPDX comment style for '
drivers/watchdog/rti_wdt_fw.S', please use '/*' instead
#168: FILE:drivers/watchdog/rti_wdt_fw.S:1:
+// SPDX-License-Identifier: GPL-2.0+WARNING: Missing or malformed SPDX-License-Identifier tag in line 1 #168: FILE:
drivers/watchdog/rti_wdt_fw.S:1:
+// SPDX-License-Identifier: GPL-2.0+total: 0 errors, 9 warnings, 0 checks, 139 lines checked
Quoted 8 lines
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
siemens/0004-watchdog-rti_wdt-Add-support-for-loading-firmware.patchhas style problems, please review.
-----------------------------------------------------------------------siemens/0005-configs-iot2050-Enable-watchdog-support-but-do-not-a.patch
-----------------------------------------------------------------------
Since I just pointed out some checkpatch problems to Lokesh in his last PR, I should note that out of all of this list, I only really care about the SPDX one. There are plenty of cases where:
#ifdef CONFIG_FOO
...
#endif
is more readable / clear than:
if (IS_ENABLED(CONFIG_FOO)) {
...
}Warnings are warning and can be ignored for good reason, errors cannot.
Signature · 1 line
Tom
Quoted 169 lines · Tom Rini
Quoted 152 lines · Lokesh Vutla
Quoted 19 lines · Jan Kiszka
This is the baseline support for the SIMATIC IOT2050 devices.
Changes in v2:
- rebased
- sync with upstream-accepted DT
- add boot switch
- include watchdog supportAllows to boot mainline 5.10 kernels, but not the original BSP-derived kernel we currently ship as reference. This is due to the TI sysfw ABI breakages between 2.x and 3.x. We will soon provide a transitional kernel that allows booting both firmware ABIs - as long as full upstream kernel support is work in progress.
Note that this baseline support lacks Ethernet drivers. We are working closely with TI to ensure that the to-be-upstreamed icssg-prueth driver will work both with new SR2.0 AM65x silicon as well as with SR1.0 which is used in the currently shipped IOT2050 devices.
Quoted 7 lines
A staging tree for complete IOT2050 support can be found at [1]. Full image integration is available via [2].
Regarding patch 4: There has been some doubts on the proposed approach, but there has been also no suggestion provided for a similarly lightweight and secure embedding method. Therefore, I'm proposing our solution once again.
There are multiple checkpatch issues with this series. Can you fix them where ever possible?
➜ u-boot-ti git:(for-next)
./scripts/checkpatch.pl--strict siemens/*.patch
--------------------------------------------------------siemens/0001-arm-dts-Add-IOT2050-device-tree-files.patch
--------------------------------------------------------
WARNING: added, moved or deleted file(s), doesMAINTAINERSneed updating? #50:
new file mode 100644WARNING: line length of 102 exceeds 100 columns #103: FILE:
arch/arm/dts/k3-am65-iot2050-boot-image.dtsi:49:(quoted diff) +1
-0+ filename = "arch/arm/dts/k3-am6528-iot2050-basic.dtb";WARNING: line length of 105 exceeds 100 columns #113: FILE:
arch/arm/dts/k3-am65-iot2050-boot-image.dtsi:59:(quoted diff) +1
-0+ filename = "arch/arm/dts/k3-am6548-iot2050-advanced.dtb";total: 0 errors, 3 warnings, 0 checks, 1025 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
siemens/0001-arm-dts-Add-IOT2050-device-tree-files.patchhas style problems, please review.
-----------------------------------------------------------------------siemens/0002-board-siemens-Add-support-for-SIMATIC-IOT2050-device.patch
-----------------------------------------------------------------------
WARNING: added, moved or deleted file(s), doesMAINTAINERSneed updating? #53:
new file mode 100644WARNING: Use 'if (
IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible #282: FILE:board/siemens/iot2050/board.c:86:
+#ifdefCONFIG_NETWARNING: Use 'if (
IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible #338: FILE:board/siemens/iot2050/board.c:142:
+#ifdefCONFIG_SPL_LOAD_FITWARNING: Use 'if (
IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible #361: FILE:board/siemens/iot2050/board.c:165:
+#ifdefCONFIG_IOT2050_BOOT_SWITCHWARNING: Use 'if (
IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible #404: FILE:board/siemens/iot2050/board.c:208:
+#ifdefCONFIG_IOT2050_BOOT_SWITCHWARNING: Use 'if (
IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible #413: FILE:board/siemens/iot2050/board.c:217:
+#ifdefined(CONFIG_OF_LIBFDT)&&defined(CONFIG_OF_BOARD_SETUP)WARNING: Use 'if (
IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible #458: FILE:board/siemens/iot2050/board.c:262:
+#ifCONFIG_IS_ENABLED(LED)CHECK: Macro argument reuse 'func' - possible side-effects? #683: FILE:
include/configs/iot2050.h:43:(quoted diff) +6
-0+#define BOOT_TARGET_DEVICES(func) \ + func(MMC, mmc, 1) \ + func(MMC, mmc, 0) \ + func(USB, usb, 0) \ + func(USB, usb, 1) \ + func(USB, usb, 2)total: 0 errors, 7 warnings, 1 checks, 606 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
siemens/0002-board-siemens-Add-support-for-SIMATIC-IOT2050-device.patchhas style problems, please review.
------------------------------------------------------------------siemens/0003-arm64-dts-ti-k3-am65-mcu-Add-RTI-watchdog-entry.patch
------------------------------------------------------------------
total: 0 errors, 0 warnings, 0 checks, 13 lines checked
siemens/0003-arm64-dts-ti-k3-am65-mcu-Add-RTI-watchdog-entry.patchhas no obvious style problems and is ready for submission.
--------------------------------------------------------------------siemens/0004-watchdog-rti_wdt-Add-support-for-loading-firmware.patch
--------------------------------------------------------------------
WARNING: externs should be avoided in .c files
#95: FILE:drivers/watchdog/rti_wdt.c:47:
+extern const u32 rti_wdt_fw[];WARNING: externs should be avoided in .c files
#96: FILE:drivers/watchdog/rti_wdt.c:48:
+extern const intrti_wdt_fw_size;WARNING: Use 'if (
IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible #100: FILE:drivers/watchdog/rti_wdt.c:52:
+#ifdefCONFIG_WDT_K3_RTI_LOAD_FWWARNING: Use 'if (
IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible #113: FILE:drivers/watchdog/rti_wdt.c:64:
+#ifdefCONFIG_WDT_K3_RTI_LOAD_FWWARNING: labels should not be indented
#116: FILE:drivers/watchdog/rti_wdt.c:67:(quoted diff) +1
-0+ dt_error:WARNING: labels should not be indented
#137: FILE:drivers/watchdog/rti_wdt.c:88:(quoted diff) +1
-0+ fw_error:WARNING: added, moved or deleted file(s), does
MAINTAINERSneed updating? #163:
new file mode 100644WARNING: Improper SPDX comment style for '
drivers/watchdog/rti_wdt_fw.S', please use '/*' instead
#168: FILE:drivers/watchdog/rti_wdt_fw.S:1:
+// SPDX-License-Identifier: GPL-2.0+WARNING: Missing or malformed SPDX-License-Identifier tag in line 1 #168: FILE:
drivers/watchdog/rti_wdt_fw.S:1:
+// SPDX-License-Identifier: GPL-2.0+total: 0 errors, 9 warnings, 0 checks, 139 lines checked
Quoted 8 lines
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
siemens/0004-watchdog-rti_wdt-Add-support-for-loading-firmware.patchhas style problems, please review.
-----------------------------------------------------------------------siemens/0005-configs-iot2050-Enable-watchdog-support-but-do-not-a.patch
-----------------------------------------------------------------------Since I just pointed out some checkpatch problems to Lokesh in his last PR, I should note that out of all of this list, I only really care about the SPDX one. There are plenty of cases where:
#ifdefCONFIG_FOO
...
#endif
Quoted 8 lines
is more readable / clear than:
if (IS_ENABLED(CONFIG_FOO)) { ... }Warnings are warning and can be ignored for good reason, errors cannot.
I've done some fixes (including the SPDX one), still need to retest. v3 will follow.
Jan
Signature · 2 lines
Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux