linux/drivers/firmware/qcom/qcom_tzmem.h
Bartosz Golaszewski 84f5a7b67b firmware: qcom: add a dedicated TrustZone buffer allocator
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@linaro.org>
Reviewed-by: Andrew Halaney <ahalaney@redhat.com>
Tested-by: Andrew Halaney <ahalaney@redhat.com> # sc8280xp-lenovo-thinkpad-x13s
Tested-by: Deepti Jaggi <quic_djaggi@quicinc.com> #sa8775p-ride
Reviewed-by: Elliot Berman <quic_eberman@quicinc.com>
Link: https://lore.kernel.org/r/20240527-shm-bridge-v10-2-ce7afaa58d3a@linaro.org
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2024-06-23 16:08:04 -05:00

14 lines
241 B
C

/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (C) 2023-2024 Linaro Ltd.
*/
#ifndef __QCOM_TZMEM_PRIV_H
#define __QCOM_TZMEM_PRIV_H
struct device;
int qcom_tzmem_enable(struct device *dev);
#endif /* __QCOM_TZMEM_PRIV_H */