diff options
author | Sidath Senanayake <sidaths@google.com> | 2019-04-10 14:37:00 +0200 |
---|---|---|
committer | Sidath Senanayake <sidaths@google.com> | 2019-04-10 14:37:00 +0200 |
commit | e972f6531ef8c9d01eae567f52db4f0fd37d1428 (patch) | |
tree | 52df0c2e2665e00e4fe5822ddb50df1a72e24cd0 /common | |
parent | a970431fa55f99aba31ea4263fdc8e70019a9ccd (diff) | |
download | gpu-e972f6531ef8c9d01eae567f52db4f0fd37d1428.tar.gz |
Mali Bifrost DDK r17p0 KMD
Provenance:
789dfe7c7 (collaborate/EAC/b_r17p0)
BX304L01B-BU-00000-r17p0-01rel0
BX304L06A-BU-00000-r17p0-01rel0
BX304X07X-BU-00000-r17p0-01rel0
Signed-off-by: Sidath Senanayake <sidaths@google.com>
Change-Id: Iff5bea2d96207a6e72d5e533e772c24a7adbdc31
Diffstat (limited to 'common')
-rw-r--r-- | common/include/linux/memory_group_manager.h | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/common/include/linux/memory_group_manager.h b/common/include/linux/memory_group_manager.h new file mode 100644 index 0000000..8b19786 --- /dev/null +++ b/common/include/linux/memory_group_manager.h @@ -0,0 +1,96 @@ +/* + * + * (C) COPYRIGHT 2019 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 + * Foundation, and any use by you of this program is subject to the terms + * of such GNU licence. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you can access it online at + * http://www.gnu.org/licenses/gpl-2.0.html. + * + * SPDX-License-Identifier: GPL-2.0 + * + */ + +#ifndef _MEMORY_GROUP_MANAGER_H_ +#define _MEMORY_GROUP_MANAGER_H_ + +#define MEMORY_GROUP_MANAGER_NR_GROUPS (16) + +struct memory_group_manager_device; + +/** + * struct memory_group_manager_ops - Callbacks for memory group manager + * operations + * + * @mgm_alloc_page: Callback to allocate physical memory in a group + * @mgm_free_page: Callback to free physical memory in a group + */ +struct memory_group_manager_ops { + /** + * mgm_alloc_page - Allocate a physical memory page in a group + * + * @mgm_dev: The memory group manager through which the request is + * being made. + * @group_id: A physical memory group ID. The meaning of this is defined + * by the systems integrator. Its valid range is + * 0 .. MEMORY_GROUP_MANAGER_NR_GROUPS-1. + * @gfp_mask: Bitmask of Get Free Page flags affecting allocator + * behavior. + * @order: Page order for physical page size (order=0 means 4 KiB, + * order=9 means 2 MiB). + * + * Return: Pointer to allocated page, or NULL if allocation failed. + */ + struct page *(*mgm_alloc_page)( + struct memory_group_manager_device *mgm_dev, int group_id, + gfp_t gfp_mask, unsigned int order); + + /** + * mgm_free_page - Free a physical memory page in a group + * + * @mgm_dev: The memory group manager through which the request + * is being made. + * @group_id: A physical memory group ID. The meaning of this is + * defined by the systems integrator. Its valid range is + * 0 .. MEMORY_GROUP_MANAGER_NR_GROUPS-1. + * @page: Address of the struct associated with a page of physical + * memory that was allocated by calling the mgm_alloc_page + * method of the same memory pool with the same values of + * @group_id and @order. + * @order: Page order for physical page size (order=0 means 4 KiB, + * order=9 means 2 MiB). + */ + void (*mgm_free_page)( + struct memory_group_manager_device *mgm_dev, int group_id, + struct page *page, unsigned int order); +}; + +/** + * struct memory_group_manager_device - Device structure for a memory group + * manager + * + * @ops - Callbacks associated with this device + * @data - Pointer to device private data + * + * In order for a systems integrator to provide custom behaviors for memory + * operations performed by the kbase module (controller driver), they must + * provide a platform-specific driver module which implements this interface. + * + * This structure should be registered with the platform device using + * platform_set_drvdata(). + */ +struct memory_group_manager_device { + struct memory_group_manager_ops ops; + void *data; +}; + +#endif /* _MEMORY_GROUP_MANAGER_H_ */ |