Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu: Add initial kernel documentation for the amd_ip_block_type structure. v3

Added IP block section to amdgpu.rst.
Added more documentation to amd_ip_funcs.
Created documentation for amd_ip_block_type.

v2: Provides a more detailed DOC section on IP blocks
v3: Clarifies the IP block list. Adds info on IP block enumeration.

Signed-off-by: Ryan Taylor <ryan.taylor@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Ryan Taylor and committed by
Alex Deucher
52ef3a1a 78f0aef1

+71 -25
+9
Documentation/gpu/amdgpu.rst
··· 70 70 .. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c 71 71 :internal: 72 72 73 + IP Blocks 74 + ------------------ 75 + 76 + .. kernel-doc:: drivers/gpu/drm/amd/include/amd_shared.h 77 + :doc: IP Blocks 78 + 79 + .. kernel-doc:: drivers/gpu/drm/amd/include/amd_shared.h 80 + :identifiers: amd_ip_block_type amd_ip_funcs 81 + 73 82 AMDGPU XGMI Support 74 83 =================== 75 84
+62 -25
drivers/gpu/drm/amd/include/amd_shared.h
··· 47 47 AMD_APU_IS_RENOIR = 0x00000008UL, 48 48 }; 49 49 50 + /** 51 + * DOC: IP Blocks 52 + * 53 + * GPUs are composed of IP (intellectual property) blocks. These 54 + * IP blocks provide various functionalities: display, graphics, 55 + * video decode, etc. The IP blocks that comprise a particular GPU 56 + * are listed in the GPU's respective SoC file. amdgpu_device.c 57 + * acquires the list of IP blocks for the GPU in use on initialization. 58 + * It can then operate on this list to perform standard driver operations 59 + * such as: init, fini, suspend, resume, etc. 60 + * 61 + * 62 + * IP block implementations are named using the following convention: 63 + * <functionality>_v<version> (E.g.: gfx_v6_0). 64 + */ 65 + 66 + /** 67 + * enum amd_ip_block_type - Used to classify IP blocks by functionality. 68 + * 69 + * @AMD_IP_BLOCK_TYPE_COMMON: GPU Family 70 + * @AMD_IP_BLOCK_TYPE_GMC: Graphics Memory Controller 71 + * @AMD_IP_BLOCK_TYPE_IH: Interrupt Handler 72 + * @AMD_IP_BLOCK_TYPE_SMC: System Management Controller 73 + * @AMD_IP_BLOCK_TYPE_PSP: Platform Security Processor 74 + * @AMD_IP_BLOCK_TYPE_DCE: Display and Compositing Engine 75 + * @AMD_IP_BLOCK_TYPE_GFX: Graphics and Compute Engine 76 + * @AMD_IP_BLOCK_TYPE_SDMA: System DMA Engine 77 + * @AMD_IP_BLOCK_TYPE_UVD: Unified Video Decoder 78 + * @AMD_IP_BLOCK_TYPE_VCE: Video Compression Engine 79 + * @AMD_IP_BLOCK_TYPE_ACP: Audio Co-Processor 80 + * @AMD_IP_BLOCK_TYPE_VCN: Video Core/Codec Next 81 + * @AMD_IP_BLOCK_TYPE_MES: Micro-Engine Scheduler 82 + * @AMD_IP_BLOCK_TYPE_JPEG: JPEG Engine 83 + */ 50 84 enum amd_ip_block_type { 51 85 AMD_IP_BLOCK_TYPE_COMMON, 52 86 AMD_IP_BLOCK_TYPE_GMC, ··· 199 165 }; 200 166 201 167 enum amd_dpm_forced_level; 168 + 202 169 /** 203 170 * struct amd_ip_funcs - general hooks for managing amdgpu IP Blocks 171 + * @name: Name of IP block 172 + * @early_init: sets up early driver state (pre sw_init), 173 + * does not configure hw - Optional 174 + * @late_init: sets up late driver/hw state (post hw_init) - Optional 175 + * @sw_init: sets up driver state, does not configure hw 176 + * @sw_fini: tears down driver state, does not configure hw 177 + * @hw_init: sets up the hw state 178 + * @hw_fini: tears down the hw state 179 + * @late_fini: final cleanup 180 + * @suspend: handles IP specific hw/sw changes for suspend 181 + * @resume: handles IP specific hw/sw changes for resume 182 + * @is_idle: returns current IP block idle status 183 + * @wait_for_idle: poll for idle 184 + * @check_soft_reset: check soft reset the IP block 185 + * @pre_soft_reset: pre soft reset the IP block 186 + * @soft_reset: soft reset the IP block 187 + * @post_soft_reset: post soft reset the IP block 188 + * @set_clockgating_state: enable/disable cg for the IP block 189 + * @set_powergating_state: enable/disable pg for the IP block 190 + * @get_clockgating_state: get current clockgating status 191 + * @enable_umd_pstate: enable UMD powerstate 192 + * 193 + * These hooks provide an interface for controlling the operational state 194 + * of IP blocks. After acquiring a list of IP blocks for the GPU in use, 195 + * the driver can make chip-wide state changes by walking this list and 196 + * making calls to hooks from each IP block. This list is ordered to ensure 197 + * that the driver initializes the IP blocks in a safe sequence. 204 198 */ 205 199 struct amd_ip_funcs { 206 - /** @name: Name of IP block */ 207 200 char *name; 208 - /** 209 - * @early_init: 210 - * 211 - * sets up early driver state (pre sw_init), 212 - * does not configure hw - Optional 213 - */ 214 201 int (*early_init)(void *handle); 215 - /** @late_init: sets up late driver/hw state (post hw_init) - Optional */ 216 202 int (*late_init)(void *handle); 217 - /** @sw_init: sets up driver state, does not configure hw */ 218 203 int (*sw_init)(void *handle); 219 - /** @sw_fini: tears down driver state, does not configure hw */ 220 204 int (*sw_fini)(void *handle); 221 - /** @hw_init: sets up the hw state */ 222 205 int (*hw_init)(void *handle); 223 - /** @hw_fini: tears down the hw state */ 224 206 int (*hw_fini)(void *handle); 225 - /** @late_fini: final cleanup */ 226 207 void (*late_fini)(void *handle); 227 - /** @suspend: handles IP specific hw/sw changes for suspend */ 228 208 int (*suspend)(void *handle); 229 - /** @resume: handles IP specific hw/sw changes for resume */ 230 209 int (*resume)(void *handle); 231 - /** @is_idle: returns current IP block idle status */ 232 210 bool (*is_idle)(void *handle); 233 - /** @wait_for_idle: poll for idle */ 234 211 int (*wait_for_idle)(void *handle); 235 - /** @check_soft_reset: check soft reset the IP block */ 236 212 bool (*check_soft_reset)(void *handle); 237 - /** @pre_soft_reset: pre soft reset the IP block */ 238 213 int (*pre_soft_reset)(void *handle); 239 - /** @soft_reset: soft reset the IP block */ 240 214 int (*soft_reset)(void *handle); 241 - /** @post_soft_reset: post soft reset the IP block */ 242 215 int (*post_soft_reset)(void *handle); 243 - /** @set_clockgating_state: enable/disable cg for the IP block */ 244 216 int (*set_clockgating_state)(void *handle, 245 217 enum amd_clockgating_state state); 246 - /** @set_powergating_state: enable/disable pg for the IP block */ 247 218 int (*set_powergating_state)(void *handle, 248 219 enum amd_powergating_state state); 249 - /** @get_clockgating_state: get current clockgating status */ 250 220 void (*get_clockgating_state)(void *handle, u32 *flags); 251 - /** @enable_umd_pstate: enable UMD powerstate */ 252 221 int (*enable_umd_pstate)(void *handle, enum amd_dpm_forced_level *level); 253 222 }; 254 223