.. | .. |
---|
1 | 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ |
---|
2 | 2 | /* |
---|
3 | 3 | * |
---|
4 | | - * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved. |
---|
| 4 | + * (C) COPYRIGHT 2019-2022 ARM Limited. All rights reserved. |
---|
5 | 5 | * |
---|
6 | 6 | * This program is free software and is provided to you under the terms of the |
---|
7 | 7 | * GNU General Public License version 2 as published by the Free Software |
---|
.. | .. |
---|
43 | 43 | * @mgm_free_page: Callback to free physical memory in a group |
---|
44 | 44 | * @mgm_get_import_memory_id: Callback to get the group ID for imported memory |
---|
45 | 45 | * @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 |
---|
46 | 48 | * @mgm_vmf_insert_pfn_prot: Callback to map a physical memory page for the CPU |
---|
47 | 49 | */ |
---|
48 | 50 | struct memory_group_manager_ops { |
---|
49 | | - /** |
---|
| 51 | + /* |
---|
50 | 52 | * mgm_alloc_page - Allocate a physical memory page in a group |
---|
51 | 53 | * |
---|
52 | 54 | * @mgm_dev: The memory group manager through which the request is |
---|
.. | .. |
---|
65 | 67 | struct memory_group_manager_device *mgm_dev, int group_id, |
---|
66 | 68 | gfp_t gfp_mask, unsigned int order); |
---|
67 | 69 | |
---|
68 | | - /** |
---|
| 70 | + /* |
---|
69 | 71 | * mgm_free_page - Free a physical memory page in a group |
---|
70 | 72 | * |
---|
71 | 73 | * @mgm_dev: The memory group manager through which the request |
---|
.. | .. |
---|
84 | 86 | struct memory_group_manager_device *mgm_dev, int group_id, |
---|
85 | 87 | struct page *page, unsigned int order); |
---|
86 | 88 | |
---|
87 | | - /** |
---|
| 89 | + /* |
---|
88 | 90 | * mgm_get_import_memory_id - Get the physical memory group ID for the |
---|
89 | 91 | * imported memory |
---|
90 | 92 | * |
---|
.. | .. |
---|
103 | 105 | struct memory_group_manager_device *mgm_dev, |
---|
104 | 106 | struct memory_group_manager_import_data *import_data); |
---|
105 | 107 | |
---|
106 | | - /** |
---|
| 108 | + /* |
---|
107 | 109 | * mgm_update_gpu_pte - Modify a GPU page table entry for a memory group |
---|
108 | 110 | * |
---|
109 | 111 | * @mgm_dev: The memory group manager through which the request |
---|
.. | .. |
---|
120 | 122 | * This function allows the memory group manager to modify a GPU page |
---|
121 | 123 | * table entry before it is stored by the kbase module (controller |
---|
122 | 124 | * 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. |
---|
124 | 127 | * |
---|
125 | 128 | * Return: A modified GPU page table entry to be stored in a page table. |
---|
126 | 129 | */ |
---|
127 | 130 | u64 (*mgm_update_gpu_pte)(struct memory_group_manager_device *mgm_dev, |
---|
128 | 131 | int group_id, int mmu_level, u64 pte); |
---|
129 | 132 | |
---|
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 | + /* |
---|
131 | 155 | * mgm_vmf_insert_pfn_prot - Map a physical page in a group for the CPU |
---|
132 | 156 | * |
---|
133 | 157 | * @mgm_dev: The memory group manager through which the request |
---|
.. | .. |
---|
158 | 182 | * struct memory_group_manager_device - Device structure for a memory group |
---|
159 | 183 | * manager |
---|
160 | 184 | * |
---|
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 |
---|
163 | 188 | * |
---|
164 | 189 | * In order for a systems integrator to provide custom behaviors for memory |
---|
165 | 190 | * operations performed by the kbase module (controller driver), they must |
---|
.. | .. |
---|
183 | 208 | * struct memory_group_manager_import_data - Structure describing the imported |
---|
184 | 209 | * memory |
---|
185 | 210 | * |
---|
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 |
---|
188 | 214 | * |
---|
189 | 215 | */ |
---|
190 | 216 | struct memory_group_manager_import_data { |
---|