hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/include/linux/memory_group_manager.h
....@@ -1,7 +1,7 @@
11 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
22 /*
33 *
4
- * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved.
4
+ * (C) COPYRIGHT 2019-2022 ARM Limited. All rights reserved.
55 *
66 * This program is free software and is provided to you under the terms of the
77 * GNU General Public License version 2 as published by the Free Software
....@@ -43,10 +43,12 @@
4343 * @mgm_free_page: Callback to free physical memory in a group
4444 * @mgm_get_import_memory_id: Callback to get the group ID for imported memory
4545 * @mgm_update_gpu_pte: Callback to modify a GPU page table entry
46
+ * @mgm_pte_to_original_pte: Callback to get the original PTE entry as given
47
+ * to mgm_update_gpu_pte
4648 * @mgm_vmf_insert_pfn_prot: Callback to map a physical memory page for the CPU
4749 */
4850 struct memory_group_manager_ops {
49
- /**
51
+ /*
5052 * mgm_alloc_page - Allocate a physical memory page in a group
5153 *
5254 * @mgm_dev: The memory group manager through which the request is
....@@ -65,7 +67,7 @@
6567 struct memory_group_manager_device *mgm_dev, int group_id,
6668 gfp_t gfp_mask, unsigned int order);
6769
68
- /**
70
+ /*
6971 * mgm_free_page - Free a physical memory page in a group
7072 *
7173 * @mgm_dev: The memory group manager through which the request
....@@ -84,7 +86,7 @@
8486 struct memory_group_manager_device *mgm_dev, int group_id,
8587 struct page *page, unsigned int order);
8688
87
- /**
89
+ /*
8890 * mgm_get_import_memory_id - Get the physical memory group ID for the
8991 * imported memory
9092 *
....@@ -103,7 +105,7 @@
103105 struct memory_group_manager_device *mgm_dev,
104106 struct memory_group_manager_import_data *import_data);
105107
106
- /**
108
+ /*
107109 * mgm_update_gpu_pte - Modify a GPU page table entry for a memory group
108110 *
109111 * @mgm_dev: The memory group manager through which the request
....@@ -120,14 +122,36 @@
120122 * This function allows the memory group manager to modify a GPU page
121123 * table entry before it is stored by the kbase module (controller
122124 * driver). It may set certain bits in the page table entry attributes
123
- * or in the physical address, based on the physical memory group ID.
125
+ * or modify the physical address, based on the physical memory group ID
126
+ * and/or additional data in struct memory_group_manager_device.
124127 *
125128 * Return: A modified GPU page table entry to be stored in a page table.
126129 */
127130 u64 (*mgm_update_gpu_pte)(struct memory_group_manager_device *mgm_dev,
128131 int group_id, int mmu_level, u64 pte);
129132
130
- /**
133
+ /*
134
+ * mgm_pte_to_original_pte - Undo any modification done during mgm_update_gpu_pte()
135
+ *
136
+ * @mgm_dev: The memory group manager through which the request
137
+ * is being made.
138
+ * @group_id: A physical memory group ID. The meaning of this is
139
+ * defined by the systems integrator. Its valid range is
140
+ * 0 .. MEMORY_GROUP_MANAGER_NR_GROUPS-1.
141
+ * @mmu_level: The level of the page table entry in @ate.
142
+ * @pte: The page table entry to restore the original representation for,
143
+ * in LPAE or AArch64 format (depending on the driver's configuration).
144
+ *
145
+ * Undo any modifications done during mgm_update_gpu_pte().
146
+ * This function allows getting back the original PTE entry as given
147
+ * to mgm_update_gpu_pte().
148
+ *
149
+ * Return: PTE entry as originally specified to mgm_update_gpu_pte()
150
+ */
151
+ u64 (*mgm_pte_to_original_pte)(struct memory_group_manager_device *mgm_dev, int group_id,
152
+ int mmu_level, u64 pte);
153
+
154
+ /*
131155 * mgm_vmf_insert_pfn_prot - Map a physical page in a group for the CPU
132156 *
133157 * @mgm_dev: The memory group manager through which the request
....@@ -158,8 +182,9 @@
158182 * struct memory_group_manager_device - Device structure for a memory group
159183 * manager
160184 *
161
- * @ops - Callbacks associated with this device
162
- * @data - Pointer to device private data
185
+ * @ops: Callbacks associated with this device
186
+ * @data: Pointer to device private data
187
+ * @owner: pointer to owning module
163188 *
164189 * In order for a systems integrator to provide custom behaviors for memory
165190 * operations performed by the kbase module (controller driver), they must
....@@ -183,8 +208,9 @@
183208 * struct memory_group_manager_import_data - Structure describing the imported
184209 * memory
185210 *
186
- * @type - type of imported memory
187
- * @u - Union describing the imported memory
211
+ * @type: type of imported memory
212
+ * @u: Union describing the imported memory
213
+ * @u.dma_buf: imported memory
188214 *
189215 */
190216 struct memory_group_manager_import_data {