STRUCT DRM_XE_GEM_MMAP_OFFSET(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ‘‘ NAME πŸ‘‘

okay bestie, welcome to STRUCT DRM_XE_GEM_MMAP_OFFSET(9) in the Kernel API Manual πŸ’– this page is literally all about struct drm_xe_gem_mmap_offset β€” the input of &DRM_IOCTL_XE_GEM_MMAP_OFFSET. iconic behavior, no cap πŸ’…


✨ SYNOPSIS ✨

struct drm_xe_gem_mmap_offset {
    __u64 extensions;
    __u32 handle;
  #define DRM_XE_MMAP_OFFSET_FLAG_PCI_BARRIER     (1 << 0);
    __u32 flags;
    __u64 offset;
    __u64 reserved[2];
 };

πŸŽ€ Members πŸŽ€

  • extensions β€” pointer to the first extension struct, if any. lowkey optional, but bestie it's there πŸ¦‹
  • handle β€” handle for the object being mapped. main character energy fr fr πŸ‘‘
  • flags β€” flags. yes bestie, flags 🚩
  • offset β€” the fake offset to use for subsequent mmap call. it's giving "trust me, this is the one" ✨
  • reserved β€” reserved. it's reserved[2] in the struct, so two lil reserved slots just vibing πŸ™ˆ

🌸 Description 🌸

so the flags can be:

  • DRM_XE_MMAP_OFFSET_FLAG_PCI_BARRIER β€” for user to query special offset for use in mmap ioctl. writing to the returned mmap address will generate a PCI memory barrier with low overhead (avoiding IOCTL call as well as writing to VRAM which would also add overhead), acting like an MI_MEM_FENCE instruction. literally a shortcut for barrier girlies πŸ’…πŸ”₯

πŸ¦‹ Note πŸ¦‹

bestie, important vibe check: the mmap size can be at most 4K, due to HW limitations. as a result this interface is only supported on CPU architectures that support 4K page size. the mmap_offset ioctl will detect this and gracefully return an error, where userspace is expected to have a different fallback method for triggering a barrier. so like… plan accordingly, mwah πŸ˜­πŸ’–

roughly the usage would be as follows:

struct drm_xe_gem_mmap_offset mmo = {
    .handle = 0, // must be set to 0
    .flags = DRM_XE_MMAP_OFFSET_FLAG_PCI_BARRIER,
};

err = ioctl(fd, DRM_IOCTL_XE_GEM_MMAP_OFFSET, mmo);
map = mmap(NULL, size, PROT_WRITE, MAP_SHARED, fd, mmo.offset);
map[i] = 0xdeadbeef; // issue barrier

🌈 SEE ALSO 🌈

  • Kernel file ./include/uapi/drm/xe_drm.h
  • Xe Device Block Diagram(9)
  • Xe uAPI Overview(9)
  • Xe IOCTL Extensions(9)
  • struct drm_xe_user_extension(9)
  • struct drm_xe_ext_set_property(9)
  • struct drm_xe_engine_class_instance(9)
  • struct drm_xe_engine(9)
  • struct drm_xe_query_engines(9)
  • enum drm_xe_memory_class(9)
  • struct drm_xe_mem_region(9)
  • struct drm_xe_query_mem_regions(9)
  • struct drm_xe_query_config(9)
  • struct drm_xe_gt(9)
  • struct drm_xe_query_gt_list(9)
  • struct drm_xe_query_topology_mask(9)
  • struct drm_xe_query_engine_cycles(9)
  • struct drm_xe_query_uc_fw_version(9)
  • struct drm_xe_query_pxp_status(9)
  • struct drm_xe_device_query(9)
  • struct drm_xe_gem_create(9)
  • struct drm_xe_vm_create(9)
  • struct drm_xe_vm_destroy(9)
  • struct drm_xe_vm_bind_op(9)
  • struct drm_xe_vm_bind(9)
  • struct drm_xe_vm_get_property(9)
  • struct drm_xe_exec_queue_create(9)
  • struct drm_xe_exec_queue_destroy(9)
  • struct drm_xe_exec_queue_get_property(9)
  • struct drm_xe_sync(9)
  • struct drm_xe_exec(9)
  • struct drm_xe_wait_user_fence(9)
  • enum drm_xe_observation_type(9)
  • enum drm_xe_observation_op(9)
  • struct drm_xe_observation_param(9)
  • enum drm_xe_observation_ioctls(9)
  • enum drm_xe_oa_unit_type(9)
  • struct drm_xe_oa_unit(9)
  • struct drm_xe_query_oa_units(9)
  • enum drm_xe_oa_format_type(9)
  • enum drm_xe_oa_property_id(9)
  • struct drm_xe_oa_config(9)
  • struct drm_xe_oa_stream_status(9)
  • struct drm_xe_oa_stream_info(9)
  • enum drm_xe_pxp_session_type(9)
  • enum drm_xe_eu_stall_property_id(9)
  • struct drm_xe_query_eu_stall(9)
  • struct drm_xe_madvise(9)
  • struct drm_xe_mem_range_attr(9)
  • struct drm_xe_vm_query_mem_range_attr(9)
  • struct drm_xe_exec_queue_set_property(9)
  • Xe DRM RAS(9)
  • enum drm_xe_ras_error_severity(9)
  • enum drm_xe_ras_error_component(9)

mwah πŸ’‹ source vibes: ./include/uapi/drm, dated October 2026, manual tag struct drm_..._mmap_offset(9) β€” periodt, go be iconic with your mmap bestie πŸ’–βœ¨πŸ«Ά

πŸ“¦ where this page comes from