diff options
author | Siddharth Kapoor <ksiddharth@google.com> | 2022-03-02 14:51:29 +0800 |
---|---|---|
committer | Siddharth Kapoor <ksiddharth@google.com> | 2022-03-02 14:51:29 +0800 |
commit | 88d7d984fed1c2a4358ce2bbc334e82d71e3a391 (patch) | |
tree | 18f20402a0ed15ae9fe62b29a9957922ebcc2ada /mali_kbase/mali_kbase_mem_pool_group.h | |
parent | 0207d6c3b7a2002f15c60d08617e956faf5ba90c (diff) | |
download | gpu-88d7d984fed1c2a4358ce2bbc334e82d71e3a391.tar.gz |
Mali Valhall Android DDK r36p0 KMD
Provenance: 9f72c118d9 (ipdelivery/EAC/v_r36p0)
VX504X08X-BU-00000-r36p0-01eac0 - Valhall Android DDK
VX504X08X-BU-60000-r36p0-01eac0 - Valhall Android Document Bundle
VX504X08X-DC-11001-r36p0-01eac0 - Valhall Android DDK Software Errata
VX504X08X-SW-99006-r36p0-01eac0 - Valhall Android Renderscript AOSP parts
Signed-off-by: Siddharth Kapoor <ksiddharth@google.com>
Change-Id: I4a63b707fedc68d7b7d046596c7098da47a139cb
Diffstat (limited to 'mali_kbase/mali_kbase_mem_pool_group.h')
-rw-r--r-- | mali_kbase/mali_kbase_mem_pool_group.h | 52 |
1 files changed, 38 insertions, 14 deletions
diff --git a/mali_kbase/mali_kbase_mem_pool_group.h b/mali_kbase/mali_kbase_mem_pool_group.h index 38fd4ca..c50ffdb 100644 --- a/mali_kbase/mali_kbase_mem_pool_group.h +++ b/mali_kbase/mali_kbase_mem_pool_group.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * - * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2019-2022 ARM Limited. All rights reserved. * * This program is free software and is provided to you under the terms of the * GNU General Public License version 2 as published by the Free Software @@ -25,16 +25,40 @@ #include <mali_kbase_defs.h> /** + * kbase_mem_pool_group_select() - Select the memory pool to use. + * + * @kbdev: Device pointer. + * @mem_group_id: Physical memory group ID to use. + * @is_small_page: Flag used to select between the small and + * large memory pool. + * + * Return: A pointer to the selected memory pool. + */ +static inline struct kbase_mem_pool *kbase_mem_pool_group_select( + struct kbase_device *kbdev, u32 mem_group_id, bool is_small_page) +{ + if (WARN_ON(unlikely(kbdev == NULL))) + return NULL; + + WARN_ON(mem_group_id > BASE_MEM_GROUP_COUNT); + + if (is_small_page) + return &kbdev->mem_pools.small[mem_group_id]; + + return &kbdev->mem_pools.large[mem_group_id]; +} + +/** * kbase_mem_pool_group_config_init - Set the initial configuration for a * set of memory pools * + * @configs: Initial configuration for the set of memory pools + * @max_size: Maximum number of free 4 KiB pages each pool can hold + * * This function sets the initial configuration for every memory pool so that * the maximum amount of free memory that each pool can hold is identical. * The equivalent number of 2 MiB pages is calculated automatically for the * purpose of configuring the large page pools. - * - * @configs: Initial configuration for the set of memory pools - * @max_size: Maximum number of free 4 KiB pages each pool can hold */ void kbase_mem_pool_group_config_set_max_size( struct kbase_mem_pool_group_config *configs, size_t max_size); @@ -42,6 +66,12 @@ void kbase_mem_pool_group_config_set_max_size( /** * kbase_mem_pool_group_init - Initialize a set of memory pools * + * @mem_pools: Set of memory pools to initialize + * @kbdev: Kbase device where memory is used + * @configs: Initial configuration for the set of memory pools + * @next_pools: Set of memory pools from which to allocate memory if there + * is no free memory in one of the @mem_pools + * * Initializes a complete set of physical memory pools. Memory pools are used to * allow efficient reallocation of previously-freed physical pages. A pair of * memory pools is initialized for each physical memory group: one for 4 KiB @@ -54,12 +84,6 @@ void kbase_mem_pool_group_config_set_max_size( * is full in @mem_pools. Pages are zeroed before they spill over to another * pool, to prevent leaking information between applications. * - * @mem_pools: Set of memory pools to initialize - * @kbdev: Kbase device where memory is used - * @configs: Initial configuration for the set of memory pools - * @next_pools: Set of memory pools from which to allocate memory if there - * is no free memory in one of the @mem_pools - * * Return: 0 on success, otherwise a negative error code */ int kbase_mem_pool_group_init(struct kbase_mem_pool_group *mem_pools, @@ -70,21 +94,21 @@ int kbase_mem_pool_group_init(struct kbase_mem_pool_group *mem_pools, /** * kbase_mem_pool_group_term - Mark a set of memory pools as dying * + * @mem_pools: Set of memory pools to mark + * * Marks a complete set of physical memory pools previously initialized by * @kbase_mem_pool_group_init as dying. This will cause any ongoing allocation * operations (eg growing on page fault) to be terminated. - * - * @mem_pools: Set of memory pools to mark */ void kbase_mem_pool_group_mark_dying(struct kbase_mem_pool_group *mem_pools); /** * kbase_mem_pool_group_term - Terminate a set of memory pools * + * @mem_pools: Set of memory pools to terminate + * * Terminates a complete set of physical memory pools previously initialized by * @kbase_mem_pool_group_init. - * - * @mem_pools: Set of memory pools to terminate */ void kbase_mem_pool_group_term(struct kbase_mem_pool_group *mem_pools); |