Page MenuHomePhabricator

How to use ATF TSP in imx8m mini?
Open, Unbreak Now!Public

Description

Hello,

I want to use the TSP provided by ATF.

However, when I build

make PLAT=imx8mm SPD=tspd
Including services/spd/tspd/tspd.mk
bl32/tsp/tsp.mk:33: *** TSP is not supported on platform imx8mm. Stop.

How do I use TSP?
Thanks

Event Timeline

amorfortune triaged this task as Unbreak Now! priority.Jun 14 2020, 1:11 AM
amorfortune created this task.
amorfortune added a project: TF-A General.

Hi,

Looks like TSP for imx8mm platform is not yet supported. Error indicates that TSP platform makefile
is absent in the platform directory <./plat/imx/imx8m/imx8mm/ >.

Hence to build TSP for imx8mm platform, there is a need to create platform TSP makefile and
corresponding platform source files.

There are several platform TSP makefile presents in source code for reference for e.g as below:

  1. ./plat/socionext/uniphier/tsp/tsp-uniphier.mk -> Unipher platform
  2. ./plat/arm/board/fvp/tsp/tsp-fvp.mk. -> ARM fvp platform.

Please let me know if you need any further information/clarification.

Thanks
Manish Badarkhe

Hi,

Thank you for your reply.

I need more information/clarification.

How to port TSP to imx8mm? I don't know how to do.

I am using
https://github.com/boundarydevices/imx-atf

They said no clue, so I came here for help.

I imitate
./plat/arm/board/fvp/tsp/tsp-fvp.mk. -> ARM fvp platform.
but failed.

The error message is below.

Built build/imx8mm/release/bl31.bin successfully
OD      build/imx8mm/release/bl31/bl31.dump
CC      bl32/tsp/tsp_main.c
CC      bl32/tsp/tsp_interrupt.c
CC      bl32/tsp/tsp_timer.c
CC      plat/arm/board/fvp/drivers/pwrc/fvp_pwrc.c
CC      plat/arm/board/fvp/fvp_topology.c
CC      plat/arm/board/fvp/tsp/fvp_tsp_setup.c
CC      plat/arm/common/arm_topology.c
CC      plat/arm/common/tsp/arm_tsp_setup.c
CC      common/bl_common.c
CC      common/tf_log.c
CC      plat/common/plat_bl_common.c
CC      plat/common/plat_log_common.c
CC      plat/common/aarch64/plat_common.c
AS      bl32/tsp/aarch64/tsp_entrypoint.S
AS      bl32/tsp/aarch64/tsp_exceptions.S
AS      bl32/tsp/aarch64/tsp_request.S
AS      common/aarch64/early_exceptions.S
AS      lib/locks/exclusive/aarch64/spinlock.S
AS      plat/arm/board/fvp/aarch64/fvp_helpers.S
AS      plat/common/aarch64/platform_mp_stack.S
AS      common/aarch64/debug.S
AS      lib/aarch64/cache_helpers.S
AS      lib/aarch64/misc_helpers.S
AS      plat/common/aarch64/platform_helpers.S
PP      bl32/tsp/tsp.ld.S
LD      build/imx8mm/release/bl32/bl32.elf
/home/lm/work/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-ld: invalid origin for memory region RAM
Makefile:721: recipe for target 'build/imx8mm/release/bl32/bl32.elf' failed
make: *** [build/imx8mm/release/bl32/bl32.elf] Error 1

Can you give me some help? Please.

Thanks
LM

Here are my steps. I have no idea.

  1. mkdir plat/imx/imx8mm/tsp

cp plat/arm/board/fvp/tsp/tsp-fvp.mk plat/imx/imx8mm/tsp/tsp-imx8mm.mk

  1. Added

#define TSP_IRQ_SEC_PHY_TIMER 29
#define FVP_CLUSTER_COUNT 1
#define FVP_MAX_CPUS_PER_CLUSTER 4
#define FVP_MAX_PE_PER_CPU 1
#define PLAT_ARM_CLUSTER_COUNT 1
#define PLAT_ARM_TSP_UART_BASE 0x1c0b0000
#define PLAT_ARM_TSP_UART_CLK_IN_HZ 24000000
#define PLAT_ARM_TRUSTED_MAILBOX_BASE 0x04000000
In plat/imx/imx8mm/include/platform_def.h

  1. Modified

plat/arm/board/fvp/drivers/pwrc/fvp_pwrc #include <plat_arm.h> To #include "../../../../../../include/plat/arm/common/plat_arm.h"

  1. Modified include/plat/arm/common/plat_arm.h

#include <arm_xlat_tables.h> To #include "arm_xlat_tables.h"

  1. Modified plat/arm/board/fvp/drivers/pwrc/fvp_pwrc.c

#include <plat_arm.h> To #include "../../../../include/plat/arm/common/plat_arm.h"

  1. Modified plat/arm/board/fvp/fvp_topology.c

#include <arm_config.h> To #include "../../../../include/plat/arm/common/arm_config.h"
#include <plat_arm.h> To #include "../../../../include/plat/arm/common/plat_arm.h"

  1. Modified plat/arm/board/fvp/tsp/fvp_tsp_setup.c

#include <plat_arm.h> To #include "../../../../../include/plat/arm/common/plat_arm.h"

  1. Modified plat/arm/common/arm_topology.c

#include <plat_arm.h> To #include "../../../include/plat/arm/common/plat_arm.h"

  1. Modified plat/arm/common/tsp/arm_tsp_setup.c

#include <arm_def.h> To #include "../../../../include/plat/arm/common/arm_def.h"
#include <plat_arm.h> To #include "../../../../include/plat/arm/common/plat_arm.h"

  1. Modified include/plat/arm/common/arm_def.h

#include <tbbr_img_def.h> To #include "../../../../include/common/tbbr/tbbr_img_def.h"

  1. Modified plat/arm/board/fvp/aarch64/fvp_helpers.S

#include <v2m_def.h> To #include "../../../../../include/plat/arm/board/common/v2m_def.h"

  1. Modified include/plat/arm/board/common/v2m_def.h

#include <arm_xlat_tables.h> To #include "../../../../../include/plat/arm/common/arm_xlat_tables.h"

  1. Deleted the definition related to BL31_BASE and BL31_LIMIT in include/plat/arm/common/arm_def.h

HI

/home/lm/work/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-ld: invalid origin for memory region RAM
Makefile:721: recipe for target 'build/imx8mm/release/bl32/bl32.elf' failed
make: *** [build/imx8mm/release/bl32/bl32.elf] Error 1

-> Can you please share "build/imx8mm/release/bl32/bl32.elf" file to check for this error? Looks like these defines are not available for imx platform

ORIGIN = **TSP_SEC_MEM_BASE**, LENGTH = **TSP_SEC_MEM_SIZE**

More comment on approach you taken to create makefile:

mkdir plat/imx/imx8mm/tsp
cp plat/arm/board/fvp/tsp/tsp-fvp.mk plat/imx/imx8mm/tsp/tsp-imx8mm.mk

-> This doesn't look correct to me to mimic ARM platform makefile to use it for imx platform.

Please create independent tsp source files for imx platform and create makefile out of it.
You can refer platforms (apart from ARM) which uses tsp are as below:
a. ./plat/socionext/uniphier/tsp/tsp-uniphier.mk
b. ./plat/xilinx/zynqmp/tsp/tsp-zynqmp.mk
c. ./plat/layerscape/board/ls1043/tsp/tsp-ls1043.mk

IMO, Please avoid below steps to make ARM's tsp platform makefile suitable for imx platform.

Added
#define TSP_IRQ_SEC_PHY_TIMER 29
#define FVP_CLUSTER_COUNT 1
#define FVP_MAX_CPUS_PER_CLUSTER 4
#define FVP_MAX_PE_PER_CPU 1
#define PLAT_ARM_CLUSTER_COUNT 1
#define PLAT_ARM_TSP_UART_BASE 0x1c0b0000
#define PLAT_ARM_TSP_UART_CLK_IN_HZ 24000000
#define PLAT_ARM_TRUSTED_MAILBOX_BASE 0x04000000
In plat/imx/imx8mm/include/platform_def.h

Modified
plat/arm/board/fvp/drivers/pwrc/fvp_pwrc #include <plat_arm.h> To #include "../../../../../../include/plat/arm/common/plat_arm.h"

Modified include/plat/arm/common/plat_arm.h
#include <arm_xlat_tables.h> To #include "arm_xlat_tables.h"

Modified plat/arm/board/fvp/drivers/pwrc/fvp_pwrc.c
#include <plat_arm.h> To #include "../../../../include/plat/arm/common/plat_arm.h"

Modified plat/arm/board/fvp/fvp_topology.c
#include <arm_config.h> To #include "../../../../include/plat/arm/common/arm_config.h"
#include <plat_arm.h> To #include "../../../../include/plat/arm/common/plat_arm.h"

Modified plat/arm/board/fvp/tsp/fvp_tsp_setup.c
#include <plat_arm.h> To #include "../../../../../include/plat/arm/common/plat_arm.h"

Modified plat/arm/common/arm_topology.c
#include <plat_arm.h> To #include "../../../include/plat/arm/common/plat_arm.h"

Modified plat/arm/common/tsp/arm_tsp_setup.c
#include <arm_def.h> To #include "../../../../include/plat/arm/common/arm_def.h"
#include <plat_arm.h> To #include "../../../../include/plat/arm/common/plat_arm.h"

Modified include/plat/arm/common/arm_def.h
#include <tbbr_img_def.h> To #include "../../../../include/common/tbbr/tbbr_img_def.h"

Modified plat/arm/board/fvp/aarch64/fvp_helpers.S
#include <v2m_def.h> To #include "../../../../../include/plat/arm/board/common/v2m_def.h"

Modified include/plat/arm/board/common/v2m_def.h
#include <arm_xlat_tables.h> To #include "../../../../../include/plat/arm/common/arm_xlat_tables.h"

Deleted the definition related to BL31_BASE and BL31_LIMIT in include/plat/arm/common/arm_def.h

Let me know if you need more info.

Thanks
Manish Badarkhe

Hi,

I have compiled tsp.

But I don't know how to run bl32.bin(TSP for BL32) on imx8mm-mini?

how to load bl32.bin on imx8mm-mini?

Can you give me some suggestions, thanks.

LM

ManishVB-Arm added a comment.EditedJul 30 2020, 3:12 AM

Hi,

Please follow below links to get idea on how to run and load bl32 image.

  1. bl32 image load:

https://trustedfirmware-a.readthedocs.io/en/latest/design/firmware-design.html?highlight=bl32#aarch64-bl32-secure-el1-payload-image-load

  1. bl32 image initialisation:

https://trustedfirmware-a.readthedocs.io/en/latest/design/firmware-design.html?highlight=bl32#aarch64-bl32-secure-el1-payload-image-initialization

Loading bl32 image is present in the common code of bl2 <bl2/bl2_main.c>
Executing bl32 image is present in the common code of bl31 <bl31/bl31_main.c>

I hope these links will be helpful for you to proceed.

Thanks
Manish Badarkhe

amorfortune added a comment.EditedJul 31 2020, 9:53 AM

Hi,

Does TSP provide some functions like addition and subtraction operations that I can call in the normal world?

If provided, how do I call in the normal world?

In other words, how do I call the service provided by TSP in the normal world, if TSP have services.

Thanks for your answer.

Li

Hi Li,

Basic mathematical operation support is present in TSP.
You can follow test case present in tf-a-test repo to know in details how to call such SMCs for addition and substration.

Clone tf-a-test repo using command:
git clone "https://review.trustedfirmware.org/TF-A/tf-a-tests"

Check this function 'issue_trustedos_service_calls' in file: tftf/tests/runtime_services/trusted_os/tsp/test_tsp_fast_smc.c to know how
to issue SMC calls to TSP.

Thanks
Manish Badarkhe

Hi Li,

Are you able to use now TSP in imx8m mini? Please let us know if you need any further assistance.

Thanks
Manish Badarkhe

This comment was removed by joannafarley-arm.

TSP includes support for basic mathematical operations. For doodle baseball detailed instructions on how to invoke System Management Calls (SMCs) for addition and subtraction, you can refer to the test cases in the tf-a-test repository.

dftyas34 added a subscriber: dftyas34.EditedJan 24 2024, 9:45 AM

ATF can not be removed, the right security level needs to be initialized properly, ATF is running at EL3, while U-boot and Linux OS run at EL2/EL1 normal world, secure OS runs at EL1 secure world. little runmo

Fulfilling the desires of the customer is the first aim of the female Escort in Delhi. Whether you want to add color to your birthday celebration or just recreational activities, the girls are perfect for these services. Dressed in the best attire, the girl will come to your residence or the place of your choice.