On 3/3/2024 7:01 AM, 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 pools 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. > > Make the allocator ready for extending with additional modes of operation > which will allow us to support the SHM bridge safety mechanism once all > users convert. > > Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx> > Reviewed-by: Andrew Halaney <ahalaney@xxxxxxxxxx> > Tested-by: Andrew Halaney <ahalaney@xxxxxxxxxx> # sc8280xp-lenovo-thinkpad-x13s > Tested-by: Deepti Jaggi <quic_djaggi@xxxxxxxxxxx> #sa8775p-ride > Reviewed-by: Elliot Berman <quic_eberman@xxxxxxxxxxx> > --- > MAINTAINERS | 8 + > drivers/firmware/qcom/Kconfig | 20 ++ > drivers/firmware/qcom/Makefile | 1 + > drivers/firmware/qcom/qcom_tzmem.c | 392 +++++++++++++++++++++++ > drivers/firmware/qcom/qcom_tzmem.h | 13 + > include/linux/firmware/qcom/qcom_tzmem.h | 56 ++++ > 6 files changed, 490 insertions(+) > create mode 100644 drivers/firmware/qcom/qcom_tzmem.c > create mode 100644 drivers/firmware/qcom/qcom_tzmem.h > create mode 100644 include/linux/firmware/qcom/qcom_tzmem.h > > diff --git a/MAINTAINERS b/MAINTAINERS > index 1794b8d7c76b..c1138c709365 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -18327,6 +18327,14 @@ L: linux-arm-msm@xxxxxxxxxxxxxxx > S: Maintained > F: drivers/firmware/qcom/qcom_qseecom.c > > +QUALCOMM TRUST ZONE MEMORY ALLOCATOR > +M: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx> > +L: linux-arm-msm@xxxxxxxxxxxxxxx > +S: Maintained > +F: drivers/firmware/qcom/qcom_tzmem.c > +F: drivers/firmware/qcom/qcom_tzmem.h > +F: include/linux/firmware/qcom/qcom_tzmem.h > + > QUALCOMM QSEECOM UEFISECAPP DRIVER > M: Maximilian Luz <luzmaximilian@xxxxxxxxx> > L: linux-arm-msm@xxxxxxxxxxxxxxx entries should be in alphabetic order so at a minimum QUALCOMM TRUST... should be after QUALCOMM QSEECOM... seems your addition belong just before QUALCOMM TSENS THERMAL DRIVER /jeff