[PATCH 0/2] Enable private ATF handoff structure

Hi,
Xilinx ZynqMP platform is using from the beggining specific structure which is passed from FSBL/SPL to ATF. Maybe in future both options can be supported by ATF and we can remove this private structure completely. But as of now bl31_params are completely ignored by ATF by RESET_TO_BL31=1 build flag.
Thanks, Michal
Michal Simek (2): spl: atf: Enable option to rewrite bl2_plat_get_bl31_params() arm: zynqmp: Wire SPL/ATF handoff structure properly
arch/arm/mach-zynqmp/handoff.c | 17 +++++++++++----- arch/arm/mach-zynqmp/include/mach/sys_proto.h | 2 -- arch/arm/mach-zynqmp/spl.c | 2 -- common/spl/spl_atf.c | 15 +------------- include/spl.h | 20 +++++++++++++++++++ 5 files changed, 33 insertions(+), 23 deletions(-)

Xilinx ZynqMP platform is passing information to ATF in private format and ATF bl31 parameters are not used. That's why enable option to rewrite this function by platform specific implementation.
The patch also move and update kernel-doc format with missing parameters.
Signed-off-by: Michal Simek michal.simek@xilinx.com ---
common/spl/spl_atf.c | 15 +-------------- include/spl.h | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/common/spl/spl_atf.c b/common/spl/spl_atf.c index 24fd35ed85f4..702367b2a23c 100644 --- a/common/spl/spl_atf.c +++ b/common/spl/spl_atf.c @@ -18,20 +18,7 @@ static struct bl2_to_bl31_params_mem bl31_params_mem; static struct bl31_params *bl2_to_bl31_params;
-/** - * bl2_plat_get_bl31_params() - prepare params for bl31. - * - * This function assigns a pointer to the memory that the platform has kept - * aside to pass platform specific and trusted firmware related information - * to BL31. This memory is allocated by allocating memory to - * bl2_to_bl31_params_mem structure which is a superset of all the - * structure whose information is passed to BL31 - * NOTE: This function should be called only once and should be done - * before generating params to BL31 - * - * @return bl31 params structure pointer - */ -static struct bl31_params *bl2_plat_get_bl31_params(uintptr_t bl32_entry, +__weak struct bl31_params *bl2_plat_get_bl31_params(uintptr_t bl32_entry, uintptr_t bl33_entry, uintptr_t fdt_addr) { diff --git a/include/spl.h b/include/spl.h index 08ffddac29f2..90162f2e36a1 100644 --- a/include/spl.h +++ b/include/spl.h @@ -442,6 +442,26 @@ int spl_ymodem_load_image(struct spl_image_info *spl_image, */ void spl_invoke_atf(struct spl_image_info *spl_image);
+/** + * bl2_plat_get_bl31_params() - prepare params for bl31. + * @bl32_entry address of BL32 executable (secure) + * @bl33_entry address of BL33 executable (non secure) + * @fdt_addr address of Flat Device Tree + * + * This function assigns a pointer to the memory that the platform has kept + * aside to pass platform specific and trusted firmware related information + * to BL31. This memory is allocated by allocating memory to + * bl2_to_bl31_params_mem structure which is a superset of all the + * structure whose information is passed to BL31 + * NOTE: This function should be called only once and should be done + * before generating params to BL31 + * + * @return bl31 params structure pointer + */ +struct bl31_params *bl2_plat_get_bl31_params(uintptr_t bl32_entry, + uintptr_t bl33_entry, + uintptr_t fdt_addr); + /** * spl_optee_entry - entry function for optee *

handoff_setup() was used to generate fixed handoff structure for ATF on ZynqMP platform. Switching to bl2_plat_get_bl31_params() platform brings more flexibility because information can be taken from fit image where /fit-images node is created at run time.
Signed-off-by: Michal Simek michal.simek@xilinx.com ---
arch/arm/mach-zynqmp/handoff.c | 17 ++++++++++++----- arch/arm/mach-zynqmp/include/mach/sys_proto.h | 2 -- arch/arm/mach-zynqmp/spl.c | 2 -- 3 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/arch/arm/mach-zynqmp/handoff.c b/arch/arm/mach-zynqmp/handoff.c index f71ff7b3d257..64e5320acc68 100644 --- a/arch/arm/mach-zynqmp/handoff.c +++ b/arch/arm/mach-zynqmp/handoff.c @@ -66,7 +66,9 @@ struct xfsbl_atf_handoff_params { };
#ifdef CONFIG_SPL_OS_BOOT -void handoff_setup(void) +struct bl31_params *bl2_plat_get_bl31_params(uintptr_t bl32_entry, + uintptr_t bl33_entry, + uintptr_t fdt_addr) { struct xfsbl_atf_handoff_params *atfhandoffparams;
@@ -76,11 +78,16 @@ void handoff_setup(void) atfhandoffparams->magic[2] = 'N'; atfhandoffparams->magic[3] = 'X';
- atfhandoffparams->num_entries = 1; - atfhandoffparams->partition[0].entry_point = CONFIG_SYS_TEXT_BASE; - atfhandoffparams->partition[0].flags = FSBL_FLAGS_EL2 << - FSBL_FLAGS_EL_SHIFT; + atfhandoffparams->num_entries = 0; + if (bl33_entry) { + atfhandoffparams->partition[0].entry_point = bl33_entry; + atfhandoffparams->partition[0].flags = FSBL_FLAGS_EL2 << + FSBL_FLAGS_EL_SHIFT; + atfhandoffparams->num_entries++; + }
writel(CONFIG_SPL_TEXT_BASE, &pmu_base->gen_storage6); + + return NULL; } #endif diff --git a/arch/arm/mach-zynqmp/include/mach/sys_proto.h b/arch/arm/mach-zynqmp/include/mach/sys_proto.h index 10b70761de4a..2974ffbc2f56 100644 --- a/arch/arm/mach-zynqmp/include/mach/sys_proto.h +++ b/arch/arm/mach-zynqmp/include/mach/sys_proto.h @@ -46,8 +46,6 @@ struct zynqmp_ipi_msg { int zynq_board_read_rom_ethaddr(unsigned char *ethaddr); unsigned int zynqmp_get_silicon_version(void);
-void handoff_setup(void); - int zynqmp_mmio_write(const u32 address, const u32 mask, const u32 value); int zynqmp_mmio_read(const u32 address, u32 *value);
diff --git a/arch/arm/mach-zynqmp/spl.c b/arch/arm/mach-zynqmp/spl.c index 8cb82635fa3a..a83e095687f6 100644 --- a/arch/arm/mach-zynqmp/spl.c +++ b/arch/arm/mach-zynqmp/spl.c @@ -120,8 +120,6 @@ u32 spl_boot_device(void) #ifdef CONFIG_SPL_OS_BOOT int spl_start_uboot(void) { - handoff_setup(); - return 0; } #endif

čt 19. 12. 2019 v 18:32 odesílatel Michal Simek michal.simek@xilinx.com napsal:
Hi,
Xilinx ZynqMP platform is using from the beggining specific structure which is passed from FSBL/SPL to ATF. Maybe in future both options can be supported by ATF and we can remove this private structure completely. But as of now bl31_params are completely ignored by ATF by RESET_TO_BL31=1 build flag.
Thanks, Michal
Michal Simek (2): spl: atf: Enable option to rewrite bl2_plat_get_bl31_params() arm: zynqmp: Wire SPL/ATF handoff structure properly
arch/arm/mach-zynqmp/handoff.c | 17 +++++++++++----- arch/arm/mach-zynqmp/include/mach/sys_proto.h | 2 -- arch/arm/mach-zynqmp/spl.c | 2 -- common/spl/spl_atf.c | 15 +------------- include/spl.h | 20 +++++++++++++++++++ 5 files changed, 33 insertions(+), 23 deletions(-)
-- 2.24.0
Applied. M

On 1/16/20 8:25 AM, Michal Simek wrote:
čt 19. 12. 2019 v 18:32 odesílatel Michal Simek michal.simek@xilinx.com napsal:
Hi,
Xilinx ZynqMP platform is using from the beggining specific structure which is passed from FSBL/SPL to ATF. Maybe in future both options can be supported by ATF and we can remove this private structure completely. But as of now bl31_params are completely ignored by ATF by RESET_TO_BL31=1 build flag.
Thanks, Michal
Michal Simek (2): spl: atf: Enable option to rewrite bl2_plat_get_bl31_params() arm: zynqmp: Wire SPL/ATF handoff structure properly
arch/arm/mach-zynqmp/handoff.c | 17 +++++++++++----- arch/arm/mach-zynqmp/include/mach/sys_proto.h | 2 -- arch/arm/mach-zynqmp/spl.c | 2 -- common/spl/spl_atf.c | 15 +------------- include/spl.h | 20 +++++++++++++++++++ 5 files changed, 33 insertions(+), 23 deletions(-)
-- 2.24.0
Applied.
Can't you rather pass DT around ?

On 16. 01. 20 10:10, Marek Vasut wrote:
On 1/16/20 8:25 AM, Michal Simek wrote:
čt 19. 12. 2019 v 18:32 odesílatel Michal Simek michal.simek@xilinx.com napsal:
Hi,
Xilinx ZynqMP platform is using from the beggining specific structure which is passed from FSBL/SPL to ATF. Maybe in future both options can be supported by ATF and we can remove this private structure completely. But as of now bl31_params are completely ignored by ATF by RESET_TO_BL31=1 build flag.
Thanks, Michal
Michal Simek (2): spl: atf: Enable option to rewrite bl2_plat_get_bl31_params() arm: zynqmp: Wire SPL/ATF handoff structure properly
arch/arm/mach-zynqmp/handoff.c | 17 +++++++++++----- arch/arm/mach-zynqmp/include/mach/sys_proto.h | 2 -- arch/arm/mach-zynqmp/spl.c | 2 -- common/spl/spl_atf.c | 15 +------------- include/spl.h | 20 +++++++++++++++++++ 5 files changed, 33 insertions(+), 23 deletions(-)
-- 2.24.0
Applied.
Can't you rather pass DT around ?
Unfortunately not. The best will be just update ATF to support standard method how to get information but that means that we break all backward compatibility and nothing will work. Xilinx handoff structure is around fro quite a long time and that's something I need to unfortunately live with.
Thanks, Michal

On 1/16/20 10:42 AM, Michal Simek wrote:
On 16. 01. 20 10:10, Marek Vasut wrote:
On 1/16/20 8:25 AM, Michal Simek wrote:
čt 19. 12. 2019 v 18:32 odesílatel Michal Simek michal.simek@xilinx.com napsal:
Hi,
Xilinx ZynqMP platform is using from the beggining specific structure which is passed from FSBL/SPL to ATF. Maybe in future both options can be supported by ATF and we can remove this private structure completely. But as of now bl31_params are completely ignored by ATF by RESET_TO_BL31=1 build flag.
Thanks, Michal
Michal Simek (2): spl: atf: Enable option to rewrite bl2_plat_get_bl31_params() arm: zynqmp: Wire SPL/ATF handoff structure properly
arch/arm/mach-zynqmp/handoff.c | 17 +++++++++++----- arch/arm/mach-zynqmp/include/mach/sys_proto.h | 2 -- arch/arm/mach-zynqmp/spl.c | 2 -- common/spl/spl_atf.c | 15 +------------- include/spl.h | 20 +++++++++++++++++++ 5 files changed, 33 insertions(+), 23 deletions(-)
-- 2.24.0
Applied.
Can't you rather pass DT around ?
Unfortunately not. The best will be just update ATF to support standard method how to get information but that means that we break all backward compatibility and nothing will work.
Isn't that what Xilinx does with their ABI between all BSP versions ? The only stable thing is the ABI version, which never changes :-)
Xilinx handoff structure is around fro quite a long time and that's something I need to unfortunately live with.
Maybe you can develop a better method (DT) in parallel and slowly switch over then ?

On 16. 01. 20 11:05, Marek Vasut wrote:
On 1/16/20 10:42 AM, Michal Simek wrote:
On 16. 01. 20 10:10, Marek Vasut wrote:
On 1/16/20 8:25 AM, Michal Simek wrote:
čt 19. 12. 2019 v 18:32 odesílatel Michal Simek michal.simek@xilinx.com napsal:
Hi,
Xilinx ZynqMP platform is using from the beggining specific structure which is passed from FSBL/SPL to ATF. Maybe in future both options can be supported by ATF and we can remove this private structure completely. But as of now bl31_params are completely ignored by ATF by RESET_TO_BL31=1 build flag.
Thanks, Michal
Michal Simek (2): spl: atf: Enable option to rewrite bl2_plat_get_bl31_params() arm: zynqmp: Wire SPL/ATF handoff structure properly
arch/arm/mach-zynqmp/handoff.c | 17 +++++++++++----- arch/arm/mach-zynqmp/include/mach/sys_proto.h | 2 -- arch/arm/mach-zynqmp/spl.c | 2 -- common/spl/spl_atf.c | 15 +------------- include/spl.h | 20 +++++++++++++++++++ 5 files changed, 33 insertions(+), 23 deletions(-)
-- 2.24.0
Applied.
Can't you rather pass DT around ?
Unfortunately not. The best will be just update ATF to support standard method how to get information but that means that we break all backward compatibility and nothing will work.
Isn't that what Xilinx does with their ABI between all BSP versions ? The only stable thing is the ABI version, which never changes :-)
This handoff structure is stable from beginning.
Xilinx handoff structure is around fro quite a long time and that's something I need to unfortunately live with.
Maybe you can develop a better method (DT) in parallel and slowly switch over then ?
bl2_plat_get_bl31_params() is something what it is used by ATF for a long time. Not sure if they are moving to DT way how to describe stuff. But from my point of view having alternatives and a way for conversion is right way to go.
Thanks, Michal
participants (3)
-
Marek Vasut
-
Michal Simek
-
Michal Simek