EXPOSING MMIO REGIONS TO USERSPACE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… Exposing MMIO regions to userspace πŸ’…

hey bestie, welcome to the Kernel API Manual β€” this is the (9) page about letting userspace peek at MMIO regions, and we’re gonna make it make sense, fr fr. ✨

In certain cases, the driver may allow userspace to mmap a portion of the hardware registers. Slay, but like… responsibly. 🫢

This can be done as follows:

  1. Call xe_mmio_gem_create to create a GEM object with an mmap-able fake offset. πŸŽ€
  2. Use xe_mmio_gem_mmap_offset on the created GEM object to retrieve the fake offset. πŸ”
  3. Provide the fake offset to userspace. πŸ“¬
  4. Userspace can call mmap with the fake offset. The length provided to mmap must match the size of the GEM object. πŸ“
  5. When the region is no longer needed, call xe_mmio_gem_destroy to release the GEM object. 🧹
NOTE: The exposed MMIO region must be page-aligned with regards to its BAR offset and size. πŸ’…
WARNING: Exposing MMIO regions to userspace can have security and stability implications. Make sure not to expose any sensitive registers. 🚨 This one is not a vibe β€” be careful, bestie.

πŸ‘€ SEE ALSO πŸ‘€


mwah πŸ’‹ this page’s source/version is ./drivers/gpu/drm/xe, dated October 2026. πŸ’–

πŸ“¦ where this page comes from