Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v6.16-rc7 56 lines 1.6 kB view raw
1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* 3 * Copyright (C) 2023-2024 Linaro Ltd. 4 */ 5 6#ifndef __QCOM_TZMEM_H 7#define __QCOM_TZMEM_H 8 9#include <linux/cleanup.h> 10#include <linux/gfp.h> 11#include <linux/types.h> 12 13struct device; 14struct qcom_tzmem_pool; 15 16/** 17 * enum qcom_tzmem_policy - Policy for pool growth. 18 */ 19enum qcom_tzmem_policy { 20 /**< Static pool, never grow above initial size. */ 21 QCOM_TZMEM_POLICY_STATIC = 1, 22 /**< When out of memory, add increment * current size of memory. */ 23 QCOM_TZMEM_POLICY_MULTIPLIER, 24 /**< When out of memory add as much as is needed until max_size. */ 25 QCOM_TZMEM_POLICY_ON_DEMAND, 26}; 27 28/** 29 * struct qcom_tzmem_pool_config - TZ memory pool configuration. 30 * @initial_size: Number of bytes to allocate for the pool during its creation. 31 * @policy: Pool size growth policy. 32 * @increment: Used with policies that allow pool growth. 33 * @max_size: Size above which the pool will never grow. 34 */ 35struct qcom_tzmem_pool_config { 36 size_t initial_size; 37 enum qcom_tzmem_policy policy; 38 size_t increment; 39 size_t max_size; 40}; 41 42struct qcom_tzmem_pool * 43qcom_tzmem_pool_new(const struct qcom_tzmem_pool_config *config); 44void qcom_tzmem_pool_free(struct qcom_tzmem_pool *pool); 45struct qcom_tzmem_pool * 46devm_qcom_tzmem_pool_new(struct device *dev, 47 const struct qcom_tzmem_pool_config *config); 48 49void *qcom_tzmem_alloc(struct qcom_tzmem_pool *pool, size_t size, gfp_t gfp); 50void qcom_tzmem_free(void *ptr); 51 52DEFINE_FREE(qcom_tzmem, void *, if (_T) qcom_tzmem_free(_T)) 53 54phys_addr_t qcom_tzmem_to_phys(void *ptr); 55 56#endif /* __QCOM_TZMEM */