Hi everyone,
I have a few questions related to TF-M code:
1. Default implementation of tfm_hal_system_reset(void) from platform/ext/common/tfm_platform.chttps://git.trustedfirmware.org/TF-M/trusted-firmware-m.git/tree/platform/ext/common/tfm_platform.c#n11 just calls NVIC_SystemReset(), but some ARM platform, take musca_b1 for example, reimplement it (platform/ext/target/arm/musca_b1/sse_200/tfm_hal_platform.chttps://git.trustedfirmware.org/TF-M/trusted-firmware-m.git/tree/platform/ext/target/arm/musca_b1/sse_200/tfm_hal_platform.c#n53 ).
Custom implementations tend to also disable and clean IRQ and call mpc_revert_non_secure_to_secure_cfg();
Is there any benefits of doing that??? If so then what those benefits are?
1. tfm_core_panic() (secure_fw/spm/ffm/utilities.chttps://git.trustedfirmware.org/TF-M/trusted-firmware-m.git/tree/secure_fw/spm/ffm/utilities.c#n12) when TFM_FIH_PROFILE_ON is defined calls fih_delay() and tfm_hal_system_reset() twice. Is this done to ensure that tfm_hal_system_reset() will be called (even if first one was skipped there is second one)? And if so, can a comment be added there to highlight that intention?
Regards, Bohdan Hunko
Cypress Semiconductor Ukraine Engineer CSUKR CSS ICW SW FW Mobile: +38099 50 19 714 Bohdan.Hunko@infineon.commailto:Bohdan.Hunko@infineon.com
Hi Bohdan,
Regarding Musca-B1 specific implementation, @Mark Horvathmailto:Mark.Horvath@arm.com may help give the details.
Regarding the duplicated reset() in tfm_core_panic(), your understanding is correct. I will add the missing comment. Thanks a lot for pointing it out.
Best regards, Hu Ziji
From: Bohdan.Hunko--- via TF-M tf-m@lists.trustedfirmware.org Sent: Friday, January 28, 2022 10:08 PM To: tf-m@lists.trustedfirmware.org Cc: Roman.Mazurak@infineon.com; Nazar.Chornenkyy@infineon.com Subject: [TF-M] Custom implementation of of tfm_hal_system_reset
Hi everyone,
I have a few questions related to TF-M code:
1. Default implementation of tfm_hal_system_reset(void) from platform/ext/common/tfm_platform.chttps://git.trustedfirmware.org/TF-M/trusted-firmware-m.git/tree/platform/ext/common/tfm_platform.c#n11 just calls NVIC_SystemReset(), but some ARM platform, take musca_b1 for example, reimplement it (platform/ext/target/arm/musca_b1/sse_200/tfm_hal_platform.chttps://git.trustedfirmware.org/TF-M/trusted-firmware-m.git/tree/platform/ext/target/arm/musca_b1/sse_200/tfm_hal_platform.c#n53 ).
Custom implementations tend to also disable and clean IRQ and call mpc_revert_non_secure_to_secure_cfg();
Is there any benefits of doing that??? If so then what those benefits are?
1. tfm_core_panic() (secure_fw/spm/ffm/utilities.chttps://git.trustedfirmware.org/TF-M/trusted-firmware-m.git/tree/secure_fw/spm/ffm/utilities.c#n12) when TFM_FIH_PROFILE_ON is defined calls fih_delay() and tfm_hal_system_reset() twice. Is this done to ensure that tfm_hal_system_reset() will be called (even if first one was skipped there is second one)? And if so, can a comment be added there to highlight that intention?
Regards, Bohdan Hunko
Cypress Semiconductor Ukraine Engineer CSUKR CSS ICW SW FW Mobile: +38099 50 19 714 Bohdan.Hunko@infineon.commailto:Bohdan.Hunko@infineon.com
Hi Bohdan,
Regarding reset no special reason, the mentioned implementations were required because of small HW issues on arm reference platforms. Usually, NVIC_SystemReset resets everything, that is reason why it is the default implementation, but in case of bigger system with multiple subsystems you might need to do some special sequence to achieve a full system reset.
Best regards, Mark ________________________________ From: David Hu David.Hu@arm.com Sent: Saturday, January 29, 2022 1:43 AM To: Bohdan.Hunko@infineon.com Bohdan.Hunko@infineon.com; Mark Horvath Mark.Horvath@arm.com Cc: Roman.Mazurak@infineon.com Roman.Mazurak@infineon.com; Nazar.Chornenkyy@infineon.com Nazar.Chornenkyy@infineon.com; tf-m@lists.trustedfirmware.org tf-m@lists.trustedfirmware.org Subject: RE: Custom implementation of of tfm_hal_system_reset
Hi Bohdan,
Regarding Musca-B1 specific implementation, @Mark Horvathmailto:Mark.Horvath@arm.com may help give the details.
Regarding the duplicated reset() in tfm_core_panic(), your understanding is correct.
I will add the missing comment. Thanks a lot for pointing it out.
Best regards,
Hu Ziji
From: Bohdan.Hunko--- via TF-M tf-m@lists.trustedfirmware.org Sent: Friday, January 28, 2022 10:08 PM To: tf-m@lists.trustedfirmware.org Cc: Roman.Mazurak@infineon.com; Nazar.Chornenkyy@infineon.com Subject: [TF-M] Custom implementation of of tfm_hal_system_reset
Hi everyone,
I have a few questions related to TF-M code:
1. Default implementation of tfm_hal_system_reset(void) from platform/ext/common/tfm_platform.chttps://git.trustedfirmware.org/TF-M/trusted-firmware-m.git/tree/platform/ext/common/tfm_platform.c#n11 just calls NVIC_SystemReset(), but some ARM platform, take musca_b1 for example, reimplement it (platform/ext/target/arm/musca_b1/sse_200/tfm_hal_platform.chttps://git.trustedfirmware.org/TF-M/trusted-firmware-m.git/tree/platform/ext/target/arm/musca_b1/sse_200/tfm_hal_platform.c#n53 ).
Custom implementations tend to also disable and clean IRQ and call mpc_revert_non_secure_to_secure_cfg();
Is there any benefits of doing that??? If so then what those benefits are?
1. tfm_core_panic() (secure_fw/spm/ffm/utilities.chttps://git.trustedfirmware.org/TF-M/trusted-firmware-m.git/tree/secure_fw/spm/ffm/utilities.c#n12) when TFM_FIH_PROFILE_ON is defined calls fih_delay() and tfm_hal_system_reset() twice. Is this done to ensure that tfm_hal_system_reset() will be called (even if first one was skipped there is second one)? And if so, can a comment be added there to highlight that intention?
Regards,
Bohdan Hunko
Cypress Semiconductor Ukraine
Engineer
CSUKR CSS ICW SW FW
Mobile: +38099 50 19 714 Bohdan.Hunko@infineon.commailto:Bohdan.Hunko@infineon.com
tf-m@lists.trustedfirmware.org