STRUCT KFD_IOCTL_SVM_ARGS(9)
π struct kfd_ioctl_svm_args(9) β¨
okay so this is a page straight out of the Kernel API Manual, and it's literally the cheat sheet for struct kfd_ioctl_svm_args β the lil argument bundle you hand to the SVM ioctl. buckle up bestie, we're going in π«Ά
πΈ NAME πΈ
struct kfd_ioctl_svm_args β the arguments for the SVM ioctl, no cap π
β¨ SYNOPSIS β¨
struct kfd_ioctl_svm_args {
__u64 start_addr;
__u64 size;
__u32 op;
__u32 nattr;
struct kfd_ioctl_svm_attribute attrs[];
};
π Members π
(the manpage keeps this heading but the actual members are the ones up in the synopsis, so likeβ¦ look up there β¬οΈ)
π¦ DESCRIPTION π¦
so op is the vibe check β it says which operation you're doing (peep enum kfd_ioctl_svm_op for the menu π). and start_addr + size? those two are the moment, they're common to every operation, always invited to the party.
you can throw a variable number of attributes in attrs, and nattr tells everyone how many you brought. the iconic part? new attributes can be added in the future without breaking the ABI β future-proof queen behavior π. but if someone hands over attributes nobody recognizes, the function hits you with -EINVAL and honestly? fair.
KFD_IOCTL_SVM_OP_SET_ATTR sets attributes for a virtual address range. it may overlap existing virtual address ranges β and if it does, those existing ranges get split so the attribute changes only apply to the address range you actually specified. surgical, precise, main character energy β
KFD_IOCTL_SVM_OP_GET_ATTR returns the intersection of attributes over all memory in the given range, and hands you back the result as the attribute value. and here's the fine print, don't skip it: if different pages have different preferred or prefetch locations, 0xffffffff will be returned for KFD_IOCTL_SVM_ATTR_PREFERRED_LOC or KFD_IOCTL_SVM_ATTR_PREFETCH_LOC respectively. π
for KFD_IOCTL_SVM_ATTR_SET_FLAGS, flags of all pages get aggregated by bitwise AND. meaning: a flag shows up set in the output only if that flag is set for all pages in the range. all of them. every single one. π
for KFD_IOCTL_SVM_ATTR_CLR_FLAGS, flags of all pages get aggregated by bitwise NOR. meaning: a flag shows up set in the output only if that flag is clear for all pages in the range.
and for KFD_IOCTL_SVM_ATTR_GRANULARITY, you get back the minimum migration granularity throughout the range. tiny but mighty, we love her π
ok so querying accessibility attributes is a whole little ritual: you init the attribute type to KFD_IOCTL_SVM_ATTR_ACCESS and the value to the GPUID you're querying. you can pass multiple attributes to query multiple GPUIDs at once β efficiency icon. then the ioctl function overwrites the attribute type to indicate the access for the specified GPU. it rewrites the type on you, that's just how it is, no notes π
π SEE ALSO π
like a whole friend group, fr fr β go read these next:
- the kernel file
./include/uapi/linux/kfd_ioctl.h(the struct lives there π) struct kfd_ioctl_criu_args(9)enum kfd_ioctl_svm_op(9)enum kfd_ioctl_svm_attr_type(9)struct kfd_ioctl_svm_attribute(9)struct kfd_ioctl_set_xnack_mode_args(9)struct kfd_ioctl_runtime_enable_args(9)struct kfd_ioctl_dbg_trap_enable_args(9)struct kfd_ioctl_dbg_trap_send_runtime_event_args(9)struct kfd_ioctl_dbg_trap_set_exceptions_enabled_args(9)struct kfd_ioctl_dbg_trap_set_wave_launch_override_args(9)struct kfd_ioctl_dbg_trap_set_wave_launch_mode_args(9)struct kfd_ioctl_dbg_trap_suspend_queues_args(9)struct kfd_ioctl_dbg_trap_resume_queues_args(9)struct kfd_ioctl_dbg_trap_set_node_address_watch_args(9)struct kfd_ioctl_dbg_trap_clear_node_address_watch_args(9)struct kfd_ioctl_dbg_trap_set_flags_args(9)struct kfd_ioctl_dbg_trap_query_debug_event_args(9)struct kfd_ioctl_dbg_trap_query_exception_info_args(9)struct kfd_ioctl_dbg_trap_queue_snapshot_args(9)struct kfd_ioctl_dbg_trap_device_snapshot_args(9)struct kfd_ioctl_dbg_trap_args(9)struct kfd_ioctl_pmc_settings(9)
and that's the whole page, bestie!! π it lives over in ./include/uapi/linux, dated October 2026, and this whole thing is literally titled struct kfd_ioctl_svm_args(9) β go off, kernel docs. slay β¨π
π¦ 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