Back to home page

OSCL-LXR

 
 

    


0001 ============================
0002  Core Driver Infrastructure
0003 ============================
0004 
0005 GPU Hardware Structure
0006 ======================
0007 
0008 Each ASIC is a collection of hardware blocks.  We refer to them as
0009 "IPs" (Intellectual Property blocks).  Each IP encapsulates certain
0010 functionality. IPs are versioned and can also be mixed and matched.
0011 E.g., you might have two different ASICs that both have System DMA (SDMA) 5.x IPs.
0012 The driver is arranged by IPs.  There are driver components to handle
0013 the initialization and operation of each IP.  There are also a bunch
0014 of smaller IPs that don't really need much if any driver interaction.
0015 Those end up getting lumped into the common stuff in the soc files.
0016 The soc files (e.g., vi.c, soc15.c nv.c) contain code for aspects of
0017 the SoC itself rather than specific IPs.  E.g., things like GPU resets
0018 and register access functions are SoC dependent.
0019 
0020 An APU contains more than just CPU and GPU, it also contains all of
0021 the platform stuff (audio, usb, gpio, etc.).  Also, a lot of
0022 components are shared between the CPU, platform, and the GPU (e.g.,
0023 SMU, PSP, etc.).  Specific components (CPU, GPU, etc.) usually have
0024 their interface to interact with those common components.  For things
0025 like S0i3 there is a ton of coordination required across all the
0026 components, but that is probably a bit beyond the scope of this
0027 section.
0028 
0029 With respect to the GPU, we have the following major IPs:
0030 
0031 GMC (Graphics Memory Controller)
0032     This was a dedicated IP on older pre-vega chips, but has since
0033     become somewhat decentralized on vega and newer chips.  They now
0034     have dedicated memory hubs for specific IPs or groups of IPs.  We
0035     still treat it as a single component in the driver however since
0036     the programming model is still pretty similar.  This is how the
0037     different IPs on the GPU get the memory (VRAM or system memory).
0038     It also provides the support for per process GPU virtual address
0039     spaces.
0040 
0041 IH (Interrupt Handler)
0042     This is the interrupt controller on the GPU.  All of the IPs feed
0043     their interrupts into this IP and it aggregates them into a set of
0044     ring buffers that the driver can parse to handle interrupts from
0045     different IPs.
0046 
0047 PSP (Platform Security Processor)
0048     This handles security policy for the SoC and executes trusted
0049     applications, and validates and loads firmwares for other blocks.
0050 
0051 SMU (System Management Unit)
0052     This is the power management microcontroller.  It manages the entire
0053     SoC.  The driver interacts with it to control power management
0054     features like clocks, voltages, power rails, etc.
0055 
0056 DCN (Display Controller Next)
0057     This is the display controller.  It handles the display hardware.
0058     It is described in more details in :ref:`Display Core <amdgpu-display-core>`.
0059 
0060 SDMA (System DMA)
0061     This is a multi-purpose DMA engine.  The kernel driver uses it for
0062     various things including paging and GPU page table updates.  It's also
0063     exposed to userspace for use by user mode drivers (OpenGL, Vulkan,
0064     etc.)
0065 
0066 GC (Graphics and Compute)
0067     This is the graphics and compute engine, i.e., the block that
0068     encompasses the 3D pipeline and and shader blocks.  This is by far the
0069     largest block on the GPU.  The 3D pipeline has tons of sub-blocks.  In
0070     addition to that, it also contains the CP microcontrollers (ME, PFP,
0071     CE, MEC) and the RLC microcontroller.  It's exposed to userspace for
0072     user mode drivers (OpenGL, Vulkan, OpenCL, etc.)
0073 
0074 VCN (Video Core Next)
0075     This is the multi-media engine.  It handles video and image encode and
0076     decode.  It's exposed to userspace for user mode drivers (VA-API,
0077     OpenMAX, etc.)
0078 
0079 Graphics and Compute Microcontrollers
0080 -------------------------------------
0081 
0082 CP (Command Processor)
0083     The name for the hardware block that encompasses the front end of the
0084     GFX/Compute pipeline.  Consists mainly of a bunch of microcontrollers
0085     (PFP, ME, CE, MEC).  The firmware that runs on these microcontrollers
0086     provides the driver interface to interact with the GFX/Compute engine.
0087 
0088     MEC (MicroEngine Compute)
0089         This is the microcontroller that controls the compute queues on the
0090         GFX/compute engine.
0091 
0092     MES (MicroEngine Scheduler)
0093         This is a new engine for managing queues.  This is currently unused.
0094 
0095 RLC (RunList Controller)
0096     This is another microcontroller in the GFX/Compute engine.  It handles
0097     power management related functionality within the GFX/Compute engine.
0098     The name is a vestige of old hardware where it was originally added
0099     and doesn't really have much relation to what the engine does now.
0100 
0101 Driver Structure
0102 ================
0103 
0104 In general, the driver has a list of all of the IPs on a particular
0105 SoC and for things like init/fini/suspend/resume, more or less just
0106 walks the list and handles each IP.
0107 
0108 Some useful constructs:
0109 
0110 KIQ (Kernel Interface Queue)
0111     This is a control queue used by the kernel driver to manage other gfx
0112     and compute queues on the GFX/compute engine.  You can use it to
0113     map/unmap additional queues, etc.
0114 
0115 IB (Indirect Buffer)
0116     A command buffer for a particular engine.  Rather than writing
0117     commands directly to the queue, you can write the commands into a
0118     piece of memory and then put a pointer to the memory into the queue.
0119     The hardware will then follow the pointer and execute the commands in
0120     the memory, then returning to the rest of the commands in the ring.
0121 
0122 .. _amdgpu_memory_domains:
0123 
0124 Memory Domains
0125 ==============
0126 
0127 .. kernel-doc:: include/uapi/drm/amdgpu_drm.h
0128    :doc: memory domains
0129 
0130 Buffer Objects
0131 ==============
0132 
0133 .. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
0134    :doc: amdgpu_object
0135 
0136 .. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
0137    :internal:
0138 
0139 PRIME Buffer Sharing
0140 ====================
0141 
0142 .. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
0143    :doc: PRIME Buffer Sharing
0144 
0145 .. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
0146    :internal:
0147 
0148 MMU Notifier
0149 ============
0150 
0151 .. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
0152    :doc: MMU Notifier
0153 
0154 .. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
0155    :internal:
0156 
0157 AMDGPU Virtual Memory
0158 =====================
0159 
0160 .. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
0161    :doc: GPUVM
0162 
0163 .. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
0164    :internal:
0165 
0166 Interrupt Handling
0167 ==================
0168 
0169 .. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
0170    :doc: Interrupt Handling
0171 
0172 .. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
0173    :internal:
0174 
0175 IP Blocks
0176 =========
0177 
0178 .. kernel-doc:: drivers/gpu/drm/amd/include/amd_shared.h
0179    :doc: IP Blocks
0180 
0181 .. kernel-doc:: drivers/gpu/drm/amd/include/amd_shared.h
0182    :identifiers: amd_ip_block_type amd_ip_funcs