STRUCT DRM_XE_MEM_RANGE_ATTR(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct drm_xe_mem_range_attr(9) β€” the glow-up

okay so bestie, we're in the Kernel API Manual today, and the star of the show is struct drm_xe_mem_range_attr(9). no cap, this one's a whole vibe: it's the output of &DRM_IOCTL_XE_VM_QUERY_MEM_RANGE_ATTRS. yes the ampersand is part of it, don't come for me πŸ’…


✨ NAME ✨

struct drm_xe_mem_range_attr β€” literally the Output of &DRM_IOCTL_XE_VM_QUERY_MEM_RANGE_ATTRS. that's it. that's the name. iconic behaviour honestly πŸŽ€


🌸 SYNOPSIS 🌸

here's the whole struct, and bestie I'm showing it to you exactly as it is, character for character, because we do not paraphrase code in this house:

struct drm_xe_mem_range_attr {
    __u64 extensions;
    __u64 start;
    __u64 end;
    struct {
      __u32 devmem_fd;
      __u32 migration_policy;
    } preferred_mem_loc;
    struct {
      __u32 val;
      __u32 reserved;
    } atomic;
    struct {
      __u32 val;
      __u32 reserved;
    } pat_index;
    __u64 reserved[2];
 };

look at those nested structs. it's giving little family units 🫢


πŸ¦‹ Members πŸ¦‹

  • extensions β€” pointer to the first extension struct, if any. the "if any" is doing so much heavy lifting here ngl
  • start β€” start of the memory range. the beginning. the origin story ✨
  • end β€” end of the memory range. the finale. the closing credits
  • preferred_mem_loc β€” preferred memory location. where it wants to live 🏑
    • preferred_mem_loc.devmem_fd β€” fd for preferred loc
    • preferred_mem_loc.migration_policy β€” Page migration policy. yes, it can move. main character energy honestly
  • atomic β€” Atomic access policy
    • atomic.val β€” atomic attribute
    • atomic.reserved β€” Reserved
  • pat_index β€” Page attribute table index
    • pat_index.val β€” PAT index
    • pat_index.reserved β€” Reserved
  • reserved β€” Reserved

(the two reserved fields inside the sub-structs lowkey minding their own business, and then there's reserved[2] at the bottom β€” an array of two, because one reserved just wasn't enough πŸ’€)


🌈 Description 🌈

so here's the tea β˜• β€” this structure is provided by userspace and filled by KMD in response to the DRM_IOCTL_XE_VM_QUERY_MEM_RANGE_ATTRS ioctl. you hand it over, the kernel does its little fill-in, and you get it back all dressed up. it describes memory attributes of memory ranges within a user specified address range in a VM. very "here's the map of your vibes" of it.

the structure includes information such as atomic access policy, page attribute table (PAT) index, and preferred memory location. so like, the whole personality of a memory range πŸŽ€

Userspace allocates an array of these structures and passes a pointer to the ioctl to retrieve attributes for each memory range. an array, bestie. plural. one per range. don't show up with a single lonely struct and expect the whole picture πŸ’…


πŸ”₯ SEE ALSO πŸ”₯

grab a snack, this list is a whole friend group and everyone's invited:

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_gem_mmap_offset(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_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).

like I said. whole friend group. say hi to all of them 🫢


fr fr though: the struct is user-provided and kernel-filled, and you need an array of them, one per memory range. get that wrong and the ioctl will simply not slay. πŸ™ˆ

and that's the page! brought to you from ./include/uapi/drm, dated October 2026 β€” mwah, catch you on the next man page bestie πŸ’–βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from