Re: [PATCH v2 2/2] habv4: use hab rom implementation of report_event

2024-01-16 Thread Ahmad Fatoum
Hello Stefan, On 12.01.24 16:21, Stefan Kerkmann wrote: > +static enum hab_status hab_sip_report_event(enum hab_status status, > + uint32_t index, uint8_t *event, > + size_t *bytes) > +{ > + struct arm_smccc_res re

[PATCH] firmware: fix external firmware dependencies

2024-01-16 Thread Sascha Hauer
A pbl is not rebuilt when the firmware file specified in fw-external-y changes. $(patsubst %.gen.o,$(obj)/%.extgen.pbl.o, $(pbl-y)) is executed before pbl-y actually contains the contents of fw-external-y. Also we want to do the subsitution only for the external firmware files, not for pbl-y. To

Re: [PATCH] firmware: fix external firmware dependencies

2024-01-16 Thread Ahmad Fatoum
Hello Sascha, On 16.01.24 10:10, Sascha Hauer wrote: > A pbl is not rebuilt when the firmware file specified in fw-external-y > changes. > > $(patsubst %.gen.o,$(obj)/%.extgen.pbl.o, $(pbl-y)) is executed before > pbl-y actually contains the contents of fw-external-y. Also we want to > do the sub

Re: [PATCH 2/3] ARM: i.MX8M: return error if imx_load_image can't honour entry address

2024-01-16 Thread Marco Felsch
Hi Ahmad, On 24-01-15, Ahmad Fatoum wrote: > On i.MX6 and 7, we call imx_load_image with start == true and address > equal to entry. > > On i.MX8M, we call imx_load_image with start == false and address > unequal to entry. > > imx_load_image interprets the address being unequal to entry as a > d

[PATCH] fixup! ARM: i.MX8M: return error if imx_load_image can't honour entry address

2024-01-16 Thread Ahmad Fatoum
Align the now outdated comment with reality. Suggested-by: Marco Felsch Signed-off-by: Ahmad Fatoum --- arch/arm/mach-imx/xload-common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-imx/xload-common.c b/arch/arm/mach-imx/xload-common.c index 32f12cd7f574

Re: [PATCH] firmware: fix external firmware dependencies

2024-01-16 Thread Marco Felsch
On 24-01-16, Ahmad Fatoum wrote: > Hello Sascha, > > On 16.01.24 10:10, Sascha Hauer wrote: > > A pbl is not rebuilt when the firmware file specified in fw-external-y > > changes. > > > > $(patsubst %.gen.o,$(obj)/%.extgen.pbl.o, $(pbl-y)) is executed before > > pbl-y actually contains the conten

Re: [PATCH] firmware: fix missing firmware handling for external firmware

2024-01-16 Thread Sascha Hauer
Hi Marco, On Wed, Jan 10, 2024 at 03:59:08PM +0100, Marco Felsch wrote: > Currently we depend on the external firmware file since we need it for > the sha256sum. But this dependency break the 'optional missing firmware' > feature. > > Fix this by dropping the firmware file prerequisite and instea

[PATCH] ARM: i.MX8MP: enhance support for ocotp driver

2024-01-16 Thread Stefan Kerkmann
.feat = &imx8mn_featctrl_data, + .ctrl = &ocotp_ctrl_reg_default, }; static struct imx_ocotp_data imx7d_ocotp_data = { @@ -976,6 +1034,7 @@ static struct imx_ocotp_data imx7d_ocotp_data = { .set_timing = imx7_ocotp_set_timing, .fuse_blow = imx7_fuse_blow_addr, .fuse_read = imx7_fuse_read_addr, + .ctrl = &ocotp_ctrl_reg_default, }; static __maybe_unused struct of_device_id imx_ocotp_dt_ids[] = { --- base-commit: c324e9ea7f8808ae069cd8bd0aa53021c1239bd2 change-id: 20240116-feature-imx8mp-octop-driver-63d2ec54a92d Best regards, -- Stefan Kerkmann

[PATCH] fixup! habv4: use hab rom implementation of report_event

2024-01-16 Thread Marco Felsch
--- drivers/hab/habv4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hab/habv4.c b/drivers/hab/habv4.c index 4e401ca9d362..87c96812c43e 100644 --- a/drivers/hab/habv4.c +++ b/drivers/hab/habv4.c @@ -318,7 +318,7 @@ static enum hab_status imx8m_report_event(enum hab_s

[PATCH v2 09/18] optee: add header version check

2024-01-16 Thread Marco Felsch
OPTEE supports two header versions right now we do only support V1. Signed-off-by: Marco Felsch --- common/optee.c | 5 + include/tee/optee.h | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/common/optee.c b/common/optee.c index fd2b03d06d2d..6a8084839619 100644 --

[PATCH v2 01/18] ARM: i.MX8M: atf: make use of imx8m*_save_bootrom_log macros

2024-01-16 Thread Marco Felsch
Make use of the already existing macros and fix the memory bus width for the i.MX8MQ. Signed-off-by: Marco Felsch Reviewed-by: Ahmad Fatoum --- arch/arm/mach-imx/atf.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-imx/atf.c b/arch/arm/mach-imx/atf

[PATCH v2 00/18] Dynamic OP-TEE Loading

2024-01-16 Thread Marco Felsch
Hi all, by this series it is supported to load OP-TEE to random DRAM locations. The location

[PATCH v2 03/18] ARM: i.MX8M: scratch: make imx_scratch_space private

2024-01-16 Thread Marco Felsch
Make the scratch layout opaque and provide required accessor functions to make it easier to extent it later on. Signed-off-by: Marco Felsch --- arch/arm/mach-imx/romapi.c | 6 ++ arch/arm/mach-imx/scratch.c | 12 +++- include/mach/imx/scratch.h | 6 ++ 3 files changed, 15 ins

[PATCH v2 07/18] common: add OPTEE_SHM_SIZE to configure optee shared memory

2024-01-16 Thread Marco Felsch
An size of 4M seems quite large and upstream OP-TEE code mostly uses 2M for all i.MX platforms. However keep the 4M as default but make it configurable for integrators which want to use the autom. OF fixup logic. Signed-off-by: Marco Felsch --- arch/arm/mach-imx/imx8m.c | 3 ++- common

[PATCH v2 04/18] ARM: i.MX8M: romapi: refactor saving the bootrom log

2024-01-16 Thread Marco Felsch
Saving the bootrom log to the scratch area was the last open coded part. Move the code to the scratch module to make the scratch handling completely opaque. Signed-off-by: Marco Felsch --- arch/arm/mach-imx/atf.c | 12 arch/arm/mach-imx/romapi.c | 6 ++ arch/arm/mach-imx/s

[PATCH v2 02/18] ARM: i.MX8M: bundle imx-scratch code

2024-01-16 Thread Marco Felsch
The scatch code spread over the code base which is ok as long as we use it for the bootrom-log only. This commit bundles the scratch code into a own module to make it easier to adapt later on and to make the scratch space independent of CONFIG_ARCH_IMX_ROMAPI. Signed-off-by: Marco Felsch --- ar

[PATCH v2 08/18] optee: add support to verify 64-bit headers as well

2024-01-16 Thread Marco Felsch
From: Rouven Czerwinski Guard the check by IS_ENABLED() to make it possible to verify 32-bit and 64-bit optee headers. Signed-off-by: Rouven Czerwinski Signed-off-by: Marco Felsch --- common/optee.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/common/optee.c

[PATCH v2 06/18] common: limit BOOTM_OPTEE to 32bit systems

2024-01-16 Thread Marco Felsch
On ARM64 OP-TEE loading requires to be in EL3 so we can't load OP-TEE via bootm on these systems. Signed-off-by: Marco Felsch --- common/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/Kconfig b/common/Kconfig index 02f376c59757..c38cfaed0e9f 100644 --- a/commo

[PATCH v2 05/18] ARM: i.MX8M: scratch: add optee_hdr area

2024-01-16 Thread Marco Felsch
Add a new scratch storage slot for possible optee-hdr information which have to passed between barebox-pbl and barebox-proper. Reserve 512 bytes between the bootrom-log and the optee-hdr in case the bootrom-log need more space in the future. Signed-off-by: Marco Felsch --- arch/arm/mach-imx/scra

[PATCH v2 11/18] optee: optee_verify_header: constify optee_header

2024-01-16 Thread Marco Felsch
Signed-off-by: Marco Felsch --- common/optee.c | 2 +- include/tee/optee.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common/optee.c b/common/optee.c index 2ae28b172bbb..34667f1f51e0 100644 --- a/common/optee.c +++ b/common/optee.c @@ -8,7 +8,7 @@ static u64 op

[PATCH v2 14/18] drivers: tee: optee: add support for dynamic optee memory base address

2024-01-16 Thread Marco Felsch
Make use of the platform provided optee memory base address. Fallback to the current behaviour if the platform doesn't provide the optee memory base. Signed-off-by: Marco Felsch --- drivers/tee/optee/of_fixup.c | 20 1 file changed, 16 insertions(+), 4 deletions(-) diff --g

[PATCH v2 10/18] optee: add helper functions to set/get the optee memory base

2024-01-16 Thread Marco Felsch
Provide helper functions to set/get the optee memory base address gathered previously from the builtin optee binary header. Signed-off-by: Marco Felsch --- common/optee.c | 27 +++ include/tee/optee.h | 18 ++ 2 files changed, 45 insertions(+) diff -

[PATCH v2 13/18] ARM: i.MX8M: add dynamic optee memory of-fixup support

2024-01-16 Thread Marco Felsch
Try to set the dynamic optee memory base address if the builtin optee binary had an header. Signed-off-by: Marco Felsch --- arch/arm/mach-imx/imx8m.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/mach-imx/imx8m.c b/arch/arm/mach-imx/imx8m.c index ca50eec63622..6db16f024148 1006

[PATCH v2 12/18] ARM64: mmu: add dynamic optee memory mapping support

2024-01-16 Thread Marco Felsch
Use the dynamic optee memory base address for the early mapping if possible and fallback to the static mapping if the query failed. Signed-off-by: Marco Felsch --- arch/arm/cpu/mmu_64.c | 14 -- arch/arm/mach-imx/esdctl.c | 4 common/Makefile| 2 +- 3 files ch

[PATCH v2 15/18] ARM: i.MX8M: atf: add support for optee hdr parsing

2024-01-16 Thread Marco Felsch
The OP-TEE binary can contain a header with useful information like loadaddr and size. This commit adds the support to take the header loadaddr into account. If the header is not found the common builtin loadaddr is used. Signed-off-by: Marco Felsch --- arch/arm/mach-imx/atf.c | 27 +

[PATCH v2 16/18] ARM: i.MX8M: allow board code to configure the bl33 loadaddr

2024-01-16 Thread Marco Felsch
At an helper to load_and_start the image on arbitrary load addresses. This should be taken with caution since it requires to configure the TF-A correctly as well, therefore the functions are prefixt with '__'. One use case of the new helper is to place OP-TEE at the very beginning of the DRAM and

[PATCH v2 18/18] ARM: i.MX8M: fix optee of-fixup logic

2024-01-16 Thread Marco Felsch
The current code checks only if "/firmware/optee" exist on the builtin dtb and applys the fixup if not found and if found nothing is done. If a builtin dts contains the node but an external don't the fixup won't be applied. Also if the external dts does have a node + the reserved memory region node

[PATCH v2 17/18] ARM: i.MX8M: cleanup MX8M*_ATF_BL33_BASE_ADDR defines

2024-01-16 Thread Marco Felsch
Instead of having three defines for the same just use the base definition which is MX8M_ATF_BL33_BASE_ADDR and drop the others. Signed-off-by: Marco Felsch --- Documentation/boards/imx/zii-imx8mq-dev/openocd.cfg | 10 +- arch/arm/boards/phytec-som-imx8mq/lowlevel.c| 2 +- arch/a

[PATCH v2 1/2] Port SoC framework from Linux

2024-01-16 Thread Marco Felsch
This adds the initial support for the Linux soc framework which can be used to register all SoC relevant informations. The framework can be used by driver to check for errata for an specific soc(-revision) in the future since this require porting the matching function. For now it gathers all requi

[PATCH v2 2/2] ARM: i.MX8M: convert the machine init to the soc driver

2024-01-16 Thread Marco Felsch
Convert the i.MX8M machine init code to the previously introduced soc framework. The soc driver was mostly copied from Linux with slightly adaptions for barebox. To the soc driver is called during the postcore_initcall to keep the level aligned with the previous imx_init(). The ocotp clock must ke

[PATCH] fixup! pbl: add COMPILE_TEST prompt for PBL_VERIFY_PIGGY

2024-01-16 Thread Marco Felsch
--- - remove the trailing whitespace pbl/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pbl/Kconfig b/pbl/Kconfig index f94791ff8a49..223bf0640e1b 100644 --- a/pbl/Kconfig +++ b/pbl/Kconfig @@ -48,7 +48,7 @@ config PBL_RELOCATABLE config PBL_VERIFY_PIGGY de

Re: [PATCH] fixup! pbl: add COMPILE_TEST prompt for PBL_VERIFY_PIGGY

2024-01-16 Thread Sascha Hauer
On Tue, 16 Jan 2024 18:41:22 +0100, Marco Felsch wrote: > Applied, thanks! [1/1] fixup! pbl: add COMPILE_TEST prompt for PBL_VERIFY_PIGGY (no commit info) Best regards, -- Sascha Hauer

Re: [PATCH] fixup! ARM: i.MX8M: return error if imx_load_image can't honour entry address

2024-01-16 Thread Sascha Hauer
On Tue, 16 Jan 2024 10:49:21 +0100, Ahmad Fatoum wrote: > Align the now outdated comment with reality. > > Applied, thanks! [1/1] fixup! ARM: i.MX8M: return error if imx_load_image can't honour entry address (no commit info) Best regards, -- Sascha Hauer

Re: [PATCH] firmware: fix external firmware dependencies

2024-01-16 Thread Sascha Hauer
On Tue, 16 Jan 2024 10:10:20 +0100, Sascha Hauer wrote: > A pbl is not rebuilt when the firmware file specified in fw-external-y > changes. > > $(patsubst %.gen.o,$(obj)/%.extgen.pbl.o, $(pbl-y)) is executed before > pbl-y actually contains the contents of fw-external-y. Also we want to > do the

Re: [PATCH v2 2/2] habv4: use hab rom implementation of report_event

2024-01-16 Thread Sascha Hauer
On Tue, Jan 16, 2024 at 09:13:48AM +0100, Ahmad Fatoum wrote: > Hello Stefan, > > On 12.01.24 16:21, Stefan Kerkmann wrote: > > +static enum hab_status hab_sip_report_event(enum hab_status status, > > + uint32_t index, uint8_t *event, > > +

Re: [PATCH v2 2/2] habv4: use hab rom implementation of report_event

2024-01-16 Thread Stefan Kerkmann
Hello Ahmad, Hello Sascha, On 17.01.24 08:20, Sascha Hauer wrote: On Tue, Jan 16, 2024 at 09:13:48AM +0100, Ahmad Fatoum wrote: Hello Stefan, On 12.01.24 16:21, Stefan Kerkmann wrote: +static enum hab_status hab_sip_report_event(enum hab_status status, +