1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 /* 3 * 4 * (C) COPYRIGHT 2011-2018, 2020-2021 ARM Limited. All rights reserved. 5 * 6 * This program is free software and is provided to you under the terms of the 7 * GNU General Public License version 2 as published by the Free Software 8 * Foundation, and any use by you of this program is subject to the terms 9 * of such GNU license. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, you can access it online at 18 * http://www.gnu.org/licenses/gpl-2.0.html. 19 * 20 */ 21 22 /** 23 * DOC: Base kernel property query APIs 24 */ 25 26 #ifndef _KBASE_GPUPROPS_TYPES_H_ 27 #define _KBASE_GPUPROPS_TYPES_H_ 28 29 #include <uapi/gpu/arm/bifrost/mali_base_kernel.h> 30 31 #define KBASE_GPU_SPEED_MHZ 123 32 #define KBASE_GPU_PC_SIZE_LOG2 24U 33 34 struct kbase_gpuprops_regdump { 35 u32 gpu_id; 36 u32 l2_features; 37 u32 l2_config; 38 u32 l2_asn_hash[ASN_HASH_COUNT]; 39 u32 core_features; 40 u32 tiler_features; 41 u32 mem_features; 42 u32 mmu_features; 43 u32 as_present; 44 u32 js_present; 45 u32 thread_max_threads; 46 u32 thread_max_workgroup_size; 47 u32 thread_max_barrier_size; 48 u32 thread_features; 49 u32 thread_tls_alloc; 50 u32 texture_features[BASE_GPU_NUM_TEXTURE_FEATURES_REGISTERS]; 51 u32 js_features[GPU_MAX_JOB_SLOTS]; 52 u32 shader_present_lo; 53 u32 shader_present_hi; 54 u32 tiler_present_lo; 55 u32 tiler_present_hi; 56 u32 l2_present_lo; 57 u32 l2_present_hi; 58 u32 stack_present_lo; 59 u32 stack_present_hi; 60 u32 coherency_features; 61 u32 gpu_features_lo; 62 u32 gpu_features_hi; 63 }; 64 65 /** 66 * struct kbase_current_config_regdump - Register dump for current resources 67 * allocated to the GPU. 68 * @mem_features: Memory system features. Contains information about the 69 * features of the memory system. Used here to get the L2 slice 70 * count. 71 * @shader_present_lo: Shader core present bitmap. Low word. 72 * @shader_present_hi: Shader core present bitmap. High word. 73 * @l2_present_lo: L2 cache present bitmap. Low word. 74 * @l2_present_hi: L2 cache present bitmap. High word. 75 * 76 * Register dump structure used to store the resgisters data realated to the 77 * current resources allocated to the GPU. 78 */ 79 struct kbase_current_config_regdump { 80 u32 mem_features; 81 u32 shader_present_lo; 82 u32 shader_present_hi; 83 u32 l2_present_lo; 84 u32 l2_present_hi; 85 }; 86 87 struct kbase_gpu_cache_props { 88 u8 associativity; 89 u8 external_bus_width; 90 }; 91 92 struct kbase_gpu_mem_props { 93 u8 core_group; 94 }; 95 96 struct kbase_gpu_mmu_props { 97 u8 va_bits; 98 u8 pa_bits; 99 }; 100 101 /** 102 * struct max_config_props - Properties based on the maximum resources 103 * available. 104 * @l2_slices: Maximum number of L2 slices that can be assinged to the GPU 105 * during runtime. 106 * @padding: Padding to a multiple of 64 bits. 107 * @core_mask: Largest core mask bitmap that can be assigned to the GPU during 108 * runtime. 109 * 110 * Properties based on the maximum resources available (not necessarly 111 * allocated at that moment). Used to provide the maximum configuration to the 112 * userspace allowing the applications to allocate enough resources in case the 113 * real allocated resources change. 114 */ 115 struct max_config_props { 116 u8 l2_slices; 117 u8 padding[3]; 118 u32 core_mask; 119 }; 120 121 /** 122 * struct curr_config_props - Properties based on the current resources 123 * allocated to the GPU. 124 * @l2_present: Current L2 present bitmap that is allocated to the GPU. 125 * @shader_present: Current shader present bitmap that is allocated to the GPU. 126 * @num_cores: Current number of shader cores allocated to the GPU. 127 * @l2_slices: Current number of L2 slices allocated to the GPU. 128 * @update_needed: Defines if it is necessary to re-read the registers to 129 * update the current allocated resources. 130 * @padding: Padding to a multiple of 64 bits. 131 * 132 * Properties based on the current resource available. Used for operations with 133 * hardware interactions to avoid using userspace data that can be based on 134 * the maximum resource available. 135 */ 136 struct curr_config_props { 137 u64 l2_present; 138 u64 shader_present; 139 u16 num_cores; 140 u8 l2_slices; 141 bool update_needed; 142 u8 padding[4]; 143 }; 144 145 struct kbase_gpu_props { 146 /* kernel-only properties */ 147 u8 num_cores; 148 u8 num_core_groups; 149 u8 num_address_spaces; 150 u8 num_job_slots; 151 152 struct kbase_gpu_cache_props l2_props; 153 154 struct kbase_gpu_mem_props mem; 155 struct kbase_gpu_mmu_props mmu; 156 157 /* Properties based on the current resource available */ 158 struct curr_config_props curr_config; 159 160 /* Properties based on the maximum resource available */ 161 struct max_config_props max_config; 162 163 /* Properties shared with userspace */ 164 struct base_gpu_props props; 165 166 u32 prop_buffer_size; 167 void *prop_buffer; 168 }; 169 170 #endif /* _KBASE_GPUPROPS_TYPES_H_ */ 171