Hi all,

 

In the current implementation, every secure function has an associated veneer function. Therefore, there are so many veneer functions in ‘tfm_veneers.c’, which have a similar prototype.

 

This would lead to:

 

This patch tries to unify the service entry so that:

 

This is also an experiment patch to start the journey to the SFN model Andrew proposed. Let’s see the feedbacks and decide what to do in the next step.

https://review.trustedfirmware.org/c/trusted-firmware-m/+/4115

 

Please do feedback, especially the library model users – please check what kinds of the inconvenience it brings so that we can discuss the correct shape.

 

Here are some details in the patch:

 

 

Prototype of the unified veneer function:

psa_status_t tfm_sfc_call(uint32_t ctrl, psa_invec *in_vec, psa_outvec *out_vec);

where:

the uint32_t type parameter ‘ctrl’ is a pack of parameters - psa invec length, psa outvec length, and function identifier.

[8 bits for inlen][8 bits for outlen][16 bits for function identifier]

 

This is to avoid the condition that 5 parameters will cause re-wrapping of parameters.

 

 

Time cost and code size measurement:

github-tracking

 

Use the unified veneer

cost of a veneer call is 1264

cost of an interrupt is 941

veneer used 832B, region size 832B, 100%

 

cost of a veneer call is 1274                                  

cost of an interrupt is 941                          

veneer used 64B, region size 832B, 7.69%

 

 

Thanks,

Mingyang