Search code examples
linux-kernelgpudrm

Regarding GPU driver in Linux kernel


I've found i915_drm which is the DRM driver for Intel GPUs. As far as I know, GPU drivers are not usually open to public.

My question is: is this i915 typically called "GPU driver" for Intel GPU? If not (I suspect not), could you tell me what is the relationship between DRM driver and GPU driver?


Solution

  • The DRM driver arbitrates access to the GPU, while the actual GPU driver prepares the command stream. Only the former is relevant to security and needs to be performed in the kernel, while the latter is highly complex and better implemented as a user process.

    The kernel driver sets up the address ranges, both for CPU->GPU accesses (BAR mappings), and for GPU->Memory accesses (DMA regions).

    This ensures that the GPU can only access dedicated DMA memory, in order to stop GPU programs from reading out sensitive data like passwords, and, depending on the capabilities of the GPU DMA engine, can even set up multiple contexts further limiting the GPU to the DMA buffers submitted along with the program.

    The full GPU driver uses this functionality to request a device context and DMA memory mappings, compiles programs such as shaders or OpenCL kernels, and submits them via the low-level drivers.