EXPOSING MMIO REGIONS TO USERSPACE(9)
π 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:
- Call
xe_mmio_gem_createto create a GEM object with an mmap-able fake offset. π - Use
xe_mmio_gem_mmap_offseton the created GEM object to retrieve the fake offset. π - Provide the fake offset to userspace. π¬
- Userspace can call
mmapwith the fake offset. The length provided tommapmust match the size of the GEM object. π - When the region is no longer needed, call
xe_mmio_gem_destroyto 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 π
- Kernel file
./drivers/gpu/drm/xe/xe_mmio_gem.c xe_mmio_gem_create(9)xe_mmio_gem_mmap_offset(9)xe_mmio_gem_destroy(9)
mwah π this pageβs source/version is ./drivers/gpu/drm/xe, dated October 2026. π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms