Hi Saurabh Jain,

I'm not an expert on FPU and its usage, however your intuition around questions 1, 2 and 3 seems correct to me.
For no.4 I guess the answer is 'yes' in order to have consistency of ABI across security states.

Many details can be found in the Armv8-M Architecture Reference Manual and it's also possible that our (TF-M) documentation may lack of details of most recent changes with regards to FPU and CP10-CP11 configurations.

If you find any discrepancies, please feel free to share and we'll try to help and address further.

Many thanks,
Best regards,

Nick


From: Jain, Saurabh via TF-M <tf-m@lists.trustedfirmware.org>
Sent: 15 November 2024 21:00
To: tf-m@lists.trustedfirmware.org <tf-m@lists.trustedfirmware.org>
Subject: [TF-M] FPU use with TF-M
 
Hi
We’re developing a platform using TF-M and would like to get some clarity on using FPU on Secure and Non-Secure side. The idea is to let NS application decide if it wants to use FPU.

Currently, we are enabling CONFIG_TFM_ENABLE_FP which means we’re setting CPACR.CP10, CPACR.CP11 and enabling NSACR.CP10, NSACR.CP11.

With this configuration:

  1.  Is it okay if SE perform some FP operation which would set CONTROL.FPCA and return to NSE (CPACR_NS.CP10 and CPACR_NS.CP11 are not set) while CONTROL.FPCA is still set?
  2.  With the above configuration, if NSE wants to use FPU, it simply needs to enable CPACR_NS.CP10 and CPACR_NS.CP11. Is this correct?
  3.  If SE doesn’t require FPU, we could simply enable CONFIG_TFM_ENABLE_CP10CP11 (CONFIG_TFM_ENABLE_FP is OFF) and NS app would still be able access FPU after enabling CPACR_NS bits?
  4.  There is a hard requirement for the -mfloat-abi to be consistent for S, NS and all the static libraries used?

Thank you in advance!

Best
Saurabh Jain

--
TF-M mailing list -- tf-m@lists.trustedfirmware.org
To unsubscribe send an email to tf-m-leave@lists.trustedfirmware.org