Re: [PATCH v4 04/15] firmware: qcom: add a dedicated TrustZone buffer allocator

From: Andrew Halaney
Date: Fri Oct 13 2023 - 10:59:58 EST


On Fri, Oct 13, 2023 at 01:48:32PM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
>
> We have several SCM calls that require passing buffers to the TrustZone
> on top of the SMC core which allocates memory for calls that require
> more than 4 arguments.
>
> Currently every user does their own thing which leads to code
> duplication. Many users call dma_alloc_coherent() for every call which
> is terribly unperformant (speed- and size-wise).
>
> Provide a set of library functions for creating and managing pool of
> memory which is suitable for sharing with the TrustZone, that is:
> page-aligned, contiguous and non-cachable as well as provides a way of
> mapping of kernel virtual addresses to physical space.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>

I'm still on the fence about introducing the Kconfig for the "just
in case the hypervisor is bad on some boards", but I spent a
while looking at this and it all looks good to me, so that opinion
aside...

Reviewed-by: Andrew Halaney <ahalaney@xxxxxxxxxx>