--- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl.c:1166 [MATCH: spin_unlock] --- queue_work(kgsl_driver.lockless_workqueue, &device->work_period_ws); } static struct gpu_work_period *kgsl_get_work_period(uid_t uid) { struct gpu_work_period *wp; spin_lock(&kgsl_driver.wp_list_lock); list_for_each_entry(wp, &kgsl_driver.wp_list, list) { if ((uid == wp->uid) && kref_get_unless_zero(&wp->refcount)) { spin_unlock(&kgsl_driver.wp_list_lock); return wp; } } wp = kzalloc(sizeof(*wp), GFP_ATOMIC); if (!wp) { spin_unlock(&kgsl_driver.wp_list_lock); return ERR_PTR(-ENOMEM); } kref_init(&wp->refcount); wp->uid = uid; INIT_WORK(&wp->defer_ws, _defer_work_period_put); list_add(&wp->list, &kgsl_driver.wp_list); spin_unlock(&kgsl_driver.wp_list_lock); return wp; } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl.c:1173 [MATCH: spin_unlock] --- spin_lock(&kgsl_driver.wp_list_lock); list_for_each_entry(wp, &kgsl_driver.wp_list, list) { if ((uid == wp->uid) && kref_get_unless_zero(&wp->refcount)) { spin_unlock(&kgsl_driver.wp_list_lock); return wp; } } wp = kzalloc(sizeof(*wp), GFP_ATOMIC); if (!wp) { spin_unlock(&kgsl_driver.wp_list_lock); return ERR_PTR(-ENOMEM); } kref_init(&wp->refcount); wp->uid = uid; INIT_WORK(&wp->defer_ws, _defer_work_period_put); list_add(&wp->list, &kgsl_driver.wp_list); spin_unlock(&kgsl_driver.wp_list_lock); return wp; } static struct kgsl_process_private *kgsl_process_private_new( struct kgsl_device *device) { struct kgsl_process_private *private; struct pid *cur_pid = get_task_pid(current->group_leader, PIDTYPE_PID); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl.c:1181 [MATCH: spin_unlock] --- wp = kzalloc(sizeof(*wp), GFP_ATOMIC); if (!wp) { spin_unlock(&kgsl_driver.wp_list_lock); return ERR_PTR(-ENOMEM); } kref_init(&wp->refcount); wp->uid = uid; INIT_WORK(&wp->defer_ws, _defer_work_period_put); list_add(&wp->list, &kgsl_driver.wp_list); spin_unlock(&kgsl_driver.wp_list_lock); return wp; } static struct kgsl_process_private *kgsl_process_private_new( struct kgsl_device *device) { struct kgsl_process_private *private; struct pid *cur_pid = get_task_pid(current->group_leader, PIDTYPE_PID); /* Search in the process list */ list_for_each_entry(private, &kgsl_driver.process_list, list) { if (private->pid == cur_pid) { if (!kgsl_process_private_get(private)) { /* * This will happen only if refcount is zero * i.e. destroy is triggered but didn't complete * yet. Return -EEXIST to indicate caller that --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl.c:1291 [MATCH: spin_unlock] --- static void process_release_memory(struct kgsl_process_private *private) { struct kgsl_mem_entry *entry; int next = 0; while (1) { spin_lock(&private->mem_lock); entry = idr_get_next(&private->mem_idr, &next); if (entry == NULL) { spin_unlock(&private->mem_lock); break; } /* * If the free pending flag is not set it means that user space * did not free it's reference to this entry, in that case * free a reference to this entry, other references are from * within kgsl so they will be freed eventually by kgsl */ if (!entry->pending_free) { entry->pending_free = 1; spin_unlock(&private->mem_lock); kgsl_mem_entry_put(entry); } else { spin_unlock(&private->mem_lock); } next = next + 1; } } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl.c:1302 [MATCH: spin_unlock] --- break; } /* * If the free pending flag is not set it means that user space * did not free it's reference to this entry, in that case * free a reference to this entry, other references are from * within kgsl so they will be freed eventually by kgsl */ if (!entry->pending_free) { entry->pending_free = 1; spin_unlock(&private->mem_lock); kgsl_mem_entry_put(entry); } else { spin_unlock(&private->mem_lock); } next = next + 1; } } static void kgsl_process_private_close(struct kgsl_device_private *dev_priv, struct kgsl_process_private *private) { mutex_lock(&private->private_mutex); if (--private->fd_count > 0) { mutex_unlock(&private->private_mutex); kgsl_process_private_put(private); return; } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl.c:1305 [MATCH: spin_unlock] --- * If the free pending flag is not set it means that user space * did not free it's reference to this entry, in that case * free a reference to this entry, other references are from * within kgsl so they will be freed eventually by kgsl */ if (!entry->pending_free) { entry->pending_free = 1; spin_unlock(&private->mem_lock); kgsl_mem_entry_put(entry); } else { spin_unlock(&private->mem_lock); } next = next + 1; } } static void kgsl_process_private_close(struct kgsl_device_private *dev_priv, struct kgsl_process_private *private) { mutex_lock(&private->private_mutex); if (--private->fd_count > 0) { mutex_unlock(&private->private_mutex); kgsl_process_private_put(private); return; } /* * If this is the last file on the process garbage collect --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl.c:1606 [MATCH: spin_unlock] --- return NULL; spin_lock(&private->mem_lock); idr_for_each_entry(&private->mem_idr, entry, id) { if (GPUADDR_IN_MEMDESC(gpuaddr, &entry->memdesc)) { if (!entry->pending_free) ret = kgsl_mem_entry_get(entry); break; } } spin_unlock(&private->mem_lock); return ret; } static struct kgsl_mem_entry * __must_check kgsl_sharedmem_find_id_flags(struct kgsl_process_private *process, unsigned int id, uint64_t flags) { struct kgsl_mem_entry *entry, *ret = NULL; spin_lock(&process->mem_lock); entry = idr_find(&process->mem_idr, id); if (entry) if (!entry->pending_free && (flags & entry->memdesc.flags) == flags) ret = kgsl_mem_entry_get(entry); spin_unlock(&process->mem_lock); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl.c:1623 [MATCH: spin_unlock] --- unsigned int id, uint64_t flags) { struct kgsl_mem_entry *entry, *ret = NULL; spin_lock(&process->mem_lock); entry = idr_find(&process->mem_idr, id); if (entry) if (!entry->pending_free && (flags & entry->memdesc.flags) == flags) ret = kgsl_mem_entry_get(entry); spin_unlock(&process->mem_lock); return ret; } /** * kgsl_sharedmem_find_id() - find a memory entry by id * @process: the owning process * @id: id to find * * @returns - the mem_entry or NULL * * Caller must kgsl_mem_entry_put() the returned entry, when finished using * it. */ struct kgsl_mem_entry * __must_check kgsl_sharedmem_find_id(struct kgsl_process_private *process, unsigned int id) { return kgsl_sharedmem_find_id_flags(process, id, 0); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl.c:1654 [MATCH: spin_unlock] --- /** * kgsl_mem_entry_unset_pend() - Unset the pending free flag of an entry * @entry - The memory entry */ static inline void kgsl_mem_entry_unset_pend(struct kgsl_mem_entry *entry) { if (entry == NULL) return; spin_lock(&entry->priv->mem_lock); entry->pending_free = 0; spin_unlock(&entry->priv->mem_lock); } /** * kgsl_mem_entry_set_pend() - Set the pending free flag of a memory entry * @entry - The memory entry * * @returns - true if pending flag was 0 else false * * This function will set the pending free flag if it is previously unset. Used * to prevent race condition between ioctls calling free/freememontimestamp * on the same entry. Whichever thread set's the flag first will do the free. */ static inline bool kgsl_mem_entry_set_pend(struct kgsl_mem_entry *entry) { bool ret = false; if (entry == NULL) return false; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl.c:1679 [MATCH: spin_unlock] --- bool ret = false; if (entry == NULL) return false; spin_lock(&entry->priv->mem_lock); if (!entry->pending_free) { entry->pending_free = 1; ret = true; } spin_unlock(&entry->priv->mem_lock); return ret; } static int kgsl_get_ctxt_fault_stats(struct kgsl_context *context, struct kgsl_context_property *ctxt_property) { struct kgsl_context_property_fault fault_stats; size_t copy; /* Return the size of the subtype struct */ if (ctxt_property->size == 0) { ctxt_property->size = sizeof(fault_stats); return 0; } memset(&fault_stats, 0, sizeof(fault_stats)); copy = min_t(size_t, ctxt_property->size, sizeof(fault_stats)); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl.c:3548 [MATCH: spin_unlock] --- switch (kgsl_memdesc_get_memtype(&scan_mem_entry->memdesc)) { case KGSL_MEMTYPE_EGL_SURFACE: case KGSL_MEMTYPE_SURFACE: (*egl_surface_count)++; break; case KGSL_MEMTYPE_EGL_IMAGE: (*egl_image_count)++; break; } } spin_unlock(&kgsl_dmabuf_lock); } unsigned long kgsl_get_dmabuf_inode_number(struct kgsl_mem_entry *entry) { struct kgsl_dma_buf_meta *metadata = entry->priv_data; return metadata ? file_inode(metadata->dmabuf->file)->i_ino : 0; } #else void kgsl_get_egl_counts(struct kgsl_mem_entry *entry, int *egl_surface_count, int *egl_image_count) { } unsigned long kgsl_get_dmabuf_inode_number(struct kgsl_mem_entry *entry) { } #endif --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl.c:4773 [MATCH: spin_unlock] --- { int ret; /* * Protect access to the gpuaddr here to prevent multiple vmas from * trying to map a SVM region at the same time */ spin_lock(&entry->memdesc.lock); if (entry->memdesc.gpuaddr) { spin_unlock(&entry->memdesc.lock); return (unsigned long) -EBUSY; } ret = kgsl_mmu_set_svm_region(private->pagetable, (uint64_t) addr, (uint64_t) size); if (ret != 0) { spin_unlock(&entry->memdesc.lock); return (unsigned long) ret; } entry->memdesc.gpuaddr = (uint64_t) addr; spin_unlock(&entry->memdesc.lock); entry->memdesc.pagetable = private->pagetable; ret = kgsl_mmu_map(private->pagetable, &entry->memdesc); if (ret) { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl.c:4781 [MATCH: spin_unlock] --- if (entry->memdesc.gpuaddr) { spin_unlock(&entry->memdesc.lock); return (unsigned long) -EBUSY; } ret = kgsl_mmu_set_svm_region(private->pagetable, (uint64_t) addr, (uint64_t) size); if (ret != 0) { spin_unlock(&entry->memdesc.lock); return (unsigned long) ret; } entry->memdesc.gpuaddr = (uint64_t) addr; spin_unlock(&entry->memdesc.lock); entry->memdesc.pagetable = private->pagetable; ret = kgsl_mmu_map(private->pagetable, &entry->memdesc); if (ret) { kgsl_mmu_put_gpuaddr(private->pagetable, &entry->memdesc); return (unsigned long) ret; } kgsl_memfree_purge(private->pagetable, entry->memdesc.gpuaddr, entry->memdesc.size); return addr; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl.c:4786 [MATCH: spin_unlock] --- ret = kgsl_mmu_set_svm_region(private->pagetable, (uint64_t) addr, (uint64_t) size); if (ret != 0) { spin_unlock(&entry->memdesc.lock); return (unsigned long) ret; } entry->memdesc.gpuaddr = (uint64_t) addr; spin_unlock(&entry->memdesc.lock); entry->memdesc.pagetable = private->pagetable; ret = kgsl_mmu_map(private->pagetable, &entry->memdesc); if (ret) { kgsl_mmu_put_gpuaddr(private->pagetable, &entry->memdesc); return (unsigned long) ret; } kgsl_memfree_purge(private->pagetable, entry->memdesc.gpuaddr, entry->memdesc.size); return addr; } unsigned long kgsl_get_align(struct kgsl_memdesc *memdesc) { u32 bit = kgsl_memdesc_get_align(memdesc); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl.h:455 [MATCH: results] --- /* check for equal */ if (a == b) return 0; /* check for greater-than for non-rollover case */ if ((a > b) && (a - b < KGSL_TIMESTAMP_WINDOW)) return 1; /* check for greater-than for rollover case * note that <= is required to ensure that consistent * results are returned for values whose difference is * equal to the window size */ a += KGSL_TIMESTAMP_WINDOW; b += KGSL_TIMESTAMP_WINDOW; return ((a > b) && (a - b <= KGSL_TIMESTAMP_WINDOW)) ? 1 : -1; } /** * kgsl_schedule_work() - Schedule a work item on the KGSL workqueue * @work: work item to schedule */ static inline void kgsl_schedule_work(struct work_struct *work) { queue_work(kgsl_driver.workqueue, work); } static inline struct kgsl_mem_entry * kgsl_mem_entry_get(struct kgsl_mem_entry *entry) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_debugfs.c:247 [MATCH: spin_lock] --- { struct kgsl_mem_entry *entry = ptr; struct kgsl_process_private *private = s->private; int id = 0; loff_t temp_pos = 1; if (entry != SEQ_START_TOKEN) id = entry->id + 1; spin_lock(&private->mem_lock); for (entry = idr_get_next(&private->mem_idr, &id); entry; id++, entry = idr_get_next(&private->mem_idr, &id), temp_pos++) { if (temp_pos == pos && kgsl_mem_entry_get(entry)) { spin_unlock(&private->mem_lock); goto found; } } spin_unlock(&private->mem_lock); entry = NULL; found: if (ptr != SEQ_START_TOKEN) kgsl_mem_entry_put(ptr); return entry; } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_debugfs.c:362 [MATCH: spin_lock] --- kgsl_memdesc_print_vbo_ranges(ptr, data); return 0; } static int vbo_print(struct seq_file *s, void *unused) { struct kgsl_process_private *private = s->private; seq_puts(s, "id child range\n"); spin_lock(&private->mem_lock); idr_for_each(&private->mem_idr, print_vbo_ranges, s); spin_unlock(&private->mem_lock); return 0; } static int vbo_open(struct inode *inode, struct file *file) { pid_t pid = (pid_t) (unsigned long) inode->i_private; struct kgsl_process_private *private; int ret; private = kgsl_process_private_find(pid); if (!private) return -ENODEV; ret = single_open(file, vbo_print, private); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_debugfs.c:252 [MATCH: spin_unlock] --- loff_t temp_pos = 1; if (entry != SEQ_START_TOKEN) id = entry->id + 1; spin_lock(&private->mem_lock); for (entry = idr_get_next(&private->mem_idr, &id); entry; id++, entry = idr_get_next(&private->mem_idr, &id), temp_pos++) { if (temp_pos == pos && kgsl_mem_entry_get(entry)) { spin_unlock(&private->mem_lock); goto found; } } spin_unlock(&private->mem_lock); entry = NULL; found: if (ptr != SEQ_START_TOKEN) kgsl_mem_entry_put(ptr); return entry; } static void *process_mem_seq_start(struct seq_file *s, loff_t *pos) { loff_t seq_file_offset = *pos; if (seq_file_offset == 0) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_debugfs.c:256 [MATCH: spin_unlock] --- spin_lock(&private->mem_lock); for (entry = idr_get_next(&private->mem_idr, &id); entry; id++, entry = idr_get_next(&private->mem_idr, &id), temp_pos++) { if (temp_pos == pos && kgsl_mem_entry_get(entry)) { spin_unlock(&private->mem_lock); goto found; } } spin_unlock(&private->mem_lock); entry = NULL; found: if (ptr != SEQ_START_TOKEN) kgsl_mem_entry_put(ptr); return entry; } static void *process_mem_seq_start(struct seq_file *s, loff_t *pos) { loff_t seq_file_offset = *pos; if (seq_file_offset == 0) return SEQ_START_TOKEN; else return process_mem_seq_find(s, SEQ_START_TOKEN, seq_file_offset); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_debugfs.c:364 [MATCH: spin_unlock] --- } static int vbo_print(struct seq_file *s, void *unused) { struct kgsl_process_private *private = s->private; seq_puts(s, "id child range\n"); spin_lock(&private->mem_lock); idr_for_each(&private->mem_idr, print_vbo_ranges, s); spin_unlock(&private->mem_lock); return 0; } static int vbo_open(struct inode *inode, struct file *file) { pid_t pid = (pid_t) (unsigned long) inode->i_private; struct kgsl_process_private *private; int ret; private = kgsl_process_private_find(pid); if (!private) return -ENODEV; ret = single_open(file, vbo_print, private); if (ret) kgsl_process_private_put(private); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_device.h:787 [MATCH: timeout] --- static inline bool kgsl_state_is_awake(struct kgsl_device *device) { return (device->state == KGSL_STATE_ACTIVE || device->state == KGSL_STATE_AWARE); } /** * kgsl_start_idle_timer - Start the idle timer * @device: A KGSL device handle * * Start the idle timer to expire in 'interval_timeout' milliseconds */ static inline void kgsl_start_idle_timer(struct kgsl_device *device) { device->idle_jiffies = jiffies + msecs_to_jiffies(atomic64_read(&device->pwrctrl.interval_timeout)); mod_timer(&device->idle_timer, device->idle_jiffies); } int kgsl_readtimestamp(struct kgsl_device *device, void *priv, enum kgsl_timestamp_type type, unsigned int *timestamp); bool kgsl_check_timestamp(struct kgsl_device *device, struct kgsl_context *context, unsigned int timestamp); int kgsl_device_platform_probe(struct kgsl_device *device); void kgsl_device_platform_remove(struct kgsl_device *device); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_device.h:792 [MATCH: timeout] --- /** * kgsl_start_idle_timer - Start the idle timer * @device: A KGSL device handle * * Start the idle timer to expire in 'interval_timeout' milliseconds */ static inline void kgsl_start_idle_timer(struct kgsl_device *device) { device->idle_jiffies = jiffies + msecs_to_jiffies(atomic64_read(&device->pwrctrl.interval_timeout)); mod_timer(&device->idle_timer, device->idle_jiffies); } int kgsl_readtimestamp(struct kgsl_device *device, void *priv, enum kgsl_timestamp_type type, unsigned int *timestamp); bool kgsl_check_timestamp(struct kgsl_device *device, struct kgsl_context *context, unsigned int timestamp); int kgsl_device_platform_probe(struct kgsl_device *device); void kgsl_device_platform_remove(struct kgsl_device *device); const char *kgsl_pwrstate_to_str(unsigned int state); /** * kgsl_device_snapshot_probe - add resources for the device GPU snapshot * @device: The device to initialize --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_device.h:67 [MATCH: results] --- #define KGSL_STATE_NONE 0x00000000 #define KGSL_STATE_INIT 0x00000001 #define KGSL_STATE_ACTIVE 0x00000002 #define KGSL_STATE_NAP 0x00000004 /* Not Used */ #define KGSL_STATE_SUSPEND 0x00000010 #define KGSL_STATE_AWARE 0x00000020 #define KGSL_STATE_SLUMBER 0x00000080 #define KGSL_STATE_MINBW 0x00000100 /* Not Used */ /** * enum kgsl_event_results - result codes passed to an event callback when the * event is retired or cancelled * @KGSL_EVENT_RETIRED: The timestamp associated with the event retired * successflly * @KGSL_EVENT_CANCELLED: The event was cancelled before the event was fired */ enum kgsl_event_results { KGSL_EVENT_RETIRED = 1, KGSL_EVENT_CANCELLED = 2, }; /* * "list" of event types for ftrace symbolic magic */ #define KGSL_CONTEXT_FLAGS \ { KGSL_CONTEXT_NO_GMEM_ALLOC, "NO_GMEM_ALLOC" }, \ { KGSL_CONTEXT_PREAMBLE, "PREAMBLE" }, \ { KGSL_CONTEXT_TRASH_STATE, "TRASH_STATE" }, \ --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_device.h:73 [MATCH: results] --- #define KGSL_STATE_SLUMBER 0x00000080 #define KGSL_STATE_MINBW 0x00000100 /* Not Used */ /** * enum kgsl_event_results - result codes passed to an event callback when the * event is retired or cancelled * @KGSL_EVENT_RETIRED: The timestamp associated with the event retired * successflly * @KGSL_EVENT_CANCELLED: The event was cancelled before the event was fired */ enum kgsl_event_results { KGSL_EVENT_RETIRED = 1, KGSL_EVENT_CANCELLED = 2, }; /* * "list" of event types for ftrace symbolic magic */ #define KGSL_CONTEXT_FLAGS \ { KGSL_CONTEXT_NO_GMEM_ALLOC, "NO_GMEM_ALLOC" }, \ { KGSL_CONTEXT_PREAMBLE, "PREAMBLE" }, \ { KGSL_CONTEXT_TRASH_STATE, "TRASH_STATE" }, \ { KGSL_CONTEXT_CTX_SWITCH, "CTX_SWITCH" }, \ { KGSL_CONTEXT_PER_CONTEXT_TS, "PER_CONTEXT_TS" }, \ { KGSL_CONTEXT_USER_GENERATED_TS, "USER_TS" }, \ { KGSL_CONTEXT_NO_FAULT_TOLERANCE, "NO_FT" }, \ { KGSL_CONTEXT_INVALIDATE_ON_FAULT, "INVALIDATE_ON_FAULT" }, \ { KGSL_CONTEXT_PWR_CONSTRAINT, "PWR" }, \ --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_device.h:26 [MATCH: mutex_lock] --- #include "kgsl_drawobj.h" #include "kgsl_mmu.h" #include "kgsl_regmap.h" #define KGSL_IOCTL_FUNC(_cmd, _func) \ [_IOC_NR((_cmd))] = \ { .cmd = (_cmd), .func = (_func) } #if IS_ENABLED(CONFIG_QCOM_KGSL_RT_MUTEX) #define kgsl_mutex_init(mutex) rt_mutex_init(mutex) #define kgsl_mutex_lock(mutex) rt_mutex_lock(mutex) #define kgsl_mutex_unlock(mutex) rt_mutex_unlock(mutex) #define kgsl_mutex_trylock(mutex) rt_mutex_trylock(mutex) #if (KERNEL_VERSION(5, 10, 0) >= LINUX_VERSION_CODE) #define kgsl_mutex_is_locked(mutex) rt_mutex_is_locked(mutex) #else #define kgsl_mutex_is_locked(mutex) ((mutex)->rtmutex.owner != NULL) #endif #else #define kgsl_mutex_init(mutex) mutex_init(mutex) #define kgsl_mutex_lock(mutex) mutex_lock(mutex) #define kgsl_mutex_unlock(mutex) mutex_unlock(mutex) #define kgsl_mutex_trylock(mutex) mutex_trylock(mutex) #define kgsl_mutex_is_locked(mutex) mutex_is_locked(mutex) #endif /* --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_device.h:38 [MATCH: mutex_lock] --- #define kgsl_mutex_trylock(mutex) rt_mutex_trylock(mutex) #if (KERNEL_VERSION(5, 10, 0) >= LINUX_VERSION_CODE) #define kgsl_mutex_is_locked(mutex) rt_mutex_is_locked(mutex) #else #define kgsl_mutex_is_locked(mutex) ((mutex)->rtmutex.owner != NULL) #endif #else #define kgsl_mutex_init(mutex) mutex_init(mutex) #define kgsl_mutex_lock(mutex) mutex_lock(mutex) #define kgsl_mutex_unlock(mutex) mutex_unlock(mutex) #define kgsl_mutex_trylock(mutex) mutex_trylock(mutex) #define kgsl_mutex_is_locked(mutex) mutex_is_locked(mutex) #endif /* * KGSL device state is initialized to INIT when platform_probe * * successfully initialized the device. Once a device has been opened * * (started) it becomes active. NAP implies that only low latency * * resources (for now clocks on some platforms) are off. SLEEP implies * * that the KGSL module believes a device is idle (has been inactive * * past its timer) and all system resources are released. SUSPEND is * * requested by the kernel and will be enforced upon all open devices. * * RESET indicates that GPU or GMU hang happens. KGSL is handling * * snapshot or recover GPU from hang. MINBW implies that DDR BW vote is * * set to non-zero minimum value. */ --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_device.h:27 [MATCH: mutex_unlock] --- #include "kgsl_mmu.h" #include "kgsl_regmap.h" #define KGSL_IOCTL_FUNC(_cmd, _func) \ [_IOC_NR((_cmd))] = \ { .cmd = (_cmd), .func = (_func) } #if IS_ENABLED(CONFIG_QCOM_KGSL_RT_MUTEX) #define kgsl_mutex_init(mutex) rt_mutex_init(mutex) #define kgsl_mutex_lock(mutex) rt_mutex_lock(mutex) #define kgsl_mutex_unlock(mutex) rt_mutex_unlock(mutex) #define kgsl_mutex_trylock(mutex) rt_mutex_trylock(mutex) #if (KERNEL_VERSION(5, 10, 0) >= LINUX_VERSION_CODE) #define kgsl_mutex_is_locked(mutex) rt_mutex_is_locked(mutex) #else #define kgsl_mutex_is_locked(mutex) ((mutex)->rtmutex.owner != NULL) #endif #else #define kgsl_mutex_init(mutex) mutex_init(mutex) #define kgsl_mutex_lock(mutex) mutex_lock(mutex) #define kgsl_mutex_unlock(mutex) mutex_unlock(mutex) #define kgsl_mutex_trylock(mutex) mutex_trylock(mutex) #define kgsl_mutex_is_locked(mutex) mutex_is_locked(mutex) #endif /* * KGSL device state is initialized to INIT when platform_probe * --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_device.h:39 [MATCH: mutex_unlock] --- #if (KERNEL_VERSION(5, 10, 0) >= LINUX_VERSION_CODE) #define kgsl_mutex_is_locked(mutex) rt_mutex_is_locked(mutex) #else #define kgsl_mutex_is_locked(mutex) ((mutex)->rtmutex.owner != NULL) #endif #else #define kgsl_mutex_init(mutex) mutex_init(mutex) #define kgsl_mutex_lock(mutex) mutex_lock(mutex) #define kgsl_mutex_unlock(mutex) mutex_unlock(mutex) #define kgsl_mutex_trylock(mutex) mutex_trylock(mutex) #define kgsl_mutex_is_locked(mutex) mutex_is_locked(mutex) #endif /* * KGSL device state is initialized to INIT when platform_probe * * successfully initialized the device. Once a device has been opened * * (started) it becomes active. NAP implies that only low latency * * resources (for now clocks on some platforms) are off. SLEEP implies * * that the KGSL module believes a device is idle (has been inactive * * past its timer) and all system resources are released. SUSPEND is * * requested by the kernel and will be enforced upon all open devices. * * RESET indicates that GPU or GMU hang happens. KGSL is handling * * snapshot or recover GPU from hang. MINBW implies that DDR BW vote is * * set to non-zero minimum value. */ #define KGSL_STATE_NONE 0x00000000 --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_drawobj.c:1268 [MATCH: spin_lock] --- INIT_LIST_HEAD(&cmdobj->cmdlist); INIT_LIST_HEAD(&cmdobj->memlist); cmdobj->requeue_cnt = 0; if (!(type & CMDOBJ_TYPE)) return cmdobj; atomic_inc(&context->proc_priv->cmd_count); atomic_inc(&context->proc_priv->period->active_cmds); spin_lock(&device->work_period_lock); if (!__test_and_set_bit(KGSL_WORK_PERIOD, &device->flags)) { mod_timer(&device->work_period_timer, jiffies + msecs_to_jiffies(KGSL_WORK_PERIOD_MS)); device->gpu_period.begin = ktime_get_ns(); } /* Take a refcount here and put it back in kgsl_work_period_timer() */ if (!__test_and_set_bit(KGSL_WORK_PERIOD, &context->proc_priv->period->flags)) kref_get(&context->proc_priv->period->refcount); spin_unlock(&device->work_period_lock); return cmdobj; } #ifdef CONFIG_COMPAT static int add_ibdesc_list_compat(struct kgsl_device *device, struct kgsl_drawobj_cmd *cmdobj, void __user *ptr, int count) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_drawobj.c:1279 [MATCH: spin_unlock] --- if (!__test_and_set_bit(KGSL_WORK_PERIOD, &device->flags)) { mod_timer(&device->work_period_timer, jiffies + msecs_to_jiffies(KGSL_WORK_PERIOD_MS)); device->gpu_period.begin = ktime_get_ns(); } /* Take a refcount here and put it back in kgsl_work_period_timer() */ if (!__test_and_set_bit(KGSL_WORK_PERIOD, &context->proc_priv->period->flags)) kref_get(&context->proc_priv->period->refcount); spin_unlock(&device->work_period_lock); return cmdobj; } #ifdef CONFIG_COMPAT static int add_ibdesc_list_compat(struct kgsl_device *device, struct kgsl_drawobj_cmd *cmdobj, void __user *ptr, int count) { int i, ret = 0; struct kgsl_ibdesc_compat ibdesc32; struct kgsl_ibdesc ibdesc; for (i = 0; i < count; i++) { memset(&ibdesc32, 0, sizeof(ibdesc32)); if (copy_from_user(&ibdesc32, ptr, sizeof(ibdesc32))) { ret = -EFAULT; break; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_drawobj.h:114 [MATCH: timeout] --- */ struct kgsl_context *context; }; /** * struct kgsl_drawobj_sync - KGSL sync object * @base: Base kgsl_drawobj, this needs to be the first entry * @synclist: Array of context/timestamp tuples to wait for before issuing * @numsyncs: Number of sync entries in the array * @pending: Bitmask of sync events that are active * @timer: a timer used to track possible sync timeouts for this * sync obj * @timeout_jiffies: For a sync obj the jiffies at * which the timer will expire */ struct kgsl_drawobj_sync { struct kgsl_drawobj base; struct kgsl_drawobj_sync_event *synclist; unsigned int numsyncs; unsigned long pending; struct timer_list timer; unsigned long timeout_jiffies; /** @flags: sync object internal flags */ unsigned long flags; /** @num_hw_fence: number of hw fences in this syncobj */ u32 num_hw_fence; /** * @hw_fences: Array to hold information regarding hardware fences that are in this syncobj */ --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_drawobj.h:116 [MATCH: timeout] --- }; /** * struct kgsl_drawobj_sync - KGSL sync object * @base: Base kgsl_drawobj, this needs to be the first entry * @synclist: Array of context/timestamp tuples to wait for before issuing * @numsyncs: Number of sync entries in the array * @pending: Bitmask of sync events that are active * @timer: a timer used to track possible sync timeouts for this * sync obj * @timeout_jiffies: For a sync obj the jiffies at * which the timer will expire */ struct kgsl_drawobj_sync { struct kgsl_drawobj base; struct kgsl_drawobj_sync_event *synclist; unsigned int numsyncs; unsigned long pending; struct timer_list timer; unsigned long timeout_jiffies; /** @flags: sync object internal flags */ unsigned long flags; /** @num_hw_fence: number of hw fences in this syncobj */ u32 num_hw_fence; /** * @hw_fences: Array to hold information regarding hardware fences that are in this syncobj */ struct kgsl_drawobj_sync_hw_fence *hw_fences; }; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_drawobj.h:125 [MATCH: timeout] --- * sync obj * @timeout_jiffies: For a sync obj the jiffies at * which the timer will expire */ struct kgsl_drawobj_sync { struct kgsl_drawobj base; struct kgsl_drawobj_sync_event *synclist; unsigned int numsyncs; unsigned long pending; struct timer_list timer; unsigned long timeout_jiffies; /** @flags: sync object internal flags */ unsigned long flags; /** @num_hw_fence: number of hw fences in this syncobj */ u32 num_hw_fence; /** * @hw_fences: Array to hold information regarding hardware fences that are in this syncobj */ struct kgsl_drawobj_sync_hw_fence *hw_fences; }; #define KGSL_BINDOBJ_STATE_START 0 #define KGSL_BINDOBJ_STATE_DONE 1 /** * struct kgsl_drawobj_bind - KGSL virtual buffer object bind operation * @base: &struct kgsl_drawobj container * @state: Current state of the draw operation * @bind: Pointer to the VBO bind operation struct --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_eventlog.c:37 [MATCH: timeout] --- */ #define LOG_SKIP 1 #define LOG_FIRE_EVENT 2 #define LOG_CMDBATCH_SUBMITTED_EVENT 3 #define LOG_CMDBATCH_RETIRED_EVENT 4 #define LOG_SYNCPOINT_FENCE_EVENT 5 #define LOG_SYNCPOINT_FENCE_EXPIRE_EVENT 6 #define LOG_TIMELINE_FENCE_ALLOC_EVENT 7 #define LOG_TIMELINE_FENCE_RELEASE_EVENT 8 #define LOG_CX_WAIT_TIMEOUT_EVENT 9 static spinlock_t lock; static void *kgsl_eventlog; static int eventlog_wptr; struct kgsl_log_header { /** @magic: Magic value to identify header */ u32 magic; /** @pid: : PID of the process */ int pid; /** @time: System time in nanoseconds */ u64 time; /** @event: bits[0:15] specify the event ID. bits[16:31] specify event version */ u32 event; /** @size: Size of the event data in bytes */ u32 size; } __packed; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_eventlog.c:245 [MATCH: timeout] --- } *entry; entry = kgsl_eventlog_alloc(LOG_TIMELINE_FENCE_RELEASE_EVENT, sizeof(*entry)); if (!entry) return; entry->id = id; entry->seqno = seqno; } void log_kgsl_cx_wait_timeout_event(u32 timeout_vote) { struct __packed { u32 timeout_vote; } *entry; entry = kgsl_eventlog_alloc(LOG_CX_WAIT_TIMEOUT_EVENT, sizeof(*entry)); if (!entry) return; entry->timeout_vote = timeout_vote; } size_t kgsl_snapshot_eventlog_buffer(struct kgsl_device *device, u8 *buf, size_t remain, void *priv) { struct kgsl_snapshot_eventlog *hdr = (struct kgsl_snapshot_eventlog *)buf; u32 *data = (u32 *)(buf + sizeof(*hdr)); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_eventlog.c:248 [MATCH: timeout] --- if (!entry) return; entry->id = id; entry->seqno = seqno; } void log_kgsl_cx_wait_timeout_event(u32 timeout_vote) { struct __packed { u32 timeout_vote; } *entry; entry = kgsl_eventlog_alloc(LOG_CX_WAIT_TIMEOUT_EVENT, sizeof(*entry)); if (!entry) return; entry->timeout_vote = timeout_vote; } size_t kgsl_snapshot_eventlog_buffer(struct kgsl_device *device, u8 *buf, size_t remain, void *priv) { struct kgsl_snapshot_eventlog *hdr = (struct kgsl_snapshot_eventlog *)buf; u32 *data = (u32 *)(buf + sizeof(*hdr)); if (!kgsl_eventlog) return 0; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_eventlog.c:251 [MATCH: timeout] --- entry->id = id; entry->seqno = seqno; } void log_kgsl_cx_wait_timeout_event(u32 timeout_vote) { struct __packed { u32 timeout_vote; } *entry; entry = kgsl_eventlog_alloc(LOG_CX_WAIT_TIMEOUT_EVENT, sizeof(*entry)); if (!entry) return; entry->timeout_vote = timeout_vote; } size_t kgsl_snapshot_eventlog_buffer(struct kgsl_device *device, u8 *buf, size_t remain, void *priv) { struct kgsl_snapshot_eventlog *hdr = (struct kgsl_snapshot_eventlog *)buf; u32 *data = (u32 *)(buf + sizeof(*hdr)); if (!kgsl_eventlog) return 0; if (remain < EVENTLOG_SIZE + sizeof(*hdr)) { dev_err(device->dev, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_eventlog.c:255 [MATCH: timeout] --- void log_kgsl_cx_wait_timeout_event(u32 timeout_vote) { struct __packed { u32 timeout_vote; } *entry; entry = kgsl_eventlog_alloc(LOG_CX_WAIT_TIMEOUT_EVENT, sizeof(*entry)); if (!entry) return; entry->timeout_vote = timeout_vote; } size_t kgsl_snapshot_eventlog_buffer(struct kgsl_device *device, u8 *buf, size_t remain, void *priv) { struct kgsl_snapshot_eventlog *hdr = (struct kgsl_snapshot_eventlog *)buf; u32 *data = (u32 *)(buf + sizeof(*hdr)); if (!kgsl_eventlog) return 0; if (remain < EVENTLOG_SIZE + sizeof(*hdr)) { dev_err(device->dev, "snapshot: Not enough memory for eventlog\n"); return 0; } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_eventlog.c:78 [MATCH: spin_lock] --- static void *kgsl_eventlog_alloc(u16 eventid, u32 size) { struct kgsl_log_header *header; u32 datasize = size + sizeof(*header); unsigned long flags; void *data; if (!kgsl_eventlog) return NULL; spin_lock_irqsave(&lock, flags); if (eventlog_wptr + datasize > (EVENTLOG_SIZE - sizeof(*header))) { add_skip_header(eventlog_wptr); eventlog_wptr = datasize; data = kgsl_eventlog; } else { data = kgsl_eventlog + eventlog_wptr; eventlog_wptr += datasize; } spin_unlock_irqrestore(&lock, flags); header = data; header->magic = MAGIC; header->time = local_clock(); header->pid = current->pid; header->event = FIELD_PREP(GENMASK(15, 0), eventid); header->size = size; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_eventlog.c:105 [MATCH: spin_lock] --- header->size = size; return data + sizeof(*header); } void kgsl_eventlog_init(void) { kgsl_eventlog = kzalloc(EVENTLOG_SIZE, GFP_KERNEL); eventlog_wptr = 0; spin_lock_init(&lock); kgsl_add_to_minidump("KGSL_EVENTLOG", (u64) kgsl_eventlog, __pa(kgsl_eventlog), EVENTLOG_SIZE); } void kgsl_eventlog_exit(void) { kgsl_remove_from_minidump("KGSL_EVENTLOG", (u64) kgsl_eventlog, __pa(kgsl_eventlog), EVENTLOG_SIZE); kfree(kgsl_eventlog); kgsl_eventlog = NULL; eventlog_wptr = 0; } void log_kgsl_fire_event(u32 id, u32 ts, u32 type, u32 age) { struct __packed { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_eventlog.c:87 [MATCH: spin_unlock] --- spin_lock_irqsave(&lock, flags); if (eventlog_wptr + datasize > (EVENTLOG_SIZE - sizeof(*header))) { add_skip_header(eventlog_wptr); eventlog_wptr = datasize; data = kgsl_eventlog; } else { data = kgsl_eventlog + eventlog_wptr; eventlog_wptr += datasize; } spin_unlock_irqrestore(&lock, flags); header = data; header->magic = MAGIC; header->time = local_clock(); header->pid = current->pid; header->event = FIELD_PREP(GENMASK(15, 0), eventid); header->size = size; return data + sizeof(*header); } void kgsl_eventlog_init(void) { kgsl_eventlog = kzalloc(EVENTLOG_SIZE, GFP_KERNEL); eventlog_wptr = 0; spin_lock_init(&lock); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_eventlog.h:10 [MATCH: timeout] --- /* SPDX-License-Identifier: GPL-2.0-only */ /* * Copyright (c) 2021, The Linux Foundation. All rights reserved. * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. */ #ifndef _KGSL_EVENTLOG_H #define _KGSL_EVENTLOG_H #define HLOS_CX_WAIT_TIMEOUT 0 #define NONHLOS_CX_WAIT_TIMEOUT 1 void kgsl_eventlog_init(void); void kgsl_eventlog_exit(void); void log_kgsl_fire_event(u32 id, u32 ts, u32 type, u32 age); void log_kgsl_cmdbatch_submitted_event(u32 id, u32 ts, u32 prio, u64 flags); void log_kgsl_cmdbatch_retired_event(u32 id, u32 ts, u32 prio, u64 flags, u64 start, u64 retire); void log_kgsl_syncpoint_fence_event(u32 id, char *fence_name); void log_kgsl_syncpoint_fence_expire_event(u32 id, char *fence_name); void log_kgsl_timeline_fence_alloc_event(u32 id, u64 seqno); void log_kgsl_timeline_fence_release_event(u32 id, u64 seqno); void log_kgsl_cx_wait_timeout_event(u32 timeout_vote); size_t kgsl_snapshot_eventlog_buffer(struct kgsl_device *device, u8 *buf, size_t remain, void *priv); #endif --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_eventlog.h:11 [MATCH: timeout] --- /* SPDX-License-Identifier: GPL-2.0-only */ /* * Copyright (c) 2021, The Linux Foundation. All rights reserved. * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. */ #ifndef _KGSL_EVENTLOG_H #define _KGSL_EVENTLOG_H #define HLOS_CX_WAIT_TIMEOUT 0 #define NONHLOS_CX_WAIT_TIMEOUT 1 void kgsl_eventlog_init(void); void kgsl_eventlog_exit(void); void log_kgsl_fire_event(u32 id, u32 ts, u32 type, u32 age); void log_kgsl_cmdbatch_submitted_event(u32 id, u32 ts, u32 prio, u64 flags); void log_kgsl_cmdbatch_retired_event(u32 id, u32 ts, u32 prio, u64 flags, u64 start, u64 retire); void log_kgsl_syncpoint_fence_event(u32 id, char *fence_name); void log_kgsl_syncpoint_fence_expire_event(u32 id, char *fence_name); void log_kgsl_timeline_fence_alloc_event(u32 id, u64 seqno); void log_kgsl_timeline_fence_release_event(u32 id, u64 seqno); void log_kgsl_cx_wait_timeout_event(u32 timeout_vote); size_t kgsl_snapshot_eventlog_buffer(struct kgsl_device *device, u8 *buf, size_t remain, void *priv); #endif --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_eventlog.h:24 [MATCH: timeout] --- void kgsl_eventlog_exit(void); void log_kgsl_fire_event(u32 id, u32 ts, u32 type, u32 age); void log_kgsl_cmdbatch_submitted_event(u32 id, u32 ts, u32 prio, u64 flags); void log_kgsl_cmdbatch_retired_event(u32 id, u32 ts, u32 prio, u64 flags, u64 start, u64 retire); void log_kgsl_syncpoint_fence_event(u32 id, char *fence_name); void log_kgsl_syncpoint_fence_expire_event(u32 id, char *fence_name); void log_kgsl_timeline_fence_alloc_event(u32 id, u64 seqno); void log_kgsl_timeline_fence_release_event(u32 id, u64 seqno); void log_kgsl_cx_wait_timeout_event(u32 timeout_vote); size_t kgsl_snapshot_eventlog_buffer(struct kgsl_device *device, u8 *buf, size_t remain, void *priv); #endif --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_events.c:89 [MATCH: spin_lock] --- context = group->context; /* * Sanity check to be sure that we aren't racing with the context * getting destroyed */ if (WARN_ON(context != NULL && !_kgsl_context_get(context))) return; spin_lock(&group->lock); group->readtimestamp(device, group->priv, KGSL_TIMESTAMP_RETIRED, ×tamp); if (!flush && !_do_process_group(group->processed, timestamp)) goto out; list_for_each_entry_safe(event, tmp, &group->events, node) { if (timestamp_cmp(event->timestamp, timestamp) <= 0) signal_event(device, event, KGSL_EVENT_RETIRED); else if (flush) signal_event(device, event, KGSL_EVENT_CANCELLED); } group->processed = timestamp; out: --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_events.c:147 [MATCH: spin_lock] --- * kgsl_cancel_events_timestamp() - Cancel pending events for a given timestamp * @device: Pointer to a KGSL device * @group: Ponter to the GPU event group that owns the event * @timestamp: Registered expiry timestamp for the event */ void kgsl_cancel_events_timestamp(struct kgsl_device *device, struct kgsl_event_group *group, unsigned int timestamp) { struct kgsl_event *event, *tmp; spin_lock(&group->lock); list_for_each_entry_safe(event, tmp, &group->events, node) { if (timestamp_cmp(timestamp, event->timestamp) == 0) signal_event(device, event, KGSL_EVENT_CANCELLED); } spin_unlock(&group->lock); } /** * kgsl_cancel_events() - Cancel all pending events in the group * @device: Pointer to a KGSL device * @group: Pointer to a kgsl_events_group */ void kgsl_cancel_events(struct kgsl_device *device, struct kgsl_event_group *group) { struct kgsl_event *event, *tmp; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_events.c:167 [MATCH: spin_lock] --- /** * kgsl_cancel_events() - Cancel all pending events in the group * @device: Pointer to a KGSL device * @group: Pointer to a kgsl_events_group */ void kgsl_cancel_events(struct kgsl_device *device, struct kgsl_event_group *group) { struct kgsl_event *event, *tmp; spin_lock(&group->lock); list_for_each_entry_safe(event, tmp, &group->events, node) signal_event(device, event, KGSL_EVENT_CANCELLED); spin_unlock(&group->lock); } /** * kgsl_cancel_event() - Cancel a specific event from a group * @device: Pointer to a KGSL device * @group: Pointer to the group that contains the events * @timestamp: Registered expiry timestamp for the event * @func: Registered callback for the function * @priv: Registered priv data for the function */ void kgsl_cancel_event(struct kgsl_device *device, struct kgsl_event_group *group, unsigned int timestamp, kgsl_event_func func, void *priv) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_events.c:189 [MATCH: spin_lock] --- * @timestamp: Registered expiry timestamp for the event * @func: Registered callback for the function * @priv: Registered priv data for the function */ void kgsl_cancel_event(struct kgsl_device *device, struct kgsl_event_group *group, unsigned int timestamp, kgsl_event_func func, void *priv) { struct kgsl_event *event, *tmp; spin_lock(&group->lock); list_for_each_entry_safe(event, tmp, &group->events, node) { if (timestamp == event->timestamp && func == event->func && event->priv == priv) { signal_event(device, event, KGSL_EVENT_CANCELLED); break; } } spin_unlock(&group->lock); } /** * kgsl_event_pending() - Searches for an event in an event group * @device: Pointer to a KGSL device * @group: Pointer to the group that contains the events * @timestamp: Registered expiry timestamp for the event * @func: Registered callback for the function --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_events.c:217 [MATCH: spin_lock] --- * @func: Registered callback for the function * @priv: Registered priv data for the function */ bool kgsl_event_pending(struct kgsl_device *device, struct kgsl_event_group *group, unsigned int timestamp, kgsl_event_func func, void *priv) { struct kgsl_event *event; bool result = false; spin_lock(&group->lock); list_for_each_entry(event, &group->events, node) { if (timestamp == event->timestamp && func == event->func && event->priv == priv) { result = true; break; } } spin_unlock(&group->lock); return result; } /** * kgsl_add_event() - Add a new GPU event to a group * @device: Pointer to a KGSL device * @group: Pointer to the group to add the event to * @timestamp: Timestamp that the event will expire on * @func: Callback function for the event * @priv: Private data to send to the callback function */ --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_events.c:282 [MATCH: spin_lock] --- event->timestamp = timestamp; event->priv = priv; event->func = func; event->created = jiffies; event->group = group; kthread_init_work(&event->work, _kgsl_event_worker); trace_kgsl_register_event(KGSL_CONTEXT_ID(context), timestamp, func); spin_lock(&group->lock); /* * Check to see if the requested timestamp has already retired. If so, * schedule the callback right away */ group->readtimestamp(device, group->priv, KGSL_TIMESTAMP_RETIRED, &retired); if (timestamp_cmp(retired, timestamp) >= 0) { event->result = KGSL_EVENT_RETIRED; kthread_queue_work(device->events_worker, &event->work); spin_unlock(&group->lock); return 0; } /* Add the event to the group list */ list_add_tail(&event->node, &group->events); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_events.c:340 [MATCH: spin_lock] --- void kgsl_add_event_group(struct kgsl_device *device, struct kgsl_event_group *group, struct kgsl_context *context, readtimestamp_func readtimestamp, void *priv, const char *fmt, ...) { va_list args; WARN_ON(readtimestamp == NULL); spin_lock_init(&group->lock); INIT_LIST_HEAD(&group->events); group->context = context; group->readtimestamp = readtimestamp; group->priv = priv; if (fmt) { va_start(args, fmt); vsnprintf(group->name, sizeof(group->name), fmt, args); va_end(args); } write_lock(&device->event_groups_lock); list_add_tail(&group->group, &device->event_groups); write_unlock(&device->event_groups_lock); } static void events_debugfs_print_group(struct seq_file *s, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_events.c:364 [MATCH: spin_lock] --- list_add_tail(&group->group, &device->event_groups); write_unlock(&device->event_groups_lock); } static void events_debugfs_print_group(struct seq_file *s, struct kgsl_event_group *group) { struct kgsl_event *event; unsigned int retired; spin_lock(&group->lock); seq_printf(s, "%s: last=%d\n", group->name, group->processed); list_for_each_entry(event, &group->events, node) { group->readtimestamp(event->device, group->priv, KGSL_TIMESTAMP_RETIRED, &retired); seq_printf(s, "\t%u:%u age=%lu func=%ps [retired=%u]\n", group->context ? group->context->id : KGSL_MEMSTORE_GLOBAL, event->timestamp, jiffies - event->created, event->func, retired); } spin_unlock(&group->lock); } static int events_show(struct seq_file *s, void *unused) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_events.c:108 [MATCH: spin_unlock] --- if (timestamp_cmp(event->timestamp, timestamp) <= 0) signal_event(device, event, KGSL_EVENT_RETIRED); else if (flush) signal_event(device, event, KGSL_EVENT_CANCELLED); } group->processed = timestamp; out: spin_unlock(&group->lock); kgsl_context_put(context); } /** * kgsl_process_event_group() - Handle all the retired events in a group * @device: Pointer to a KGSL device * @group: Pointer to a GPU events group to process */ void kgsl_process_event_group(struct kgsl_device *device, struct kgsl_event_group *group) { _process_event_group(device, group, false); } /** * kgsl_flush_event_group() - flush all the events in a group by retiring the * ones can be retired and cancelling the ones that are pending --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_events.c:154 [MATCH: spin_unlock] --- { struct kgsl_event *event, *tmp; spin_lock(&group->lock); list_for_each_entry_safe(event, tmp, &group->events, node) { if (timestamp_cmp(timestamp, event->timestamp) == 0) signal_event(device, event, KGSL_EVENT_CANCELLED); } spin_unlock(&group->lock); } /** * kgsl_cancel_events() - Cancel all pending events in the group * @device: Pointer to a KGSL device * @group: Pointer to a kgsl_events_group */ void kgsl_cancel_events(struct kgsl_device *device, struct kgsl_event_group *group) { struct kgsl_event *event, *tmp; spin_lock(&group->lock); list_for_each_entry_safe(event, tmp, &group->events, node) signal_event(device, event, KGSL_EVENT_CANCELLED); spin_unlock(&group->lock); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_events.c:172 [MATCH: spin_unlock] --- void kgsl_cancel_events(struct kgsl_device *device, struct kgsl_event_group *group) { struct kgsl_event *event, *tmp; spin_lock(&group->lock); list_for_each_entry_safe(event, tmp, &group->events, node) signal_event(device, event, KGSL_EVENT_CANCELLED); spin_unlock(&group->lock); } /** * kgsl_cancel_event() - Cancel a specific event from a group * @device: Pointer to a KGSL device * @group: Pointer to the group that contains the events * @timestamp: Registered expiry timestamp for the event * @func: Registered callback for the function * @priv: Registered priv data for the function */ void kgsl_cancel_event(struct kgsl_device *device, struct kgsl_event_group *group, unsigned int timestamp, kgsl_event_func func, void *priv) { struct kgsl_event *event, *tmp; spin_lock(&group->lock); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_events.c:199 [MATCH: spin_unlock] --- spin_lock(&group->lock); list_for_each_entry_safe(event, tmp, &group->events, node) { if (timestamp == event->timestamp && func == event->func && event->priv == priv) { signal_event(device, event, KGSL_EVENT_CANCELLED); break; } } spin_unlock(&group->lock); } /** * kgsl_event_pending() - Searches for an event in an event group * @device: Pointer to a KGSL device * @group: Pointer to the group that contains the events * @timestamp: Registered expiry timestamp for the event * @func: Registered callback for the function * @priv: Registered priv data for the function */ bool kgsl_event_pending(struct kgsl_device *device, struct kgsl_event_group *group, unsigned int timestamp, kgsl_event_func func, void *priv) { struct kgsl_event *event; bool result = false; spin_lock(&group->lock); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_events.c:225 [MATCH: spin_unlock] --- bool result = false; spin_lock(&group->lock); list_for_each_entry(event, &group->events, node) { if (timestamp == event->timestamp && func == event->func && event->priv == priv) { result = true; break; } } spin_unlock(&group->lock); return result; } /** * kgsl_add_event() - Add a new GPU event to a group * @device: Pointer to a KGSL device * @group: Pointer to the group to add the event to * @timestamp: Timestamp that the event will expire on * @func: Callback function for the event * @priv: Private data to send to the callback function */ int kgsl_add_event(struct kgsl_device *device, struct kgsl_event_group *group, unsigned int timestamp, kgsl_event_func func, void *priv) { unsigned int queued; struct kgsl_context *context = group->context; struct kgsl_event *event; unsigned int retired; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_events.c:294 [MATCH: spin_unlock] --- /* * Check to see if the requested timestamp has already retired. If so, * schedule the callback right away */ group->readtimestamp(device, group->priv, KGSL_TIMESTAMP_RETIRED, &retired); if (timestamp_cmp(retired, timestamp) >= 0) { event->result = KGSL_EVENT_RETIRED; kthread_queue_work(device->events_worker, &event->work); spin_unlock(&group->lock); return 0; } /* Add the event to the group list */ list_add_tail(&event->node, &group->events); spin_unlock(&group->lock); return 0; } void kgsl_process_event_groups(struct kgsl_device *device) { struct kgsl_event_group *group; read_lock(&device->event_groups_lock); list_for_each_entry(group, &device->event_groups, group) _process_event_group(device, group, false); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_events.c:301 [MATCH: spin_unlock] --- if (timestamp_cmp(retired, timestamp) >= 0) { event->result = KGSL_EVENT_RETIRED; kthread_queue_work(device->events_worker, &event->work); spin_unlock(&group->lock); return 0; } /* Add the event to the group list */ list_add_tail(&event->node, &group->events); spin_unlock(&group->lock); return 0; } void kgsl_process_event_groups(struct kgsl_device *device) { struct kgsl_event_group *group; read_lock(&device->event_groups_lock); list_for_each_entry(group, &device->event_groups, group) _process_event_group(device, group, false); read_unlock(&device->event_groups_lock); } void kgsl_del_event_group(struct kgsl_device *device, struct kgsl_event_group *group) { /* Check if the group is uninintalized */ --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_events.c:379 [MATCH: spin_unlock] --- group->readtimestamp(event->device, group->priv, KGSL_TIMESTAMP_RETIRED, &retired); seq_printf(s, "\t%u:%u age=%lu func=%ps [retired=%u]\n", group->context ? group->context->id : KGSL_MEMSTORE_GLOBAL, event->timestamp, jiffies - event->created, event->func, retired); } spin_unlock(&group->lock); } static int events_show(struct seq_file *s, void *unused) { struct kgsl_device *device = s->private; struct kgsl_event_group *group; seq_puts(s, "event groups:\n"); seq_puts(s, "--------------\n"); read_lock(&device->event_groups_lock); list_for_each_entry(group, &device->event_groups, group) { events_debugfs_print_group(s, group); seq_puts(s, "\n"); } read_unlock(&device->event_groups_lock); return 0; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_gmu_core.c:200 [MATCH: timeout] --- /* Send NMI first to halt GMU and capture the state close to the point of failure */ if (ops && ops->send_nmi) ops->send_nmi(device, false, gf_policy); kgsl_device_snapshot(device, NULL, NULL, true); } int gmu_core_timed_poll_check(struct kgsl_device *device, unsigned int offset, unsigned int expected_ret, unsigned int timeout_ms, unsigned int mask) { u32 val; return kgsl_regmap_read_poll_timeout(&device->regmap, offset, val, (val & mask) == expected_ret, 100, timeout_ms * 1000); } int gmu_core_map_memdesc(struct iommu_domain *domain, struct kgsl_memdesc *memdesc, u64 gmuaddr, int attrs) { ssize_t mapped; if (!memdesc->pages) { mapped = kgsl_mmu_map_sg(domain, gmuaddr, memdesc->sgt->sgl, memdesc->sgt->nents, attrs); } else { struct sg_table sgt = { 0 }; int ret; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_gmu_core.c:204 [MATCH: timeout] --- kgsl_device_snapshot(device, NULL, NULL, true); } int gmu_core_timed_poll_check(struct kgsl_device *device, unsigned int offset, unsigned int expected_ret, unsigned int timeout_ms, unsigned int mask) { u32 val; return kgsl_regmap_read_poll_timeout(&device->regmap, offset, val, (val & mask) == expected_ret, 100, timeout_ms * 1000); } int gmu_core_map_memdesc(struct iommu_domain *domain, struct kgsl_memdesc *memdesc, u64 gmuaddr, int attrs) { ssize_t mapped; if (!memdesc->pages) { mapped = kgsl_mmu_map_sg(domain, gmuaddr, memdesc->sgt->sgl, memdesc->sgt->nents, attrs); } else { struct sg_table sgt = { 0 }; int ret; ret = sg_alloc_table_from_pages(&sgt, memdesc->pages, memdesc->page_count, 0, memdesc->size, GFP_KERNEL); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_gmu_core.c:205 [MATCH: timeout] --- kgsl_device_snapshot(device, NULL, NULL, true); } int gmu_core_timed_poll_check(struct kgsl_device *device, unsigned int offset, unsigned int expected_ret, unsigned int timeout_ms, unsigned int mask) { u32 val; return kgsl_regmap_read_poll_timeout(&device->regmap, offset, val, (val & mask) == expected_ret, 100, timeout_ms * 1000); } int gmu_core_map_memdesc(struct iommu_domain *domain, struct kgsl_memdesc *memdesc, u64 gmuaddr, int attrs) { ssize_t mapped; if (!memdesc->pages) { mapped = kgsl_mmu_map_sg(domain, gmuaddr, memdesc->sgt->sgl, memdesc->sgt->nents, attrs); } else { struct sg_table sgt = { 0 }; int ret; ret = sg_alloc_table_from_pages(&sgt, memdesc->pages, memdesc->page_count, 0, memdesc->size, GFP_KERNEL); if (ret) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_gmu_core.c:1032 [MATCH: timeout] --- bool gmu_core_is_trace_empty(struct gmu_trace_header *hdr) { return (readl(&hdr->read_index) == readl(&hdr->write_index)) ? true : false; } void gmu_core_trace_header_init(struct kgsl_gmu_trace *trace) { struct gmu_trace_header *hdr = trace->md->hostptr; hdr->threshold = TRACE_BUFFER_THRESHOLD; hdr->timeout = TRACE_TIMEOUT_MSEC; hdr->metadata = FIELD_PREP(GENMASK(31, 30), TRACE_MODE_DROP) | FIELD_PREP(GENMASK(3, 0), TRACE_HEADER_VERSION_1); hdr->cookie = trace->md->gmuaddr; hdr->size = trace->md->size; hdr->log_type = TRACE_LOGTYPE_HWSCHED; } void gmu_core_reset_trace_header(struct kgsl_gmu_trace *trace) { if (!trace->reset_hdr || IS_ERR_OR_NULL(trace->md)) return; memset(trace->md->hostptr, 0, sizeof(struct gmu_trace_header)); /* Reset sequence number to detect trace packet loss */ trace->seq_num = 0; gmu_core_trace_header_init(trace); trace->reset_hdr = false; } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_gmu_core.c:1002 [MATCH: seqnum] --- writel(trace_hdr->write_index, &trace_hdr->read_index); trace->reset_hdr = true; return; } size = TRACE_PKT_GET_SIZE(pkt->hdr); if (TRACE_PKT_GET_SKIP_FIELD(pkt->hdr)) goto done; seq_num = TRACE_PKT_GET_SEQNUM(pkt->hdr); num_pkts = seq_num - trace->seq_num; /* Detect trace packet loss by tracking any gaps in the sequence number */ if (num_pkts > 1) { char str[128]; snprintf(str, sizeof(str), "%d GMU trace packets dropped from sequence number: %d\n", num_pkts - 1, trace->seq_num); trace_kgsl_msg(str); } trace->seq_num = seq_num; stream_trace_data(device, pkt); done: ridx = (ridx + size) % trace_hdr->payload_size; writel(ridx, &trace_hdr->read_index); } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_gmu_core.c:391 [MATCH: spin_lock] --- static int _map_gmu_dynamic(struct kgsl_device *device, struct kgsl_memdesc *md, u32 addr, u32 vma_id, int attrs, u32 align) { struct gmu_core_device *gmu = &device->gmu_core; struct device *gmu_pdev_dev = GMU_PDEV_DEV(device); struct gmu_vma_entry *vma = &gmu->vma[vma_id]; struct gmu_vma_node *vma_node = NULL; int ret; u32 size = ALIGN(md->size, hfi_get_gmu_sz_alignment(align)); spin_lock(&vma->lock); if (!addr) { /* * We will end up with a hole (GMU VA range not backed by physical mapping) if * the aligned size is greater than the size of the physical mapping */ addr = find_unmapped_va(vma, size, hfi_get_gmu_va_alignment(align)); if (addr == 0) { spin_unlock(&vma->lock); dev_err(gmu_pdev_dev, "Insufficient VA space size: %x\n", size); return -ENOMEM; } } ret = insert_va(vma, addr, size); spin_unlock(&vma->lock); if (ret < 0) { dev_err(gmu_pdev_dev, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_gmu_core.c:425 [MATCH: spin_lock] --- if (!ret) { md->gmuaddr = addr; return 0; } /* Failed to map to GMU */ dev_err(gmu_pdev_dev, "Unable to map GMU kernel block: addr:0x%08x size:0x%llx :%d\n", addr, md->size, ret); spin_lock(&vma->lock); vma_node = find_va(vma, md->gmuaddr, size); if (vma_node) rb_erase(&vma_node->node, &vma->vma_root); spin_unlock(&vma->lock); kfree(vma_node); return ret; } static int _map_gmu_static(struct kgsl_device *device, struct kgsl_memdesc *md, u32 addr, u32 vma_id, int attrs, u32 align) { struct gmu_core_device *gmu = &device->gmu_core; struct gmu_vma_entry *vma = &gmu->vma[vma_id]; int ret; u32 size = ALIGN(md->size, hfi_get_gmu_sz_alignment(align)); if (!addr) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_gmu_core.c:470 [MATCH: spin_lock] --- } int gmu_core_reserve_gmuaddr(struct kgsl_device *device, struct kgsl_memdesc *md, u32 vma_id, u32 align) { struct gmu_core_device *gmu = &device->gmu_core; struct gmu_vma_entry *vma = &gmu->vma[vma_id]; u32 addr, size = ALIGN(md->size, hfi_get_gmu_sz_alignment(align)); if (vma_is_dynamic(device, vma_id)) { spin_lock(&vma->lock); addr = find_unmapped_va(vma, size, hfi_get_gmu_va_alignment(align)); spin_unlock(&vma->lock); if (addr == 0) goto error; } else { addr = ALIGN(vma->next_va, hfi_get_gmu_va_alignment(align)); if ((addr + size) >= (vma->start + vma->size)) goto error; vma->next_va = addr + size; } md->gmuaddr = addr; return 0; error: dev_err_ratelimited(GMU_PDEV_DEV(device), "Insufficient VA space size: %x in vma:%u\n", size, vma_id); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_gmu_core.c:643 [MATCH: spin_lock] --- vma = &gmu->vma[vma_id]; /* * Do not remove the vma node if we failed to unmap the entire buffer. This is because the * iommu driver considers remapping an already mapped iova as fatal. */ if (md->size != iommu_unmap(device->gmu_core.domain, md->gmuaddr, md->size)) goto free; spin_lock(&vma->lock); vma_node = find_va(vma, md->gmuaddr, md->size); if (vma_node) rb_erase(&vma_node->node, &vma->vma_root); spin_unlock(&vma->lock); kfree(vma_node); free: kgsl_sharedmem_free(md); } int gmu_core_process_prealloc(struct kgsl_device *device, struct gmu_block_header *blk) { struct kgsl_memdesc *md; int id = gmu_core_find_vma_block(device, blk->addr, blk->value); if (id < 0) { dev_err(GMU_PDEV_DEV(device), "Invalid prealloc block addr: 0x%x value:%d\n", blk->addr, blk->value); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_gmu_core.c:867 [MATCH: spin_lock] --- trace_kgsl_pwrstats(device, data->total_time, &stats, device->active_context_count, pkt->ticks); pwr->clock_times[pwr->active_pwrlevel] += data->gpu_time; pwr->time_in_pwrlevel[pwr->active_pwrlevel] += data->total_time; if (pwr->thermal_pwrlevel) pwr->thermal_time += data->gpu_time; pwr->aggr_max_pwrlevel = data->aggr_max_pwrlevel; spin_lock(&pwr->stats_lock); pwr->accum_busy_stats += data->gpu_time; pwr->accum_total_time += data->total_time; spin_unlock(&pwr->stats_lock); } static void stream_trace_data(struct kgsl_device *device, struct gmu_trace_packet *pkt) { switch (pkt->trace_id) { case GMU_TRACE_PREEMPT_TRIGGER: { struct trace_preempt_trigger *data = (struct trace_preempt_trigger *)pkt->payload; trace_adreno_preempt_trigger(data->cur_rb, data->next_rb, data->ctx_switch_cntl, pkt->ticks); break; } case GMU_TRACE_PREEMPT_DONE: { struct trace_preempt_done *data = --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_gmu_core.c:399 [MATCH: spin_unlock] --- u32 size = ALIGN(md->size, hfi_get_gmu_sz_alignment(align)); spin_lock(&vma->lock); if (!addr) { /* * We will end up with a hole (GMU VA range not backed by physical mapping) if * the aligned size is greater than the size of the physical mapping */ addr = find_unmapped_va(vma, size, hfi_get_gmu_va_alignment(align)); if (addr == 0) { spin_unlock(&vma->lock); dev_err(gmu_pdev_dev, "Insufficient VA space size: %x\n", size); return -ENOMEM; } } ret = insert_va(vma, addr, size); spin_unlock(&vma->lock); if (ret < 0) { dev_err(gmu_pdev_dev, "Could not insert va: %x size %x\n", addr, size); return ret; } ret = gmu_core_map_memdesc(gmu->domain, md, addr, attrs); if (!ret) { md->gmuaddr = addr; return 0; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_gmu_core.c:407 [MATCH: spin_unlock] --- addr = find_unmapped_va(vma, size, hfi_get_gmu_va_alignment(align)); if (addr == 0) { spin_unlock(&vma->lock); dev_err(gmu_pdev_dev, "Insufficient VA space size: %x\n", size); return -ENOMEM; } } ret = insert_va(vma, addr, size); spin_unlock(&vma->lock); if (ret < 0) { dev_err(gmu_pdev_dev, "Could not insert va: %x size %x\n", addr, size); return ret; } ret = gmu_core_map_memdesc(gmu->domain, md, addr, attrs); if (!ret) { md->gmuaddr = addr; return 0; } /* Failed to map to GMU */ dev_err(gmu_pdev_dev, "Unable to map GMU kernel block: addr:0x%08x size:0x%llx :%d\n", addr, md->size, ret); spin_lock(&vma->lock); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_gmu_core.c:429 [MATCH: spin_unlock] --- /* Failed to map to GMU */ dev_err(gmu_pdev_dev, "Unable to map GMU kernel block: addr:0x%08x size:0x%llx :%d\n", addr, md->size, ret); spin_lock(&vma->lock); vma_node = find_va(vma, md->gmuaddr, size); if (vma_node) rb_erase(&vma_node->node, &vma->vma_root); spin_unlock(&vma->lock); kfree(vma_node); return ret; } static int _map_gmu_static(struct kgsl_device *device, struct kgsl_memdesc *md, u32 addr, u32 vma_id, int attrs, u32 align) { struct gmu_core_device *gmu = &device->gmu_core; struct gmu_vma_entry *vma = &gmu->vma[vma_id]; int ret; u32 size = ALIGN(md->size, hfi_get_gmu_sz_alignment(align)); if (!addr) addr = ALIGN(vma->next_va, hfi_get_gmu_va_alignment(align)); ret = gmu_core_map_memdesc(device->gmu_core.domain, md, addr, attrs); if (ret) { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_gmu_core.c:472 [MATCH: spin_unlock] --- int gmu_core_reserve_gmuaddr(struct kgsl_device *device, struct kgsl_memdesc *md, u32 vma_id, u32 align) { struct gmu_core_device *gmu = &device->gmu_core; struct gmu_vma_entry *vma = &gmu->vma[vma_id]; u32 addr, size = ALIGN(md->size, hfi_get_gmu_sz_alignment(align)); if (vma_is_dynamic(device, vma_id)) { spin_lock(&vma->lock); addr = find_unmapped_va(vma, size, hfi_get_gmu_va_alignment(align)); spin_unlock(&vma->lock); if (addr == 0) goto error; } else { addr = ALIGN(vma->next_va, hfi_get_gmu_va_alignment(align)); if ((addr + size) >= (vma->start + vma->size)) goto error; vma->next_va = addr + size; } md->gmuaddr = addr; return 0; error: dev_err_ratelimited(GMU_PDEV_DEV(device), "Insufficient VA space size: %x in vma:%u\n", size, vma_id); return -ENOMEM; } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_gmu_core.c:647 [MATCH: spin_unlock] --- * Do not remove the vma node if we failed to unmap the entire buffer. This is because the * iommu driver considers remapping an already mapped iova as fatal. */ if (md->size != iommu_unmap(device->gmu_core.domain, md->gmuaddr, md->size)) goto free; spin_lock(&vma->lock); vma_node = find_va(vma, md->gmuaddr, md->size); if (vma_node) rb_erase(&vma_node->node, &vma->vma_root); spin_unlock(&vma->lock); kfree(vma_node); free: kgsl_sharedmem_free(md); } int gmu_core_process_prealloc(struct kgsl_device *device, struct gmu_block_header *blk) { struct kgsl_memdesc *md; int id = gmu_core_find_vma_block(device, blk->addr, blk->value); if (id < 0) { dev_err(GMU_PDEV_DEV(device), "Invalid prealloc block addr: 0x%x value:%d\n", blk->addr, blk->value); return id; } /* Nothing to do for TCM blocks or user uncached */ --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_gmu_core.c:870 [MATCH: spin_unlock] --- pwr->clock_times[pwr->active_pwrlevel] += data->gpu_time; pwr->time_in_pwrlevel[pwr->active_pwrlevel] += data->total_time; if (pwr->thermal_pwrlevel) pwr->thermal_time += data->gpu_time; pwr->aggr_max_pwrlevel = data->aggr_max_pwrlevel; spin_lock(&pwr->stats_lock); pwr->accum_busy_stats += data->gpu_time; pwr->accum_total_time += data->total_time; spin_unlock(&pwr->stats_lock); } static void stream_trace_data(struct kgsl_device *device, struct gmu_trace_packet *pkt) { switch (pkt->trace_id) { case GMU_TRACE_PREEMPT_TRIGGER: { struct trace_preempt_trigger *data = (struct trace_preempt_trigger *)pkt->payload; trace_adreno_preempt_trigger(data->cur_rb, data->next_rb, data->ctx_switch_cntl, pkt->ticks); break; } case GMU_TRACE_PREEMPT_DONE: { struct trace_preempt_done *data = (struct trace_preempt_done *)pkt->payload; trace_adreno_preempt_done(data->prev_rb, data->next_rb, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_gmu_core.h:47 [MATCH: timeout] --- #error "CNOC levels cannot exceed GX levels" #endif enum gmu_common_capabilities { FCC_VERSION_INFO = 0, }; enum gmu_platform_capabilities { FAC_TRACE_BUFFER = 0, FAC_VRB_HW_FENCE_SHADOW_NUM_ENTRIES = 1, FAC_VRB_CL_NO_FT_TIMEOUT = 2, FAC_VRB_PREEMPT_COUNT = 3, FAC_RBBM_INTERRUPTS_HANDLE_ALL = 4, FAC_FORCE_RETIRE_COMMAND = 5, FAC_SOFT_RESET = 6, FAC_FAST_CONTEXT_DESTROY = 7, FAC_POWER_CONTROL_WA = 8, }; /* * These are the different ways the GMU can boot. GMU_WARM_BOOT is waking up * from slumber. GMU_COLD_BOOT is booting for the first time. GMU_RESET * is a soft reset of the GMU. */ enum gmu_core_boot { GMU_WARM_BOOT = 0, GMU_COLD_BOOT = 1, GMU_RESET = 2 }; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_gmu_core.h:217 [MATCH: timeout] --- */ enum gmu_vrb_idx { /* Number of dwords supported by VRB */ VRB_SIZE_IDX = 0, /* Contains the address of warmboot scratch buffer */ VRB_WARMBOOT_SCRATCH_IDX = 1, /* Contains the address of GMU trace buffer */ VRB_TRACE_BUFFER_ADDR_IDX = 2, /* Contains the number of hw fence shadow table entries */ VRB_HW_FENCE_SHADOW_NUM_ENTRIES = 3, /* Contains OpenCL no fault tolerance timeout in ms */ VRB_CL_NO_FT_TIMEOUT = 4, /* Contains the total number of GPU preemptions */ VRB_PREEMPT_COUNT_TOTAL = 5, /* Contains the number of L0 GPU preemptions */ VRB_PREEMPT_COUNT_L0 = 6, /* Contains the number of L1A GPU preemptions */ VRB_PREEMPT_COUNT_L1A = 7, /* Contains the number of L1B GPU preemptions */ VRB_PREEMPT_COUNT_L1B = 8, /* Contains the GMU VA for power limits trace buffer */ VRB_PWR_LIMITS_TRACE_BUF = 9, /* Contains the total size of context record in KB */ VRB_CTXRECORD_TOTAL_SZ = 10, /* Contains the size of AQE context record in KB */ VRB_CTXRECORD_AQE_SZ = 11, /* Contains the size of GMEM inside context record in KB */ VRB_CTXRECORD_GMEM_SZ = 12, /* Contains whether to enable fault on DBGC interrupts */ --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_gmu_core.h:218 [MATCH: timeout] --- enum gmu_vrb_idx { /* Number of dwords supported by VRB */ VRB_SIZE_IDX = 0, /* Contains the address of warmboot scratch buffer */ VRB_WARMBOOT_SCRATCH_IDX = 1, /* Contains the address of GMU trace buffer */ VRB_TRACE_BUFFER_ADDR_IDX = 2, /* Contains the number of hw fence shadow table entries */ VRB_HW_FENCE_SHADOW_NUM_ENTRIES = 3, /* Contains OpenCL no fault tolerance timeout in ms */ VRB_CL_NO_FT_TIMEOUT = 4, /* Contains the total number of GPU preemptions */ VRB_PREEMPT_COUNT_TOTAL = 5, /* Contains the number of L0 GPU preemptions */ VRB_PREEMPT_COUNT_L0 = 6, /* Contains the number of L1A GPU preemptions */ VRB_PREEMPT_COUNT_L1A = 7, /* Contains the number of L1B GPU preemptions */ VRB_PREEMPT_COUNT_L1B = 8, /* Contains the GMU VA for power limits trace buffer */ VRB_PWR_LIMITS_TRACE_BUF = 9, /* Contains the total size of context record in KB */ VRB_CTXRECORD_TOTAL_SZ = 10, /* Contains the size of AQE context record in KB */ VRB_CTXRECORD_AQE_SZ = 11, /* Contains the size of GMEM inside context record in KB */ VRB_CTXRECORD_GMEM_SZ = 12, /* Contains whether to enable fault on DBGC interrupts */ VRB_DBGC_FAULT_ENABLE = 17, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_gmu_core.h:252 [MATCH: timeout] --- /* Trace header defines */ /* Logtype to decode the trace pkt data */ #define TRACE_LOGTYPE_HWSCHED 1 /* Trace buffer threshold for GMU to send F2H message */ #define TRACE_BUFFER_THRESHOLD 80 /* * GMU Trace timer value to check trace packet consumption. GMU timer handler tracks the * readindex, If it's not moved since last timer fired, GMU will send the f2h message to * drain trace packets. GMU Trace Timer will be restarted if the readindex is moving. */ #define TRACE_TIMEOUT_MSEC 5 /* Trace metadata defines */ /* Trace drop mode hint for GMU to drop trace packets when trace buffer is full */ #define TRACE_MODE_DROP 1 /* Trace buffer header version */ #define TRACE_HEADER_VERSION_1 1 /* Trace packet defines */ #define TRACE_PKT_VALID 1 #define TRACE_PKT_SEQ_MASK GENMASK(15, 0) #define TRACE_PKT_SZ_MASK GENMASK(27, 16) #define TRACE_PKT_SZ_SHIFT 16 #define TRACE_PKT_VALID_MASK GENMASK(31, 31) #define TRACE_PKT_SKIP_MASK GENMASK(30, 30) #define TRACE_PKT_VALID_SHIFT 31 #define TRACE_PKT_SKIP_SHIFT 30 #define TRACE_PKT_GET_SEQNUM(hdr) ((hdr) & TRACE_PKT_SEQ_MASK) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_gmu_core.h:279 [MATCH: timeout] --- #define TRACE_PKT_GET_SEQNUM(hdr) ((hdr) & TRACE_PKT_SEQ_MASK) #define TRACE_PKT_GET_SIZE(hdr) (((hdr) & TRACE_PKT_SZ_MASK) >> TRACE_PKT_SZ_SHIFT) #define TRACE_PKT_GET_VALID_FIELD(hdr) (((hdr) & TRACE_PKT_VALID_MASK) >> TRACE_PKT_VALID_SHIFT) #define TRACE_PKT_GET_SKIP_FIELD(hdr) (((hdr) & TRACE_PKT_SKIP_MASK) >> TRACE_PKT_SKIP_SHIFT) /* * Trace buffer header definition * Trace buffer header fields initialized/updated by KGSL and GMU * GMU input: Following header fields are initialized by KGSL * - @metadata, @threshold, @size, @cookie, @timeout, @log_type * - @readIndex updated by kgsl when traces messages are consumed. * GMU output: Following header fields are initialized by GMU only * - @magic, @payload_offset, @payload_size * - @write_index updated by GMU upon filling the trace messages */ struct gmu_trace_header { /** @magic: Initialized by GMU to check header is valid or not */ u32 magic; /** * @metadata: Trace buffer metadata.Bit(31) Trace Mode to log tracepoints * messages, Bits [3:0] Version for header format changes. */ u32 metadata; /** * @threshold: % at which GMU to send f2h message to wakeup KMD to consume * tracepoints data. Set it to zero to disable thresholding. Threshold is % * of buffer full condition not the trace packet count. If GMU is continuously * writing to trace buffer makes it buffer full condition when KMD is not --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_gmu_core.h:316 [MATCH: timeout] --- u32 read_index; /** @write_index: trace buffer write index in dwords */ u32 write_index; /** @payload_offset: trace buffer payload dword offset */ u32 payload_offset; /** @payload_size: trace buffer payload size in dword */ u32 payload_size; /** cookie: cookie data sent through F2H_PROCESS_MESSAGE */ u64 cookie; /** * timeout: GMU Trace Timer value in msec - zero to disable trace timer else * value for GMU trace timerhandler to send HFI msg. */ u32 timeout; /** @log_type: To decode the trace buffer data */ u32 log_type; } __packed; /* Trace ID definition */ enum gmu_trace_id { GMU_TRACE_PREEMPT_TRIGGER = 1, GMU_TRACE_PREEMPT_DONE = 2, GMU_TRACE_EXTERNAL_HW_FENCE_SIGNAL = 3, GMU_TRACE_SYNCOBJ_RETIRE = 4, GMU_TRACE_DCVS_PWRLVL = 5, GMU_TRACE_DCVS_BUSLVL = 6, GMU_TRACE_DCVS_PWRSTATS = 7, GMU_TRACE_PWR_CONSTRAINT = 8, GMU_TRACE_DCVS_PROFILE = 9, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_gmu_core.h:319 [MATCH: timeout] --- /** @payload_offset: trace buffer payload dword offset */ u32 payload_offset; /** @payload_size: trace buffer payload size in dword */ u32 payload_size; /** cookie: cookie data sent through F2H_PROCESS_MESSAGE */ u64 cookie; /** * timeout: GMU Trace Timer value in msec - zero to disable trace timer else * value for GMU trace timerhandler to send HFI msg. */ u32 timeout; /** @log_type: To decode the trace buffer data */ u32 log_type; } __packed; /* Trace ID definition */ enum gmu_trace_id { GMU_TRACE_PREEMPT_TRIGGER = 1, GMU_TRACE_PREEMPT_DONE = 2, GMU_TRACE_EXTERNAL_HW_FENCE_SIGNAL = 3, GMU_TRACE_SYNCOBJ_RETIRE = 4, GMU_TRACE_DCVS_PWRLVL = 5, GMU_TRACE_DCVS_BUSLVL = 6, GMU_TRACE_DCVS_PWRSTATS = 7, GMU_TRACE_PWR_CONSTRAINT = 8, GMU_TRACE_DCVS_PROFILE = 9, GMU_TRACE_MAX, }; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_gmu_core.h:512 [MATCH: timeout] --- GMU_FAULT_HFI_SEND_GENERIC_REQ, GMU_FAULT_F2H_MSG_ERR, GMU_FAULT_H2F_MSG_START, GMU_FAULT_WAIT_ACK_COMPLETION, GMU_FAULT_HFI_ACK, GMU_FAULT_CTX_UNREGISTER, GMU_FAULT_WAIT_FOR_LOWEST_IDLE, GMU_FAULT_WAIT_FOR_IDLE, GMU_FAULT_HW_FENCE, GMU_FAULT_WAIT_FOR_CX, GMU_FAULT_CX_WAIT_TIMEOUT, GMU_FAULT_CM3, GMU_FAULT_MAX, }; #define KGSL_GMU_CORE_FORCE_PANIC(gf_panic, pdev, ticks, policy) do { \ if (gf_panic & BIT(policy)) { \ dev_err(&pdev->dev, \ "GMU always on ticks: %llx gf_policy: 0x%x gf_trigger: 0x%lx\n", \ ticks, gf_panic, BIT(policy));\ BUG();\ } \ } while (0) struct gmu_dev_ops { int (*oob_set)(struct kgsl_device *device, enum oob_request req); void (*oob_clear)(struct kgsl_device *device, enum oob_request req); int (*ifpc_store)(struct kgsl_device *device, unsigned int val); unsigned int (*ifpc_isenabled)(struct kgsl_device *device); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_gmu_core.h:690 [MATCH: timeout] --- /** * gmu_core_timed_poll_check() - polling *gmu* register at given offset until * its value changed to match expected value. The function times * out and returns after given duration if register is not updated * as expected. * * @device: Pointer to KGSL device * @offset: Register offset in dwords * @expected_ret: expected register value that stops polling * @timeout_ms: time in milliseconds to poll the register * @mask: bitmask to filter register value to match expected_ret */ int gmu_core_timed_poll_check(struct kgsl_device *device, unsigned int offset, unsigned int expected_ret, unsigned int timeout_ms, unsigned int mask); struct kgsl_memdesc; struct iommu_domain; struct hfi_mem_alloc_entry; struct gmu_mem_type_desc { /** @memdesc: Pointer to the memory descriptor */ struct kgsl_memdesc *memdesc; /** @type: Type of the memory descriptor */ u32 type; }; /** --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_gmu_core.h:695 [MATCH: timeout] --- * as expected. * * @device: Pointer to KGSL device * @offset: Register offset in dwords * @expected_ret: expected register value that stops polling * @timeout_ms: time in milliseconds to poll the register * @mask: bitmask to filter register value to match expected_ret */ int gmu_core_timed_poll_check(struct kgsl_device *device, unsigned int offset, unsigned int expected_ret, unsigned int timeout_ms, unsigned int mask); struct kgsl_memdesc; struct iommu_domain; struct hfi_mem_alloc_entry; struct gmu_mem_type_desc { /** @memdesc: Pointer to the memory descriptor */ struct kgsl_memdesc *memdesc; /** @type: Type of the memory descriptor */ u32 type; }; /** * gmu_core_map_memdesc - Map the memdesc into the GMU IOMMU domain * @domain: Domain to map the memory into * @memdesc: Memory descriptor to map * @gmuaddr: Virtual GMU address to map the memory into * @attrs: Attributes for the mapping --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_gmu_core.h:270 [MATCH: seqnum] --- /* Trace packet defines */ #define TRACE_PKT_VALID 1 #define TRACE_PKT_SEQ_MASK GENMASK(15, 0) #define TRACE_PKT_SZ_MASK GENMASK(27, 16) #define TRACE_PKT_SZ_SHIFT 16 #define TRACE_PKT_VALID_MASK GENMASK(31, 31) #define TRACE_PKT_SKIP_MASK GENMASK(30, 30) #define TRACE_PKT_VALID_SHIFT 31 #define TRACE_PKT_SKIP_SHIFT 30 #define TRACE_PKT_GET_SEQNUM(hdr) ((hdr) & TRACE_PKT_SEQ_MASK) #define TRACE_PKT_GET_SIZE(hdr) (((hdr) & TRACE_PKT_SZ_MASK) >> TRACE_PKT_SZ_SHIFT) #define TRACE_PKT_GET_VALID_FIELD(hdr) (((hdr) & TRACE_PKT_VALID_MASK) >> TRACE_PKT_VALID_SHIFT) #define TRACE_PKT_GET_SKIP_FIELD(hdr) (((hdr) & TRACE_PKT_SKIP_MASK) >> TRACE_PKT_SKIP_SHIFT) /* * Trace buffer header definition * Trace buffer header fields initialized/updated by KGSL and GMU * GMU input: Following header fields are initialized by KGSL * - @metadata, @threshold, @size, @cookie, @timeout, @log_type * - @readIndex updated by kgsl when traces messages are consumed. * GMU output: Following header fields are initialized by GMU only * - @magic, @payload_offset, @payload_size * - @write_index updated by GMU upon filling the trace messages */ struct gmu_trace_header { /** @magic: Initialized by GMU to check header is valid or not */ u32 magic; /** --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_iommu.c:1198 [MATCH: mutex_unlock] --- /* * Turn off GPU IRQ so we don't get faults from it too. * The device mutex must be held to change power state */ if (gmu_core_isenabled(device)) kgsl_pwrctrl_irq(device, false); else kgsl_pwrctrl_change_state(device, KGSL_STATE_AWARE); kgsl_mutex_unlock(&device->mutex); return true; } static int kgsl_iommu_fault_handler(struct kgsl_mmu *mmu, struct kgsl_iommu_context *ctx, unsigned long addr, int flags) { struct kgsl_device *device = KGSL_MMU_DEVICE(mmu); u64 ptbase; u32 contextidr; bool stall, terminate; struct kgsl_process_private *private; struct kgsl_context *context; ptbase = KGSL_IOMMU_GET_CTX_REG_Q(ctx, KGSL_IOMMU_CTX_TTBR0); contextidr = KGSL_IOMMU_GET_CTX_REG(ctx, KGSL_IOMMU_CTX_CONTEXTIDR); private = kgsl_iommu_get_process(ptbase); context = kgsl_context_get(device, contextidr); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_iommu.c:1140 [MATCH: spin_lock] --- if (kgsl_iommu_addr_is_global(mmu, addr)) { dev_crit(device->dev, "Fault in global memory\n"); return; } if (!private) return; dev_crit(device->dev, "---- nearby memory ----\n"); spin_lock(&private->mem_lock); idr_for_each_entry(&private->mem_idr, entry, id) { u64 cur = entry->memdesc.gpuaddr; if (cur < addr) { if (!prev || prev->memdesc.gpuaddr < cur) prev = entry; } if (cur > addr) { if (!next || next->memdesc.gpuaddr > cur) next = entry; } } print_entry(device->dev, prev, pid_nr(private->pid)); dev_crit(device->dev, "<- fault @ %16.16lx\n", addr); print_entry(device->dev, next, pid_nr(private->pid)); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_iommu.c:2418 [MATCH: spin_lock] --- static uint64_t kgsl_iommu_find_svm_region(struct kgsl_pagetable *pagetable, uint64_t start, uint64_t end, uint64_t size, uint64_t alignment) { uint64_t addr; /* Avoid black holes */ if (WARN(end <= start, "Bad search range: 0x%llx-0x%llx", start, end)) return (uint64_t) -EINVAL; spin_lock(&pagetable->lock); addr = _get_unmapped_area_topdown(pagetable, start, end, size, alignment); spin_unlock(&pagetable->lock); return addr; } static bool iommu_addr_in_svm_ranges(struct kgsl_pagetable *pagetable, u64 gpuaddr, u64 size) { u64 end = gpuaddr + size; /* Make sure size is not zero and we don't wrap around */ if (end <= gpuaddr) return false; if ((gpuaddr >= pagetable->compat_va_start && gpuaddr < pagetable->compat_va_end) && (end > pagetable->compat_va_start && end <= pagetable->compat_va_end)) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_iommu.c:2457 [MATCH: spin_lock] --- static int kgsl_iommu_set_svm_region(struct kgsl_pagetable *pagetable, uint64_t gpuaddr, uint64_t size) { int ret = -ENOMEM; struct rb_node *node; /* Make sure the requested address doesn't fall out of SVM range */ if (!iommu_addr_in_svm_ranges(pagetable, gpuaddr, size)) return -ENOMEM; spin_lock(&pagetable->lock); node = pagetable->rbtree.rb_node; while (node != NULL) { uint64_t start, end; struct kgsl_iommu_addr_entry *entry = rb_entry(node, struct kgsl_iommu_addr_entry, node); start = entry->base; end = entry->base + entry->size; if (gpuaddr + size <= start) node = node->rb_left; else if (end <= gpuaddr) node = node->rb_right; else goto out; } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_iommu.c:2489 [MATCH: spin_lock] --- return ret; } static int get_gpuaddr(struct kgsl_pagetable *pagetable, struct kgsl_memdesc *memdesc, u64 start, u64 end, u64 size, u64 align) { u64 addr; int ret; spin_lock(&pagetable->lock); addr = _get_unmapped_area(pagetable, start, end, size, align); if (addr == (u64) -ENOMEM) { spin_unlock(&pagetable->lock); return -ENOMEM; } ret = _insert_gpuaddr(pagetable, addr, size); spin_unlock(&pagetable->lock); if (ret == 0) { memdesc->gpuaddr = addr; memdesc->pagetable = pagetable; } return ret; } static int kgsl_iommu_get_gpuaddr(struct kgsl_pagetable *pagetable, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_iommu.c:2547 [MATCH: spin_lock] --- } return ret; } static void kgsl_iommu_put_gpuaddr(struct kgsl_memdesc *memdesc) { if (memdesc->pagetable == NULL) return; spin_lock(&memdesc->pagetable->lock); _remove_gpuaddr(memdesc->pagetable, memdesc->gpuaddr); spin_unlock(&memdesc->pagetable->lock); } static int kgsl_iommu_svm_range(struct kgsl_pagetable *pagetable, uint64_t *lo, uint64_t *hi, uint64_t memflags) { bool gpu_compat = (memflags & KGSL_MEMFLAGS_FORCE_32BIT) != 0; if (lo != NULL) *lo = gpu_compat ? pagetable->compat_va_start : pagetable->svm_start; if (hi != NULL) *hi = gpu_compat ? pagetable->compat_va_end : pagetable->svm_end; return 0; } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_iommu.c:1159 [MATCH: spin_unlock] --- if (cur > addr) { if (!next || next->memdesc.gpuaddr > cur) next = entry; } } print_entry(device->dev, prev, pid_nr(private->pid)); dev_crit(device->dev, "<- fault @ %16.16lx\n", addr); print_entry(device->dev, next, pid_nr(private->pid)); spin_unlock(&private->mem_lock); } /* * Return true if the IOMMU should stall and trigger a snapshot on a pagefault */ static bool kgsl_iommu_check_stall_on_fault(struct kgsl_iommu_context *ctx, struct kgsl_mmu *mmu, int flags) { struct kgsl_device *device = KGSL_MMU_DEVICE(mmu); if (!(flags & IOMMU_FAULT_TRANSACTION_STALLED)) return false; if (!test_bit(KGSL_FT_PAGEFAULT_GPUHALT_ENABLE, &mmu->pfpolicy)) return false; if (test_bit(KGSL_MMU_PAGEFAULT_TERMINATE, &mmu->features)) return false; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_iommu.c:2421 [MATCH: spin_unlock] --- { uint64_t addr; /* Avoid black holes */ if (WARN(end <= start, "Bad search range: 0x%llx-0x%llx", start, end)) return (uint64_t) -EINVAL; spin_lock(&pagetable->lock); addr = _get_unmapped_area_topdown(pagetable, start, end, size, alignment); spin_unlock(&pagetable->lock); return addr; } static bool iommu_addr_in_svm_ranges(struct kgsl_pagetable *pagetable, u64 gpuaddr, u64 size) { u64 end = gpuaddr + size; /* Make sure size is not zero and we don't wrap around */ if (end <= gpuaddr) return false; if ((gpuaddr >= pagetable->compat_va_start && gpuaddr < pagetable->compat_va_end) && (end > pagetable->compat_va_start && end <= pagetable->compat_va_end)) return true; if ((gpuaddr >= pagetable->svm_start && gpuaddr < pagetable->svm_end) && --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_iommu.c:2478 [MATCH: spin_unlock] --- if (gpuaddr + size <= start) node = node->rb_left; else if (end <= gpuaddr) node = node->rb_right; else goto out; } ret = _insert_gpuaddr(pagetable, gpuaddr, size); out: spin_unlock(&pagetable->lock); return ret; } static int get_gpuaddr(struct kgsl_pagetable *pagetable, struct kgsl_memdesc *memdesc, u64 start, u64 end, u64 size, u64 align) { u64 addr; int ret; spin_lock(&pagetable->lock); addr = _get_unmapped_area(pagetable, start, end, size, align); if (addr == (u64) -ENOMEM) { spin_unlock(&pagetable->lock); return -ENOMEM; } ret = _insert_gpuaddr(pagetable, addr, size); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_iommu.c:2492 [MATCH: spin_unlock] --- static int get_gpuaddr(struct kgsl_pagetable *pagetable, struct kgsl_memdesc *memdesc, u64 start, u64 end, u64 size, u64 align) { u64 addr; int ret; spin_lock(&pagetable->lock); addr = _get_unmapped_area(pagetable, start, end, size, align); if (addr == (u64) -ENOMEM) { spin_unlock(&pagetable->lock); return -ENOMEM; } ret = _insert_gpuaddr(pagetable, addr, size); spin_unlock(&pagetable->lock); if (ret == 0) { memdesc->gpuaddr = addr; memdesc->pagetable = pagetable; } return ret; } static int kgsl_iommu_get_gpuaddr(struct kgsl_pagetable *pagetable, struct kgsl_memdesc *memdesc) { int ret = 0; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_iommu.c:2497 [MATCH: spin_unlock] --- int ret; spin_lock(&pagetable->lock); addr = _get_unmapped_area(pagetable, start, end, size, align); if (addr == (u64) -ENOMEM) { spin_unlock(&pagetable->lock); return -ENOMEM; } ret = _insert_gpuaddr(pagetable, addr, size); spin_unlock(&pagetable->lock); if (ret == 0) { memdesc->gpuaddr = addr; memdesc->pagetable = pagetable; } return ret; } static int kgsl_iommu_get_gpuaddr(struct kgsl_pagetable *pagetable, struct kgsl_memdesc *memdesc) { int ret = 0; u64 start, end, size, align; if (WARN_ON(kgsl_memdesc_use_cpu_map(memdesc))) return -EINVAL; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_iommu.c:2551 [MATCH: spin_unlock] --- static void kgsl_iommu_put_gpuaddr(struct kgsl_memdesc *memdesc) { if (memdesc->pagetable == NULL) return; spin_lock(&memdesc->pagetable->lock); _remove_gpuaddr(memdesc->pagetable, memdesc->gpuaddr); spin_unlock(&memdesc->pagetable->lock); } static int kgsl_iommu_svm_range(struct kgsl_pagetable *pagetable, uint64_t *lo, uint64_t *hi, uint64_t memflags) { bool gpu_compat = (memflags & KGSL_MEMFLAGS_FORCE_32BIT) != 0; if (lo != NULL) *lo = gpu_compat ? pagetable->compat_va_start : pagetable->svm_start; if (hi != NULL) *hi = gpu_compat ? pagetable->compat_va_end : pagetable->svm_end; return 0; } static bool kgsl_iommu_addr_in_range(struct kgsl_pagetable *pagetable, uint64_t gpuaddr, uint64_t size) { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_mmu.c:44 [MATCH: spin_lock] --- kgsl_schedule_work(&pagetable->destroy_ws); } struct kgsl_pagetable * kgsl_get_pagetable(unsigned long name) { struct kgsl_pagetable *pt, *ret = NULL; unsigned long flags; spin_lock_irqsave(&kgsl_driver.ptlock, flags); list_for_each_entry(pt, &kgsl_driver.pagetable_list, list) { if (name == pt->name && kref_get_unless_zero(&pt->refcount)) { ret = pt; break; } } spin_unlock_irqrestore(&kgsl_driver.ptlock, flags); return ret; } static struct kgsl_pagetable * _get_pt_from_kobj(struct kobject *kobj) { unsigned int ptname; if (!kobj) return NULL; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_mmu.c:216 [MATCH: spin_lock] --- static void kgsl_mmu_trace_gpu_mem_pagetable(struct kgsl_pagetable *pagetable) { } #endif void kgsl_mmu_detach_pagetable(struct kgsl_pagetable *pagetable) { unsigned long flags; spin_lock_irqsave(&kgsl_driver.ptlock, flags); if (!list_empty(&pagetable->list)) list_del_init(&pagetable->list); spin_unlock_irqrestore(&kgsl_driver.ptlock, flags); pagetable_remove_sysfs_objects(pagetable); } unsigned int kgsl_mmu_log_fault_addr(struct kgsl_mmu *mmu, u64 pt_base, uint64_t addr) { struct kgsl_pagetable *pt; unsigned int ret = 0; spin_lock(&kgsl_driver.ptlock); list_for_each_entry(pt, &kgsl_driver.pagetable_list, list) { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_mmu.c:233 [MATCH: spin_lock] --- pagetable_remove_sysfs_objects(pagetable); } unsigned int kgsl_mmu_log_fault_addr(struct kgsl_mmu *mmu, u64 pt_base, uint64_t addr) { struct kgsl_pagetable *pt; unsigned int ret = 0; spin_lock(&kgsl_driver.ptlock); list_for_each_entry(pt, &kgsl_driver.pagetable_list, list) { if (kgsl_mmu_pagetable_get_ttbr0(pt) == MMU_SW_PT_BASE(pt_base)) { if ((addr & ~(PAGE_SIZE-1)) == pt->fault_addr) { ret = 1; break; } pt->fault_addr = (addr & ~(PAGE_SIZE-1)); ret = 0; break; } } spin_unlock(&kgsl_driver.ptlock); return ret; } int kgsl_mmu_start(struct kgsl_device *device) { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_mmu.c:265 [MATCH: spin_lock] --- return mmu->mmu_ops->mmu_start(mmu); return 0; } void kgsl_mmu_pagetable_init(struct kgsl_mmu *mmu, struct kgsl_pagetable *pagetable, u32 name) { kref_init(&pagetable->refcount); spin_lock_init(&pagetable->lock); INIT_WORK(&pagetable->destroy_ws, _deferred_destroy); pagetable->mmu = mmu; pagetable->name = name; atomic_set(&pagetable->stats.entries, 0); atomic_long_set(&pagetable->stats.mapped, 0); atomic_long_set(&pagetable->stats.max_mapped, 0); } void kgsl_mmu_pagetable_add(struct kgsl_mmu *mmu, struct kgsl_pagetable *pagetable) { unsigned long flags; spin_lock_irqsave(&kgsl_driver.ptlock, flags); list_add(&pagetable->list, &kgsl_driver.pagetable_list); spin_unlock_irqrestore(&kgsl_driver.ptlock, flags); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_mmu.c:280 [MATCH: spin_lock] --- atomic_set(&pagetable->stats.entries, 0); atomic_long_set(&pagetable->stats.mapped, 0); atomic_long_set(&pagetable->stats.max_mapped, 0); } void kgsl_mmu_pagetable_add(struct kgsl_mmu *mmu, struct kgsl_pagetable *pagetable) { unsigned long flags; spin_lock_irqsave(&kgsl_driver.ptlock, flags); list_add(&pagetable->list, &kgsl_driver.pagetable_list); spin_unlock_irqrestore(&kgsl_driver.ptlock, flags); /* Create the sysfs entries */ pagetable_add_sysfs_objects(pagetable); } void kgsl_mmu_putpagetable(struct kgsl_pagetable *pagetable) { if (!IS_ERR_OR_NULL(pagetable)) kref_put(&pagetable->refcount, kgsl_destroy_pagetable); } /** * kgsl_mmu_find_svm_region() - Find a empty spot in the SVM region * @pagetable: KGSL pagetable to search * @start: start of search range, must be within kgsl_mmu_svm_range() * @end: end of search range, must be within kgsl_mmu_svm_range() --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_mmu.c:52 [MATCH: spin_unlock] --- unsigned long flags; spin_lock_irqsave(&kgsl_driver.ptlock, flags); list_for_each_entry(pt, &kgsl_driver.pagetable_list, list) { if (name == pt->name && kref_get_unless_zero(&pt->refcount)) { ret = pt; break; } } spin_unlock_irqrestore(&kgsl_driver.ptlock, flags); return ret; } static struct kgsl_pagetable * _get_pt_from_kobj(struct kobject *kobj) { unsigned int ptname; if (!kobj) return NULL; if (kstrtou32(kobj->name, 0, &ptname)) return NULL; return kgsl_get_pagetable(ptname); } static ssize_t --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_mmu.c:221 [MATCH: spin_unlock] --- void kgsl_mmu_detach_pagetable(struct kgsl_pagetable *pagetable) { unsigned long flags; spin_lock_irqsave(&kgsl_driver.ptlock, flags); if (!list_empty(&pagetable->list)) list_del_init(&pagetable->list); spin_unlock_irqrestore(&kgsl_driver.ptlock, flags); pagetable_remove_sysfs_objects(pagetable); } unsigned int kgsl_mmu_log_fault_addr(struct kgsl_mmu *mmu, u64 pt_base, uint64_t addr) { struct kgsl_pagetable *pt; unsigned int ret = 0; spin_lock(&kgsl_driver.ptlock); list_for_each_entry(pt, &kgsl_driver.pagetable_list, list) { if (kgsl_mmu_pagetable_get_ttbr0(pt) == MMU_SW_PT_BASE(pt_base)) { if ((addr & ~(PAGE_SIZE-1)) == pt->fault_addr) { ret = 1; break; } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_mmu.c:245 [MATCH: spin_unlock] --- if (kgsl_mmu_pagetable_get_ttbr0(pt) == MMU_SW_PT_BASE(pt_base)) { if ((addr & ~(PAGE_SIZE-1)) == pt->fault_addr) { ret = 1; break; } pt->fault_addr = (addr & ~(PAGE_SIZE-1)); ret = 0; break; } } spin_unlock(&kgsl_driver.ptlock); return ret; } int kgsl_mmu_start(struct kgsl_device *device) { struct kgsl_mmu *mmu = &device->mmu; if (MMU_OP_VALID(mmu, mmu_start)) return mmu->mmu_ops->mmu_start(mmu); return 0; } void kgsl_mmu_pagetable_init(struct kgsl_mmu *mmu, struct kgsl_pagetable *pagetable, u32 name) { kref_init(&pagetable->refcount); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_mmu.c:282 [MATCH: spin_unlock] --- atomic_long_set(&pagetable->stats.mapped, 0); atomic_long_set(&pagetable->stats.max_mapped, 0); } void kgsl_mmu_pagetable_add(struct kgsl_mmu *mmu, struct kgsl_pagetable *pagetable) { unsigned long flags; spin_lock_irqsave(&kgsl_driver.ptlock, flags); list_add(&pagetable->list, &kgsl_driver.pagetable_list); spin_unlock_irqrestore(&kgsl_driver.ptlock, flags); /* Create the sysfs entries */ pagetable_add_sysfs_objects(pagetable); } void kgsl_mmu_putpagetable(struct kgsl_pagetable *pagetable) { if (!IS_ERR_OR_NULL(pagetable)) kref_put(&pagetable->refcount, kgsl_destroy_pagetable); } /** * kgsl_mmu_find_svm_region() - Find a empty spot in the SVM region * @pagetable: KGSL pagetable to search * @start: start of search range, must be within kgsl_mmu_svm_range() * @end: end of search range, must be within kgsl_mmu_svm_range() * @size: Size of the region to find * @align: Desired alignment of the address --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pool.c:47 [MATCH: spin_lock] --- { return kmem_cache_free(addr_page_cache, element); } static int __kgsl_pool_add_page(struct kgsl_page_pool *pool, struct page *p) { struct rb_node **node, *parent = NULL; struct kgsl_pool_page_entry *new_page, *entry; spin_lock(&pool->list_lock); new_page = pool->mempool ? mempool_alloc(pool->mempool, GFP_ATOMIC) : kmem_cache_alloc(addr_page_cache, GFP_ATOMIC); if (new_page == NULL) { spin_unlock(&pool->list_lock); return -ENOMEM; } node = &pool->pool_rbtree.rb_node; new_page->physaddr = page_to_phys(p); new_page->page = p; while (*node != NULL) { parent = *node; entry = rb_entry(parent, struct kgsl_pool_page_entry, node); if (new_page->physaddr < entry->physaddr) node = &parent->rb_left; else --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pool.c:136 [MATCH: spin_lock] --- static void kgsl_destroy_page_pool(struct kgsl_page_pool *pool) { mempool_destroy(pool->mempool); } #else static int __kgsl_pool_add_page(struct kgsl_page_pool *pool, struct page *p) { spin_lock(&pool->list_lock); list_add_tail(&p->lru, &pool->page_list); /* * page_count may be read without the list_lock held. Use WRITE_ONCE * to avoid compiler optimizations that may break consistency. */ ASSERT_EXCLUSIVE_WRITER(pool->page_count); WRITE_ONCE(pool->page_count, pool->page_count + 1); spin_unlock(&pool->list_lock); return 0; } static struct page * __kgsl_pool_get_page(struct kgsl_page_pool *pool) { struct page *p; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pool.c:248 [MATCH: spin_lock] --- mod_node_page_state(page_pgdat(p), NR_KERNEL_MISC_RECLAIMABLE, (1 << pool->pool_order)); } /* Returns a page from specified pool */ static struct page * _kgsl_pool_get_page(struct kgsl_page_pool *pool) { struct page *p = NULL; spin_lock(&pool->list_lock); p = __kgsl_pool_get_page(pool); spin_unlock(&pool->list_lock); if (p != NULL) { /* Use READ_ONCE to read page_count without holding list_lock */ trace_kgsl_pool_get_page(pool->pool_order, READ_ONCE(pool->page_count)); mod_node_page_state(page_pgdat(p), NR_KERNEL_MISC_RECLAIMABLE, -(1 << pool->pool_order)); } return p; } int kgsl_pool_size_total(void) { int i; int total = 0; for (i = 0; i < kgsl_num_pools; i++) { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pool.c:269 [MATCH: spin_lock] --- } int kgsl_pool_size_total(void) { int i; int total = 0; for (i = 0; i < kgsl_num_pools; i++) { struct kgsl_page_pool *kgsl_pool = &kgsl_pools[i]; spin_lock(&kgsl_pool->list_lock); total += kgsl_pool->page_count * (1 << kgsl_pool->pool_order); spin_unlock(&kgsl_pool->list_lock); } return total; } /* Returns the total number of pages in all pools excluding reserved pages */ static unsigned long kgsl_pool_size_nonreserved(void) { int i; unsigned long total = 0; for (i = 0; i < kgsl_num_pools; i++) { struct kgsl_page_pool *pool = &kgsl_pools[i]; spin_lock(&pool->list_lock); if (pool->page_count > pool->reserved_pages) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pool.c:286 [MATCH: spin_lock] --- /* Returns the total number of pages in all pools excluding reserved pages */ static unsigned long kgsl_pool_size_nonreserved(void) { int i; unsigned long total = 0; for (i = 0; i < kgsl_num_pools; i++) { struct kgsl_page_pool *pool = &kgsl_pools[i]; spin_lock(&pool->list_lock); if (pool->page_count > pool->reserved_pages) total += (pool->page_count - pool->reserved_pages) * (1 << pool->pool_order); spin_unlock(&pool->list_lock); } return total; } /* * Returns a page from specified pool only if pool * currently holds more number of pages than reserved * pages. */ static struct page * _kgsl_pool_get_nonreserved_page(struct kgsl_page_pool *pool) { struct page *p = NULL; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pool.c:306 [MATCH: spin_lock] --- /* * Returns a page from specified pool only if pool * currently holds more number of pages than reserved * pages. */ static struct page * _kgsl_pool_get_nonreserved_page(struct kgsl_page_pool *pool) { struct page *p = NULL; spin_lock(&pool->list_lock); if (pool->page_count <= pool->reserved_pages) { spin_unlock(&pool->list_lock); return NULL; } p = __kgsl_pool_get_page(pool); spin_unlock(&pool->list_lock); if (p != NULL) { /* Use READ_ONCE to read page_count without holding list_lock */ trace_kgsl_pool_get_page(pool->pool_order, READ_ONCE(pool->page_count)); mod_node_page_state(page_pgdat(p), NR_KERNEL_MISC_RECLAIMABLE, -(1 << pool->pool_order)); } return p; } /* --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pool.c:657 [MATCH: spin_lock] --- if (order > 8) { pr_err("kgsl: %pOF: pool order %d is too big\n", node, order); return -EINVAL; } pool->pool_order = order; if (of_property_read_u32(node, "qcom,mempool-max-pages", &pool->max_pages)) pool->max_pages = UINT_MAX; spin_lock_init(&pool->list_lock); kgsl_pool_list_init(pool); kgsl_pool_reserve_pages(pool, node); snprintf(name, sizeof(name), "%d_order", (pool->pool_order)); kgsl_pool_init_debugfs(pool->debug_root, name, (void *) pool); return 0; } #if (KERNEL_VERSION(6, 7, 0) <= LINUX_VERSION_CODE) static void kgsl_pool_shrinker_init(void) { kgsl_driver.pool_shrinker = shrinker_alloc(0, "kgsl_pool_shrinker"); if (!kgsl_driver.pool_shrinker) return; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pool.c:51 [MATCH: spin_unlock] --- static int __kgsl_pool_add_page(struct kgsl_page_pool *pool, struct page *p) { struct rb_node **node, *parent = NULL; struct kgsl_pool_page_entry *new_page, *entry; spin_lock(&pool->list_lock); new_page = pool->mempool ? mempool_alloc(pool->mempool, GFP_ATOMIC) : kmem_cache_alloc(addr_page_cache, GFP_ATOMIC); if (new_page == NULL) { spin_unlock(&pool->list_lock); return -ENOMEM; } node = &pool->pool_rbtree.rb_node; new_page->physaddr = page_to_phys(p); new_page->page = p; while (*node != NULL) { parent = *node; entry = rb_entry(parent, struct kgsl_pool_page_entry, node); if (new_page->physaddr < entry->physaddr) node = &parent->rb_left; else node = &parent->rb_right; } rb_link_node(&new_page->node, parent, node); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pool.c:78 [MATCH: spin_unlock] --- rb_link_node(&new_page->node, parent, node); rb_insert_color(&new_page->node, &pool->pool_rbtree); /* * page_count may be read without the list_lock held. Use WRITE_ONCE * to avoid compiler optimizations that may break consistency. */ ASSERT_EXCLUSIVE_WRITER(pool->page_count); WRITE_ONCE(pool->page_count, pool->page_count + 1); spin_unlock(&pool->list_lock); return 0; } static struct page * __kgsl_pool_get_page(struct kgsl_page_pool *pool) { struct rb_node *node; struct kgsl_pool_page_entry *entry; struct page *p; node = rb_first(&pool->pool_rbtree); if (!node) return NULL; entry = rb_entry(node, struct kgsl_pool_page_entry, node); p = entry->page; rb_erase(&entry->node, &pool->pool_rbtree); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pool.c:145 [MATCH: spin_unlock] --- { spin_lock(&pool->list_lock); list_add_tail(&p->lru, &pool->page_list); /* * page_count may be read without the list_lock held. Use WRITE_ONCE * to avoid compiler optimizations that may break consistency. */ ASSERT_EXCLUSIVE_WRITER(pool->page_count); WRITE_ONCE(pool->page_count, pool->page_count + 1); spin_unlock(&pool->list_lock); return 0; } static struct page * __kgsl_pool_get_page(struct kgsl_page_pool *pool) { struct page *p; p = list_first_entry_or_null(&pool->page_list, struct page, lru); if (p) { /* * page_count may be read without the list_lock held. Use * WRITE_ONCE to avoid compiler optimizations that may break * consistency. */ ASSERT_EXCLUSIVE_WRITER(pool->page_count); WRITE_ONCE(pool->page_count, pool->page_count - 1); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pool.c:250 [MATCH: spin_unlock] --- } /* Returns a page from specified pool */ static struct page * _kgsl_pool_get_page(struct kgsl_page_pool *pool) { struct page *p = NULL; spin_lock(&pool->list_lock); p = __kgsl_pool_get_page(pool); spin_unlock(&pool->list_lock); if (p != NULL) { /* Use READ_ONCE to read page_count without holding list_lock */ trace_kgsl_pool_get_page(pool->pool_order, READ_ONCE(pool->page_count)); mod_node_page_state(page_pgdat(p), NR_KERNEL_MISC_RECLAIMABLE, -(1 << pool->pool_order)); } return p; } int kgsl_pool_size_total(void) { int i; int total = 0; for (i = 0; i < kgsl_num_pools; i++) { struct kgsl_page_pool *kgsl_pool = &kgsl_pools[i]; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pool.c:271 [MATCH: spin_unlock] --- int kgsl_pool_size_total(void) { int i; int total = 0; for (i = 0; i < kgsl_num_pools; i++) { struct kgsl_page_pool *kgsl_pool = &kgsl_pools[i]; spin_lock(&kgsl_pool->list_lock); total += kgsl_pool->page_count * (1 << kgsl_pool->pool_order); spin_unlock(&kgsl_pool->list_lock); } return total; } /* Returns the total number of pages in all pools excluding reserved pages */ static unsigned long kgsl_pool_size_nonreserved(void) { int i; unsigned long total = 0; for (i = 0; i < kgsl_num_pools; i++) { struct kgsl_page_pool *pool = &kgsl_pools[i]; spin_lock(&pool->list_lock); if (pool->page_count > pool->reserved_pages) total += (pool->page_count - pool->reserved_pages) * (1 << pool->pool_order); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pool.c:290 [MATCH: spin_unlock] --- int i; unsigned long total = 0; for (i = 0; i < kgsl_num_pools; i++) { struct kgsl_page_pool *pool = &kgsl_pools[i]; spin_lock(&pool->list_lock); if (pool->page_count > pool->reserved_pages) total += (pool->page_count - pool->reserved_pages) * (1 << pool->pool_order); spin_unlock(&pool->list_lock); } return total; } /* * Returns a page from specified pool only if pool * currently holds more number of pages than reserved * pages. */ static struct page * _kgsl_pool_get_nonreserved_page(struct kgsl_page_pool *pool) { struct page *p = NULL; spin_lock(&pool->list_lock); if (pool->page_count <= pool->reserved_pages) { spin_unlock(&pool->list_lock); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pool.c:308 [MATCH: spin_unlock] --- * currently holds more number of pages than reserved * pages. */ static struct page * _kgsl_pool_get_nonreserved_page(struct kgsl_page_pool *pool) { struct page *p = NULL; spin_lock(&pool->list_lock); if (pool->page_count <= pool->reserved_pages) { spin_unlock(&pool->list_lock); return NULL; } p = __kgsl_pool_get_page(pool); spin_unlock(&pool->list_lock); if (p != NULL) { /* Use READ_ONCE to read page_count without holding list_lock */ trace_kgsl_pool_get_page(pool->pool_order, READ_ONCE(pool->page_count)); mod_node_page_state(page_pgdat(p), NR_KERNEL_MISC_RECLAIMABLE, -(1 << pool->pool_order)); } return p; } /* * This will shrink the specified pool by num_pages or by * (page_count - reserved_pages), whichever is smaller. --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pool.c:313 [MATCH: spin_unlock] --- { struct page *p = NULL; spin_lock(&pool->list_lock); if (pool->page_count <= pool->reserved_pages) { spin_unlock(&pool->list_lock); return NULL; } p = __kgsl_pool_get_page(pool); spin_unlock(&pool->list_lock); if (p != NULL) { /* Use READ_ONCE to read page_count without holding list_lock */ trace_kgsl_pool_get_page(pool->pool_order, READ_ONCE(pool->page_count)); mod_node_page_state(page_pgdat(p), NR_KERNEL_MISC_RECLAIMABLE, -(1 << pool->pool_order)); } return p; } /* * This will shrink the specified pool by num_pages or by * (page_count - reserved_pages), whichever is smaller. */ static unsigned int _kgsl_pool_shrink(struct kgsl_page_pool *pool, unsigned int num_pages, bool exit) { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:1434 [MATCH: wait_for_completion] --- } int kgsl_pwrctrl_enable_cx_gdsc(struct kgsl_device *device) { struct kgsl_pwrctrl *pwr = &device->pwrctrl; int ret; if (!pwr->cx_regulator && !pwr->gmu_cx_pd) return 0; ret = wait_for_completion_timeout(&pwr->cx_gdsc_gate, msecs_to_jiffies(5000)); if (!ret) { /* Dump the cx regulator consumer list */ if (pwr->cx_regulator) { dev_err(device->dev, "GPU CX wait timeout. Dumping CX votes:\n"); qcom_clk_dump(NULL, pwr->cx_regulator, false); } else { dev_err(device->dev, "GPU CX wait timeout\n"); } KGSL_GMU_CORE_FORCE_PANIC(device->gmu_core.gf_panic, GMU_PDEV(device), 0ULL, GMU_FAULT_CX_WAIT_TIMEOUT); } if (!completion_done(&pwr->cx_gdsc_gate)) log_kgsl_cx_wait_timeout_event(HLOS_CX_WAIT_TIMEOUT); if (pwr->cx_regulator) ret = regulator_enable(pwr->cx_regulator); else --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:1738 [MATCH: complete_all] --- if (kgsl_regmap_read_poll_timeout(&device->regmap, pwr->cx_cfg_gdsc_offset, val, (val & BIT(15)), 100, 100 * 1000)) { dev_err(device->dev, "GPU CX GDSC power down timed out\n"); log_kgsl_cx_wait_timeout_event(NONHLOS_CX_WAIT_TIMEOUT); KGSL_GMU_CORE_FORCE_PANIC(device->gmu_core.gf_panic, GMU_PDEV(device), 0ULL, GMU_FAULT_WAIT_FOR_CX); } } pwr->cx_gdsc_wait = false; complete_all(&pwr->cx_gdsc_gate); return 0; } static int kgsl_register_gdsc_notifier(struct kgsl_device *device) { struct kgsl_pwrctrl *pwr = &device->pwrctrl; if (!pwr->cx_regulator && !pwr->cx_pd) return 0; pwr->cx_gdsc_nb.notifier_call = kgsl_cx_gdsc_event; if (pwr->cx_regulator) return devm_regulator_register_notifier(pwr->cx_regulator, &pwr->cx_gdsc_nb); return dev_pm_genpd_add_notifier(pwr->cx_pd, &pwr->cx_gdsc_nb); } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:2206 [MATCH: complete_all] --- if (of_property_read_u32(pdev->dev.of_node, "vdd-parent-min-corner", &pwr->gx_regulator_parent_min_corner)) { dev_err(device->dev, "vdd-parent-min-corner not found\n"); return -ENODEV; } } init_completion(&pwr->cx_gdsc_gate); complete_all(&pwr->cx_gdsc_gate); result = kgsl_register_gdsc_notifier(device); if (result) { dev_err(&pdev->dev, "Failed to register gdsc notifier: %d\n", result); goto err; } /* Initialize the thermal clock constraints */ pwr->thermal_pwrlevel = 0; result = dev_pm_qos_add_request(&pdev->dev, &pwr->sysfs_thermal_req, DEV_PM_QOS_MAX_FREQUENCY, PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE); if (result < 0) dev_err(device->dev, "PM QoS sysfs thermal request failed:%d\n", result); /* * Due to the way it is implemented by the thermal driver, thermal skin mitigation event * is triggered through PMQOS. Usually, this is supposed to be handled via devfreq. --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:2515 [MATCH: complete_all] --- * * Resume the GPU from a lower power state to ACTIVE. */ static int _wake(struct kgsl_device *device) { struct kgsl_pwrctrl *pwr = &device->pwrctrl; int status = 0; switch (device->state) { case KGSL_STATE_SUSPEND: complete_all(&device->hwaccess_gate); /* Call the GPU specific resume function */ device->ftbl->resume(device); fallthrough; case KGSL_STATE_SLUMBER: status = device->ftbl->start(device, device->pwrctrl.superfast); device->pwrctrl.superfast = false; if (status) { kgsl_pwrctrl_request_state(device, KGSL_STATE_NONE); dev_err(device->dev, "start failed %d\n", status); break; } kgsl_pwrctrl_axi(device, true); kgsl_pwrscale_wake(device); kgsl_pwrctrl_irq(device, true); KGSL_TRACE_GPU_FREQ( pwr->pwrlevels[pwr->active_pwrlevel].gpu_freq/1000, 0, 0); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:2627 [MATCH: complete_all] --- /* make sure power is on to stop the device*/ status = kgsl_pwrctrl_enable(device); device->ftbl->check_idle(device); device->ftbl->stop(device); kgsl_pwrctrl_disable(device); kgsl_pwrscale_sleep(device); KGSL_TRACE_GPU_FREQ(0, 0, 0); kgsl_pwrctrl_set_state(device, KGSL_STATE_SLUMBER); break; case KGSL_STATE_SUSPEND: complete_all(&device->hwaccess_gate); device->ftbl->resume(device); kgsl_pwrctrl_set_state(device, KGSL_STATE_SLUMBER); break; case KGSL_STATE_AWARE: kgsl_pwrctrl_disable(device); KGSL_TRACE_GPU_FREQ(0, 0, 0); kgsl_pwrctrl_set_state(device, KGSL_STATE_SLUMBER); break; default: kgsl_pwrctrl_request_state(device, KGSL_STATE_NONE); break; } return status; } /* * _suspend() - Put device into suspend --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:2793 [MATCH: wait_event] --- { int result = 0; if (WARN_ON(!kgsl_mutex_is_locked(&device->mutex))) return -EINVAL; while (atomic_read(&device->active_cnt) > count) { long ret; kgsl_mutex_unlock(&device->mutex); ret = wait_event_timeout(device->active_cnt_wq, _check_active_count(device, count), wait_jiffies); kgsl_mutex_lock(&device->mutex); result = ret == 0 ? -ETIMEDOUT : 0; if (!result) wait_jiffies = ret; else break; } return result; } /** * kgsl_pwrctrl_set_default_gpu_pwrlevel() - Set GPU to default power level * @device: Pointer to the kgsl_device struct */ static int kgsl_pwrctrl_set_default_gpu_pwrlevel(struct kgsl_device *device) { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:37 [MATCH: timeout] --- #include "kgsl_power_trace.h" #include "kgsl_pwrscale.h" #include "kgsl_sysfs.h" #include "kgsl_trace.h" #include "kgsl_util.h" #define UPDATE_BUSY_VAL 1000000 #define KGSL_MAX_BUSLEVELS 20 #define GX_GDSC_TIMEOUT_MS 200 /* Order deeply matters here because reasons. New entries go on the end */ static const char * const clocks[KGSL_MAX_CLKS] = { "src_clk", "core_clk", "iface_clk", "mem_clk", "mem_iface_clk", "alt_mem_iface_clk", "rbbmtimer_clk", "gtcu_clk", "gtbu_clk", "gtcu_iface_clk", "alwayson_clk", "isense_clk", "rbcpr_clk", "iref_clk", "gmu_clk", --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:173 [MATCH: timeout] --- * clear the constraint */ if (kgsl_check_timestamp(device, context, pwr->constraint.owner_timestamp)) { reset = true; kgsl_context_put(context); goto done; } /* * Increase the timeout to keep the constraint at least till * the timestamp retires */ pwr->constraint.expires = jiffies + msecs_to_jiffies(atomic64_read(&device->pwrctrl.interval_timeout)); kgsl_context_put(context); } done: if (reset) { /* Trace the constraint being un-set by the driver */ trace_kgsl_constraint(device, pwr->constraint.type, old_level, 0, 0); /*Invalidate the constraint set */ pwr->constraint.expires = 0; pwr->constraint.type = KGSL_CONSTRAINT_NONE; } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:177 [MATCH: timeout] --- reset = true; kgsl_context_put(context); goto done; } /* * Increase the timeout to keep the constraint at least till * the timestamp retires */ pwr->constraint.expires = jiffies + msecs_to_jiffies(atomic64_read(&device->pwrctrl.interval_timeout)); kgsl_context_put(context); } done: if (reset) { /* Trace the constraint being un-set by the driver */ trace_kgsl_constraint(device, pwr->constraint.type, old_level, 0, 0); /*Invalidate the constraint set */ pwr->constraint.expires = 0; pwr->constraint.type = KGSL_CONSTRAINT_NONE; } /* * Adjust the power level if required by thermal, max/min, * constraints, etc */ --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:309 [MATCH: timeout] --- * if it is faster. If the requested constraint is the same * as the current one, update ownership and timestamp. */ if ((pwrc_old->type == KGSL_CONSTRAINT_NONE) || (pwrc_old->sub_type == KGSL_CONSTRAINT_PWR_MIN && pwrc->sub_type == KGSL_CONSTRAINT_PWR_MAX)) { pwrc_old->type = pwrc->type; pwrc_old->sub_type = pwrc->sub_type; pwrc_old->owner_id = id; pwrc_old->expires = jiffies + msecs_to_jiffies(atomic64_read(&device->pwrctrl.interval_timeout)); pwrc_old->owner_timestamp = ts; kgsl_pwrctrl_pwrlevel_change(device, constraint); /* Trace the constraint being set by the driver */ trace_kgsl_constraint(device, pwrc_old->type, constraint, 1, 0); } else if ((pwrc_old->type == pwrc->type) && (pwrc_old->sub_type == pwrc->sub_type)) { pwrc_old->owner_id = id; pwrc_old->owner_timestamp = ts; pwrc_old->expires = jiffies + msecs_to_jiffies(atomic64_read(&device->pwrctrl.interval_timeout)); } } static int kgsl_pwrctrl_set_thermal_limit(struct kgsl_device *device, u32 level) { struct kgsl_pwrctrl *pwr = &device->pwrctrl; int ret = -EINVAL; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:318 [MATCH: timeout] --- pwrc_old->expires = jiffies + msecs_to_jiffies(atomic64_read(&device->pwrctrl.interval_timeout)); pwrc_old->owner_timestamp = ts; kgsl_pwrctrl_pwrlevel_change(device, constraint); /* Trace the constraint being set by the driver */ trace_kgsl_constraint(device, pwrc_old->type, constraint, 1, 0); } else if ((pwrc_old->type == pwrc->type) && (pwrc_old->sub_type == pwrc->sub_type)) { pwrc_old->owner_id = id; pwrc_old->owner_timestamp = ts; pwrc_old->expires = jiffies + msecs_to_jiffies(atomic64_read(&device->pwrctrl.interval_timeout)); } } static int kgsl_pwrctrl_set_thermal_limit(struct kgsl_device *device, u32 level) { struct kgsl_pwrctrl *pwr = &device->pwrctrl; int ret = -EINVAL; if (level >= pwr->num_pwrlevels) level = pwr->num_pwrlevels - 1; if (dev_pm_qos_request_active(&pwr->sysfs_thermal_req)) ret = dev_pm_qos_update_request(&pwr->sysfs_thermal_req, (pwr->pwrlevels[level].gpu_freq / 1000)); return (ret < 0) ? ret : 0; } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:588 [MATCH: timeout] --- /* * We don't quite accept a maximum of 0xFFFFFFFF due to internal jiffy * math, so make sure the value falls within the largest offset we can * deal with */ if (val > jiffies_to_usecs(MAX_JIFFY_OFFSET)) return -EINVAL; atomic64_set(&device->pwrctrl.interval_timeout, val); return count; } static ssize_t idle_timer_show(struct device *dev, struct device_attribute *attr, char *buf) { struct kgsl_device *device = dev_get_drvdata(dev); return scnprintf(buf, PAGE_SIZE, "%llu\n", atomic64_read(&device->pwrctrl.interval_timeout)); } static ssize_t minbw_timer_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { /* minbw_timer is deprecated, so return EOPNOTSUPP */ return -EOPNOTSUPP; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:599 [MATCH: timeout] --- return count; } static ssize_t idle_timer_show(struct device *dev, struct device_attribute *attr, char *buf) { struct kgsl_device *device = dev_get_drvdata(dev); return scnprintf(buf, PAGE_SIZE, "%llu\n", atomic64_read(&device->pwrctrl.interval_timeout)); } static ssize_t minbw_timer_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { /* minbw_timer is deprecated, so return EOPNOTSUPP */ return -EOPNOTSUPP; } static ssize_t minbw_timer_show(struct device *dev, struct device_attribute *attr, char *buf) { /* minbw_timer is deprecated, so return it as always disabled */ return scnprintf(buf, PAGE_SIZE, "0\n"); } static ssize_t gpubusy_show(struct device *dev, struct device_attribute *attr, char *buf) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:1363 [MATCH: timeout] --- if (!test_and_set_bit(KGSL_PWRFLAGS_AXI_ON, &pwr->power_flags)) { trace_kgsl_bus(device, state); return kgsl_bus_update(device, KGSL_BUS_VOTE_ON); } } return 0; } static int kgsl_genpd_disable_wait(struct device *dev, u32 timeout) { ktime_t tout = ktime_add_us(ktime_get(), timeout * USEC_PER_MSEC); int ret; ret = pm_runtime_put_sync(dev); if (ret < 0) return ret; for (;;) { if (!kgsl_genpd_is_enabled(dev)) return 0; if (ktime_compare(ktime_get(), tout) > 0) return (!kgsl_genpd_is_enabled(dev) ? 0 : -ETIMEDOUT); usleep_range((100 >> 2) + 1, 100); } } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:1365 [MATCH: timeout] --- trace_kgsl_bus(device, state); return kgsl_bus_update(device, KGSL_BUS_VOTE_ON); } } return 0; } static int kgsl_genpd_disable_wait(struct device *dev, u32 timeout) { ktime_t tout = ktime_add_us(ktime_get(), timeout * USEC_PER_MSEC); int ret; ret = pm_runtime_put_sync(dev); if (ret < 0) return ret; for (;;) { if (!kgsl_genpd_is_enabled(dev)) return 0; if (ktime_compare(ktime_get(), tout) > 0) return (!kgsl_genpd_is_enabled(dev) ? 0 : -ETIMEDOUT); usleep_range((100 >> 2) + 1, 100); } } int kgsl_regulator_disable_wait(struct regulator *reg, u32 timeout) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:1383 [MATCH: timeout] --- if (!kgsl_genpd_is_enabled(dev)) return 0; if (ktime_compare(ktime_get(), tout) > 0) return (!kgsl_genpd_is_enabled(dev) ? 0 : -ETIMEDOUT); usleep_range((100 >> 2) + 1, 100); } } int kgsl_regulator_disable_wait(struct regulator *reg, u32 timeout) { ktime_t tout = ktime_add_us(ktime_get(), timeout * USEC_PER_MSEC); int ret; ret = regulator_disable(reg); if (ret) return ret; for (;;) { if (!regulator_is_enabled(reg)) return 0; if (ktime_compare(ktime_get(), tout) > 0) return (!regulator_is_enabled(reg) ? 0 : -ETIMEDOUT); usleep_range((100 >> 2) + 1, 100); } } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:1385 [MATCH: timeout] --- if (ktime_compare(ktime_get(), tout) > 0) return (!kgsl_genpd_is_enabled(dev) ? 0 : -ETIMEDOUT); usleep_range((100 >> 2) + 1, 100); } } int kgsl_regulator_disable_wait(struct regulator *reg, u32 timeout) { ktime_t tout = ktime_add_us(ktime_get(), timeout * USEC_PER_MSEC); int ret; ret = regulator_disable(reg); if (ret) return ret; for (;;) { if (!regulator_is_enabled(reg)) return 0; if (ktime_compare(ktime_get(), tout) > 0) return (!regulator_is_enabled(reg) ? 0 : -ETIMEDOUT); usleep_range((100 >> 2) + 1, 100); } } void kgsl_pwrctrl_disable_mx_gdsc(struct kgsl_device *device) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:1438 [MATCH: timeout] --- struct kgsl_pwrctrl *pwr = &device->pwrctrl; int ret; if (!pwr->cx_regulator && !pwr->gmu_cx_pd) return 0; ret = wait_for_completion_timeout(&pwr->cx_gdsc_gate, msecs_to_jiffies(5000)); if (!ret) { /* Dump the cx regulator consumer list */ if (pwr->cx_regulator) { dev_err(device->dev, "GPU CX wait timeout. Dumping CX votes:\n"); qcom_clk_dump(NULL, pwr->cx_regulator, false); } else { dev_err(device->dev, "GPU CX wait timeout\n"); } KGSL_GMU_CORE_FORCE_PANIC(device->gmu_core.gf_panic, GMU_PDEV(device), 0ULL, GMU_FAULT_CX_WAIT_TIMEOUT); } if (!completion_done(&pwr->cx_gdsc_gate)) log_kgsl_cx_wait_timeout_event(HLOS_CX_WAIT_TIMEOUT); if (pwr->cx_regulator) ret = regulator_enable(pwr->cx_regulator); else ret = pm_runtime_resume_and_get(pwr->gmu_cx_pd); if (ret) dev_err(device->dev, "Failed to enable CX gdsc, error %d\n", ret); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:1441 [MATCH: timeout] --- if (!pwr->cx_regulator && !pwr->gmu_cx_pd) return 0; ret = wait_for_completion_timeout(&pwr->cx_gdsc_gate, msecs_to_jiffies(5000)); if (!ret) { /* Dump the cx regulator consumer list */ if (pwr->cx_regulator) { dev_err(device->dev, "GPU CX wait timeout. Dumping CX votes:\n"); qcom_clk_dump(NULL, pwr->cx_regulator, false); } else { dev_err(device->dev, "GPU CX wait timeout\n"); } KGSL_GMU_CORE_FORCE_PANIC(device->gmu_core.gf_panic, GMU_PDEV(device), 0ULL, GMU_FAULT_CX_WAIT_TIMEOUT); } if (!completion_done(&pwr->cx_gdsc_gate)) log_kgsl_cx_wait_timeout_event(HLOS_CX_WAIT_TIMEOUT); if (pwr->cx_regulator) ret = regulator_enable(pwr->cx_regulator); else ret = pm_runtime_resume_and_get(pwr->gmu_cx_pd); if (ret) dev_err(device->dev, "Failed to enable CX gdsc, error %d\n", ret); kgsl_mmu_send_tlb_hint(&device->mmu, false); pwr->cx_gdsc_wait = false; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:1444 [MATCH: timeout] --- ret = wait_for_completion_timeout(&pwr->cx_gdsc_gate, msecs_to_jiffies(5000)); if (!ret) { /* Dump the cx regulator consumer list */ if (pwr->cx_regulator) { dev_err(device->dev, "GPU CX wait timeout. Dumping CX votes:\n"); qcom_clk_dump(NULL, pwr->cx_regulator, false); } else { dev_err(device->dev, "GPU CX wait timeout\n"); } KGSL_GMU_CORE_FORCE_PANIC(device->gmu_core.gf_panic, GMU_PDEV(device), 0ULL, GMU_FAULT_CX_WAIT_TIMEOUT); } if (!completion_done(&pwr->cx_gdsc_gate)) log_kgsl_cx_wait_timeout_event(HLOS_CX_WAIT_TIMEOUT); if (pwr->cx_regulator) ret = regulator_enable(pwr->cx_regulator); else ret = pm_runtime_resume_and_get(pwr->gmu_cx_pd); if (ret) dev_err(device->dev, "Failed to enable CX gdsc, error %d\n", ret); kgsl_mmu_send_tlb_hint(&device->mmu, false); pwr->cx_gdsc_wait = false; return ret; } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:1448 [MATCH: timeout] --- dev_err(device->dev, "GPU CX wait timeout. Dumping CX votes:\n"); qcom_clk_dump(NULL, pwr->cx_regulator, false); } else { dev_err(device->dev, "GPU CX wait timeout\n"); } KGSL_GMU_CORE_FORCE_PANIC(device->gmu_core.gf_panic, GMU_PDEV(device), 0ULL, GMU_FAULT_CX_WAIT_TIMEOUT); } if (!completion_done(&pwr->cx_gdsc_gate)) log_kgsl_cx_wait_timeout_event(HLOS_CX_WAIT_TIMEOUT); if (pwr->cx_regulator) ret = regulator_enable(pwr->cx_regulator); else ret = pm_runtime_resume_and_get(pwr->gmu_cx_pd); if (ret) dev_err(device->dev, "Failed to enable CX gdsc, error %d\n", ret); kgsl_mmu_send_tlb_hint(&device->mmu, false); pwr->cx_gdsc_wait = false; return ret; } int kgsl_pwrctrl_enable_gx_gdsc(struct kgsl_device *device) { struct kgsl_pwrctrl *pwr = &device->pwrctrl; int ret; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:1508 [MATCH: timeout] --- void kgsl_pwrctrl_disable_gx_gdsc(struct kgsl_device *device) { struct kgsl_pwrctrl *pwr = &device->pwrctrl; int ret; if (!pwr->gx_regulator && !pwr->gx_pd) return; if (pwr->gx_regulator) ret = kgsl_regulator_disable_wait(pwr->gx_regulator, GX_GDSC_TIMEOUT_MS); else ret = kgsl_genpd_disable_wait(pwr->gx_pd, GX_GDSC_TIMEOUT_MS); if (ret) dev_err(device->dev, "vdd is stuck on, error %d\n", ret); } static int enable_gdscs(struct kgsl_device *device) { struct kgsl_pwrctrl *pwr = &device->pwrctrl; int ret; if (test_and_set_bit(KGSL_PWRFLAGS_POWER_ON, &pwr->power_flags)) return 0; ret = kgsl_pwrctrl_enable_cx_gdsc(device); if (!ret) { /* Set parent in retention voltage to power up vdd supply */ --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:1510 [MATCH: timeout] --- { struct kgsl_pwrctrl *pwr = &device->pwrctrl; int ret; if (!pwr->gx_regulator && !pwr->gx_pd) return; if (pwr->gx_regulator) ret = kgsl_regulator_disable_wait(pwr->gx_regulator, GX_GDSC_TIMEOUT_MS); else ret = kgsl_genpd_disable_wait(pwr->gx_pd, GX_GDSC_TIMEOUT_MS); if (ret) dev_err(device->dev, "vdd is stuck on, error %d\n", ret); } static int enable_gdscs(struct kgsl_device *device) { struct kgsl_pwrctrl *pwr = &device->pwrctrl; int ret; if (test_and_set_bit(KGSL_PWRFLAGS_POWER_ON, &pwr->power_flags)) return 0; ret = kgsl_pwrctrl_enable_cx_gdsc(device); if (!ret) { /* Set parent in retention voltage to power up vdd supply */ ret = kgsl_regulator_set_voltage(device->dev, pwr->gx_regulator_parent, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:1728 [MATCH: timeout] --- if (!pwr->cx_gdsc_wait) return 0; if (pwr->cx_pd && (event != GENPD_NOTIFY_OFF)) return 0; if (pwr->cx_regulator && !(event & REGULATOR_EVENT_DISABLE)) return 0; if (pwr->cx_cfg_gdsc_offset) { if (kgsl_regmap_read_poll_timeout(&device->regmap, pwr->cx_cfg_gdsc_offset, val, (val & BIT(15)), 100, 100 * 1000)) { dev_err(device->dev, "GPU CX GDSC power down timed out\n"); log_kgsl_cx_wait_timeout_event(NONHLOS_CX_WAIT_TIMEOUT); KGSL_GMU_CORE_FORCE_PANIC(device->gmu_core.gf_panic, GMU_PDEV(device), 0ULL, GMU_FAULT_WAIT_FOR_CX); } } pwr->cx_gdsc_wait = false; complete_all(&pwr->cx_gdsc_gate); return 0; } static int kgsl_register_gdsc_notifier(struct kgsl_device *device) { struct kgsl_pwrctrl *pwr = &device->pwrctrl; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:1731 [MATCH: timeout] --- if (pwr->cx_pd && (event != GENPD_NOTIFY_OFF)) return 0; if (pwr->cx_regulator && !(event & REGULATOR_EVENT_DISABLE)) return 0; if (pwr->cx_cfg_gdsc_offset) { if (kgsl_regmap_read_poll_timeout(&device->regmap, pwr->cx_cfg_gdsc_offset, val, (val & BIT(15)), 100, 100 * 1000)) { dev_err(device->dev, "GPU CX GDSC power down timed out\n"); log_kgsl_cx_wait_timeout_event(NONHLOS_CX_WAIT_TIMEOUT); KGSL_GMU_CORE_FORCE_PANIC(device->gmu_core.gf_panic, GMU_PDEV(device), 0ULL, GMU_FAULT_WAIT_FOR_CX); } } pwr->cx_gdsc_wait = false; complete_all(&pwr->cx_gdsc_gate); return 0; } static int kgsl_register_gdsc_notifier(struct kgsl_device *device) { struct kgsl_pwrctrl *pwr = &device->pwrctrl; if (!pwr->cx_regulator && !pwr->cx_pd) return 0; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:2410 [MATCH: timeout] --- * that this function does not check active_cnt because the registers * must be accessed during device start and stop, when the active_cnt * may legitimately be 0. */ void kgsl_pre_hwaccess(struct kgsl_device *device) { /* In order to touch a register you must hold the device mutex */ WARN_ON(!kgsl_mutex_is_locked(&device->mutex)); /* * A register access without device power will cause a fatal timeout. * This is not valid for targets with a GMU. */ if (!gmu_core_gpmu_isenabled(device)) WARN_ON(!kgsl_pwrctrl_isenabled(device)); } static int kgsl_pwrctrl_enable(struct kgsl_device *device) { struct kgsl_pwrctrl *pwr = &device->pwrctrl; int level, status; level = pwr->default_pwrlevel; kgsl_pwrctrl_pwrlevel_change(device, level); /* Order pwrrail/clk sequence based upon platform */ status = kgsl_pwrctrl_pwrrail(device, true); if (status) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:390 [MATCH: mutex_lock] --- { struct kgsl_device *device = dev_get_drvdata(dev); struct kgsl_pwrctrl *pwr = &device->pwrctrl; int ret; unsigned int level = 0; ret = kstrtou32(buf, 0, &level); if (ret) return ret; kgsl_mutex_lock(&device->mutex); /* You can't set a maximum power level lower than the minimum */ if (level > pwr->min_pwrlevel) level = pwr->min_pwrlevel; pwr->max_pwrlevel = level; if (device->ftbl->gmu_based_dcvs_pwr_ops(device, level, GPU_PWRLEVEL_OP_MAX_PWRLEVEL)) { /* Update the current level using the new limit */ kgsl_pwrctrl_pwrlevel_change(device, pwr->active_pwrlevel); } kgsl_mutex_unlock(&device->mutex); return count; } static ssize_t max_pwrlevel_show(struct device *dev, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:426 [MATCH: mutex_lock] --- } static void kgsl_pwrctrl_min_pwrlevel_set(struct kgsl_device *device, int level) { struct kgsl_pwrctrl *pwr = &device->pwrctrl; if (level > pwr->min_render_pwrlevel) level = pwr->min_render_pwrlevel; kgsl_mutex_lock(&device->mutex); /* You can't set a minimum power level lower than the maximum */ if (level < pwr->max_pwrlevel) level = pwr->max_pwrlevel; pwr->min_pwrlevel = level; if (device->ftbl->gmu_based_dcvs_pwr_ops(device, level, GPU_PWRLEVEL_OP_MIN_PWRLEVEL)) { /* Update the current level using the new limit */ kgsl_pwrctrl_pwrlevel_change(device, pwr->active_pwrlevel); } kgsl_mutex_unlock(&device->mutex); } static ssize_t min_pwrlevel_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:549 [MATCH: mutex_lock] --- int ret, level; ret = kstrtou32(buf, 0, &val); if (ret) return ret; level = _get_nearest_pwrlevel(pwr, val); if (level < 0) return count; kgsl_mutex_lock(&device->mutex); if (device->ftbl->gmu_based_dcvs_pwr_ops(device, level, GPU_PWRLEVEL_OP_GPUCLK)) kgsl_pwrctrl_pwrlevel_change(device, (unsigned int) level); kgsl_mutex_unlock(&device->mutex); return count; } static ssize_t gpuclk_show(struct device *dev, struct device_attribute *attr, char *buf) { struct kgsl_device *device = dev_get_drvdata(dev); return scnprintf(buf, PAGE_SIZE, "%ld\n", kgsl_pwrctrl_active_freq(&device->pwrctrl)); } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:664 [MATCH: mutex_lock] --- return num_chars; } static ssize_t gpu_clock_stats_show(struct device *dev, struct device_attribute *attr, char *buf) { struct kgsl_device *device = dev_get_drvdata(dev); struct kgsl_pwrctrl *pwr = &device->pwrctrl; int index, num_chars = 0; kgsl_mutex_lock(&device->mutex); kgsl_pwrscale_update_stats(device); kgsl_mutex_unlock(&device->mutex); for (index = 0; index < pwr->num_pwrlevels; index++) num_chars += scnprintf(buf + num_chars, PAGE_SIZE - num_chars, "%llu ", pwr->clock_times[index]); if (num_chars < PAGE_SIZE) buf[num_chars++] = '\n'; return num_chars; } static ssize_t reset_count_show(struct device *dev, struct device_attribute *attr, char *buf) { struct kgsl_device *device = dev_get_drvdata(dev); return scnprintf(buf, PAGE_SIZE, "%d\n", device->reset_counter); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:734 [MATCH: mutex_lock] --- struct kgsl_device *device = dev_get_drvdata(dev); int ret; if (gmu_core_gpmu_isenabled(device)) return -EOPNOTSUPP; ret = kstrtou32(buf, 0, &val); if (ret) return ret; kgsl_mutex_lock(&device->mutex); __force_on(device, flag, val); kgsl_mutex_unlock(&device->mutex); return count; } static ssize_t force_clk_on_show(struct device *dev, struct device_attribute *attr, char *buf) { return __force_on_show(dev, attr, buf, KGSL_PWRFLAGS_CLK_ON); } static ssize_t force_clk_on_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { return __force_on_store(dev, attr, buf, count, KGSL_PWRFLAGS_CLK_ON); } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:819 [MATCH: mutex_lock] --- struct kgsl_device *device = dev_get_drvdata(dev); int ret; ret = kstrtou32(buf, 0, &val); if (ret) return ret; if (!device->host_based_dcvs || !kgsl_is_msm_adreno_tz_governor(device)) return count; kgsl_mutex_lock(&device->mutex); device->pwrctrl.bus_control = val ? true : false; kgsl_mutex_unlock(&device->mutex); return count; } static ssize_t default_pwrlevel_show(struct device *dev, struct device_attribute *attr, char *buf) { struct kgsl_device *device = dev_get_drvdata(dev); return scnprintf(buf, PAGE_SIZE, "%d\n", device->pwrctrl.default_pwrlevel); } static ssize_t default_pwrlevel_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:855 [MATCH: mutex_lock] --- ret = kstrtou32(buf, 0, &level); if (ret) return ret; if (level >= pwr->num_pwrlevels) return count; if (pwr->default_pwrlevel == level) return count; kgsl_mutex_lock(&device->mutex); /* * If GMU based DCVS is enabled, mark the DCVS table for update and force * a coldboot for the next boot so that the updated default pwrlevel is * send to GMU */ if (!device->host_based_dcvs) { pwr->update_dcvs_table = true; pwr->default_pwrlevel = level; gmu_core_mark_for_coldboot(device); } else { pwr->default_pwrlevel = level; pwrscale->gpu_profile.profile.initial_freq = pwr->pwrlevels[level].gpu_freq; } kgsl_mutex_unlock(&device->mutex); return count; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:1107 [MATCH: mutex_lock] --- const char *buf, size_t count) { struct kgsl_device *device = dev_get_drvdata(dev); int ret; unsigned int enable = 0; ret = kstrtou32(buf, 0, &enable); if (ret) return ret; kgsl_mutex_lock(&device->mutex); if (device->ftbl->gmu_based_dcvs_pwr_ops(device, enable, GPU_PWRLEVEL_OP_DCVS_ENABLE)) { if (enable) kgsl_pwrscale_governor_enable(device); else kgsl_pwrscale_governor_disable(device, false); } kgsl_mutex_unlock(&device->mutex); return count; } static ssize_t pwrscale_show(struct device *dev, struct device_attribute *attr, char *buf) { struct kgsl_device *device = dev_get_drvdata(dev); struct kgsl_pwrscale *psc = &device->pwrscale; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:1983 [MATCH: mutex_lock] --- return NOTIFY_OK; pwr->pmqos_max_pwrlevel = level; trace_kgsl_thermal_constraint(max_freq); /* Apply the constraints only if first boot is done */ if (!device->ftbl->is_first_boot_done(device)) return NOTIFY_OK; kgsl_mutex_lock(&device->mutex); if (!device->ftbl->gmu_based_dcvs_pwr_ops(device, 0, GPU_PWRLEVEL_OP_THERMAL)) goto done; /* If RT hint is active, send thermal constraint to GMU */ if (pwr->rt_pwrlevel_hint != INVALID_DCVS_IDX) device->ftbl->set_thermal_index(device); /* Update the current level using the new limit */ kgsl_pwrctrl_pwrlevel_change(device, pwr->active_pwrlevel); done: kgsl_mutex_unlock(&device->mutex); return NOTIFY_OK; } static void kgsl_set_thermal_constraint(struct kthread_work *work) { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:2005 [MATCH: mutex_lock] --- done: kgsl_mutex_unlock(&device->mutex); return NOTIFY_OK; } static void kgsl_set_thermal_constraint(struct kthread_work *work) { struct kgsl_pwrctrl *pwr = container_of(work, struct kgsl_pwrctrl, cooling_work); struct kgsl_device *device = container_of(pwr, struct kgsl_device, pwrctrl); kgsl_mutex_lock(&device->mutex); if (!device->ftbl->gmu_based_dcvs_pwr_ops(device, 0, GPU_PWRLEVEL_OP_THERMAL)) goto done; /* If RT hint is active, send thermal constraint to GMU */ if (pwr->rt_pwrlevel_hint != INVALID_DCVS_IDX) device->ftbl->set_thermal_index(device); /* Update the current level using the new limit */ if (device->state == KGSL_STATE_ACTIVE) kgsl_pwrctrl_pwrlevel_change(device, pwr->active_pwrlevel); done: kgsl_mutex_unlock(&device->mutex); } static int kgsl_cooling_get_max_state(struct thermal_cooling_device *cooling_dev, unsigned long *state) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:2317 [MATCH: mutex_lock] --- pwr->gmu_mx_pd = NULL; } void kgsl_idle_check(struct work_struct *work) { struct kgsl_device *device = container_of(work, struct kgsl_device, idle_check_ws); int ret = 0; unsigned int requested_state; kgsl_mutex_lock(&device->mutex); /* * After scheduling idle work for transitioning to SLUMBER, it's * possbile that requested state can change to NONE if any new workload * comes before kgsl_idle_check is executed or it gets the device mutex. * In such case, no need to change state to NONE. */ if (device->requested_state == KGSL_STATE_NONE) { kgsl_mutex_unlock(&device->mutex); return; } requested_state = device->requested_state; if (device->state == KGSL_STATE_ACTIVE) { if (!atomic_read(&device->active_cnt)) { spin_lock(&device->submit_lock); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:2795 [MATCH: mutex_lock] --- if (WARN_ON(!kgsl_mutex_is_locked(&device->mutex))) return -EINVAL; while (atomic_read(&device->active_cnt) > count) { long ret; kgsl_mutex_unlock(&device->mutex); ret = wait_event_timeout(device->active_cnt_wq, _check_active_count(device, count), wait_jiffies); kgsl_mutex_lock(&device->mutex); result = ret == 0 ? -ETIMEDOUT : 0; if (!result) wait_jiffies = ret; else break; } return result; } /** * kgsl_pwrctrl_set_default_gpu_pwrlevel() - Set GPU to default power level * @device: Pointer to the kgsl_device struct */ static int kgsl_pwrctrl_set_default_gpu_pwrlevel(struct kgsl_device *device) { struct kgsl_pwrctrl *pwr = &device->pwrctrl; unsigned int new_level = pwr->default_pwrlevel; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:2888 [MATCH: mutex_lock] --- int i; if (!device) return -ENODEV; pwr = &device->pwrctrl; if (!stats || (numfreq < pwr->num_pwrlevels)) return -EINVAL; kgsl_mutex_lock(&device->mutex); kgsl_pwrscale_update_stats(device); for (i = 0; i < pwr->num_pwrlevels; i++) { stats[i].freq = pwr->pwrlevels[i].gpu_freq; stats[i].active_time = pwr->clock_times[i]; stats[i].idle_time = pwr->time_in_pwrlevel[i] - pwr->clock_times[i]; } kgsl_mutex_unlock(&device->mutex); return 0; } EXPORT_SYMBOL(kgsl_gpu_stat); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:403 [MATCH: mutex_unlock] --- if (level > pwr->min_pwrlevel) level = pwr->min_pwrlevel; pwr->max_pwrlevel = level; if (device->ftbl->gmu_based_dcvs_pwr_ops(device, level, GPU_PWRLEVEL_OP_MAX_PWRLEVEL)) { /* Update the current level using the new limit */ kgsl_pwrctrl_pwrlevel_change(device, pwr->active_pwrlevel); } kgsl_mutex_unlock(&device->mutex); return count; } static ssize_t max_pwrlevel_show(struct device *dev, struct device_attribute *attr, char *buf) { struct kgsl_device *device = dev_get_drvdata(dev); struct kgsl_pwrctrl *pwr = &device->pwrctrl; return scnprintf(buf, PAGE_SIZE, "%u\n", pwr->max_pwrlevel); } static void kgsl_pwrctrl_min_pwrlevel_set(struct kgsl_device *device, int level) { struct kgsl_pwrctrl *pwr = &device->pwrctrl; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:439 [MATCH: mutex_unlock] --- if (level < pwr->max_pwrlevel) level = pwr->max_pwrlevel; pwr->min_pwrlevel = level; if (device->ftbl->gmu_based_dcvs_pwr_ops(device, level, GPU_PWRLEVEL_OP_MIN_PWRLEVEL)) { /* Update the current level using the new limit */ kgsl_pwrctrl_pwrlevel_change(device, pwr->active_pwrlevel); } kgsl_mutex_unlock(&device->mutex); } static ssize_t min_pwrlevel_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct kgsl_device *device = dev_get_drvdata(dev); int ret; unsigned int level = 0; ret = kstrtou32(buf, 0, &level); if (ret) return ret; kgsl_pwrctrl_min_pwrlevel_set(device, level); return count; } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:554 [MATCH: mutex_unlock] --- level = _get_nearest_pwrlevel(pwr, val); if (level < 0) return count; kgsl_mutex_lock(&device->mutex); if (device->ftbl->gmu_based_dcvs_pwr_ops(device, level, GPU_PWRLEVEL_OP_GPUCLK)) kgsl_pwrctrl_pwrlevel_change(device, (unsigned int) level); kgsl_mutex_unlock(&device->mutex); return count; } static ssize_t gpuclk_show(struct device *dev, struct device_attribute *attr, char *buf) { struct kgsl_device *device = dev_get_drvdata(dev); return scnprintf(buf, PAGE_SIZE, "%ld\n", kgsl_pwrctrl_active_freq(&device->pwrctrl)); } static ssize_t idle_timer_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { unsigned int val = 0; struct kgsl_device *device = dev_get_drvdata(dev); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:666 [MATCH: mutex_unlock] --- static ssize_t gpu_clock_stats_show(struct device *dev, struct device_attribute *attr, char *buf) { struct kgsl_device *device = dev_get_drvdata(dev); struct kgsl_pwrctrl *pwr = &device->pwrctrl; int index, num_chars = 0; kgsl_mutex_lock(&device->mutex); kgsl_pwrscale_update_stats(device); kgsl_mutex_unlock(&device->mutex); for (index = 0; index < pwr->num_pwrlevels; index++) num_chars += scnprintf(buf + num_chars, PAGE_SIZE - num_chars, "%llu ", pwr->clock_times[index]); if (num_chars < PAGE_SIZE) buf[num_chars++] = '\n'; return num_chars; } static ssize_t reset_count_show(struct device *dev, struct device_attribute *attr, char *buf) { struct kgsl_device *device = dev_get_drvdata(dev); return scnprintf(buf, PAGE_SIZE, "%d\n", device->reset_counter); } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:736 [MATCH: mutex_unlock] --- if (gmu_core_gpmu_isenabled(device)) return -EOPNOTSUPP; ret = kstrtou32(buf, 0, &val); if (ret) return ret; kgsl_mutex_lock(&device->mutex); __force_on(device, flag, val); kgsl_mutex_unlock(&device->mutex); return count; } static ssize_t force_clk_on_show(struct device *dev, struct device_attribute *attr, char *buf) { return __force_on_show(dev, attr, buf, KGSL_PWRFLAGS_CLK_ON); } static ssize_t force_clk_on_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { return __force_on_store(dev, attr, buf, count, KGSL_PWRFLAGS_CLK_ON); } static ssize_t force_bus_on_show(struct device *dev, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:821 [MATCH: mutex_unlock] --- ret = kstrtou32(buf, 0, &val); if (ret) return ret; if (!device->host_based_dcvs || !kgsl_is_msm_adreno_tz_governor(device)) return count; kgsl_mutex_lock(&device->mutex); device->pwrctrl.bus_control = val ? true : false; kgsl_mutex_unlock(&device->mutex); return count; } static ssize_t default_pwrlevel_show(struct device *dev, struct device_attribute *attr, char *buf) { struct kgsl_device *device = dev_get_drvdata(dev); return scnprintf(buf, PAGE_SIZE, "%d\n", device->pwrctrl.default_pwrlevel); } static ssize_t default_pwrlevel_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct kgsl_device *device = dev_get_drvdata(dev); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:872 [MATCH: mutex_unlock] --- if (!device->host_based_dcvs) { pwr->update_dcvs_table = true; pwr->default_pwrlevel = level; gmu_core_mark_for_coldboot(device); } else { pwr->default_pwrlevel = level; pwrscale->gpu_profile.profile.initial_freq = pwr->pwrlevels[level].gpu_freq; } kgsl_mutex_unlock(&device->mutex); return count; } static ssize_t popp_show(struct device *dev, struct device_attribute *attr, char *buf) { /* POPP is deprecated, so return it as always disabled */ return scnprintf(buf, PAGE_SIZE, "0\n"); } static ssize_t _gpu_busy_show(struct kgsl_device *device, char *buf) { int ret; struct kgsl_clk_stats *stats = &device->pwrctrl.clk_stats; struct kgsl_pwrctrl *pwr = &device->pwrctrl; unsigned int busy_percent = 0; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:1116 [MATCH: mutex_unlock] --- kgsl_mutex_lock(&device->mutex); if (device->ftbl->gmu_based_dcvs_pwr_ops(device, enable, GPU_PWRLEVEL_OP_DCVS_ENABLE)) { if (enable) kgsl_pwrscale_governor_enable(device); else kgsl_pwrscale_governor_disable(device, false); } kgsl_mutex_unlock(&device->mutex); return count; } static ssize_t pwrscale_show(struct device *dev, struct device_attribute *attr, char *buf) { struct kgsl_device *device = dev_get_drvdata(dev); struct kgsl_pwrscale *psc = &device->pwrscale; struct gmu_core_device *gmu_core = &device->gmu_core; if (device->host_based_dcvs) return scnprintf(buf, PAGE_SIZE, "%u\n", psc->enabled); else return scnprintf(buf, PAGE_SIZE, "%u\n", (u32)gmu_core->gpu_pwrscale_enable); } static DEVICE_ATTR_RO(temp); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:1996 [MATCH: mutex_unlock] --- goto done; /* If RT hint is active, send thermal constraint to GMU */ if (pwr->rt_pwrlevel_hint != INVALID_DCVS_IDX) device->ftbl->set_thermal_index(device); /* Update the current level using the new limit */ kgsl_pwrctrl_pwrlevel_change(device, pwr->active_pwrlevel); done: kgsl_mutex_unlock(&device->mutex); return NOTIFY_OK; } static void kgsl_set_thermal_constraint(struct kthread_work *work) { struct kgsl_pwrctrl *pwr = container_of(work, struct kgsl_pwrctrl, cooling_work); struct kgsl_device *device = container_of(pwr, struct kgsl_device, pwrctrl); kgsl_mutex_lock(&device->mutex); if (!device->ftbl->gmu_based_dcvs_pwr_ops(device, 0, GPU_PWRLEVEL_OP_THERMAL)) goto done; /* If RT hint is active, send thermal constraint to GMU */ if (pwr->rt_pwrlevel_hint != INVALID_DCVS_IDX) device->ftbl->set_thermal_index(device); /* Update the current level using the new limit */ --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:2019 [MATCH: mutex_unlock] --- /* If RT hint is active, send thermal constraint to GMU */ if (pwr->rt_pwrlevel_hint != INVALID_DCVS_IDX) device->ftbl->set_thermal_index(device); /* Update the current level using the new limit */ if (device->state == KGSL_STATE_ACTIVE) kgsl_pwrctrl_pwrlevel_change(device, pwr->active_pwrlevel); done: kgsl_mutex_unlock(&device->mutex); } static int kgsl_cooling_get_max_state(struct thermal_cooling_device *cooling_dev, unsigned long *state) { struct kgsl_device *device = cooling_dev->devdata; *state = device->pwrctrl.num_pwrlevels - 1; return 0; } static int kgsl_cooling_get_cur_state(struct thermal_cooling_device *cooling_dev, unsigned long *state) { struct kgsl_device *device = cooling_dev->devdata; struct kgsl_pwrctrl *pwr = &device->pwrctrl; *state = READ_ONCE(pwr->thermal_pwrlevel); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:2326 [MATCH: mutex_unlock] --- kgsl_mutex_lock(&device->mutex); /* * After scheduling idle work for transitioning to SLUMBER, it's * possbile that requested state can change to NONE if any new workload * comes before kgsl_idle_check is executed or it gets the device mutex. * In such case, no need to change state to NONE. */ if (device->requested_state == KGSL_STATE_NONE) { kgsl_mutex_unlock(&device->mutex); return; } requested_state = device->requested_state; if (device->state == KGSL_STATE_ACTIVE) { if (!atomic_read(&device->active_cnt)) { spin_lock(&device->submit_lock); if (device->submit_now) { spin_unlock(&device->submit_lock); goto done; } /* Don't allow GPU inline submission in SLUMBER */ if (requested_state == KGSL_STATE_SLUMBER) device->skip_inline_submit = true; spin_unlock(&device->submit_lock); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:2372 [MATCH: mutex_unlock] --- } done: if (!ret) kgsl_pwrctrl_request_state(device, KGSL_STATE_NONE); if (device->state == KGSL_STATE_ACTIVE) kgsl_start_idle_timer(device); } kgsl_pwrscale_update(device); kgsl_mutex_unlock(&device->mutex); } void kgsl_timer(struct timer_list *t) { struct kgsl_device *device = kgsl_timer_container_of(device, t, idle_timer); if (device->requested_state != KGSL_STATE_SUSPEND) { kgsl_pwrctrl_request_state(device, KGSL_STATE_SLUMBER); /* Have work run in a non-interrupt context. */ kgsl_schedule_work(&device->idle_check_ws); } } static bool kgsl_pwrctrl_isenabled(struct kgsl_device *device) { struct kgsl_pwrctrl *pwr = &device->pwrctrl; return ((test_bit(KGSL_PWRFLAGS_CLK_ON, &pwr->power_flags) != 0) && --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:2792 [MATCH: mutex_unlock] --- unsigned long wait_jiffies) { int result = 0; if (WARN_ON(!kgsl_mutex_is_locked(&device->mutex))) return -EINVAL; while (atomic_read(&device->active_cnt) > count) { long ret; kgsl_mutex_unlock(&device->mutex); ret = wait_event_timeout(device->active_cnt_wq, _check_active_count(device, count), wait_jiffies); kgsl_mutex_lock(&device->mutex); result = ret == 0 ? -ETIMEDOUT : 0; if (!result) wait_jiffies = ret; else break; } return result; } /** * kgsl_pwrctrl_set_default_gpu_pwrlevel() - Set GPU to default power level * @device: Pointer to the kgsl_device struct */ static int kgsl_pwrctrl_set_default_gpu_pwrlevel(struct kgsl_device *device) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:2896 [MATCH: mutex_unlock] --- return -EINVAL; kgsl_mutex_lock(&device->mutex); kgsl_pwrscale_update_stats(device); for (i = 0; i < pwr->num_pwrlevels; i++) { stats[i].freq = pwr->pwrlevels[i].gpu_freq; stats[i].active_time = pwr->clock_times[i]; stats[i].idle_time = pwr->time_in_pwrlevel[i] - pwr->clock_times[i]; } kgsl_mutex_unlock(&device->mutex); return 0; } EXPORT_SYMBOL(kgsl_gpu_stat); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:629 [MATCH: spin_lock] --- int ret; struct kgsl_device *device = dev_get_drvdata(dev); struct kgsl_clk_stats *stats = &device->pwrctrl.clk_stats; struct kgsl_pwrctrl *pwr = &device->pwrctrl; ret = scnprintf(buf, PAGE_SIZE, "%7d %7d\n", stats->busy_old, stats->total_old); /* Reset the stats if GPU is OFF */ if ((atomic_read(&device->active_cnt) == 0)) { spin_lock(&pwr->stats_lock); stats->busy_old = 0; stats->total_old = 0; spin_unlock(&pwr->stats_lock); } return ret; } static ssize_t gpu_available_frequencies_show(struct device *dev, struct device_attribute *attr, char *buf) { struct kgsl_device *device = dev_get_drvdata(dev); struct kgsl_pwrctrl *pwr = &device->pwrctrl; int index, num_chars = 0; for (index = 0; index < pwr->num_pwrlevels; index++) { num_chars += scnprintf(buf + num_chars, PAGE_SIZE - num_chars - 1, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:899 [MATCH: spin_lock] --- struct kgsl_pwrctrl *pwr = &device->pwrctrl; unsigned int busy_percent = 0; if (stats->total_old != 0) busy_percent = (stats->busy_old * 100) / stats->total_old; ret = scnprintf(buf, PAGE_SIZE, "%d %%\n", busy_percent); /* Reset the stats if GPU is OFF */ if ((atomic_read(&device->active_cnt) == 0)) { spin_lock(&pwr->stats_lock); stats->busy_old = 0; stats->total_old = 0; spin_unlock(&pwr->stats_lock); } return ret; } static ssize_t gpu_busy_percentage_show(struct device *dev, struct device_attribute *attr, char *buf) { struct kgsl_device *device = dev_get_drvdata(dev); return _gpu_busy_show(device, buf); } static ssize_t _min_clock_mhz_show(struct kgsl_device *device, char *buf) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:1241 [MATCH: spin_lock] --- { struct kgsl_clk_stats *stats = &device->pwrctrl.clk_stats; struct kgsl_pwrctrl *pwr = &device->pwrctrl; stats->total += time; stats->busy += busy; if (stats->total < UPDATE_BUSY_VAL) return; spin_lock(&pwr->stats_lock); /* Update the output regularly and reset the counters. */ stats->total_old = stats->total; stats->busy_old = stats->busy; stats->total = 0; stats->busy = 0; spin_unlock(&pwr->stats_lock); trace_kgsl_gpubusy(device, stats->busy_old, stats->total_old, ticks); } static void kgsl_pwrctrl_clk(struct kgsl_device *device, bool state, int requested_state) { struct kgsl_pwrctrl *pwr = &device->pwrctrl; int i = 0; if (gmu_core_gpmu_isenabled(device)) return; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:2139 [MATCH: spin_lock] --- "qcom,gpu-bimc-interface-clk-freq", &pwr->gpu_bimc_int_clk_freq)) pwr->gpu_bimc_int_clk = devm_clk_get(&pdev->dev, "bimc_gpu_clk"); if (pwr->num_pwrlevels == 0) { dev_err(device->dev, "No power levels are defined\n"); return -EINVAL; } spin_lock_init(&pwr->stats_lock); init_waitqueue_head(&device->active_cnt_wq); for (i = 0; i < pwr->num_pwrlevels; i++) { freq = pwr->pwrlevels[i].gpu_freq; if (freq > 0) freq = clk_round_rate(pwr->grp_clks[0], freq); if (freq >= pwr->pwrlevels[i].gpu_freq) pwr->pwrlevels[i].gpu_freq = freq; } clk_set_rate(pwr->grp_clks[0], pwr->pwrlevels[pwr->num_pwrlevels - 1].gpu_freq); freq = clk_round_rate(pwr->grp_clks[6], KGSL_XO_CLK_FREQ); if (freq > 0) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:2335 [MATCH: spin_lock] --- if (device->requested_state == KGSL_STATE_NONE) { kgsl_mutex_unlock(&device->mutex); return; } requested_state = device->requested_state; if (device->state == KGSL_STATE_ACTIVE) { if (!atomic_read(&device->active_cnt)) { spin_lock(&device->submit_lock); if (device->submit_now) { spin_unlock(&device->submit_lock); goto done; } /* Don't allow GPU inline submission in SLUMBER */ if (requested_state == KGSL_STATE_SLUMBER) device->skip_inline_submit = true; spin_unlock(&device->submit_lock); ret = kgsl_pwrctrl_change_state(device, device->requested_state); if (ret == -EBUSY) { if (requested_state == KGSL_STATE_SLUMBER) { spin_lock(&device->submit_lock); device->skip_inline_submit = false; spin_unlock(&device->submit_lock); } /* --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:2349 [MATCH: spin_lock] --- } /* Don't allow GPU inline submission in SLUMBER */ if (requested_state == KGSL_STATE_SLUMBER) device->skip_inline_submit = true; spin_unlock(&device->submit_lock); ret = kgsl_pwrctrl_change_state(device, device->requested_state); if (ret == -EBUSY) { if (requested_state == KGSL_STATE_SLUMBER) { spin_lock(&device->submit_lock); device->skip_inline_submit = false; spin_unlock(&device->submit_lock); } /* * If the GPU is currently busy, restore * the requested state and reschedule * idle work. */ kgsl_pwrctrl_request_state(device, requested_state); kgsl_schedule_work(&device->idle_check_ws); } } done: if (!ret) kgsl_pwrctrl_request_state(device, KGSL_STATE_NONE); if (device->state == KGSL_STATE_ACTIVE) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:2738 [MATCH: spin_lock] --- void kgsl_pwrctrl_set_state(struct kgsl_device *device, unsigned int state) { trace_kgsl_pwr_set_state(device, state); device->state = state; device->requested_state = KGSL_STATE_NONE; if (state == KGSL_STATE_SLUMBER) device->pwrctrl.wake_on_touch = false; spin_lock(&device->submit_lock); if (state == KGSL_STATE_ACTIVE) device->skip_inline_submit = false; else device->skip_inline_submit = true; spin_unlock(&device->submit_lock); } void kgsl_pwrctrl_request_state(struct kgsl_device *device, unsigned int state) { if (state != KGSL_STATE_NONE && state != device->requested_state) trace_kgsl_pwr_request_state(device, state); device->requested_state = state; } const char *kgsl_pwrstate_to_str(unsigned int state) { switch (state) { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:632 [MATCH: spin_unlock] --- struct kgsl_pwrctrl *pwr = &device->pwrctrl; ret = scnprintf(buf, PAGE_SIZE, "%7d %7d\n", stats->busy_old, stats->total_old); /* Reset the stats if GPU is OFF */ if ((atomic_read(&device->active_cnt) == 0)) { spin_lock(&pwr->stats_lock); stats->busy_old = 0; stats->total_old = 0; spin_unlock(&pwr->stats_lock); } return ret; } static ssize_t gpu_available_frequencies_show(struct device *dev, struct device_attribute *attr, char *buf) { struct kgsl_device *device = dev_get_drvdata(dev); struct kgsl_pwrctrl *pwr = &device->pwrctrl; int index, num_chars = 0; for (index = 0; index < pwr->num_pwrlevels; index++) { num_chars += scnprintf(buf + num_chars, PAGE_SIZE - num_chars - 1, "%d ", pwr->pwrlevels[index].gpu_freq); /* One space for trailing null and another for the newline */ if (num_chars >= PAGE_SIZE - 2) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:902 [MATCH: spin_unlock] --- if (stats->total_old != 0) busy_percent = (stats->busy_old * 100) / stats->total_old; ret = scnprintf(buf, PAGE_SIZE, "%d %%\n", busy_percent); /* Reset the stats if GPU is OFF */ if ((atomic_read(&device->active_cnt) == 0)) { spin_lock(&pwr->stats_lock); stats->busy_old = 0; stats->total_old = 0; spin_unlock(&pwr->stats_lock); } return ret; } static ssize_t gpu_busy_percentage_show(struct device *dev, struct device_attribute *attr, char *buf) { struct kgsl_device *device = dev_get_drvdata(dev); return _gpu_busy_show(device, buf); } static ssize_t _min_clock_mhz_show(struct kgsl_device *device, char *buf) { struct kgsl_pwrctrl *pwr = &device->pwrctrl; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:1247 [MATCH: spin_unlock] --- if (stats->total < UPDATE_BUSY_VAL) return; spin_lock(&pwr->stats_lock); /* Update the output regularly and reset the counters. */ stats->total_old = stats->total; stats->busy_old = stats->busy; stats->total = 0; stats->busy = 0; spin_unlock(&pwr->stats_lock); trace_kgsl_gpubusy(device, stats->busy_old, stats->total_old, ticks); } static void kgsl_pwrctrl_clk(struct kgsl_device *device, bool state, int requested_state) { struct kgsl_pwrctrl *pwr = &device->pwrctrl; int i = 0; if (gmu_core_gpmu_isenabled(device)) return; if (test_bit(KGSL_PWRFLAGS_CLK_ON, &pwr->ctrl_flags)) return; if (!state) { if (test_and_clear_bit(KGSL_PWRFLAGS_CLK_ON, &pwr->power_flags)) { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:2337 [MATCH: spin_unlock] --- return; } requested_state = device->requested_state; if (device->state == KGSL_STATE_ACTIVE) { if (!atomic_read(&device->active_cnt)) { spin_lock(&device->submit_lock); if (device->submit_now) { spin_unlock(&device->submit_lock); goto done; } /* Don't allow GPU inline submission in SLUMBER */ if (requested_state == KGSL_STATE_SLUMBER) device->skip_inline_submit = true; spin_unlock(&device->submit_lock); ret = kgsl_pwrctrl_change_state(device, device->requested_state); if (ret == -EBUSY) { if (requested_state == KGSL_STATE_SLUMBER) { spin_lock(&device->submit_lock); device->skip_inline_submit = false; spin_unlock(&device->submit_lock); } /* * If the GPU is currently busy, restore * the requested state and reschedule --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:2343 [MATCH: spin_unlock] --- if (!atomic_read(&device->active_cnt)) { spin_lock(&device->submit_lock); if (device->submit_now) { spin_unlock(&device->submit_lock); goto done; } /* Don't allow GPU inline submission in SLUMBER */ if (requested_state == KGSL_STATE_SLUMBER) device->skip_inline_submit = true; spin_unlock(&device->submit_lock); ret = kgsl_pwrctrl_change_state(device, device->requested_state); if (ret == -EBUSY) { if (requested_state == KGSL_STATE_SLUMBER) { spin_lock(&device->submit_lock); device->skip_inline_submit = false; spin_unlock(&device->submit_lock); } /* * If the GPU is currently busy, restore * the requested state and reschedule * idle work. */ kgsl_pwrctrl_request_state(device, requested_state); kgsl_schedule_work(&device->idle_check_ws); } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:2351 [MATCH: spin_unlock] --- if (requested_state == KGSL_STATE_SLUMBER) device->skip_inline_submit = true; spin_unlock(&device->submit_lock); ret = kgsl_pwrctrl_change_state(device, device->requested_state); if (ret == -EBUSY) { if (requested_state == KGSL_STATE_SLUMBER) { spin_lock(&device->submit_lock); device->skip_inline_submit = false; spin_unlock(&device->submit_lock); } /* * If the GPU is currently busy, restore * the requested state and reschedule * idle work. */ kgsl_pwrctrl_request_state(device, requested_state); kgsl_schedule_work(&device->idle_check_ws); } } done: if (!ret) kgsl_pwrctrl_request_state(device, KGSL_STATE_NONE); if (device->state == KGSL_STATE_ACTIVE) kgsl_start_idle_timer(device); } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c:2743 [MATCH: spin_unlock] --- device->requested_state = KGSL_STATE_NONE; if (state == KGSL_STATE_SLUMBER) device->pwrctrl.wake_on_touch = false; spin_lock(&device->submit_lock); if (state == KGSL_STATE_ACTIVE) device->skip_inline_submit = false; else device->skip_inline_submit = true; spin_unlock(&device->submit_lock); } void kgsl_pwrctrl_request_state(struct kgsl_device *device, unsigned int state) { if (state != KGSL_STATE_NONE && state != device->requested_state) trace_kgsl_pwr_request_state(device, state); device->requested_state = state; } const char *kgsl_pwrstate_to_str(unsigned int state) { switch (state) { case KGSL_STATE_NONE: return "NONE"; case KGSL_STATE_INIT: return "INIT"; case KGSL_STATE_AWARE: --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.h:95 [MATCH: timeout] --- * @pwrlevels - List of supported power levels * @active_pwrlevel - The currently active power level * @previous_pwrlevel - The power level before transition * @thermal_pwrlevel - maximum powerlevel constraint from thermal * @default_pwrlevel - device wake up power level * @max_pwrlevel - maximum allowable powerlevel per the user * @min_pwrlevel - minimum allowable powerlevel per the user * @min_render_pwrlevel - minimum allowable powerlevel for rendering * @num_pwrlevels - number of available power levels * @throttle_mask - LM throttle mask * @interval_timeout - timeout to be idle before a power event * @clock_times - Each GPU frequency's accumulated active time in us * @clk_stats - structure of clock statistics * @input_disable - To disable GPU wakeup on touch input event * @bus_control - true if the bus calculation is independent * @bus_mod - modifier from the current power level for the bus vote * @bus_percent_ab - current percent of total possible bus usage * @bus_width - target specific bus width in number of bytes * @bus_ab_mbytes - AB vote in Mbytes for current bus usage * @constraint - currently active power constraint * @superfast - Boolean flag to indicate that the GPU start should be run in the * higher priority thread * isense_clk_indx - index of isense clock, 0 if no isense * isense_clk_on_level - isense clock rate is XO rate below this level. */ struct kgsl_pwrctrl { int interrupt_num; struct clk *grp_clks[KGSL_MAX_CLKS]; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.h:158 [MATCH: timeout] --- struct kgsl_pwrlevel pwrlevels[KGSL_MAX_PWRLEVELS]; unsigned int active_pwrlevel; unsigned int previous_pwrlevel; unsigned int thermal_pwrlevel; unsigned int default_pwrlevel; unsigned int max_pwrlevel; unsigned int min_pwrlevel; unsigned int min_render_pwrlevel; unsigned int num_pwrlevels; unsigned int throttle_mask; atomic64_t interval_timeout; u64 clock_times[KGSL_MAX_PWRLEVELS]; /** @thermal_time: Time in usecs the GPU is limited by thermal constraints */ u64 thermal_time; struct kgsl_clk_stats clk_stats; bool bus_control; int bus_mod; unsigned int bus_percent_ab; unsigned int bus_width; unsigned long bus_ab_mbytes; /** @ddr_table: List of the DDR bandwidths in KBps for the target */ u32 *ddr_table; /** @ddr_table_count: Number of objects in @ddr_table */ int ddr_table_count; /** cur_buslevel: The last buslevel voted by the driver */ int cur_buslevel; /** @bus_max: The maximum bandwidth available to the device */ unsigned long bus_max; struct kgsl_pwr_constraint constraint; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.h:378 [MATCH: timeout] --- u32 kgsl_pwrctrl_get_acv_perfmode_lvl(struct kgsl_device *device, u32 ddr_freq); /** * kgsl_pwrctrl_setup_default_votes - Set up default power level and bandwidth vote * @device: Pointer to the kgsl device * * Return: 0 on success or a negative error code on failure. */ int kgsl_pwrctrl_setup_default_votes(struct kgsl_device *device); static int kgsl_regulator_disable_wait(struct regulator *reg, u32 timeout); /** * kgsl_pwrctrl_probe_mx_gdsc - Probe mx gdsc * @device: Pointer to the kgsl device * @pdev: Pointer to the platform device * * Return: 0 on success or negative error on failure */ int kgsl_pwrctrl_probe_mx_gdsc(struct kgsl_device *device, struct platform_device *pdev); /** * kgsl_pwrctrl_enable_mx_gdsc - Enable mx gdsc * @device: Pointer to the kgsl device * * Return: 0 on success or negative error on failure */ int kgsl_pwrctrl_enable_mx_gdsc(struct kgsl_device *device); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrscale.c:103 [MATCH: results] --- KGSL_GOVERNOR_CALL_INTERVAL); /* to call devfreq_resume_device() from a kernel thread */ queue_work(psc->devfreq_wq, &psc->devfreq_resume_ws); } /** * kgsl_pwrscale_update_stats() - update device busy statistics * @device: The device * * Read hardware busy counters and accumulate the results. */ void kgsl_pwrscale_update_stats(struct kgsl_device *device) { struct kgsl_pwrctrl *pwrctrl = &device->pwrctrl; struct kgsl_pwrscale *psc = &device->pwrscale; if (WARN_ON(!kgsl_mutex_is_locked(&device->mutex))) return; if (!psc->enabled) return; if (device->state == KGSL_STATE_ACTIVE) { struct kgsl_power_stats stats; ktime_t cur_time = ktime_get(); device->ftbl->power_stats(device, &stats); device->pwrscale.accum_stats.busy_time += stats.busy_time; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrscale.c:257 [MATCH: mutex_lock] --- * be set to true after successfully starting the governor. */ if (!pwrscale->enabled) return 0; return -EPROTO; } pwr = &device->pwrctrl; rec_freq = *freq; kgsl_mutex_lock(&device->mutex); cur_freq = kgsl_pwrctrl_active_freq(pwr); level = pwr->active_pwrlevel; /* If the governor recommends a new frequency, update it here */ if (rec_freq != cur_freq) { for (i = 0; i < pwr->num_pwrlevels; i++) if (rec_freq == pwr->pwrlevels[i].gpu_freq) { level = i; break; } if (level != pwr->active_pwrlevel) kgsl_pwrctrl_pwrlevel_change(device, level); } *freq = kgsl_pwrctrl_active_freq(pwr); kgsl_mutex_unlock(&device->mutex); return 0; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrscale.c:316 [MATCH: mutex_lock] --- * and before we have a chance to suspend. * To add and start simple_ondemand governor successfully during * probe, return 0 when we reach here. pwrscale->enabled will * be set to true after successfully starting the governor. */ if (!pwrscale->enabled) return 0; return -EPROTO; } kgsl_mutex_lock(&device->mutex); tmp1 = ktime_get(); /* * If the GPU clock is on grab the latest power counter * values. Otherwise the most recent ACTIVE values will * already be stored in accum_stats. */ kgsl_pwrscale_update_stats(device); tmp2 = ktime_get(); stat->total_time = ktime_us_delta(tmp2, pwrscale->time); pwrscale->time = tmp1; stat->busy_time = pwrscale->accum_stats.busy_time; stat->current_frequency = kgsl_pwrctrl_active_freq(&device->pwrctrl); stat->private_data = &device->active_context_count; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrscale.c:400 [MATCH: mutex_lock] --- * devfreq_add_device. * To add and start performance governor successfully during * probe, return 0 when we reach here. pwrscale->enabled will * be set to true after successfully starting the governor. */ if (!pwrscale->enabled) return 0; return -EPROTO; } kgsl_mutex_lock(&device->mutex); *freq = kgsl_pwrctrl_active_freq(&device->pwrctrl); kgsl_mutex_unlock(&device->mutex); return 0; } /* * kgsl_busmon_get_dev_status - devfreq_dev_profile.get_dev_status callback * @dev: see devfreq.h * @freq: see devfreq.h * @flags: see devfreq.h * * This function expects the device mutex to be unlocked. */ static int kgsl_busmon_get_dev_status(struct device *dev, struct devfreq_dev_status *stat) { struct xstats *b; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrscale.c:485 [MATCH: mutex_lock] --- if (!device->pwrscale.enabled) return 0; if (!device->pwrscale.devfreq_enabled) return -EPROTO; pwr = &device->pwrctrl; if (!pwr->bus_control) return 0; kgsl_mutex_lock(&device->mutex); level = pwr->active_pwrlevel; pwr_level = &pwr->pwrlevels[level]; bus_flag = device->pwrscale.bus_profile.flag; device->pwrscale.bus_profile.flag = 0; ab_mbytes = device->pwrscale.bus_profile.ab_mbytes; /* * Bus devfreq governor has calculated its recomendations * when gpu was running with *freq frequency. * If the gpu frequency is different now it's better to * ignore the call */ if (pwr_level->gpu_freq != *freq) { kgsl_mutex_unlock(&device->mutex); return 0; } b = pwr->bus_mod; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrscale.c:995 [MATCH: mutex_lock] --- devfreq_resume_device(pwrscale->devfreqptr); if (pwrscale->bus_devfreq) devfreq_resume_device(pwrscale->bus_devfreq); } static void do_devfreq_notify(struct kthread_work *work) { struct kgsl_pwrscale *pwrscale = container_of(work, struct kgsl_pwrscale, devfreq_notify_work); mutex_lock(&pwrscale->devfreqptr->lock); update_devfreq(pwrscale->devfreqptr); mutex_unlock(&pwrscale->devfreqptr->lock); if (pwrscale->bus_devfreq) { mutex_lock(&pwrscale->bus_devfreq->lock); update_devfreq(pwrscale->bus_devfreq); mutex_unlock(&pwrscale->bus_devfreq->lock); } } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrscale.c:1000 [MATCH: mutex_lock] --- static void do_devfreq_notify(struct kthread_work *work) { struct kgsl_pwrscale *pwrscale = container_of(work, struct kgsl_pwrscale, devfreq_notify_work); mutex_lock(&pwrscale->devfreqptr->lock); update_devfreq(pwrscale->devfreqptr); mutex_unlock(&pwrscale->devfreqptr->lock); if (pwrscale->bus_devfreq) { mutex_lock(&pwrscale->bus_devfreq->lock); update_devfreq(pwrscale->bus_devfreq); mutex_unlock(&pwrscale->bus_devfreq->lock); } } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrscale.c:274 [MATCH: mutex_unlock] --- if (rec_freq == pwr->pwrlevels[i].gpu_freq) { level = i; break; } if (level != pwr->active_pwrlevel) kgsl_pwrctrl_pwrlevel_change(device, level); } *freq = kgsl_pwrctrl_active_freq(pwr); kgsl_mutex_unlock(&device->mutex); return 0; } /* * kgsl_devfreq_get_dev_status - devfreq_dev_profile.get_dev_status callback * @dev: see devfreq.h * @freq: see devfreq.h * @flags: see devfreq.h * * This function expects the device mutex to be unlocked. */ static int kgsl_devfreq_get_dev_status(struct device *dev, struct devfreq_dev_status *stat) { struct kgsl_device *device = dev_get_drvdata(dev); struct kgsl_pwrctrl *pwrctrl; struct kgsl_pwrscale *pwrscale; ktime_t tmp1, tmp2; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrscale.c:363 [MATCH: mutex_unlock] --- pwrlevel = &pwrctrl->pwrlevels[pwrctrl->min_pwrlevel]; last_b->gpu_minfreq = pwrlevel->gpu_freq; } kgsl_pwrctrl_busy_time(device, stat->total_time, stat->busy_time, 0); trace_kgsl_pwrstats(device, stat->total_time, &pwrscale->accum_stats, device->active_context_count, 0); memset(&pwrscale->accum_stats, 0, sizeof(pwrscale->accum_stats)); kgsl_mutex_unlock(&device->mutex); return 0; } /* * kgsl_devfreq_get_cur_freq - devfreq_dev_profile.get_cur_freq callback * @dev: see devfreq.h * @freq: see devfreq.h * @flags: see devfreq.h * * This function expects the device mutex to be unlocked. */ static int kgsl_devfreq_get_cur_freq(struct device *dev, unsigned long *freq) { struct kgsl_device *device = dev_get_drvdata(dev); struct kgsl_pwrscale *pwrscale = &device->pwrscale; if (device == NULL) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrscale.c:402 [MATCH: mutex_unlock] --- * probe, return 0 when we reach here. pwrscale->enabled will * be set to true after successfully starting the governor. */ if (!pwrscale->enabled) return 0; return -EPROTO; } kgsl_mutex_lock(&device->mutex); *freq = kgsl_pwrctrl_active_freq(&device->pwrctrl); kgsl_mutex_unlock(&device->mutex); return 0; } /* * kgsl_busmon_get_dev_status - devfreq_dev_profile.get_dev_status callback * @dev: see devfreq.h * @freq: see devfreq.h * @flags: see devfreq.h * * This function expects the device mutex to be unlocked. */ static int kgsl_busmon_get_dev_status(struct device *dev, struct devfreq_dev_status *stat) { struct xstats *b; struct kgsl_device *device = dev_get_drvdata(dev); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrscale.c:499 [MATCH: mutex_unlock] --- device->pwrscale.bus_profile.flag = 0; ab_mbytes = device->pwrscale.bus_profile.ab_mbytes; /* * Bus devfreq governor has calculated its recomendations * when gpu was running with *freq frequency. * If the gpu frequency is different now it's better to * ignore the call */ if (pwr_level->gpu_freq != *freq) { kgsl_mutex_unlock(&device->mutex); return 0; } b = pwr->bus_mod; pwr->bus_mod += _read_hint(bus_flag); /* trim calculated change to fit range */ if (pwr_level->bus_freq + pwr->bus_mod < pwr_level->bus_min) pwr->bus_mod = -(pwr_level->bus_freq - pwr_level->bus_min); else if (pwr_level->bus_freq + pwr->bus_mod > pwr_level->bus_max) pwr->bus_mod = pwr_level->bus_max - pwr_level->bus_freq; /* Update bus vote if AB or IB is modified */ if ((pwr->bus_mod != b) || (pwr->bus_ab_mbytes != ab_mbytes)) { pwr->bus_percent_ab = device->pwrscale.bus_profile.percent_ab; /* * When gpu is thermally throttled to its lowest power level, * drop GPU's AB vote as a last resort to lower CX voltage and --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrscale.c:531 [MATCH: mutex_unlock] --- */ if ((pwr->thermal_pwrlevel != pwr->num_pwrlevels - 1 && pwr->pmqos_max_pwrlevel != pwr->num_pwrlevels - 1) || pwr->num_pwrlevels == 1) pwr->bus_ab_mbytes = ab_mbytes; else pwr->bus_ab_mbytes = 0; kgsl_bus_update(device, KGSL_BUS_VOTE_ON); } kgsl_mutex_unlock(&device->mutex); return 0; } static int kgsl_busmon_get_cur_freq(struct device *dev, unsigned long *freq) { return 0; } static void busmon_dev_release(struct device *dev) { } static void pwrscale_busmon_create(struct kgsl_device *device, struct platform_device *pdev, unsigned long *table) { struct kgsl_pwrctrl *pwr = &device->pwrctrl; struct kgsl_pwrscale *pwrscale = &device->pwrscale; struct device *dev = &pwrscale->busmondev; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrscale.c:997 [MATCH: mutex_unlock] --- devfreq_resume_device(pwrscale->bus_devfreq); } static void do_devfreq_notify(struct kthread_work *work) { struct kgsl_pwrscale *pwrscale = container_of(work, struct kgsl_pwrscale, devfreq_notify_work); mutex_lock(&pwrscale->devfreqptr->lock); update_devfreq(pwrscale->devfreqptr); mutex_unlock(&pwrscale->devfreqptr->lock); if (pwrscale->bus_devfreq) { mutex_lock(&pwrscale->bus_devfreq->lock); update_devfreq(pwrscale->bus_devfreq); mutex_unlock(&pwrscale->bus_devfreq->lock); } } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrscale.c:1002 [MATCH: mutex_unlock] --- struct kgsl_pwrscale *pwrscale = container_of(work, struct kgsl_pwrscale, devfreq_notify_work); mutex_lock(&pwrscale->devfreqptr->lock); update_devfreq(pwrscale->devfreqptr); mutex_unlock(&pwrscale->devfreqptr->lock); if (pwrscale->bus_devfreq) { mutex_lock(&pwrscale->bus_devfreq->lock); update_devfreq(pwrscale->bus_devfreq); mutex_unlock(&pwrscale->bus_devfreq->lock); } } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_reclaim.c:179 [MATCH: mutex_lock] --- return 0; } int kgsl_reclaim_to_pinned_state( struct kgsl_process_private *process) { struct kgsl_mem_entry *entry, *valid_entry; int next = 0, ret = 0, count; mutex_lock(&process->reclaim_lock); if (test_bit(KGSL_PROC_PINNED_STATE, &process->state)) goto done; count = atomic_read(&process->unpinned_page_count); for ( ; ; ) { valid_entry = NULL; spin_lock(&process->mem_lock); entry = idr_get_next(&process->mem_idr, &next); if (entry == NULL) { spin_unlock(&process->mem_lock); break; } if (TEST_FLAG(KGSL_MEMDESC_RECLAIMED, &entry->memdesc.priv)) valid_entry = kgsl_mem_entry_get(entry); spin_unlock(&process->mem_lock); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_reclaim.c:212 [MATCH: mutex_unlock] --- if (ret) goto done; } next++; } trace_kgsl_reclaim_process(process, count, false); set_bit(KGSL_PROC_PINNED_STATE, &process->state); done: mutex_unlock(&process->reclaim_lock); return ret; } static void kgsl_reclaim_foreground_work(struct work_struct *work) { struct kgsl_process_private *process = container_of(work, struct kgsl_process_private, fg_work); if (test_bit(KGSL_PROC_STATE, &process->state)) kgsl_reclaim_to_pinned_state(process); kgsl_process_private_put(process); } #ifdef CONFIG_QCOM_KGSL_HYBRID_ALLOCATION static void _copy_page(struct kgsl_memdesc *memdesc, struct page *dest, struct page *src) { void *src_ptr, *dest_ptr; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_reclaim.c:433 [MATCH: mutex_unlock] --- kgsl_mem_entry_put(valid_entry); } clear_bit(KGSL_PROC_CAN_MIGRATE, &process->state); abort: trace_kgsl_migrate_process(process, migrate_count); mmput(mm); put_task: put_task_struct(task); done: mutex_unlock(&process->reclaim_lock); } static void kgsl_background_work(struct work_struct *work) { struct kgsl_process_private *process = container_of(work, struct kgsl_process_private, bg_work); if (!test_bit(KGSL_PROC_STATE, &process->state)) kgsl_shmem_migrate(process); kgsl_process_private_put(process); } #else static void kgsl_background_work(struct work_struct *work) { } #endif static ssize_t kgsl_proc_state_show(struct kobject *kobj, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_reclaim.c:623 [MATCH: mutex_unlock] --- } kgsl_mem_entry_put(entry); next++; } if (next) clear_bit(KGSL_PROC_PINNED_STATE, &process->state); trace_kgsl_reclaim_process(process, pages_to_reclaim - remaining, true); mutex_unlock(&process->reclaim_lock); return (pages_to_reclaim - remaining); } static void kgsl_reclaim_background_work(struct work_struct *work) { u32 bg_proc = 0, nr_pages = atomic_read(&kgsl_nr_to_reclaim); u64 pp_nr_pages; struct list_head kgsl_reclaim_process_list; struct kgsl_process_private *process, *next; INIT_LIST_HEAD(&kgsl_reclaim_process_list); read_lock(&kgsl_driver.proclist_lock); list_for_each_entry(process, &kgsl_driver.process_list, list) { if (test_bit(KGSL_PROC_STATE, &process->state) || !kgsl_process_private_get(process)) continue; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_reclaim.c:55 [MATCH: spin_lock] --- * check_move_unevictable_folios() places them on the * evictable list. * * Once reclaim is done, hint that further shmem allocations * will have to be on the unevictable list. */ mapping_clear_unevictable(memdesc->shmem_filp->f_mapping); folio_batch_init(&fbatch); for (i = 0; i < memdesc->page_count; i++) { set_page_dirty_lock(memdesc->pages[i]); spin_lock(&memdesc->lock); folio_batch_add(&fbatch, page_folio(memdesc->pages[i])); memdesc->pages[i] = NULL; atomic_inc(&process->unpinned_page_count); spin_unlock(&memdesc->lock); if (folio_batch_count(&fbatch) == PAGEVEC_SIZE) { check_move_unevictable_folios(&fbatch); __folio_batch_release(&fbatch); } } if (folio_batch_count(&fbatch)) { check_move_unevictable_folios(&fbatch); __folio_batch_release(&fbatch); } } static int kgsl_read_mapping(struct kgsl_memdesc *memdesc, struct page **page, int i) { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_reclaim.c:105 [MATCH: spin_lock] --- * check_move_unevictable_pages() places them on the * evictable list. * * Once reclaim is done, hint that further shmem allocations * will have to be on the unevictable list. */ mapping_clear_unevictable(memdesc->shmem_filp->f_mapping); pagevec_init(&pvec); for (i = 0; i < memdesc->page_count; i++) { set_page_dirty_lock(memdesc->pages[i]); spin_lock(&memdesc->lock); pagevec_add(&pvec, memdesc->pages[i]); memdesc->pages[i] = NULL; atomic_inc(&process->unpinned_page_count); spin_unlock(&memdesc->lock); if (pagevec_count(&pvec) == PAGEVEC_SIZE) { check_move_unevictable_pages(&pvec); __pagevec_release(&pvec); } } if (pagevec_count(&pvec)) { check_move_unevictable_pages(&pvec); __pagevec_release(&pvec); } } static int kgsl_read_mapping(struct kgsl_memdesc *memdesc, struct page **page, int i) { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_reclaim.c:136 [MATCH: spin_lock] --- return PTR_ERR_OR_ZERO(*page); } #endif static int kgsl_memdesc_get_reclaimed_pages(struct kgsl_mem_entry *entry) { struct kgsl_memdesc *memdesc = &entry->memdesc; int i, ret; struct page *page = NULL; spin_lock(&memdesc->lock); for (i = 0; i < memdesc->page_count; i++) { if (memdesc->pages[i]) continue; spin_unlock(&memdesc->lock); ret = kgsl_read_mapping(memdesc, &page, i); if (ret) return ret; kgsl_page_sync(memdesc->dev, page, PAGE_SIZE, DMA_BIDIRECTIONAL); /* * Update the pages array only if vmfault has not * updated it meanwhile */ spin_lock(&memdesc->lock); if (!memdesc->pages[i]) { memdesc->pages[i] = page; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_reclaim.c:152 [MATCH: spin_lock] --- ret = kgsl_read_mapping(memdesc, &page, i); if (ret) return ret; kgsl_page_sync(memdesc->dev, page, PAGE_SIZE, DMA_BIDIRECTIONAL); /* * Update the pages array only if vmfault has not * updated it meanwhile */ spin_lock(&memdesc->lock); if (!memdesc->pages[i]) { memdesc->pages[i] = page; atomic_dec(&entry->priv->unpinned_page_count); } else put_page(page); spin_unlock(&memdesc->lock); } spin_unlock(&memdesc->lock); ret = kgsl_mmu_map(memdesc->pagetable, memdesc); if (ret) return ret; trace_kgsl_reclaim_memdesc(entry, false); CLEAR_FLAG(KGSL_MEMDESC_RECLAIMED | KGSL_MEMDESC_SKIP_RECLAIM, &memdesc->priv); return 0; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_reclaim.c:188 [MATCH: spin_lock] --- mutex_lock(&process->reclaim_lock); if (test_bit(KGSL_PROC_PINNED_STATE, &process->state)) goto done; count = atomic_read(&process->unpinned_page_count); for ( ; ; ) { valid_entry = NULL; spin_lock(&process->mem_lock); entry = idr_get_next(&process->mem_idr, &next); if (entry == NULL) { spin_unlock(&process->mem_lock); break; } if (TEST_FLAG(KGSL_MEMDESC_RECLAIMED, &entry->memdesc.priv)) valid_entry = kgsl_mem_entry_get(entry); spin_unlock(&process->mem_lock); if (valid_entry) { ret = kgsl_memdesc_get_reclaimed_pages(entry); kgsl_mem_entry_put(entry); if (ret) goto done; } next++; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_reclaim.c:326 [MATCH: spin_lock] --- struct page *new_page = pages[i + n]; _copy_page(memdesc, new_page, page); page_count++; } i += count; } old_pages = memdesc->pages; spin_lock(&memdesc->lock); memdesc->pages = pages; memdesc->shmem_filp = shmem_filp; SET_FLAG(KGSL_MEMDESC_MIGRATED, &memdesc->priv); spin_unlock(&memdesc->lock); /* Re-enable mmaps and vm_faults on the entry memdesc */ mmap_write_unlock(mm); /* Free the old pages back into the pool */ kgsl_pool_free_pages(old_pages, memdesc->page_count); kvfree(old_pages); /* Map the new pages to the mmu */ ret = kgsl_mmu_map(memdesc->pagetable, memdesc); if (ret) { pr_err_ratelimited("kgsl: Failed to map process %d entry %d\n", pid_nr(entry->priv->pid), entry->id); kill_pid(entry->priv->pid, SIGKILL, 1); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_reclaim.c:400 [MATCH: spin_lock] --- struct kgsl_mem_entry *valid_entry = NULL; u32 priv; /* Abort migration if process submitted work. */ if (atomic_read(&process->cmd_count)) goto abort; if (atomic_read(&process->migrated_page_count) >= kgsl_reclaim_max_page_limit) break; spin_lock(&process->mem_lock); entry = idr_get_next(&process->mem_idr, &next); if (entry == NULL) { spin_unlock(&process->mem_lock); break; } /* * Skip entries that are pending free or are already migrated or * cannot be reclaimed */ priv = atomic_read(&entry->memdesc.priv); if (!(entry->pending_free || (priv & KGSL_MEMDESC_MIGRATED) || !(priv & KGSL_MEMDESC_CAN_RECLAIM))) valid_entry = kgsl_mem_entry_get(entry); spin_unlock(&process->mem_lock); next++; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_reclaim.c:565 [MATCH: spin_lock] --- /* Abort reclaim if process submitted work. */ if (atomic_read(&process->cmd_count)) break; /* Abort reclaim if process foreground hint is received. */ if (test_bit(KGSL_PROC_STATE, &process->state)) break; valid_entry = NULL; spin_lock(&process->mem_lock); entry = idr_get_next(&process->mem_idr, &next); if (entry == NULL) { spin_unlock(&process->mem_lock); break; } memdesc = &entry->memdesc; priv = atomic_read(&memdesc->priv); if (!entry->pending_free && (priv & KGSL_MEMDESC_CAN_RECLAIM) && !(priv & KGSL_MEMDESC_RECLAIMED) && !(priv & KGSL_MEMDESC_SKIP_RECLAIM)) valid_entry = kgsl_mem_entry_get(entry); spin_unlock(&process->mem_lock); if (!valid_entry) { next++; continue; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_reclaim.c:59 [MATCH: spin_unlock] --- * will have to be on the unevictable list. */ mapping_clear_unevictable(memdesc->shmem_filp->f_mapping); folio_batch_init(&fbatch); for (i = 0; i < memdesc->page_count; i++) { set_page_dirty_lock(memdesc->pages[i]); spin_lock(&memdesc->lock); folio_batch_add(&fbatch, page_folio(memdesc->pages[i])); memdesc->pages[i] = NULL; atomic_inc(&process->unpinned_page_count); spin_unlock(&memdesc->lock); if (folio_batch_count(&fbatch) == PAGEVEC_SIZE) { check_move_unevictable_folios(&fbatch); __folio_batch_release(&fbatch); } } if (folio_batch_count(&fbatch)) { check_move_unevictable_folios(&fbatch); __folio_batch_release(&fbatch); } } static int kgsl_read_mapping(struct kgsl_memdesc *memdesc, struct page **page, int i) { struct folio *folio = shmem_read_folio_gfp(memdesc->shmem_filp->f_mapping, i, kgsl_gfp_mask(0)); if (!IS_ERR(folio)) { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_reclaim.c:109 [MATCH: spin_unlock] --- * will have to be on the unevictable list. */ mapping_clear_unevictable(memdesc->shmem_filp->f_mapping); pagevec_init(&pvec); for (i = 0; i < memdesc->page_count; i++) { set_page_dirty_lock(memdesc->pages[i]); spin_lock(&memdesc->lock); pagevec_add(&pvec, memdesc->pages[i]); memdesc->pages[i] = NULL; atomic_inc(&process->unpinned_page_count); spin_unlock(&memdesc->lock); if (pagevec_count(&pvec) == PAGEVEC_SIZE) { check_move_unevictable_pages(&pvec); __pagevec_release(&pvec); } } if (pagevec_count(&pvec)) { check_move_unevictable_pages(&pvec); __pagevec_release(&pvec); } } static int kgsl_read_mapping(struct kgsl_memdesc *memdesc, struct page **page, int i) { *page = shmem_read_mapping_page_gfp(memdesc->shmem_filp->f_mapping, i, kgsl_gfp_mask(0)); return PTR_ERR_OR_ZERO(*page); } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_reclaim.c:141 [MATCH: spin_unlock] --- { struct kgsl_memdesc *memdesc = &entry->memdesc; int i, ret; struct page *page = NULL; spin_lock(&memdesc->lock); for (i = 0; i < memdesc->page_count; i++) { if (memdesc->pages[i]) continue; spin_unlock(&memdesc->lock); ret = kgsl_read_mapping(memdesc, &page, i); if (ret) return ret; kgsl_page_sync(memdesc->dev, page, PAGE_SIZE, DMA_BIDIRECTIONAL); /* * Update the pages array only if vmfault has not * updated it meanwhile */ spin_lock(&memdesc->lock); if (!memdesc->pages[i]) { memdesc->pages[i] = page; atomic_dec(&entry->priv->unpinned_page_count); } else put_page(page); spin_unlock(&memdesc->lock); } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_reclaim.c:158 [MATCH: spin_unlock] --- /* * Update the pages array only if vmfault has not * updated it meanwhile */ spin_lock(&memdesc->lock); if (!memdesc->pages[i]) { memdesc->pages[i] = page; atomic_dec(&entry->priv->unpinned_page_count); } else put_page(page); spin_unlock(&memdesc->lock); } spin_unlock(&memdesc->lock); ret = kgsl_mmu_map(memdesc->pagetable, memdesc); if (ret) return ret; trace_kgsl_reclaim_memdesc(entry, false); CLEAR_FLAG(KGSL_MEMDESC_RECLAIMED | KGSL_MEMDESC_SKIP_RECLAIM, &memdesc->priv); return 0; } int kgsl_reclaim_to_pinned_state( struct kgsl_process_private *process) { struct kgsl_mem_entry *entry, *valid_entry; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_reclaim.c:160 [MATCH: spin_unlock] --- * updated it meanwhile */ spin_lock(&memdesc->lock); if (!memdesc->pages[i]) { memdesc->pages[i] = page; atomic_dec(&entry->priv->unpinned_page_count); } else put_page(page); spin_unlock(&memdesc->lock); } spin_unlock(&memdesc->lock); ret = kgsl_mmu_map(memdesc->pagetable, memdesc); if (ret) return ret; trace_kgsl_reclaim_memdesc(entry, false); CLEAR_FLAG(KGSL_MEMDESC_RECLAIMED | KGSL_MEMDESC_SKIP_RECLAIM, &memdesc->priv); return 0; } int kgsl_reclaim_to_pinned_state( struct kgsl_process_private *process) { struct kgsl_mem_entry *entry, *valid_entry; int next = 0, ret = 0, count; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_reclaim.c:191 [MATCH: spin_unlock] --- if (test_bit(KGSL_PROC_PINNED_STATE, &process->state)) goto done; count = atomic_read(&process->unpinned_page_count); for ( ; ; ) { valid_entry = NULL; spin_lock(&process->mem_lock); entry = idr_get_next(&process->mem_idr, &next); if (entry == NULL) { spin_unlock(&process->mem_lock); break; } if (TEST_FLAG(KGSL_MEMDESC_RECLAIMED, &entry->memdesc.priv)) valid_entry = kgsl_mem_entry_get(entry); spin_unlock(&process->mem_lock); if (valid_entry) { ret = kgsl_memdesc_get_reclaimed_pages(entry); kgsl_mem_entry_put(entry); if (ret) goto done; } next++; } trace_kgsl_reclaim_process(process, count, false); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_reclaim.c:197 [MATCH: spin_unlock] --- valid_entry = NULL; spin_lock(&process->mem_lock); entry = idr_get_next(&process->mem_idr, &next); if (entry == NULL) { spin_unlock(&process->mem_lock); break; } if (TEST_FLAG(KGSL_MEMDESC_RECLAIMED, &entry->memdesc.priv)) valid_entry = kgsl_mem_entry_get(entry); spin_unlock(&process->mem_lock); if (valid_entry) { ret = kgsl_memdesc_get_reclaimed_pages(entry); kgsl_mem_entry_put(entry); if (ret) goto done; } next++; } trace_kgsl_reclaim_process(process, count, false); set_bit(KGSL_PROC_PINNED_STATE, &process->state); done: mutex_unlock(&process->reclaim_lock); return ret; } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_reclaim.c:330 [MATCH: spin_unlock] --- } i += count; } old_pages = memdesc->pages; spin_lock(&memdesc->lock); memdesc->pages = pages; memdesc->shmem_filp = shmem_filp; SET_FLAG(KGSL_MEMDESC_MIGRATED, &memdesc->priv); spin_unlock(&memdesc->lock); /* Re-enable mmaps and vm_faults on the entry memdesc */ mmap_write_unlock(mm); /* Free the old pages back into the pool */ kgsl_pool_free_pages(old_pages, memdesc->page_count); kvfree(old_pages); /* Map the new pages to the mmu */ ret = kgsl_mmu_map(memdesc->pagetable, memdesc); if (ret) { pr_err_ratelimited("kgsl: Failed to map process %d entry %d\n", pid_nr(entry->priv->pid), entry->id); kill_pid(entry->priv->pid, SIGKILL, 1); } atomic_add(memdesc->page_count, &entry->priv->migrated_page_count); trace_kgsl_migrate_memdesc(entry); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_reclaim.c:403 [MATCH: spin_unlock] --- /* Abort migration if process submitted work. */ if (atomic_read(&process->cmd_count)) goto abort; if (atomic_read(&process->migrated_page_count) >= kgsl_reclaim_max_page_limit) break; spin_lock(&process->mem_lock); entry = idr_get_next(&process->mem_idr, &next); if (entry == NULL) { spin_unlock(&process->mem_lock); break; } /* * Skip entries that are pending free or are already migrated or * cannot be reclaimed */ priv = atomic_read(&entry->memdesc.priv); if (!(entry->pending_free || (priv & KGSL_MEMDESC_MIGRATED) || !(priv & KGSL_MEMDESC_CAN_RECLAIM))) valid_entry = kgsl_mem_entry_get(entry); spin_unlock(&process->mem_lock); next++; if (!valid_entry) continue; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_reclaim.c:416 [MATCH: spin_unlock] --- /* * Skip entries that are pending free or are already migrated or * cannot be reclaimed */ priv = atomic_read(&entry->memdesc.priv); if (!(entry->pending_free || (priv & KGSL_MEMDESC_MIGRATED) || !(priv & KGSL_MEMDESC_CAN_RECLAIM))) valid_entry = kgsl_mem_entry_get(entry); spin_unlock(&process->mem_lock); next++; if (!valid_entry) continue; migrate_count += kgsl_shmem_mem_entry_migrate(mm, valid_entry); kgsl_mem_entry_put(valid_entry); } clear_bit(KGSL_PROC_CAN_MIGRATE, &process->state); abort: trace_kgsl_migrate_process(process, migrate_count); mmput(mm); put_task: put_task_struct(task); done: mutex_unlock(&process->reclaim_lock); } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_reclaim.c:568 [MATCH: spin_unlock] --- break; /* Abort reclaim if process foreground hint is received. */ if (test_bit(KGSL_PROC_STATE, &process->state)) break; valid_entry = NULL; spin_lock(&process->mem_lock); entry = idr_get_next(&process->mem_idr, &next); if (entry == NULL) { spin_unlock(&process->mem_lock); break; } memdesc = &entry->memdesc; priv = atomic_read(&memdesc->priv); if (!entry->pending_free && (priv & KGSL_MEMDESC_CAN_RECLAIM) && !(priv & KGSL_MEMDESC_RECLAIMED) && !(priv & KGSL_MEMDESC_SKIP_RECLAIM)) valid_entry = kgsl_mem_entry_get(entry); spin_unlock(&process->mem_lock); if (!valid_entry) { next++; continue; } /* Do not reclaim pages mapped into a VBO */ --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_reclaim.c:579 [MATCH: spin_unlock] --- break; } memdesc = &entry->memdesc; priv = atomic_read(&memdesc->priv); if (!entry->pending_free && (priv & KGSL_MEMDESC_CAN_RECLAIM) && !(priv & KGSL_MEMDESC_RECLAIMED) && !(priv & KGSL_MEMDESC_SKIP_RECLAIM)) valid_entry = kgsl_mem_entry_get(entry); spin_unlock(&process->mem_lock); if (!valid_entry) { next++; continue; } /* Do not reclaim pages mapped into a VBO */ if (atomic_read(&valid_entry->vbo_count)) { kgsl_mem_entry_put(entry); next++; continue; } if ((atomic_read(&process->unpinned_page_count) + memdesc->page_count) > kgsl_reclaim_max_page_limit) { kgsl_mem_entry_put(entry); next++; continue; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_regmap.c:342 [MATCH: timeout] --- writel_relaxed(start + i, region_addr(region, addr)); /* Make sure the write finishes */ wmb(); dest[i] = readl_relaxed(region_addr(region, data)); /* Make sure the read finishes */ rmb(); } } /* A special helper function to work with read_poll_timeout */ int kgsl_regmap_poll_read(struct kgsl_regmap_region *region, u32 offset, u32 *val) { /* FIXME: WARN on !region? */ if (WARN(!region, "Out of bounds poll read: 0x%x\n", offset)) return -ENODEV; *val = readl_relaxed(region_addr(region, offset)); /* Make sure the read is finished before moving on */ rmb(); return 0; } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_regmap.h:271 [MATCH: timeout] --- * kgsl_regmap_get_region - Return the region for the given offset * @regmap: The regmap to query * @offset: The offset to query * * Return: The &struct kgsl_regmap_region that owns the offset or NULL */ struct kgsl_regmap_region *kgsl_regmap_get_region(struct kgsl_regmap *regmap, u32 offset); /** * kgsl_regmap_poll_read - A helper function for kgsl_regmap_read_poll_timeout * @region: Pointer to a &struct kgsl_regmap_region * @offset: Offset to read * @val: Pointer for the result * * This is a special helper function to be called only from * kgsl_regmap_read_poll_timeout. * * Return: 0 on success or -ENODEV if the region is NULL. */ int kgsl_regmap_poll_read(struct kgsl_regmap_region *region, u32 offset, u32 *val); #define kgsl_regmap_read_poll_timeout(regmap, offset, val, cond, \ sleep_us, timeout_us) \ ({ \ int __ret, __tmp; \ struct kgsl_regmap_region *region = \ kgsl_regmap_get_region(regmap, offset); \ --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_regmap.h:277 [MATCH: timeout] --- struct kgsl_regmap_region *kgsl_regmap_get_region(struct kgsl_regmap *regmap, u32 offset); /** * kgsl_regmap_poll_read - A helper function for kgsl_regmap_read_poll_timeout * @region: Pointer to a &struct kgsl_regmap_region * @offset: Offset to read * @val: Pointer for the result * * This is a special helper function to be called only from * kgsl_regmap_read_poll_timeout. * * Return: 0 on success or -ENODEV if the region is NULL. */ int kgsl_regmap_poll_read(struct kgsl_regmap_region *region, u32 offset, u32 *val); #define kgsl_regmap_read_poll_timeout(regmap, offset, val, cond, \ sleep_us, timeout_us) \ ({ \ int __ret, __tmp; \ struct kgsl_regmap_region *region = \ kgsl_regmap_get_region(regmap, offset); \ \ if (region && region->ops && region->ops->preaccess) \ region->ops->preaccess(region); \ __tmp = read_poll_timeout(kgsl_regmap_poll_read, __ret, __ret || (cond),\ sleep_us, timeout_us, false, region, offset, &(val)); \ __ret ?: __tmp; \ --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_regmap.h:284 [MATCH: timeout] --- * @val: Pointer for the result * * This is a special helper function to be called only from * kgsl_regmap_read_poll_timeout. * * Return: 0 on success or -ENODEV if the region is NULL. */ int kgsl_regmap_poll_read(struct kgsl_regmap_region *region, u32 offset, u32 *val); #define kgsl_regmap_read_poll_timeout(regmap, offset, val, cond, \ sleep_us, timeout_us) \ ({ \ int __ret, __tmp; \ struct kgsl_regmap_region *region = \ kgsl_regmap_get_region(regmap, offset); \ \ if (region && region->ops && region->ops->preaccess) \ region->ops->preaccess(region); \ __tmp = read_poll_timeout(kgsl_regmap_poll_read, __ret, __ret || (cond),\ sleep_us, timeout_us, false, region, offset, &(val)); \ __ret ?: __tmp; \ }) #endif --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_regmap.h:285 [MATCH: timeout] --- * * This is a special helper function to be called only from * kgsl_regmap_read_poll_timeout. * * Return: 0 on success or -ENODEV if the region is NULL. */ int kgsl_regmap_poll_read(struct kgsl_regmap_region *region, u32 offset, u32 *val); #define kgsl_regmap_read_poll_timeout(regmap, offset, val, cond, \ sleep_us, timeout_us) \ ({ \ int __ret, __tmp; \ struct kgsl_regmap_region *region = \ kgsl_regmap_get_region(regmap, offset); \ \ if (region && region->ops && region->ops->preaccess) \ region->ops->preaccess(region); \ __tmp = read_poll_timeout(kgsl_regmap_poll_read, __ret, __ret || (cond),\ sleep_us, timeout_us, false, region, offset, &(val)); \ __ret ?: __tmp; \ }) #endif --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_regmap.h:293 [MATCH: timeout] --- #define kgsl_regmap_read_poll_timeout(regmap, offset, val, cond, \ sleep_us, timeout_us) \ ({ \ int __ret, __tmp; \ struct kgsl_regmap_region *region = \ kgsl_regmap_get_region(regmap, offset); \ \ if (region && region->ops && region->ops->preaccess) \ region->ops->preaccess(region); \ __tmp = read_poll_timeout(kgsl_regmap_poll_read, __ret, __ret || (cond),\ sleep_us, timeout_us, false, region, offset, &(val)); \ __ret ?: __tmp; \ }) #endif --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_regmap.h:294 [MATCH: timeout] --- #define kgsl_regmap_read_poll_timeout(regmap, offset, val, cond, \ sleep_us, timeout_us) \ ({ \ int __ret, __tmp; \ struct kgsl_regmap_region *region = \ kgsl_regmap_get_region(regmap, offset); \ \ if (region && region->ops && region->ops->preaccess) \ region->ops->preaccess(region); \ __tmp = read_poll_timeout(kgsl_regmap_poll_read, __ret, __ret || (cond),\ sleep_us, timeout_us, false, region, offset, &(val)); \ __ret ?: __tmp; \ }) #endif --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sharedmem.c:574 [MATCH: mutex_lock] --- } spin_unlock(&memdesc->lock); ret = vmf_insert_page(vma, vmf->address, page); put_page(page); return ret; } static void kgsl_paged_unmap_kernel(struct kgsl_memdesc *memdesc) { mutex_lock(&kernel_map_global_lock); if (!memdesc->hostptr) { /* If already unmapped the refcount should be 0 */ WARN_ON(memdesc->hostptr_count); goto done; } memdesc->hostptr_count--; if (memdesc->hostptr_count) goto done; vunmap(memdesc->hostptr); atomic_long_sub(memdesc->size, &kgsl_driver.stats.vmalloc); memdesc->hostptr = NULL; done: mutex_unlock(&kernel_map_global_lock); } #if IS_ENABLED(CONFIG_QCOM_SECURE_BUFFER) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sharedmem.c:652 [MATCH: mutex_lock] --- #endif static int kgsl_paged_map_kernel(struct kgsl_memdesc *memdesc) { int ret = 0; /* Sanity check - don't map more than we could possibly chew */ if (memdesc->size > ULONG_MAX) return -ENOMEM; mutex_lock(&kernel_map_global_lock); if ((!memdesc->hostptr) && (memdesc->pages != NULL)) { pgprot_t page_prot; u64 cache; /* Determine user-side caching policy */ cache = kgsl_memdesc_get_cachemode(memdesc); switch (cache) { case KGSL_CACHEMODE_WRITETHROUGH: page_prot = PAGE_KERNEL; WARN_ONCE(1, "WRITETHROUGH is deprecated for arm64"); break; case KGSL_CACHEMODE_WRITEBACK: page_prot = PAGE_KERNEL; break; case KGSL_CACHEMODE_UNCACHED: case KGSL_CACHEMODE_WRITECOMBINE: default: page_prot = pgprot_writecombine(PAGE_KERNEL); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sharedmem.c:588 [MATCH: mutex_unlock] --- goto done; } memdesc->hostptr_count--; if (memdesc->hostptr_count) goto done; vunmap(memdesc->hostptr); atomic_long_sub(memdesc->size, &kgsl_driver.stats.vmalloc); memdesc->hostptr = NULL; done: mutex_unlock(&kernel_map_global_lock); } #if IS_ENABLED(CONFIG_QCOM_SECURE_BUFFER) #include int kgsl_lock_sgt(struct sg_table *sgt, u64 size) { int dest_perms = PERM_READ | PERM_WRITE; int source_vm = VMID_HLOS; int dest_vm = VMID_CP_PIXEL; int ret; do { ret = hyp_assign_table(sgt, &source_vm, 1, &dest_vm, &dest_perms, 1); } while (ret == -EAGAIN); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sharedmem.c:686 [MATCH: mutex_unlock] --- if (memdesc->hostptr) KGSL_STATS_ADD(memdesc->size, &kgsl_driver.stats.vmalloc, &kgsl_driver.stats.vmalloc_max); else ret = -ENOMEM; } if (memdesc->hostptr) memdesc->hostptr_count++; mutex_unlock(&kernel_map_global_lock); return ret; } static vm_fault_t kgsl_contiguous_vmfault(struct kgsl_memdesc *memdesc, struct vm_area_struct *vma, struct vm_fault *vmf) { unsigned long offset, pfn; offset = ((unsigned long) vmf->address - vma->vm_start) >> PAGE_SHIFT; pfn = (memdesc->physaddr >> PAGE_SHIFT) + offset; return vmf_insert_pfn(vma, vmf->address, pfn); } static void _dma_cache_op(struct device *dev, struct page *page, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sharedmem.c:185 [MATCH: spin_lock] --- * of the sysfs files. */ if (!kgsl_process_private_get(priv)) { kfree(work); return -ENOENT; } work->private = priv; INIT_WORK(&work->work, process_private_deferred_put); spin_lock(&priv->mem_lock); for (entry = idr_get_next(&priv->mem_idr, &id); entry; id++, entry = idr_get_next(&priv->mem_idr, &id)) { struct kgsl_memdesc *memdesc; unsigned int type; if (!kgsl_mem_entry_get(entry)) continue; spin_unlock(&priv->mem_lock); memdesc = &entry->memdesc; type = kgsl_memdesc_get_memtype(memdesc); if (type == memtype->type) size += memdesc->size; kgsl_mem_entry_put(entry); spin_lock(&priv->mem_lock); } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sharedmem.c:202 [MATCH: spin_lock] --- continue; spin_unlock(&priv->mem_lock); memdesc = &entry->memdesc; type = kgsl_memdesc_get_memtype(memdesc); if (type == memtype->type) size += memdesc->size; kgsl_mem_entry_put(entry); spin_lock(&priv->mem_lock); } spin_unlock(&priv->mem_lock); queue_work(kgsl_driver.lockless_workqueue, &work->work); return scnprintf(buf, PAGE_SIZE, "%llu\n", size); } static const struct sysfs_ops memtype_sysfs_ops = { .show = memtype_sysfs_show, }; static struct kobj_type ktype_memtype = { .sysfs_ops = &memtype_sysfs_ops, .default_groups = memtype_groups, }; static ssize_t --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sharedmem.c:248 [MATCH: spin_lock] --- * of the sysfs files. */ if (!kgsl_process_private_get(priv)) { kfree(work); return -ENOENT; } work->private = priv; INIT_WORK(&work->work, process_private_deferred_put); spin_lock(&priv->mem_lock); for (entry = idr_get_next(&priv->mem_idr, &id); entry; id++, entry = idr_get_next(&priv->mem_idr, &id)) { int egl_surface_count = 0, egl_image_count = 0; struct kgsl_memdesc *m; if (!kgsl_mem_entry_get(entry)) continue; spin_unlock(&priv->mem_lock); m = &entry->memdesc; if (kgsl_memdesc_usermem_type(m) == KGSL_MEM_ENTRY_ION) { u64 size = m->size; int total_egl_count; kgsl_get_egl_counts(entry, &egl_surface_count, &egl_image_count); total_egl_count = egl_surface_count + egl_image_count; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sharedmem.c:277 [MATCH: spin_lock] --- /* * Divide the total buffer size uniformly across all the * processes that imported the buffer. */ do_div(size, (total_egl_count ? total_egl_count : 1)); imported_mem += size; } kgsl_mem_entry_put(entry); spin_lock(&priv->mem_lock); } spin_unlock(&priv->mem_lock); queue_work(kgsl_driver.lockless_workqueue, &work->work); return scnprintf(buf, PAGE_SIZE, "%llu\n", imported_mem); } static ssize_t gpumem_mapped_show(struct kgsl_process_private *priv, int type, char *buf) { return scnprintf(buf, PAGE_SIZE, "%lld\n", atomic64_read(&priv->gpumem_mapped)); } static ssize_t gpumem_unmapped_show(struct kgsl_process_private *priv, int type, char *buf) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sharedmem.c:535 [MATCH: spin_lock] --- { int pgoff, ret; struct page *page; unsigned int offset = vmf->address - vma->vm_start; if (offset >= memdesc->size) return VM_FAULT_SIGBUS; pgoff = offset >> PAGE_SHIFT; spin_lock(&memdesc->lock); if (memdesc->pages[pgoff]) { page = memdesc->pages[pgoff]; get_page(page); } else { struct kgsl_process_private *priv = ((struct kgsl_mem_entry *)vma->vm_private_data)->priv; /* We are here because page was reclaimed */ SET_FLAG(KGSL_MEMDESC_SKIP_RECLAIM, &memdesc->priv); spin_unlock(&memdesc->lock); page = shmem_read_mapping_page_gfp( memdesc->shmem_filp->f_mapping, pgoff, kgsl_gfp_mask(0)); if (IS_ERR(page)) return VM_FAULT_SIGBUS; kgsl_page_sync(memdesc->dev, page, PAGE_SIZE, DMA_BIDIRECTIONAL); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sharedmem.c:558 [MATCH: spin_lock] --- memdesc->shmem_filp->f_mapping, pgoff, kgsl_gfp_mask(0)); if (IS_ERR(page)) return VM_FAULT_SIGBUS; kgsl_page_sync(memdesc->dev, page, PAGE_SIZE, DMA_BIDIRECTIONAL); /* * Update the pages array only if the page was * not already brought back. */ spin_lock(&memdesc->lock); if (!memdesc->pages[pgoff]) { memdesc->pages[pgoff] = page; atomic_dec(&priv->unpinned_page_count); get_page(page); } } spin_unlock(&memdesc->lock); ret = vmf_insert_page(vma, vmf->address, page); put_page(page); return ret; } static void kgsl_paged_unmap_kernel(struct kgsl_memdesc *memdesc) { mutex_lock(&kernel_map_global_lock); if (!memdesc->hostptr) { /* If already unmapped the refcount should be 0 */ --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sharedmem.c:845 [MATCH: spin_lock] --- * For io-coherent buffers don't set memdesc->dev, so that we skip DMA * cache operations at allocation time */ if (!(flags & KGSL_MEMFLAGS_IOCOHERENT)) memdesc->dev = &kgsl_driver.virtdev; align = max_t(unsigned int, kgsl_memdesc_get_align(memdesc), ilog2(PAGE_SIZE)); kgsl_memdesc_set_align(memdesc, align); spin_lock_init(&memdesc->lock); } void kgsl_sharedmem_free(struct kgsl_memdesc *memdesc) { if (!memdesc || !memdesc->size) return; /* Assume if no operations were specified something went bad early */ if (!memdesc->ops) return; if (memdesc->ops->put_gpuaddr) memdesc->ops->put_gpuaddr(memdesc); if (memdesc->ops->free) memdesc->ops->free(memdesc); } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sharedmem.c:193 [MATCH: spin_unlock] --- INIT_WORK(&work->work, process_private_deferred_put); spin_lock(&priv->mem_lock); for (entry = idr_get_next(&priv->mem_idr, &id); entry; id++, entry = idr_get_next(&priv->mem_idr, &id)) { struct kgsl_memdesc *memdesc; unsigned int type; if (!kgsl_mem_entry_get(entry)) continue; spin_unlock(&priv->mem_lock); memdesc = &entry->memdesc; type = kgsl_memdesc_get_memtype(memdesc); if (type == memtype->type) size += memdesc->size; kgsl_mem_entry_put(entry); spin_lock(&priv->mem_lock); } spin_unlock(&priv->mem_lock); queue_work(kgsl_driver.lockless_workqueue, &work->work); return scnprintf(buf, PAGE_SIZE, "%llu\n", size); } static const struct sysfs_ops memtype_sysfs_ops = { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sharedmem.c:204 [MATCH: spin_unlock] --- memdesc = &entry->memdesc; type = kgsl_memdesc_get_memtype(memdesc); if (type == memtype->type) size += memdesc->size; kgsl_mem_entry_put(entry); spin_lock(&priv->mem_lock); } spin_unlock(&priv->mem_lock); queue_work(kgsl_driver.lockless_workqueue, &work->work); return scnprintf(buf, PAGE_SIZE, "%llu\n", size); } static const struct sysfs_ops memtype_sysfs_ops = { .show = memtype_sysfs_show, }; static struct kobj_type ktype_memtype = { .sysfs_ops = &memtype_sysfs_ops, .default_groups = memtype_groups, }; static ssize_t imported_mem_show(struct kgsl_process_private *priv, int type, char *buf) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sharedmem.c:257 [MATCH: spin_unlock] --- spin_lock(&priv->mem_lock); for (entry = idr_get_next(&priv->mem_idr, &id); entry; id++, entry = idr_get_next(&priv->mem_idr, &id)) { int egl_surface_count = 0, egl_image_count = 0; struct kgsl_memdesc *m; if (!kgsl_mem_entry_get(entry)) continue; spin_unlock(&priv->mem_lock); m = &entry->memdesc; if (kgsl_memdesc_usermem_type(m) == KGSL_MEM_ENTRY_ION) { u64 size = m->size; int total_egl_count; kgsl_get_egl_counts(entry, &egl_surface_count, &egl_image_count); total_egl_count = egl_surface_count + egl_image_count; /* * Divide the total buffer size uniformly across all the * processes that imported the buffer. */ do_div(size, (total_egl_count ? total_egl_count : 1)); imported_mem += size; } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sharedmem.c:279 [MATCH: spin_unlock] --- * Divide the total buffer size uniformly across all the * processes that imported the buffer. */ do_div(size, (total_egl_count ? total_egl_count : 1)); imported_mem += size; } kgsl_mem_entry_put(entry); spin_lock(&priv->mem_lock); } spin_unlock(&priv->mem_lock); queue_work(kgsl_driver.lockless_workqueue, &work->work); return scnprintf(buf, PAGE_SIZE, "%llu\n", imported_mem); } static ssize_t gpumem_mapped_show(struct kgsl_process_private *priv, int type, char *buf) { return scnprintf(buf, PAGE_SIZE, "%lld\n", atomic64_read(&priv->gpumem_mapped)); } static ssize_t gpumem_unmapped_show(struct kgsl_process_private *priv, int type, char *buf) { u64 gpumem_total = atomic64_read(&priv->stats[type].cur); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sharedmem.c:545 [MATCH: spin_unlock] --- spin_lock(&memdesc->lock); if (memdesc->pages[pgoff]) { page = memdesc->pages[pgoff]; get_page(page); } else { struct kgsl_process_private *priv = ((struct kgsl_mem_entry *)vma->vm_private_data)->priv; /* We are here because page was reclaimed */ SET_FLAG(KGSL_MEMDESC_SKIP_RECLAIM, &memdesc->priv); spin_unlock(&memdesc->lock); page = shmem_read_mapping_page_gfp( memdesc->shmem_filp->f_mapping, pgoff, kgsl_gfp_mask(0)); if (IS_ERR(page)) return VM_FAULT_SIGBUS; kgsl_page_sync(memdesc->dev, page, PAGE_SIZE, DMA_BIDIRECTIONAL); /* * Update the pages array only if the page was * not already brought back. */ spin_lock(&memdesc->lock); if (!memdesc->pages[pgoff]) { memdesc->pages[pgoff] = page; atomic_dec(&priv->unpinned_page_count); get_page(page); } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sharedmem.c:565 [MATCH: spin_unlock] --- * Update the pages array only if the page was * not already brought back. */ spin_lock(&memdesc->lock); if (!memdesc->pages[pgoff]) { memdesc->pages[pgoff] = page; atomic_dec(&priv->unpinned_page_count); get_page(page); } } spin_unlock(&memdesc->lock); ret = vmf_insert_page(vma, vmf->address, page); put_page(page); return ret; } static void kgsl_paged_unmap_kernel(struct kgsl_memdesc *memdesc) { mutex_lock(&kernel_map_global_lock); if (!memdesc->hostptr) { /* If already unmapped the refcount should be 0 */ WARN_ON(memdesc->hostptr_count); goto done; } memdesc->hostptr_count--; if (memdesc->hostptr_count) goto done; vunmap(memdesc->hostptr); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_snapshot.c:498 [MATCH: wait_for_completion] --- snapshot->ptr += header->size; snapshot->remain -= header->size; snapshot->size += header->size; } static void kgsl_free_snapshot(struct kgsl_snapshot *snapshot) { struct kgsl_snapshot_object *obj, *tmp; struct kgsl_device *device = snapshot->device; wait_for_completion(&snapshot->dump_gate); list_for_each_entry_safe(obj, tmp, &snapshot->obj_list, node) kgsl_snapshot_put_object(obj); if (snapshot->mempool) vfree(snapshot->mempool); kfree(snapshot); dev_err(device->dev, "snapshot: objects released\n"); } #define SP0_ISDB_ISDB_BRKPT_CFG 0x40014 #define SP0_ISDB_ISDB_EN 0x40004 #define SP0_ISDB_ISDB_CMD 0x4000C void isdb_write(void __iomem *base, u32 offset) { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_snapshot.c:880 [MATCH: wait_for_completion] --- return ret; /* Return nothing if we haven't taken a snapshot yet */ if (snapshot == NULL) return 0; /* * Wait for the dump worker to finish. This is interruptible * to allow userspace to bail if things go horribly wrong. */ ret = wait_for_completion_interruptible(&snapshot->dump_gate); if (ret) { snapshot_release(device, snapshot); return ret; } written = kgsl_snapshot_do_read(snapshot, buf, off, count); /* * Make sure everything has been written out before destroying things. * The best way to confirm this is to go all the way through without * writing any bytes - so only release if we get this far and * written is 0 and there are no concurrent reads pending */ if (written == 0) { bool snapshot_free = false; kgsl_mutex_lock(&device->mutex); if (--snapshot->sysfs_read == 0) { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_snapshot.c:1380 [MATCH: complete_all] --- "snapshot: Active IB1:%016llx not dumped\n", snapshot->ib1base); else if (snapshot->ib2base && !snapshot->ib2dumped) dev_err(snapshot->device->dev, "snapshot: Active IB2:%016llx not dumped\n", snapshot->ib2base); gmu_only: BUG_ON(!snapshot->device->skip_ib_capture && snapshot->device->force_panic); complete_all(&snapshot->dump_gate); kgsl_devcoredump(snapshot->device); } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_snapshot.c:787 [MATCH: mutex_lock] --- #define kobj_to_device(a) \ container_of(a, struct kgsl_device, snapshot_kobj) static int snapshot_release(struct kgsl_device *device, struct kgsl_snapshot *snapshot) { bool snapshot_free = false; int ret = 0; kgsl_mutex_lock(&device->mutex); snapshot->sysfs_read--; /* * If someone's replaced the snapshot, return an error and free * the snapshot if this is the last thread to read it. */ if (device->snapshot != snapshot) { ret = -EIO; if (!snapshot->sysfs_read) snapshot_free = true; } kgsl_mutex_unlock(&device->mutex); if (snapshot_free) kgsl_free_snapshot(snapshot); return ret; } static ssize_t kgsl_snapshot_do_read(struct kgsl_snapshot *snapshot, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_snapshot.c:850 [MATCH: mutex_lock] --- #else static ssize_t snapshot_show(struct file *filep, struct kobject *kobj, const struct bin_attribute *attr, char *buf, loff_t off, size_t count) #endif { struct kgsl_device *device = kobj_to_device(kobj); struct kgsl_snapshot *snapshot; ssize_t written; int ret = 0; kgsl_mutex_lock(&device->mutex); snapshot = device->snapshot; if (snapshot != NULL) { /* * If we're reading at a non-zero offset from a new snapshot, * that means we want to read from the previous snapshot (which * was overwritten), so return an error */ if (snapshot->first_read) { if (off) ret = -EIO; else snapshot->first_read = false; } if (!ret) snapshot->sysfs_read++; } kgsl_mutex_unlock(&device->mutex); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_snapshot.c:897 [MATCH: mutex_lock] --- /* * Make sure everything has been written out before destroying things. * The best way to confirm this is to go all the way through without * writing any bytes - so only release if we get this far and * written is 0 and there are no concurrent reads pending */ if (written == 0) { bool snapshot_free = false; kgsl_mutex_lock(&device->mutex); if (--snapshot->sysfs_read == 0) { if (device->snapshot == snapshot) device->snapshot = NULL; snapshot_free = true; } kgsl_mutex_unlock(&device->mutex); if (snapshot_free) kgsl_free_snapshot(snapshot); return 0; } ret = snapshot_release(device, snapshot); return (ret < 0) ? ret : written; } /* Show the total number of hangs since device boot */ static ssize_t faultcount_show(struct kgsl_device *device, char *buf) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_snapshot.c:1005 [MATCH: mutex_lock] --- ret = kstrtobool(buf, &device->snapshot_crashdumper); return ret ? ret : count; } /* Show the timestamp of the last collected snapshot */ static ssize_t timestamp_show(struct kgsl_device *device, char *buf) { unsigned long timestamp; kgsl_mutex_lock(&device->mutex); timestamp = device->snapshot ? device->snapshot->timestamp : 0; kgsl_mutex_unlock(&device->mutex); return scnprintf(buf, PAGE_SIZE, "%lu\n", timestamp); } static ssize_t snapshot_legacy_show(struct kgsl_device *device, char *buf) { return scnprintf(buf, PAGE_SIZE, "%d\n", device->snapshot_legacy); } static ssize_t snapshot_legacy_store(struct kgsl_device *device, const char *buf, size_t count) { int ret; ret = kstrtobool(buf, &device->snapshot_legacy); return ret ? ret : count; } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_snapshot.c:799 [MATCH: mutex_unlock] --- /* * If someone's replaced the snapshot, return an error and free * the snapshot if this is the last thread to read it. */ if (device->snapshot != snapshot) { ret = -EIO; if (!snapshot->sysfs_read) snapshot_free = true; } kgsl_mutex_unlock(&device->mutex); if (snapshot_free) kgsl_free_snapshot(snapshot); return ret; } static ssize_t kgsl_snapshot_do_read(struct kgsl_snapshot *snapshot, char *buf, loff_t off, size_t count) { struct kgsl_snapshot_section_header head; struct snapshot_obj_itr itr; int ret; obj_itr_init(&itr, buf, off, count); ret = obj_itr_out(&itr, snapshot->start, snapshot->size); if (ret == 0) goto out; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_snapshot.c:867 [MATCH: mutex_unlock] --- */ if (snapshot->first_read) { if (off) ret = -EIO; else snapshot->first_read = false; } if (!ret) snapshot->sysfs_read++; } kgsl_mutex_unlock(&device->mutex); if (ret) return ret; /* Return nothing if we haven't taken a snapshot yet */ if (snapshot == NULL) return 0; /* * Wait for the dump worker to finish. This is interruptible * to allow userspace to bail if things go horribly wrong. */ ret = wait_for_completion_interruptible(&snapshot->dump_gate); if (ret) { snapshot_release(device, snapshot); return ret; } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_snapshot.c:903 [MATCH: mutex_unlock] --- */ if (written == 0) { bool snapshot_free = false; kgsl_mutex_lock(&device->mutex); if (--snapshot->sysfs_read == 0) { if (device->snapshot == snapshot) device->snapshot = NULL; snapshot_free = true; } kgsl_mutex_unlock(&device->mutex); if (snapshot_free) kgsl_free_snapshot(snapshot); return 0; } ret = snapshot_release(device, snapshot); return (ret < 0) ? ret : written; } /* Show the total number of hangs since device boot */ static ssize_t faultcount_show(struct kgsl_device *device, char *buf) { return scnprintf(buf, PAGE_SIZE, "%d\n", device->snapshot_faultcount); } /* Reset the total number of hangs since device boot */ static ssize_t faultcount_store(struct kgsl_device *device, const char *buf, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_snapshot.c:1007 [MATCH: mutex_unlock] --- return ret ? ret : count; } /* Show the timestamp of the last collected snapshot */ static ssize_t timestamp_show(struct kgsl_device *device, char *buf) { unsigned long timestamp; kgsl_mutex_lock(&device->mutex); timestamp = device->snapshot ? device->snapshot->timestamp : 0; kgsl_mutex_unlock(&device->mutex); return scnprintf(buf, PAGE_SIZE, "%lu\n", timestamp); } static ssize_t snapshot_legacy_show(struct kgsl_device *device, char *buf) { return scnprintf(buf, PAGE_SIZE, "%d\n", device->snapshot_legacy); } static ssize_t snapshot_legacy_store(struct kgsl_device *device, const char *buf, size_t count) { int ret; ret = kstrtobool(buf, &device->snapshot_legacy); return ret ? ret : count; } static struct bin_attribute snapshot_attr = { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_snapshot.h:76 [MATCH: timeout] --- /* OS sub-section header */ #define KGSL_SNAPSHOT_OS_LINUX_V4 0x00000203 /* Linux OS specific information */ struct kgsl_snapshot_linux_v4 { int osid; /* subsection OS identifier */ __u32 seconds; /* Unix timestamp for the snapshot */ __u32 power_flags; /* Current power flags */ __u32 power_level; /* Current power level */ __u32 power_interval_timeout; /* Power interval timeout */ __u32 grpclk; /* Current GP clock value */ __u32 busclk; /* Current busclk value */ __u64 ptbase; /* Current ptbase */ __u64 ptbase_lpac; /* Current LPAC ptbase */ __u32 pid; /* PID of the process that owns the PT */ __u32 pid_lpac; /* PID of the LPAC process that owns the PT */ __u32 current_context; /* ID of the current context */ __u32 current_context_lpac; /* ID of the current LPAC context */ __u32 ctxtcount; /* Number of contexts appended to section */ unsigned char release[32]; /* kernel release */ unsigned char version[32]; /* kernel version */ unsigned char comm[16]; /* Name of the process that owns the PT */ unsigned char comm_lpac[16]; /* Name of the LPAC process that owns the PT */ } __packed; /* * This structure contains a record of an active context. * These are appended one after another in the OS section below --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sync.c:32 [MATCH: spin_lock] --- /* List of hardware fences that haven't been destroyed */ struct list_head hw_fence_list; /* Spinlock to protect access to hw_fence_list */ spinlock_t hw_fence_list_lock; static void destroy_all_hw_fences(void); static void _hw_fence_destroy(struct kgsl_sync_fence *kfence); static inline void add_hw_fence(struct kgsl_sync_fence *kfence) { spin_lock(&hw_fence_list_lock); list_add_tail(&kfence->hw_fence_list, &hw_fence_list); spin_unlock(&hw_fence_list_lock); } #ifdef CONFIG_QCOM_KGSL_SYNX #include #include static struct synx_hw_fence_descriptor { /** @handle: Handle for hardware fences */ struct synx_session *handle; /** @descriptor: Memory descriptor for hardware fences */ struct synx_queue_desc mem_descriptor; } kgsl_synx; int kgsl_hw_fence_soccp_vote(bool pwr_on) { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sync.c:70 [MATCH: spin_lock] --- kgsl_synx.handle = synx_initialize(¶ms); if (IS_ERR_OR_NULL(kgsl_synx.handle)) { dev_err(device->dev, "HW fences not supported: %d\n", PTR_ERR_OR_ZERO(kgsl_synx.handle)); kgsl_synx.handle = NULL; return -EINVAL; } INIT_LIST_HEAD(&hw_fence_list); spin_lock_init(&hw_fence_list_lock); return 0; } void kgsl_hw_fence_close(struct kgsl_device *device) { destroy_all_hw_fences(); synx_uninitialize(kgsl_synx.handle); } void kgsl_hw_fence_populate_md(struct kgsl_device *device, struct kgsl_memdesc *md) { md->physaddr = kgsl_synx.mem_descriptor.dev_addr; md->size = kgsl_synx.mem_descriptor.size; md->hostptr = kgsl_synx.mem_descriptor.vaddr; } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sync.c:240 [MATCH: spin_lock] --- &kgsl_msm_hw_fence.mem_descriptor); if (IS_ERR_OR_NULL(kgsl_msm_hw_fence.handle)) { dev_err(device->dev, "HW fences not supported: %d\n", PTR_ERR_OR_ZERO(kgsl_msm_hw_fence.handle)); kgsl_msm_hw_fence.handle = NULL; return -EINVAL; } INIT_LIST_HEAD(&hw_fence_list); spin_lock_init(&hw_fence_list_lock); return 0; } void kgsl_hw_fence_close(struct kgsl_device *device) { destroy_all_hw_fences(); msm_hw_fence_deregister(kgsl_msm_hw_fence.handle); } void kgsl_hw_fence_populate_md(struct kgsl_device *device, struct kgsl_memdesc *md) { md->physaddr = kgsl_msm_hw_fence.mem_descriptor.device_addr; md->size = kgsl_msm_hw_fence.mem_descriptor.size; md->hostptr = kgsl_msm_hw_fence.mem_descriptor.virtual_addr; } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sync.c:401 [MATCH: spin_lock] --- */ kfence->sync_file = sync_file_create(&kfence->fence); if (kfence->sync_file == NULL) { kgsl_sync_timeline_put(ktimeline); dev_err(context->device->dev, "Create sync_file failed\n"); kfree(kfence); return NULL; } spin_lock_irqsave(&ktimeline->lock, flags); list_add_tail(&kfence->child_list, &ktimeline->child_list_head); spin_unlock_irqrestore(&ktimeline->lock, flags); return kfence; } static void kgsl_sync_fence_release(struct dma_fence *fence) { struct kgsl_sync_fence *kfence = (struct kgsl_sync_fence *)fence; if (kgsl_is_output_hw_fence(fence)) kgsl_hw_fence_destroy(kfence); kgsl_sync_timeline_put(kfence->parent); kfree(kfence); } /* Called with ktimeline->lock held */ --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sync.c:495 [MATCH: spin_lock] --- kgsl_context_put(context); kfree(event); } return ret; } /* Only to be used if creating a related event failed */ static void kgsl_sync_cancel(struct kgsl_sync_fence *kfence) { spin_lock(&kfence->parent->lock); if (!list_empty(&kfence->child_list)) { list_del_init(&kfence->child_list); dma_fence_put(&kfence->fence); } spin_unlock(&kfence->parent->lock); } /** * kgsl_add_fence_event - Create a new fence event * @device - KGSL device to create the event on * @timestamp - Timestamp to trigger the event * @data - Return fence fd stored in struct kgsl_timestamp_event_fence * @len - length of the fence event * @owner - driver instance that owns this event * @returns 0 on success or error code on error * * Create a fence and register an event to signal the fence when * the timestamp expires --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sync.c:621 [MATCH: spin_lock] --- unsigned int timestamp_queued; if (fence->ops != &kgsl_sync_fence_ops) return; if (!kref_get_unless_zero(&ktimeline->kref)) return; if (!ktimeline->device) goto put_timeline; spin_lock_irqsave(&ktimeline->lock, flags); ret = _kgsl_context_get(ktimeline->context); context = ret ? ktimeline->context : NULL; spin_unlock_irqrestore(&ktimeline->lock, flags); /* Get the last signaled timestamp if the context is not valid */ timestamp_queued = ktimeline->last_timestamp; timestamp_retired = timestamp_queued; if (context) { kgsl_readtimestamp(ktimeline->device, context, KGSL_TIMESTAMP_RETIRED, ×tamp_retired); kgsl_readtimestamp(ktimeline->device, context, KGSL_TIMESTAMP_QUEUED, ×tamp_queued); kgsl_context_put(context); } snprintf(str, size, "%u queued:%u retired:%u", --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sync.c:692 [MATCH: spin_lock] --- kref_init(&ktimeline->kref); snprintf(ktimeline->name, sizeof(ktimeline->name), "%s_%u-%.15s(%d)-%.15s(%d)", context->device->name, context->id, current->group_leader->comm, current->group_leader->pid, current->comm, current->pid); ktimeline->fence_context = dma_fence_context_alloc(1); ktimeline->last_timestamp = 0; INIT_LIST_HEAD(&ktimeline->child_list_head); spin_lock_init(&ktimeline->lock); ktimeline->device = context->device; /* * The context pointer is valid till detach time, where we put the * refcount on the context */ ktimeline->context = context; context->ktimeline = ktimeline; return 0; } void kgsl_sync_timeline_signal(struct kgsl_sync_timeline *ktimeline, unsigned int timestamp) { unsigned long flags; struct kgsl_sync_fence *kfence, *next; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sync.c:715 [MATCH: spin_lock] --- void kgsl_sync_timeline_signal(struct kgsl_sync_timeline *ktimeline, unsigned int timestamp) { unsigned long flags; struct kgsl_sync_fence *kfence, *next; if (!kref_get_unless_zero(&ktimeline->kref)) return; spin_lock_irqsave(&ktimeline->lock, flags); if (timestamp_cmp(timestamp, ktimeline->last_timestamp) > 0) ktimeline->last_timestamp = timestamp; list_for_each_entry_safe(kfence, next, &ktimeline->child_list_head, child_list) { if (dma_fence_is_signaled_locked(&kfence->fence)) { list_del_init(&kfence->child_list); dma_fence_put(&kfence->fence); } } spin_unlock_irqrestore(&ktimeline->lock, flags); kgsl_sync_timeline_put(ktimeline); } void kgsl_sync_timeline_detach(struct kgsl_sync_timeline *ktimeline) { unsigned long flags; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sync.c:737 [MATCH: spin_lock] --- spin_unlock_irqrestore(&ktimeline->lock, flags); kgsl_sync_timeline_put(ktimeline); } void kgsl_sync_timeline_detach(struct kgsl_sync_timeline *ktimeline) { unsigned long flags; struct kgsl_context *context = ktimeline->context; /* Set context pointer to NULL and drop our refcount on the context */ spin_lock_irqsave(&ktimeline->lock, flags); ktimeline->context = NULL; spin_unlock_irqrestore(&ktimeline->lock, flags); kgsl_context_put(context); } static void kgsl_sync_timeline_destroy(struct kref *kref) { struct kgsl_sync_timeline *ktimeline = container_of(kref, struct kgsl_sync_timeline, kref); kfree(ktimeline); } void kgsl_sync_timeline_put(struct kgsl_sync_timeline *ktimeline) { if (ktimeline) kref_put(&ktimeline->kref, kgsl_sync_timeline_destroy); } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sync.c:789 [MATCH: spin_lock] --- bool is_kgsl_fence(struct dma_fence *f) { if (f->ops == &kgsl_sync_fence_ops) return true; return false; } void kgsl_hw_fence_destroy(struct kgsl_sync_fence *kfence) { spin_lock(&hw_fence_list_lock); if (!list_empty(&kfence->hw_fence_list)) { _hw_fence_destroy(kfence); list_del_init(&kfence->hw_fence_list); } spin_unlock(&hw_fence_list_lock); } static void destroy_all_hw_fences(void) { struct kgsl_sync_fence *kfence, *next; spin_lock(&hw_fence_list_lock); list_for_each_entry_safe(kfence, next, &hw_fence_list, hw_fence_list) { _hw_fence_destroy(kfence); list_del_init(&kfence->hw_fence_list); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sync.c:803 [MATCH: spin_lock] --- list_del_init(&kfence->hw_fence_list); } spin_unlock(&hw_fence_list_lock); } static void destroy_all_hw_fences(void) { struct kgsl_sync_fence *kfence, *next; spin_lock(&hw_fence_list_lock); list_for_each_entry_safe(kfence, next, &hw_fence_list, hw_fence_list) { _hw_fence_destroy(kfence); list_del_init(&kfence->hw_fence_list); } spin_unlock(&hw_fence_list_lock); } static void kgsl_count_hw_fences(struct kgsl_drawobj_sync_event *event, struct dma_fence *fence) { struct kgsl_drawobj_sync *syncobj = event->syncobj; u32 max_hw_fence = event->device->max_syncobj_hw_fence_count; if (test_bit(KGSL_SYNCOBJ_SW, &syncobj->flags)) return; if (!kgsl_is_input_hw_fence(fence)) { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sync.c:1031 [MATCH: spin_lock] --- if (syncsource == NULL) { ret = -ENOMEM; goto out; } kref_init(&syncsource->refcount); snprintf(syncsource->name, sizeof(syncsource->name), "kgsl-syncsource-pid-%d", current->group_leader->pid); syncsource->private = private; INIT_LIST_HEAD(&syncsource->child_list_head); spin_lock_init(&syncsource->lock); idr_preload(GFP_KERNEL); spin_lock(&private->syncsource_lock); id = idr_alloc(&private->syncsource_idr, syncsource, 1, 0, GFP_NOWAIT); if (id > 0) { syncsource->id = id; param->id = id; ret = 0; } else { ret = id; } spin_unlock(&private->syncsource_lock); idr_preload_end(); out: if (ret) { kgsl_process_private_put(private); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sync.c:1034 [MATCH: spin_lock] --- } kref_init(&syncsource->refcount); snprintf(syncsource->name, sizeof(syncsource->name), "kgsl-syncsource-pid-%d", current->group_leader->pid); syncsource->private = private; INIT_LIST_HEAD(&syncsource->child_list_head); spin_lock_init(&syncsource->lock); idr_preload(GFP_KERNEL); spin_lock(&private->syncsource_lock); id = idr_alloc(&private->syncsource_idr, syncsource, 1, 0, GFP_NOWAIT); if (id > 0) { syncsource->id = id; param->id = id; ret = 0; } else { ret = id; } spin_unlock(&private->syncsource_lock); idr_preload_end(); out: if (ret) { kgsl_process_private_put(private); kfree(syncsource); } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sync.c:1062 [MATCH: spin_lock] --- return ret; } static struct kgsl_syncsource * kgsl_syncsource_get(struct kgsl_process_private *private, int id) { int result = 0; struct kgsl_syncsource *syncsource = NULL; spin_lock(&private->syncsource_lock); syncsource = idr_find(&private->syncsource_idr, id); if (syncsource) result = kref_get_unless_zero(&syncsource->refcount); spin_unlock(&private->syncsource_lock); return result ? syncsource : NULL; } static void kgsl_syncsource_destroy(struct kref *kref) { struct kgsl_syncsource *syncsource = container_of(kref, struct kgsl_syncsource, refcount); struct kgsl_process_private *private = syncsource->private; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sync.c:1100 [MATCH: spin_lock] --- kref_put(&syncsource->refcount, kgsl_syncsource_destroy); } static void kgsl_syncsource_cleanup(struct kgsl_process_private *private, struct kgsl_syncsource *syncsource) { struct kgsl_syncsource_fence *sfence, *next; unsigned long flags; /* Signal all fences to release any callbacks */ spin_lock_irqsave(&syncsource->lock, flags); list_for_each_entry_safe(sfence, next, &syncsource->child_list_head, child_list) { dma_fence_signal_locked(&sfence->fence); list_del_init(&sfence->child_list); } spin_unlock_irqrestore(&syncsource->lock, flags); /* put reference from syncsource creation */ kgsl_syncsource_put(syncsource); } long kgsl_ioctl_syncsource_destroy(struct kgsl_device_private *dev_priv, unsigned int cmd, void *data) { struct kgsl_syncsource_destroy *param = data; struct kgsl_syncsource *syncsource = NULL; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sync.c:1121 [MATCH: spin_lock] --- kgsl_syncsource_put(syncsource); } long kgsl_ioctl_syncsource_destroy(struct kgsl_device_private *dev_priv, unsigned int cmd, void *data) { struct kgsl_syncsource_destroy *param = data; struct kgsl_syncsource *syncsource = NULL; struct kgsl_process_private *private = dev_priv->process_priv; spin_lock(&private->syncsource_lock); syncsource = idr_find(&private->syncsource_idr, param->id); if (syncsource == NULL) { spin_unlock(&private->syncsource_lock); return -EINVAL; } if (syncsource->id != 0) { idr_remove(&private->syncsource_idr, syncsource->id); syncsource->id = 0; } spin_unlock(&private->syncsource_lock); kgsl_syncsource_cleanup(private, syncsource); return 0; } long kgsl_ioctl_syncsource_create_fence(struct kgsl_device_private *dev_priv, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sync.c:1190 [MATCH: spin_lock] --- if (fd < 0) { ret = -EBADF; goto out; } ret = 0; fd_install(fd, sync_file->file); param->fence_fd = fd; spin_lock_irqsave(&syncsource->lock, flags); list_add_tail(&sfence->child_list, &syncsource->child_list_head); spin_unlock_irqrestore(&syncsource->lock, flags); out: /* * We're transferring ownership of the fence to the sync file. * The sync file takes an extra refcount when it is created, so put * our refcount. */ if (sync_file) dma_fence_put(&sfence->fence); if (ret) { if (sync_file) fput(sync_file->file); else if (sfence) dma_fence_put(&sfence->fence); else kgsl_syncsource_put(syncsource); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sync.c:1221 [MATCH: spin_lock] --- return ret; } static int kgsl_syncsource_signal(struct kgsl_syncsource *syncsource, struct dma_fence *fence) { struct kgsl_syncsource_fence *sfence, *next; int ret = -EINVAL; unsigned long flags; spin_lock_irqsave(&syncsource->lock, flags); list_for_each_entry_safe(sfence, next, &syncsource->child_list_head, child_list) { if (fence == &sfence->fence) { dma_fence_signal_locked(fence); list_del_init(&sfence->child_list); ret = 0; break; } } spin_unlock_irqrestore(&syncsource->lock, flags); return ret; } long kgsl_ioctl_syncsource_signal_fence(struct kgsl_device_private *dev_priv, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sync.c:1288 [MATCH: spin_lock] --- kfree(sfence); } void kgsl_syncsource_process_release_syncsources( struct kgsl_process_private *private) { struct kgsl_syncsource *syncsource; int next = 0; while (1) { spin_lock(&private->syncsource_lock); syncsource = idr_get_next(&private->syncsource_idr, &next); if (syncsource == NULL) { spin_unlock(&private->syncsource_lock); break; } if (syncsource->id != 0) { idr_remove(&private->syncsource_idr, syncsource->id); syncsource->id = 0; } spin_unlock(&private->syncsource_lock); kgsl_syncsource_cleanup(private, syncsource); next = next + 1; } } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sync.c:34 [MATCH: spin_unlock] --- /* Spinlock to protect access to hw_fence_list */ spinlock_t hw_fence_list_lock; static void destroy_all_hw_fences(void); static void _hw_fence_destroy(struct kgsl_sync_fence *kfence); static inline void add_hw_fence(struct kgsl_sync_fence *kfence) { spin_lock(&hw_fence_list_lock); list_add_tail(&kfence->hw_fence_list, &hw_fence_list); spin_unlock(&hw_fence_list_lock); } #ifdef CONFIG_QCOM_KGSL_SYNX #include #include static struct synx_hw_fence_descriptor { /** @handle: Handle for hardware fences */ struct synx_session *handle; /** @descriptor: Memory descriptor for hardware fences */ struct synx_queue_desc mem_descriptor; } kgsl_synx; int kgsl_hw_fence_soccp_vote(bool pwr_on) { return synx_enable_resources(SYNX_CLIENT_HW_FENCE_GFX_CTX0, SYNX_RESOURCE_SOCCP, pwr_on); } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sync.c:403 [MATCH: spin_unlock] --- if (kfence->sync_file == NULL) { kgsl_sync_timeline_put(ktimeline); dev_err(context->device->dev, "Create sync_file failed\n"); kfree(kfence); return NULL; } spin_lock_irqsave(&ktimeline->lock, flags); list_add_tail(&kfence->child_list, &ktimeline->child_list_head); spin_unlock_irqrestore(&ktimeline->lock, flags); return kfence; } static void kgsl_sync_fence_release(struct dma_fence *fence) { struct kgsl_sync_fence *kfence = (struct kgsl_sync_fence *)fence; if (kgsl_is_output_hw_fence(fence)) kgsl_hw_fence_destroy(kfence); kgsl_sync_timeline_put(kfence->parent); kfree(kfence); } /* Called with ktimeline->lock held */ static bool kgsl_sync_fence_has_signaled(struct dma_fence *fence) { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sync.c:500 [MATCH: spin_unlock] --- } /* Only to be used if creating a related event failed */ static void kgsl_sync_cancel(struct kgsl_sync_fence *kfence) { spin_lock(&kfence->parent->lock); if (!list_empty(&kfence->child_list)) { list_del_init(&kfence->child_list); dma_fence_put(&kfence->fence); } spin_unlock(&kfence->parent->lock); } /** * kgsl_add_fence_event - Create a new fence event * @device - KGSL device to create the event on * @timestamp - Timestamp to trigger the event * @data - Return fence fd stored in struct kgsl_timestamp_event_fence * @len - length of the fence event * @owner - driver instance that owns this event * @returns 0 on success or error code on error * * Create a fence and register an event to signal the fence when * the timestamp expires */ int kgsl_add_fence_event(struct kgsl_device *device, u32 context_id, u32 timestamp, void __user *data, int len, struct kgsl_device_private *owner) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sync.c:624 [MATCH: spin_unlock] --- return; if (!kref_get_unless_zero(&ktimeline->kref)) return; if (!ktimeline->device) goto put_timeline; spin_lock_irqsave(&ktimeline->lock, flags); ret = _kgsl_context_get(ktimeline->context); context = ret ? ktimeline->context : NULL; spin_unlock_irqrestore(&ktimeline->lock, flags); /* Get the last signaled timestamp if the context is not valid */ timestamp_queued = ktimeline->last_timestamp; timestamp_retired = timestamp_queued; if (context) { kgsl_readtimestamp(ktimeline->device, context, KGSL_TIMESTAMP_RETIRED, ×tamp_retired); kgsl_readtimestamp(ktimeline->device, context, KGSL_TIMESTAMP_QUEUED, ×tamp_queued); kgsl_context_put(context); } snprintf(str, size, "%u queued:%u retired:%u", ktimeline->last_timestamp, timestamp_queued, timestamp_retired); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sync.c:727 [MATCH: spin_unlock] --- ktimeline->last_timestamp = timestamp; list_for_each_entry_safe(kfence, next, &ktimeline->child_list_head, child_list) { if (dma_fence_is_signaled_locked(&kfence->fence)) { list_del_init(&kfence->child_list); dma_fence_put(&kfence->fence); } } spin_unlock_irqrestore(&ktimeline->lock, flags); kgsl_sync_timeline_put(ktimeline); } void kgsl_sync_timeline_detach(struct kgsl_sync_timeline *ktimeline) { unsigned long flags; struct kgsl_context *context = ktimeline->context; /* Set context pointer to NULL and drop our refcount on the context */ spin_lock_irqsave(&ktimeline->lock, flags); ktimeline->context = NULL; spin_unlock_irqrestore(&ktimeline->lock, flags); kgsl_context_put(context); } static void kgsl_sync_timeline_destroy(struct kref *kref) { struct kgsl_sync_timeline *ktimeline = --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sync.c:739 [MATCH: spin_unlock] --- } void kgsl_sync_timeline_detach(struct kgsl_sync_timeline *ktimeline) { unsigned long flags; struct kgsl_context *context = ktimeline->context; /* Set context pointer to NULL and drop our refcount on the context */ spin_lock_irqsave(&ktimeline->lock, flags); ktimeline->context = NULL; spin_unlock_irqrestore(&ktimeline->lock, flags); kgsl_context_put(context); } static void kgsl_sync_timeline_destroy(struct kref *kref) { struct kgsl_sync_timeline *ktimeline = container_of(kref, struct kgsl_sync_timeline, kref); kfree(ktimeline); } void kgsl_sync_timeline_put(struct kgsl_sync_timeline *ktimeline) { if (ktimeline) kref_put(&ktimeline->kref, kgsl_sync_timeline_destroy); } const struct dma_fence_ops kgsl_sync_fence_ops = { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sync.c:796 [MATCH: spin_unlock] --- void kgsl_hw_fence_destroy(struct kgsl_sync_fence *kfence) { spin_lock(&hw_fence_list_lock); if (!list_empty(&kfence->hw_fence_list)) { _hw_fence_destroy(kfence); list_del_init(&kfence->hw_fence_list); } spin_unlock(&hw_fence_list_lock); } static void destroy_all_hw_fences(void) { struct kgsl_sync_fence *kfence, *next; spin_lock(&hw_fence_list_lock); list_for_each_entry_safe(kfence, next, &hw_fence_list, hw_fence_list) { _hw_fence_destroy(kfence); list_del_init(&kfence->hw_fence_list); } spin_unlock(&hw_fence_list_lock); } static void kgsl_count_hw_fences(struct kgsl_drawobj_sync_event *event, struct dma_fence *fence) { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sync.c:810 [MATCH: spin_unlock] --- { struct kgsl_sync_fence *kfence, *next; spin_lock(&hw_fence_list_lock); list_for_each_entry_safe(kfence, next, &hw_fence_list, hw_fence_list) { _hw_fence_destroy(kfence); list_del_init(&kfence->hw_fence_list); } spin_unlock(&hw_fence_list_lock); } static void kgsl_count_hw_fences(struct kgsl_drawobj_sync_event *event, struct dma_fence *fence) { struct kgsl_drawobj_sync *syncobj = event->syncobj; u32 max_hw_fence = event->device->max_syncobj_hw_fence_count; if (test_bit(KGSL_SYNCOBJ_SW, &syncobj->flags)) return; if (!kgsl_is_input_hw_fence(fence)) { /* * Ignore software fences that are already signaled. Even one unsignaled sw-only * fence in this sync object means we can't send this sync object to the hardware */ if (!dma_fence_is_signaled(fence)) set_bit(KGSL_SYNCOBJ_SW, &syncobj->flags); return; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sync.c:1044 [MATCH: spin_unlock] --- spin_lock(&private->syncsource_lock); id = idr_alloc(&private->syncsource_idr, syncsource, 1, 0, GFP_NOWAIT); if (id > 0) { syncsource->id = id; param->id = id; ret = 0; } else { ret = id; } spin_unlock(&private->syncsource_lock); idr_preload_end(); out: if (ret) { kgsl_process_private_put(private); kfree(syncsource); } return ret; } static struct kgsl_syncsource * kgsl_syncsource_get(struct kgsl_process_private *private, int id) { int result = 0; struct kgsl_syncsource *syncsource = NULL; spin_lock(&private->syncsource_lock); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sync.c:1068 [MATCH: spin_unlock] --- { int result = 0; struct kgsl_syncsource *syncsource = NULL; spin_lock(&private->syncsource_lock); syncsource = idr_find(&private->syncsource_idr, id); if (syncsource) result = kref_get_unless_zero(&syncsource->refcount); spin_unlock(&private->syncsource_lock); return result ? syncsource : NULL; } static void kgsl_syncsource_destroy(struct kref *kref) { struct kgsl_syncsource *syncsource = container_of(kref, struct kgsl_syncsource, refcount); struct kgsl_process_private *private = syncsource->private; /* Done with process private. Release the refcount */ kgsl_process_private_put(private); kfree(syncsource); } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sync.c:1108 [MATCH: spin_unlock] --- /* Signal all fences to release any callbacks */ spin_lock_irqsave(&syncsource->lock, flags); list_for_each_entry_safe(sfence, next, &syncsource->child_list_head, child_list) { dma_fence_signal_locked(&sfence->fence); list_del_init(&sfence->child_list); } spin_unlock_irqrestore(&syncsource->lock, flags); /* put reference from syncsource creation */ kgsl_syncsource_put(syncsource); } long kgsl_ioctl_syncsource_destroy(struct kgsl_device_private *dev_priv, unsigned int cmd, void *data) { struct kgsl_syncsource_destroy *param = data; struct kgsl_syncsource *syncsource = NULL; struct kgsl_process_private *private = dev_priv->process_priv; spin_lock(&private->syncsource_lock); syncsource = idr_find(&private->syncsource_idr, param->id); if (syncsource == NULL) { spin_unlock(&private->syncsource_lock); return -EINVAL; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sync.c:1125 [MATCH: spin_unlock] --- unsigned int cmd, void *data) { struct kgsl_syncsource_destroy *param = data; struct kgsl_syncsource *syncsource = NULL; struct kgsl_process_private *private = dev_priv->process_priv; spin_lock(&private->syncsource_lock); syncsource = idr_find(&private->syncsource_idr, param->id); if (syncsource == NULL) { spin_unlock(&private->syncsource_lock); return -EINVAL; } if (syncsource->id != 0) { idr_remove(&private->syncsource_idr, syncsource->id); syncsource->id = 0; } spin_unlock(&private->syncsource_lock); kgsl_syncsource_cleanup(private, syncsource); return 0; } long kgsl_ioctl_syncsource_create_fence(struct kgsl_device_private *dev_priv, unsigned int cmd, void *data) { struct kgsl_syncsource_create_fence *param = data; struct kgsl_syncsource *syncsource = NULL; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sync.c:1133 [MATCH: spin_unlock] --- if (syncsource == NULL) { spin_unlock(&private->syncsource_lock); return -EINVAL; } if (syncsource->id != 0) { idr_remove(&private->syncsource_idr, syncsource->id); syncsource->id = 0; } spin_unlock(&private->syncsource_lock); kgsl_syncsource_cleanup(private, syncsource); return 0; } long kgsl_ioctl_syncsource_create_fence(struct kgsl_device_private *dev_priv, unsigned int cmd, void *data) { struct kgsl_syncsource_create_fence *param = data; struct kgsl_syncsource *syncsource = NULL; int ret = -EINVAL; struct kgsl_syncsource_fence *sfence = NULL; struct sync_file *sync_file = NULL; int fd = -1; unsigned long flags; /* * Take a refcount that is released when the fence is released --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sync.c:1192 [MATCH: spin_unlock] --- goto out; } ret = 0; fd_install(fd, sync_file->file); param->fence_fd = fd; spin_lock_irqsave(&syncsource->lock, flags); list_add_tail(&sfence->child_list, &syncsource->child_list_head); spin_unlock_irqrestore(&syncsource->lock, flags); out: /* * We're transferring ownership of the fence to the sync file. * The sync file takes an extra refcount when it is created, so put * our refcount. */ if (sync_file) dma_fence_put(&sfence->fence); if (ret) { if (sync_file) fput(sync_file->file); else if (sfence) dma_fence_put(&sfence->fence); else kgsl_syncsource_put(syncsource); } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sync.c:1234 [MATCH: spin_unlock] --- child_list) { if (fence == &sfence->fence) { dma_fence_signal_locked(fence); list_del_init(&sfence->child_list); ret = 0; break; } } spin_unlock_irqrestore(&syncsource->lock, flags); return ret; } long kgsl_ioctl_syncsource_signal_fence(struct kgsl_device_private *dev_priv, unsigned int cmd, void *data) { int ret = -EINVAL; struct kgsl_syncsource_signal_fence *param = data; struct kgsl_syncsource *syncsource = NULL; struct dma_fence *fence = NULL; syncsource = kgsl_syncsource_get(dev_priv->process_priv, param->id); if (syncsource == NULL) goto out; fence = sync_file_get_fence(param->fence_fd); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sync.c:1292 [MATCH: spin_unlock] --- struct kgsl_process_private *private) { struct kgsl_syncsource *syncsource; int next = 0; while (1) { spin_lock(&private->syncsource_lock); syncsource = idr_get_next(&private->syncsource_idr, &next); if (syncsource == NULL) { spin_unlock(&private->syncsource_lock); break; } if (syncsource->id != 0) { idr_remove(&private->syncsource_idr, syncsource->id); syncsource->id = 0; } spin_unlock(&private->syncsource_lock); kgsl_syncsource_cleanup(private, syncsource); next = next + 1; } } static const char *kgsl_syncsource_get_timeline_name(struct dma_fence *fence) { struct kgsl_syncsource_fence *sfence = (struct kgsl_syncsource_fence *)fence; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sync.c:1300 [MATCH: spin_unlock] --- if (syncsource == NULL) { spin_unlock(&private->syncsource_lock); break; } if (syncsource->id != 0) { idr_remove(&private->syncsource_idr, syncsource->id); syncsource->id = 0; } spin_unlock(&private->syncsource_lock); kgsl_syncsource_cleanup(private, syncsource); next = next + 1; } } static const char *kgsl_syncsource_get_timeline_name(struct dma_fence *fence) { struct kgsl_syncsource_fence *sfence = (struct kgsl_syncsource_fence *)fence; struct kgsl_syncsource *syncsource = sfence->parent; return syncsource->name; } static bool kgsl_syncsource_enable_signaling(struct dma_fence *fence) { return true; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.c:499 [MATCH: timeout] --- return ret ? timeline : NULL; } long kgsl_ioctl_timeline_wait(struct kgsl_device_private *dev_priv, unsigned int cmd, void *data) { struct kgsl_device *device = dev_priv->device; struct kgsl_timeline_wait *param = data; struct dma_fence_array *array; struct dma_fence **fences; unsigned long timeout; signed long ret; int i; if (param->flags != KGSL_TIMELINE_WAIT_ANY && param->flags != KGSL_TIMELINE_WAIT_ALL) return -EINVAL; if (param->padding) return -EINVAL; fences = kgsl_timelines_collect_fences(device, param->timelines, param->count, param->timelines_size); if (IS_ERR(fences)) return PTR_ERR(fences); if (param->tv_sec >= KTIME_SEC_MAX) timeout = MAX_SCHEDULE_TIMEOUT; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.c:517 [MATCH: timeout] --- if (param->padding) return -EINVAL; fences = kgsl_timelines_collect_fences(device, param->timelines, param->count, param->timelines_size); if (IS_ERR(fences)) return PTR_ERR(fences); if (param->tv_sec >= KTIME_SEC_MAX) timeout = MAX_SCHEDULE_TIMEOUT; else { ktime_t time = ktime_set(param->tv_sec, param->tv_nsec); timeout = msecs_to_jiffies(ktime_to_ms(time)); } trace_kgsl_timeline_wait(param->flags, param->tv_sec, param->tv_nsec); if (param->flags == KGSL_TIMELINE_WAIT_ANY) { ret = dma_fence_wait_any_timeout(fences, param->count, true, timeout, NULL); for (i = 0; i < param->count; i++) dma_fence_put(fences[i]); kfree(fences); } else { array = kgsl_dma_fence_array_create(param->count, fences); if (!array) { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.c:521 [MATCH: timeout] --- param->count, param->timelines_size); if (IS_ERR(fences)) return PTR_ERR(fences); if (param->tv_sec >= KTIME_SEC_MAX) timeout = MAX_SCHEDULE_TIMEOUT; else { ktime_t time = ktime_set(param->tv_sec, param->tv_nsec); timeout = msecs_to_jiffies(ktime_to_ms(time)); } trace_kgsl_timeline_wait(param->flags, param->tv_sec, param->tv_nsec); if (param->flags == KGSL_TIMELINE_WAIT_ANY) { ret = dma_fence_wait_any_timeout(fences, param->count, true, timeout, NULL); for (i = 0; i < param->count; i++) dma_fence_put(fences[i]); kfree(fences); } else { array = kgsl_dma_fence_array_create(param->count, fences); if (!array) { for (i = 0; i < param->count; i++) dma_fence_put(fences[i]); kfree(fences); return -ENOMEM; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.c:527 [MATCH: timeout] --- timeout = MAX_SCHEDULE_TIMEOUT; else { ktime_t time = ktime_set(param->tv_sec, param->tv_nsec); timeout = msecs_to_jiffies(ktime_to_ms(time)); } trace_kgsl_timeline_wait(param->flags, param->tv_sec, param->tv_nsec); if (param->flags == KGSL_TIMELINE_WAIT_ANY) { ret = dma_fence_wait_any_timeout(fences, param->count, true, timeout, NULL); for (i = 0; i < param->count; i++) dma_fence_put(fences[i]); kfree(fences); } else { array = kgsl_dma_fence_array_create(param->count, fences); if (!array) { for (i = 0; i < param->count; i++) dma_fence_put(fences[i]); kfree(fences); return -ENOMEM; } ret = dma_fence_wait_timeout(&array->base, true, timeout); dma_fence_put(&array->base); } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.c:528 [MATCH: timeout] --- else { ktime_t time = ktime_set(param->tv_sec, param->tv_nsec); timeout = msecs_to_jiffies(ktime_to_ms(time)); } trace_kgsl_timeline_wait(param->flags, param->tv_sec, param->tv_nsec); if (param->flags == KGSL_TIMELINE_WAIT_ANY) { ret = dma_fence_wait_any_timeout(fences, param->count, true, timeout, NULL); for (i = 0; i < param->count; i++) dma_fence_put(fences[i]); kfree(fences); } else { array = kgsl_dma_fence_array_create(param->count, fences); if (!array) { for (i = 0; i < param->count; i++) dma_fence_put(fences[i]); kfree(fences); return -ENOMEM; } ret = dma_fence_wait_timeout(&array->base, true, timeout); dma_fence_put(&array->base); } if (!ret) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.c:542 [MATCH: timeout] --- kfree(fences); } else { array = kgsl_dma_fence_array_create(param->count, fences); if (!array) { for (i = 0; i < param->count; i++) dma_fence_put(fences[i]); kfree(fences); return -ENOMEM; } ret = dma_fence_wait_timeout(&array->base, true, timeout); dma_fence_put(&array->base); } if (!ret) ret = (!timeout) ? -EBUSY : -ETIMEDOUT; else if (ret > 0) ret = 0; return ret; } long kgsl_ioctl_timeline_query(struct kgsl_device_private *dev_priv, unsigned int cmd, void *data) { struct kgsl_timeline_val *param = data; struct kgsl_timeline *timeline; struct kgsl_timeline_event *event; u64 seqno; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.c:547 [MATCH: timeout] --- dma_fence_put(fences[i]); kfree(fences); return -ENOMEM; } ret = dma_fence_wait_timeout(&array->base, true, timeout); dma_fence_put(&array->base); } if (!ret) ret = (!timeout) ? -EBUSY : -ETIMEDOUT; else if (ret > 0) ret = 0; return ret; } long kgsl_ioctl_timeline_query(struct kgsl_device_private *dev_priv, unsigned int cmd, void *data) { struct kgsl_timeline_val *param = data; struct kgsl_timeline *timeline; struct kgsl_timeline_event *event; u64 seqno; if (param->padding) return -EINVAL; timeline = kgsl_timeline_by_id(dev_priv->device, param->timeline); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.c:176 [MATCH: spin_lock] --- { struct kgsl_device *device = dev_priv->device; struct kgsl_timeline *timeline; int id; timeline = kzalloc(sizeof(*timeline), GFP_KERNEL); if (!timeline) return ERR_PTR(-ENOMEM); idr_preload(GFP_KERNEL); spin_lock(&device->timelines_lock); /* Allocate the ID but don't attach the pointer just yet */ id = idr_alloc(&device->timelines, NULL, 1, 0, GFP_NOWAIT); spin_unlock(&device->timelines_lock); idr_preload_end(); if (id < 0) { kfree(timeline); return ERR_PTR(id); } timeline->context = dma_fence_context_alloc(1); timeline->id = id; INIT_LIST_HEAD(&timeline->fences); INIT_LIST_HEAD(&timeline->events); timeline->value = initial; timeline->dev_priv = dev_priv; snprintf((char *) timeline->name, sizeof(timeline->name), --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.c:199 [MATCH: spin_lock] --- INIT_LIST_HEAD(&timeline->fences); INIT_LIST_HEAD(&timeline->events); timeline->value = initial; timeline->dev_priv = dev_priv; snprintf((char *) timeline->name, sizeof(timeline->name), "kgsl-sw-timeline-%d", id); trace_kgsl_timeline_alloc(id, initial); spin_lock_init(&timeline->lock); spin_lock_init(&timeline->fence_lock); kref_init(&timeline->ref); return timeline; } static struct kgsl_timeline_fence *to_timeline_fence(struct dma_fence *fence) { return container_of(fence, struct kgsl_timeline_fence, base); } static void timeline_fence_release(struct dma_fence *fence) { struct kgsl_timeline_fence *f = to_timeline_fence(fence); struct kgsl_timeline *timeline = f->timeline; struct kgsl_timeline_fence *cur, *temp; unsigned long flags; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.c:200 [MATCH: spin_lock] --- INIT_LIST_HEAD(&timeline->events); timeline->value = initial; timeline->dev_priv = dev_priv; snprintf((char *) timeline->name, sizeof(timeline->name), "kgsl-sw-timeline-%d", id); trace_kgsl_timeline_alloc(id, initial); spin_lock_init(&timeline->lock); spin_lock_init(&timeline->fence_lock); kref_init(&timeline->ref); return timeline; } static struct kgsl_timeline_fence *to_timeline_fence(struct dma_fence *fence) { return container_of(fence, struct kgsl_timeline_fence, base); } static void timeline_fence_release(struct dma_fence *fence) { struct kgsl_timeline_fence *f = to_timeline_fence(fence); struct kgsl_timeline *timeline = f->timeline; struct kgsl_timeline_fence *cur, *temp; unsigned long flags; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.c:219 [MATCH: spin_lock] --- return container_of(fence, struct kgsl_timeline_fence, base); } static void timeline_fence_release(struct dma_fence *fence) { struct kgsl_timeline_fence *f = to_timeline_fence(fence); struct kgsl_timeline *timeline = f->timeline; struct kgsl_timeline_fence *cur, *temp; unsigned long flags; spin_lock_irqsave(&timeline->fence_lock, flags); /* If the fence is still on the active list, remove it */ list_for_each_entry_safe(cur, temp, &timeline->fences, node) { if (f != cur) continue; list_del_init(&f->node); break; } spin_unlock_irqrestore(&timeline->fence_lock, flags); trace_kgsl_timeline_fence_release(f->timeline->id, fence->seqno); log_kgsl_timeline_fence_release_event(f->timeline->id, fence->seqno); kgsl_timeline_put(f->timeline); dma_fence_free(fence); } #if (KERNEL_VERSION(6, 17, 0) <= LINUX_VERSION_CODE) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.c:330 [MATCH: spin_lock] --- kgsl_sync_timeline_value_str(fence, value, size); } #endif static void kgsl_timeline_add_fence(struct kgsl_timeline *timeline, struct kgsl_timeline_fence *fence) { struct kgsl_timeline_fence *entry; unsigned long flags; spin_lock_irqsave(&timeline->fence_lock, flags); list_for_each_entry(entry, &timeline->fences, node) { if (fence->base.seqno < entry->base.seqno) { list_add_tail(&fence->node, &entry->node); spin_unlock_irqrestore(&timeline->fence_lock, flags); return; } } list_add_tail(&fence->node, &timeline->fences); spin_unlock_irqrestore(&timeline->fence_lock, flags); } void kgsl_timeline_add_signal(struct kgsl_timeline_event *signal) { struct kgsl_timeline *timeline = signal->timeline; struct kgsl_timeline_event *event; unsigned long flags; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.c:349 [MATCH: spin_lock] --- list_add_tail(&fence->node, &timeline->fences); spin_unlock_irqrestore(&timeline->fence_lock, flags); } void kgsl_timeline_add_signal(struct kgsl_timeline_event *signal) { struct kgsl_timeline *timeline = signal->timeline; struct kgsl_timeline_event *event; unsigned long flags; spin_lock_irqsave(&timeline->lock, flags); /* If we already signaled this seqno don't add it to the list */ if (timeline->value >= signal->seqno) goto done; /* Keep the list sorted by seqno */ list_for_each_entry_reverse(event, &timeline->events, node) { if (event->seqno <= signal->seqno) break; } list_add(&signal->node, &event->node); done: spin_unlock_irqrestore(&timeline->lock, flags); } void kgsl_timeline_signal(struct kgsl_timeline *timeline, u64 seqno) { struct kgsl_timeline_fence *fence, *tmp; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.c:373 [MATCH: spin_lock] --- } void kgsl_timeline_signal(struct kgsl_timeline *timeline, u64 seqno) { struct kgsl_timeline_fence *fence, *tmp; struct kgsl_timeline_event *event, *tmp_event; struct list_head temp; INIT_LIST_HEAD(&temp); spin_lock_irq(&timeline->lock); if (seqno < timeline->value) goto unlock; trace_kgsl_timeline_signal(timeline->id, seqno); timeline->value = seqno; list_for_each_entry_safe(event, tmp_event, &timeline->events, node) { /* List is sorted by seqno */ if (event->seqno > seqno) break; /* Remove retired nodes */ list_del(&event->node); } spin_lock(&timeline->fence_lock); list_for_each_entry_safe(fence, tmp, &timeline->fences, node) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.c:390 [MATCH: spin_lock] --- timeline->value = seqno; list_for_each_entry_safe(event, tmp_event, &timeline->events, node) { /* List is sorted by seqno */ if (event->seqno > seqno) break; /* Remove retired nodes */ list_del(&event->node); } spin_lock(&timeline->fence_lock); list_for_each_entry_safe(fence, tmp, &timeline->fences, node) if (timeline_fence_signaled(&fence->base) && kref_get_unless_zero(&fence->base.refcount)) list_move(&fence->node, &temp); spin_unlock(&timeline->fence_lock); list_for_each_entry_safe(fence, tmp, &temp, node) { dma_fence_signal_locked(&fence->base); dma_fence_put(&fence->base); } unlock: spin_unlock_irq(&timeline->lock); } #if KERNEL_VERSION(6, 17, 0) <= LINUX_VERSION_CODE static inline void kgsl_timeline_dma_fence_init(struct dma_fence *fence, const struct dma_fence_ops *ops, spinlock_t *lock, u64 context, u64 seqno) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.c:445 [MATCH: spin_lock] --- kgsl_timeline_dma_fence_init(&fence->base, &timeline_fence_ops, &timeline->lock, timeline->context, seqno); INIT_LIST_HEAD(&fence->node); /* * Once fence is checked as not signaled, allow it to be added * in the list before other thread such as kgsl_timeline_signal * can get chance to signal. */ spin_lock_irq(&timeline->lock); if (!dma_fence_is_signaled_locked(&fence->base)) kgsl_timeline_add_fence(timeline, fence); trace_kgsl_timeline_fence_alloc(timeline->id, seqno); spin_unlock_irq(&timeline->lock); log_kgsl_timeline_fence_alloc_event(timeline->id, seqno); return &fence->base; } long kgsl_ioctl_timeline_create(struct kgsl_device_private *dev_priv, unsigned int cmd, void *data) { struct kgsl_device *device = dev_priv->device; struct kgsl_timeline_create *param = data; struct kgsl_timeline *timeline; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.c:469 [MATCH: spin_lock] --- { struct kgsl_device *device = dev_priv->device; struct kgsl_timeline_create *param = data; struct kgsl_timeline *timeline; timeline = kgsl_timeline_alloc(dev_priv, param->seqno); if (IS_ERR(timeline)) return PTR_ERR(timeline); /* Commit the pointer to the timeline in timeline idr */ spin_lock(&device->timelines_lock); idr_replace(&device->timelines, timeline, timeline->id); param->id = timeline->id; spin_unlock(&device->timelines_lock); return 0; } struct kgsl_timeline *kgsl_timeline_by_id(struct kgsl_device *device, u32 id) { struct kgsl_timeline *timeline; int ret = 0; spin_lock(&device->timelines_lock); timeline = idr_find(&device->timelines, id); if (timeline) ret = kref_get_unless_zero(&timeline->ref); spin_unlock(&device->timelines_lock); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.c:482 [MATCH: spin_lock] --- spin_unlock(&device->timelines_lock); return 0; } struct kgsl_timeline *kgsl_timeline_by_id(struct kgsl_device *device, u32 id) { struct kgsl_timeline *timeline; int ret = 0; spin_lock(&device->timelines_lock); timeline = idr_find(&device->timelines, id); if (timeline) ret = kref_get_unless_zero(&timeline->ref); spin_unlock(&device->timelines_lock); return ret ? timeline : NULL; } long kgsl_ioctl_timeline_wait(struct kgsl_device_private *dev_priv, unsigned int cmd, void *data) { struct kgsl_device *device = dev_priv->device; struct kgsl_timeline_wait *param = data; struct dma_fence_array *array; struct dma_fence **fences; unsigned long timeout; signed long ret; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.c:575 [MATCH: spin_lock] --- timeline = kgsl_timeline_by_id(dev_priv->device, param->timeline); if (!timeline) return -ENODEV; /* * Start from the end of the list to find the last retired signal event * that was not yet processed. Leave the entry in the list until the * timeline signal actually advances the timeline's value. This ensures * subsequent query ioctls return a monotonically increasing seqno. */ spin_lock_irq(&timeline->lock); seqno = timeline->value; list_for_each_entry_reverse(event, &timeline->events, node) { if (kgsl_check_timestamp(event->context->device, event->context, event->timestamp)) { seqno = event->seqno; break; } } spin_unlock_irq(&timeline->lock); param->seqno = seqno; kgsl_timeline_put(timeline); return 0; } long kgsl_ioctl_timeline_fence_get(struct kgsl_device_private *dev_priv, unsigned int cmd, void *data) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.c:690 [MATCH: spin_lock] --- { struct kgsl_device *device = dev_priv->device; struct kgsl_timeline_fence *fence, *tmp; struct kgsl_timeline *timeline; struct list_head temp; u32 *param = data; if (*param == 0) return -ENODEV; spin_lock(&device->timelines_lock); timeline = idr_find(&device->timelines, *param); if (timeline == NULL) { spin_unlock(&device->timelines_lock); return -ENODEV; } /* * Validate that the id given is owned by the dev_priv * instance that is passed in. If not, abort. */ if (timeline->dev_priv != dev_priv) { spin_unlock(&device->timelines_lock); return -EINVAL; } idr_remove(&device->timelines, timeline->id); spin_unlock(&device->timelines_lock); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.c:712 [MATCH: spin_lock] --- if (timeline->dev_priv != dev_priv) { spin_unlock(&device->timelines_lock); return -EINVAL; } idr_remove(&device->timelines, timeline->id); spin_unlock(&device->timelines_lock); INIT_LIST_HEAD(&temp); spin_lock(&timeline->fence_lock); list_for_each_entry_safe(fence, tmp, &timeline->fences, node) if (!kref_get_unless_zero(&fence->base.refcount)) list_del_init(&fence->node); list_replace_init(&timeline->fences, &temp); spin_unlock(&timeline->fence_lock); spin_lock_irq(&timeline->lock); list_for_each_entry_safe(fence, tmp, &temp, node) { dma_fence_set_error(&fence->base, -ENOENT); dma_fence_signal_locked(&fence->base); dma_fence_put(&fence->base); } spin_unlock_irq(&timeline->lock); kgsl_timeline_put(timeline); return 0; } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.c:719 [MATCH: spin_lock] --- INIT_LIST_HEAD(&temp); spin_lock(&timeline->fence_lock); list_for_each_entry_safe(fence, tmp, &timeline->fences, node) if (!kref_get_unless_zero(&fence->base.refcount)) list_del_init(&fence->node); list_replace_init(&timeline->fences, &temp); spin_unlock(&timeline->fence_lock); spin_lock_irq(&timeline->lock); list_for_each_entry_safe(fence, tmp, &temp, node) { dma_fence_set_error(&fence->base, -ENOENT); dma_fence_signal_locked(&fence->base); dma_fence_put(&fence->base); } spin_unlock_irq(&timeline->lock); kgsl_timeline_put(timeline); return 0; } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.c:179 [MATCH: spin_unlock] --- int id; timeline = kzalloc(sizeof(*timeline), GFP_KERNEL); if (!timeline) return ERR_PTR(-ENOMEM); idr_preload(GFP_KERNEL); spin_lock(&device->timelines_lock); /* Allocate the ID but don't attach the pointer just yet */ id = idr_alloc(&device->timelines, NULL, 1, 0, GFP_NOWAIT); spin_unlock(&device->timelines_lock); idr_preload_end(); if (id < 0) { kfree(timeline); return ERR_PTR(id); } timeline->context = dma_fence_context_alloc(1); timeline->id = id; INIT_LIST_HEAD(&timeline->fences); INIT_LIST_HEAD(&timeline->events); timeline->value = initial; timeline->dev_priv = dev_priv; snprintf((char *) timeline->name, sizeof(timeline->name), "kgsl-sw-timeline-%d", id); trace_kgsl_timeline_alloc(id, initial); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.c:229 [MATCH: spin_unlock] --- spin_lock_irqsave(&timeline->fence_lock, flags); /* If the fence is still on the active list, remove it */ list_for_each_entry_safe(cur, temp, &timeline->fences, node) { if (f != cur) continue; list_del_init(&f->node); break; } spin_unlock_irqrestore(&timeline->fence_lock, flags); trace_kgsl_timeline_fence_release(f->timeline->id, fence->seqno); log_kgsl_timeline_fence_release_event(f->timeline->id, fence->seqno); kgsl_timeline_put(f->timeline); dma_fence_free(fence); } #if (KERNEL_VERSION(6, 17, 0) <= LINUX_VERSION_CODE) static bool timeline_fence_signaled(struct dma_fence *fence) { struct kgsl_timeline_fence *f = to_timeline_fence(fence); return !__dma_fence_is_later(fence, fence->seqno, f->timeline->value); } #else static bool timeline_fence_signaled(struct dma_fence *fence) { struct kgsl_timeline_fence *f = to_timeline_fence(fence); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.c:334 [MATCH: spin_unlock] --- static void kgsl_timeline_add_fence(struct kgsl_timeline *timeline, struct kgsl_timeline_fence *fence) { struct kgsl_timeline_fence *entry; unsigned long flags; spin_lock_irqsave(&timeline->fence_lock, flags); list_for_each_entry(entry, &timeline->fences, node) { if (fence->base.seqno < entry->base.seqno) { list_add_tail(&fence->node, &entry->node); spin_unlock_irqrestore(&timeline->fence_lock, flags); return; } } list_add_tail(&fence->node, &timeline->fences); spin_unlock_irqrestore(&timeline->fence_lock, flags); } void kgsl_timeline_add_signal(struct kgsl_timeline_event *signal) { struct kgsl_timeline *timeline = signal->timeline; struct kgsl_timeline_event *event; unsigned long flags; spin_lock_irqsave(&timeline->lock, flags); /* If we already signaled this seqno don't add it to the list */ if (timeline->value >= signal->seqno) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.c:340 [MATCH: spin_unlock] --- spin_lock_irqsave(&timeline->fence_lock, flags); list_for_each_entry(entry, &timeline->fences, node) { if (fence->base.seqno < entry->base.seqno) { list_add_tail(&fence->node, &entry->node); spin_unlock_irqrestore(&timeline->fence_lock, flags); return; } } list_add_tail(&fence->node, &timeline->fences); spin_unlock_irqrestore(&timeline->fence_lock, flags); } void kgsl_timeline_add_signal(struct kgsl_timeline_event *signal) { struct kgsl_timeline *timeline = signal->timeline; struct kgsl_timeline_event *event; unsigned long flags; spin_lock_irqsave(&timeline->lock, flags); /* If we already signaled this seqno don't add it to the list */ if (timeline->value >= signal->seqno) goto done; /* Keep the list sorted by seqno */ list_for_each_entry_reverse(event, &timeline->events, node) { if (event->seqno <= signal->seqno) break; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.c:362 [MATCH: spin_unlock] --- if (timeline->value >= signal->seqno) goto done; /* Keep the list sorted by seqno */ list_for_each_entry_reverse(event, &timeline->events, node) { if (event->seqno <= signal->seqno) break; } list_add(&signal->node, &event->node); done: spin_unlock_irqrestore(&timeline->lock, flags); } void kgsl_timeline_signal(struct kgsl_timeline *timeline, u64 seqno) { struct kgsl_timeline_fence *fence, *tmp; struct kgsl_timeline_event *event, *tmp_event; struct list_head temp; INIT_LIST_HEAD(&temp); spin_lock_irq(&timeline->lock); if (seqno < timeline->value) goto unlock; trace_kgsl_timeline_signal(timeline->id, seqno); timeline->value = seqno; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.c:395 [MATCH: spin_unlock] --- /* Remove retired nodes */ list_del(&event->node); } spin_lock(&timeline->fence_lock); list_for_each_entry_safe(fence, tmp, &timeline->fences, node) if (timeline_fence_signaled(&fence->base) && kref_get_unless_zero(&fence->base.refcount)) list_move(&fence->node, &temp); spin_unlock(&timeline->fence_lock); list_for_each_entry_safe(fence, tmp, &temp, node) { dma_fence_signal_locked(&fence->base); dma_fence_put(&fence->base); } unlock: spin_unlock_irq(&timeline->lock); } #if KERNEL_VERSION(6, 17, 0) <= LINUX_VERSION_CODE static inline void kgsl_timeline_dma_fence_init(struct dma_fence *fence, const struct dma_fence_ops *ops, spinlock_t *lock, u64 context, u64 seqno) { dma_fence_init64(fence, ops, lock, context, seqno); } #else static inline void kgsl_timeline_dma_fence_init(struct dma_fence *fence, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.c:403 [MATCH: spin_unlock] --- kref_get_unless_zero(&fence->base.refcount)) list_move(&fence->node, &temp); spin_unlock(&timeline->fence_lock); list_for_each_entry_safe(fence, tmp, &temp, node) { dma_fence_signal_locked(&fence->base); dma_fence_put(&fence->base); } unlock: spin_unlock_irq(&timeline->lock); } #if KERNEL_VERSION(6, 17, 0) <= LINUX_VERSION_CODE static inline void kgsl_timeline_dma_fence_init(struct dma_fence *fence, const struct dma_fence_ops *ops, spinlock_t *lock, u64 context, u64 seqno) { dma_fence_init64(fence, ops, lock, context, seqno); } #else static inline void kgsl_timeline_dma_fence_init(struct dma_fence *fence, const struct dma_fence_ops *ops, spinlock_t *lock, u64 context, u64 seqno) { dma_fence_init(fence, ops, lock, context, seqno); } #endif struct dma_fence *kgsl_timeline_fence_alloc(struct kgsl_timeline *timeline, u64 seqno) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.c:450 [MATCH: spin_unlock] --- /* * Once fence is checked as not signaled, allow it to be added * in the list before other thread such as kgsl_timeline_signal * can get chance to signal. */ spin_lock_irq(&timeline->lock); if (!dma_fence_is_signaled_locked(&fence->base)) kgsl_timeline_add_fence(timeline, fence); trace_kgsl_timeline_fence_alloc(timeline->id, seqno); spin_unlock_irq(&timeline->lock); log_kgsl_timeline_fence_alloc_event(timeline->id, seqno); return &fence->base; } long kgsl_ioctl_timeline_create(struct kgsl_device_private *dev_priv, unsigned int cmd, void *data) { struct kgsl_device *device = dev_priv->device; struct kgsl_timeline_create *param = data; struct kgsl_timeline *timeline; timeline = kgsl_timeline_alloc(dev_priv, param->seqno); if (IS_ERR(timeline)) return PTR_ERR(timeline); /* Commit the pointer to the timeline in timeline idr */ --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.c:472 [MATCH: spin_unlock] --- struct kgsl_timeline *timeline; timeline = kgsl_timeline_alloc(dev_priv, param->seqno); if (IS_ERR(timeline)) return PTR_ERR(timeline); /* Commit the pointer to the timeline in timeline idr */ spin_lock(&device->timelines_lock); idr_replace(&device->timelines, timeline, timeline->id); param->id = timeline->id; spin_unlock(&device->timelines_lock); return 0; } struct kgsl_timeline *kgsl_timeline_by_id(struct kgsl_device *device, u32 id) { struct kgsl_timeline *timeline; int ret = 0; spin_lock(&device->timelines_lock); timeline = idr_find(&device->timelines, id); if (timeline) ret = kref_get_unless_zero(&timeline->ref); spin_unlock(&device->timelines_lock); return ret ? timeline : NULL; } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.c:487 [MATCH: spin_unlock] --- u32 id) { struct kgsl_timeline *timeline; int ret = 0; spin_lock(&device->timelines_lock); timeline = idr_find(&device->timelines, id); if (timeline) ret = kref_get_unless_zero(&timeline->ref); spin_unlock(&device->timelines_lock); return ret ? timeline : NULL; } long kgsl_ioctl_timeline_wait(struct kgsl_device_private *dev_priv, unsigned int cmd, void *data) { struct kgsl_device *device = dev_priv->device; struct kgsl_timeline_wait *param = data; struct dma_fence_array *array; struct dma_fence **fences; unsigned long timeout; signed long ret; int i; if (param->flags != KGSL_TIMELINE_WAIT_ANY && param->flags != KGSL_TIMELINE_WAIT_ALL) return -EINVAL; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.c:584 [MATCH: spin_unlock] --- */ spin_lock_irq(&timeline->lock); seqno = timeline->value; list_for_each_entry_reverse(event, &timeline->events, node) { if (kgsl_check_timestamp(event->context->device, event->context, event->timestamp)) { seqno = event->seqno; break; } } spin_unlock_irq(&timeline->lock); param->seqno = seqno; kgsl_timeline_put(timeline); return 0; } long kgsl_ioctl_timeline_fence_get(struct kgsl_device_private *dev_priv, unsigned int cmd, void *data) { struct kgsl_device *device = dev_priv->device; struct kgsl_timeline_fence_get *param = data; struct kgsl_timeline *timeline; struct sync_file *sync_file; struct dma_fence *fence; int ret = 0, fd; timeline = kgsl_timeline_by_id(device, param->timeline); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.c:694 [MATCH: spin_unlock] --- struct list_head temp; u32 *param = data; if (*param == 0) return -ENODEV; spin_lock(&device->timelines_lock); timeline = idr_find(&device->timelines, *param); if (timeline == NULL) { spin_unlock(&device->timelines_lock); return -ENODEV; } /* * Validate that the id given is owned by the dev_priv * instance that is passed in. If not, abort. */ if (timeline->dev_priv != dev_priv) { spin_unlock(&device->timelines_lock); return -EINVAL; } idr_remove(&device->timelines, timeline->id); spin_unlock(&device->timelines_lock); INIT_LIST_HEAD(&temp); spin_lock(&timeline->fence_lock); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.c:703 [MATCH: spin_unlock] --- if (timeline == NULL) { spin_unlock(&device->timelines_lock); return -ENODEV; } /* * Validate that the id given is owned by the dev_priv * instance that is passed in. If not, abort. */ if (timeline->dev_priv != dev_priv) { spin_unlock(&device->timelines_lock); return -EINVAL; } idr_remove(&device->timelines, timeline->id); spin_unlock(&device->timelines_lock); INIT_LIST_HEAD(&temp); spin_lock(&timeline->fence_lock); list_for_each_entry_safe(fence, tmp, &timeline->fences, node) if (!kref_get_unless_zero(&fence->base.refcount)) list_del_init(&fence->node); list_replace_init(&timeline->fences, &temp); spin_unlock(&timeline->fence_lock); spin_lock_irq(&timeline->lock); list_for_each_entry_safe(fence, tmp, &temp, node) { dma_fence_set_error(&fence->base, -ENOENT); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.c:708 [MATCH: spin_unlock] --- /* * Validate that the id given is owned by the dev_priv * instance that is passed in. If not, abort. */ if (timeline->dev_priv != dev_priv) { spin_unlock(&device->timelines_lock); return -EINVAL; } idr_remove(&device->timelines, timeline->id); spin_unlock(&device->timelines_lock); INIT_LIST_HEAD(&temp); spin_lock(&timeline->fence_lock); list_for_each_entry_safe(fence, tmp, &timeline->fences, node) if (!kref_get_unless_zero(&fence->base.refcount)) list_del_init(&fence->node); list_replace_init(&timeline->fences, &temp); spin_unlock(&timeline->fence_lock); spin_lock_irq(&timeline->lock); list_for_each_entry_safe(fence, tmp, &temp, node) { dma_fence_set_error(&fence->base, -ENOENT); dma_fence_signal_locked(&fence->base); dma_fence_put(&fence->base); } spin_unlock_irq(&timeline->lock); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.c:717 [MATCH: spin_unlock] --- idr_remove(&device->timelines, timeline->id); spin_unlock(&device->timelines_lock); INIT_LIST_HEAD(&temp); spin_lock(&timeline->fence_lock); list_for_each_entry_safe(fence, tmp, &timeline->fences, node) if (!kref_get_unless_zero(&fence->base.refcount)) list_del_init(&fence->node); list_replace_init(&timeline->fences, &temp); spin_unlock(&timeline->fence_lock); spin_lock_irq(&timeline->lock); list_for_each_entry_safe(fence, tmp, &temp, node) { dma_fence_set_error(&fence->base, -ENOENT); dma_fence_signal_locked(&fence->base); dma_fence_put(&fence->base); } spin_unlock_irq(&timeline->lock); kgsl_timeline_put(timeline); return 0; } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.c:725 [MATCH: spin_unlock] --- list_del_init(&fence->node); list_replace_init(&timeline->fences, &temp); spin_unlock(&timeline->fence_lock); spin_lock_irq(&timeline->lock); list_for_each_entry_safe(fence, tmp, &temp, node) { dma_fence_set_error(&fence->base, -ENOENT); dma_fence_signal_locked(&fence->base); dma_fence_put(&fence->base); } spin_unlock_irq(&timeline->lock); kgsl_timeline_put(timeline); return 0; } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_trace.h:144 [MATCH: timeout] --- /* * Tracepoint for kgsl waittimestamp entry */ TRACE_EVENT(kgsl_waittimestamp_entry, TP_PROTO(struct kgsl_device *device, unsigned int context_id, unsigned int curr_ts, unsigned int wait_ts, unsigned int timeout), TP_ARGS(device, context_id, curr_ts, wait_ts, timeout), TP_STRUCT__entry( __string(device_name, device->name) __field(unsigned int, context_id) __field(unsigned int, curr_ts) __field(unsigned int, wait_ts) __field(unsigned int, timeout) ), TP_fast_assign( kgsl_assign_str(device_name, device->name); __entry->context_id = context_id; __entry->curr_ts = curr_ts; __entry->wait_ts = wait_ts; __entry->timeout = timeout; ), --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_trace.h:146 [MATCH: timeout] --- * Tracepoint for kgsl waittimestamp entry */ TRACE_EVENT(kgsl_waittimestamp_entry, TP_PROTO(struct kgsl_device *device, unsigned int context_id, unsigned int curr_ts, unsigned int wait_ts, unsigned int timeout), TP_ARGS(device, context_id, curr_ts, wait_ts, timeout), TP_STRUCT__entry( __string(device_name, device->name) __field(unsigned int, context_id) __field(unsigned int, curr_ts) __field(unsigned int, wait_ts) __field(unsigned int, timeout) ), TP_fast_assign( kgsl_assign_str(device_name, device->name); __entry->context_id = context_id; __entry->curr_ts = curr_ts; __entry->wait_ts = wait_ts; __entry->timeout = timeout; ), TP_printk( --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_trace.h:153 [MATCH: timeout] --- unsigned int wait_ts, unsigned int timeout), TP_ARGS(device, context_id, curr_ts, wait_ts, timeout), TP_STRUCT__entry( __string(device_name, device->name) __field(unsigned int, context_id) __field(unsigned int, curr_ts) __field(unsigned int, wait_ts) __field(unsigned int, timeout) ), TP_fast_assign( kgsl_assign_str(device_name, device->name); __entry->context_id = context_id; __entry->curr_ts = curr_ts; __entry->wait_ts = wait_ts; __entry->timeout = timeout; ), TP_printk( "d_name=%s ctx=%u curr_ts=%u ts=%u timeout=%u", __get_str(device_name), __entry->context_id, __entry->curr_ts, __entry->wait_ts, __entry->timeout ) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_trace.h:161 [MATCH: timeout] --- __field(unsigned int, curr_ts) __field(unsigned int, wait_ts) __field(unsigned int, timeout) ), TP_fast_assign( kgsl_assign_str(device_name, device->name); __entry->context_id = context_id; __entry->curr_ts = curr_ts; __entry->wait_ts = wait_ts; __entry->timeout = timeout; ), TP_printk( "d_name=%s ctx=%u curr_ts=%u ts=%u timeout=%u", __get_str(device_name), __entry->context_id, __entry->curr_ts, __entry->wait_ts, __entry->timeout ) ); /* * Tracepoint for kgsl waittimestamp exit */ TRACE_EVENT(kgsl_waittimestamp_exit, TP_PROTO(struct kgsl_device *device, unsigned int curr_ts, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_trace.h:165 [MATCH: timeout] --- TP_fast_assign( kgsl_assign_str(device_name, device->name); __entry->context_id = context_id; __entry->curr_ts = curr_ts; __entry->wait_ts = wait_ts; __entry->timeout = timeout; ), TP_printk( "d_name=%s ctx=%u curr_ts=%u ts=%u timeout=%u", __get_str(device_name), __entry->context_id, __entry->curr_ts, __entry->wait_ts, __entry->timeout ) ); /* * Tracepoint for kgsl waittimestamp exit */ TRACE_EVENT(kgsl_waittimestamp_exit, TP_PROTO(struct kgsl_device *device, unsigned int curr_ts, int result), TP_ARGS(device, curr_ts, result), --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_trace.h:170 [MATCH: timeout] --- __entry->wait_ts = wait_ts; __entry->timeout = timeout; ), TP_printk( "d_name=%s ctx=%u curr_ts=%u ts=%u timeout=%u", __get_str(device_name), __entry->context_id, __entry->curr_ts, __entry->wait_ts, __entry->timeout ) ); /* * Tracepoint for kgsl waittimestamp exit */ TRACE_EVENT(kgsl_waittimestamp_exit, TP_PROTO(struct kgsl_device *device, unsigned int curr_ts, int result), TP_ARGS(device, curr_ts, result), TP_STRUCT__entry( __string(device_name, device->name) __field(unsigned int, curr_ts) __field(int, result) ), --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_trace.h:1260 [MATCH: seqnum] --- TP_PROTO(unsigned int mask), TP_ARGS(mask) ); DEFINE_EVENT(gmu_oob_template, kgsl_gmu_oob_clear, TP_PROTO(unsigned int mask), TP_ARGS(mask) ); DECLARE_EVENT_CLASS(hfi_msg_template, TP_PROTO(unsigned int id, unsigned int size, unsigned int seqnum), TP_ARGS(id, size, seqnum), TP_STRUCT__entry( __field(unsigned int, id) __field(unsigned int, size) __field(unsigned int, seq) ), TP_fast_assign( __entry->id = id; __entry->size = size; __entry->seq = seqnum; ), TP_printk("id=0x%x size=0x%x seqnum=0x%x", __entry->id, __entry->size, __entry->seq) ); DEFINE_EVENT(hfi_msg_template, kgsl_hfi_send, TP_PROTO(unsigned int id, unsigned int size, unsigned int seqnum), TP_ARGS(id, size, seqnum) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_trace.h:1261 [MATCH: seqnum] --- TP_ARGS(mask) ); DEFINE_EVENT(gmu_oob_template, kgsl_gmu_oob_clear, TP_PROTO(unsigned int mask), TP_ARGS(mask) ); DECLARE_EVENT_CLASS(hfi_msg_template, TP_PROTO(unsigned int id, unsigned int size, unsigned int seqnum), TP_ARGS(id, size, seqnum), TP_STRUCT__entry( __field(unsigned int, id) __field(unsigned int, size) __field(unsigned int, seq) ), TP_fast_assign( __entry->id = id; __entry->size = size; __entry->seq = seqnum; ), TP_printk("id=0x%x size=0x%x seqnum=0x%x", __entry->id, __entry->size, __entry->seq) ); DEFINE_EVENT(hfi_msg_template, kgsl_hfi_send, TP_PROTO(unsigned int id, unsigned int size, unsigned int seqnum), TP_ARGS(id, size, seqnum) ); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_trace.h:1270 [MATCH: seqnum] --- TP_PROTO(unsigned int id, unsigned int size, unsigned int seqnum), TP_ARGS(id, size, seqnum), TP_STRUCT__entry( __field(unsigned int, id) __field(unsigned int, size) __field(unsigned int, seq) ), TP_fast_assign( __entry->id = id; __entry->size = size; __entry->seq = seqnum; ), TP_printk("id=0x%x size=0x%x seqnum=0x%x", __entry->id, __entry->size, __entry->seq) ); DEFINE_EVENT(hfi_msg_template, kgsl_hfi_send, TP_PROTO(unsigned int id, unsigned int size, unsigned int seqnum), TP_ARGS(id, size, seqnum) ); DEFINE_EVENT(hfi_msg_template, kgsl_hfi_receive, TP_PROTO(unsigned int id, unsigned int size, unsigned int seqnum), TP_ARGS(id, size, seqnum) ); TRACE_EVENT(kgsl_timeline_alloc, TP_PROTO( u32 id, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_trace.h:1272 [MATCH: seqnum] --- TP_STRUCT__entry( __field(unsigned int, id) __field(unsigned int, size) __field(unsigned int, seq) ), TP_fast_assign( __entry->id = id; __entry->size = size; __entry->seq = seqnum; ), TP_printk("id=0x%x size=0x%x seqnum=0x%x", __entry->id, __entry->size, __entry->seq) ); DEFINE_EVENT(hfi_msg_template, kgsl_hfi_send, TP_PROTO(unsigned int id, unsigned int size, unsigned int seqnum), TP_ARGS(id, size, seqnum) ); DEFINE_EVENT(hfi_msg_template, kgsl_hfi_receive, TP_PROTO(unsigned int id, unsigned int size, unsigned int seqnum), TP_ARGS(id, size, seqnum) ); TRACE_EVENT(kgsl_timeline_alloc, TP_PROTO( u32 id, u64 seqno ), --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_trace.h:1277 [MATCH: seqnum] --- TP_fast_assign( __entry->id = id; __entry->size = size; __entry->seq = seqnum; ), TP_printk("id=0x%x size=0x%x seqnum=0x%x", __entry->id, __entry->size, __entry->seq) ); DEFINE_EVENT(hfi_msg_template, kgsl_hfi_send, TP_PROTO(unsigned int id, unsigned int size, unsigned int seqnum), TP_ARGS(id, size, seqnum) ); DEFINE_EVENT(hfi_msg_template, kgsl_hfi_receive, TP_PROTO(unsigned int id, unsigned int size, unsigned int seqnum), TP_ARGS(id, size, seqnum) ); TRACE_EVENT(kgsl_timeline_alloc, TP_PROTO( u32 id, u64 seqno ), TP_ARGS( id, seqno ), TP_STRUCT__entry( --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_trace.h:1278 [MATCH: seqnum] --- __entry->id = id; __entry->size = size; __entry->seq = seqnum; ), TP_printk("id=0x%x size=0x%x seqnum=0x%x", __entry->id, __entry->size, __entry->seq) ); DEFINE_EVENT(hfi_msg_template, kgsl_hfi_send, TP_PROTO(unsigned int id, unsigned int size, unsigned int seqnum), TP_ARGS(id, size, seqnum) ); DEFINE_EVENT(hfi_msg_template, kgsl_hfi_receive, TP_PROTO(unsigned int id, unsigned int size, unsigned int seqnum), TP_ARGS(id, size, seqnum) ); TRACE_EVENT(kgsl_timeline_alloc, TP_PROTO( u32 id, u64 seqno ), TP_ARGS( id, seqno ), TP_STRUCT__entry( __field(u32, id) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_trace.h:1282 [MATCH: seqnum] --- TP_printk("id=0x%x size=0x%x seqnum=0x%x", __entry->id, __entry->size, __entry->seq) ); DEFINE_EVENT(hfi_msg_template, kgsl_hfi_send, TP_PROTO(unsigned int id, unsigned int size, unsigned int seqnum), TP_ARGS(id, size, seqnum) ); DEFINE_EVENT(hfi_msg_template, kgsl_hfi_receive, TP_PROTO(unsigned int id, unsigned int size, unsigned int seqnum), TP_ARGS(id, size, seqnum) ); TRACE_EVENT(kgsl_timeline_alloc, TP_PROTO( u32 id, u64 seqno ), TP_ARGS( id, seqno ), TP_STRUCT__entry( __field(u32, id) __field(u64, seqno) ), TP_fast_assign( __entry->id = id; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_trace.h:1283 [MATCH: seqnum] --- __entry->id, __entry->size, __entry->seq) ); DEFINE_EVENT(hfi_msg_template, kgsl_hfi_send, TP_PROTO(unsigned int id, unsigned int size, unsigned int seqnum), TP_ARGS(id, size, seqnum) ); DEFINE_EVENT(hfi_msg_template, kgsl_hfi_receive, TP_PROTO(unsigned int id, unsigned int size, unsigned int seqnum), TP_ARGS(id, size, seqnum) ); TRACE_EVENT(kgsl_timeline_alloc, TP_PROTO( u32 id, u64 seqno ), TP_ARGS( id, seqno ), TP_STRUCT__entry( __field(u32, id) __field(u64, seqno) ), TP_fast_assign( __entry->id = id; __entry->seqno = seqno; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_util.c:149 [MATCH: timeout] --- gpu_req, ret); else return -EOPNOTSUPP; } return ret; } int kgsl_hwlock(struct cpu_gpu_lock *lock) { unsigned long timeout = jiffies + msecs_to_jiffies(1000); /* Indicate that the CPU wants the lock */ lock->cpu_req = 1; /* post the request */ wmb(); /* Wait for our turn */ lock->turn = 0; /* Finish all memory transactions before moving on */ mb(); /* * Spin here while GPU ucode holds the lock, lock->gpu_req will * be set to 0 after GPU ucode releases the lock. Maximum wait time * is 1 second and this should be enough for GPU to release the lock. */ --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_util.c:173 [MATCH: timeout] --- /* * Spin here while GPU ucode holds the lock, lock->gpu_req will * be set to 0 after GPU ucode releases the lock. Maximum wait time * is 1 second and this should be enough for GPU to release the lock. */ while (lock->gpu_req && lock->turn == 0) { cpu_relax(); /* Get the latest updates from GPU */ rmb(); if (time_after(jiffies, timeout)) break; } if (lock->gpu_req && lock->turn == 0) return -EBUSY; return 0; } void kgsl_hwunlock(struct cpu_gpu_lock *lock) { /* Make sure all writes are done before releasing the lock */ wmb(); lock->cpu_req = 0; } bool kgsl_is_compatible_node_available(const char *compat) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_vbo.c:735 [MATCH: wait_for_completion] --- return 0; } /* * Schedule the work. All the resources will be released after * the bind operation is done */ kgsl_sharedmem_bind_ranges(op); ret = wait_for_completion_interruptible(&op->comp); kgsl_sharedmem_put_bind_op(op); return ret; } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_vbo.c:584 [MATCH: complete_all] --- op->ops[i].child_offset); } else { kgsl_memdesc_remove_range(op->target, op->ops[i].start, op->ops[i].last, op->ops[i].entry); } } /* Wake up any threads waiting for the bind operation */ complete_all(&op->comp); if (op->callback) op->callback(op); /* Put the refcount we took when scheduling the worker */ kgsl_sharedmem_put_bind_op(op); } void kgsl_sharedmem_bind_ranges(struct kgsl_sharedmem_bind_op *op) { /* Take a reference to the operation while it is scheduled */ kref_get(&op->ref); INIT_WORK(&op->work, kgsl_sharedmem_bind_worker); schedule_work(&op->work); } struct kgsl_sharedmem_bind_fence { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_vbo.c:102 [MATCH: mutex_lock] --- mutex_unlock(&memdesc->ranges_lock); } static void kgsl_memdesc_remove_range(struct kgsl_mem_entry *target, u64 start, u64 last, struct kgsl_mem_entry *entry) { struct interval_tree_node *node, *next; struct kgsl_memdesc_bind_range *range; struct kgsl_memdesc *memdesc = &target->memdesc; mutex_lock(&memdesc->ranges_lock); next = interval_tree_iter_first(&memdesc->ranges, start, last); while (next) { node = next; range = bind_to_range(node); next = interval_tree_iter_next(node, start, last); /* * If entry is null, consider it as a special request. Unbind * the entire range between start and last in this case. */ if (!entry || range->entry->id == entry->id) { if (kgsl_mmu_unmap_range(memdesc->pagetable, memdesc, range->range.start, bind_range_len(range))) continue; interval_tree_remove(node, &memdesc->ranges); trace_kgsl_mem_remove_bind_range(target, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_vbo.c:147 [MATCH: mutex_lock] --- { struct interval_tree_node *node, *next; struct kgsl_memdesc *memdesc = &target->memdesc; struct kgsl_memdesc_bind_range *range = bind_range_create(start, last, entry); int ret = 0; if (IS_ERR(range)) return PTR_ERR(range); mutex_lock(&memdesc->ranges_lock); /* * If the VBO maps the zero page, then we can unmap the requested range * in one call. Otherwise we have to figure out what ranges to unmap * while walking the interval tree. */ if (!(memdesc->flags & KGSL_MEMFLAGS_VBO_NO_MAP_ZERO)) { ret = kgsl_mmu_unmap_range(memdesc->pagetable, memdesc, start, last - start + 1); if (ret) goto error; } next = interval_tree_iter_first(&memdesc->ranges, start, last); while (next) { struct kgsl_memdesc_bind_range *cur; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_vbo.c:92 [MATCH: mutex_unlock] --- while (next) { struct kgsl_memdesc_bind_range *range = bind_to_range(next); seq_printf(s, "%5d %5d 0x%16.16lx-0x%16.16lx\n", entry->id, range->entry->id, range->range.start, range->range.last); next = interval_tree_iter_next(next, 0, ~0UL); } mutex_unlock(&memdesc->ranges_lock); } static void kgsl_memdesc_remove_range(struct kgsl_mem_entry *target, u64 start, u64 last, struct kgsl_mem_entry *entry) { struct interval_tree_node *node, *next; struct kgsl_memdesc_bind_range *range; struct kgsl_memdesc *memdesc = &target->memdesc; mutex_lock(&memdesc->ranges_lock); next = interval_tree_iter_first(&memdesc->ranges, start, last); while (next) { node = next; range = bind_to_range(node); next = interval_tree_iter_next(node, start, last); /* --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_vbo.c:132 [MATCH: mutex_unlock] --- bind_range_len(range)); if (!(memdesc->flags & KGSL_MEMFLAGS_VBO_NO_MAP_ZERO)) kgsl_mmu_map_zero_page_to_range(memdesc->pagetable, memdesc, range->range.start, bind_range_len(range)); bind_range_destroy(range); } } mutex_unlock(&memdesc->ranges_lock); } static int kgsl_memdesc_add_range(struct kgsl_mem_entry *target, u64 start, u64 last, struct kgsl_mem_entry *entry, u64 offset) { struct interval_tree_node *node, *next; struct kgsl_memdesc *memdesc = &target->memdesc; struct kgsl_memdesc_bind_range *range = bind_range_create(start, last, entry); int ret = 0; if (IS_ERR(range)) return PTR_ERR(range); mutex_lock(&memdesc->ranges_lock); /* * If the VBO maps the zero page, then we can unmap the requested range --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_vbo.c:260 [MATCH: mutex_unlock] --- ret = kgsl_mmu_map_child(memdesc->pagetable, memdesc, start, &entry->memdesc, offset, last - start + 1); if (ret) goto error; /* Add the new range */ interval_tree_insert(&range->range, &memdesc->ranges); trace_kgsl_mem_add_bind_range(target, range->range.start, range->entry, bind_range_len(range)); mutex_unlock(&memdesc->ranges_lock); return ret; error: bind_range_destroy(range); mutex_unlock(&memdesc->ranges_lock); return ret; } static void kgsl_sharedmem_vbo_put_gpuaddr(struct kgsl_memdesc *memdesc) { struct interval_tree_node *node, *next; struct kgsl_memdesc_bind_range *range; int ret = 0; bool unmap_fail; /* * If the VBO maps the zero range then we can unmap the entire --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_vbo.c:266 [MATCH: mutex_unlock] --- interval_tree_insert(&range->range, &memdesc->ranges); trace_kgsl_mem_add_bind_range(target, range->range.start, range->entry, bind_range_len(range)); mutex_unlock(&memdesc->ranges_lock); return ret; error: bind_range_destroy(range); mutex_unlock(&memdesc->ranges_lock); return ret; } static void kgsl_sharedmem_vbo_put_gpuaddr(struct kgsl_memdesc *memdesc) { struct interval_tree_node *node, *next; struct kgsl_memdesc_bind_range *range; int ret = 0; bool unmap_fail; /* * If the VBO maps the zero range then we can unmap the entire * pagetable region in one call. */ if (!(memdesc->flags & KGSL_MEMFLAGS_VBO_NO_MAP_ZERO)) ret = kgsl_mmu_unmap_range(memdesc->pagetable, memdesc, 0, memdesc->size); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_vbo.c:564 [MATCH: spin_lock] --- } static void kgsl_sharedmem_bind_worker(struct work_struct *work) { struct kgsl_sharedmem_bind_op *op = container_of(work, struct kgsl_sharedmem_bind_op, work); int i; for (i = 0; i < op->nr_ops; i++) { if (op->ops[i].op == KGSL_GPUMEM_RANGE_OP_BIND) { spin_lock(&op->ops[i].entry->priv->mem_lock); if (op->ops[i].entry->pending_free) { spin_unlock(&op->ops[i].entry->priv->mem_lock); continue; } spin_unlock(&op->ops[i].entry->priv->mem_lock); kgsl_memdesc_add_range(op->target, op->ops[i].start, op->ops[i].last, op->ops[i].entry, op->ops[i].child_offset); } else { kgsl_memdesc_remove_range(op->target, op->ops[i].start, op->ops[i].last, op->ops[i].entry); } } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_vbo.c:654 [MATCH: spin_lock] --- kgsl_sharedmem_bind_fence(struct kgsl_sharedmem_bind_op *op) { struct kgsl_sharedmem_bind_fence *fence; struct sync_file *sync_file; int fd; fence = kzalloc(sizeof(*fence), GFP_KERNEL); if (!fence) return ERR_PTR(-ENOMEM); spin_lock_init(&fence->lock); dma_fence_init(&fence->base, &kgsl_sharedmem_bind_fence_ops, &fence->lock, dma_fence_context_alloc(1), 0); fd = get_unused_fd_flags(O_CLOEXEC); if (fd < 0) { kfree(fence); return ERR_PTR(fd); } sync_file = sync_file_create(&fence->base); if (!sync_file) { put_unused_fd(fd); kfree(fence); return ERR_PTR(-ENOMEM); } fd_install(fd, sync_file->file); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_vbo.c:566 [MATCH: spin_unlock] --- static void kgsl_sharedmem_bind_worker(struct work_struct *work) { struct kgsl_sharedmem_bind_op *op = container_of(work, struct kgsl_sharedmem_bind_op, work); int i; for (i = 0; i < op->nr_ops; i++) { if (op->ops[i].op == KGSL_GPUMEM_RANGE_OP_BIND) { spin_lock(&op->ops[i].entry->priv->mem_lock); if (op->ops[i].entry->pending_free) { spin_unlock(&op->ops[i].entry->priv->mem_lock); continue; } spin_unlock(&op->ops[i].entry->priv->mem_lock); kgsl_memdesc_add_range(op->target, op->ops[i].start, op->ops[i].last, op->ops[i].entry, op->ops[i].child_offset); } else { kgsl_memdesc_remove_range(op->target, op->ops[i].start, op->ops[i].last, op->ops[i].entry); } } /* Wake up any threads waiting for the bind operation */ complete_all(&op->comp); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_vbo.c:569 [MATCH: spin_unlock] --- struct kgsl_sharedmem_bind_op, work); int i; for (i = 0; i < op->nr_ops; i++) { if (op->ops[i].op == KGSL_GPUMEM_RANGE_OP_BIND) { spin_lock(&op->ops[i].entry->priv->mem_lock); if (op->ops[i].entry->pending_free) { spin_unlock(&op->ops[i].entry->priv->mem_lock); continue; } spin_unlock(&op->ops[i].entry->priv->mem_lock); kgsl_memdesc_add_range(op->target, op->ops[i].start, op->ops[i].last, op->ops[i].entry, op->ops[i].child_offset); } else { kgsl_memdesc_remove_range(op->target, op->ops[i].start, op->ops[i].last, op->ops[i].entry); } } /* Wake up any threads waiting for the bind operation */ complete_all(&op->comp); if (op->callback) op->callback(op); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\include\uapi\linux\msm_kgsl.h:242 [MATCH: timeout] --- #define KGSL_FLAGS_INITIALIZED0 0x00000002 #define KGSL_FLAGS_INITIALIZED 0x00000004 #define KGSL_FLAGS_STARTED 0x00000008 #define KGSL_FLAGS_ACTIVE 0x00000010 #define KGSL_FLAGS_RESERVED0 0x00000020 #define KGSL_FLAGS_RESERVED1 0x00000040 #define KGSL_FLAGS_RESERVED2 0x00000080 #define KGSL_FLAGS_SOFT_RESET 0x00000100 #define KGSL_FLAGS_PER_CONTEXT_TIMESTAMPS 0x00000200 /* Server Side Sync Timeout in milliseconds */ #define KGSL_SYNCOBJ_SERVER_TIMEOUT 2000 /* UBWC Modes */ #define KGSL_UBWC_NONE 0 #define KGSL_UBWC_1_0 1 #define KGSL_UBWC_2_0 2 #define KGSL_UBWC_3_0 3 #define KGSL_UBWC_4_0 4 #define KGSL_UBWC_5_0 5 #define KGSL_UBWC_6_0 6 /* * Reset status values for context */ enum kgsl_ctx_reset_stat { KGSL_CTX_STAT_NO_ERROR = 0x00000000, KGSL_CTX_STAT_GUILTY_CONTEXT_RESET_EXT = 0x00000001, KGSL_CTX_STAT_INNOCENT_CONTEXT_RESET_EXT = 0x00000002, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\include\uapi\linux\msm_kgsl.h:243 [MATCH: timeout] --- #define KGSL_FLAGS_INITIALIZED 0x00000004 #define KGSL_FLAGS_STARTED 0x00000008 #define KGSL_FLAGS_ACTIVE 0x00000010 #define KGSL_FLAGS_RESERVED0 0x00000020 #define KGSL_FLAGS_RESERVED1 0x00000040 #define KGSL_FLAGS_RESERVED2 0x00000080 #define KGSL_FLAGS_SOFT_RESET 0x00000100 #define KGSL_FLAGS_PER_CONTEXT_TIMESTAMPS 0x00000200 /* Server Side Sync Timeout in milliseconds */ #define KGSL_SYNCOBJ_SERVER_TIMEOUT 2000 /* UBWC Modes */ #define KGSL_UBWC_NONE 0 #define KGSL_UBWC_1_0 1 #define KGSL_UBWC_2_0 2 #define KGSL_UBWC_3_0 3 #define KGSL_UBWC_4_0 4 #define KGSL_UBWC_5_0 5 #define KGSL_UBWC_6_0 6 /* * Reset status values for context */ enum kgsl_ctx_reset_stat { KGSL_CTX_STAT_NO_ERROR = 0x00000000, KGSL_CTX_STAT_GUILTY_CONTEXT_RESET_EXT = 0x00000001, KGSL_CTX_STAT_INNOCENT_CONTEXT_RESET_EXT = 0x00000002, KGSL_CTX_STAT_UNKNOWN_CONTEXT_RESET_EXT = 0x00000003 --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\include\uapi\linux\msm_kgsl.h:581 [MATCH: timeout] --- __kernel_size_t sizebytes; }; #define IOCTL_KGSL_DEVICE_GETPROPERTY \ _IOWR(KGSL_IOC_TYPE, 0x2, struct kgsl_device_getproperty) /* IOCTL_KGSL_DEVICE_READ (0x3) - removed 03/2012 */ /* block until the GPU has executed past a given timestamp * timeout is in milliseconds. */ struct kgsl_device_waittimestamp { unsigned int timestamp; unsigned int timeout; }; #define IOCTL_KGSL_DEVICE_WAITTIMESTAMP \ _IOW(KGSL_IOC_TYPE, 0x6, struct kgsl_device_waittimestamp) struct kgsl_device_waittimestamp_ctxtid { unsigned int context_id; unsigned int timestamp; unsigned int timeout; }; #define IOCTL_KGSL_DEVICE_WAITTIMESTAMP_CTXTID \ _IOW(KGSL_IOC_TYPE, 0x7, struct kgsl_device_waittimestamp_ctxtid) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\include\uapi\linux\msm_kgsl.h:585 [MATCH: timeout] --- _IOWR(KGSL_IOC_TYPE, 0x2, struct kgsl_device_getproperty) /* IOCTL_KGSL_DEVICE_READ (0x3) - removed 03/2012 */ /* block until the GPU has executed past a given timestamp * timeout is in milliseconds. */ struct kgsl_device_waittimestamp { unsigned int timestamp; unsigned int timeout; }; #define IOCTL_KGSL_DEVICE_WAITTIMESTAMP \ _IOW(KGSL_IOC_TYPE, 0x6, struct kgsl_device_waittimestamp) struct kgsl_device_waittimestamp_ctxtid { unsigned int context_id; unsigned int timestamp; unsigned int timeout; }; #define IOCTL_KGSL_DEVICE_WAITTIMESTAMP_CTXTID \ _IOW(KGSL_IOC_TYPE, 0x7, struct kgsl_device_waittimestamp_ctxtid) /* DEPRECATED: issue indirect commands to the GPU. * drawctxt_id must have been created with IOCTL_KGSL_DRAWCTXT_CREATE * ibaddr and sizedwords must specify a subset of a buffer created * with IOCTL_KGSL_SHAREDMEM_FROM_PMEM --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\include\uapi\linux\msm_kgsl.h:594 [MATCH: timeout] --- unsigned int timestamp; unsigned int timeout; }; #define IOCTL_KGSL_DEVICE_WAITTIMESTAMP \ _IOW(KGSL_IOC_TYPE, 0x6, struct kgsl_device_waittimestamp) struct kgsl_device_waittimestamp_ctxtid { unsigned int context_id; unsigned int timestamp; unsigned int timeout; }; #define IOCTL_KGSL_DEVICE_WAITTIMESTAMP_CTXTID \ _IOW(KGSL_IOC_TYPE, 0x7, struct kgsl_device_waittimestamp_ctxtid) /* DEPRECATED: issue indirect commands to the GPU. * drawctxt_id must have been created with IOCTL_KGSL_DRAWCTXT_CREATE * ibaddr and sizedwords must specify a subset of a buffer created * with IOCTL_KGSL_SHAREDMEM_FROM_PMEM * flags may be a mask of KGSL_CONTEXT_ values * timestamp is a returned counter value which can be passed to * other ioctls to determine when the commands have been executed by * the GPU. * * This function is deprecated - consider using IOCTL_KGSL_SUBMIT_COMMANDS * instead */ struct kgsl_ringbuffer_issueibcmds { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\include\uapi\linux\msm_kgsl.h:2008 [MATCH: seqnum] --- #define IOCTL_KGSL_TIMELINE_SIGNAL \ _IOW(KGSL_IOC_TYPE, 0x5B, struct kgsl_timeline_signal) /** * struct kgsl_timeline_fence_get - argument for IOCTL_KGSL_TIMELINE_FENCE_GET * @seqno: Sequence number for the fence * @timeline: Timeline to create the fence on * @handle: Contains the fence fd for a successful operation [out] * * Create a sync file descriptor for the seqnum on the timeline and return it in * @handle. Can be polled and queried just like any other sync file descriptor */ struct kgsl_timeline_fence_get { __u64 seqno; __u32 timeline; int handle; }; #define IOCTL_KGSL_TIMELINE_FENCE_GET \ _IOWR(KGSL_IOC_TYPE, 0x5C, struct kgsl_timeline_fence_get) /** * IOCTL_KGSL_TIMELINE_DESTROY takes a u32 identifier for the timeline to * destroy */ #define IOCTL_KGSL_TIMELINE_DESTROY _IOW(KGSL_IOC_TYPE, 0x5D, __u32) /** * struct kgsl_gpu_aux_command_timeline - An aux command for timeline signals ######## G: DARWIN23 HFI IMPLEMENTATION ######## --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\drivers\DarwinBoot\DarwinBootPkg\Driver\DarwinBoot.c:17 [MATCH: ACK] --- #include #include #include #include #include #include #include #include #include "BootArgs.h" #include "BootVideo.h" #include "PackedRamdisk.h" #include "WindowSize.h" #include "WindowRange.h" #define WINDOW_SIZE SIZE_256MB #define BLOCK_SIZE SIZE_2MB #define MAX_SEGMENTS 64 typedef struct { UINT64 Address; UINT64 Size; UINT64 FileOffset; UINT64 FileSize; UINT32 Protection; } SEGMENT; typedef struct { SEGMENT Segments[MAX_SEGMENTS]; UINTN Count; UINT64 Base; UINT64 End; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\drivers\DarwinBoot\DarwinBootPkg\Driver\DarwinBoot.c:186 [MATCH: ACK] --- } } if (!Executable || (Kernel->Entry & 3) || (Kernel->Base & EFI_PAGE_MASK) || (Kernel->Base > MAX_UINT64 - WINDOW_SIZE) || (Kernel->End - Kernel->Base > WINDOW_SIZE - SIZE_2MB)) { return EFI_LOAD_ERROR; } return EFI_SUCCESS; } STATIC BOOLEAN AdtNode (CONST UINT8 *Data, UINTN Size, UINTN *Offset, UINTN Depth, UINTN ParentPath, UINTN *RamdiskOffset, UINTN *TrustCacheOffset, UINT64 *WindowSize, DARWIN_WINDOW_RANGE *WindowRange, BOOLEAN *KeepPacked) { UINT32 Properties; UINT32 Children; UINT32 Length; UINTN Index; UINTN Path; UINTN Candidate; UINTN TrustCandidate; UINTN MemoryCandidate; UINTN RangeCandidate; CONST UINT8 *Name; UINTN NameLength; Name = NULL; NameLength = 0; Candidate = MAX_UINTN; TrustCandidate = MAX_UINTN; MemoryCandidate = MAX_UINTN; RangeCandidate = MAX_UINTN; if ((Depth > 64) || (Size - *Offset < 8)) { return FALSE; } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\drivers\DarwinBoot\DarwinBootPkg\Driver\DarwinBoot.c:223 [MATCH: ACK] --- if (ScanMem8 (Data + *Offset, 32, 0) == NULL) { return FALSE; } Length = U32 (Data + *Offset + 32); *Offset += 36; if (Length > Size - *Offset) { return FALSE; } if (AsciiStrCmp ((CONST CHAR8 *)(Data + *Offset - 36), "name") == 0) { if (Name != NULL) { return FALSE; } Name = Data + *Offset; NameLength = Length; } if ((AsciiStrCmp ((CONST CHAR8 *)(Data + *Offset - 36), "RAMDisk") == 0) || (AsciiStrCmp ((CONST CHAR8 *)(Data + *Offset - 36), "PackedRAMDisk") == 0)) { if (AsciiStrCmp ((CONST CHAR8 *)(Data + *Offset - 36), "PackedRAMDisk") == 0) { if (*KeepPacked) { return FALSE; } *KeepPacked = TRUE; } if ((Candidate != MAX_UINTN) || (Length != 16)) { return FALSE; } Candidate = *Offset; } if (AsciiStrCmp ((CONST CHAR8 *)(Data + *Offset - 36), "TrustCache") == 0) { if ((TrustCandidate != MAX_UINTN) || (Length != 16)) { return FALSE; } TrustCandidate = *Offset; } if (AsciiStrCmp ((CONST CHAR8 *)(Data + *Offset - 36), "darwinboot-memory-size") == 0) { if ((MemoryCandidate != MAX_UINTN) || (Length != 8)) { return FALSE; } MemoryCandidate = *Offset; } if (AsciiStrCmp ((CONST CHAR8 *)(Data + *Offset - 36), "darwinboot-memory-range") == 0) { if ((RangeCandidate != MAX_UINTN) || (Length != 16)) { return FALSE; } RangeCandidate = *Offset; } *Offset += Length; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\drivers\DarwinBoot\DarwinBootPkg\Driver\DarwinBoot.c:224 [MATCH: ACK] --- Length = U32 (Data + *Offset + 32); *Offset += 36; if (Length > Size - *Offset) { return FALSE; } if (AsciiStrCmp ((CONST CHAR8 *)(Data + *Offset - 36), "name") == 0) { if (Name != NULL) { return FALSE; } Name = Data + *Offset; NameLength = Length; } if ((AsciiStrCmp ((CONST CHAR8 *)(Data + *Offset - 36), "RAMDisk") == 0) || (AsciiStrCmp ((CONST CHAR8 *)(Data + *Offset - 36), "PackedRAMDisk") == 0)) { if (AsciiStrCmp ((CONST CHAR8 *)(Data + *Offset - 36), "PackedRAMDisk") == 0) { if (*KeepPacked) { return FALSE; } *KeepPacked = TRUE; } if ((Candidate != MAX_UINTN) || (Length != 16)) { return FALSE; } Candidate = *Offset; } if (AsciiStrCmp ((CONST CHAR8 *)(Data + *Offset - 36), "TrustCache") == 0) { if ((TrustCandidate != MAX_UINTN) || (Length != 16)) { return FALSE; } TrustCandidate = *Offset; } if (AsciiStrCmp ((CONST CHAR8 *)(Data + *Offset - 36), "darwinboot-memory-size") == 0) { if ((MemoryCandidate != MAX_UINTN) || (Length != 8)) { return FALSE; } MemoryCandidate = *Offset; } if (AsciiStrCmp ((CONST CHAR8 *)(Data + *Offset - 36), "darwinboot-memory-range") == 0) { if ((RangeCandidate != MAX_UINTN) || (Length != 16)) { return FALSE; } RangeCandidate = *Offset; } *Offset += Length; if (ALIGN_VALUE (*Offset, 4) > Size) { return FALSE; } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\drivers\DarwinBoot\DarwinBootPkg\Driver\DarwinBoot.c:225 [MATCH: ACK] --- *Offset += 36; if (Length > Size - *Offset) { return FALSE; } if (AsciiStrCmp ((CONST CHAR8 *)(Data + *Offset - 36), "name") == 0) { if (Name != NULL) { return FALSE; } Name = Data + *Offset; NameLength = Length; } if ((AsciiStrCmp ((CONST CHAR8 *)(Data + *Offset - 36), "RAMDisk") == 0) || (AsciiStrCmp ((CONST CHAR8 *)(Data + *Offset - 36), "PackedRAMDisk") == 0)) { if (AsciiStrCmp ((CONST CHAR8 *)(Data + *Offset - 36), "PackedRAMDisk") == 0) { if (*KeepPacked) { return FALSE; } *KeepPacked = TRUE; } if ((Candidate != MAX_UINTN) || (Length != 16)) { return FALSE; } Candidate = *Offset; } if (AsciiStrCmp ((CONST CHAR8 *)(Data + *Offset - 36), "TrustCache") == 0) { if ((TrustCandidate != MAX_UINTN) || (Length != 16)) { return FALSE; } TrustCandidate = *Offset; } if (AsciiStrCmp ((CONST CHAR8 *)(Data + *Offset - 36), "darwinboot-memory-size") == 0) { if ((MemoryCandidate != MAX_UINTN) || (Length != 8)) { return FALSE; } MemoryCandidate = *Offset; } if (AsciiStrCmp ((CONST CHAR8 *)(Data + *Offset - 36), "darwinboot-memory-range") == 0) { if ((RangeCandidate != MAX_UINTN) || (Length != 16)) { return FALSE; } RangeCandidate = *Offset; } *Offset += Length; if (ALIGN_VALUE (*Offset, 4) > Size) { return FALSE; } *Offset = ALIGN_VALUE (*Offset, 4); --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\drivers\DarwinBoot\DarwinBootPkg\Driver\DarwinBoot.c:226 [MATCH: ACK] --- if (Length > Size - *Offset) { return FALSE; } if (AsciiStrCmp ((CONST CHAR8 *)(Data + *Offset - 36), "name") == 0) { if (Name != NULL) { return FALSE; } Name = Data + *Offset; NameLength = Length; } if ((AsciiStrCmp ((CONST CHAR8 *)(Data + *Offset - 36), "RAMDisk") == 0) || (AsciiStrCmp ((CONST CHAR8 *)(Data + *Offset - 36), "PackedRAMDisk") == 0)) { if (AsciiStrCmp ((CONST CHAR8 *)(Data + *Offset - 36), "PackedRAMDisk") == 0) { if (*KeepPacked) { return FALSE; } *KeepPacked = TRUE; } if ((Candidate != MAX_UINTN) || (Length != 16)) { return FALSE; } Candidate = *Offset; } if (AsciiStrCmp ((CONST CHAR8 *)(Data + *Offset - 36), "TrustCache") == 0) { if ((TrustCandidate != MAX_UINTN) || (Length != 16)) { return FALSE; } TrustCandidate = *Offset; } if (AsciiStrCmp ((CONST CHAR8 *)(Data + *Offset - 36), "darwinboot-memory-size") == 0) { if ((MemoryCandidate != MAX_UINTN) || (Length != 8)) { return FALSE; } MemoryCandidate = *Offset; } if (AsciiStrCmp ((CONST CHAR8 *)(Data + *Offset - 36), "darwinboot-memory-range") == 0) { if ((RangeCandidate != MAX_UINTN) || (Length != 16)) { return FALSE; } RangeCandidate = *Offset; } *Offset += Length; if (ALIGN_VALUE (*Offset, 4) > Size) { return FALSE; } *Offset = ALIGN_VALUE (*Offset, 4); } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\drivers\DarwinBoot\DarwinBootPkg\Driver\DarwinBoot.c:272 [MATCH: ACK] --- if (!DarwinWindowSizeValid (*WindowSize)) { return FALSE; } } if (RangeCandidate != MAX_UINTN) { if ((Path != 1) || (WindowRange->Bytes != 0)) { return FALSE; } WindowRange->Base = U64 (Data + RangeCandidate); WindowRange->Bytes = U64 (Data + RangeCandidate + 8); if (!DarwinWindowRangeValid (WindowRange->Base, WindowRange->Bytes)) { return FALSE; } } if (Children > (Size - *Offset) / 8) { return FALSE; } for (Index = 0; Index < Children; Index++) { if (!AdtNode (Data, Size, Offset, Depth + 1, Path, RamdiskOffset, TrustCacheOffset, WindowSize, WindowRange, KeepPacked)) { return FALSE; } } return TRUE; } STATIC BOOLEAN ValidTrustCaches (CONST UINT8 *Data, UINTN Size) { UINTN Count; UINTN Index; UINTN Start; UINTN End; UINTN Entries; UINTN Entry; if (Size < 8) { return FALSE; } Count = U32 (Data); if ((Count == 0) || (Count > 128) || (Count > (Size - 4) / 4)) { return FALSE; } for (Index = 0; Index < Count; Index++) { Start = U32 (Data + 4 + Index * 4); --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\drivers\DarwinBoot\DarwinBootPkg\Driver\DarwinBoot.c:353 [MATCH: ACK] --- End += EFI_PAGES_TO_SIZE (Descriptor->NumberOfPages); Extended = TRUE; } } } while (Extended); (VOID)Start; return End; } // Large diagnostic text straight into the GOP framebuffer: the UEFI text console font is too small to // photograph. 5x12 glyphs from DiagFont.h scaled 4x, white on a black box; wraps at the right edge. #include "DiagFont.h" STATIC CONST UINT64 mDiagFont[] = GLYPH_FONT; STATIC VOID DiagDraw (CONST CHAR16 *Text, UINTN Row) { EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop; UINT64 Video[6]; UINTN Scale = 4, X = 0, Y, Index, Gx, Gy, Dx, Dy, Cell, Line; UINT32 *Fb; UINT64 Glyph, Data; CHAR16 Ch; if (EFI_ERROR (gBS->LocateProtocol (&gEfiGraphicsOutputProtocolGuid, NULL, (VOID **)&Gop)) || EFI_ERROR (DarwinBootVideoFromGop (Gop, Video))) { return; } Cell = 6 * Scale; Line = 14 * Scale; Y = Video[4] / 4 + Row * Line; Fb = (UINT32 *)(UINTN)Video[0]; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\drivers\DarwinBoot\DarwinBootPkg\Driver\DarwinBoot.c:489 [MATCH: ACK] --- EFI_PHYSICAL_ADDRESS Address; UINT64 ArgsAddress; UINT64 TreeAddress; UINT64 Used; UINT64 WindowSize; DARWIN_WINDOW_RANGE WindowRange; UINT64 RamdiskAddress; UINTN RamdiskOffset; UINTN RamdiskBytes; UINTN RamdiskExpandedSize; BOOLEAN RamdiskPacked; BOOLEAN KeepPacked; UINTN TrustCacheOffset; UINT64 TrustCacheAddress; DARWIN_BOOT_ARGS *Args; EFI_MEMORY_DESCRIPTOR *Map; UINTN Capacity; UINTN MapSize; UINTN Key; UINTN Stride; UINT32 Version; UINTN Attempt; CHAR8 CommandLine[1024]; UINT64 Video[6]; (VOID)This; if ((Request == NULL) || (Request->Volume == NULL) || (Request->KernelPath == NULL)) { return EFI_INVALID_PARAMETER; } if ((Request->KextCount != 0) || (Request->DeviceTree != NULL) || (Request->DeviceTreeSize != 0) || (DarwinCurrentEl () != 4)) { Print (L"DARWINBOOT: unsupported inputs or exception level; firmware retained\n"); return EFI_UNSUPPORTED; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\drivers\DarwinBoot\DarwinBootPkg\Driver\DarwinBoot.c:490 [MATCH: ACK] --- UINT64 ArgsAddress; UINT64 TreeAddress; UINT64 Used; UINT64 WindowSize; DARWIN_WINDOW_RANGE WindowRange; UINT64 RamdiskAddress; UINTN RamdiskOffset; UINTN RamdiskBytes; UINTN RamdiskExpandedSize; BOOLEAN RamdiskPacked; BOOLEAN KeepPacked; UINTN TrustCacheOffset; UINT64 TrustCacheAddress; DARWIN_BOOT_ARGS *Args; EFI_MEMORY_DESCRIPTOR *Map; UINTN Capacity; UINTN MapSize; UINTN Key; UINTN Stride; UINT32 Version; UINTN Attempt; CHAR8 CommandLine[1024]; UINT64 Video[6]; (VOID)This; if ((Request == NULL) || (Request->Volume == NULL) || (Request->KernelPath == NULL)) { return EFI_INVALID_PARAMETER; } if ((Request->KextCount != 0) || (Request->DeviceTree != NULL) || (Request->DeviceTreeSize != 0) || (DarwinCurrentEl () != 4)) { Print (L"DARWINBOOT: unsupported inputs or exception level; firmware retained\n"); return EFI_UNSUPPORTED; } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\drivers\DarwinBoot\DarwinBootPkg\Driver\DarwinBoot.c:511 [MATCH: ACK] --- CHAR8 CommandLine[1024]; UINT64 Video[6]; (VOID)This; if ((Request == NULL) || (Request->Volume == NULL) || (Request->KernelPath == NULL)) { return EFI_INVALID_PARAMETER; } if ((Request->KextCount != 0) || (Request->DeviceTree != NULL) || (Request->DeviceTreeSize != 0) || (DarwinCurrentEl () != 4)) { Print (L"DARWINBOOT: unsupported inputs or exception level; firmware retained\n"); return EFI_UNSUPPORTED; } if (!RamdiskLayout (Request->Ramdisk, Request->RamdiskSize, &RamdiskExpandedSize, &RamdiskPacked)) { return EFI_BAD_BUFFER_SIZE; } ZeroMem (CommandLine, sizeof (CommandLine)); if (Request->BootArgs != NULL) { for (Index = 0; Request->BootArgs[Index] != 0; Index++) { if ((Index >= sizeof (CommandLine) - 1) || (Request->BootArgs[Index] > 0x7f)) { return EFI_BAD_BUFFER_SIZE; } CommandLine[Index] = (CHAR8)Request->BootArgs[Index]; } } Root = NULL; Image = NULL; Tree = NULL; TrustCaches = NULL; TreePath = NULL; Map = NULL; Address = 0; Capacity = 0; Status = gBS->HandleProtocol (Request->Volume, &gEfiSimpleFileSystemProtocolGuid, (VOID **)&Fs); if (EFI_ERROR (Status)) { return Status; } Status = Fs->OpenVolume (Fs, &Root); --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\drivers\DarwinBoot\DarwinBootPkg\Driver\DarwinBoot.c:549 [MATCH: ACK] --- if (TreePath == NULL) { Status = EFI_OUT_OF_RESOURCES; goto Fail; } CopyMem (TreePath, Request->KernelPath, Length); StrCatS (TreePath, Length / sizeof (CHAR16) + 11, L".adt"); Status = ReadFile (Root, TreePath, SIZE_16MB, &Tree, &TreeSize); if (EFI_ERROR (Status)) { goto Fail; } Offset = 0; RamdiskOffset = MAX_UINTN; TrustCacheOffset = MAX_UINTN; WindowSize = 0; ZeroMem (&WindowRange, sizeof (WindowRange)); KeepPacked = FALSE; if (!AdtNode (Tree, TreeSize, &Offset, 0, 3, &RamdiskOffset, &TrustCacheOffset, &WindowSize, &WindowRange, &KeepPacked) || (Offset != TreeSize)) { Status = EFI_COMPROMISED_DATA; goto Fail; } if (KeepPacked && (!RamdiskPacked || (RamdiskOffset == MAX_UINTN))) { Status = EFI_COMPROMISED_DATA; goto Fail; } if (WindowSize == 0) { WindowSize = WINDOW_SIZE; } if (Kernel.Base > MAX_UINT64 - WindowSize) { Status = EFI_LOAD_ERROR; goto Fail; } if (Request->Ramdisk != NULL) { if ((RamdiskOffset == MAX_UINTN) || (U64 ((UINT8 *)Tree + RamdiskOffset) != 0) || (U64 ((UINT8 *)Tree + RamdiskOffset + 8) != 0)) { Status = EFI_COMPROMISED_DATA; goto Fail; } } else if (RamdiskOffset != MAX_UINTN) { Status = EFI_UNSUPPORTED; goto Fail; } CopyMem (TreePath, Request->KernelPath, Length); StrCatS (TreePath, Length / sizeof (CHAR16) + 11, L".trustcache"); Status = ReadFile (Root, TreePath, SIZE_16MB, &TrustCaches, &TrustCacheSize); if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) { goto Fail; } if (TrustCaches != NULL) { if ((TrustCacheOffset == MAX_UINTN) || (U64 ((UINT8 *)Tree + TrustCacheOffset) != 0) || (U64 ((UINT8 *)Tree + TrustCacheOffset + 8) != 0) || !ValidTrustCaches (TrustCaches, TrustCacheSize)) { Status = EFI_COMPROMISED_DATA; goto Fail; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\drivers\DarwinBoot\DarwinBootPkg\Driver\DarwinBoot.c:550 [MATCH: ACK] --- CopyMem (TreePath, Request->KernelPath, Length); StrCatS (TreePath, Length / sizeof (CHAR16) + 11, L".adt"); Status = ReadFile (Root, TreePath, SIZE_16MB, &Tree, &TreeSize); if (EFI_ERROR (Status)) { goto Fail; } Offset = 0; RamdiskOffset = MAX_UINTN; TrustCacheOffset = MAX_UINTN; WindowSize = 0; ZeroMem (&WindowRange, sizeof (WindowRange)); KeepPacked = FALSE; if (!AdtNode (Tree, TreeSize, &Offset, 0, 3, &RamdiskOffset, &TrustCacheOffset, &WindowSize, &WindowRange, &KeepPacked) || (Offset != TreeSize)) { Status = EFI_COMPROMISED_DATA; goto Fail; } if (KeepPacked && (!RamdiskPacked || (RamdiskOffset == MAX_UINTN))) { Status = EFI_COMPROMISED_DATA; goto Fail; } if (WindowSize == 0) { WindowSize = WINDOW_SIZE; } if (Kernel.Base > MAX_UINT64 - WindowSize) { Status = EFI_LOAD_ERROR; goto Fail; } if (Request->Ramdisk != NULL) { if ((RamdiskOffset == MAX_UINTN) || (U64 ((UINT8 *)Tree + RamdiskOffset) != 0) || (U64 ((UINT8 *)Tree + RamdiskOffset + 8) != 0)) { Status = EFI_COMPROMISED_DATA; goto Fail; } } else if (RamdiskOffset != MAX_UINTN) { Status = EFI_UNSUPPORTED; goto Fail; } CopyMem (TreePath, Request->KernelPath, Length); StrCatS (TreePath, Length / sizeof (CHAR16) + 11, L".trustcache"); Status = ReadFile (Root, TreePath, SIZE_16MB, &TrustCaches, &TrustCacheSize); if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) { goto Fail; } if (TrustCaches != NULL) { if ((TrustCacheOffset == MAX_UINTN) || (U64 ((UINT8 *)Tree + TrustCacheOffset) != 0) || (U64 ((UINT8 *)Tree + TrustCacheOffset + 8) != 0) || !ValidTrustCaches (TrustCaches, TrustCacheSize)) { Status = EFI_COMPROMISED_DATA; goto Fail; } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\drivers\DarwinBoot\DarwinBootPkg\Driver\DarwinBoot.c:551 [MATCH: ACK] --- StrCatS (TreePath, Length / sizeof (CHAR16) + 11, L".adt"); Status = ReadFile (Root, TreePath, SIZE_16MB, &Tree, &TreeSize); if (EFI_ERROR (Status)) { goto Fail; } Offset = 0; RamdiskOffset = MAX_UINTN; TrustCacheOffset = MAX_UINTN; WindowSize = 0; ZeroMem (&WindowRange, sizeof (WindowRange)); KeepPacked = FALSE; if (!AdtNode (Tree, TreeSize, &Offset, 0, 3, &RamdiskOffset, &TrustCacheOffset, &WindowSize, &WindowRange, &KeepPacked) || (Offset != TreeSize)) { Status = EFI_COMPROMISED_DATA; goto Fail; } if (KeepPacked && (!RamdiskPacked || (RamdiskOffset == MAX_UINTN))) { Status = EFI_COMPROMISED_DATA; goto Fail; } if (WindowSize == 0) { WindowSize = WINDOW_SIZE; } if (Kernel.Base > MAX_UINT64 - WindowSize) { Status = EFI_LOAD_ERROR; goto Fail; } if (Request->Ramdisk != NULL) { if ((RamdiskOffset == MAX_UINTN) || (U64 ((UINT8 *)Tree + RamdiskOffset) != 0) || (U64 ((UINT8 *)Tree + RamdiskOffset + 8) != 0)) { Status = EFI_COMPROMISED_DATA; goto Fail; } } else if (RamdiskOffset != MAX_UINTN) { Status = EFI_UNSUPPORTED; goto Fail; } CopyMem (TreePath, Request->KernelPath, Length); StrCatS (TreePath, Length / sizeof (CHAR16) + 11, L".trustcache"); Status = ReadFile (Root, TreePath, SIZE_16MB, &TrustCaches, &TrustCacheSize); if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) { goto Fail; } if (TrustCaches != NULL) { if ((TrustCacheOffset == MAX_UINTN) || (U64 ((UINT8 *)Tree + TrustCacheOffset) != 0) || (U64 ((UINT8 *)Tree + TrustCacheOffset + 8) != 0) || !ValidTrustCaches (TrustCaches, TrustCacheSize)) { Status = EFI_COMPROMISED_DATA; goto Fail; } } else if (TrustCacheOffset != MAX_UINTN) { --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\drivers\DarwinBoot\DarwinBootPkg\Driver\DarwinBoot.c:582 [MATCH: ACK] --- Status = EFI_COMPROMISED_DATA; goto Fail; } Status = ReadBootVideo (Video); if (EFI_ERROR (Status)) { goto Fail; } Status = AllocateWindow (&Kernel, WindowSize, &WindowRange, &Address); if (EFI_ERROR (Status)) { goto Fail; } ArgsAddress = ALIGN_VALUE (Address + Kernel.End - Kernel.Base, SIZE_16KB); TreeAddress = ArgsAddress + EFI_PAGE_SIZE; RamdiskAddress = ALIGN_VALUE (TreeAddress + TreeSize, EFI_PAGE_SIZE); RamdiskBytes = ALIGN_VALUE (KeepPacked ? Request->RamdiskSize : RamdiskExpandedSize, EFI_PAGE_SIZE); TrustCacheAddress = RamdiskAddress + RamdiskBytes; Used = ALIGN_VALUE (TrustCacheAddress + TrustCacheSize, SIZE_16KB) - Address; if (Used > WindowSize - BLOCK_SIZE) { Status = EFI_BAD_BUFFER_SIZE; goto Fail; } ZeroMem ((VOID *)(UINTN)Address, (UINTN)Used); for (Index = 0; Index < Kernel.Count; Index++) { CopyMem ((VOID *)(UINTN)(Address + Kernel.Segments[Index].Address - Kernel.Base), (UINT8 *)Image + Kernel.Segments[Index].FileOffset, (UINTN)Kernel.Segments[Index].FileSize); } Args = (DARWIN_BOOT_ARGS *)(UINTN)ArgsAddress; Args->Revision = 2; Args->Version = 2; Args->VirtualBase = Kernel.Base; Args->PhysicalBase = Address; Args->MemorySize = WindowSize; Args->MemorySizeActual = WindowSize; Args->TopOfKernelData = Address + Used; CopyMem (Args->Video, Video, sizeof (Video)); Args->DeviceTree = Kernel.Base + TreeAddress - Address; Args->DeviceTreeLength = (UINT32)TreeSize; CopyMem (Args->CommandLine, CommandLine, sizeof (CommandLine)); --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\drivers\DarwinBoot\DarwinBootPkg\Driver\DarwinBoot.c:605 [MATCH: ACK] --- Args->PhysicalBase = Address; Args->MemorySize = WindowSize; Args->MemorySizeActual = WindowSize; Args->TopOfKernelData = Address + Used; CopyMem (Args->Video, Video, sizeof (Video)); Args->DeviceTree = Kernel.Base + TreeAddress - Address; Args->DeviceTreeLength = (UINT32)TreeSize; CopyMem (Args->CommandLine, CommandLine, sizeof (CommandLine)); CopyMem ((VOID *)(UINTN)TreeAddress, Tree, TreeSize); if (Request->Ramdisk != NULL) { if (KeepPacked) { CopyMem ((VOID *)(UINTN)RamdiskAddress, Request->Ramdisk, Request->RamdiskSize); } else { CopyRamdisk ((VOID *)(UINTN)RamdiskAddress, Request->Ramdisk, Request->RamdiskSize, RamdiskPacked); } WriteUnaligned64 ((UINT64 *)(UINTN)(TreeAddress + RamdiskOffset), RamdiskAddress); WriteUnaligned64 ((UINT64 *)(UINTN)(TreeAddress + RamdiskOffset + 8), KeepPacked ? Request->RamdiskSize : RamdiskBytes); } if (TrustCaches != NULL) { CopyMem ((VOID *)(UINTN)TrustCacheAddress, TrustCaches, TrustCacheSize); WriteUnaligned64 ((UINT64 *)(UINTN)(TreeAddress + TrustCacheOffset), TrustCacheAddress); WriteUnaligned64 ((UINT64 *)(UINTN)(TreeAddress + TrustCacheOffset + 8), TrustCacheSize); FreePool (TrustCaches); TrustCaches = NULL; } FreePool (Image); Image = NULL; FreePool (Tree); Tree = NULL; FreePool (TreePath); TreePath = NULL; Root->Close (Root); Root = NULL; Status = GetMap (&Map, &Capacity, &MapSize, &Key, &Stride); if (EFI_ERROR (Status)) { goto Fail; } Print (L"DARWINBOOT: ARM64 va=0x%lx pa=0x%lx args=0x%lx entry=0x%lx owned=0x%lx\n", Kernel.Base, Address, ArgsAddress, Address + Kernel.Entry - Kernel.Base, (UINT64)WindowSize); Print (L"DARWINBOOT: video base=0x%lx display=%lu row=%lu width=%lu height=%lu depth=%lu\n", Video[0], Video[1], Video[2], Video[3], Video[4], Video[5]); --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\drivers\DarwinBoot\DarwinBootPkg\Driver\DarwinBoot.c:606 [MATCH: ACK] --- Args->MemorySize = WindowSize; Args->MemorySizeActual = WindowSize; Args->TopOfKernelData = Address + Used; CopyMem (Args->Video, Video, sizeof (Video)); Args->DeviceTree = Kernel.Base + TreeAddress - Address; Args->DeviceTreeLength = (UINT32)TreeSize; CopyMem (Args->CommandLine, CommandLine, sizeof (CommandLine)); CopyMem ((VOID *)(UINTN)TreeAddress, Tree, TreeSize); if (Request->Ramdisk != NULL) { if (KeepPacked) { CopyMem ((VOID *)(UINTN)RamdiskAddress, Request->Ramdisk, Request->RamdiskSize); } else { CopyRamdisk ((VOID *)(UINTN)RamdiskAddress, Request->Ramdisk, Request->RamdiskSize, RamdiskPacked); } WriteUnaligned64 ((UINT64 *)(UINTN)(TreeAddress + RamdiskOffset), RamdiskAddress); WriteUnaligned64 ((UINT64 *)(UINTN)(TreeAddress + RamdiskOffset + 8), KeepPacked ? Request->RamdiskSize : RamdiskBytes); } if (TrustCaches != NULL) { CopyMem ((VOID *)(UINTN)TrustCacheAddress, TrustCaches, TrustCacheSize); WriteUnaligned64 ((UINT64 *)(UINTN)(TreeAddress + TrustCacheOffset), TrustCacheAddress); WriteUnaligned64 ((UINT64 *)(UINTN)(TreeAddress + TrustCacheOffset + 8), TrustCacheSize); FreePool (TrustCaches); TrustCaches = NULL; } FreePool (Image); Image = NULL; FreePool (Tree); Tree = NULL; FreePool (TreePath); TreePath = NULL; Root->Close (Root); Root = NULL; Status = GetMap (&Map, &Capacity, &MapSize, &Key, &Stride); if (EFI_ERROR (Status)) { goto Fail; } Print (L"DARWINBOOT: ARM64 va=0x%lx pa=0x%lx args=0x%lx entry=0x%lx owned=0x%lx\n", Kernel.Base, Address, ArgsAddress, Address + Kernel.Entry - Kernel.Base, (UINT64)WindowSize); Print (L"DARWINBOOT: video base=0x%lx display=%lu row=%lu width=%lu height=%lu depth=%lu\n", Video[0], Video[1], Video[2], Video[3], Video[4], Video[5]); Print (L"DARWINBOOT: inputs validated; exiting boot services\n"); --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\drivers\DarwinBoot\DarwinBootPkg\Driver\DarwinBoot.c:608 [MATCH: ACK] --- Args->TopOfKernelData = Address + Used; CopyMem (Args->Video, Video, sizeof (Video)); Args->DeviceTree = Kernel.Base + TreeAddress - Address; Args->DeviceTreeLength = (UINT32)TreeSize; CopyMem (Args->CommandLine, CommandLine, sizeof (CommandLine)); CopyMem ((VOID *)(UINTN)TreeAddress, Tree, TreeSize); if (Request->Ramdisk != NULL) { if (KeepPacked) { CopyMem ((VOID *)(UINTN)RamdiskAddress, Request->Ramdisk, Request->RamdiskSize); } else { CopyRamdisk ((VOID *)(UINTN)RamdiskAddress, Request->Ramdisk, Request->RamdiskSize, RamdiskPacked); } WriteUnaligned64 ((UINT64 *)(UINTN)(TreeAddress + RamdiskOffset), RamdiskAddress); WriteUnaligned64 ((UINT64 *)(UINTN)(TreeAddress + RamdiskOffset + 8), KeepPacked ? Request->RamdiskSize : RamdiskBytes); } if (TrustCaches != NULL) { CopyMem ((VOID *)(UINTN)TrustCacheAddress, TrustCaches, TrustCacheSize); WriteUnaligned64 ((UINT64 *)(UINTN)(TreeAddress + TrustCacheOffset), TrustCacheAddress); WriteUnaligned64 ((UINT64 *)(UINTN)(TreeAddress + TrustCacheOffset + 8), TrustCacheSize); FreePool (TrustCaches); TrustCaches = NULL; } FreePool (Image); Image = NULL; FreePool (Tree); Tree = NULL; FreePool (TreePath); TreePath = NULL; Root->Close (Root); Root = NULL; Status = GetMap (&Map, &Capacity, &MapSize, &Key, &Stride); if (EFI_ERROR (Status)) { goto Fail; } Print (L"DARWINBOOT: ARM64 va=0x%lx pa=0x%lx args=0x%lx entry=0x%lx owned=0x%lx\n", Kernel.Base, Address, ArgsAddress, Address + Kernel.Entry - Kernel.Base, (UINT64)WindowSize); Print (L"DARWINBOOT: video base=0x%lx display=%lu row=%lu width=%lu height=%lu depth=%lu\n", Video[0], Video[1], Video[2], Video[3], Video[4], Video[5]); Print (L"DARWINBOOT: inputs validated; exiting boot services\n"); // --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\drivers\DarwinBoot\DarwinBootPkg\Driver\PackedRamdisk.h:5 [MATCH: ACK] --- // SPDX-License-Identifier: BSD-2-Clause-Patent // Little-endian DBRDISK1: version, page size, expanded bytes, extent count; // then sorted (destination offset, byte count) pairs and concatenated bytes. // Omitted ranges are real zeroed RAM, not virtual/simulated disk storage. #ifndef DARWIN_BOOT_PACKED_RAMDISK_H #define DARWIN_BOOT_PACKED_RAMDISK_H STATIC BOOLEAN RamdiskLayout (CONST VOID *Input, UINTN InputSize, UINTN *Expanded, BOOLEAN *Packed) { CONST UINT8 *Bytes = Input; UINT64 Logical, Count, Table, Cursor, End, Index, Offset, Length; *Expanded = InputSize; *Packed = FALSE; if ((InputSize > SIZE_256MB) || ((Input == NULL) != (InputSize == 0))) { return FALSE; } if ((InputSize < 8) || (CompareMem (Input, "DBRDISK1", 8) != 0)) { return TRUE; } if ((InputSize < 32) || (ReadUnaligned32 ((CONST UINT32 *)(Bytes + 8)) != 1) || (ReadUnaligned32 ((CONST UINT32 *)(Bytes + 12)) != EFI_PAGE_SIZE)) { return FALSE; } Logical = ReadUnaligned64 ((CONST UINT64 *)(Bytes + 16)); Count = ReadUnaligned64 ((CONST UINT64 *)(Bytes + 24)); if ((Logical == 0) || (Logical > SIZE_2GB) || (Logical & (EFI_PAGE_SIZE - 1)) || (Count > 65536) || (Count > (InputSize - 32) / 16)) { return FALSE; } Table = 32 + Count * 16; Cursor = Table; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\drivers\DarwinBoot\DarwinBootPkg\Driver\PackedRamdisk.h:6 [MATCH: ACK] --- // SPDX-License-Identifier: BSD-2-Clause-Patent // Little-endian DBRDISK1: version, page size, expanded bytes, extent count; // then sorted (destination offset, byte count) pairs and concatenated bytes. // Omitted ranges are real zeroed RAM, not virtual/simulated disk storage. #ifndef DARWIN_BOOT_PACKED_RAMDISK_H #define DARWIN_BOOT_PACKED_RAMDISK_H STATIC BOOLEAN RamdiskLayout (CONST VOID *Input, UINTN InputSize, UINTN *Expanded, BOOLEAN *Packed) { CONST UINT8 *Bytes = Input; UINT64 Logical, Count, Table, Cursor, End, Index, Offset, Length; *Expanded = InputSize; *Packed = FALSE; if ((InputSize > SIZE_256MB) || ((Input == NULL) != (InputSize == 0))) { return FALSE; } if ((InputSize < 8) || (CompareMem (Input, "DBRDISK1", 8) != 0)) { return TRUE; } if ((InputSize < 32) || (ReadUnaligned32 ((CONST UINT32 *)(Bytes + 8)) != 1) || (ReadUnaligned32 ((CONST UINT32 *)(Bytes + 12)) != EFI_PAGE_SIZE)) { return FALSE; } Logical = ReadUnaligned64 ((CONST UINT64 *)(Bytes + 16)); Count = ReadUnaligned64 ((CONST UINT64 *)(Bytes + 24)); if ((Logical == 0) || (Logical > SIZE_2GB) || (Logical & (EFI_PAGE_SIZE - 1)) || (Count > 65536) || (Count > (InputSize - 32) / 16)) { return FALSE; } Table = 32 + Count * 16; Cursor = Table; End = 0; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\drivers\DarwinBoot\DarwinBootPkg\Driver\PackedRamdisk.h:10 [MATCH: ACK] --- // SPDX-License-Identifier: BSD-2-Clause-Patent // Little-endian DBRDISK1: version, page size, expanded bytes, extent count; // then sorted (destination offset, byte count) pairs and concatenated bytes. // Omitted ranges are real zeroed RAM, not virtual/simulated disk storage. #ifndef DARWIN_BOOT_PACKED_RAMDISK_H #define DARWIN_BOOT_PACKED_RAMDISK_H STATIC BOOLEAN RamdiskLayout (CONST VOID *Input, UINTN InputSize, UINTN *Expanded, BOOLEAN *Packed) { CONST UINT8 *Bytes = Input; UINT64 Logical, Count, Table, Cursor, End, Index, Offset, Length; *Expanded = InputSize; *Packed = FALSE; if ((InputSize > SIZE_256MB) || ((Input == NULL) != (InputSize == 0))) { return FALSE; } if ((InputSize < 8) || (CompareMem (Input, "DBRDISK1", 8) != 0)) { return TRUE; } if ((InputSize < 32) || (ReadUnaligned32 ((CONST UINT32 *)(Bytes + 8)) != 1) || (ReadUnaligned32 ((CONST UINT32 *)(Bytes + 12)) != EFI_PAGE_SIZE)) { return FALSE; } Logical = ReadUnaligned64 ((CONST UINT64 *)(Bytes + 16)); Count = ReadUnaligned64 ((CONST UINT64 *)(Bytes + 24)); if ((Logical == 0) || (Logical > SIZE_2GB) || (Logical & (EFI_PAGE_SIZE - 1)) || (Count > 65536) || (Count > (InputSize - 32) / 16)) { return FALSE; } Table = 32 + Count * 16; Cursor = Table; End = 0; for (Index = 0; Index < Count; Index++) { Offset = ReadUnaligned64 ((CONST UINT64 *)(Bytes + 32 + Index * 16)); Length = ReadUnaligned64 ((CONST UINT64 *)(Bytes + 40 + Index * 16)); if (!Length || ((Offset | Length) & (EFI_PAGE_SIZE - 1)) || (Offset < End) || --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\drivers\DarwinBoot\DarwinBootPkg\Driver\PackedRamdisk.h:15 [MATCH: ACK] --- #ifndef DARWIN_BOOT_PACKED_RAMDISK_H #define DARWIN_BOOT_PACKED_RAMDISK_H STATIC BOOLEAN RamdiskLayout (CONST VOID *Input, UINTN InputSize, UINTN *Expanded, BOOLEAN *Packed) { CONST UINT8 *Bytes = Input; UINT64 Logical, Count, Table, Cursor, End, Index, Offset, Length; *Expanded = InputSize; *Packed = FALSE; if ((InputSize > SIZE_256MB) || ((Input == NULL) != (InputSize == 0))) { return FALSE; } if ((InputSize < 8) || (CompareMem (Input, "DBRDISK1", 8) != 0)) { return TRUE; } if ((InputSize < 32) || (ReadUnaligned32 ((CONST UINT32 *)(Bytes + 8)) != 1) || (ReadUnaligned32 ((CONST UINT32 *)(Bytes + 12)) != EFI_PAGE_SIZE)) { return FALSE; } Logical = ReadUnaligned64 ((CONST UINT64 *)(Bytes + 16)); Count = ReadUnaligned64 ((CONST UINT64 *)(Bytes + 24)); if ((Logical == 0) || (Logical > SIZE_2GB) || (Logical & (EFI_PAGE_SIZE - 1)) || (Count > 65536) || (Count > (InputSize - 32) / 16)) { return FALSE; } Table = 32 + Count * 16; Cursor = Table; End = 0; for (Index = 0; Index < Count; Index++) { Offset = ReadUnaligned64 ((CONST UINT64 *)(Bytes + 32 + Index * 16)); Length = ReadUnaligned64 ((CONST UINT64 *)(Bytes + 40 + Index * 16)); if (!Length || ((Offset | Length) & (EFI_PAGE_SIZE - 1)) || (Offset < End) || (Offset > Logical) || (Length > Logical - Offset) || (Length > InputSize - Cursor)) { return FALSE; } End = Offset + Length; Cursor += Length; } if (Cursor != InputSize) { return FALSE; } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\drivers\DarwinBoot\DarwinBootPkg\Driver\PackedRamdisk.h:37 [MATCH: ACK] --- for (Index = 0; Index < Count; Index++) { Offset = ReadUnaligned64 ((CONST UINT64 *)(Bytes + 32 + Index * 16)); Length = ReadUnaligned64 ((CONST UINT64 *)(Bytes + 40 + Index * 16)); if (!Length || ((Offset | Length) & (EFI_PAGE_SIZE - 1)) || (Offset < End) || (Offset > Logical) || (Length > Logical - Offset) || (Length > InputSize - Cursor)) { return FALSE; } End = Offset + Length; Cursor += Length; } if (Cursor != InputSize) { return FALSE; } *Expanded = (UINTN)Logical; *Packed = TRUE; return TRUE; } STATIC VOID CopyRamdisk (VOID *Destination, CONST VOID *Input, UINTN InputSize, BOOLEAN Packed) { CONST UINT8 *Bytes = Input; UINT64 Count, Cursor, Index, Offset, Length; // Caller has validated every range and zeroed the entire expanded allocation. if (!Packed) { CopyMem (Destination, Input, InputSize); return; } Count = ReadUnaligned64 ((CONST UINT64 *)(Bytes + 24)); Cursor = 32 + Count * 16; for (Index = 0; Index < Count; Index++) { Offset = ReadUnaligned64 ((CONST UINT64 *)(Bytes + 32 + Index * 16)); Length = ReadUnaligned64 ((CONST UINT64 *)(Bytes + 40 + Index * 16)); CopyMem ((UINT8 *)Destination + Offset, Bytes + Cursor, (UINTN)Length); Cursor += Length; } } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\drivers\DarwinBoot\DarwinBootPkg\Driver\PackedRamdisk.h:43 [MATCH: ACK] --- Cursor += Length; } if (Cursor != InputSize) { return FALSE; } *Expanded = (UINTN)Logical; *Packed = TRUE; return TRUE; } STATIC VOID CopyRamdisk (VOID *Destination, CONST VOID *Input, UINTN InputSize, BOOLEAN Packed) { CONST UINT8 *Bytes = Input; UINT64 Count, Cursor, Index, Offset, Length; // Caller has validated every range and zeroed the entire expanded allocation. if (!Packed) { CopyMem (Destination, Input, InputSize); return; } Count = ReadUnaligned64 ((CONST UINT64 *)(Bytes + 24)); Cursor = 32 + Count * 16; for (Index = 0; Index < Count; Index++) { Offset = ReadUnaligned64 ((CONST UINT64 *)(Bytes + 32 + Index * 16)); Length = ReadUnaligned64 ((CONST UINT64 *)(Bytes + 40 + Index * 16)); CopyMem ((UINT8 *)Destination + Offset, Bytes + Cursor, (UINTN)Length); Cursor += Length; } } #endif --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\drivers\DarwinBoot\DarwinBootPkg\Driver\PackedRamdisk.h:48 [MATCH: ACK] --- return TRUE; } STATIC VOID CopyRamdisk (VOID *Destination, CONST VOID *Input, UINTN InputSize, BOOLEAN Packed) { CONST UINT8 *Bytes = Input; UINT64 Count, Cursor, Index, Offset, Length; // Caller has validated every range and zeroed the entire expanded allocation. if (!Packed) { CopyMem (Destination, Input, InputSize); return; } Count = ReadUnaligned64 ((CONST UINT64 *)(Bytes + 24)); Cursor = 32 + Count * 16; for (Index = 0; Index < Count; Index++) { Offset = ReadUnaligned64 ((CONST UINT64 *)(Bytes + 32 + Index * 16)); Length = ReadUnaligned64 ((CONST UINT64 *)(Bytes + 40 + Index * 16)); CopyMem ((UINT8 *)Destination + Offset, Bytes + Cursor, (UINTN)Length); Cursor += Length; } } #endif --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\drivers\DarwinBoot\DarwinBootPkg\Driver\WindowSize.h:5 [MATCH: ACK] --- // SPDX-License-Identifier: BSD-2-Clause-Patent #ifndef DARWINBOOT_WINDOW_SIZE_H #define DARWINBOOT_WINDOW_SIZE_H // Allocation still requires one real conventional-memory run. This is a // parser bound, never a declaration of available RAM or an allocation fallback. static inline int DarwinWindowSizeValid(unsigned long long size) { return size >= 0x10000000ULL && size <= 0x200000000ULL && !(size & 0x1fffffULL); } #endif --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfi.c:51 [MATCH: AdrenoHfiInitialize] --- for(unsigned q=0;q255 || words>254 || (words && !payload))return AdrenoHfiInvalid; volatile uint32_t *v,*data;uint32_t read,write; AdrenoHfiStatus status=valid(h,0,&v,&data,&read,&write); if(status!=AdrenoHfiSuccess)return status; if(h->pending_header)return AdrenoHfiBusy; unsigned count=(unsigned)words+1,padded=h->legacy?count:(count+3)&~3u; if(((read-write-1)&(WORDS-1))sequence+1)%4095; uint32_t header=(sequence<<20)|(count<<8)|id; data[write]=header; for(unsigned i=0;i255 || words>254 || (words && !payload))return AdrenoHfiInvalid; volatile uint32_t *v,*data;uint32_t read,write; AdrenoHfiStatus status=valid(h,0,&v,&data,&read,&write); if(status!=AdrenoHfiSuccess)return status; if(h->pending_header)return AdrenoHfiBusy; unsigned count=(unsigned)words+1,padded=h->legacy?count:(count+3)&~3u; if(((read-write-1)&(WORDS-1))sequence+1)%4095; uint32_t header=(sequence<<20)|(count<<8)|id; data[write]=header; for(unsigned i=0;ipending_header=header;h->sequence=sequence;*wire_header=header; if(h->notify(h->cookie))return poison(h,AdrenoHfiNotifyError); --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfi.c:77 [MATCH: AdrenoHfiPoll] --- uint32_t sequence=(h->sequence+1)%4095; uint32_t header=(sequence<<20)|(count<<8)|id; data[write]=header; for(unsigned i=0;ipending_header=header;h->sequence=sequence;*wire_header=header; if(h->notify(h->cookie))return poison(h,AdrenoHfiNotifyError); return AdrenoHfiSuccess; } AdrenoHfiStatus AdrenoHfiPoll(AdrenoHfi *h,uint32_t *payload,size_t capacity, size_t *payload_words,uint32_t *error) { if(!payload || capacity<16 || !payload_words || !error)return AdrenoHfiInvalid; *payload_words=0;*error=0; volatile uint32_t *v,*data;uint32_t read,write; AdrenoHfiStatus status=valid(h,1,&v,&data,&read,&write); if(status!=AdrenoHfiSuccess)return status; if(!h->pending_header)return AdrenoHfiInvalid; /* Legacy skipped packets have at least two words; modern packets occupy * multiples of four. Bound consumption even if the peer keeps writing. */ for(unsigned pass=0;passlegacy?2:4);++pass) { if(read==write) {v[8]=1;publish();return AdrenoHfiEmpty;} uint32_t packet[19];uint32_t header=data[read];unsigned count=(header>>8)&255; unsigned available=(write-read)&(WORDS-1),padded=h->legacy?count:(count+3)&~3u; if(!count || count>19 || padded>available)return poison(h,AdrenoHfiCorrupt); for(unsigned i=0;i=3 && (packet[1]>>20)==(h->pending_header>>20); if(!match) { --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfi.c:122 [MATCH: AdrenoHfiPoll] --- AdrenoHfiStatus AdrenoHfiExchange(AdrenoHfi *h,unsigned id,const uint32_t *input, size_t words,unsigned budget,int (*wait_once)(void *),uint32_t *output, size_t capacity,size_t *count,uint32_t *error) { if(!budget || budget>1048576 || !output || capacity<16 || !count || !error) return AdrenoHfiInvalid; *count=0;*error=0;uint32_t header; AdrenoHfiStatus status=AdrenoHfiSend(h,id,input,words,&header); if(status!=AdrenoHfiSuccess)return status; for(unsigned i=0;icookie))return poison(h,AdrenoHfiWaitError); } return poison(h,AdrenoHfiTimeout); } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfi.c:57 [MATCH: AdrenoHfiSend] --- publish(); *h=(AdrenoHfi){shared,(uint32_t)iova,0,0,0,cookie,notify,0,0,0,0,legacy}; return AdrenoHfiSuccess; } AdrenoHfiStatus AdrenoHfiInitializeStopped(AdrenoHfi *h,volatile uint32_t *shared, size_t bytes,uint64_t iova,void *cookie,int (*notify)(void *)) {return initialize(h,shared,bytes,iova,cookie,notify,0);} AdrenoHfiStatus AdrenoHfiInitializeLegacyStopped(AdrenoHfi *h,volatile uint32_t *shared, size_t bytes,uint64_t iova,void *cookie,int (*notify)(void *)) {return initialize(h,shared,bytes,iova,cookie,notify,1);} AdrenoHfiStatus AdrenoHfiSend(AdrenoHfi *h,unsigned id,const uint32_t *payload, size_t words,uint32_t *wire_header) { if(!wire_header || id>255 || words>254 || (words && !payload))return AdrenoHfiInvalid; volatile uint32_t *v,*data;uint32_t read,write; AdrenoHfiStatus status=valid(h,0,&v,&data,&read,&write); if(status!=AdrenoHfiSuccess)return status; if(h->pending_header)return AdrenoHfiBusy; unsigned count=(unsigned)words+1,padded=h->legacy?count:(count+3)&~3u; if(((read-write-1)&(WORDS-1))sequence+1)%4095; uint32_t header=(sequence<<20)|(count<<8)|id; data[write]=header; for(unsigned i=0;ipending_header=header;h->sequence=sequence;*wire_header=header; if(h->notify(h->cookie))return poison(h,AdrenoHfiNotifyError); return AdrenoHfiSuccess; } AdrenoHfiStatus AdrenoHfiPoll(AdrenoHfi *h,uint32_t *payload,size_t capacity, --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfi.c:119 [MATCH: AdrenoHfiSend] --- } return poison(h,AdrenoHfiCorrupt); } AdrenoHfiStatus AdrenoHfiExchange(AdrenoHfi *h,unsigned id,const uint32_t *input, size_t words,unsigned budget,int (*wait_once)(void *),uint32_t *output, size_t capacity,size_t *count,uint32_t *error) { if(!budget || budget>1048576 || !output || capacity<16 || !count || !error) return AdrenoHfiInvalid; *count=0;*error=0;uint32_t header; AdrenoHfiStatus status=AdrenoHfiSend(h,id,input,words,&header); if(status!=AdrenoHfiSuccess)return status; for(unsigned i=0;icookie))return poison(h,AdrenoHfiWaitError); } return poison(h,AdrenoHfiTimeout); } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfi.c:103 [MATCH: AdrenoHfiFirmwareError] --- for(unsigned i=0;i=3 && (packet[1]>>20)==(h->pending_header>>20); if(!match) { if(count<2)return poison(h,AdrenoHfiCorrupt); if(!h->skipped++) {h->skipped_header=header;h->skipped_ret=packet[1];h->skipped_code=count>2?packet[2]:0;} read=(read+padded)&(WORDS-1);v[10]=read;publish(); continue; } if(packet[2]) {*error=packet[2];return poison(h,AdrenoHfiFirmwareError);} /* Copy only the checked matching response, never padding. This is not * cryptographic authentication of firmware or its response. */ for(unsigned i=3;ipending_header=0;*payload_words=count-3;return AdrenoHfiSuccess; } return poison(h,AdrenoHfiCorrupt); } AdrenoHfiStatus AdrenoHfiExchange(AdrenoHfi *h,unsigned id,const uint32_t *input, size_t words,unsigned budget,int (*wait_once)(void *),uint32_t *output, size_t capacity,size_t *count,uint32_t *error) { if(!budget || budget>1048576 || !output || capacity<16 || !count || !error) return AdrenoHfiInvalid; *count=0;*error=0;uint32_t header; AdrenoHfiStatus status=AdrenoHfiSend(h,id,input,words,&header); if(status!=AdrenoHfiSuccess)return status; for(unsigned i=0;ipoisoned=1;return status;} static AdrenoHfiStatus valid(AdrenoHfi *h,unsigned q,volatile uint32_t **header, volatile uint32_t **data,uint32_t *read,uint32_t *write) { if(!h || !h->shared || !h->notify || !h->iova || (h->iova&4095) || ((uintptr_t)h->shared&4095))return AdrenoHfiInvalid; if(h->poisoned)return AdrenoHfiPoisoned; volatile uint32_t *m=h->shared;acquire(); if(h->legacy>1 || q>1)return poison(h,AdrenoHfiCorrupt); const unsigned queues=h->legacy?2:3; if(m[0]!=0 || m[1]!=(24+48*queues) || m[2]!=6 || m[3]!=12 || m[4]!=queues || m[5]!=queues) return poison(h,AdrenoHfiCorrupt); volatile uint32_t *v=m+6+12*q; const unsigned queue_id=(h->legacy && q==1)?4:q; if(v[0]!=1 || v[1]!=h->iova+(q+1)*4096 || v[2]!=(0xa00|queue_id) || v[3]!=WORDS || v[4]!=0)return poison(h,AdrenoHfiCorrupt); *read=v[10];*write=v[11];acquire(); if(*read>=WORDS || *write>=WORDS || (!h->legacy && ((*read&3) || (*write&3))))return poison(h,AdrenoHfiCorrupt); *header=v;*data=m+(q+1)*WORDS;return AdrenoHfiSuccess; } static AdrenoHfiStatus initialize(AdrenoHfi *h,volatile uint32_t *shared, size_t bytes,uint64_t iova,void *cookie,int (*notify)(void *),unsigned legacy) { if(!h || !shared || !notify || bytes!=16384 || ((uintptr_t)shared&4095) || (uintptr_t)shared>UINTPTR_MAX-16383 || !iova || (iova&4095) || iova>UINT32_MAX-16383) return AdrenoHfiInvalid; for(unsigned i=0;i<4096;++i)shared[i]=0; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfi.c:64 [MATCH: pending_header] --- AdrenoHfiStatus AdrenoHfiInitializeLegacyStopped(AdrenoHfi *h,volatile uint32_t *shared, size_t bytes,uint64_t iova,void *cookie,int (*notify)(void *)) {return initialize(h,shared,bytes,iova,cookie,notify,1);} AdrenoHfiStatus AdrenoHfiSend(AdrenoHfi *h,unsigned id,const uint32_t *payload, size_t words,uint32_t *wire_header) { if(!wire_header || id>255 || words>254 || (words && !payload))return AdrenoHfiInvalid; volatile uint32_t *v,*data;uint32_t read,write; AdrenoHfiStatus status=valid(h,0,&v,&data,&read,&write); if(status!=AdrenoHfiSuccess)return status; if(h->pending_header)return AdrenoHfiBusy; unsigned count=(unsigned)words+1,padded=h->legacy?count:(count+3)&~3u; if(((read-write-1)&(WORDS-1))sequence+1)%4095; uint32_t header=(sequence<<20)|(count<<8)|id; data[write]=header; for(unsigned i=0;ipending_header=header;h->sequence=sequence;*wire_header=header; if(h->notify(h->cookie))return poison(h,AdrenoHfiNotifyError); return AdrenoHfiSuccess; } AdrenoHfiStatus AdrenoHfiPoll(AdrenoHfi *h,uint32_t *payload,size_t capacity, size_t *payload_words,uint32_t *error) { if(!payload || capacity<16 || !payload_words || !error)return AdrenoHfiInvalid; *payload_words=0;*error=0; volatile uint32_t *v,*data;uint32_t read,write; AdrenoHfiStatus status=valid(h,1,&v,&data,&read,&write); if(status!=AdrenoHfiSuccess)return status; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfi.c:73 [MATCH: pending_header] --- if(status!=AdrenoHfiSuccess)return status; if(h->pending_header)return AdrenoHfiBusy; unsigned count=(unsigned)words+1,padded=h->legacy?count:(count+3)&~3u; if(((read-write-1)&(WORDS-1))sequence+1)%4095; uint32_t header=(sequence<<20)|(count<<8)|id; data[write]=header; for(unsigned i=0;ipending_header=header;h->sequence=sequence;*wire_header=header; if(h->notify(h->cookie))return poison(h,AdrenoHfiNotifyError); return AdrenoHfiSuccess; } AdrenoHfiStatus AdrenoHfiPoll(AdrenoHfi *h,uint32_t *payload,size_t capacity, size_t *payload_words,uint32_t *error) { if(!payload || capacity<16 || !payload_words || !error)return AdrenoHfiInvalid; *payload_words=0;*error=0; volatile uint32_t *v,*data;uint32_t read,write; AdrenoHfiStatus status=valid(h,1,&v,&data,&read,&write); if(status!=AdrenoHfiSuccess)return status; if(!h->pending_header)return AdrenoHfiInvalid; /* Legacy skipped packets have at least two words; modern packets occupy * multiples of four. Bound consumption even if the peer keeps writing. */ for(unsigned pass=0;passlegacy?2:4);++pass) { if(read==write) {v[8]=1;publish();return AdrenoHfiEmpty;} uint32_t packet[19];uint32_t header=data[read];unsigned count=(header>>8)&255; unsigned available=(write-read)&(WORDS-1),padded=h->legacy?count:(count+3)&~3u; if(!count || count>19 || padded>available)return poison(h,AdrenoHfiCorrupt); for(unsigned i=0;ipending_header)return AdrenoHfiInvalid; /* Legacy skipped packets have at least two words; modern packets occupy * multiples of four. Bound consumption even if the peer keeps writing. */ for(unsigned pass=0;passlegacy?2:4);++pass) { if(read==write) {v[8]=1;publish();return AdrenoHfiEmpty;} uint32_t packet[19];uint32_t header=data[read];unsigned count=(header>>8)&255; unsigned available=(write-read)&(WORDS-1),padded=h->legacy?count:(count+3)&~3u; if(!count || count>19 || padded>available)return poison(h,AdrenoHfiCorrupt); for(unsigned i=0;i=3 && (packet[1]>>20)==(h->pending_header>>20); if(!match) { if(count<2)return poison(h,AdrenoHfiCorrupt); if(!h->skipped++) {h->skipped_header=header;h->skipped_ret=packet[1];h->skipped_code=count>2?packet[2]:0;} read=(read+padded)&(WORDS-1);v[10]=read;publish(); continue; } if(packet[2]) {*error=packet[2];return poison(h,AdrenoHfiFirmwareError);} /* Copy only the checked matching response, never padding. This is not * cryptographic authentication of firmware or its response. */ --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfi.c:96 [MATCH: pending_header] --- /* Legacy skipped packets have at least two words; modern packets occupy * multiples of four. Bound consumption even if the peer keeps writing. */ for(unsigned pass=0;passlegacy?2:4);++pass) { if(read==write) {v[8]=1;publish();return AdrenoHfiEmpty;} uint32_t packet[19];uint32_t header=data[read];unsigned count=(header>>8)&255; unsigned available=(write-read)&(WORDS-1),padded=h->legacy?count:(count+3)&~3u; if(!count || count>19 || padded>available)return poison(h,AdrenoHfiCorrupt); for(unsigned i=0;i=3 && (packet[1]>>20)==(h->pending_header>>20); if(!match) { if(count<2)return poison(h,AdrenoHfiCorrupt); if(!h->skipped++) {h->skipped_header=header;h->skipped_ret=packet[1];h->skipped_code=count>2?packet[2]:0;} read=(read+padded)&(WORDS-1);v[10]=read;publish(); continue; } if(packet[2]) {*error=packet[2];return poison(h,AdrenoHfiFirmwareError);} /* Copy only the checked matching response, never padding. This is not * cryptographic authentication of firmware or its response. */ for(unsigned i=3;ipending_header=0;*payload_words=count-3;return AdrenoHfiSuccess; } return poison(h,AdrenoHfiCorrupt); } AdrenoHfiStatus AdrenoHfiExchange(AdrenoHfi *h,unsigned id,const uint32_t *input, size_t words,unsigned budget,int (*wait_once)(void *),uint32_t *output, size_t capacity,size_t *count,uint32_t *error) { if(!budget || budget>1048576 || !output || capacity<16 || !count || !error) --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfi.c:108 [MATCH: pending_header] --- if(count<2)return poison(h,AdrenoHfiCorrupt); if(!h->skipped++) {h->skipped_header=header;h->skipped_ret=packet[1];h->skipped_code=count>2?packet[2]:0;} read=(read+padded)&(WORDS-1);v[10]=read;publish(); continue; } if(packet[2]) {*error=packet[2];return poison(h,AdrenoHfiFirmwareError);} /* Copy only the checked matching response, never padding. This is not * cryptographic authentication of firmware or its response. */ for(unsigned i=3;ipending_header=0;*payload_words=count-3;return AdrenoHfiSuccess; } return poison(h,AdrenoHfiCorrupt); } AdrenoHfiStatus AdrenoHfiExchange(AdrenoHfi *h,unsigned id,const uint32_t *input, size_t words,unsigned budget,int (*wait_once)(void *),uint32_t *output, size_t capacity,size_t *count,uint32_t *error) { if(!budget || budget>1048576 || !output || capacity<16 || !count || !error) return AdrenoHfiInvalid; *count=0;*error=0;uint32_t header; AdrenoHfiStatus status=AdrenoHfiSend(h,id,input,words,&header); if(status!=AdrenoHfiSuccess)return status; for(unsigned i=0;icookie))return poison(h,AdrenoHfiWaitError); } return poison(h,AdrenoHfiTimeout); } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfi.c:126 [MATCH: timeout] --- if(!budget || budget>1048576 || !output || capacity<16 || !count || !error) return AdrenoHfiInvalid; *count=0;*error=0;uint32_t header; AdrenoHfiStatus status=AdrenoHfiSend(h,id,input,words,&header); if(status!=AdrenoHfiSuccess)return status; for(unsigned i=0;icookie))return poison(h,AdrenoHfiWaitError); } return poison(h,AdrenoHfiTimeout); } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfi.c:86 [MATCH: ACK] --- } AdrenoHfiStatus AdrenoHfiPoll(AdrenoHfi *h,uint32_t *payload,size_t capacity, size_t *payload_words,uint32_t *error) { if(!payload || capacity<16 || !payload_words || !error)return AdrenoHfiInvalid; *payload_words=0;*error=0; volatile uint32_t *v,*data;uint32_t read,write; AdrenoHfiStatus status=valid(h,1,&v,&data,&read,&write); if(status!=AdrenoHfiSuccess)return status; if(!h->pending_header)return AdrenoHfiInvalid; /* Legacy skipped packets have at least two words; modern packets occupy * multiples of four. Bound consumption even if the peer keeps writing. */ for(unsigned pass=0;passlegacy?2:4);++pass) { if(read==write) {v[8]=1;publish();return AdrenoHfiEmpty;} uint32_t packet[19];uint32_t header=data[read];unsigned count=(header>>8)&255; unsigned available=(write-read)&(WORDS-1),padded=h->legacy?count:(count+3)&~3u; if(!count || count>19 || padded>available)return poison(h,AdrenoHfiCorrupt); for(unsigned i=0;i=3 && (packet[1]>>20)==(h->pending_header>>20); if(!match) { if(count<2)return poison(h,AdrenoHfiCorrupt); if(!h->skipped++) {h->skipped_header=header;h->skipped_ret=packet[1];h->skipped_code=count>2?packet[2]:0;} read=(read+padded)&(WORDS-1);v[10]=read;publish(); continue; } if(packet[2]) {*error=packet[2];return poison(h,AdrenoHfiFirmwareError);} /* Copy only the checked matching response, never padding. This is not * cryptographic authentication of firmware or its response. */ for(unsigned i=3;ipending_header)return AdrenoHfiInvalid; /* Legacy skipped packets have at least two words; modern packets occupy * multiples of four. Bound consumption even if the peer keeps writing. */ for(unsigned pass=0;passlegacy?2:4);++pass) { if(read==write) {v[8]=1;publish();return AdrenoHfiEmpty;} uint32_t packet[19];uint32_t header=data[read];unsigned count=(header>>8)&255; unsigned available=(write-read)&(WORDS-1),padded=h->legacy?count:(count+3)&~3u; if(!count || count>19 || padded>available)return poison(h,AdrenoHfiCorrupt); for(unsigned i=0;i=3 && (packet[1]>>20)==(h->pending_header>>20); if(!match) { if(count<2)return poison(h,AdrenoHfiCorrupt); if(!h->skipped++) {h->skipped_header=header;h->skipped_ret=packet[1];h->skipped_code=count>2?packet[2]:0;} read=(read+padded)&(WORDS-1);v[10]=read;publish(); continue; } if(packet[2]) {*error=packet[2];return poison(h,AdrenoHfiFirmwareError);} /* Copy only the checked matching response, never padding. This is not * cryptographic authentication of firmware or its response. */ for(unsigned i=3;ipending_header=0;*payload_words=count-3;return AdrenoHfiSuccess; } return poison(h,AdrenoHfiCorrupt); --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfi.c:93 [MATCH: ACK] --- AdrenoHfiStatus status=valid(h,1,&v,&data,&read,&write); if(status!=AdrenoHfiSuccess)return status; if(!h->pending_header)return AdrenoHfiInvalid; /* Legacy skipped packets have at least two words; modern packets occupy * multiples of four. Bound consumption even if the peer keeps writing. */ for(unsigned pass=0;passlegacy?2:4);++pass) { if(read==write) {v[8]=1;publish();return AdrenoHfiEmpty;} uint32_t packet[19];uint32_t header=data[read];unsigned count=(header>>8)&255; unsigned available=(write-read)&(WORDS-1),padded=h->legacy?count:(count+3)&~3u; if(!count || count>19 || padded>available)return poison(h,AdrenoHfiCorrupt); for(unsigned i=0;i=3 && (packet[1]>>20)==(h->pending_header>>20); if(!match) { if(count<2)return poison(h,AdrenoHfiCorrupt); if(!h->skipped++) {h->skipped_header=header;h->skipped_ret=packet[1];h->skipped_code=count>2?packet[2]:0;} read=(read+padded)&(WORDS-1);v[10]=read;publish(); continue; } if(packet[2]) {*error=packet[2];return poison(h,AdrenoHfiFirmwareError);} /* Copy only the checked matching response, never padding. This is not * cryptographic authentication of firmware or its response. */ for(unsigned i=3;ipending_header=0;*payload_words=count-3;return AdrenoHfiSuccess; } return poison(h,AdrenoHfiCorrupt); } AdrenoHfiStatus AdrenoHfiExchange(AdrenoHfi *h,unsigned id,const uint32_t *input, size_t words,unsigned budget,int (*wait_once)(void *),uint32_t *output, --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfi.c:99 [MATCH: ACK] --- if(read==write) {v[8]=1;publish();return AdrenoHfiEmpty;} uint32_t packet[19];uint32_t header=data[read];unsigned count=(header>>8)&255; unsigned available=(write-read)&(WORDS-1),padded=h->legacy?count:(count+3)&~3u; if(!count || count>19 || padded>available)return poison(h,AdrenoHfiCorrupt); for(unsigned i=0;i=3 && (packet[1]>>20)==(h->pending_header>>20); if(!match) { if(count<2)return poison(h,AdrenoHfiCorrupt); if(!h->skipped++) {h->skipped_header=header;h->skipped_ret=packet[1];h->skipped_code=count>2?packet[2]:0;} read=(read+padded)&(WORDS-1);v[10]=read;publish(); continue; } if(packet[2]) {*error=packet[2];return poison(h,AdrenoHfiFirmwareError);} /* Copy only the checked matching response, never padding. This is not * cryptographic authentication of firmware or its response. */ for(unsigned i=3;ipending_header=0;*payload_words=count-3;return AdrenoHfiSuccess; } return poison(h,AdrenoHfiCorrupt); } AdrenoHfiStatus AdrenoHfiExchange(AdrenoHfi *h,unsigned id,const uint32_t *input, size_t words,unsigned budget,int (*wait_once)(void *),uint32_t *output, size_t capacity,size_t *count,uint32_t *error) { if(!budget || budget>1048576 || !output || capacity<16 || !count || !error) return AdrenoHfiInvalid; *count=0;*error=0;uint32_t header; AdrenoHfiStatus status=AdrenoHfiSend(h,id,input,words,&header); --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfi.c:106 [MATCH: ACK] --- const int match=!firmware_error && count>=3 && (packet[1]>>20)==(h->pending_header>>20); if(!match) { if(count<2)return poison(h,AdrenoHfiCorrupt); if(!h->skipped++) {h->skipped_header=header;h->skipped_ret=packet[1];h->skipped_code=count>2?packet[2]:0;} read=(read+padded)&(WORDS-1);v[10]=read;publish(); continue; } if(packet[2]) {*error=packet[2];return poison(h,AdrenoHfiFirmwareError);} /* Copy only the checked matching response, never padding. This is not * cryptographic authentication of firmware or its response. */ for(unsigned i=3;ipending_header=0;*payload_words=count-3;return AdrenoHfiSuccess; } return poison(h,AdrenoHfiCorrupt); } AdrenoHfiStatus AdrenoHfiExchange(AdrenoHfi *h,unsigned id,const uint32_t *input, size_t words,unsigned budget,int (*wait_once)(void *),uint32_t *output, size_t capacity,size_t *count,uint32_t *error) { if(!budget || budget>1048576 || !output || capacity<16 || !count || !error) return AdrenoHfiInvalid; *count=0;*error=0;uint32_t header; AdrenoHfiStatus status=AdrenoHfiSend(h,id,input,words,&header); if(status!=AdrenoHfiSuccess)return status; for(unsigned i=0;icookie))return poison(h,AdrenoHfiWaitError); } return poison(h,AdrenoHfiTimeout); --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfi.h:34 [MATCH: AdrenoHfiInitialize] --- /* Caller owns an exclusive, 16KiB extent * mapped with four native4K pages, coherent for CPU and GMU, and a valid 32bit * GMU IOVA. Coherence, ownership and active mappings are platform obligations, * not established by this API. The GMU MUST be stopped and unable to access * this extent during initialization. No reset of a running queue is allowed. * AArch64 little-endian; real outer-shareable barriers, no fake ACKs. * All calls on an instance are serialized by the caller. Shared memory, * object and message/output storage must be disjoint and remain owned. * Never free/reuse shared storage until an external real stop+TLB drain is * proved. Poison/timeout/notify failure do not establish safe release. */ AdrenoHfiStatus AdrenoHfiInitializeStopped(AdrenoHfi *,volatile uint32_t *, size_t shared_bytes,uint64_t iova,void *cookie,int (*notify)(void *)); /* A618/a630_gmu.bin legacy profile: two queues, response type 0xa04, * byte-size 120 table, word-granular ring indexes, no four-word padding. * The same stopped/coherent/exclusive storage requirements apply. This * initializes wire data only: it never powers, releases or resets a GMU. */ AdrenoHfiStatus AdrenoHfiInitializeLegacyStopped(AdrenoHfi *,volatile uint32_t *, size_t shared_bytes,uint64_t iova,void *cookie,int (*notify)(void *)); /* payload excludes the wire header. One command may be outstanding. A failed * notify after publishing is indeterminate: poisons the session, no retry. * NoSpace/Busy refuse before publishing. No firmware readiness is inferred. */ AdrenoHfiStatus AdrenoHfiSend(AdrenoHfi *,unsigned id,const uint32_t *payload, size_t payload_words,uint32_t *wire_header); /* Poll the response queue. As a6xx_hfi_wait_for_ack: the reply whose return * header carries the pending command's sequence number completes it (error=0 * succeeds, otherwise FirmwareError); F2H error messages and replies to other * sequence numbers are consumed, counted and skipped. payload_words reports * actual returned words; output remains untouched on failure. Capacity must be * >=16, the protocol's maximum ACK payload. Empty keeps the pending command. * Malformed queues or packets poison the session; no success or queue reset is * synthesized. Debug queue not drained. */ --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfi.h:40 [MATCH: AdrenoHfiInitialize] --- * All calls on an instance are serialized by the caller. Shared memory, * object and message/output storage must be disjoint and remain owned. * Never free/reuse shared storage until an external real stop+TLB drain is * proved. Poison/timeout/notify failure do not establish safe release. */ AdrenoHfiStatus AdrenoHfiInitializeStopped(AdrenoHfi *,volatile uint32_t *, size_t shared_bytes,uint64_t iova,void *cookie,int (*notify)(void *)); /* A618/a630_gmu.bin legacy profile: two queues, response type 0xa04, * byte-size 120 table, word-granular ring indexes, no four-word padding. * The same stopped/coherent/exclusive storage requirements apply. This * initializes wire data only: it never powers, releases or resets a GMU. */ AdrenoHfiStatus AdrenoHfiInitializeLegacyStopped(AdrenoHfi *,volatile uint32_t *, size_t shared_bytes,uint64_t iova,void *cookie,int (*notify)(void *)); /* payload excludes the wire header. One command may be outstanding. A failed * notify after publishing is indeterminate: poisons the session, no retry. * NoSpace/Busy refuse before publishing. No firmware readiness is inferred. */ AdrenoHfiStatus AdrenoHfiSend(AdrenoHfi *,unsigned id,const uint32_t *payload, size_t payload_words,uint32_t *wire_header); /* Poll the response queue. As a6xx_hfi_wait_for_ack: the reply whose return * header carries the pending command's sequence number completes it (error=0 * succeeds, otherwise FirmwareError); F2H error messages and replies to other * sequence numbers are consumed, counted and skipped. payload_words reports * actual returned words; output remains untouched on failure. Capacity must be * >=16, the protocol's maximum ACK payload. Empty keeps the pending command. * Malformed queues or packets poison the session; no success or queue reset is * synthesized. Debug queue not drained. */ AdrenoHfiStatus AdrenoHfiPoll(AdrenoHfi *,uint32_t *payload,size_t capacity, size_t *payload_words,uint32_t *firmware_error); /* Serialized command + bounded response polling. Poll budget limits software * iterations, not hardware elapsed microseconds. Optional wait callback must * return promptly; an error poisons the session. Timeout also poisons it. * This transport alone performs no power/firmware/performance-table startup. */ --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfi.h:55 [MATCH: AdrenoHfiPoll] --- AdrenoHfiStatus AdrenoHfiSend(AdrenoHfi *,unsigned id,const uint32_t *payload, size_t payload_words,uint32_t *wire_header); /* Poll the response queue. As a6xx_hfi_wait_for_ack: the reply whose return * header carries the pending command's sequence number completes it (error=0 * succeeds, otherwise FirmwareError); F2H error messages and replies to other * sequence numbers are consumed, counted and skipped. payload_words reports * actual returned words; output remains untouched on failure. Capacity must be * >=16, the protocol's maximum ACK payload. Empty keeps the pending command. * Malformed queues or packets poison the session; no success or queue reset is * synthesized. Debug queue not drained. */ AdrenoHfiStatus AdrenoHfiPoll(AdrenoHfi *,uint32_t *payload,size_t capacity, size_t *payload_words,uint32_t *firmware_error); /* Serialized command + bounded response polling. Poll budget limits software * iterations, not hardware elapsed microseconds. Optional wait callback must * return promptly; an error poisons the session. Timeout also poisons it. * This transport alone performs no power/firmware/performance-table startup. */ AdrenoHfiStatus AdrenoHfiExchange(AdrenoHfi *,unsigned id,const uint32_t *,size_t, unsigned poll_budget,int (*wait_once)(void *),uint32_t *,size_t, size_t *,uint32_t *firmware_error); #ifdef __cplusplus } #endif #endif --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfi.h:45 [MATCH: AdrenoHfiSend] --- size_t shared_bytes,uint64_t iova,void *cookie,int (*notify)(void *)); /* A618/a630_gmu.bin legacy profile: two queues, response type 0xa04, * byte-size 120 table, word-granular ring indexes, no four-word padding. * The same stopped/coherent/exclusive storage requirements apply. This * initializes wire data only: it never powers, releases or resets a GMU. */ AdrenoHfiStatus AdrenoHfiInitializeLegacyStopped(AdrenoHfi *,volatile uint32_t *, size_t shared_bytes,uint64_t iova,void *cookie,int (*notify)(void *)); /* payload excludes the wire header. One command may be outstanding. A failed * notify after publishing is indeterminate: poisons the session, no retry. * NoSpace/Busy refuse before publishing. No firmware readiness is inferred. */ AdrenoHfiStatus AdrenoHfiSend(AdrenoHfi *,unsigned id,const uint32_t *payload, size_t payload_words,uint32_t *wire_header); /* Poll the response queue. As a6xx_hfi_wait_for_ack: the reply whose return * header carries the pending command's sequence number completes it (error=0 * succeeds, otherwise FirmwareError); F2H error messages and replies to other * sequence numbers are consumed, counted and skipped. payload_words reports * actual returned words; output remains untouched on failure. Capacity must be * >=16, the protocol's maximum ACK payload. Empty keeps the pending command. * Malformed queues or packets poison the session; no success or queue reset is * synthesized. Debug queue not drained. */ AdrenoHfiStatus AdrenoHfiPoll(AdrenoHfi *,uint32_t *payload,size_t capacity, size_t *payload_words,uint32_t *firmware_error); /* Serialized command + bounded response polling. Poll budget limits software * iterations, not hardware elapsed microseconds. Optional wait callback must * return promptly; an error poisons the session. Timeout also poisons it. * This transport alone performs no power/firmware/performance-table startup. */ AdrenoHfiStatus AdrenoHfiExchange(AdrenoHfi *,unsigned id,const uint32_t *,size_t, unsigned poll_budget,int (*wait_once)(void *),uint32_t *,size_t, size_t *,uint32_t *firmware_error); #ifdef __cplusplus } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfi.h:11 [MATCH: AdrenoHfiFirmwareError] --- /* SPDX-License-Identifier: BSD-2-Clause-Patent */ #ifndef ADRENO_HFI_H #define ADRENO_HFI_H #include #include #ifdef __cplusplus extern "C" { #endif typedef enum { AdrenoHfiSuccess,AdrenoHfiInvalid,AdrenoHfiBusy,AdrenoHfiNoSpace, AdrenoHfiEmpty,AdrenoHfiCorrupt,AdrenoHfiUnexpected,AdrenoHfiFirmwareError, AdrenoHfiNotifyError,AdrenoHfiWaitError,AdrenoHfiTimeout,AdrenoHfiPoisoned } AdrenoHfiStatus; typedef struct { volatile uint32_t *shared; uint32_t iova,sequence,pending_header,poisoned; void *cookie; int (*notify)(void *); /* real HOST2GMU interrupt write, 0=success */ /* Diagnostics of skipped response packets (a6xx_hfi_wait_for_ack skips firmware error messages and replies to * another sequence number): their count and the first one's header, return header and code. */ uint32_t skipped,skipped_header,skipped_ret,skipped_code; uint32_t legacy; /* set only by the stopped initializer; immutable thereafter */ } AdrenoHfi; /* Caller owns an exclusive, 16KiB extent * mapped with four native4K pages, coherent for CPU and GMU, and a valid 32bit * GMU IOVA. Coherence, ownership and active mappings are platform obligations, * not established by this API. The GMU MUST be stopped and unable to access * this extent during initialization. No reset of a running queue is allowed. * AArch64 little-endian; real outer-shareable barriers, no fake ACKs. * All calls on an instance are serialized by the caller. Shared memory, * object and message/output storage must be disjoint and remain owned. --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfi.h:12 [MATCH: AdrenoHfiPoisoned] --- #ifndef ADRENO_HFI_H #define ADRENO_HFI_H #include #include #ifdef __cplusplus extern "C" { #endif typedef enum { AdrenoHfiSuccess,AdrenoHfiInvalid,AdrenoHfiBusy,AdrenoHfiNoSpace, AdrenoHfiEmpty,AdrenoHfiCorrupt,AdrenoHfiUnexpected,AdrenoHfiFirmwareError, AdrenoHfiNotifyError,AdrenoHfiWaitError,AdrenoHfiTimeout,AdrenoHfiPoisoned } AdrenoHfiStatus; typedef struct { volatile uint32_t *shared; uint32_t iova,sequence,pending_header,poisoned; void *cookie; int (*notify)(void *); /* real HOST2GMU interrupt write, 0=success */ /* Diagnostics of skipped response packets (a6xx_hfi_wait_for_ack skips firmware error messages and replies to * another sequence number): their count and the first one's header, return header and code. */ uint32_t skipped,skipped_header,skipped_ret,skipped_code; uint32_t legacy; /* set only by the stopped initializer; immutable thereafter */ } AdrenoHfi; /* Caller owns an exclusive, 16KiB extent * mapped with four native4K pages, coherent for CPU and GMU, and a valid 32bit * GMU IOVA. Coherence, ownership and active mappings are platform obligations, * not established by this API. The GMU MUST be stopped and unable to access * this extent during initialization. No reset of a running queue is allowed. * AArch64 little-endian; real outer-shareable barriers, no fake ACKs. * All calls on an instance are serialized by the caller. Shared memory, * object and message/output storage must be disjoint and remain owned. * Never free/reuse shared storage until an external real stop+TLB drain is --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfi.h:16 [MATCH: pending_header] --- #ifdef __cplusplus extern "C" { #endif typedef enum { AdrenoHfiSuccess,AdrenoHfiInvalid,AdrenoHfiBusy,AdrenoHfiNoSpace, AdrenoHfiEmpty,AdrenoHfiCorrupt,AdrenoHfiUnexpected,AdrenoHfiFirmwareError, AdrenoHfiNotifyError,AdrenoHfiWaitError,AdrenoHfiTimeout,AdrenoHfiPoisoned } AdrenoHfiStatus; typedef struct { volatile uint32_t *shared; uint32_t iova,sequence,pending_header,poisoned; void *cookie; int (*notify)(void *); /* real HOST2GMU interrupt write, 0=success */ /* Diagnostics of skipped response packets (a6xx_hfi_wait_for_ack skips firmware error messages and replies to * another sequence number): their count and the first one's header, return header and code. */ uint32_t skipped,skipped_header,skipped_ret,skipped_code; uint32_t legacy; /* set only by the stopped initializer; immutable thereafter */ } AdrenoHfi; /* Caller owns an exclusive, 16KiB extent * mapped with four native4K pages, coherent for CPU and GMU, and a valid 32bit * GMU IOVA. Coherence, ownership and active mappings are platform obligations, * not established by this API. The GMU MUST be stopped and unable to access * this extent during initialization. No reset of a running queue is allowed. * AArch64 little-endian; real outer-shareable barriers, no fake ACKs. * All calls on an instance are serialized by the caller. Shared memory, * object and message/output storage must be disjoint and remain owned. * Never free/reuse shared storage until an external real stop+TLB drain is * proved. Poison/timeout/notify failure do not establish safe release. */ AdrenoHfiStatus AdrenoHfiInitializeStopped(AdrenoHfi *,volatile uint32_t *, size_t shared_bytes,uint64_t iova,void *cookie,int (*notify)(void *)); /* A618/a630_gmu.bin legacy profile: two queues, response type 0xa04, --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfi.h:36 [MATCH: 0xa04] --- * GMU IOVA. Coherence, ownership and active mappings are platform obligations, * not established by this API. The GMU MUST be stopped and unable to access * this extent during initialization. No reset of a running queue is allowed. * AArch64 little-endian; real outer-shareable barriers, no fake ACKs. * All calls on an instance are serialized by the caller. Shared memory, * object and message/output storage must be disjoint and remain owned. * Never free/reuse shared storage until an external real stop+TLB drain is * proved. Poison/timeout/notify failure do not establish safe release. */ AdrenoHfiStatus AdrenoHfiInitializeStopped(AdrenoHfi *,volatile uint32_t *, size_t shared_bytes,uint64_t iova,void *cookie,int (*notify)(void *)); /* A618/a630_gmu.bin legacy profile: two queues, response type 0xa04, * byte-size 120 table, word-granular ring indexes, no four-word padding. * The same stopped/coherent/exclusive storage requirements apply. This * initializes wire data only: it never powers, releases or resets a GMU. */ AdrenoHfiStatus AdrenoHfiInitializeLegacyStopped(AdrenoHfi *,volatile uint32_t *, size_t shared_bytes,uint64_t iova,void *cookie,int (*notify)(void *)); /* payload excludes the wire header. One command may be outstanding. A failed * notify after publishing is indeterminate: poisons the session, no retry. * NoSpace/Busy refuse before publishing. No firmware readiness is inferred. */ AdrenoHfiStatus AdrenoHfiSend(AdrenoHfi *,unsigned id,const uint32_t *payload, size_t payload_words,uint32_t *wire_header); /* Poll the response queue. As a6xx_hfi_wait_for_ack: the reply whose return * header carries the pending command's sequence number completes it (error=0 * succeeds, otherwise FirmwareError); F2H error messages and replies to other * sequence numbers are consumed, counted and skipped. payload_words reports * actual returned words; output remains untouched on failure. Capacity must be * >=16, the protocol's maximum ACK payload. Empty keeps the pending command. * Malformed queues or packets poison the session; no success or queue reset is * synthesized. Debug queue not drained. */ AdrenoHfiStatus AdrenoHfiPoll(AdrenoHfi *,uint32_t *payload,size_t capacity, size_t *payload_words,uint32_t *firmware_error); --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfi.h:54 [MATCH: debug queue] --- * NoSpace/Busy refuse before publishing. No firmware readiness is inferred. */ AdrenoHfiStatus AdrenoHfiSend(AdrenoHfi *,unsigned id,const uint32_t *payload, size_t payload_words,uint32_t *wire_header); /* Poll the response queue. As a6xx_hfi_wait_for_ack: the reply whose return * header carries the pending command's sequence number completes it (error=0 * succeeds, otherwise FirmwareError); F2H error messages and replies to other * sequence numbers are consumed, counted and skipped. payload_words reports * actual returned words; output remains untouched on failure. Capacity must be * >=16, the protocol's maximum ACK payload. Empty keeps the pending command. * Malformed queues or packets poison the session; no success or queue reset is * synthesized. Debug queue not drained. */ AdrenoHfiStatus AdrenoHfiPoll(AdrenoHfi *,uint32_t *payload,size_t capacity, size_t *payload_words,uint32_t *firmware_error); /* Serialized command + bounded response polling. Poll budget limits software * iterations, not hardware elapsed microseconds. Optional wait callback must * return promptly; an error poisons the session. Timeout also poisons it. * This transport alone performs no power/firmware/performance-table startup. */ AdrenoHfiStatus AdrenoHfiExchange(AdrenoHfi *,unsigned id,const uint32_t *,size_t, unsigned poll_budget,int (*wait_once)(void *),uint32_t *,size_t, size_t *,uint32_t *firmware_error); #ifdef __cplusplus } #endif #endif --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfi.h:47 [MATCH: response queue] --- * byte-size 120 table, word-granular ring indexes, no four-word padding. * The same stopped/coherent/exclusive storage requirements apply. This * initializes wire data only: it never powers, releases or resets a GMU. */ AdrenoHfiStatus AdrenoHfiInitializeLegacyStopped(AdrenoHfi *,volatile uint32_t *, size_t shared_bytes,uint64_t iova,void *cookie,int (*notify)(void *)); /* payload excludes the wire header. One command may be outstanding. A failed * notify after publishing is indeterminate: poisons the session, no retry. * NoSpace/Busy refuse before publishing. No firmware readiness is inferred. */ AdrenoHfiStatus AdrenoHfiSend(AdrenoHfi *,unsigned id,const uint32_t *payload, size_t payload_words,uint32_t *wire_header); /* Poll the response queue. As a6xx_hfi_wait_for_ack: the reply whose return * header carries the pending command's sequence number completes it (error=0 * succeeds, otherwise FirmwareError); F2H error messages and replies to other * sequence numbers are consumed, counted and skipped. payload_words reports * actual returned words; output remains untouched on failure. Capacity must be * >=16, the protocol's maximum ACK payload. Empty keeps the pending command. * Malformed queues or packets poison the session; no success or queue reset is * synthesized. Debug queue not drained. */ AdrenoHfiStatus AdrenoHfiPoll(AdrenoHfi *,uint32_t *payload,size_t capacity, size_t *payload_words,uint32_t *firmware_error); /* Serialized command + bounded response polling. Poll budget limits software * iterations, not hardware elapsed microseconds. Optional wait callback must * return promptly; an error poisons the session. Timeout also poisons it. * This transport alone performs no power/firmware/performance-table startup. */ AdrenoHfiStatus AdrenoHfiExchange(AdrenoHfi *,unsigned id,const uint32_t *,size_t, unsigned poll_budget,int (*wait_once)(void *),uint32_t *,size_t, size_t *,uint32_t *firmware_error); #ifdef __cplusplus } #endif #endif --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfi.h:33 [MATCH: timeout] --- } AdrenoHfi; /* Caller owns an exclusive, 16KiB extent * mapped with four native4K pages, coherent for CPU and GMU, and a valid 32bit * GMU IOVA. Coherence, ownership and active mappings are platform obligations, * not established by this API. The GMU MUST be stopped and unable to access * this extent during initialization. No reset of a running queue is allowed. * AArch64 little-endian; real outer-shareable barriers, no fake ACKs. * All calls on an instance are serialized by the caller. Shared memory, * object and message/output storage must be disjoint and remain owned. * Never free/reuse shared storage until an external real stop+TLB drain is * proved. Poison/timeout/notify failure do not establish safe release. */ AdrenoHfiStatus AdrenoHfiInitializeStopped(AdrenoHfi *,volatile uint32_t *, size_t shared_bytes,uint64_t iova,void *cookie,int (*notify)(void *)); /* A618/a630_gmu.bin legacy profile: two queues, response type 0xa04, * byte-size 120 table, word-granular ring indexes, no four-word padding. * The same stopped/coherent/exclusive storage requirements apply. This * initializes wire data only: it never powers, releases or resets a GMU. */ AdrenoHfiStatus AdrenoHfiInitializeLegacyStopped(AdrenoHfi *,volatile uint32_t *, size_t shared_bytes,uint64_t iova,void *cookie,int (*notify)(void *)); /* payload excludes the wire header. One command may be outstanding. A failed * notify after publishing is indeterminate: poisons the session, no retry. * NoSpace/Busy refuse before publishing. No firmware readiness is inferred. */ AdrenoHfiStatus AdrenoHfiSend(AdrenoHfi *,unsigned id,const uint32_t *payload, size_t payload_words,uint32_t *wire_header); /* Poll the response queue. As a6xx_hfi_wait_for_ack: the reply whose return * header carries the pending command's sequence number completes it (error=0 * succeeds, otherwise FirmwareError); F2H error messages and replies to other * sequence numbers are consumed, counted and skipped. payload_words reports * actual returned words; output remains untouched on failure. Capacity must be * >=16, the protocol's maximum ACK payload. Empty keeps the pending command. * Malformed queues or packets poison the session; no success or queue reset is --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfi.h:59 [MATCH: timeout] --- * succeeds, otherwise FirmwareError); F2H error messages and replies to other * sequence numbers are consumed, counted and skipped. payload_words reports * actual returned words; output remains untouched on failure. Capacity must be * >=16, the protocol's maximum ACK payload. Empty keeps the pending command. * Malformed queues or packets poison the session; no success or queue reset is * synthesized. Debug queue not drained. */ AdrenoHfiStatus AdrenoHfiPoll(AdrenoHfi *,uint32_t *payload,size_t capacity, size_t *payload_words,uint32_t *firmware_error); /* Serialized command + bounded response polling. Poll budget limits software * iterations, not hardware elapsed microseconds. Optional wait callback must * return promptly; an error poisons the session. Timeout also poisons it. * This transport alone performs no power/firmware/performance-table startup. */ AdrenoHfiStatus AdrenoHfiExchange(AdrenoHfi *,unsigned id,const uint32_t *,size_t, unsigned poll_budget,int (*wait_once)(void *),uint32_t *,size_t, size_t *,uint32_t *firmware_error); #ifdef __cplusplus } #endif #endif --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfi.h:19 [MATCH: ACK] --- typedef enum { AdrenoHfiSuccess,AdrenoHfiInvalid,AdrenoHfiBusy,AdrenoHfiNoSpace, AdrenoHfiEmpty,AdrenoHfiCorrupt,AdrenoHfiUnexpected,AdrenoHfiFirmwareError, AdrenoHfiNotifyError,AdrenoHfiWaitError,AdrenoHfiTimeout,AdrenoHfiPoisoned } AdrenoHfiStatus; typedef struct { volatile uint32_t *shared; uint32_t iova,sequence,pending_header,poisoned; void *cookie; int (*notify)(void *); /* real HOST2GMU interrupt write, 0=success */ /* Diagnostics of skipped response packets (a6xx_hfi_wait_for_ack skips firmware error messages and replies to * another sequence number): their count and the first one's header, return header and code. */ uint32_t skipped,skipped_header,skipped_ret,skipped_code; uint32_t legacy; /* set only by the stopped initializer; immutable thereafter */ } AdrenoHfi; /* Caller owns an exclusive, 16KiB extent * mapped with four native4K pages, coherent for CPU and GMU, and a valid 32bit * GMU IOVA. Coherence, ownership and active mappings are platform obligations, * not established by this API. The GMU MUST be stopped and unable to access * this extent during initialization. No reset of a running queue is allowed. * AArch64 little-endian; real outer-shareable barriers, no fake ACKs. * All calls on an instance are serialized by the caller. Shared memory, * object and message/output storage must be disjoint and remain owned. * Never free/reuse shared storage until an external real stop+TLB drain is * proved. Poison/timeout/notify failure do not establish safe release. */ AdrenoHfiStatus AdrenoHfiInitializeStopped(AdrenoHfi *,volatile uint32_t *, size_t shared_bytes,uint64_t iova,void *cookie,int (*notify)(void *)); /* A618/a630_gmu.bin legacy profile: two queues, response type 0xa04, * byte-size 120 table, word-granular ring indexes, no four-word padding. * The same stopped/coherent/exclusive storage requirements apply. This * initializes wire data only: it never powers, releases or resets a GMU. */ --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfi.h:29 [MATCH: ACK] --- /* Diagnostics of skipped response packets (a6xx_hfi_wait_for_ack skips firmware error messages and replies to * another sequence number): their count and the first one's header, return header and code. */ uint32_t skipped,skipped_header,skipped_ret,skipped_code; uint32_t legacy; /* set only by the stopped initializer; immutable thereafter */ } AdrenoHfi; /* Caller owns an exclusive, 16KiB extent * mapped with four native4K pages, coherent for CPU and GMU, and a valid 32bit * GMU IOVA. Coherence, ownership and active mappings are platform obligations, * not established by this API. The GMU MUST be stopped and unable to access * this extent during initialization. No reset of a running queue is allowed. * AArch64 little-endian; real outer-shareable barriers, no fake ACKs. * All calls on an instance are serialized by the caller. Shared memory, * object and message/output storage must be disjoint and remain owned. * Never free/reuse shared storage until an external real stop+TLB drain is * proved. Poison/timeout/notify failure do not establish safe release. */ AdrenoHfiStatus AdrenoHfiInitializeStopped(AdrenoHfi *,volatile uint32_t *, size_t shared_bytes,uint64_t iova,void *cookie,int (*notify)(void *)); /* A618/a630_gmu.bin legacy profile: two queues, response type 0xa04, * byte-size 120 table, word-granular ring indexes, no four-word padding. * The same stopped/coherent/exclusive storage requirements apply. This * initializes wire data only: it never powers, releases or resets a GMU. */ AdrenoHfiStatus AdrenoHfiInitializeLegacyStopped(AdrenoHfi *,volatile uint32_t *, size_t shared_bytes,uint64_t iova,void *cookie,int (*notify)(void *)); /* payload excludes the wire header. One command may be outstanding. A failed * notify after publishing is indeterminate: poisons the session, no retry. * NoSpace/Busy refuse before publishing. No firmware readiness is inferred. */ AdrenoHfiStatus AdrenoHfiSend(AdrenoHfi *,unsigned id,const uint32_t *payload, size_t payload_words,uint32_t *wire_header); /* Poll the response queue. As a6xx_hfi_wait_for_ack: the reply whose return * header carries the pending command's sequence number completes it (error=0 * succeeds, otherwise FirmwareError); F2H error messages and replies to other --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfi.h:52 [MATCH: ACK] --- /* payload excludes the wire header. One command may be outstanding. A failed * notify after publishing is indeterminate: poisons the session, no retry. * NoSpace/Busy refuse before publishing. No firmware readiness is inferred. */ AdrenoHfiStatus AdrenoHfiSend(AdrenoHfi *,unsigned id,const uint32_t *payload, size_t payload_words,uint32_t *wire_header); /* Poll the response queue. As a6xx_hfi_wait_for_ack: the reply whose return * header carries the pending command's sequence number completes it (error=0 * succeeds, otherwise FirmwareError); F2H error messages and replies to other * sequence numbers are consumed, counted and skipped. payload_words reports * actual returned words; output remains untouched on failure. Capacity must be * >=16, the protocol's maximum ACK payload. Empty keeps the pending command. * Malformed queues or packets poison the session; no success or queue reset is * synthesized. Debug queue not drained. */ AdrenoHfiStatus AdrenoHfiPoll(AdrenoHfi *,uint32_t *payload,size_t capacity, size_t *payload_words,uint32_t *firmware_error); /* Serialized command + bounded response polling. Poll budget limits software * iterations, not hardware elapsed microseconds. Optional wait callback must * return promptly; an error poisons the session. Timeout also poisons it. * This transport alone performs no power/firmware/performance-table startup. */ AdrenoHfiStatus AdrenoHfiExchange(AdrenoHfi *,unsigned id,const uint32_t *,size_t, unsigned poll_budget,int (*wait_once)(void *),uint32_t *,size_t, size_t *,uint32_t *firmware_error); #ifdef __cplusplus } #endif #endif --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfi.h:53 [MATCH: ACK] --- * notify after publishing is indeterminate: poisons the session, no retry. * NoSpace/Busy refuse before publishing. No firmware readiness is inferred. */ AdrenoHfiStatus AdrenoHfiSend(AdrenoHfi *,unsigned id,const uint32_t *payload, size_t payload_words,uint32_t *wire_header); /* Poll the response queue. As a6xx_hfi_wait_for_ack: the reply whose return * header carries the pending command's sequence number completes it (error=0 * succeeds, otherwise FirmwareError); F2H error messages and replies to other * sequence numbers are consumed, counted and skipped. payload_words reports * actual returned words; output remains untouched on failure. Capacity must be * >=16, the protocol's maximum ACK payload. Empty keeps the pending command. * Malformed queues or packets poison the session; no success or queue reset is * synthesized. Debug queue not drained. */ AdrenoHfiStatus AdrenoHfiPoll(AdrenoHfi *,uint32_t *payload,size_t capacity, size_t *payload_words,uint32_t *firmware_error); /* Serialized command + bounded response polling. Poll budget limits software * iterations, not hardware elapsed microseconds. Optional wait callback must * return promptly; an error poisons the session. Timeout also poisons it. * This transport alone performs no power/firmware/performance-table startup. */ AdrenoHfiStatus AdrenoHfiExchange(AdrenoHfi *,unsigned id,const uint32_t *,size_t, unsigned poll_budget,int (*wait_once)(void *),uint32_t *,size_t, size_t *,uint32_t *firmware_error); #ifdef __cplusplus } #endif #endif --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfi.h:58 [MATCH: ACK] --- * header carries the pending command's sequence number completes it (error=0 * succeeds, otherwise FirmwareError); F2H error messages and replies to other * sequence numbers are consumed, counted and skipped. payload_words reports * actual returned words; output remains untouched on failure. Capacity must be * >=16, the protocol's maximum ACK payload. Empty keeps the pending command. * Malformed queues or packets poison the session; no success or queue reset is * synthesized. Debug queue not drained. */ AdrenoHfiStatus AdrenoHfiPoll(AdrenoHfi *,uint32_t *payload,size_t capacity, size_t *payload_words,uint32_t *firmware_error); /* Serialized command + bounded response polling. Poll budget limits software * iterations, not hardware elapsed microseconds. Optional wait callback must * return promptly; an error poisons the session. Timeout also poisons it. * This transport alone performs no power/firmware/performance-table startup. */ AdrenoHfiStatus AdrenoHfiExchange(AdrenoHfi *,unsigned id,const uint32_t *,size_t, unsigned poll_budget,int (*wait_once)(void *),uint32_t *,size_t, size_t *,uint32_t *firmware_error); #ifdef __cplusplus } #endif #endif --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:3 [MATCH: AdrenoHfiStartup] --- /* SPDX-License-Identifier: BSD-2-Clause-Patent */ /* Independent serialization from the pinned modern HFI wire contract. */ #include "AdrenoHfiStartup.h" static int zero(const uint32_t *v,size_t n) {for(size_t i=0;imax || v[0].hz)return 0; for(unsigned i=0;iUINT32_MAX || (i && v[i].hz<=v[i-1].hz))return 0; for(unsigned i=n;imax)return 0; for(unsigned i=0;imax)return 0; for(unsigned i=0;igpu,c->gpu_count,16) || !levels(c->gmu,c->gmu_count,4) || !c->bandwidth_count || c->bandwidth_count>16 || c->enable_ifpc>1 || !addresses(c->cnoc_addresses,c->cnoc_count,6) || !addresses(c->ddr_addresses,c->ddr_count,8))return AdrenoHfiStartupInvalid; if(c->cnoc_wait_mask>>c->cnoc_count || c->ddr_wait_mask>>c->ddr_count)return AdrenoHfiStartupInvalid; for(unsigned i=0;icnoc_count;++i) for(unsigned j=0;jddr_count;++j)if(c->cnoc_addresses[i]==c->ddr_addresses[j])return AdrenoHfiStartupInvalid; for(unsigned i=0;i<2;++i)if(!zero(c->cnoc_data[i]+c->cnoc_count,6-c->cnoc_count))return AdrenoHfiStartupInvalid; for(unsigned i=0;i<16;++i) if(!zero(c->ddr_data[i]+(ibandwidth_count?c->ddr_count:0), 8-(ibandwidth_count?c->ddr_count:0)))return AdrenoHfiStartupInvalid; if(!c->acd_enable_mask) { if(c->acd_version || c->acd_stride || c->acd_count || !zero(c->acd_data,32))return AdrenoHfiStartupInvalid; } else { if(c->acd_version!=1 || c->acd_stride!=1 || (c->acd_enable_mask&1) || c->acd_enable_mask>>c->gpu_count)return AdrenoHfiStartupInvalid; unsigned count=0; for(uint32_t bits=c->acd_enable_mask;bits;bits>>=1)count+=bits&1; if(c->acd_count!=count || !zero(c->acd_data+count,32-count))return AdrenoHfiStartupInvalid; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:28 [MATCH: AdrenoHfiStartup] --- if(!v[i] || (v[i]&3))return 0; for(unsigned j=0;jgpu,c->gpu_count,16) || !levels(c->gmu,c->gmu_count,4) || !c->bandwidth_count || c->bandwidth_count>16 || c->enable_ifpc>1 || !addresses(c->cnoc_addresses,c->cnoc_count,6) || !addresses(c->ddr_addresses,c->ddr_count,8))return AdrenoHfiStartupInvalid; if(c->cnoc_wait_mask>>c->cnoc_count || c->ddr_wait_mask>>c->ddr_count)return AdrenoHfiStartupInvalid; for(unsigned i=0;icnoc_count;++i) for(unsigned j=0;jddr_count;++j)if(c->cnoc_addresses[i]==c->ddr_addresses[j])return AdrenoHfiStartupInvalid; for(unsigned i=0;i<2;++i)if(!zero(c->cnoc_data[i]+c->cnoc_count,6-c->cnoc_count))return AdrenoHfiStartupInvalid; for(unsigned i=0;i<16;++i) if(!zero(c->ddr_data[i]+(ibandwidth_count?c->ddr_count:0), 8-(ibandwidth_count?c->ddr_count:0)))return AdrenoHfiStartupInvalid; if(!c->acd_enable_mask) { if(c->acd_version || c->acd_stride || c->acd_count || !zero(c->acd_data,32))return AdrenoHfiStartupInvalid; } else { if(c->acd_version!=1 || c->acd_stride!=1 || (c->acd_enable_mask&1) || c->acd_enable_mask>>c->gpu_count)return AdrenoHfiStartupInvalid; unsigned count=0; for(uint32_t bits=c->acd_enable_mask;bits;bits>>=1)count+=bits&1; if(c->acd_count!=count || !zero(c->acd_data+count,32-count))return AdrenoHfiStartupInvalid; } return AdrenoHfiStartupSuccess; } AdrenoHfiStartupStatus AdrenoHfiStartupEncode(const AdrenoHfiStartupConfig *c, AdrenoHfiStartupStage stage,uint32_t *id,uint32_t *p,size_t capacity,size_t *count) --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:29 [MATCH: AdrenoHfiStartup] --- for(unsigned j=0;jgpu,c->gpu_count,16) || !levels(c->gmu,c->gmu_count,4) || !c->bandwidth_count || c->bandwidth_count>16 || c->enable_ifpc>1 || !addresses(c->cnoc_addresses,c->cnoc_count,6) || !addresses(c->ddr_addresses,c->ddr_count,8))return AdrenoHfiStartupInvalid; if(c->cnoc_wait_mask>>c->cnoc_count || c->ddr_wait_mask>>c->ddr_count)return AdrenoHfiStartupInvalid; for(unsigned i=0;icnoc_count;++i) for(unsigned j=0;jddr_count;++j)if(c->cnoc_addresses[i]==c->ddr_addresses[j])return AdrenoHfiStartupInvalid; for(unsigned i=0;i<2;++i)if(!zero(c->cnoc_data[i]+c->cnoc_count,6-c->cnoc_count))return AdrenoHfiStartupInvalid; for(unsigned i=0;i<16;++i) if(!zero(c->ddr_data[i]+(ibandwidth_count?c->ddr_count:0), 8-(ibandwidth_count?c->ddr_count:0)))return AdrenoHfiStartupInvalid; if(!c->acd_enable_mask) { if(c->acd_version || c->acd_stride || c->acd_count || !zero(c->acd_data,32))return AdrenoHfiStartupInvalid; } else { if(c->acd_version!=1 || c->acd_stride!=1 || (c->acd_enable_mask&1) || c->acd_enable_mask>>c->gpu_count)return AdrenoHfiStartupInvalid; unsigned count=0; for(uint32_t bits=c->acd_enable_mask;bits;bits>>=1)count+=bits&1; if(c->acd_count!=count || !zero(c->acd_data+count,32-count))return AdrenoHfiStartupInvalid; } return AdrenoHfiStartupSuccess; } AdrenoHfiStartupStatus AdrenoHfiStartupEncode(const AdrenoHfiStartupConfig *c, AdrenoHfiStartupStage stage,uint32_t *id,uint32_t *p,size_t capacity,size_t *count) { --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:31 [MATCH: AdrenoHfiStartup] --- return zero(v+n,max-n); } AdrenoHfiStartupStatus AdrenoHfiStartupValidate(const AdrenoHfiStartupConfig *c) { if(!c || !levels(c->gpu,c->gpu_count,16) || !levels(c->gmu,c->gmu_count,4) || !c->bandwidth_count || c->bandwidth_count>16 || c->enable_ifpc>1 || !addresses(c->cnoc_addresses,c->cnoc_count,6) || !addresses(c->ddr_addresses,c->ddr_count,8))return AdrenoHfiStartupInvalid; if(c->cnoc_wait_mask>>c->cnoc_count || c->ddr_wait_mask>>c->ddr_count)return AdrenoHfiStartupInvalid; for(unsigned i=0;icnoc_count;++i) for(unsigned j=0;jddr_count;++j)if(c->cnoc_addresses[i]==c->ddr_addresses[j])return AdrenoHfiStartupInvalid; for(unsigned i=0;i<2;++i)if(!zero(c->cnoc_data[i]+c->cnoc_count,6-c->cnoc_count))return AdrenoHfiStartupInvalid; for(unsigned i=0;i<16;++i) if(!zero(c->ddr_data[i]+(ibandwidth_count?c->ddr_count:0), 8-(ibandwidth_count?c->ddr_count:0)))return AdrenoHfiStartupInvalid; if(!c->acd_enable_mask) { if(c->acd_version || c->acd_stride || c->acd_count || !zero(c->acd_data,32))return AdrenoHfiStartupInvalid; } else { if(c->acd_version!=1 || c->acd_stride!=1 || (c->acd_enable_mask&1) || c->acd_enable_mask>>c->gpu_count)return AdrenoHfiStartupInvalid; unsigned count=0; for(uint32_t bits=c->acd_enable_mask;bits;bits>>=1)count+=bits&1; if(c->acd_count!=count || !zero(c->acd_data+count,32-count))return AdrenoHfiStartupInvalid; } return AdrenoHfiStartupSuccess; } AdrenoHfiStartupStatus AdrenoHfiStartupEncode(const AdrenoHfiStartupConfig *c, AdrenoHfiStartupStage stage,uint32_t *id,uint32_t *p,size_t capacity,size_t *count) { if(!count)return AdrenoHfiStartupInvalid; *count=0; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:32 [MATCH: AdrenoHfiStartup] --- } AdrenoHfiStartupStatus AdrenoHfiStartupValidate(const AdrenoHfiStartupConfig *c) { if(!c || !levels(c->gpu,c->gpu_count,16) || !levels(c->gmu,c->gmu_count,4) || !c->bandwidth_count || c->bandwidth_count>16 || c->enable_ifpc>1 || !addresses(c->cnoc_addresses,c->cnoc_count,6) || !addresses(c->ddr_addresses,c->ddr_count,8))return AdrenoHfiStartupInvalid; if(c->cnoc_wait_mask>>c->cnoc_count || c->ddr_wait_mask>>c->ddr_count)return AdrenoHfiStartupInvalid; for(unsigned i=0;icnoc_count;++i) for(unsigned j=0;jddr_count;++j)if(c->cnoc_addresses[i]==c->ddr_addresses[j])return AdrenoHfiStartupInvalid; for(unsigned i=0;i<2;++i)if(!zero(c->cnoc_data[i]+c->cnoc_count,6-c->cnoc_count))return AdrenoHfiStartupInvalid; for(unsigned i=0;i<16;++i) if(!zero(c->ddr_data[i]+(ibandwidth_count?c->ddr_count:0), 8-(ibandwidth_count?c->ddr_count:0)))return AdrenoHfiStartupInvalid; if(!c->acd_enable_mask) { if(c->acd_version || c->acd_stride || c->acd_count || !zero(c->acd_data,32))return AdrenoHfiStartupInvalid; } else { if(c->acd_version!=1 || c->acd_stride!=1 || (c->acd_enable_mask&1) || c->acd_enable_mask>>c->gpu_count)return AdrenoHfiStartupInvalid; unsigned count=0; for(uint32_t bits=c->acd_enable_mask;bits;bits>>=1)count+=bits&1; if(c->acd_count!=count || !zero(c->acd_data+count,32-count))return AdrenoHfiStartupInvalid; } return AdrenoHfiStartupSuccess; } AdrenoHfiStartupStatus AdrenoHfiStartupEncode(const AdrenoHfiStartupConfig *c, AdrenoHfiStartupStage stage,uint32_t *id,uint32_t *p,size_t capacity,size_t *count) { if(!count)return AdrenoHfiStartupInvalid; *count=0; if(!id || !p || capacity<159 || AdrenoHfiStartupValidate(c)!=AdrenoHfiStartupSuccess || --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:35 [MATCH: AdrenoHfiStartup] --- if(!c || !levels(c->gpu,c->gpu_count,16) || !levels(c->gmu,c->gmu_count,4) || !c->bandwidth_count || c->bandwidth_count>16 || c->enable_ifpc>1 || !addresses(c->cnoc_addresses,c->cnoc_count,6) || !addresses(c->ddr_addresses,c->ddr_count,8))return AdrenoHfiStartupInvalid; if(c->cnoc_wait_mask>>c->cnoc_count || c->ddr_wait_mask>>c->ddr_count)return AdrenoHfiStartupInvalid; for(unsigned i=0;icnoc_count;++i) for(unsigned j=0;jddr_count;++j)if(c->cnoc_addresses[i]==c->ddr_addresses[j])return AdrenoHfiStartupInvalid; for(unsigned i=0;i<2;++i)if(!zero(c->cnoc_data[i]+c->cnoc_count,6-c->cnoc_count))return AdrenoHfiStartupInvalid; for(unsigned i=0;i<16;++i) if(!zero(c->ddr_data[i]+(ibandwidth_count?c->ddr_count:0), 8-(ibandwidth_count?c->ddr_count:0)))return AdrenoHfiStartupInvalid; if(!c->acd_enable_mask) { if(c->acd_version || c->acd_stride || c->acd_count || !zero(c->acd_data,32))return AdrenoHfiStartupInvalid; } else { if(c->acd_version!=1 || c->acd_stride!=1 || (c->acd_enable_mask&1) || c->acd_enable_mask>>c->gpu_count)return AdrenoHfiStartupInvalid; unsigned count=0; for(uint32_t bits=c->acd_enable_mask;bits;bits>>=1)count+=bits&1; if(c->acd_count!=count || !zero(c->acd_data+count,32-count))return AdrenoHfiStartupInvalid; } return AdrenoHfiStartupSuccess; } AdrenoHfiStartupStatus AdrenoHfiStartupEncode(const AdrenoHfiStartupConfig *c, AdrenoHfiStartupStage stage,uint32_t *id,uint32_t *p,size_t capacity,size_t *count) { if(!count)return AdrenoHfiStartupInvalid; *count=0; if(!id || !p || capacity<159 || AdrenoHfiStartupValidate(c)!=AdrenoHfiStartupSuccess || stageAdrenoHfiStageStart || ((stage==AdrenoHfiStageAcdEnable || stage==AdrenoHfiStageAcdTable) && !c->acd_enable_mask) || (stage==AdrenoHfiStageIfpc && !c->enable_ifpc))return AdrenoHfiStartupInvalid; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:37 [MATCH: AdrenoHfiStartup] --- !addresses(c->cnoc_addresses,c->cnoc_count,6) || !addresses(c->ddr_addresses,c->ddr_count,8))return AdrenoHfiStartupInvalid; if(c->cnoc_wait_mask>>c->cnoc_count || c->ddr_wait_mask>>c->ddr_count)return AdrenoHfiStartupInvalid; for(unsigned i=0;icnoc_count;++i) for(unsigned j=0;jddr_count;++j)if(c->cnoc_addresses[i]==c->ddr_addresses[j])return AdrenoHfiStartupInvalid; for(unsigned i=0;i<2;++i)if(!zero(c->cnoc_data[i]+c->cnoc_count,6-c->cnoc_count))return AdrenoHfiStartupInvalid; for(unsigned i=0;i<16;++i) if(!zero(c->ddr_data[i]+(ibandwidth_count?c->ddr_count:0), 8-(ibandwidth_count?c->ddr_count:0)))return AdrenoHfiStartupInvalid; if(!c->acd_enable_mask) { if(c->acd_version || c->acd_stride || c->acd_count || !zero(c->acd_data,32))return AdrenoHfiStartupInvalid; } else { if(c->acd_version!=1 || c->acd_stride!=1 || (c->acd_enable_mask&1) || c->acd_enable_mask>>c->gpu_count)return AdrenoHfiStartupInvalid; unsigned count=0; for(uint32_t bits=c->acd_enable_mask;bits;bits>>=1)count+=bits&1; if(c->acd_count!=count || !zero(c->acd_data+count,32-count))return AdrenoHfiStartupInvalid; } return AdrenoHfiStartupSuccess; } AdrenoHfiStartupStatus AdrenoHfiStartupEncode(const AdrenoHfiStartupConfig *c, AdrenoHfiStartupStage stage,uint32_t *id,uint32_t *p,size_t capacity,size_t *count) { if(!count)return AdrenoHfiStartupInvalid; *count=0; if(!id || !p || capacity<159 || AdrenoHfiStartupValidate(c)!=AdrenoHfiStartupSuccess || stageAdrenoHfiStageStart || ((stage==AdrenoHfiStageAcdEnable || stage==AdrenoHfiStageAcdTable) && !c->acd_enable_mask) || (stage==AdrenoHfiStageIfpc && !c->enable_ifpc))return AdrenoHfiStartupInvalid; size_t n=0;unsigned message=0; switch(stage) { --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:40 [MATCH: AdrenoHfiStartup] --- for(unsigned i=0;icnoc_count;++i) for(unsigned j=0;jddr_count;++j)if(c->cnoc_addresses[i]==c->ddr_addresses[j])return AdrenoHfiStartupInvalid; for(unsigned i=0;i<2;++i)if(!zero(c->cnoc_data[i]+c->cnoc_count,6-c->cnoc_count))return AdrenoHfiStartupInvalid; for(unsigned i=0;i<16;++i) if(!zero(c->ddr_data[i]+(ibandwidth_count?c->ddr_count:0), 8-(ibandwidth_count?c->ddr_count:0)))return AdrenoHfiStartupInvalid; if(!c->acd_enable_mask) { if(c->acd_version || c->acd_stride || c->acd_count || !zero(c->acd_data,32))return AdrenoHfiStartupInvalid; } else { if(c->acd_version!=1 || c->acd_stride!=1 || (c->acd_enable_mask&1) || c->acd_enable_mask>>c->gpu_count)return AdrenoHfiStartupInvalid; unsigned count=0; for(uint32_t bits=c->acd_enable_mask;bits;bits>>=1)count+=bits&1; if(c->acd_count!=count || !zero(c->acd_data+count,32-count))return AdrenoHfiStartupInvalid; } return AdrenoHfiStartupSuccess; } AdrenoHfiStartupStatus AdrenoHfiStartupEncode(const AdrenoHfiStartupConfig *c, AdrenoHfiStartupStage stage,uint32_t *id,uint32_t *p,size_t capacity,size_t *count) { if(!count)return AdrenoHfiStartupInvalid; *count=0; if(!id || !p || capacity<159 || AdrenoHfiStartupValidate(c)!=AdrenoHfiStartupSuccess || stageAdrenoHfiStageStart || ((stage==AdrenoHfiStageAcdEnable || stage==AdrenoHfiStageAcdTable) && !c->acd_enable_mask) || (stage==AdrenoHfiStageIfpc && !c->enable_ifpc))return AdrenoHfiStartupInvalid; size_t n=0;unsigned message=0; switch(stage) { case AdrenoHfiStagePerformance: message=4;n=58; for(size_t i=0;iddr_data[i]+(ibandwidth_count?c->ddr_count:0), 8-(ibandwidth_count?c->ddr_count:0)))return AdrenoHfiStartupInvalid; if(!c->acd_enable_mask) { if(c->acd_version || c->acd_stride || c->acd_count || !zero(c->acd_data,32))return AdrenoHfiStartupInvalid; } else { if(c->acd_version!=1 || c->acd_stride!=1 || (c->acd_enable_mask&1) || c->acd_enable_mask>>c->gpu_count)return AdrenoHfiStartupInvalid; unsigned count=0; for(uint32_t bits=c->acd_enable_mask;bits;bits>>=1)count+=bits&1; if(c->acd_count!=count || !zero(c->acd_data+count,32-count))return AdrenoHfiStartupInvalid; } return AdrenoHfiStartupSuccess; } AdrenoHfiStartupStatus AdrenoHfiStartupEncode(const AdrenoHfiStartupConfig *c, AdrenoHfiStartupStage stage,uint32_t *id,uint32_t *p,size_t capacity,size_t *count) { if(!count)return AdrenoHfiStartupInvalid; *count=0; if(!id || !p || capacity<159 || AdrenoHfiStartupValidate(c)!=AdrenoHfiStartupSuccess || stageAdrenoHfiStageStart || ((stage==AdrenoHfiStageAcdEnable || stage==AdrenoHfiStageAcdTable) && !c->acd_enable_mask) || (stage==AdrenoHfiStageIfpc && !c->enable_ifpc))return AdrenoHfiStartupInvalid; size_t n=0;unsigned message=0; switch(stage) { case AdrenoHfiStagePerformance: message=4;n=58; for(size_t i=0;igpu_count;p[1]=c->gmu_count; for(unsigned i=0;igpu_count;++i) { p[2+3*i]=c->gpu[i].vote;p[3+3*i]=UINT32_MAX;p[4+3*i]=(uint32_t)(c->gpu[i].hz/1000); --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:45 [MATCH: AdrenoHfiStartup] --- 8-(ibandwidth_count?c->ddr_count:0)))return AdrenoHfiStartupInvalid; if(!c->acd_enable_mask) { if(c->acd_version || c->acd_stride || c->acd_count || !zero(c->acd_data,32))return AdrenoHfiStartupInvalid; } else { if(c->acd_version!=1 || c->acd_stride!=1 || (c->acd_enable_mask&1) || c->acd_enable_mask>>c->gpu_count)return AdrenoHfiStartupInvalid; unsigned count=0; for(uint32_t bits=c->acd_enable_mask;bits;bits>>=1)count+=bits&1; if(c->acd_count!=count || !zero(c->acd_data+count,32-count))return AdrenoHfiStartupInvalid; } return AdrenoHfiStartupSuccess; } AdrenoHfiStartupStatus AdrenoHfiStartupEncode(const AdrenoHfiStartupConfig *c, AdrenoHfiStartupStage stage,uint32_t *id,uint32_t *p,size_t capacity,size_t *count) { if(!count)return AdrenoHfiStartupInvalid; *count=0; if(!id || !p || capacity<159 || AdrenoHfiStartupValidate(c)!=AdrenoHfiStartupSuccess || stageAdrenoHfiStageStart || ((stage==AdrenoHfiStageAcdEnable || stage==AdrenoHfiStageAcdTable) && !c->acd_enable_mask) || (stage==AdrenoHfiStageIfpc && !c->enable_ifpc))return AdrenoHfiStartupInvalid; size_t n=0;unsigned message=0; switch(stage) { case AdrenoHfiStagePerformance: message=4;n=58; for(size_t i=0;igpu_count;p[1]=c->gmu_count; for(unsigned i=0;igpu_count;++i) { p[2+3*i]=c->gpu[i].vote;p[3+3*i]=UINT32_MAX;p[4+3*i]=(uint32_t)(c->gpu[i].hz/1000); } for(unsigned i=0;igmu_count;++i) { --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:47 [MATCH: AdrenoHfiStartup] --- if(c->acd_version || c->acd_stride || c->acd_count || !zero(c->acd_data,32))return AdrenoHfiStartupInvalid; } else { if(c->acd_version!=1 || c->acd_stride!=1 || (c->acd_enable_mask&1) || c->acd_enable_mask>>c->gpu_count)return AdrenoHfiStartupInvalid; unsigned count=0; for(uint32_t bits=c->acd_enable_mask;bits;bits>>=1)count+=bits&1; if(c->acd_count!=count || !zero(c->acd_data+count,32-count))return AdrenoHfiStartupInvalid; } return AdrenoHfiStartupSuccess; } AdrenoHfiStartupStatus AdrenoHfiStartupEncode(const AdrenoHfiStartupConfig *c, AdrenoHfiStartupStage stage,uint32_t *id,uint32_t *p,size_t capacity,size_t *count) { if(!count)return AdrenoHfiStartupInvalid; *count=0; if(!id || !p || capacity<159 || AdrenoHfiStartupValidate(c)!=AdrenoHfiStartupSuccess || stageAdrenoHfiStageStart || ((stage==AdrenoHfiStageAcdEnable || stage==AdrenoHfiStageAcdTable) && !c->acd_enable_mask) || (stage==AdrenoHfiStageIfpc && !c->enable_ifpc))return AdrenoHfiStartupInvalid; size_t n=0;unsigned message=0; switch(stage) { case AdrenoHfiStagePerformance: message=4;n=58; for(size_t i=0;igpu_count;p[1]=c->gmu_count; for(unsigned i=0;igpu_count;++i) { p[2+3*i]=c->gpu[i].vote;p[3+3*i]=UINT32_MAX;p[4+3*i]=(uint32_t)(c->gpu[i].hz/1000); } for(unsigned i=0;igmu_count;++i) { p[50+2*i]=c->gmu[i].vote;p[51+2*i]=(uint32_t)(c->gmu[i].hz/1000); } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:48 [MATCH: AdrenoHfiStartup] --- } else { if(c->acd_version!=1 || c->acd_stride!=1 || (c->acd_enable_mask&1) || c->acd_enable_mask>>c->gpu_count)return AdrenoHfiStartupInvalid; unsigned count=0; for(uint32_t bits=c->acd_enable_mask;bits;bits>>=1)count+=bits&1; if(c->acd_count!=count || !zero(c->acd_data+count,32-count))return AdrenoHfiStartupInvalid; } return AdrenoHfiStartupSuccess; } AdrenoHfiStartupStatus AdrenoHfiStartupEncode(const AdrenoHfiStartupConfig *c, AdrenoHfiStartupStage stage,uint32_t *id,uint32_t *p,size_t capacity,size_t *count) { if(!count)return AdrenoHfiStartupInvalid; *count=0; if(!id || !p || capacity<159 || AdrenoHfiStartupValidate(c)!=AdrenoHfiStartupSuccess || stageAdrenoHfiStageStart || ((stage==AdrenoHfiStageAcdEnable || stage==AdrenoHfiStageAcdTable) && !c->acd_enable_mask) || (stage==AdrenoHfiStageIfpc && !c->enable_ifpc))return AdrenoHfiStartupInvalid; size_t n=0;unsigned message=0; switch(stage) { case AdrenoHfiStagePerformance: message=4;n=58; for(size_t i=0;igpu_count;p[1]=c->gmu_count; for(unsigned i=0;igpu_count;++i) { p[2+3*i]=c->gpu[i].vote;p[3+3*i]=UINT32_MAX;p[4+3*i]=(uint32_t)(c->gpu[i].hz/1000); } for(unsigned i=0;igmu_count;++i) { p[50+2*i]=c->gmu[i].vote;p[51+2*i]=(uint32_t)(c->gmu[i].hz/1000); } break; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:50 [MATCH: AdrenoHfiStartup] --- c->acd_enable_mask>>c->gpu_count)return AdrenoHfiStartupInvalid; unsigned count=0; for(uint32_t bits=c->acd_enable_mask;bits;bits>>=1)count+=bits&1; if(c->acd_count!=count || !zero(c->acd_data+count,32-count))return AdrenoHfiStartupInvalid; } return AdrenoHfiStartupSuccess; } AdrenoHfiStartupStatus AdrenoHfiStartupEncode(const AdrenoHfiStartupConfig *c, AdrenoHfiStartupStage stage,uint32_t *id,uint32_t *p,size_t capacity,size_t *count) { if(!count)return AdrenoHfiStartupInvalid; *count=0; if(!id || !p || capacity<159 || AdrenoHfiStartupValidate(c)!=AdrenoHfiStartupSuccess || stageAdrenoHfiStageStart || ((stage==AdrenoHfiStageAcdEnable || stage==AdrenoHfiStageAcdTable) && !c->acd_enable_mask) || (stage==AdrenoHfiStageIfpc && !c->enable_ifpc))return AdrenoHfiStartupInvalid; size_t n=0;unsigned message=0; switch(stage) { case AdrenoHfiStagePerformance: message=4;n=58; for(size_t i=0;igpu_count;p[1]=c->gmu_count; for(unsigned i=0;igpu_count;++i) { p[2+3*i]=c->gpu[i].vote;p[3+3*i]=UINT32_MAX;p[4+3*i]=(uint32_t)(c->gpu[i].hz/1000); } for(unsigned i=0;igmu_count;++i) { p[50+2*i]=c->gmu[i].vote;p[51+2*i]=(uint32_t)(c->gmu[i].hz/1000); } break; case AdrenoHfiStageBandwidth: message=3;n=159; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:52 [MATCH: AdrenoHfiStartup] --- for(uint32_t bits=c->acd_enable_mask;bits;bits>>=1)count+=bits&1; if(c->acd_count!=count || !zero(c->acd_data+count,32-count))return AdrenoHfiStartupInvalid; } return AdrenoHfiStartupSuccess; } AdrenoHfiStartupStatus AdrenoHfiStartupEncode(const AdrenoHfiStartupConfig *c, AdrenoHfiStartupStage stage,uint32_t *id,uint32_t *p,size_t capacity,size_t *count) { if(!count)return AdrenoHfiStartupInvalid; *count=0; if(!id || !p || capacity<159 || AdrenoHfiStartupValidate(c)!=AdrenoHfiStartupSuccess || stageAdrenoHfiStageStart || ((stage==AdrenoHfiStageAcdEnable || stage==AdrenoHfiStageAcdTable) && !c->acd_enable_mask) || (stage==AdrenoHfiStageIfpc && !c->enable_ifpc))return AdrenoHfiStartupInvalid; size_t n=0;unsigned message=0; switch(stage) { case AdrenoHfiStagePerformance: message=4;n=58; for(size_t i=0;igpu_count;p[1]=c->gmu_count; for(unsigned i=0;igpu_count;++i) { p[2+3*i]=c->gpu[i].vote;p[3+3*i]=UINT32_MAX;p[4+3*i]=(uint32_t)(c->gpu[i].hz/1000); } for(unsigned i=0;igmu_count;++i) { p[50+2*i]=c->gmu[i].vote;p[51+2*i]=(uint32_t)(c->gmu[i].hz/1000); } break; case AdrenoHfiStageBandwidth: message=3;n=159; p[0]=c->bandwidth_count;p[1]=c->cnoc_count;p[2]=c->ddr_count; p[3]=c->cnoc_wait_mask;p[4]=c->ddr_wait_mask; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:55 [MATCH: AdrenoHfiStartup] --- return AdrenoHfiStartupSuccess; } AdrenoHfiStartupStatus AdrenoHfiStartupEncode(const AdrenoHfiStartupConfig *c, AdrenoHfiStartupStage stage,uint32_t *id,uint32_t *p,size_t capacity,size_t *count) { if(!count)return AdrenoHfiStartupInvalid; *count=0; if(!id || !p || capacity<159 || AdrenoHfiStartupValidate(c)!=AdrenoHfiStartupSuccess || stageAdrenoHfiStageStart || ((stage==AdrenoHfiStageAcdEnable || stage==AdrenoHfiStageAcdTable) && !c->acd_enable_mask) || (stage==AdrenoHfiStageIfpc && !c->enable_ifpc))return AdrenoHfiStartupInvalid; size_t n=0;unsigned message=0; switch(stage) { case AdrenoHfiStagePerformance: message=4;n=58; for(size_t i=0;igpu_count;p[1]=c->gmu_count; for(unsigned i=0;igpu_count;++i) { p[2+3*i]=c->gpu[i].vote;p[3+3*i]=UINT32_MAX;p[4+3*i]=(uint32_t)(c->gpu[i].hz/1000); } for(unsigned i=0;igmu_count;++i) { p[50+2*i]=c->gmu[i].vote;p[51+2*i]=(uint32_t)(c->gmu[i].hz/1000); } break; case AdrenoHfiStageBandwidth: message=3;n=159; p[0]=c->bandwidth_count;p[1]=c->cnoc_count;p[2]=c->ddr_count; p[3]=c->cnoc_wait_mask;p[4]=c->ddr_wait_mask; for(unsigned i=0;i<6;++i)p[5+i]=c->cnoc_addresses[i]; for(unsigned i=0;i<12;++i)p[11+i]=c->cnoc_data[i/6][i%6]; for(unsigned i=0;i<8;++i)p[23+i]=c->ddr_addresses[i]; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:86 [MATCH: AdrenoHfiStartup] --- for(unsigned i=0;i<128;++i)p[31+i]=c->ddr_data[i/8][i%8]; break; case AdrenoHfiStageAcdEnable:message=11;n=3;p[0]=12;p[1]=1;p[2]=0;break; case AdrenoHfiStageAcdTable: message=7;n=36;p[0]=c->acd_version;p[1]=c->acd_enable_mask;p[2]=c->acd_stride;p[3]=c->acd_count; for(unsigned i=0;i<32;++i)p[4+i]=c->acd_data[i]; break; case AdrenoHfiStageIfpc:message=11;n=3;p[0]=9;p[1]=1;p[2]=0x1680;break; case AdrenoHfiStageCoreStart:message=14;n=1;p[0]=0;break; case AdrenoHfiStageStart:message=10;n=0;break; default:return AdrenoHfiStartupInvalid; } *id=message;*count=n;return AdrenoHfiStartupSuccess; } AdrenoHfiStartupStatus AdrenoHfiStartupValidateServices(const AdrenoHfiStartupServices *s) { if(!s || !s->now_us || !s->wait_us || !s->check_health || !s->polls_per_command || s->polls_per_command>1048576 || !s->wait_interval_us || s->wait_interval_us>1000000 || !s->command_timeout_us || s->command_timeout_us>10000000 || s->total_timeout_uscommand_timeout_us || s->total_timeout_us>60000000) return AdrenoHfiStartupInvalid; return AdrenoHfiStartupSuccess; } static AdrenoHfiStartupStatus clock_check(const AdrenoHfiStartupServices *s, uint64_t begin,uint64_t command,uint64_t *last,AdrenoHfiStartupResult *r) { uint64_t now; if(s->now_us(s->cookie,&now) || now<*last)return AdrenoHfiStartupClockError; *last=now;r->elapsed_us=now-begin; if(now-begin>=s->total_timeout_us || now-command>=s->command_timeout_us)return AdrenoHfiStartupTimeout; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:88 [MATCH: AdrenoHfiStartup] --- case AdrenoHfiStageAcdEnable:message=11;n=3;p[0]=12;p[1]=1;p[2]=0;break; case AdrenoHfiStageAcdTable: message=7;n=36;p[0]=c->acd_version;p[1]=c->acd_enable_mask;p[2]=c->acd_stride;p[3]=c->acd_count; for(unsigned i=0;i<32;++i)p[4+i]=c->acd_data[i]; break; case AdrenoHfiStageIfpc:message=11;n=3;p[0]=9;p[1]=1;p[2]=0x1680;break; case AdrenoHfiStageCoreStart:message=14;n=1;p[0]=0;break; case AdrenoHfiStageStart:message=10;n=0;break; default:return AdrenoHfiStartupInvalid; } *id=message;*count=n;return AdrenoHfiStartupSuccess; } AdrenoHfiStartupStatus AdrenoHfiStartupValidateServices(const AdrenoHfiStartupServices *s) { if(!s || !s->now_us || !s->wait_us || !s->check_health || !s->polls_per_command || s->polls_per_command>1048576 || !s->wait_interval_us || s->wait_interval_us>1000000 || !s->command_timeout_us || s->command_timeout_us>10000000 || s->total_timeout_uscommand_timeout_us || s->total_timeout_us>60000000) return AdrenoHfiStartupInvalid; return AdrenoHfiStartupSuccess; } static AdrenoHfiStartupStatus clock_check(const AdrenoHfiStartupServices *s, uint64_t begin,uint64_t command,uint64_t *last,AdrenoHfiStartupResult *r) { uint64_t now; if(s->now_us(s->cookie,&now) || now<*last)return AdrenoHfiStartupClockError; *last=now;r->elapsed_us=now-begin; if(now-begin>=s->total_timeout_us || now-command>=s->command_timeout_us)return AdrenoHfiStartupTimeout; return AdrenoHfiStartupSuccess; } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:90 [MATCH: AdrenoHfiStartup] --- message=7;n=36;p[0]=c->acd_version;p[1]=c->acd_enable_mask;p[2]=c->acd_stride;p[3]=c->acd_count; for(unsigned i=0;i<32;++i)p[4+i]=c->acd_data[i]; break; case AdrenoHfiStageIfpc:message=11;n=3;p[0]=9;p[1]=1;p[2]=0x1680;break; case AdrenoHfiStageCoreStart:message=14;n=1;p[0]=0;break; case AdrenoHfiStageStart:message=10;n=0;break; default:return AdrenoHfiStartupInvalid; } *id=message;*count=n;return AdrenoHfiStartupSuccess; } AdrenoHfiStartupStatus AdrenoHfiStartupValidateServices(const AdrenoHfiStartupServices *s) { if(!s || !s->now_us || !s->wait_us || !s->check_health || !s->polls_per_command || s->polls_per_command>1048576 || !s->wait_interval_us || s->wait_interval_us>1000000 || !s->command_timeout_us || s->command_timeout_us>10000000 || s->total_timeout_uscommand_timeout_us || s->total_timeout_us>60000000) return AdrenoHfiStartupInvalid; return AdrenoHfiStartupSuccess; } static AdrenoHfiStartupStatus clock_check(const AdrenoHfiStartupServices *s, uint64_t begin,uint64_t command,uint64_t *last,AdrenoHfiStartupResult *r) { uint64_t now; if(s->now_us(s->cookie,&now) || now<*last)return AdrenoHfiStartupClockError; *last=now;r->elapsed_us=now-begin; if(now-begin>=s->total_timeout_us || now-command>=s->command_timeout_us)return AdrenoHfiStartupTimeout; return AdrenoHfiStartupSuccess; } AdrenoHfiStartupStatus AdrenoHfiStartupRun(AdrenoHfiStartup *state,AdrenoHfi *h, const AdrenoHfiStartupConfig *c,const AdrenoHfiStartupServices *s,AdrenoHfiStartupResult *r) --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:97 [MATCH: AdrenoHfiStartup] --- } *id=message;*count=n;return AdrenoHfiStartupSuccess; } AdrenoHfiStartupStatus AdrenoHfiStartupValidateServices(const AdrenoHfiStartupServices *s) { if(!s || !s->now_us || !s->wait_us || !s->check_health || !s->polls_per_command || s->polls_per_command>1048576 || !s->wait_interval_us || s->wait_interval_us>1000000 || !s->command_timeout_us || s->command_timeout_us>10000000 || s->total_timeout_uscommand_timeout_us || s->total_timeout_us>60000000) return AdrenoHfiStartupInvalid; return AdrenoHfiStartupSuccess; } static AdrenoHfiStartupStatus clock_check(const AdrenoHfiStartupServices *s, uint64_t begin,uint64_t command,uint64_t *last,AdrenoHfiStartupResult *r) { uint64_t now; if(s->now_us(s->cookie,&now) || now<*last)return AdrenoHfiStartupClockError; *last=now;r->elapsed_us=now-begin; if(now-begin>=s->total_timeout_us || now-command>=s->command_timeout_us)return AdrenoHfiStartupTimeout; return AdrenoHfiStartupSuccess; } AdrenoHfiStartupStatus AdrenoHfiStartupRun(AdrenoHfiStartup *state,AdrenoHfi *h, const AdrenoHfiStartupConfig *c,const AdrenoHfiStartupServices *s,AdrenoHfiStartupResult *r) { if(!r)return AdrenoHfiStartupInvalid; *r=(AdrenoHfiStartupResult){0};r->resources_must_retain=1; if(!state || !h || h->legacy || AdrenoHfiStartupValidateServices(s)!=AdrenoHfiStartupSuccess || AdrenoHfiStartupValidate(c)!=AdrenoHfiStartupSuccess)return AdrenoHfiStartupInvalid; if(state->poisoned || h->poisoned)return AdrenoHfiStartupPoisoned; if(state->attempted || state->completed || h->pending_header)return AdrenoHfiStartupBusy; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:98 [MATCH: AdrenoHfiStartup] --- *id=message;*count=n;return AdrenoHfiStartupSuccess; } AdrenoHfiStartupStatus AdrenoHfiStartupValidateServices(const AdrenoHfiStartupServices *s) { if(!s || !s->now_us || !s->wait_us || !s->check_health || !s->polls_per_command || s->polls_per_command>1048576 || !s->wait_interval_us || s->wait_interval_us>1000000 || !s->command_timeout_us || s->command_timeout_us>10000000 || s->total_timeout_uscommand_timeout_us || s->total_timeout_us>60000000) return AdrenoHfiStartupInvalid; return AdrenoHfiStartupSuccess; } static AdrenoHfiStartupStatus clock_check(const AdrenoHfiStartupServices *s, uint64_t begin,uint64_t command,uint64_t *last,AdrenoHfiStartupResult *r) { uint64_t now; if(s->now_us(s->cookie,&now) || now<*last)return AdrenoHfiStartupClockError; *last=now;r->elapsed_us=now-begin; if(now-begin>=s->total_timeout_us || now-command>=s->command_timeout_us)return AdrenoHfiStartupTimeout; return AdrenoHfiStartupSuccess; } AdrenoHfiStartupStatus AdrenoHfiStartupRun(AdrenoHfiStartup *state,AdrenoHfi *h, const AdrenoHfiStartupConfig *c,const AdrenoHfiStartupServices *s,AdrenoHfiStartupResult *r) { if(!r)return AdrenoHfiStartupInvalid; *r=(AdrenoHfiStartupResult){0};r->resources_must_retain=1; if(!state || !h || h->legacy || AdrenoHfiStartupValidateServices(s)!=AdrenoHfiStartupSuccess || AdrenoHfiStartupValidate(c)!=AdrenoHfiStartupSuccess)return AdrenoHfiStartupInvalid; if(state->poisoned || h->poisoned)return AdrenoHfiStartupPoisoned; if(state->attempted || state->completed || h->pending_header)return AdrenoHfiStartupBusy; uint64_t begin,last,command; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:100 [MATCH: AdrenoHfiStartup] --- AdrenoHfiStartupStatus AdrenoHfiStartupValidateServices(const AdrenoHfiStartupServices *s) { if(!s || !s->now_us || !s->wait_us || !s->check_health || !s->polls_per_command || s->polls_per_command>1048576 || !s->wait_interval_us || s->wait_interval_us>1000000 || !s->command_timeout_us || s->command_timeout_us>10000000 || s->total_timeout_uscommand_timeout_us || s->total_timeout_us>60000000) return AdrenoHfiStartupInvalid; return AdrenoHfiStartupSuccess; } static AdrenoHfiStartupStatus clock_check(const AdrenoHfiStartupServices *s, uint64_t begin,uint64_t command,uint64_t *last,AdrenoHfiStartupResult *r) { uint64_t now; if(s->now_us(s->cookie,&now) || now<*last)return AdrenoHfiStartupClockError; *last=now;r->elapsed_us=now-begin; if(now-begin>=s->total_timeout_us || now-command>=s->command_timeout_us)return AdrenoHfiStartupTimeout; return AdrenoHfiStartupSuccess; } AdrenoHfiStartupStatus AdrenoHfiStartupRun(AdrenoHfiStartup *state,AdrenoHfi *h, const AdrenoHfiStartupConfig *c,const AdrenoHfiStartupServices *s,AdrenoHfiStartupResult *r) { if(!r)return AdrenoHfiStartupInvalid; *r=(AdrenoHfiStartupResult){0};r->resources_must_retain=1; if(!state || !h || h->legacy || AdrenoHfiStartupValidateServices(s)!=AdrenoHfiStartupSuccess || AdrenoHfiStartupValidate(c)!=AdrenoHfiStartupSuccess)return AdrenoHfiStartupInvalid; if(state->poisoned || h->poisoned)return AdrenoHfiStartupPoisoned; if(state->attempted || state->completed || h->pending_header)return AdrenoHfiStartupBusy; uint64_t begin,last,command; if(s->now_us(s->cookie,&begin))return AdrenoHfiStartupClockError; last=begin; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:101 [MATCH: AdrenoHfiStartup] --- { if(!s || !s->now_us || !s->wait_us || !s->check_health || !s->polls_per_command || s->polls_per_command>1048576 || !s->wait_interval_us || s->wait_interval_us>1000000 || !s->command_timeout_us || s->command_timeout_us>10000000 || s->total_timeout_uscommand_timeout_us || s->total_timeout_us>60000000) return AdrenoHfiStartupInvalid; return AdrenoHfiStartupSuccess; } static AdrenoHfiStartupStatus clock_check(const AdrenoHfiStartupServices *s, uint64_t begin,uint64_t command,uint64_t *last,AdrenoHfiStartupResult *r) { uint64_t now; if(s->now_us(s->cookie,&now) || now<*last)return AdrenoHfiStartupClockError; *last=now;r->elapsed_us=now-begin; if(now-begin>=s->total_timeout_us || now-command>=s->command_timeout_us)return AdrenoHfiStartupTimeout; return AdrenoHfiStartupSuccess; } AdrenoHfiStartupStatus AdrenoHfiStartupRun(AdrenoHfiStartup *state,AdrenoHfi *h, const AdrenoHfiStartupConfig *c,const AdrenoHfiStartupServices *s,AdrenoHfiStartupResult *r) { if(!r)return AdrenoHfiStartupInvalid; *r=(AdrenoHfiStartupResult){0};r->resources_must_retain=1; if(!state || !h || h->legacy || AdrenoHfiStartupValidateServices(s)!=AdrenoHfiStartupSuccess || AdrenoHfiStartupValidate(c)!=AdrenoHfiStartupSuccess)return AdrenoHfiStartupInvalid; if(state->poisoned || h->poisoned)return AdrenoHfiStartupPoisoned; if(state->attempted || state->completed || h->pending_header)return AdrenoHfiStartupBusy; uint64_t begin,last,command; if(s->now_us(s->cookie,&begin))return AdrenoHfiStartupClockError; last=begin; if(s->check_health(s->cookie))return AdrenoHfiStartupPlatformFault; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:104 [MATCH: AdrenoHfiStartup] --- !s->wait_interval_us || s->wait_interval_us>1000000 || !s->command_timeout_us || s->command_timeout_us>10000000 || s->total_timeout_uscommand_timeout_us || s->total_timeout_us>60000000) return AdrenoHfiStartupInvalid; return AdrenoHfiStartupSuccess; } static AdrenoHfiStartupStatus clock_check(const AdrenoHfiStartupServices *s, uint64_t begin,uint64_t command,uint64_t *last,AdrenoHfiStartupResult *r) { uint64_t now; if(s->now_us(s->cookie,&now) || now<*last)return AdrenoHfiStartupClockError; *last=now;r->elapsed_us=now-begin; if(now-begin>=s->total_timeout_us || now-command>=s->command_timeout_us)return AdrenoHfiStartupTimeout; return AdrenoHfiStartupSuccess; } AdrenoHfiStartupStatus AdrenoHfiStartupRun(AdrenoHfiStartup *state,AdrenoHfi *h, const AdrenoHfiStartupConfig *c,const AdrenoHfiStartupServices *s,AdrenoHfiStartupResult *r) { if(!r)return AdrenoHfiStartupInvalid; *r=(AdrenoHfiStartupResult){0};r->resources_must_retain=1; if(!state || !h || h->legacy || AdrenoHfiStartupValidateServices(s)!=AdrenoHfiStartupSuccess || AdrenoHfiStartupValidate(c)!=AdrenoHfiStartupSuccess)return AdrenoHfiStartupInvalid; if(state->poisoned || h->poisoned)return AdrenoHfiStartupPoisoned; if(state->attempted || state->completed || h->pending_header)return AdrenoHfiStartupBusy; uint64_t begin,last,command; if(s->now_us(s->cookie,&begin))return AdrenoHfiStartupClockError; last=begin; if(s->check_health(s->cookie))return AdrenoHfiStartupPlatformFault; state->attempted=1; AdrenoHfiStartupStatus status=AdrenoHfiStartupSuccess; uint32_t payload[159],output[16],id;size_t words,returned; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:106 [MATCH: AdrenoHfiStartup] --- s->total_timeout_uscommand_timeout_us || s->total_timeout_us>60000000) return AdrenoHfiStartupInvalid; return AdrenoHfiStartupSuccess; } static AdrenoHfiStartupStatus clock_check(const AdrenoHfiStartupServices *s, uint64_t begin,uint64_t command,uint64_t *last,AdrenoHfiStartupResult *r) { uint64_t now; if(s->now_us(s->cookie,&now) || now<*last)return AdrenoHfiStartupClockError; *last=now;r->elapsed_us=now-begin; if(now-begin>=s->total_timeout_us || now-command>=s->command_timeout_us)return AdrenoHfiStartupTimeout; return AdrenoHfiStartupSuccess; } AdrenoHfiStartupStatus AdrenoHfiStartupRun(AdrenoHfiStartup *state,AdrenoHfi *h, const AdrenoHfiStartupConfig *c,const AdrenoHfiStartupServices *s,AdrenoHfiStartupResult *r) { if(!r)return AdrenoHfiStartupInvalid; *r=(AdrenoHfiStartupResult){0};r->resources_must_retain=1; if(!state || !h || h->legacy || AdrenoHfiStartupValidateServices(s)!=AdrenoHfiStartupSuccess || AdrenoHfiStartupValidate(c)!=AdrenoHfiStartupSuccess)return AdrenoHfiStartupInvalid; if(state->poisoned || h->poisoned)return AdrenoHfiStartupPoisoned; if(state->attempted || state->completed || h->pending_header)return AdrenoHfiStartupBusy; uint64_t begin,last,command; if(s->now_us(s->cookie,&begin))return AdrenoHfiStartupClockError; last=begin; if(s->check_health(s->cookie))return AdrenoHfiStartupPlatformFault; state->attempted=1; AdrenoHfiStartupStatus status=AdrenoHfiStartupSuccess; uint32_t payload[159],output[16],id;size_t words,returned; for(unsigned step=AdrenoHfiStagePerformance;step<=AdrenoHfiStageStart;++step) { if((step==AdrenoHfiStageAcdEnable || step==AdrenoHfiStageAcdTable) && !c->acd_enable_mask)continue; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:107 [MATCH: AdrenoHfiStartup] --- return AdrenoHfiStartupInvalid; return AdrenoHfiStartupSuccess; } static AdrenoHfiStartupStatus clock_check(const AdrenoHfiStartupServices *s, uint64_t begin,uint64_t command,uint64_t *last,AdrenoHfiStartupResult *r) { uint64_t now; if(s->now_us(s->cookie,&now) || now<*last)return AdrenoHfiStartupClockError; *last=now;r->elapsed_us=now-begin; if(now-begin>=s->total_timeout_us || now-command>=s->command_timeout_us)return AdrenoHfiStartupTimeout; return AdrenoHfiStartupSuccess; } AdrenoHfiStartupStatus AdrenoHfiStartupRun(AdrenoHfiStartup *state,AdrenoHfi *h, const AdrenoHfiStartupConfig *c,const AdrenoHfiStartupServices *s,AdrenoHfiStartupResult *r) { if(!r)return AdrenoHfiStartupInvalid; *r=(AdrenoHfiStartupResult){0};r->resources_must_retain=1; if(!state || !h || h->legacy || AdrenoHfiStartupValidateServices(s)!=AdrenoHfiStartupSuccess || AdrenoHfiStartupValidate(c)!=AdrenoHfiStartupSuccess)return AdrenoHfiStartupInvalid; if(state->poisoned || h->poisoned)return AdrenoHfiStartupPoisoned; if(state->attempted || state->completed || h->pending_header)return AdrenoHfiStartupBusy; uint64_t begin,last,command; if(s->now_us(s->cookie,&begin))return AdrenoHfiStartupClockError; last=begin; if(s->check_health(s->cookie))return AdrenoHfiStartupPlatformFault; state->attempted=1; AdrenoHfiStartupStatus status=AdrenoHfiStartupSuccess; uint32_t payload[159],output[16],id;size_t words,returned; for(unsigned step=AdrenoHfiStagePerformance;step<=AdrenoHfiStageStart;++step) { if((step==AdrenoHfiStageAcdEnable || step==AdrenoHfiStageAcdTable) && !c->acd_enable_mask)continue; if(step==AdrenoHfiStageIfpc && !c->enable_ifpc)continue; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:109 [MATCH: AdrenoHfiStartup] --- } static AdrenoHfiStartupStatus clock_check(const AdrenoHfiStartupServices *s, uint64_t begin,uint64_t command,uint64_t *last,AdrenoHfiStartupResult *r) { uint64_t now; if(s->now_us(s->cookie,&now) || now<*last)return AdrenoHfiStartupClockError; *last=now;r->elapsed_us=now-begin; if(now-begin>=s->total_timeout_us || now-command>=s->command_timeout_us)return AdrenoHfiStartupTimeout; return AdrenoHfiStartupSuccess; } AdrenoHfiStartupStatus AdrenoHfiStartupRun(AdrenoHfiStartup *state,AdrenoHfi *h, const AdrenoHfiStartupConfig *c,const AdrenoHfiStartupServices *s,AdrenoHfiStartupResult *r) { if(!r)return AdrenoHfiStartupInvalid; *r=(AdrenoHfiStartupResult){0};r->resources_must_retain=1; if(!state || !h || h->legacy || AdrenoHfiStartupValidateServices(s)!=AdrenoHfiStartupSuccess || AdrenoHfiStartupValidate(c)!=AdrenoHfiStartupSuccess)return AdrenoHfiStartupInvalid; if(state->poisoned || h->poisoned)return AdrenoHfiStartupPoisoned; if(state->attempted || state->completed || h->pending_header)return AdrenoHfiStartupBusy; uint64_t begin,last,command; if(s->now_us(s->cookie,&begin))return AdrenoHfiStartupClockError; last=begin; if(s->check_health(s->cookie))return AdrenoHfiStartupPlatformFault; state->attempted=1; AdrenoHfiStartupStatus status=AdrenoHfiStartupSuccess; uint32_t payload[159],output[16],id;size_t words,returned; for(unsigned step=AdrenoHfiStagePerformance;step<=AdrenoHfiStageStart;++step) { if((step==AdrenoHfiStageAcdEnable || step==AdrenoHfiStageAcdTable) && !c->acd_enable_mask)continue; if(step==AdrenoHfiStageIfpc && !c->enable_ifpc)continue; r->stage=(AdrenoHfiStartupStage)step;command=last; status=clock_check(s,begin,command,&last,r);if(status)goto failed; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:110 [MATCH: AdrenoHfiStartup] --- static AdrenoHfiStartupStatus clock_check(const AdrenoHfiStartupServices *s, uint64_t begin,uint64_t command,uint64_t *last,AdrenoHfiStartupResult *r) { uint64_t now; if(s->now_us(s->cookie,&now) || now<*last)return AdrenoHfiStartupClockError; *last=now;r->elapsed_us=now-begin; if(now-begin>=s->total_timeout_us || now-command>=s->command_timeout_us)return AdrenoHfiStartupTimeout; return AdrenoHfiStartupSuccess; } AdrenoHfiStartupStatus AdrenoHfiStartupRun(AdrenoHfiStartup *state,AdrenoHfi *h, const AdrenoHfiStartupConfig *c,const AdrenoHfiStartupServices *s,AdrenoHfiStartupResult *r) { if(!r)return AdrenoHfiStartupInvalid; *r=(AdrenoHfiStartupResult){0};r->resources_must_retain=1; if(!state || !h || h->legacy || AdrenoHfiStartupValidateServices(s)!=AdrenoHfiStartupSuccess || AdrenoHfiStartupValidate(c)!=AdrenoHfiStartupSuccess)return AdrenoHfiStartupInvalid; if(state->poisoned || h->poisoned)return AdrenoHfiStartupPoisoned; if(state->attempted || state->completed || h->pending_header)return AdrenoHfiStartupBusy; uint64_t begin,last,command; if(s->now_us(s->cookie,&begin))return AdrenoHfiStartupClockError; last=begin; if(s->check_health(s->cookie))return AdrenoHfiStartupPlatformFault; state->attempted=1; AdrenoHfiStartupStatus status=AdrenoHfiStartupSuccess; uint32_t payload[159],output[16],id;size_t words,returned; for(unsigned step=AdrenoHfiStagePerformance;step<=AdrenoHfiStageStart;++step) { if((step==AdrenoHfiStageAcdEnable || step==AdrenoHfiStageAcdTable) && !c->acd_enable_mask)continue; if(step==AdrenoHfiStageIfpc && !c->enable_ifpc)continue; r->stage=(AdrenoHfiStartupStage)step;command=last; status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:112 [MATCH: AdrenoHfiStartup] --- { uint64_t now; if(s->now_us(s->cookie,&now) || now<*last)return AdrenoHfiStartupClockError; *last=now;r->elapsed_us=now-begin; if(now-begin>=s->total_timeout_us || now-command>=s->command_timeout_us)return AdrenoHfiStartupTimeout; return AdrenoHfiStartupSuccess; } AdrenoHfiStartupStatus AdrenoHfiStartupRun(AdrenoHfiStartup *state,AdrenoHfi *h, const AdrenoHfiStartupConfig *c,const AdrenoHfiStartupServices *s,AdrenoHfiStartupResult *r) { if(!r)return AdrenoHfiStartupInvalid; *r=(AdrenoHfiStartupResult){0};r->resources_must_retain=1; if(!state || !h || h->legacy || AdrenoHfiStartupValidateServices(s)!=AdrenoHfiStartupSuccess || AdrenoHfiStartupValidate(c)!=AdrenoHfiStartupSuccess)return AdrenoHfiStartupInvalid; if(state->poisoned || h->poisoned)return AdrenoHfiStartupPoisoned; if(state->attempted || state->completed || h->pending_header)return AdrenoHfiStartupBusy; uint64_t begin,last,command; if(s->now_us(s->cookie,&begin))return AdrenoHfiStartupClockError; last=begin; if(s->check_health(s->cookie))return AdrenoHfiStartupPlatformFault; state->attempted=1; AdrenoHfiStartupStatus status=AdrenoHfiStartupSuccess; uint32_t payload[159],output[16],id;size_t words,returned; for(unsigned step=AdrenoHfiStagePerformance;step<=AdrenoHfiStageStart;++step) { if((step==AdrenoHfiStageAcdEnable || step==AdrenoHfiStageAcdTable) && !c->acd_enable_mask)continue; if(step==AdrenoHfiStageIfpc && !c->enable_ifpc)continue; r->stage=(AdrenoHfiStartupStage)step;command=last; status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} status=AdrenoHfiStartupEncode(c,r->stage,&id,payload,159,&words);if(status)goto failed; r->wire_header=0; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:113 [MATCH: AdrenoHfiStartup] --- uint64_t now; if(s->now_us(s->cookie,&now) || now<*last)return AdrenoHfiStartupClockError; *last=now;r->elapsed_us=now-begin; if(now-begin>=s->total_timeout_us || now-command>=s->command_timeout_us)return AdrenoHfiStartupTimeout; return AdrenoHfiStartupSuccess; } AdrenoHfiStartupStatus AdrenoHfiStartupRun(AdrenoHfiStartup *state,AdrenoHfi *h, const AdrenoHfiStartupConfig *c,const AdrenoHfiStartupServices *s,AdrenoHfiStartupResult *r) { if(!r)return AdrenoHfiStartupInvalid; *r=(AdrenoHfiStartupResult){0};r->resources_must_retain=1; if(!state || !h || h->legacy || AdrenoHfiStartupValidateServices(s)!=AdrenoHfiStartupSuccess || AdrenoHfiStartupValidate(c)!=AdrenoHfiStartupSuccess)return AdrenoHfiStartupInvalid; if(state->poisoned || h->poisoned)return AdrenoHfiStartupPoisoned; if(state->attempted || state->completed || h->pending_header)return AdrenoHfiStartupBusy; uint64_t begin,last,command; if(s->now_us(s->cookie,&begin))return AdrenoHfiStartupClockError; last=begin; if(s->check_health(s->cookie))return AdrenoHfiStartupPlatformFault; state->attempted=1; AdrenoHfiStartupStatus status=AdrenoHfiStartupSuccess; uint32_t payload[159],output[16],id;size_t words,returned; for(unsigned step=AdrenoHfiStagePerformance;step<=AdrenoHfiStageStart;++step) { if((step==AdrenoHfiStageAcdEnable || step==AdrenoHfiStageAcdTable) && !c->acd_enable_mask)continue; if(step==AdrenoHfiStageIfpc && !c->enable_ifpc)continue; r->stage=(AdrenoHfiStartupStage)step;command=last; status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} status=AdrenoHfiStartupEncode(c,r->stage,&id,payload,159,&words);if(status)goto failed; r->wire_header=0; r->transport_status=AdrenoHfiSend(h,id,payload,words,&r->wire_header); --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:114 [MATCH: AdrenoHfiStartup] --- if(s->now_us(s->cookie,&now) || now<*last)return AdrenoHfiStartupClockError; *last=now;r->elapsed_us=now-begin; if(now-begin>=s->total_timeout_us || now-command>=s->command_timeout_us)return AdrenoHfiStartupTimeout; return AdrenoHfiStartupSuccess; } AdrenoHfiStartupStatus AdrenoHfiStartupRun(AdrenoHfiStartup *state,AdrenoHfi *h, const AdrenoHfiStartupConfig *c,const AdrenoHfiStartupServices *s,AdrenoHfiStartupResult *r) { if(!r)return AdrenoHfiStartupInvalid; *r=(AdrenoHfiStartupResult){0};r->resources_must_retain=1; if(!state || !h || h->legacy || AdrenoHfiStartupValidateServices(s)!=AdrenoHfiStartupSuccess || AdrenoHfiStartupValidate(c)!=AdrenoHfiStartupSuccess)return AdrenoHfiStartupInvalid; if(state->poisoned || h->poisoned)return AdrenoHfiStartupPoisoned; if(state->attempted || state->completed || h->pending_header)return AdrenoHfiStartupBusy; uint64_t begin,last,command; if(s->now_us(s->cookie,&begin))return AdrenoHfiStartupClockError; last=begin; if(s->check_health(s->cookie))return AdrenoHfiStartupPlatformFault; state->attempted=1; AdrenoHfiStartupStatus status=AdrenoHfiStartupSuccess; uint32_t payload[159],output[16],id;size_t words,returned; for(unsigned step=AdrenoHfiStagePerformance;step<=AdrenoHfiStageStart;++step) { if((step==AdrenoHfiStageAcdEnable || step==AdrenoHfiStageAcdTable) && !c->acd_enable_mask)continue; if(step==AdrenoHfiStageIfpc && !c->enable_ifpc)continue; r->stage=(AdrenoHfiStartupStage)step;command=last; status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} status=AdrenoHfiStartupEncode(c,r->stage,&id,payload,159,&words);if(status)goto failed; r->wire_header=0; r->transport_status=AdrenoHfiSend(h,id,payload,words,&r->wire_header); if(r->wire_header)++r->published_commands; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:115 [MATCH: AdrenoHfiStartup] --- *last=now;r->elapsed_us=now-begin; if(now-begin>=s->total_timeout_us || now-command>=s->command_timeout_us)return AdrenoHfiStartupTimeout; return AdrenoHfiStartupSuccess; } AdrenoHfiStartupStatus AdrenoHfiStartupRun(AdrenoHfiStartup *state,AdrenoHfi *h, const AdrenoHfiStartupConfig *c,const AdrenoHfiStartupServices *s,AdrenoHfiStartupResult *r) { if(!r)return AdrenoHfiStartupInvalid; *r=(AdrenoHfiStartupResult){0};r->resources_must_retain=1; if(!state || !h || h->legacy || AdrenoHfiStartupValidateServices(s)!=AdrenoHfiStartupSuccess || AdrenoHfiStartupValidate(c)!=AdrenoHfiStartupSuccess)return AdrenoHfiStartupInvalid; if(state->poisoned || h->poisoned)return AdrenoHfiStartupPoisoned; if(state->attempted || state->completed || h->pending_header)return AdrenoHfiStartupBusy; uint64_t begin,last,command; if(s->now_us(s->cookie,&begin))return AdrenoHfiStartupClockError; last=begin; if(s->check_health(s->cookie))return AdrenoHfiStartupPlatformFault; state->attempted=1; AdrenoHfiStartupStatus status=AdrenoHfiStartupSuccess; uint32_t payload[159],output[16],id;size_t words,returned; for(unsigned step=AdrenoHfiStagePerformance;step<=AdrenoHfiStageStart;++step) { if((step==AdrenoHfiStageAcdEnable || step==AdrenoHfiStageAcdTable) && !c->acd_enable_mask)continue; if(step==AdrenoHfiStageIfpc && !c->enable_ifpc)continue; r->stage=(AdrenoHfiStartupStage)step;command=last; status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} status=AdrenoHfiStartupEncode(c,r->stage,&id,payload,159,&words);if(status)goto failed; r->wire_header=0; r->transport_status=AdrenoHfiSend(h,id,payload,words,&r->wire_header); if(r->wire_header)++r->published_commands; if(r->transport_status!=AdrenoHfiSuccess) {status=AdrenoHfiStartupTransportError;goto failed;} --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:116 [MATCH: AdrenoHfiStartup] --- if(now-begin>=s->total_timeout_us || now-command>=s->command_timeout_us)return AdrenoHfiStartupTimeout; return AdrenoHfiStartupSuccess; } AdrenoHfiStartupStatus AdrenoHfiStartupRun(AdrenoHfiStartup *state,AdrenoHfi *h, const AdrenoHfiStartupConfig *c,const AdrenoHfiStartupServices *s,AdrenoHfiStartupResult *r) { if(!r)return AdrenoHfiStartupInvalid; *r=(AdrenoHfiStartupResult){0};r->resources_must_retain=1; if(!state || !h || h->legacy || AdrenoHfiStartupValidateServices(s)!=AdrenoHfiStartupSuccess || AdrenoHfiStartupValidate(c)!=AdrenoHfiStartupSuccess)return AdrenoHfiStartupInvalid; if(state->poisoned || h->poisoned)return AdrenoHfiStartupPoisoned; if(state->attempted || state->completed || h->pending_header)return AdrenoHfiStartupBusy; uint64_t begin,last,command; if(s->now_us(s->cookie,&begin))return AdrenoHfiStartupClockError; last=begin; if(s->check_health(s->cookie))return AdrenoHfiStartupPlatformFault; state->attempted=1; AdrenoHfiStartupStatus status=AdrenoHfiStartupSuccess; uint32_t payload[159],output[16],id;size_t words,returned; for(unsigned step=AdrenoHfiStagePerformance;step<=AdrenoHfiStageStart;++step) { if((step==AdrenoHfiStageAcdEnable || step==AdrenoHfiStageAcdTable) && !c->acd_enable_mask)continue; if(step==AdrenoHfiStageIfpc && !c->enable_ifpc)continue; r->stage=(AdrenoHfiStartupStage)step;command=last; status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} status=AdrenoHfiStartupEncode(c,r->stage,&id,payload,159,&words);if(status)goto failed; r->wire_header=0; r->transport_status=AdrenoHfiSend(h,id,payload,words,&r->wire_header); if(r->wire_header)++r->published_commands; if(r->transport_status!=AdrenoHfiSuccess) {status=AdrenoHfiStartupTransportError;goto failed;} unsigned acknowledged=0; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:117 [MATCH: AdrenoHfiStartup] --- return AdrenoHfiStartupSuccess; } AdrenoHfiStartupStatus AdrenoHfiStartupRun(AdrenoHfiStartup *state,AdrenoHfi *h, const AdrenoHfiStartupConfig *c,const AdrenoHfiStartupServices *s,AdrenoHfiStartupResult *r) { if(!r)return AdrenoHfiStartupInvalid; *r=(AdrenoHfiStartupResult){0};r->resources_must_retain=1; if(!state || !h || h->legacy || AdrenoHfiStartupValidateServices(s)!=AdrenoHfiStartupSuccess || AdrenoHfiStartupValidate(c)!=AdrenoHfiStartupSuccess)return AdrenoHfiStartupInvalid; if(state->poisoned || h->poisoned)return AdrenoHfiStartupPoisoned; if(state->attempted || state->completed || h->pending_header)return AdrenoHfiStartupBusy; uint64_t begin,last,command; if(s->now_us(s->cookie,&begin))return AdrenoHfiStartupClockError; last=begin; if(s->check_health(s->cookie))return AdrenoHfiStartupPlatformFault; state->attempted=1; AdrenoHfiStartupStatus status=AdrenoHfiStartupSuccess; uint32_t payload[159],output[16],id;size_t words,returned; for(unsigned step=AdrenoHfiStagePerformance;step<=AdrenoHfiStageStart;++step) { if((step==AdrenoHfiStageAcdEnable || step==AdrenoHfiStageAcdTable) && !c->acd_enable_mask)continue; if(step==AdrenoHfiStageIfpc && !c->enable_ifpc)continue; r->stage=(AdrenoHfiStartupStage)step;command=last; status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} status=AdrenoHfiStartupEncode(c,r->stage,&id,payload,159,&words);if(status)goto failed; r->wire_header=0; r->transport_status=AdrenoHfiSend(h,id,payload,words,&r->wire_header); if(r->wire_header)++r->published_commands; if(r->transport_status!=AdrenoHfiSuccess) {status=AdrenoHfiStartupTransportError;goto failed;} unsigned acknowledged=0; for(unsigned i=0;ipolls_per_command;++i) { --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:119 [MATCH: AdrenoHfiStartup] --- AdrenoHfiStartupStatus AdrenoHfiStartupRun(AdrenoHfiStartup *state,AdrenoHfi *h, const AdrenoHfiStartupConfig *c,const AdrenoHfiStartupServices *s,AdrenoHfiStartupResult *r) { if(!r)return AdrenoHfiStartupInvalid; *r=(AdrenoHfiStartupResult){0};r->resources_must_retain=1; if(!state || !h || h->legacy || AdrenoHfiStartupValidateServices(s)!=AdrenoHfiStartupSuccess || AdrenoHfiStartupValidate(c)!=AdrenoHfiStartupSuccess)return AdrenoHfiStartupInvalid; if(state->poisoned || h->poisoned)return AdrenoHfiStartupPoisoned; if(state->attempted || state->completed || h->pending_header)return AdrenoHfiStartupBusy; uint64_t begin,last,command; if(s->now_us(s->cookie,&begin))return AdrenoHfiStartupClockError; last=begin; if(s->check_health(s->cookie))return AdrenoHfiStartupPlatformFault; state->attempted=1; AdrenoHfiStartupStatus status=AdrenoHfiStartupSuccess; uint32_t payload[159],output[16],id;size_t words,returned; for(unsigned step=AdrenoHfiStagePerformance;step<=AdrenoHfiStageStart;++step) { if((step==AdrenoHfiStageAcdEnable || step==AdrenoHfiStageAcdTable) && !c->acd_enable_mask)continue; if(step==AdrenoHfiStageIfpc && !c->enable_ifpc)continue; r->stage=(AdrenoHfiStartupStage)step;command=last; status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} status=AdrenoHfiStartupEncode(c,r->stage,&id,payload,159,&words);if(status)goto failed; r->wire_header=0; r->transport_status=AdrenoHfiSend(h,id,payload,words,&r->wire_header); if(r->wire_header)++r->published_commands; if(r->transport_status!=AdrenoHfiSuccess) {status=AdrenoHfiStartupTransportError;goto failed;} unsigned acknowledged=0; for(unsigned i=0;ipolls_per_command;++i) { status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:121 [MATCH: AdrenoHfiStartup] --- { if(!r)return AdrenoHfiStartupInvalid; *r=(AdrenoHfiStartupResult){0};r->resources_must_retain=1; if(!state || !h || h->legacy || AdrenoHfiStartupValidateServices(s)!=AdrenoHfiStartupSuccess || AdrenoHfiStartupValidate(c)!=AdrenoHfiStartupSuccess)return AdrenoHfiStartupInvalid; if(state->poisoned || h->poisoned)return AdrenoHfiStartupPoisoned; if(state->attempted || state->completed || h->pending_header)return AdrenoHfiStartupBusy; uint64_t begin,last,command; if(s->now_us(s->cookie,&begin))return AdrenoHfiStartupClockError; last=begin; if(s->check_health(s->cookie))return AdrenoHfiStartupPlatformFault; state->attempted=1; AdrenoHfiStartupStatus status=AdrenoHfiStartupSuccess; uint32_t payload[159],output[16],id;size_t words,returned; for(unsigned step=AdrenoHfiStagePerformance;step<=AdrenoHfiStageStart;++step) { if((step==AdrenoHfiStageAcdEnable || step==AdrenoHfiStageAcdTable) && !c->acd_enable_mask)continue; if(step==AdrenoHfiStageIfpc && !c->enable_ifpc)continue; r->stage=(AdrenoHfiStartupStage)step;command=last; status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} status=AdrenoHfiStartupEncode(c,r->stage,&id,payload,159,&words);if(status)goto failed; r->wire_header=0; r->transport_status=AdrenoHfiSend(h,id,payload,words,&r->wire_header); if(r->wire_header)++r->published_commands; if(r->transport_status!=AdrenoHfiSuccess) {status=AdrenoHfiStartupTransportError;goto failed;} unsigned acknowledged=0; for(unsigned i=0;ipolls_per_command;++i) { status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} ++r->poll_reads; r->transport_status=AdrenoHfiPoll(h,output,16,&returned,&r->firmware_error); --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:123 [MATCH: AdrenoHfiStartup] --- *r=(AdrenoHfiStartupResult){0};r->resources_must_retain=1; if(!state || !h || h->legacy || AdrenoHfiStartupValidateServices(s)!=AdrenoHfiStartupSuccess || AdrenoHfiStartupValidate(c)!=AdrenoHfiStartupSuccess)return AdrenoHfiStartupInvalid; if(state->poisoned || h->poisoned)return AdrenoHfiStartupPoisoned; if(state->attempted || state->completed || h->pending_header)return AdrenoHfiStartupBusy; uint64_t begin,last,command; if(s->now_us(s->cookie,&begin))return AdrenoHfiStartupClockError; last=begin; if(s->check_health(s->cookie))return AdrenoHfiStartupPlatformFault; state->attempted=1; AdrenoHfiStartupStatus status=AdrenoHfiStartupSuccess; uint32_t payload[159],output[16],id;size_t words,returned; for(unsigned step=AdrenoHfiStagePerformance;step<=AdrenoHfiStageStart;++step) { if((step==AdrenoHfiStageAcdEnable || step==AdrenoHfiStageAcdTable) && !c->acd_enable_mask)continue; if(step==AdrenoHfiStageIfpc && !c->enable_ifpc)continue; r->stage=(AdrenoHfiStartupStage)step;command=last; status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} status=AdrenoHfiStartupEncode(c,r->stage,&id,payload,159,&words);if(status)goto failed; r->wire_header=0; r->transport_status=AdrenoHfiSend(h,id,payload,words,&r->wire_header); if(r->wire_header)++r->published_commands; if(r->transport_status!=AdrenoHfiSuccess) {status=AdrenoHfiStartupTransportError;goto failed;} unsigned acknowledged=0; for(unsigned i=0;ipolls_per_command;++i) { status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} ++r->poll_reads; r->transport_status=AdrenoHfiPoll(h,output,16,&returned,&r->firmware_error); if(r->transport_status==AdrenoHfiSuccess) { status=clock_check(s,begin,command,&last,r);if(status)goto failed; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:128 [MATCH: AdrenoHfiStartup] --- uint64_t begin,last,command; if(s->now_us(s->cookie,&begin))return AdrenoHfiStartupClockError; last=begin; if(s->check_health(s->cookie))return AdrenoHfiStartupPlatformFault; state->attempted=1; AdrenoHfiStartupStatus status=AdrenoHfiStartupSuccess; uint32_t payload[159],output[16],id;size_t words,returned; for(unsigned step=AdrenoHfiStagePerformance;step<=AdrenoHfiStageStart;++step) { if((step==AdrenoHfiStageAcdEnable || step==AdrenoHfiStageAcdTable) && !c->acd_enable_mask)continue; if(step==AdrenoHfiStageIfpc && !c->enable_ifpc)continue; r->stage=(AdrenoHfiStartupStage)step;command=last; status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} status=AdrenoHfiStartupEncode(c,r->stage,&id,payload,159,&words);if(status)goto failed; r->wire_header=0; r->transport_status=AdrenoHfiSend(h,id,payload,words,&r->wire_header); if(r->wire_header)++r->published_commands; if(r->transport_status!=AdrenoHfiSuccess) {status=AdrenoHfiStartupTransportError;goto failed;} unsigned acknowledged=0; for(unsigned i=0;ipolls_per_command;++i) { status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} ++r->poll_reads; r->transport_status=AdrenoHfiPoll(h,output,16,&returned,&r->firmware_error); if(r->transport_status==AdrenoHfiSuccess) { status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} r->acknowledged_stages|=1u<transport_status!=AdrenoHfiEmpty) {status=AdrenoHfiStartupTransportError;goto failed;} if(i+1polls_per_command && s->wait_us(s->cookie,s->wait_interval_us)) { --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:130 [MATCH: AdrenoHfiStartup] --- last=begin; if(s->check_health(s->cookie))return AdrenoHfiStartupPlatformFault; state->attempted=1; AdrenoHfiStartupStatus status=AdrenoHfiStartupSuccess; uint32_t payload[159],output[16],id;size_t words,returned; for(unsigned step=AdrenoHfiStagePerformance;step<=AdrenoHfiStageStart;++step) { if((step==AdrenoHfiStageAcdEnable || step==AdrenoHfiStageAcdTable) && !c->acd_enable_mask)continue; if(step==AdrenoHfiStageIfpc && !c->enable_ifpc)continue; r->stage=(AdrenoHfiStartupStage)step;command=last; status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} status=AdrenoHfiStartupEncode(c,r->stage,&id,payload,159,&words);if(status)goto failed; r->wire_header=0; r->transport_status=AdrenoHfiSend(h,id,payload,words,&r->wire_header); if(r->wire_header)++r->published_commands; if(r->transport_status!=AdrenoHfiSuccess) {status=AdrenoHfiStartupTransportError;goto failed;} unsigned acknowledged=0; for(unsigned i=0;ipolls_per_command;++i) { status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} ++r->poll_reads; r->transport_status=AdrenoHfiPoll(h,output,16,&returned,&r->firmware_error); if(r->transport_status==AdrenoHfiSuccess) { status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} r->acknowledged_stages|=1u<transport_status!=AdrenoHfiEmpty) {status=AdrenoHfiStartupTransportError;goto failed;} if(i+1polls_per_command && s->wait_us(s->cookie,s->wait_interval_us)) { status=AdrenoHfiStartupWaitError;goto failed; } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:131 [MATCH: AdrenoHfiStartup] --- if(s->check_health(s->cookie))return AdrenoHfiStartupPlatformFault; state->attempted=1; AdrenoHfiStartupStatus status=AdrenoHfiStartupSuccess; uint32_t payload[159],output[16],id;size_t words,returned; for(unsigned step=AdrenoHfiStagePerformance;step<=AdrenoHfiStageStart;++step) { if((step==AdrenoHfiStageAcdEnable || step==AdrenoHfiStageAcdTable) && !c->acd_enable_mask)continue; if(step==AdrenoHfiStageIfpc && !c->enable_ifpc)continue; r->stage=(AdrenoHfiStartupStage)step;command=last; status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} status=AdrenoHfiStartupEncode(c,r->stage,&id,payload,159,&words);if(status)goto failed; r->wire_header=0; r->transport_status=AdrenoHfiSend(h,id,payload,words,&r->wire_header); if(r->wire_header)++r->published_commands; if(r->transport_status!=AdrenoHfiSuccess) {status=AdrenoHfiStartupTransportError;goto failed;} unsigned acknowledged=0; for(unsigned i=0;ipolls_per_command;++i) { status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} ++r->poll_reads; r->transport_status=AdrenoHfiPoll(h,output,16,&returned,&r->firmware_error); if(r->transport_status==AdrenoHfiSuccess) { status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} r->acknowledged_stages|=1u<transport_status!=AdrenoHfiEmpty) {status=AdrenoHfiStartupTransportError;goto failed;} if(i+1polls_per_command && s->wait_us(s->cookie,s->wait_interval_us)) { status=AdrenoHfiStartupWaitError;goto failed; } } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:135 [MATCH: AdrenoHfiStartup] --- for(unsigned step=AdrenoHfiStagePerformance;step<=AdrenoHfiStageStart;++step) { if((step==AdrenoHfiStageAcdEnable || step==AdrenoHfiStageAcdTable) && !c->acd_enable_mask)continue; if(step==AdrenoHfiStageIfpc && !c->enable_ifpc)continue; r->stage=(AdrenoHfiStartupStage)step;command=last; status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} status=AdrenoHfiStartupEncode(c,r->stage,&id,payload,159,&words);if(status)goto failed; r->wire_header=0; r->transport_status=AdrenoHfiSend(h,id,payload,words,&r->wire_header); if(r->wire_header)++r->published_commands; if(r->transport_status!=AdrenoHfiSuccess) {status=AdrenoHfiStartupTransportError;goto failed;} unsigned acknowledged=0; for(unsigned i=0;ipolls_per_command;++i) { status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} ++r->poll_reads; r->transport_status=AdrenoHfiPoll(h,output,16,&returned,&r->firmware_error); if(r->transport_status==AdrenoHfiSuccess) { status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} r->acknowledged_stages|=1u<transport_status!=AdrenoHfiEmpty) {status=AdrenoHfiStartupTransportError;goto failed;} if(i+1polls_per_command && s->wait_us(s->cookie,s->wait_interval_us)) { status=AdrenoHfiStartupWaitError;goto failed; } } if(!acknowledged) {status=AdrenoHfiStartupTimeout;goto failed;} } state->completed=1;r->stage=AdrenoHfiStageComplete;return AdrenoHfiStartupSuccess; failed: --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:139 [MATCH: AdrenoHfiStartup] --- status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} status=AdrenoHfiStartupEncode(c,r->stage,&id,payload,159,&words);if(status)goto failed; r->wire_header=0; r->transport_status=AdrenoHfiSend(h,id,payload,words,&r->wire_header); if(r->wire_header)++r->published_commands; if(r->transport_status!=AdrenoHfiSuccess) {status=AdrenoHfiStartupTransportError;goto failed;} unsigned acknowledged=0; for(unsigned i=0;ipolls_per_command;++i) { status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} ++r->poll_reads; r->transport_status=AdrenoHfiPoll(h,output,16,&returned,&r->firmware_error); if(r->transport_status==AdrenoHfiSuccess) { status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} r->acknowledged_stages|=1u<transport_status!=AdrenoHfiEmpty) {status=AdrenoHfiStartupTransportError;goto failed;} if(i+1polls_per_command && s->wait_us(s->cookie,s->wait_interval_us)) { status=AdrenoHfiStartupWaitError;goto failed; } } if(!acknowledged) {status=AdrenoHfiStartupTimeout;goto failed;} } state->completed=1;r->stage=AdrenoHfiStageComplete;return AdrenoHfiStartupSuccess; failed: state->poisoned=1;h->poisoned=1;return status; } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:144 [MATCH: AdrenoHfiStartup] --- if(r->wire_header)++r->published_commands; if(r->transport_status!=AdrenoHfiSuccess) {status=AdrenoHfiStartupTransportError;goto failed;} unsigned acknowledged=0; for(unsigned i=0;ipolls_per_command;++i) { status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} ++r->poll_reads; r->transport_status=AdrenoHfiPoll(h,output,16,&returned,&r->firmware_error); if(r->transport_status==AdrenoHfiSuccess) { status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} r->acknowledged_stages|=1u<transport_status!=AdrenoHfiEmpty) {status=AdrenoHfiStartupTransportError;goto failed;} if(i+1polls_per_command && s->wait_us(s->cookie,s->wait_interval_us)) { status=AdrenoHfiStartupWaitError;goto failed; } } if(!acknowledged) {status=AdrenoHfiStartupTimeout;goto failed;} } state->completed=1;r->stage=AdrenoHfiStageComplete;return AdrenoHfiStartupSuccess; failed: state->poisoned=1;h->poisoned=1;return status; } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:147 [MATCH: AdrenoHfiStartup] --- for(unsigned i=0;ipolls_per_command;++i) { status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} ++r->poll_reads; r->transport_status=AdrenoHfiPoll(h,output,16,&returned,&r->firmware_error); if(r->transport_status==AdrenoHfiSuccess) { status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} r->acknowledged_stages|=1u<transport_status!=AdrenoHfiEmpty) {status=AdrenoHfiStartupTransportError;goto failed;} if(i+1polls_per_command && s->wait_us(s->cookie,s->wait_interval_us)) { status=AdrenoHfiStartupWaitError;goto failed; } } if(!acknowledged) {status=AdrenoHfiStartupTimeout;goto failed;} } state->completed=1;r->stage=AdrenoHfiStageComplete;return AdrenoHfiStartupSuccess; failed: state->poisoned=1;h->poisoned=1;return status; } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:149 [MATCH: AdrenoHfiStartup] --- if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} ++r->poll_reads; r->transport_status=AdrenoHfiPoll(h,output,16,&returned,&r->firmware_error); if(r->transport_status==AdrenoHfiSuccess) { status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} r->acknowledged_stages|=1u<transport_status!=AdrenoHfiEmpty) {status=AdrenoHfiStartupTransportError;goto failed;} if(i+1polls_per_command && s->wait_us(s->cookie,s->wait_interval_us)) { status=AdrenoHfiStartupWaitError;goto failed; } } if(!acknowledged) {status=AdrenoHfiStartupTimeout;goto failed;} } state->completed=1;r->stage=AdrenoHfiStageComplete;return AdrenoHfiStartupSuccess; failed: state->poisoned=1;h->poisoned=1;return status; } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:152 [MATCH: AdrenoHfiStartup] --- if(r->transport_status==AdrenoHfiSuccess) { status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} r->acknowledged_stages|=1u<transport_status!=AdrenoHfiEmpty) {status=AdrenoHfiStartupTransportError;goto failed;} if(i+1polls_per_command && s->wait_us(s->cookie,s->wait_interval_us)) { status=AdrenoHfiStartupWaitError;goto failed; } } if(!acknowledged) {status=AdrenoHfiStartupTimeout;goto failed;} } state->completed=1;r->stage=AdrenoHfiStageComplete;return AdrenoHfiStartupSuccess; failed: state->poisoned=1;h->poisoned=1;return status; } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:154 [MATCH: AdrenoHfiStartup] --- if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} r->acknowledged_stages|=1u<transport_status!=AdrenoHfiEmpty) {status=AdrenoHfiStartupTransportError;goto failed;} if(i+1polls_per_command && s->wait_us(s->cookie,s->wait_interval_us)) { status=AdrenoHfiStartupWaitError;goto failed; } } if(!acknowledged) {status=AdrenoHfiStartupTimeout;goto failed;} } state->completed=1;r->stage=AdrenoHfiStageComplete;return AdrenoHfiStartupSuccess; failed: state->poisoned=1;h->poisoned=1;return status; } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:141 [MATCH: AdrenoHfiPoll] --- status=AdrenoHfiStartupEncode(c,r->stage,&id,payload,159,&words);if(status)goto failed; r->wire_header=0; r->transport_status=AdrenoHfiSend(h,id,payload,words,&r->wire_header); if(r->wire_header)++r->published_commands; if(r->transport_status!=AdrenoHfiSuccess) {status=AdrenoHfiStartupTransportError;goto failed;} unsigned acknowledged=0; for(unsigned i=0;ipolls_per_command;++i) { status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} ++r->poll_reads; r->transport_status=AdrenoHfiPoll(h,output,16,&returned,&r->firmware_error); if(r->transport_status==AdrenoHfiSuccess) { status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} r->acknowledged_stages|=1u<transport_status!=AdrenoHfiEmpty) {status=AdrenoHfiStartupTransportError;goto failed;} if(i+1polls_per_command && s->wait_us(s->cookie,s->wait_interval_us)) { status=AdrenoHfiStartupWaitError;goto failed; } } if(!acknowledged) {status=AdrenoHfiStartupTimeout;goto failed;} } state->completed=1;r->stage=AdrenoHfiStageComplete;return AdrenoHfiStartupSuccess; failed: state->poisoned=1;h->poisoned=1;return status; } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:133 [MATCH: AdrenoHfiSend] --- AdrenoHfiStartupStatus status=AdrenoHfiStartupSuccess; uint32_t payload[159],output[16],id;size_t words,returned; for(unsigned step=AdrenoHfiStagePerformance;step<=AdrenoHfiStageStart;++step) { if((step==AdrenoHfiStageAcdEnable || step==AdrenoHfiStageAcdTable) && !c->acd_enable_mask)continue; if(step==AdrenoHfiStageIfpc && !c->enable_ifpc)continue; r->stage=(AdrenoHfiStartupStage)step;command=last; status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} status=AdrenoHfiStartupEncode(c,r->stage,&id,payload,159,&words);if(status)goto failed; r->wire_header=0; r->transport_status=AdrenoHfiSend(h,id,payload,words,&r->wire_header); if(r->wire_header)++r->published_commands; if(r->transport_status!=AdrenoHfiSuccess) {status=AdrenoHfiStartupTransportError;goto failed;} unsigned acknowledged=0; for(unsigned i=0;ipolls_per_command;++i) { status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} ++r->poll_reads; r->transport_status=AdrenoHfiPoll(h,output,16,&returned,&r->firmware_error); if(r->transport_status==AdrenoHfiSuccess) { status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} r->acknowledged_stages|=1u<transport_status!=AdrenoHfiEmpty) {status=AdrenoHfiStartupTransportError;goto failed;} if(i+1polls_per_command && s->wait_us(s->cookie,s->wait_interval_us)) { status=AdrenoHfiStartupWaitError;goto failed; } } if(!acknowledged) {status=AdrenoHfiStartupTimeout;goto failed;} } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:95 [MATCH: timeout] --- case AdrenoHfiStageStart:message=10;n=0;break; default:return AdrenoHfiStartupInvalid; } *id=message;*count=n;return AdrenoHfiStartupSuccess; } AdrenoHfiStartupStatus AdrenoHfiStartupValidateServices(const AdrenoHfiStartupServices *s) { if(!s || !s->now_us || !s->wait_us || !s->check_health || !s->polls_per_command || s->polls_per_command>1048576 || !s->wait_interval_us || s->wait_interval_us>1000000 || !s->command_timeout_us || s->command_timeout_us>10000000 || s->total_timeout_uscommand_timeout_us || s->total_timeout_us>60000000) return AdrenoHfiStartupInvalid; return AdrenoHfiStartupSuccess; } static AdrenoHfiStartupStatus clock_check(const AdrenoHfiStartupServices *s, uint64_t begin,uint64_t command,uint64_t *last,AdrenoHfiStartupResult *r) { uint64_t now; if(s->now_us(s->cookie,&now) || now<*last)return AdrenoHfiStartupClockError; *last=now;r->elapsed_us=now-begin; if(now-begin>=s->total_timeout_us || now-command>=s->command_timeout_us)return AdrenoHfiStartupTimeout; return AdrenoHfiStartupSuccess; } AdrenoHfiStartupStatus AdrenoHfiStartupRun(AdrenoHfiStartup *state,AdrenoHfi *h, const AdrenoHfiStartupConfig *c,const AdrenoHfiStartupServices *s,AdrenoHfiStartupResult *r) { if(!r)return AdrenoHfiStartupInvalid; *r=(AdrenoHfiStartupResult){0};r->resources_must_retain=1; if(!state || !h || h->legacy || AdrenoHfiStartupValidateServices(s)!=AdrenoHfiStartupSuccess || AdrenoHfiStartupValidate(c)!=AdrenoHfiStartupSuccess)return AdrenoHfiStartupInvalid; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:96 [MATCH: timeout] --- default:return AdrenoHfiStartupInvalid; } *id=message;*count=n;return AdrenoHfiStartupSuccess; } AdrenoHfiStartupStatus AdrenoHfiStartupValidateServices(const AdrenoHfiStartupServices *s) { if(!s || !s->now_us || !s->wait_us || !s->check_health || !s->polls_per_command || s->polls_per_command>1048576 || !s->wait_interval_us || s->wait_interval_us>1000000 || !s->command_timeout_us || s->command_timeout_us>10000000 || s->total_timeout_uscommand_timeout_us || s->total_timeout_us>60000000) return AdrenoHfiStartupInvalid; return AdrenoHfiStartupSuccess; } static AdrenoHfiStartupStatus clock_check(const AdrenoHfiStartupServices *s, uint64_t begin,uint64_t command,uint64_t *last,AdrenoHfiStartupResult *r) { uint64_t now; if(s->now_us(s->cookie,&now) || now<*last)return AdrenoHfiStartupClockError; *last=now;r->elapsed_us=now-begin; if(now-begin>=s->total_timeout_us || now-command>=s->command_timeout_us)return AdrenoHfiStartupTimeout; return AdrenoHfiStartupSuccess; } AdrenoHfiStartupStatus AdrenoHfiStartupRun(AdrenoHfiStartup *state,AdrenoHfi *h, const AdrenoHfiStartupConfig *c,const AdrenoHfiStartupServices *s,AdrenoHfiStartupResult *r) { if(!r)return AdrenoHfiStartupInvalid; *r=(AdrenoHfiStartupResult){0};r->resources_must_retain=1; if(!state || !h || h->legacy || AdrenoHfiStartupValidateServices(s)!=AdrenoHfiStartupSuccess || AdrenoHfiStartupValidate(c)!=AdrenoHfiStartupSuccess)return AdrenoHfiStartupInvalid; if(state->poisoned || h->poisoned)return AdrenoHfiStartupPoisoned; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:136 [MATCH: ACK] --- if((step==AdrenoHfiStageAcdEnable || step==AdrenoHfiStageAcdTable) && !c->acd_enable_mask)continue; if(step==AdrenoHfiStageIfpc && !c->enable_ifpc)continue; r->stage=(AdrenoHfiStartupStage)step;command=last; status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} status=AdrenoHfiStartupEncode(c,r->stage,&id,payload,159,&words);if(status)goto failed; r->wire_header=0; r->transport_status=AdrenoHfiSend(h,id,payload,words,&r->wire_header); if(r->wire_header)++r->published_commands; if(r->transport_status!=AdrenoHfiSuccess) {status=AdrenoHfiStartupTransportError;goto failed;} unsigned acknowledged=0; for(unsigned i=0;ipolls_per_command;++i) { status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} ++r->poll_reads; r->transport_status=AdrenoHfiPoll(h,output,16,&returned,&r->firmware_error); if(r->transport_status==AdrenoHfiSuccess) { status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} r->acknowledged_stages|=1u<transport_status!=AdrenoHfiEmpty) {status=AdrenoHfiStartupTransportError;goto failed;} if(i+1polls_per_command && s->wait_us(s->cookie,s->wait_interval_us)) { status=AdrenoHfiStartupWaitError;goto failed; } } if(!acknowledged) {status=AdrenoHfiStartupTimeout;goto failed;} } state->completed=1;r->stage=AdrenoHfiStageComplete;return AdrenoHfiStartupSuccess; failed: state->poisoned=1;h->poisoned=1;return status; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c:145 [MATCH: ACK] --- if(r->transport_status!=AdrenoHfiSuccess) {status=AdrenoHfiStartupTransportError;goto failed;} unsigned acknowledged=0; for(unsigned i=0;ipolls_per_command;++i) { status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} ++r->poll_reads; r->transport_status=AdrenoHfiPoll(h,output,16,&returned,&r->firmware_error); if(r->transport_status==AdrenoHfiSuccess) { status=clock_check(s,begin,command,&last,r);if(status)goto failed; if(s->check_health(s->cookie)) {status=AdrenoHfiStartupPlatformFault;goto failed;} r->acknowledged_stages|=1u<transport_status!=AdrenoHfiEmpty) {status=AdrenoHfiStartupTransportError;goto failed;} if(i+1polls_per_command && s->wait_us(s->cookie,s->wait_interval_us)) { status=AdrenoHfiStartupWaitError;goto failed; } } if(!acknowledged) {status=AdrenoHfiStartupTimeout;goto failed;} } state->completed=1;r->stage=AdrenoHfiStageComplete;return AdrenoHfiStartupSuccess; failed: state->poisoned=1;h->poisoned=1;return status; } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.h:19 [MATCH: AdrenoHfiStartup] --- typedef struct {uint64_t hz;uint32_t vote;} AdrenoHfiPerformanceLevel; typedef struct { unsigned gpu_count,gmu_count; AdrenoHfiPerformanceLevel gpu[16],gmu[4]; unsigned bandwidth_count,cnoc_count,ddr_count; uint32_t cnoc_wait_mask,ddr_wait_mask; uint32_t cnoc_addresses[6],cnoc_data[2][6]; uint32_t ddr_addresses[8],ddr_data[16][8]; uint32_t acd_version,acd_enable_mask,acd_stride,acd_count,acd_data[32]; unsigned enable_ifpc; } AdrenoHfiStartupConfig; typedef enum { AdrenoHfiStageNone,AdrenoHfiStagePerformance,AdrenoHfiStageBandwidth, AdrenoHfiStageAcdEnable,AdrenoHfiStageAcdTable,AdrenoHfiStageIfpc, AdrenoHfiStageCoreStart,AdrenoHfiStageStart,AdrenoHfiStageComplete } AdrenoHfiStartupStage; typedef enum { AdrenoHfiStartupSuccess,AdrenoHfiStartupInvalid,AdrenoHfiStartupBusy, AdrenoHfiStartupPoisoned,AdrenoHfiStartupClockError,AdrenoHfiStartupWaitError, AdrenoHfiStartupTimeout,AdrenoHfiStartupPlatformFault,AdrenoHfiStartupTransportError } AdrenoHfiStartupStatus; typedef struct { void *cookie; int (*now_us)(void *,uint64_t *); int (*wait_us)(void *,unsigned); int (*check_health)(void *); /* real platform fault/ownership checks */ unsigned polls_per_command,wait_interval_us; uint64_t command_timeout_us,total_timeout_us; } AdrenoHfiStartupServices; typedef struct {unsigned attempted,poisoned,completed;} AdrenoHfiStartup; typedef struct { --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.h:24 [MATCH: AdrenoHfiStartup] --- uint32_t cnoc_wait_mask,ddr_wait_mask; uint32_t cnoc_addresses[6],cnoc_data[2][6]; uint32_t ddr_addresses[8],ddr_data[16][8]; uint32_t acd_version,acd_enable_mask,acd_stride,acd_count,acd_data[32]; unsigned enable_ifpc; } AdrenoHfiStartupConfig; typedef enum { AdrenoHfiStageNone,AdrenoHfiStagePerformance,AdrenoHfiStageBandwidth, AdrenoHfiStageAcdEnable,AdrenoHfiStageAcdTable,AdrenoHfiStageIfpc, AdrenoHfiStageCoreStart,AdrenoHfiStageStart,AdrenoHfiStageComplete } AdrenoHfiStartupStage; typedef enum { AdrenoHfiStartupSuccess,AdrenoHfiStartupInvalid,AdrenoHfiStartupBusy, AdrenoHfiStartupPoisoned,AdrenoHfiStartupClockError,AdrenoHfiStartupWaitError, AdrenoHfiStartupTimeout,AdrenoHfiStartupPlatformFault,AdrenoHfiStartupTransportError } AdrenoHfiStartupStatus; typedef struct { void *cookie; int (*now_us)(void *,uint64_t *); int (*wait_us)(void *,unsigned); int (*check_health)(void *); /* real platform fault/ownership checks */ unsigned polls_per_command,wait_interval_us; uint64_t command_timeout_us,total_timeout_us; } AdrenoHfiStartupServices; typedef struct {unsigned attempted,poisoned,completed;} AdrenoHfiStartup; typedef struct { AdrenoHfiStartupStage stage; AdrenoHfiStatus transport_status; uint32_t firmware_error,wire_header,acknowledged_stages; unsigned published_commands,poll_reads,resources_must_retain; uint64_t elapsed_us; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.h:26 [MATCH: AdrenoHfiStartup] --- uint32_t ddr_addresses[8],ddr_data[16][8]; uint32_t acd_version,acd_enable_mask,acd_stride,acd_count,acd_data[32]; unsigned enable_ifpc; } AdrenoHfiStartupConfig; typedef enum { AdrenoHfiStageNone,AdrenoHfiStagePerformance,AdrenoHfiStageBandwidth, AdrenoHfiStageAcdEnable,AdrenoHfiStageAcdTable,AdrenoHfiStageIfpc, AdrenoHfiStageCoreStart,AdrenoHfiStageStart,AdrenoHfiStageComplete } AdrenoHfiStartupStage; typedef enum { AdrenoHfiStartupSuccess,AdrenoHfiStartupInvalid,AdrenoHfiStartupBusy, AdrenoHfiStartupPoisoned,AdrenoHfiStartupClockError,AdrenoHfiStartupWaitError, AdrenoHfiStartupTimeout,AdrenoHfiStartupPlatformFault,AdrenoHfiStartupTransportError } AdrenoHfiStartupStatus; typedef struct { void *cookie; int (*now_us)(void *,uint64_t *); int (*wait_us)(void *,unsigned); int (*check_health)(void *); /* real platform fault/ownership checks */ unsigned polls_per_command,wait_interval_us; uint64_t command_timeout_us,total_timeout_us; } AdrenoHfiStartupServices; typedef struct {unsigned attempted,poisoned,completed;} AdrenoHfiStartup; typedef struct { AdrenoHfiStartupStage stage; AdrenoHfiStatus transport_status; uint32_t firmware_error,wire_header,acknowledged_stages; unsigned published_commands,poll_reads,resources_must_retain; uint64_t elapsed_us; } AdrenoHfiStartupResult; /* Validate every input before any queue publication. Frequencies include the --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.h:27 [MATCH: AdrenoHfiStartup] --- uint32_t acd_version,acd_enable_mask,acd_stride,acd_count,acd_data[32]; unsigned enable_ifpc; } AdrenoHfiStartupConfig; typedef enum { AdrenoHfiStageNone,AdrenoHfiStagePerformance,AdrenoHfiStageBandwidth, AdrenoHfiStageAcdEnable,AdrenoHfiStageAcdTable,AdrenoHfiStageIfpc, AdrenoHfiStageCoreStart,AdrenoHfiStageStart,AdrenoHfiStageComplete } AdrenoHfiStartupStage; typedef enum { AdrenoHfiStartupSuccess,AdrenoHfiStartupInvalid,AdrenoHfiStartupBusy, AdrenoHfiStartupPoisoned,AdrenoHfiStartupClockError,AdrenoHfiStartupWaitError, AdrenoHfiStartupTimeout,AdrenoHfiStartupPlatformFault,AdrenoHfiStartupTransportError } AdrenoHfiStartupStatus; typedef struct { void *cookie; int (*now_us)(void *,uint64_t *); int (*wait_us)(void *,unsigned); int (*check_health)(void *); /* real platform fault/ownership checks */ unsigned polls_per_command,wait_interval_us; uint64_t command_timeout_us,total_timeout_us; } AdrenoHfiStartupServices; typedef struct {unsigned attempted,poisoned,completed;} AdrenoHfiStartup; typedef struct { AdrenoHfiStartupStage stage; AdrenoHfiStatus transport_status; uint32_t firmware_error,wire_header,acknowledged_stages; unsigned published_commands,poll_reads,resources_must_retain; uint64_t elapsed_us; } AdrenoHfiStartupResult; /* Validate every input before any queue publication. Frequencies include the * zero/off entry, are strictly ascending, exactly representable in wire kHz. --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.h:28 [MATCH: AdrenoHfiStartup] --- unsigned enable_ifpc; } AdrenoHfiStartupConfig; typedef enum { AdrenoHfiStageNone,AdrenoHfiStagePerformance,AdrenoHfiStageBandwidth, AdrenoHfiStageAcdEnable,AdrenoHfiStageAcdTable,AdrenoHfiStageIfpc, AdrenoHfiStageCoreStart,AdrenoHfiStageStart,AdrenoHfiStageComplete } AdrenoHfiStartupStage; typedef enum { AdrenoHfiStartupSuccess,AdrenoHfiStartupInvalid,AdrenoHfiStartupBusy, AdrenoHfiStartupPoisoned,AdrenoHfiStartupClockError,AdrenoHfiStartupWaitError, AdrenoHfiStartupTimeout,AdrenoHfiStartupPlatformFault,AdrenoHfiStartupTransportError } AdrenoHfiStartupStatus; typedef struct { void *cookie; int (*now_us)(void *,uint64_t *); int (*wait_us)(void *,unsigned); int (*check_health)(void *); /* real platform fault/ownership checks */ unsigned polls_per_command,wait_interval_us; uint64_t command_timeout_us,total_timeout_us; } AdrenoHfiStartupServices; typedef struct {unsigned attempted,poisoned,completed;} AdrenoHfiStartup; typedef struct { AdrenoHfiStartupStage stage; AdrenoHfiStatus transport_status; uint32_t firmware_error,wire_header,acknowledged_stages; unsigned published_commands,poll_reads,resources_must_retain; uint64_t elapsed_us; } AdrenoHfiStartupResult; /* Validate every input before any queue publication. Frequencies include the * zero/off entry, are strictly ascending, exactly representable in wire kHz. * Votes and command-db addresses are trusted platform inputs, never guessed --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.h:29 [MATCH: AdrenoHfiStartup] --- } AdrenoHfiStartupConfig; typedef enum { AdrenoHfiStageNone,AdrenoHfiStagePerformance,AdrenoHfiStageBandwidth, AdrenoHfiStageAcdEnable,AdrenoHfiStageAcdTable,AdrenoHfiStageIfpc, AdrenoHfiStageCoreStart,AdrenoHfiStageStart,AdrenoHfiStageComplete } AdrenoHfiStartupStage; typedef enum { AdrenoHfiStartupSuccess,AdrenoHfiStartupInvalid,AdrenoHfiStartupBusy, AdrenoHfiStartupPoisoned,AdrenoHfiStartupClockError,AdrenoHfiStartupWaitError, AdrenoHfiStartupTimeout,AdrenoHfiStartupPlatformFault,AdrenoHfiStartupTransportError } AdrenoHfiStartupStatus; typedef struct { void *cookie; int (*now_us)(void *,uint64_t *); int (*wait_us)(void *,unsigned); int (*check_health)(void *); /* real platform fault/ownership checks */ unsigned polls_per_command,wait_interval_us; uint64_t command_timeout_us,total_timeout_us; } AdrenoHfiStartupServices; typedef struct {unsigned attempted,poisoned,completed;} AdrenoHfiStartup; typedef struct { AdrenoHfiStartupStage stage; AdrenoHfiStatus transport_status; uint32_t firmware_error,wire_header,acknowledged_stages; unsigned published_commands,poll_reads,resources_must_retain; uint64_t elapsed_us; } AdrenoHfiStartupResult; /* Validate every input before any queue publication. Frequencies include the * zero/off entry, are strictly ascending, exactly representable in wire kHz. * Votes and command-db addresses are trusted platform inputs, never guessed * by this library. ACD entries are packed for each enabled GPU level; AOSS --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.h:37 [MATCH: AdrenoHfiStartup] --- AdrenoHfiStartupPoisoned,AdrenoHfiStartupClockError,AdrenoHfiStartupWaitError, AdrenoHfiStartupTimeout,AdrenoHfiStartupPlatformFault,AdrenoHfiStartupTransportError } AdrenoHfiStartupStatus; typedef struct { void *cookie; int (*now_us)(void *,uint64_t *); int (*wait_us)(void *,unsigned); int (*check_health)(void *); /* real platform fault/ownership checks */ unsigned polls_per_command,wait_interval_us; uint64_t command_timeout_us,total_timeout_us; } AdrenoHfiStartupServices; typedef struct {unsigned attempted,poisoned,completed;} AdrenoHfiStartup; typedef struct { AdrenoHfiStartupStage stage; AdrenoHfiStatus transport_status; uint32_t firmware_error,wire_header,acknowledged_stages; unsigned published_commands,poll_reads,resources_must_retain; uint64_t elapsed_us; } AdrenoHfiStartupResult; /* Validate every input before any queue publication. Frequencies include the * zero/off entry, are strictly ascending, exactly representable in wire kHz. * Votes and command-db addresses are trusted platform inputs, never guessed * by this library. ACD entries are packed for each enabled GPU level; AOSS * notification and IFPC power prerequisites must already be established. * Unused fixed-capacity slots must be zero. This prevents silently ignoring * unsupported or malformed configuration. No input is authenticated here. */ AdrenoHfiStartupStatus AdrenoHfiStartupValidate(const AdrenoHfiStartupConfig *); AdrenoHfiStartupStatus AdrenoHfiStartupValidateServices(const AdrenoHfiStartupServices *); /* Payload excludes header. All output storage must be disjoint from inputs. * Encodes one selected stage; unused optional stages refuse. Failure leaves * payload/header outputs untouched except word_count=0. Capacity >=159. */ --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.h:38 [MATCH: AdrenoHfiStartup] --- AdrenoHfiStartupTimeout,AdrenoHfiStartupPlatformFault,AdrenoHfiStartupTransportError } AdrenoHfiStartupStatus; typedef struct { void *cookie; int (*now_us)(void *,uint64_t *); int (*wait_us)(void *,unsigned); int (*check_health)(void *); /* real platform fault/ownership checks */ unsigned polls_per_command,wait_interval_us; uint64_t command_timeout_us,total_timeout_us; } AdrenoHfiStartupServices; typedef struct {unsigned attempted,poisoned,completed;} AdrenoHfiStartup; typedef struct { AdrenoHfiStartupStage stage; AdrenoHfiStatus transport_status; uint32_t firmware_error,wire_header,acknowledged_stages; unsigned published_commands,poll_reads,resources_must_retain; uint64_t elapsed_us; } AdrenoHfiStartupResult; /* Validate every input before any queue publication. Frequencies include the * zero/off entry, are strictly ascending, exactly representable in wire kHz. * Votes and command-db addresses are trusted platform inputs, never guessed * by this library. ACD entries are packed for each enabled GPU level; AOSS * notification and IFPC power prerequisites must already be established. * Unused fixed-capacity slots must be zero. This prevents silently ignoring * unsupported or malformed configuration. No input is authenticated here. */ AdrenoHfiStartupStatus AdrenoHfiStartupValidate(const AdrenoHfiStartupConfig *); AdrenoHfiStartupStatus AdrenoHfiStartupValidateServices(const AdrenoHfiStartupServices *); /* Payload excludes header. All output storage must be disjoint from inputs. * Encodes one selected stage; unused optional stages refuse. Failure leaves * payload/header outputs untouched except word_count=0. Capacity >=159. */ AdrenoHfiStartupStatus AdrenoHfiStartupEncode(const AdrenoHfiStartupConfig *, --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.h:40 [MATCH: AdrenoHfiStartup] --- typedef struct { void *cookie; int (*now_us)(void *,uint64_t *); int (*wait_us)(void *,unsigned); int (*check_health)(void *); /* real platform fault/ownership checks */ unsigned polls_per_command,wait_interval_us; uint64_t command_timeout_us,total_timeout_us; } AdrenoHfiStartupServices; typedef struct {unsigned attempted,poisoned,completed;} AdrenoHfiStartup; typedef struct { AdrenoHfiStartupStage stage; AdrenoHfiStatus transport_status; uint32_t firmware_error,wire_header,acknowledged_stages; unsigned published_commands,poll_reads,resources_must_retain; uint64_t elapsed_us; } AdrenoHfiStartupResult; /* Validate every input before any queue publication. Frequencies include the * zero/off entry, are strictly ascending, exactly representable in wire kHz. * Votes and command-db addresses are trusted platform inputs, never guessed * by this library. ACD entries are packed for each enabled GPU level; AOSS * notification and IFPC power prerequisites must already be established. * Unused fixed-capacity slots must be zero. This prevents silently ignoring * unsupported or malformed configuration. No input is authenticated here. */ AdrenoHfiStartupStatus AdrenoHfiStartupValidate(const AdrenoHfiStartupConfig *); AdrenoHfiStartupStatus AdrenoHfiStartupValidateServices(const AdrenoHfiStartupServices *); /* Payload excludes header. All output storage must be disjoint from inputs. * Encodes one selected stage; unused optional stages refuse. Failure leaves * payload/header outputs untouched except word_count=0. Capacity >=159. */ AdrenoHfiStartupStatus AdrenoHfiStartupEncode(const AdrenoHfiStartupConfig *, AdrenoHfiStartupStage,uint32_t *id,uint32_t *payload,size_t capacity,size_t *word_count); /* Single attempt, serialized, caller-owned zero-initialized state. Requires --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.h:45 [MATCH: AdrenoHfiStartup] --- unsigned polls_per_command,wait_interval_us; uint64_t command_timeout_us,total_timeout_us; } AdrenoHfiStartupServices; typedef struct {unsigned attempted,poisoned,completed;} AdrenoHfiStartup; typedef struct { AdrenoHfiStartupStage stage; AdrenoHfiStatus transport_status; uint32_t firmware_error,wire_header,acknowledged_stages; unsigned published_commands,poll_reads,resources_must_retain; uint64_t elapsed_us; } AdrenoHfiStartupResult; /* Validate every input before any queue publication. Frequencies include the * zero/off entry, are strictly ascending, exactly representable in wire kHz. * Votes and command-db addresses are trusted platform inputs, never guessed * by this library. ACD entries are packed for each enabled GPU level; AOSS * notification and IFPC power prerequisites must already be established. * Unused fixed-capacity slots must be zero. This prevents silently ignoring * unsupported or malformed configuration. No input is authenticated here. */ AdrenoHfiStartupStatus AdrenoHfiStartupValidate(const AdrenoHfiStartupConfig *); AdrenoHfiStartupStatus AdrenoHfiStartupValidateServices(const AdrenoHfiStartupServices *); /* Payload excludes header. All output storage must be disjoint from inputs. * Encodes one selected stage; unused optional stages refuse. Failure leaves * payload/header outputs untouched except word_count=0. Capacity >=159. */ AdrenoHfiStartupStatus AdrenoHfiStartupEncode(const AdrenoHfiStartupConfig *, AdrenoHfiStartupStage,uint32_t *id,uint32_t *payload,size_t capacity,size_t *word_count); /* Single attempt, serialized, caller-owned zero-initialized state. Requires * a real ready GMU, exclusive coherent HFI allocation and active native4K GMU * mappings. Only matching actual ACKs advance the startup sequence. All * commands and the whole sequence have monotonic-time AND iteration bounds. * Callback operations must themselves be bounded. On any attempted-sequence * failure the transport is poisoned; no replay, synthetic ACK or implicit --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.h:53 [MATCH: AdrenoHfiStartup] --- unsigned published_commands,poll_reads,resources_must_retain; uint64_t elapsed_us; } AdrenoHfiStartupResult; /* Validate every input before any queue publication. Frequencies include the * zero/off entry, are strictly ascending, exactly representable in wire kHz. * Votes and command-db addresses are trusted platform inputs, never guessed * by this library. ACD entries are packed for each enabled GPU level; AOSS * notification and IFPC power prerequisites must already be established. * Unused fixed-capacity slots must be zero. This prevents silently ignoring * unsupported or malformed configuration. No input is authenticated here. */ AdrenoHfiStartupStatus AdrenoHfiStartupValidate(const AdrenoHfiStartupConfig *); AdrenoHfiStartupStatus AdrenoHfiStartupValidateServices(const AdrenoHfiStartupServices *); /* Payload excludes header. All output storage must be disjoint from inputs. * Encodes one selected stage; unused optional stages refuse. Failure leaves * payload/header outputs untouched except word_count=0. Capacity >=159. */ AdrenoHfiStartupStatus AdrenoHfiStartupEncode(const AdrenoHfiStartupConfig *, AdrenoHfiStartupStage,uint32_t *id,uint32_t *payload,size_t capacity,size_t *word_count); /* Single attempt, serialized, caller-owned zero-initialized state. Requires * a real ready GMU, exclusive coherent HFI allocation and active native4K GMU * mappings. Only matching actual ACKs advance the startup sequence. All * commands and the whole sequence have monotonic-time AND iteration bounds. * Callback operations must themselves be bounded. On any attempted-sequence * failure the transport is poisoned; no replay, synthetic ACK or implicit * stop occurs. Even success does not authorize resource release or prove GPU * execution, power/coherence/SMMU readiness, shader submission or a desktop. * Input, state, services, transport, result and shared queues must remain * disjoint and pinned; config remains immutable throughout the sequence. */ AdrenoHfiStartupStatus AdrenoHfiStartupRun(AdrenoHfiStartup *,AdrenoHfi *, const AdrenoHfiStartupConfig *,const AdrenoHfiStartupServices *,AdrenoHfiStartupResult *); #ifdef __cplusplus } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.h:54 [MATCH: AdrenoHfiStartup] --- uint64_t elapsed_us; } AdrenoHfiStartupResult; /* Validate every input before any queue publication. Frequencies include the * zero/off entry, are strictly ascending, exactly representable in wire kHz. * Votes and command-db addresses are trusted platform inputs, never guessed * by this library. ACD entries are packed for each enabled GPU level; AOSS * notification and IFPC power prerequisites must already be established. * Unused fixed-capacity slots must be zero. This prevents silently ignoring * unsupported or malformed configuration. No input is authenticated here. */ AdrenoHfiStartupStatus AdrenoHfiStartupValidate(const AdrenoHfiStartupConfig *); AdrenoHfiStartupStatus AdrenoHfiStartupValidateServices(const AdrenoHfiStartupServices *); /* Payload excludes header. All output storage must be disjoint from inputs. * Encodes one selected stage; unused optional stages refuse. Failure leaves * payload/header outputs untouched except word_count=0. Capacity >=159. */ AdrenoHfiStartupStatus AdrenoHfiStartupEncode(const AdrenoHfiStartupConfig *, AdrenoHfiStartupStage,uint32_t *id,uint32_t *payload,size_t capacity,size_t *word_count); /* Single attempt, serialized, caller-owned zero-initialized state. Requires * a real ready GMU, exclusive coherent HFI allocation and active native4K GMU * mappings. Only matching actual ACKs advance the startup sequence. All * commands and the whole sequence have monotonic-time AND iteration bounds. * Callback operations must themselves be bounded. On any attempted-sequence * failure the transport is poisoned; no replay, synthetic ACK or implicit * stop occurs. Even success does not authorize resource release or prove GPU * execution, power/coherence/SMMU readiness, shader submission or a desktop. * Input, state, services, transport, result and shared queues must remain * disjoint and pinned; config remains immutable throughout the sequence. */ AdrenoHfiStartupStatus AdrenoHfiStartupRun(AdrenoHfiStartup *,AdrenoHfi *, const AdrenoHfiStartupConfig *,const AdrenoHfiStartupServices *,AdrenoHfiStartupResult *); #ifdef __cplusplus } #endif --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.h:58 [MATCH: AdrenoHfiStartup] --- * Votes and command-db addresses are trusted platform inputs, never guessed * by this library. ACD entries are packed for each enabled GPU level; AOSS * notification and IFPC power prerequisites must already be established. * Unused fixed-capacity slots must be zero. This prevents silently ignoring * unsupported or malformed configuration. No input is authenticated here. */ AdrenoHfiStartupStatus AdrenoHfiStartupValidate(const AdrenoHfiStartupConfig *); AdrenoHfiStartupStatus AdrenoHfiStartupValidateServices(const AdrenoHfiStartupServices *); /* Payload excludes header. All output storage must be disjoint from inputs. * Encodes one selected stage; unused optional stages refuse. Failure leaves * payload/header outputs untouched except word_count=0. Capacity >=159. */ AdrenoHfiStartupStatus AdrenoHfiStartupEncode(const AdrenoHfiStartupConfig *, AdrenoHfiStartupStage,uint32_t *id,uint32_t *payload,size_t capacity,size_t *word_count); /* Single attempt, serialized, caller-owned zero-initialized state. Requires * a real ready GMU, exclusive coherent HFI allocation and active native4K GMU * mappings. Only matching actual ACKs advance the startup sequence. All * commands and the whole sequence have monotonic-time AND iteration bounds. * Callback operations must themselves be bounded. On any attempted-sequence * failure the transport is poisoned; no replay, synthetic ACK or implicit * stop occurs. Even success does not authorize resource release or prove GPU * execution, power/coherence/SMMU readiness, shader submission or a desktop. * Input, state, services, transport, result and shared queues must remain * disjoint and pinned; config remains immutable throughout the sequence. */ AdrenoHfiStartupStatus AdrenoHfiStartupRun(AdrenoHfiStartup *,AdrenoHfi *, const AdrenoHfiStartupConfig *,const AdrenoHfiStartupServices *,AdrenoHfiStartupResult *); #ifdef __cplusplus } #endif #endif --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.h:59 [MATCH: AdrenoHfiStartup] --- * by this library. ACD entries are packed for each enabled GPU level; AOSS * notification and IFPC power prerequisites must already be established. * Unused fixed-capacity slots must be zero. This prevents silently ignoring * unsupported or malformed configuration. No input is authenticated here. */ AdrenoHfiStartupStatus AdrenoHfiStartupValidate(const AdrenoHfiStartupConfig *); AdrenoHfiStartupStatus AdrenoHfiStartupValidateServices(const AdrenoHfiStartupServices *); /* Payload excludes header. All output storage must be disjoint from inputs. * Encodes one selected stage; unused optional stages refuse. Failure leaves * payload/header outputs untouched except word_count=0. Capacity >=159. */ AdrenoHfiStartupStatus AdrenoHfiStartupEncode(const AdrenoHfiStartupConfig *, AdrenoHfiStartupStage,uint32_t *id,uint32_t *payload,size_t capacity,size_t *word_count); /* Single attempt, serialized, caller-owned zero-initialized state. Requires * a real ready GMU, exclusive coherent HFI allocation and active native4K GMU * mappings. Only matching actual ACKs advance the startup sequence. All * commands and the whole sequence have monotonic-time AND iteration bounds. * Callback operations must themselves be bounded. On any attempted-sequence * failure the transport is poisoned; no replay, synthetic ACK or implicit * stop occurs. Even success does not authorize resource release or prove GPU * execution, power/coherence/SMMU readiness, shader submission or a desktop. * Input, state, services, transport, result and shared queues must remain * disjoint and pinned; config remains immutable throughout the sequence. */ AdrenoHfiStartupStatus AdrenoHfiStartupRun(AdrenoHfiStartup *,AdrenoHfi *, const AdrenoHfiStartupConfig *,const AdrenoHfiStartupServices *,AdrenoHfiStartupResult *); #ifdef __cplusplus } #endif #endif --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.h:70 [MATCH: AdrenoHfiStartup] --- /* Single attempt, serialized, caller-owned zero-initialized state. Requires * a real ready GMU, exclusive coherent HFI allocation and active native4K GMU * mappings. Only matching actual ACKs advance the startup sequence. All * commands and the whole sequence have monotonic-time AND iteration bounds. * Callback operations must themselves be bounded. On any attempted-sequence * failure the transport is poisoned; no replay, synthetic ACK or implicit * stop occurs. Even success does not authorize resource release or prove GPU * execution, power/coherence/SMMU readiness, shader submission or a desktop. * Input, state, services, transport, result and shared queues must remain * disjoint and pinned; config remains immutable throughout the sequence. */ AdrenoHfiStartupStatus AdrenoHfiStartupRun(AdrenoHfiStartup *,AdrenoHfi *, const AdrenoHfiStartupConfig *,const AdrenoHfiStartupServices *,AdrenoHfiStartupResult *); #ifdef __cplusplus } #endif #endif --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.h:71 [MATCH: AdrenoHfiStartup] --- * a real ready GMU, exclusive coherent HFI allocation and active native4K GMU * mappings. Only matching actual ACKs advance the startup sequence. All * commands and the whole sequence have monotonic-time AND iteration bounds. * Callback operations must themselves be bounded. On any attempted-sequence * failure the transport is poisoned; no replay, synthetic ACK or implicit * stop occurs. Even success does not authorize resource release or prove GPU * execution, power/coherence/SMMU readiness, shader submission or a desktop. * Input, state, services, transport, result and shared queues must remain * disjoint and pinned; config remains immutable throughout the sequence. */ AdrenoHfiStartupStatus AdrenoHfiStartupRun(AdrenoHfiStartup *,AdrenoHfi *, const AdrenoHfiStartupConfig *,const AdrenoHfiStartupServices *,AdrenoHfiStartupResult *); #ifdef __cplusplus } #endif #endif --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.h:36 [MATCH: timeout] --- AdrenoHfiStartupSuccess,AdrenoHfiStartupInvalid,AdrenoHfiStartupBusy, AdrenoHfiStartupPoisoned,AdrenoHfiStartupClockError,AdrenoHfiStartupWaitError, AdrenoHfiStartupTimeout,AdrenoHfiStartupPlatformFault,AdrenoHfiStartupTransportError } AdrenoHfiStartupStatus; typedef struct { void *cookie; int (*now_us)(void *,uint64_t *); int (*wait_us)(void *,unsigned); int (*check_health)(void *); /* real platform fault/ownership checks */ unsigned polls_per_command,wait_interval_us; uint64_t command_timeout_us,total_timeout_us; } AdrenoHfiStartupServices; typedef struct {unsigned attempted,poisoned,completed;} AdrenoHfiStartup; typedef struct { AdrenoHfiStartupStage stage; AdrenoHfiStatus transport_status; uint32_t firmware_error,wire_header,acknowledged_stages; unsigned published_commands,poll_reads,resources_must_retain; uint64_t elapsed_us; } AdrenoHfiStartupResult; /* Validate every input before any queue publication. Frequencies include the * zero/off entry, are strictly ascending, exactly representable in wire kHz. * Votes and command-db addresses are trusted platform inputs, never guessed * by this library. ACD entries are packed for each enabled GPU level; AOSS * notification and IFPC power prerequisites must already be established. * Unused fixed-capacity slots must be zero. This prevents silently ignoring * unsupported or malformed configuration. No input is authenticated here. */ AdrenoHfiStartupStatus AdrenoHfiStartupValidate(const AdrenoHfiStartupConfig *); AdrenoHfiStartupStatus AdrenoHfiStartupValidateServices(const AdrenoHfiStartupServices *); /* Payload excludes header. All output storage must be disjoint from inputs. * Encodes one selected stage; unused optional stages refuse. Failure leaves --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.h:42 [MATCH: ACK] --- int (*now_us)(void *,uint64_t *); int (*wait_us)(void *,unsigned); int (*check_health)(void *); /* real platform fault/ownership checks */ unsigned polls_per_command,wait_interval_us; uint64_t command_timeout_us,total_timeout_us; } AdrenoHfiStartupServices; typedef struct {unsigned attempted,poisoned,completed;} AdrenoHfiStartup; typedef struct { AdrenoHfiStartupStage stage; AdrenoHfiStatus transport_status; uint32_t firmware_error,wire_header,acknowledged_stages; unsigned published_commands,poll_reads,resources_must_retain; uint64_t elapsed_us; } AdrenoHfiStartupResult; /* Validate every input before any queue publication. Frequencies include the * zero/off entry, are strictly ascending, exactly representable in wire kHz. * Votes and command-db addresses are trusted platform inputs, never guessed * by this library. ACD entries are packed for each enabled GPU level; AOSS * notification and IFPC power prerequisites must already be established. * Unused fixed-capacity slots must be zero. This prevents silently ignoring * unsupported or malformed configuration. No input is authenticated here. */ AdrenoHfiStartupStatus AdrenoHfiStartupValidate(const AdrenoHfiStartupConfig *); AdrenoHfiStartupStatus AdrenoHfiStartupValidateServices(const AdrenoHfiStartupServices *); /* Payload excludes header. All output storage must be disjoint from inputs. * Encodes one selected stage; unused optional stages refuse. Failure leaves * payload/header outputs untouched except word_count=0. Capacity >=159. */ AdrenoHfiStartupStatus AdrenoHfiStartupEncode(const AdrenoHfiStartupConfig *, AdrenoHfiStartupStage,uint32_t *id,uint32_t *payload,size_t capacity,size_t *word_count); /* Single attempt, serialized, caller-owned zero-initialized state. Requires * a real ready GMU, exclusive coherent HFI allocation and active native4K GMU * mappings. Only matching actual ACKs advance the startup sequence. All --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.h:49 [MATCH: ACK] --- typedef struct { AdrenoHfiStartupStage stage; AdrenoHfiStatus transport_status; uint32_t firmware_error,wire_header,acknowledged_stages; unsigned published_commands,poll_reads,resources_must_retain; uint64_t elapsed_us; } AdrenoHfiStartupResult; /* Validate every input before any queue publication. Frequencies include the * zero/off entry, are strictly ascending, exactly representable in wire kHz. * Votes and command-db addresses are trusted platform inputs, never guessed * by this library. ACD entries are packed for each enabled GPU level; AOSS * notification and IFPC power prerequisites must already be established. * Unused fixed-capacity slots must be zero. This prevents silently ignoring * unsupported or malformed configuration. No input is authenticated here. */ AdrenoHfiStartupStatus AdrenoHfiStartupValidate(const AdrenoHfiStartupConfig *); AdrenoHfiStartupStatus AdrenoHfiStartupValidateServices(const AdrenoHfiStartupServices *); /* Payload excludes header. All output storage must be disjoint from inputs. * Encodes one selected stage; unused optional stages refuse. Failure leaves * payload/header outputs untouched except word_count=0. Capacity >=159. */ AdrenoHfiStartupStatus AdrenoHfiStartupEncode(const AdrenoHfiStartupConfig *, AdrenoHfiStartupStage,uint32_t *id,uint32_t *payload,size_t capacity,size_t *word_count); /* Single attempt, serialized, caller-owned zero-initialized state. Requires * a real ready GMU, exclusive coherent HFI allocation and active native4K GMU * mappings. Only matching actual ACKs advance the startup sequence. All * commands and the whole sequence have monotonic-time AND iteration bounds. * Callback operations must themselves be bounded. On any attempted-sequence * failure the transport is poisoned; no replay, synthetic ACK or implicit * stop occurs. Even success does not authorize resource release or prove GPU * execution, power/coherence/SMMU readiness, shader submission or a desktop. * Input, state, services, transport, result and shared queues must remain * disjoint and pinned; config remains immutable throughout the sequence. */ --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.h:62 [MATCH: ACK] --- * unsupported or malformed configuration. No input is authenticated here. */ AdrenoHfiStartupStatus AdrenoHfiStartupValidate(const AdrenoHfiStartupConfig *); AdrenoHfiStartupStatus AdrenoHfiStartupValidateServices(const AdrenoHfiStartupServices *); /* Payload excludes header. All output storage must be disjoint from inputs. * Encodes one selected stage; unused optional stages refuse. Failure leaves * payload/header outputs untouched except word_count=0. Capacity >=159. */ AdrenoHfiStartupStatus AdrenoHfiStartupEncode(const AdrenoHfiStartupConfig *, AdrenoHfiStartupStage,uint32_t *id,uint32_t *payload,size_t capacity,size_t *word_count); /* Single attempt, serialized, caller-owned zero-initialized state. Requires * a real ready GMU, exclusive coherent HFI allocation and active native4K GMU * mappings. Only matching actual ACKs advance the startup sequence. All * commands and the whole sequence have monotonic-time AND iteration bounds. * Callback operations must themselves be bounded. On any attempted-sequence * failure the transport is poisoned; no replay, synthetic ACK or implicit * stop occurs. Even success does not authorize resource release or prove GPU * execution, power/coherence/SMMU readiness, shader submission or a desktop. * Input, state, services, transport, result and shared queues must remain * disjoint and pinned; config remains immutable throughout the sequence. */ AdrenoHfiStartupStatus AdrenoHfiStartupRun(AdrenoHfiStartup *,AdrenoHfi *, const AdrenoHfiStartupConfig *,const AdrenoHfiStartupServices *,AdrenoHfiStartupResult *); #ifdef __cplusplus } #endif #endif --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.h:64 [MATCH: ACK] --- AdrenoHfiStartupStatus AdrenoHfiStartupValidateServices(const AdrenoHfiStartupServices *); /* Payload excludes header. All output storage must be disjoint from inputs. * Encodes one selected stage; unused optional stages refuse. Failure leaves * payload/header outputs untouched except word_count=0. Capacity >=159. */ AdrenoHfiStartupStatus AdrenoHfiStartupEncode(const AdrenoHfiStartupConfig *, AdrenoHfiStartupStage,uint32_t *id,uint32_t *payload,size_t capacity,size_t *word_count); /* Single attempt, serialized, caller-owned zero-initialized state. Requires * a real ready GMU, exclusive coherent HFI allocation and active native4K GMU * mappings. Only matching actual ACKs advance the startup sequence. All * commands and the whole sequence have monotonic-time AND iteration bounds. * Callback operations must themselves be bounded. On any attempted-sequence * failure the transport is poisoned; no replay, synthetic ACK or implicit * stop occurs. Even success does not authorize resource release or prove GPU * execution, power/coherence/SMMU readiness, shader submission or a desktop. * Input, state, services, transport, result and shared queues must remain * disjoint and pinned; config remains immutable throughout the sequence. */ AdrenoHfiStartupStatus AdrenoHfiStartupRun(AdrenoHfiStartup *,AdrenoHfi *, const AdrenoHfiStartupConfig *,const AdrenoHfiStartupServices *,AdrenoHfiStartupResult *); #ifdef __cplusplus } #endif #endif --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.h:65 [MATCH: ACK] --- /* Payload excludes header. All output storage must be disjoint from inputs. * Encodes one selected stage; unused optional stages refuse. Failure leaves * payload/header outputs untouched except word_count=0. Capacity >=159. */ AdrenoHfiStartupStatus AdrenoHfiStartupEncode(const AdrenoHfiStartupConfig *, AdrenoHfiStartupStage,uint32_t *id,uint32_t *payload,size_t capacity,size_t *word_count); /* Single attempt, serialized, caller-owned zero-initialized state. Requires * a real ready GMU, exclusive coherent HFI allocation and active native4K GMU * mappings. Only matching actual ACKs advance the startup sequence. All * commands and the whole sequence have monotonic-time AND iteration bounds. * Callback operations must themselves be bounded. On any attempted-sequence * failure the transport is poisoned; no replay, synthetic ACK or implicit * stop occurs. Even success does not authorize resource release or prove GPU * execution, power/coherence/SMMU readiness, shader submission or a desktop. * Input, state, services, transport, result and shared queues must remain * disjoint and pinned; config remains immutable throughout the sequence. */ AdrenoHfiStartupStatus AdrenoHfiStartupRun(AdrenoHfiStartup *,AdrenoHfi *, const AdrenoHfiStartupConfig *,const AdrenoHfiStartupServices *,AdrenoHfiStartupResult *); #ifdef __cplusplus } #endif #endif --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiVotes.c:17 [MATCH: AdrenoHfiStartup] --- if(!p || !bytes || (bytes&1) || bytes>512 || le16(p))return 0; unsigned padding=0;uint16_t last=0; for(size_t i=2;i16 || capacityUINT16_MAX || (i && levels[i]=levels[i]) {s=j;break;} if(value)s=j; } result[i]=(uint32_t)le16(primary+2*p)<<16 | (uint32_t)s<<8 | (uint32_t)p; } for(size_t i=0;i16 || capacityUINT16_MAX || (i && levels[i]=levels[i]) {s=j;break;} if(value)s=j; } result[i]=(uint32_t)le16(primary+2*p)<<16 | (uint32_t)s<<8 | (uint32_t)p; } for(size_t i=0;iunit=le32(p);b->width=le16(p+4);b->vcd=p[6];return AdrenoHfiStartupSuccess; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiVotes.c:25 [MATCH: AdrenoHfiStartup] --- return 1; } AdrenoHfiStartupStatus AdrenoHfiArcVotes(const uint32_t *levels,size_t count, const uint8_t *primary,size_t primary_bytes,const uint8_t *secondary,size_t secondary_bytes, uint32_t *votes,size_t capacity) { if(!levels || !votes || !count || count>16 || capacityUINT16_MAX || (i && levels[i]=levels[i]) {s=j;break;} if(value)s=j; } result[i]=(uint32_t)le16(primary+2*p)<<16 | (uint32_t)s<<8 | (uint32_t)p; } for(size_t i=0;iunit=le32(p);b->width=le16(p+4);b->vcd=p[6];return AdrenoHfiStartupSuccess; } static int address(uint32_t a){return a && !(a&3);} AdrenoHfiStartupStatus AdrenoHfiBuildBandwidth(const uint32_t *kbps,size_t count, --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiVotes.c:28 [MATCH: AdrenoHfiStartup] --- const uint8_t *primary,size_t primary_bytes,const uint8_t *secondary,size_t secondary_bytes, uint32_t *votes,size_t capacity) { if(!levels || !votes || !count || count>16 || capacityUINT16_MAX || (i && levels[i]=levels[i]) {s=j;break;} if(value)s=j; } result[i]=(uint32_t)le16(primary+2*p)<<16 | (uint32_t)s<<8 | (uint32_t)p; } for(size_t i=0;iunit=le32(p);b->width=le16(p+4);b->vcd=p[6];return AdrenoHfiStartupSuccess; } static int address(uint32_t a){return a && !(a&3);} AdrenoHfiStartupStatus AdrenoHfiBuildBandwidth(const uint32_t *kbps,size_t count, const AdrenoHfiBcm *bcms,size_t n,uint32_t cn0,AdrenoHfiStartupConfig *c) { if(!c || !kbps || !bcms || !count || count>16 || kbps[0] || !n || n>3 || !address(cn0)) --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiVotes.c:37 [MATCH: AdrenoHfiStartup] --- while(p=levels[i]) {s=j;break;} if(value)s=j; } result[i]=(uint32_t)le16(primary+2*p)<<16 | (uint32_t)s<<8 | (uint32_t)p; } for(size_t i=0;iunit=le32(p);b->width=le16(p+4);b->vcd=p[6];return AdrenoHfiStartupSuccess; } static int address(uint32_t a){return a && !(a&3);} AdrenoHfiStartupStatus AdrenoHfiBuildBandwidth(const uint32_t *kbps,size_t count, const AdrenoHfiBcm *bcms,size_t n,uint32_t cn0,AdrenoHfiStartupConfig *c) { if(!c || !kbps || !bcms || !count || count>16 || kbps[0] || !n || n>3 || !address(cn0)) return AdrenoHfiStartupInvalid; for(size_t i=1;iaddress) || b->address==cn0 || b->fixed>1 || b->perfmode>0x3fff || (!b->fixed && (!b->unit || !b->width || !b->buswidth || b->perfmode || b->perfmode_kbps))) return AdrenoHfiStartupInvalid; for(size_t k=0;kaddress==bcms[k].address)return AdrenoHfiStartupInvalid; } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiVotes.c:39 [MATCH: AdrenoHfiStartup] --- for(size_t j=0;j=levels[i]) {s=j;break;} if(value)s=j; } result[i]=(uint32_t)le16(primary+2*p)<<16 | (uint32_t)s<<8 | (uint32_t)p; } for(size_t i=0;iunit=le32(p);b->width=le16(p+4);b->vcd=p[6];return AdrenoHfiStartupSuccess; } static int address(uint32_t a){return a && !(a&3);} AdrenoHfiStartupStatus AdrenoHfiBuildBandwidth(const uint32_t *kbps,size_t count, const AdrenoHfiBcm *bcms,size_t n,uint32_t cn0,AdrenoHfiStartupConfig *c) { if(!c || !kbps || !bcms || !count || count>16 || kbps[0] || !n || n>3 || !address(cn0)) return AdrenoHfiStartupInvalid; for(size_t i=1;iaddress) || b->address==cn0 || b->fixed>1 || b->perfmode>0x3fff || (!b->fixed && (!b->unit || !b->width || !b->buswidth || b->perfmode || b->perfmode_kbps))) return AdrenoHfiStartupInvalid; for(size_t k=0;kaddress==bcms[k].address)return AdrenoHfiStartupInvalid; } /* All input validation is finished before changing caller storage. */ c->bandwidth_count=(unsigned)count;c->cnoc_count=1;c->ddr_count=(unsigned)n; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiVotes.c:41 [MATCH: AdrenoHfiStartup] --- if(value>=levels[i]) {s=j;break;} if(value)s=j; } result[i]=(uint32_t)le16(primary+2*p)<<16 | (uint32_t)s<<8 | (uint32_t)p; } for(size_t i=0;iunit=le32(p);b->width=le16(p+4);b->vcd=p[6];return AdrenoHfiStartupSuccess; } static int address(uint32_t a){return a && !(a&3);} AdrenoHfiStartupStatus AdrenoHfiBuildBandwidth(const uint32_t *kbps,size_t count, const AdrenoHfiBcm *bcms,size_t n,uint32_t cn0,AdrenoHfiStartupConfig *c) { if(!c || !kbps || !bcms || !count || count>16 || kbps[0] || !n || n>3 || !address(cn0)) return AdrenoHfiStartupInvalid; for(size_t i=1;iaddress) || b->address==cn0 || b->fixed>1 || b->perfmode>0x3fff || (!b->fixed && (!b->unit || !b->width || !b->buswidth || b->perfmode || b->perfmode_kbps))) return AdrenoHfiStartupInvalid; for(size_t k=0;kaddress==bcms[k].address)return AdrenoHfiStartupInvalid; } /* All input validation is finished before changing caller storage. */ c->bandwidth_count=(unsigned)count;c->cnoc_count=1;c->ddr_count=(unsigned)n; c->cnoc_wait_mask=1;c->ddr_wait_mask=0; for(size_t i=0;i<6;++i) { --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiVotes.c:42 [MATCH: AdrenoHfiStartup] --- if(value)s=j; } result[i]=(uint32_t)le16(primary+2*p)<<16 | (uint32_t)s<<8 | (uint32_t)p; } for(size_t i=0;iunit=le32(p);b->width=le16(p+4);b->vcd=p[6];return AdrenoHfiStartupSuccess; } static int address(uint32_t a){return a && !(a&3);} AdrenoHfiStartupStatus AdrenoHfiBuildBandwidth(const uint32_t *kbps,size_t count, const AdrenoHfiBcm *bcms,size_t n,uint32_t cn0,AdrenoHfiStartupConfig *c) { if(!c || !kbps || !bcms || !count || count>16 || kbps[0] || !n || n>3 || !address(cn0)) return AdrenoHfiStartupInvalid; for(size_t i=1;iaddress) || b->address==cn0 || b->fixed>1 || b->perfmode>0x3fff || (!b->fixed && (!b->unit || !b->width || !b->buswidth || b->perfmode || b->perfmode_kbps))) return AdrenoHfiStartupInvalid; for(size_t k=0;kaddress==bcms[k].address)return AdrenoHfiStartupInvalid; } /* All input validation is finished before changing caller storage. */ c->bandwidth_count=(unsigned)count;c->cnoc_count=1;c->ddr_count=(unsigned)n; c->cnoc_wait_mask=1;c->ddr_wait_mask=0; for(size_t i=0;i<6;++i) { c->cnoc_addresses[i]=i?0:cn0;c->cnoc_data[0][i]=i?0:0x40000000; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiVotes.c:45 [MATCH: AdrenoHfiStartup] --- } for(size_t i=0;iunit=le32(p);b->width=le16(p+4);b->vcd=p[6];return AdrenoHfiStartupSuccess; } static int address(uint32_t a){return a && !(a&3);} AdrenoHfiStartupStatus AdrenoHfiBuildBandwidth(const uint32_t *kbps,size_t count, const AdrenoHfiBcm *bcms,size_t n,uint32_t cn0,AdrenoHfiStartupConfig *c) { if(!c || !kbps || !bcms || !count || count>16 || kbps[0] || !n || n>3 || !address(cn0)) return AdrenoHfiStartupInvalid; for(size_t i=1;iaddress) || b->address==cn0 || b->fixed>1 || b->perfmode>0x3fff || (!b->fixed && (!b->unit || !b->width || !b->buswidth || b->perfmode || b->perfmode_kbps))) return AdrenoHfiStartupInvalid; for(size_t k=0;kaddress==bcms[k].address)return AdrenoHfiStartupInvalid; } /* All input validation is finished before changing caller storage. */ c->bandwidth_count=(unsigned)count;c->cnoc_count=1;c->ddr_count=(unsigned)n; c->cnoc_wait_mask=1;c->ddr_wait_mask=0; for(size_t i=0;i<6;++i) { c->cnoc_addresses[i]=i?0:cn0;c->cnoc_data[0][i]=i?0:0x40000000; c->cnoc_data[1][i]=i?0:0x60000001; } for(size_t j=0;j<8;++j) { --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiVotes.c:46 [MATCH: AdrenoHfiStartup] --- for(size_t i=0;iunit=le32(p);b->width=le16(p+4);b->vcd=p[6];return AdrenoHfiStartupSuccess; } static int address(uint32_t a){return a && !(a&3);} AdrenoHfiStartupStatus AdrenoHfiBuildBandwidth(const uint32_t *kbps,size_t count, const AdrenoHfiBcm *bcms,size_t n,uint32_t cn0,AdrenoHfiStartupConfig *c) { if(!c || !kbps || !bcms || !count || count>16 || kbps[0] || !n || n>3 || !address(cn0)) return AdrenoHfiStartupInvalid; for(size_t i=1;iaddress) || b->address==cn0 || b->fixed>1 || b->perfmode>0x3fff || (!b->fixed && (!b->unit || !b->width || !b->buswidth || b->perfmode || b->perfmode_kbps))) return AdrenoHfiStartupInvalid; for(size_t k=0;kaddress==bcms[k].address)return AdrenoHfiStartupInvalid; } /* All input validation is finished before changing caller storage. */ c->bandwidth_count=(unsigned)count;c->cnoc_count=1;c->ddr_count=(unsigned)n; c->cnoc_wait_mask=1;c->ddr_wait_mask=0; for(size_t i=0;i<6;++i) { c->cnoc_addresses[i]=i?0:cn0;c->cnoc_data[0][i]=i?0:0x40000000; c->cnoc_data[1][i]=i?0:0x60000001; } for(size_t j=0;j<8;++j) { c->ddr_addresses[j]=junit=le32(p);b->width=le16(p+4);b->vcd=p[6];return AdrenoHfiStartupSuccess; } static int address(uint32_t a){return a && !(a&3);} AdrenoHfiStartupStatus AdrenoHfiBuildBandwidth(const uint32_t *kbps,size_t count, const AdrenoHfiBcm *bcms,size_t n,uint32_t cn0,AdrenoHfiStartupConfig *c) { if(!c || !kbps || !bcms || !count || count>16 || kbps[0] || !n || n>3 || !address(cn0)) return AdrenoHfiStartupInvalid; for(size_t i=1;iaddress) || b->address==cn0 || b->fixed>1 || b->perfmode>0x3fff || (!b->fixed && (!b->unit || !b->width || !b->buswidth || b->perfmode || b->perfmode_kbps))) return AdrenoHfiStartupInvalid; for(size_t k=0;kaddress==bcms[k].address)return AdrenoHfiStartupInvalid; } /* All input validation is finished before changing caller storage. */ c->bandwidth_count=(unsigned)count;c->cnoc_count=1;c->ddr_count=(unsigned)n; c->cnoc_wait_mask=1;c->ddr_wait_mask=0; for(size_t i=0;i<6;++i) { c->cnoc_addresses[i]=i?0:cn0;c->cnoc_data[0][i]=i?0:0x40000000; c->cnoc_data[1][i]=i?0:0x60000001; } for(size_t j=0;j<8;++j) { c->ddr_addresses[j]=jddr_wait_mask|=1u<unit=le32(p);b->width=le16(p+4);b->vcd=p[6];return AdrenoHfiStartupSuccess; } static int address(uint32_t a){return a && !(a&3);} AdrenoHfiStartupStatus AdrenoHfiBuildBandwidth(const uint32_t *kbps,size_t count, const AdrenoHfiBcm *bcms,size_t n,uint32_t cn0,AdrenoHfiStartupConfig *c) { if(!c || !kbps || !bcms || !count || count>16 || kbps[0] || !n || n>3 || !address(cn0)) return AdrenoHfiStartupInvalid; for(size_t i=1;iaddress) || b->address==cn0 || b->fixed>1 || b->perfmode>0x3fff || (!b->fixed && (!b->unit || !b->width || !b->buswidth || b->perfmode || b->perfmode_kbps))) return AdrenoHfiStartupInvalid; for(size_t k=0;kaddress==bcms[k].address)return AdrenoHfiStartupInvalid; } /* All input validation is finished before changing caller storage. */ c->bandwidth_count=(unsigned)count;c->cnoc_count=1;c->ddr_count=(unsigned)n; c->cnoc_wait_mask=1;c->ddr_wait_mask=0; for(size_t i=0;i<6;++i) { c->cnoc_addresses[i]=i?0:cn0;c->cnoc_data[0][i]=i?0:0x40000000; c->cnoc_data[1][i]=i?0:0x60000001; } for(size_t j=0;j<8;++j) { c->ddr_addresses[j]=jddr_wait_mask|=1u<16 || kbps[0] || !n || n>3 || !address(cn0)) return AdrenoHfiStartupInvalid; for(size_t i=1;iaddress) || b->address==cn0 || b->fixed>1 || b->perfmode>0x3fff || (!b->fixed && (!b->unit || !b->width || !b->buswidth || b->perfmode || b->perfmode_kbps))) return AdrenoHfiStartupInvalid; for(size_t k=0;kaddress==bcms[k].address)return AdrenoHfiStartupInvalid; } /* All input validation is finished before changing caller storage. */ c->bandwidth_count=(unsigned)count;c->cnoc_count=1;c->ddr_count=(unsigned)n; c->cnoc_wait_mask=1;c->ddr_wait_mask=0; for(size_t i=0;i<6;++i) { c->cnoc_addresses[i]=i?0:cn0;c->cnoc_data[0][i]=i?0:0x40000000; c->cnoc_data[1][i]=i?0:0x60000001; } for(size_t j=0;j<8;++j) { c->ddr_addresses[j]=jddr_wait_mask|=1u<fixed) { --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiVotes.c:56 [MATCH: AdrenoHfiStartup] --- const AdrenoHfiBcm *bcms,size_t n,uint32_t cn0,AdrenoHfiStartupConfig *c) { if(!c || !kbps || !bcms || !count || count>16 || kbps[0] || !n || n>3 || !address(cn0)) return AdrenoHfiStartupInvalid; for(size_t i=1;iaddress) || b->address==cn0 || b->fixed>1 || b->perfmode>0x3fff || (!b->fixed && (!b->unit || !b->width || !b->buswidth || b->perfmode || b->perfmode_kbps))) return AdrenoHfiStartupInvalid; for(size_t k=0;kaddress==bcms[k].address)return AdrenoHfiStartupInvalid; } /* All input validation is finished before changing caller storage. */ c->bandwidth_count=(unsigned)count;c->cnoc_count=1;c->ddr_count=(unsigned)n; c->cnoc_wait_mask=1;c->ddr_wait_mask=0; for(size_t i=0;i<6;++i) { c->cnoc_addresses[i]=i?0:cn0;c->cnoc_data[0][i]=i?0:0x40000000; c->cnoc_data[1][i]=i?0:0x60000001; } for(size_t j=0;j<8;++j) { c->ddr_addresses[j]=jddr_wait_mask|=1u<fixed) { if(b->perfmode_kbps && kbps[i]>=b->perfmode_kbps)data|=b->perfmode; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiVotes.c:88 [MATCH: AdrenoHfiStartup] --- uint64_t peak=(uint64_t)kbps[i]*b->width/b->buswidth; peak=peak*1000/b->unit; uint32_t vote=peak>0x3fff?0x3fff:peak?(uint32_t)peak:1; data|=vote<<14|vote; } } } c->ddr_data[i][j]=data; } } return AdrenoHfiStartupSuccess; } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiVotes.h:4 [MATCH: AdrenoHfiStartup] --- /* SPDX-License-Identifier: BSD-2-Clause-Patent */ #ifndef ADRENO_HFI_VOTES_H #define ADRENO_HFI_VOTES_H #include "AdrenoHfiStartup.h" #ifdef __cplusplus extern "C" { #endif /* CPU-side generation only, no RPMh transaction or power transition. * Input levels are from exact enabled OPPs (including off=0), not frequencies * or voltages. Rail byte spans are original little-endian cmd-db aux data. * Caller selects actual primary/secondary rails (including GMxC discovery). * Rail profile: off at entry zero, ascending active levels (duplicates allowed), * optional zero padding at the end. Other profiles explicitly refuse. * Supports <=256 rail entries, <=16 OPPs; no truncation or guessed fallback. * Output remains unchanged on failure. Inputs/outputs must be disjoint and * immutable during calls. Successful arithmetic does not authenticate inputs. */ AdrenoHfiStartupStatus AdrenoHfiArcVotes(const uint32_t *levels,size_t level_count, const uint8_t *primary,size_t primary_bytes,const uint8_t *secondary,size_t secondary_bytes, uint32_t *votes,size_t capacity); typedef struct { uint32_t address,unit; uint16_t width,buswidth; uint8_t vcd,fixed; uint16_t perfmode; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiVotes.h:17 [MATCH: AdrenoHfiStartup] --- #endif /* CPU-side generation only, no RPMh transaction or power transition. * Input levels are from exact enabled OPPs (including off=0), not frequencies * or voltages. Rail byte spans are original little-endian cmd-db aux data. * Caller selects actual primary/secondary rails (including GMxC discovery). * Rail profile: off at entry zero, ascending active levels (duplicates allowed), * optional zero padding at the end. Other profiles explicitly refuse. * Supports <=256 rail entries, <=16 OPPs; no truncation or guessed fallback. * Output remains unchanged on failure. Inputs/outputs must be disjoint and * immutable during calls. Successful arithmetic does not authenticate inputs. */ AdrenoHfiStartupStatus AdrenoHfiArcVotes(const uint32_t *levels,size_t level_count, const uint8_t *primary,size_t primary_bytes,const uint8_t *secondary,size_t secondary_bytes, uint32_t *votes,size_t capacity); typedef struct { uint32_t address,unit; uint16_t width,buswidth; uint8_t vcd,fixed; uint16_t perfmode; uint32_t perfmode_kbps; } AdrenoHfiBcm; /* Decode exactly eight bytes of BCM aux data; address/buswidth/fixed/perfmode * are separately supplied source/platform policy and are preserved. */ AdrenoHfiStartupStatus AdrenoHfiBcmAux(AdrenoHfiBcm *,const uint8_t *,size_t); /* A7xx BCM arithmetic and modern HFI bandwidth layout. Off=0, then strictly * ascending KB/s OPP bandwidths, <=16. Up to three platform-ordered BCMs; * CN0 address must come from command-db. No source fallback address exists. * Unit/width come from BCM aux; buswidth/fixed/perfmode from target catalog. * Fills only bandwidth-related config fields, preserving performance/features. * Failure leaves the entire config unchanged. Success requires no HFI/device. * Does not validate actual rail/BCM ownership, limits, speed bin or power. */ AdrenoHfiStartupStatus AdrenoHfiBuildBandwidth(const uint32_t *kbps,size_t level_count, --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiVotes.h:29 [MATCH: AdrenoHfiStartup] --- uint32_t *votes,size_t capacity); typedef struct { uint32_t address,unit; uint16_t width,buswidth; uint8_t vcd,fixed; uint16_t perfmode; uint32_t perfmode_kbps; } AdrenoHfiBcm; /* Decode exactly eight bytes of BCM aux data; address/buswidth/fixed/perfmode * are separately supplied source/platform policy and are preserved. */ AdrenoHfiStartupStatus AdrenoHfiBcmAux(AdrenoHfiBcm *,const uint8_t *,size_t); /* A7xx BCM arithmetic and modern HFI bandwidth layout. Off=0, then strictly * ascending KB/s OPP bandwidths, <=16. Up to three platform-ordered BCMs; * CN0 address must come from command-db. No source fallback address exists. * Unit/width come from BCM aux; buswidth/fixed/perfmode from target catalog. * Fills only bandwidth-related config fields, preserving performance/features. * Failure leaves the entire config unchanged. Success requires no HFI/device. * Does not validate actual rail/BCM ownership, limits, speed bin or power. */ AdrenoHfiStartupStatus AdrenoHfiBuildBandwidth(const uint32_t *kbps,size_t level_count, const AdrenoHfiBcm *bcms,size_t bcm_count,uint32_t cn0_address,AdrenoHfiStartupConfig *); #ifdef __cplusplus } #endif #endif --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiVotes.h:37 [MATCH: AdrenoHfiStartup] --- /* Decode exactly eight bytes of BCM aux data; address/buswidth/fixed/perfmode * are separately supplied source/platform policy and are preserved. */ AdrenoHfiStartupStatus AdrenoHfiBcmAux(AdrenoHfiBcm *,const uint8_t *,size_t); /* A7xx BCM arithmetic and modern HFI bandwidth layout. Off=0, then strictly * ascending KB/s OPP bandwidths, <=16. Up to three platform-ordered BCMs; * CN0 address must come from command-db. No source fallback address exists. * Unit/width come from BCM aux; buswidth/fixed/perfmode from target catalog. * Fills only bandwidth-related config fields, preserving performance/features. * Failure leaves the entire config unchanged. Success requires no HFI/device. * Does not validate actual rail/BCM ownership, limits, speed bin or power. */ AdrenoHfiStartupStatus AdrenoHfiBuildBandwidth(const uint32_t *kbps,size_t level_count, const AdrenoHfiBcm *bcms,size_t bcm_count,uint32_t cn0_address,AdrenoHfiStartupConfig *); #ifdef __cplusplus } #endif #endif --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiVotes.h:38 [MATCH: AdrenoHfiStartup] --- * are separately supplied source/platform policy and are preserved. */ AdrenoHfiStartupStatus AdrenoHfiBcmAux(AdrenoHfiBcm *,const uint8_t *,size_t); /* A7xx BCM arithmetic and modern HFI bandwidth layout. Off=0, then strictly * ascending KB/s OPP bandwidths, <=16. Up to three platform-ordered BCMs; * CN0 address must come from command-db. No source fallback address exists. * Unit/width come from BCM aux; buswidth/fixed/perfmode from target catalog. * Fills only bandwidth-related config fields, preserving performance/features. * Failure leaves the entire config unchanged. Success requires no HFI/device. * Does not validate actual rail/BCM ownership, limits, speed bin or power. */ AdrenoHfiStartupStatus AdrenoHfiBuildBandwidth(const uint32_t *kbps,size_t level_count, const AdrenoHfiBcm *bcms,size_t bcm_count,uint32_t cn0_address,AdrenoHfiStartupConfig *); #ifdef __cplusplus } #endif #endif --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiVotes.h:14 [MATCH: ACK] --- #include "AdrenoHfiStartup.h" #ifdef __cplusplus extern "C" { #endif /* CPU-side generation only, no RPMh transaction or power transition. * Input levels are from exact enabled OPPs (including off=0), not frequencies * or voltages. Rail byte spans are original little-endian cmd-db aux data. * Caller selects actual primary/secondary rails (including GMxC discovery). * Rail profile: off at entry zero, ascending active levels (duplicates allowed), * optional zero padding at the end. Other profiles explicitly refuse. * Supports <=256 rail entries, <=16 OPPs; no truncation or guessed fallback. * Output remains unchanged on failure. Inputs/outputs must be disjoint and * immutable during calls. Successful arithmetic does not authenticate inputs. */ AdrenoHfiStartupStatus AdrenoHfiArcVotes(const uint32_t *levels,size_t level_count, const uint8_t *primary,size_t primary_bytes,const uint8_t *secondary,size_t secondary_bytes, uint32_t *votes,size_t capacity); typedef struct { uint32_t address,unit; uint16_t width,buswidth; uint8_t vcd,fixed; uint16_t perfmode; uint32_t perfmode_kbps; } AdrenoHfiBcm; /* Decode exactly eight bytes of BCM aux data; address/buswidth/fixed/perfmode * are separately supplied source/platform policy and are preserved. */ AdrenoHfiStartupStatus AdrenoHfiBcmAux(AdrenoHfiBcm *,const uint8_t *,size_t); /* A7xx BCM arithmetic and modern HFI bandwidth layout. Off=0, then strictly * ascending KB/s OPP bandwidths, <=16. Up to three platform-ordered BCMs; * CN0 address must come from command-db. No source fallback address exists. * Unit/width come from BCM aux; buswidth/fixed/perfmode from target catalog. * Fills only bandwidth-related config fields, preserving performance/features. --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiVotes.h:32 [MATCH: ACK] --- uint16_t width,buswidth; uint8_t vcd,fixed; uint16_t perfmode; uint32_t perfmode_kbps; } AdrenoHfiBcm; /* Decode exactly eight bytes of BCM aux data; address/buswidth/fixed/perfmode * are separately supplied source/platform policy and are preserved. */ AdrenoHfiStartupStatus AdrenoHfiBcmAux(AdrenoHfiBcm *,const uint8_t *,size_t); /* A7xx BCM arithmetic and modern HFI bandwidth layout. Off=0, then strictly * ascending KB/s OPP bandwidths, <=16. Up to three platform-ordered BCMs; * CN0 address must come from command-db. No source fallback address exists. * Unit/width come from BCM aux; buswidth/fixed/perfmode from target catalog. * Fills only bandwidth-related config fields, preserving performance/features. * Failure leaves the entire config unchanged. Success requires no HFI/device. * Does not validate actual rail/BCM ownership, limits, speed bin or power. */ AdrenoHfiStartupStatus AdrenoHfiBuildBandwidth(const uint32_t *kbps,size_t level_count, const AdrenoHfiBcm *bcms,size_t bcm_count,uint32_t cn0_address,AdrenoHfiStartupConfig *); #ifdef __cplusplus } #endif #endif --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\test_hfi.c:40 [MATCH: AdrenoHfiInitialize] --- return notify_fail; } static int wait_once(void *cookie) {CHECK(cookie==&h);if(++waits==reply_at)response(4,126,h.pending_header,0);return 0;} static int failed_wait(void *cookie) {CHECK(cookie==&h);++waits;return 1;} static void reset(void) { notified=notify_fail=auto_reply=waits=reply_at=0; memset(&h,0,sizeof(h));memset(shared,0xa5,sizeof(shared)); CHECK(AdrenoHfiInitializeStopped(&h,shared,sizeof(shared),0x60000000,&h,notify)==AdrenoHfiSuccess); CHECK(shared[1]==168 && shared[2]==6 && shared[3]==12 && shared[4]==3 && shared[5]==3); for(unsigned q=0;q<3;++q) { uint32_t *v=shared+6+12*q; CHECK(v[0]==1 && v[1]==0x60000000+(q+1)*4096 && v[2]==(0xa00|q) && v[3]==1024); CHECK(v[4]==0 && v[5]==0 && v[6]==1 && v[7]==1 && v[8]==1 && v[9]==0 && !v[10] && !v[11]); } #ifdef SOURCE_ORACLE memset(reference,0,sizeof(reference));source_initialize(reference,h.iova); CHECK(!memcmp(shared,reference,sizeof(shared))); #endif } static void untouched_output(void) {for(unsigned i=0;i<16;++i)CHECK(output[i]==0x5a5a5a5a);} int main(void) { for(unsigned i=0;i<254;++i)input[i]=0xabcdef00+i; size_t count;uint32_t error,header;unsigned cases=0; for(unsigned wrap=0;wrap<2;++wrap)for(unsigned words=0;words<255;++words) { reset();unsigned at=wrap?1020:0;shared[16]=shared[17]=at; CHECK(AdrenoHfiSend(&h,14,input,words,&header)==AdrenoHfiSuccess && notified==1); --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\test_hfi.c:146 [MATCH: AdrenoHfiInitialize] --- CHECK(AdrenoHfiExchange(&h,14,NULL,0,3,wait_once,output,16,&count,&error)==AdrenoHfiSuccess); CHECK(waits==2 && count==1 && output[0]==0xfeed0003 && !h.pending_header); reset();auto_reply=1; for(unsigned i=0;i<4100;++i) { /* Software peer consumes the outgoing packet, then produces its ACK. */ shared[16]=shared[17]; CHECK(AdrenoHfiExchange(&h,10,NULL,0,1,NULL,output,16,&count,&error)==AdrenoHfiSuccess); CHECK(h.sequence==(i+1)%4095); } reset();memcpy(before,shared,sizeof(shared)); CHECK(AdrenoHfiInitializeStopped(&h,shared,16383,0x60000000,&h,notify)==AdrenoHfiInvalid); CHECK(AdrenoHfiInitializeStopped(&h,shared,16384,0xffffd000,&h,notify)==AdrenoHfiInvalid); CHECK(AdrenoHfiInitializeStopped(&h,shared+1,16384,0x60000000,&h,notify)==AdrenoHfiInvalid); CHECK(!memcmp(before,shared,sizeof(shared))); CHECK(AdrenoHfiSend(&h,256,NULL,0,&header)==AdrenoHfiInvalid); CHECK(AdrenoHfiSend(&h,14,input,255,&header)==AdrenoHfiInvalid && !notified); CHECK(AdrenoHfiExchange(&h,14,NULL,0,0,NULL,output,16,&count,&error)==AdrenoHfiInvalid && !notified); printf("PASS: %u modern HFI wrapped command/response cases, 4100 sequence exchanges, padded-space guard, malformed/stale/error/timeout quarantine\n",cases); puts("Software peer only; no actual GMU ACK, firmware startup, MMIO or GPU execution"); } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\test_hfi.c:147 [MATCH: AdrenoHfiInitialize] --- CHECK(waits==2 && count==1 && output[0]==0xfeed0003 && !h.pending_header); reset();auto_reply=1; for(unsigned i=0;i<4100;++i) { /* Software peer consumes the outgoing packet, then produces its ACK. */ shared[16]=shared[17]; CHECK(AdrenoHfiExchange(&h,10,NULL,0,1,NULL,output,16,&count,&error)==AdrenoHfiSuccess); CHECK(h.sequence==(i+1)%4095); } reset();memcpy(before,shared,sizeof(shared)); CHECK(AdrenoHfiInitializeStopped(&h,shared,16383,0x60000000,&h,notify)==AdrenoHfiInvalid); CHECK(AdrenoHfiInitializeStopped(&h,shared,16384,0xffffd000,&h,notify)==AdrenoHfiInvalid); CHECK(AdrenoHfiInitializeStopped(&h,shared+1,16384,0x60000000,&h,notify)==AdrenoHfiInvalid); CHECK(!memcmp(before,shared,sizeof(shared))); CHECK(AdrenoHfiSend(&h,256,NULL,0,&header)==AdrenoHfiInvalid); CHECK(AdrenoHfiSend(&h,14,input,255,&header)==AdrenoHfiInvalid && !notified); CHECK(AdrenoHfiExchange(&h,14,NULL,0,0,NULL,output,16,&count,&error)==AdrenoHfiInvalid && !notified); printf("PASS: %u modern HFI wrapped command/response cases, 4100 sequence exchanges, padded-space guard, malformed/stale/error/timeout quarantine\n",cases); puts("Software peer only; no actual GMU ACK, firmware startup, MMIO or GPU execution"); } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\test_hfi.c:148 [MATCH: AdrenoHfiInitialize] --- reset();auto_reply=1; for(unsigned i=0;i<4100;++i) { /* Software peer consumes the outgoing packet, then produces its ACK. */ shared[16]=shared[17]; CHECK(AdrenoHfiExchange(&h,10,NULL,0,1,NULL,output,16,&count,&error)==AdrenoHfiSuccess); CHECK(h.sequence==(i+1)%4095); } reset();memcpy(before,shared,sizeof(shared)); CHECK(AdrenoHfiInitializeStopped(&h,shared,16383,0x60000000,&h,notify)==AdrenoHfiInvalid); CHECK(AdrenoHfiInitializeStopped(&h,shared,16384,0xffffd000,&h,notify)==AdrenoHfiInvalid); CHECK(AdrenoHfiInitializeStopped(&h,shared+1,16384,0x60000000,&h,notify)==AdrenoHfiInvalid); CHECK(!memcmp(before,shared,sizeof(shared))); CHECK(AdrenoHfiSend(&h,256,NULL,0,&header)==AdrenoHfiInvalid); CHECK(AdrenoHfiSend(&h,14,input,255,&header)==AdrenoHfiInvalid && !notified); CHECK(AdrenoHfiExchange(&h,14,NULL,0,0,NULL,output,16,&count,&error)==AdrenoHfiInvalid && !notified); printf("PASS: %u modern HFI wrapped command/response cases, 4100 sequence exchanges, padded-space guard, malformed/stale/error/timeout quarantine\n",cases); puts("Software peer only; no actual GMU ACK, firmware startup, MMIO or GPU execution"); } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\test_hfi.c:76 [MATCH: AdrenoHfiPoll] --- CHECK(shared[17]==((at+padded)&1023)); #ifdef SOURCE_ORACLE reference[16]=reference[17]=at; uint32_t message[255];message[0]=header;for(unsigned i=0;i1)shared[2048+((at+1)&1023)]=ret; if(count>2)shared[2048+((at+2)&1023)]=error; v[11]=(at+((count+3)&~3u))&1023; } static int notify(void *cookie) { CHECK(cookie==&h);++notified; if(auto_reply)response(4,126,h.pending_header,0); return notify_fail; } static int wait_once(void *cookie) {CHECK(cookie==&h);if(++waits==reply_at)response(4,126,h.pending_header,0);return 0;} static int failed_wait(void *cookie) {CHECK(cookie==&h);++waits;return 1;} static void reset(void) { notified=notify_fail=auto_reply=waits=reply_at=0; memset(&h,0,sizeof(h));memset(shared,0xa5,sizeof(shared)); CHECK(AdrenoHfiInitializeStopped(&h,shared,sizeof(shared),0x60000000,&h,notify)==AdrenoHfiSuccess); CHECK(shared[1]==168 && shared[2]==6 && shared[3]==12 && shared[4]==3 && shared[5]==3); for(unsigned q=0;q<3;++q) { uint32_t *v=shared+6+12*q; CHECK(v[0]==1 && v[1]==0x60000000+(q+1)*4096 && v[2]==(0xa00|q) && v[3]==1024); CHECK(v[4]==0 && v[5]==0 && v[6]==1 && v[7]==1 && v[8]==1 && v[9]==0 && !v[10] && !v[11]); } #ifdef SOURCE_ORACLE memset(reference,0,sizeof(reference));source_initialize(reference,h.iova); CHECK(!memcmp(shared,reference,sizeof(shared))); --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\test_hfi.c:33 [MATCH: pending_header] --- if(count>2)shared[2048+((at+2)&1023)]=error; v[11]=(at+((count+3)&~3u))&1023; } static int notify(void *cookie) { CHECK(cookie==&h);++notified; if(auto_reply)response(4,126,h.pending_header,0); return notify_fail; } static int wait_once(void *cookie) {CHECK(cookie==&h);if(++waits==reply_at)response(4,126,h.pending_header,0);return 0;} static int failed_wait(void *cookie) {CHECK(cookie==&h);++waits;return 1;} static void reset(void) { notified=notify_fail=auto_reply=waits=reply_at=0; memset(&h,0,sizeof(h));memset(shared,0xa5,sizeof(shared)); CHECK(AdrenoHfiInitializeStopped(&h,shared,sizeof(shared),0x60000000,&h,notify)==AdrenoHfiSuccess); CHECK(shared[1]==168 && shared[2]==6 && shared[3]==12 && shared[4]==3 && shared[5]==3); for(unsigned q=0;q<3;++q) { uint32_t *v=shared+6+12*q; CHECK(v[0]==1 && v[1]==0x60000000+(q+1)*4096 && v[2]==(0xa00|q) && v[3]==1024); CHECK(v[4]==0 && v[5]==0 && v[6]==1 && v[7]==1 && v[8]==1 && v[9]==0 && !v[10] && !v[11]); } #ifdef SOURCE_ORACLE memset(reference,0,sizeof(reference));source_initialize(reference,h.iova); CHECK(!memcmp(shared,reference,sizeof(shared))); #endif } static void untouched_output(void) {for(unsigned i=0;i<16;++i)CHECK(output[i]==0x5a5a5a5a);} --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\test_hfi.c:61 [MATCH: pending_header] --- } static void untouched_output(void) {for(unsigned i=0;i<16;++i)CHECK(output[i]==0x5a5a5a5a);} int main(void) { for(unsigned i=0;i<254;++i)input[i]=0xabcdef00+i; size_t count;uint32_t error,header;unsigned cases=0; for(unsigned wrap=0;wrap<2;++wrap)for(unsigned words=0;words<255;++words) { reset();unsigned at=wrap?1020:0;shared[16]=shared[17]=at; CHECK(AdrenoHfiSend(&h,14,input,words,&header)==AdrenoHfiSuccess && notified==1); CHECK(header==((1u<<20)|((words+1)<<8)|14) && h.pending_header==header); CHECK(shared[1024+at]==header); for(unsigned i=0;i #include #include #define CHECK(x) do {if(!(x)){fprintf(stderr,"line %d: %s\n",__LINE__,#x);exit(1);}}while(0) static uint32_t *shared; static AdrenoHfi hfi; static AdrenoHfiStartup state; static AdrenoHfiStartupConfig config; static AdrenoHfiStartupServices services; static AdrenoHfiStartupResult result; static struct { uint64_t time,jump; unsigned count,waits,health_calls,now_calls; unsigned fail_at,mode,clock_fail,clock_reverse,health_fail,wait_fail,clock_stall; unsigned ids[8],words[8];uint32_t messages[8][159]; } peer; #ifdef SOURCE_ORACLE extern int source_startup(const AdrenoHfiStartupConfig *,unsigned,unsigned *,unsigned *,unsigned *,uint32_t [8][159]); #endif static void response(uint32_t command) --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\test_startup.c:10 [MATCH: AdrenoHfiStartup] --- /* SPDX-License-Identifier: BSD-2-Clause-Patent */ /* Software GMU peer only. Original source oracle is compiled outside Git. */ #include "AdrenoHfiStartup.h" #include #include #include #define CHECK(x) do {if(!(x)){fprintf(stderr,"line %d: %s\n",__LINE__,#x);exit(1);}}while(0) static uint32_t *shared; static AdrenoHfi hfi; static AdrenoHfiStartup state; static AdrenoHfiStartupConfig config; static AdrenoHfiStartupServices services; static AdrenoHfiStartupResult result; static struct { uint64_t time,jump; unsigned count,waits,health_calls,now_calls; unsigned fail_at,mode,clock_fail,clock_reverse,health_fail,wait_fail,clock_stall; unsigned ids[8],words[8];uint32_t messages[8][159]; } peer; #ifdef SOURCE_ORACLE extern int source_startup(const AdrenoHfiStartupConfig *,unsigned,unsigned *,unsigned *,unsigned *,uint32_t [8][159]); #endif static void response(uint32_t command) { volatile uint32_t *q=shared+18;unsigned at=q[11]; shared[2048+at]=(3u<<8)|126u; shared[2048+((at+1)&1023)]=command; shared[2048+((at+2)&1023)]=(peer.fail_at==peer.count && peer.mode==1)?37:0; shared[2048+((at+3)&1023)]=0xfafafafa; q[11]=(at+4)&1023; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\test_startup.c:11 [MATCH: AdrenoHfiStartup] --- /* SPDX-License-Identifier: BSD-2-Clause-Patent */ /* Software GMU peer only. Original source oracle is compiled outside Git. */ #include "AdrenoHfiStartup.h" #include #include #include #define CHECK(x) do {if(!(x)){fprintf(stderr,"line %d: %s\n",__LINE__,#x);exit(1);}}while(0) static uint32_t *shared; static AdrenoHfi hfi; static AdrenoHfiStartup state; static AdrenoHfiStartupConfig config; static AdrenoHfiStartupServices services; static AdrenoHfiStartupResult result; static struct { uint64_t time,jump; unsigned count,waits,health_calls,now_calls; unsigned fail_at,mode,clock_fail,clock_reverse,health_fail,wait_fail,clock_stall; unsigned ids[8],words[8];uint32_t messages[8][159]; } peer; #ifdef SOURCE_ORACLE extern int source_startup(const AdrenoHfiStartupConfig *,unsigned,unsigned *,unsigned *,unsigned *,uint32_t [8][159]); #endif static void response(uint32_t command) { volatile uint32_t *q=shared+18;unsigned at=q[11]; shared[2048+at]=(3u<<8)|126u; shared[2048+((at+1)&1023)]=command; shared[2048+((at+2)&1023)]=(peer.fail_at==peer.count && peer.mode==1)?37:0; shared[2048+((at+3)&1023)]=0xfafafafa; q[11]=(at+4)&1023; } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\test_startup.c:12 [MATCH: AdrenoHfiStartup] --- /* Software GMU peer only. Original source oracle is compiled outside Git. */ #include "AdrenoHfiStartup.h" #include #include #include #define CHECK(x) do {if(!(x)){fprintf(stderr,"line %d: %s\n",__LINE__,#x);exit(1);}}while(0) static uint32_t *shared; static AdrenoHfi hfi; static AdrenoHfiStartup state; static AdrenoHfiStartupConfig config; static AdrenoHfiStartupServices services; static AdrenoHfiStartupResult result; static struct { uint64_t time,jump; unsigned count,waits,health_calls,now_calls; unsigned fail_at,mode,clock_fail,clock_reverse,health_fail,wait_fail,clock_stall; unsigned ids[8],words[8];uint32_t messages[8][159]; } peer; #ifdef SOURCE_ORACLE extern int source_startup(const AdrenoHfiStartupConfig *,unsigned,unsigned *,unsigned *,unsigned *,uint32_t [8][159]); #endif static void response(uint32_t command) { volatile uint32_t *q=shared+18;unsigned at=q[11]; shared[2048+at]=(3u<<8)|126u; shared[2048+((at+1)&1023)]=command; shared[2048+((at+2)&1023)]=(peer.fail_at==peer.count && peer.mode==1)?37:0; shared[2048+((at+3)&1023)]=0xfafafafa; q[11]=(at+4)&1023; } static int notify(void *cookie) --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\test_startup.c:13 [MATCH: AdrenoHfiStartup] --- #include "AdrenoHfiStartup.h" #include #include #include #define CHECK(x) do {if(!(x)){fprintf(stderr,"line %d: %s\n",__LINE__,#x);exit(1);}}while(0) static uint32_t *shared; static AdrenoHfi hfi; static AdrenoHfiStartup state; static AdrenoHfiStartupConfig config; static AdrenoHfiStartupServices services; static AdrenoHfiStartupResult result; static struct { uint64_t time,jump; unsigned count,waits,health_calls,now_calls; unsigned fail_at,mode,clock_fail,clock_reverse,health_fail,wait_fail,clock_stall; unsigned ids[8],words[8];uint32_t messages[8][159]; } peer; #ifdef SOURCE_ORACLE extern int source_startup(const AdrenoHfiStartupConfig *,unsigned,unsigned *,unsigned *,unsigned *,uint32_t [8][159]); #endif static void response(uint32_t command) { volatile uint32_t *q=shared+18;unsigned at=q[11]; shared[2048+at]=(3u<<8)|126u; shared[2048+((at+1)&1023)]=command; shared[2048+((at+2)&1023)]=(peer.fail_at==peer.count && peer.mode==1)?37:0; shared[2048+((at+3)&1023)]=0xfafafafa; q[11]=(at+4)&1023; } static int notify(void *cookie) { --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\test_startup.c:21 [MATCH: AdrenoHfiStartup] --- static AdrenoHfiStartupConfig config; static AdrenoHfiStartupServices services; static AdrenoHfiStartupResult result; static struct { uint64_t time,jump; unsigned count,waits,health_calls,now_calls; unsigned fail_at,mode,clock_fail,clock_reverse,health_fail,wait_fail,clock_stall; unsigned ids[8],words[8];uint32_t messages[8][159]; } peer; #ifdef SOURCE_ORACLE extern int source_startup(const AdrenoHfiStartupConfig *,unsigned,unsigned *,unsigned *,unsigned *,uint32_t [8][159]); #endif static void response(uint32_t command) { volatile uint32_t *q=shared+18;unsigned at=q[11]; shared[2048+at]=(3u<<8)|126u; shared[2048+((at+1)&1023)]=command; shared[2048+((at+2)&1023)]=(peer.fail_at==peer.count && peer.mode==1)?37:0; shared[2048+((at+3)&1023)]=0xfafafafa; q[11]=(at+4)&1023; } static int notify(void *cookie) { CHECK(cookie==&peer && peer.count<8); unsigned at=shared[16];uint32_t header=shared[1024+at];unsigned n=(header>>8)&255; unsigned index=peer.count++;peer.ids[index]=header&255;peer.words[index]=n-1; for(unsigned i=1;i=3))response(header); peer.time+=peer.jump; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\test_startup.c:64 [MATCH: AdrenoHfiStartup] --- if(peer.wait_fail)return 1; if(!peer.clock_stall)peer.time+=us; return 0; } static int health(void *cookie) {CHECK(cookie==&peer);return ++peer.health_calls==peer.health_fail;} static void setup(unsigned acd,unsigned ifpc) { memset(&peer,0,sizeof(peer));peer.time=1000; CHECK(AdrenoHfiInitializeStopped(&hfi,shared,16384,0x61004000,&peer,notify)==AdrenoHfiSuccess); state=(AdrenoHfiStartup){0};config=(AdrenoHfiStartupConfig){0}; config.gpu_count=4;config.gmu_count=3; for(unsigned i=0;i<4;++i)config.gpu[i]=(AdrenoHfiPerformanceLevel){i*100000000ULL,i*3}; for(unsigned i=0;i<3;++i)config.gmu[i]=(AdrenoHfiPerformanceLevel){i*200000000ULL,i*4}; config.bandwidth_count=3;config.cnoc_count=2;config.ddr_count=3; config.cnoc_wait_mask=3;config.ddr_wait_mask=7; for(unsigned i=0;i<2;++i) { config.cnoc_addresses[i]=0x1000+4*i; // deliberate software fixture addresses, not board facts config.cnoc_data[0][i]=0x40000000;config.cnoc_data[1][i]=0x60000001; } for(unsigned i=0;i<3;++i) { config.ddr_addresses[i]=0x2000+4*i; for(unsigned j=0;j<3;++j)config.ddr_data[j][i]=0x40000000+i+j; } if(acd) {config.acd_version=1;config.acd_enable_mask=10;config.acd_stride=1;config.acd_count=2;config.acd_data[0]=41;config.acd_data[1]=99;} config.enable_ifpc=ifpc; services=(AdrenoHfiStartupServices){&peer,now,wait_us,health,5,10,100,500}; } static AdrenoHfiStartupStatus run(void) {return AdrenoHfiStartupRun(&state,&hfi,&config,&services,&result);} static void refused(void) --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\test_startup.c:80 [MATCH: AdrenoHfiStartup] --- for(unsigned i=0;i<2;++i) { config.cnoc_addresses[i]=0x1000+4*i; // deliberate software fixture addresses, not board facts config.cnoc_data[0][i]=0x40000000;config.cnoc_data[1][i]=0x60000001; } for(unsigned i=0;i<3;++i) { config.ddr_addresses[i]=0x2000+4*i; for(unsigned j=0;j<3;++j)config.ddr_data[j][i]=0x40000000+i+j; } if(acd) {config.acd_version=1;config.acd_enable_mask=10;config.acd_stride=1;config.acd_count=2;config.acd_data[0]=41;config.acd_data[1]=99;} config.enable_ifpc=ifpc; services=(AdrenoHfiStartupServices){&peer,now,wait_us,health,5,10,100,500}; } static AdrenoHfiStartupStatus run(void) {return AdrenoHfiStartupRun(&state,&hfi,&config,&services,&result);} static void refused(void) { uint32_t before[4096];memcpy(before,shared,sizeof(before)); CHECK(run()==AdrenoHfiStartupInvalid && !state.attempted && !peer.count); CHECK(!memcmp(before,shared,sizeof(before)) && result.resources_must_retain); } int main(void) { CHECK(!posix_memalign((void **)&shared,4096,16384)); unsigned cases=0; for(unsigned acd=0;acd<2;++acd)for(unsigned ifpc=0;ifpc<2;++ifpc) { setup(acd,ifpc);CHECK(run()==AdrenoHfiStartupSuccess); unsigned count=4+2*acd+ifpc;CHECK(peer.count==count && state.completed && !state.poisoned); CHECK(result.stage==AdrenoHfiStageComplete && result.published_commands==count && result.resources_must_retain); #ifdef SOURCE_ORACLE unsigned expected_count=0,ids[8]={0},words[8]={0};uint32_t messages[8][159]={{0}}; CHECK(!source_startup(&config,0,&expected_count,ids,words,messages)); --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\test_startup.c:82 [MATCH: AdrenoHfiStartup] --- config.cnoc_data[0][i]=0x40000000;config.cnoc_data[1][i]=0x60000001; } for(unsigned i=0;i<3;++i) { config.ddr_addresses[i]=0x2000+4*i; for(unsigned j=0;j<3;++j)config.ddr_data[j][i]=0x40000000+i+j; } if(acd) {config.acd_version=1;config.acd_enable_mask=10;config.acd_stride=1;config.acd_count=2;config.acd_data[0]=41;config.acd_data[1]=99;} config.enable_ifpc=ifpc; services=(AdrenoHfiStartupServices){&peer,now,wait_us,health,5,10,100,500}; } static AdrenoHfiStartupStatus run(void) {return AdrenoHfiStartupRun(&state,&hfi,&config,&services,&result);} static void refused(void) { uint32_t before[4096];memcpy(before,shared,sizeof(before)); CHECK(run()==AdrenoHfiStartupInvalid && !state.attempted && !peer.count); CHECK(!memcmp(before,shared,sizeof(before)) && result.resources_must_retain); } int main(void) { CHECK(!posix_memalign((void **)&shared,4096,16384)); unsigned cases=0; for(unsigned acd=0;acd<2;++acd)for(unsigned ifpc=0;ifpc<2;++ifpc) { setup(acd,ifpc);CHECK(run()==AdrenoHfiStartupSuccess); unsigned count=4+2*acd+ifpc;CHECK(peer.count==count && state.completed && !state.poisoned); CHECK(result.stage==AdrenoHfiStageComplete && result.published_commands==count && result.resources_must_retain); #ifdef SOURCE_ORACLE unsigned expected_count=0,ids[8]={0},words[8]={0};uint32_t messages[8][159]={{0}}; CHECK(!source_startup(&config,0,&expected_count,ids,words,messages)); CHECK(expected_count==count); for(unsigned i=0;i>17;seed^=seed<<5;return seed;} static void put16(uint8_t *p,unsigned n){p[0]=(uint8_t)n;p[1]=(uint8_t)(n>>8);} static void arc_tests(void) { uint8_t primary[513]={0},secondary[513]={0};uint32_t levels[16]={0},votes[16],expected[16]; /* Unaligned original aux data, duplicated levels, trailing zero padding, * secondary fallback and maximum representable 8-bit rail index. */ for(unsigned i=1;i<256;++i)put16(primary+1+2*i,i*257); put16(secondary+3,128);put16(secondary+5,500); for(unsigned run=0;run<1000;++run) { unsigned count=1+random32()%16;levels[0]=0; for(unsigned i=1;i #include #include static _Alignas(4096) uint32_t shared[4096], before[4096]; static AdrenoHfi h; static unsigned notifications, fail_notify, reply_immediately; static void reply(unsigned words, uint32_t sequence, uint32_t error) { uint32_t *queue = shared + 18; unsigned at = queue[11]; shared[2048 + at] = (2u << 16) | ((words + 3) << 8) | 126; shared[2048 + ((at + 1) & 1023)] = sequence; shared[2048 + ((at + 2) & 1023)] = error; for (unsigned index = 0; index < words; ++index) shared[2048 + ((at + 3 + index) & 1023)] = 0xabc00000 + index; queue[11] = (at + 3 + words) & 1023; } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\tests\test_hfi_legacy.c:134 [MATCH: AdrenoHfiStartup] --- reset(); assert(AdrenoHfiExchange(&h, 1, NULL, 0, 2, NULL, output, 16, &returned, &error) == AdrenoHfiTimeout); assert(h.poisoned && notifications == 1); reset(); reply_immediately = 1; for (unsigned index = 0; index < 4100; ++index) { shared[16] = shared[17]; assert(AdrenoHfiExchange(&h, 1, NULL, 0, 1, NULL, output, 16, &returned, &error) == AdrenoHfiSuccess); assert(h.sequence == (index + 1) % 4095); } reset(); AdrenoHfiStartup state = {0}; AdrenoHfiStartupResult result; assert(AdrenoHfiStartupRun(&state, &h, NULL, NULL, &result) == AdrenoHfiStartupInvalid); assert(!notifications && !state.attempted && !h.pending_header); assert(cases == 2295); printf("PASS: %u legacy HFI ring/response cases, 4100 sequence exchanges, failure quarantine\n", cases); puts("Software peer only; no real firmware ACK or GPU execution"); return 0; } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\tests\test_hfi_legacy.c:135 [MATCH: AdrenoHfiStartup] --- assert(AdrenoHfiExchange(&h, 1, NULL, 0, 2, NULL, output, 16, &returned, &error) == AdrenoHfiTimeout); assert(h.poisoned && notifications == 1); reset(); reply_immediately = 1; for (unsigned index = 0; index < 4100; ++index) { shared[16] = shared[17]; assert(AdrenoHfiExchange(&h, 1, NULL, 0, 1, NULL, output, 16, &returned, &error) == AdrenoHfiSuccess); assert(h.sequence == (index + 1) % 4095); } reset(); AdrenoHfiStartup state = {0}; AdrenoHfiStartupResult result; assert(AdrenoHfiStartupRun(&state, &h, NULL, NULL, &result) == AdrenoHfiStartupInvalid); assert(!notifications && !state.attempted && !h.pending_header); assert(cases == 2295); printf("PASS: %u legacy HFI ring/response cases, 4100 sequence exchanges, failure quarantine\n", cases); puts("Software peer only; no real firmware ACK or GPU execution"); return 0; } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\tests\test_hfi_legacy.c:136 [MATCH: AdrenoHfiStartup] --- assert(h.poisoned && notifications == 1); reset(); reply_immediately = 1; for (unsigned index = 0; index < 4100; ++index) { shared[16] = shared[17]; assert(AdrenoHfiExchange(&h, 1, NULL, 0, 1, NULL, output, 16, &returned, &error) == AdrenoHfiSuccess); assert(h.sequence == (index + 1) % 4095); } reset(); AdrenoHfiStartup state = {0}; AdrenoHfiStartupResult result; assert(AdrenoHfiStartupRun(&state, &h, NULL, NULL, &result) == AdrenoHfiStartupInvalid); assert(!notifications && !state.attempted && !h.pending_header); assert(cases == 2295); printf("PASS: %u legacy HFI ring/response cases, 4100 sequence exchanges, failure quarantine\n", cases); puts("Software peer only; no real firmware ACK or GPU execution"); return 0; } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\tests\test_hfi_legacy.c:77 [MATCH: AdrenoHfiPoll] --- assert(shared[1024 + at] == header); for (unsigned index = 0; index < words; ++index) assert(shared[1024 + ((at + 1 + index) & 1023)] == input[index]); assert(shared[17] == ((at + words + 1) & 1023)); // The next word is not modern-protocol padding. assert(shared[1024 + shared[17]] == 0); shared[28] = shared[29] = at; const unsigned response_words = words % 17; reply(response_words, header, 0); memset(output, 0x5a, sizeof(output)); assert(AdrenoHfiPoll(&h, output, 16, &returned, &error) == AdrenoHfiSuccess); assert(returned == response_words && !error && !h.pending_header && !h.poisoned); assert(shared[28] == ((at + 3 + response_words) & 1023)); for (unsigned index = 0; index < 16; ++index) assert(output[index] == (index < returned ? 0xabc00000 + index : 0x5a5a5a5a)); ++cases; } } reset(); shared[16] = 1; memcpy(before, shared, sizeof(shared)); assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiNoSpace); assert(!memcmp(shared, before, sizeof(shared)) && !notifications); reset(); shared[16] = 2; assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiSuccess && shared[17] == 1); reset(); fail_notify = 1; assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiNotifyError); assert(h.poisoned && h.pending_header && shared[17] == 1); assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiPoisoned && notifications == 1); for (unsigned fault = 0; fault < 7; ++fault) { --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\tests\test_hfi_legacy.c:111 [MATCH: AdrenoHfiPoll] --- switch (fault) { case 0: shared[1] = 168; break; case 1: shared[4] = 3; break; case 2: shared[20] = 0xa01; break; case 3: shared[28] = 1024; break; case 4: shared[2048] = (4u << 8) | 126; break; // incomplete case 5: shared[2048] &= ~0xff00u; break; case 6: h.legacy = 2; break; } memset(output, 0x5a, sizeof(output)); assert(AdrenoHfiPoll(&h, output, 16, &returned, &error) == AdrenoHfiCorrupt); assert(h.poisoned && h.pending_header && returned == 0); for (unsigned index = 0; index < 16; ++index) assert(output[index] == 0x5a5a5a5a); } reset(); assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiSuccess); reply(0, header + (1u << 20), 0); reply(0, header, 0); assert(AdrenoHfiPoll(&h, output, 16, &returned, &error) == AdrenoHfiSuccess && h.skipped == 1); reset(); assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiSuccess); reply(0, header, 7); assert(AdrenoHfiPoll(&h, output, 16, &returned, &error) == AdrenoHfiFirmwareError && error == 7); reset(); assert(AdrenoHfiExchange(&h, 1, NULL, 0, 2, NULL, output, 16, &returned, &error) == AdrenoHfiTimeout); assert(h.poisoned && notifications == 1); reset(); reply_immediately = 1; for (unsigned index = 0; index < 4100; ++index) { shared[16] = shared[17]; assert(AdrenoHfiExchange(&h, 1, NULL, 0, 1, NULL, output, 16, &returned, &error) == AdrenoHfiSuccess); assert(h.sequence == (index + 1) % 4095); --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\tests\test_hfi_legacy.c:119 [MATCH: AdrenoHfiPoll] --- } memset(output, 0x5a, sizeof(output)); assert(AdrenoHfiPoll(&h, output, 16, &returned, &error) == AdrenoHfiCorrupt); assert(h.poisoned && h.pending_header && returned == 0); for (unsigned index = 0; index < 16; ++index) assert(output[index] == 0x5a5a5a5a); } reset(); assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiSuccess); reply(0, header + (1u << 20), 0); reply(0, header, 0); assert(AdrenoHfiPoll(&h, output, 16, &returned, &error) == AdrenoHfiSuccess && h.skipped == 1); reset(); assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiSuccess); reply(0, header, 7); assert(AdrenoHfiPoll(&h, output, 16, &returned, &error) == AdrenoHfiFirmwareError && error == 7); reset(); assert(AdrenoHfiExchange(&h, 1, NULL, 0, 2, NULL, output, 16, &returned, &error) == AdrenoHfiTimeout); assert(h.poisoned && notifications == 1); reset(); reply_immediately = 1; for (unsigned index = 0; index < 4100; ++index) { shared[16] = shared[17]; assert(AdrenoHfiExchange(&h, 1, NULL, 0, 1, NULL, output, 16, &returned, &error) == AdrenoHfiSuccess); assert(h.sequence == (index + 1) % 4095); } reset(); AdrenoHfiStartup state = {0}; AdrenoHfiStartupResult result; assert(AdrenoHfiStartupRun(&state, &h, NULL, NULL, &result) == AdrenoHfiStartupInvalid); assert(!notifications && !state.attempted && !h.pending_header); assert(cases == 2295); printf("PASS: %u legacy HFI ring/response cases, 4100 sequence exchanges, failure quarantine\n", cases); --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\tests\test_hfi_legacy.c:123 [MATCH: AdrenoHfiPoll] --- for (unsigned index = 0; index < 16; ++index) assert(output[index] == 0x5a5a5a5a); } reset(); assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiSuccess); reply(0, header + (1u << 20), 0); reply(0, header, 0); assert(AdrenoHfiPoll(&h, output, 16, &returned, &error) == AdrenoHfiSuccess && h.skipped == 1); reset(); assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiSuccess); reply(0, header, 7); assert(AdrenoHfiPoll(&h, output, 16, &returned, &error) == AdrenoHfiFirmwareError && error == 7); reset(); assert(AdrenoHfiExchange(&h, 1, NULL, 0, 2, NULL, output, 16, &returned, &error) == AdrenoHfiTimeout); assert(h.poisoned && notifications == 1); reset(); reply_immediately = 1; for (unsigned index = 0; index < 4100; ++index) { shared[16] = shared[17]; assert(AdrenoHfiExchange(&h, 1, NULL, 0, 1, NULL, output, 16, &returned, &error) == AdrenoHfiSuccess); assert(h.sequence == (index + 1) % 4095); } reset(); AdrenoHfiStartup state = {0}; AdrenoHfiStartupResult result; assert(AdrenoHfiStartupRun(&state, &h, NULL, NULL, &result) == AdrenoHfiStartupInvalid); assert(!notifications && !state.attempted && !h.pending_header); assert(cases == 2295); printf("PASS: %u legacy HFI ring/response cases, 4100 sequence exchanges, failure quarantine\n", cases); puts("Software peer only; no real firmware ACK or GPU execution"); return 0; } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\tests\test_hfi_legacy.c:65 [MATCH: AdrenoHfiSend] --- } for (unsigned index = 30; index < 4096; ++index) assert(!shared[index]); unsigned cases = 0; const unsigned positions[] = {0, 1, 2, 3, 1019, 1020, 1021, 1022, 1023}; for (unsigned position = 0; position < sizeof(positions) / sizeof(positions[0]); ++position) { for (unsigned words = 0; words < 255; ++words) { reset(); unsigned at = positions[position]; shared[16] = shared[17] = at; assert(AdrenoHfiSend(&h, 1, input, words, &header) == AdrenoHfiSuccess); assert(notifications == 1 && header == (0x100000 | ((words + 1) << 8) | 1)); assert(shared[1024 + at] == header); for (unsigned index = 0; index < words; ++index) assert(shared[1024 + ((at + 1 + index) & 1023)] == input[index]); assert(shared[17] == ((at + words + 1) & 1023)); // The next word is not modern-protocol padding. assert(shared[1024 + shared[17]] == 0); shared[28] = shared[29] = at; const unsigned response_words = words % 17; reply(response_words, header, 0); memset(output, 0x5a, sizeof(output)); assert(AdrenoHfiPoll(&h, output, 16, &returned, &error) == AdrenoHfiSuccess); assert(returned == response_words && !error && !h.pending_header && !h.poisoned); assert(shared[28] == ((at + 3 + response_words) & 1023)); for (unsigned index = 0; index < 16; ++index) assert(output[index] == (index < returned ? 0xabc00000 + index : 0x5a5a5a5a)); ++cases; } } reset(); shared[16] = 1; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\tests\test_hfi_legacy.c:87 [MATCH: AdrenoHfiSend] --- assert(AdrenoHfiPoll(&h, output, 16, &returned, &error) == AdrenoHfiSuccess); assert(returned == response_words && !error && !h.pending_header && !h.poisoned); assert(shared[28] == ((at + 3 + response_words) & 1023)); for (unsigned index = 0; index < 16; ++index) assert(output[index] == (index < returned ? 0xabc00000 + index : 0x5a5a5a5a)); ++cases; } } reset(); shared[16] = 1; memcpy(before, shared, sizeof(shared)); assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiNoSpace); assert(!memcmp(shared, before, sizeof(shared)) && !notifications); reset(); shared[16] = 2; assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiSuccess && shared[17] == 1); reset(); fail_notify = 1; assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiNotifyError); assert(h.poisoned && h.pending_header && shared[17] == 1); assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiPoisoned && notifications == 1); for (unsigned fault = 0; fault < 7; ++fault) { reset(); assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiSuccess); reply(0, header, 0); switch (fault) { case 0: shared[1] = 168; break; case 1: shared[4] = 3; break; case 2: shared[20] = 0xa01; break; case 3: shared[28] = 1024; break; case 4: shared[2048] = (4u << 8) | 126; break; // incomplete case 5: shared[2048] &= ~0xff00u; break; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\tests\test_hfi_legacy.c:90 [MATCH: AdrenoHfiSend] --- for (unsigned index = 0; index < 16; ++index) assert(output[index] == (index < returned ? 0xabc00000 + index : 0x5a5a5a5a)); ++cases; } } reset(); shared[16] = 1; memcpy(before, shared, sizeof(shared)); assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiNoSpace); assert(!memcmp(shared, before, sizeof(shared)) && !notifications); reset(); shared[16] = 2; assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiSuccess && shared[17] == 1); reset(); fail_notify = 1; assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiNotifyError); assert(h.poisoned && h.pending_header && shared[17] == 1); assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiPoisoned && notifications == 1); for (unsigned fault = 0; fault < 7; ++fault) { reset(); assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiSuccess); reply(0, header, 0); switch (fault) { case 0: shared[1] = 168; break; case 1: shared[4] = 3; break; case 2: shared[20] = 0xa01; break; case 3: shared[28] = 1024; break; case 4: shared[2048] = (4u << 8) | 126; break; // incomplete case 5: shared[2048] &= ~0xff00u; break; case 6: h.legacy = 2; break; } memset(output, 0x5a, sizeof(output)); --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\tests\test_hfi_legacy.c:93 [MATCH: AdrenoHfiSend] --- } } reset(); shared[16] = 1; memcpy(before, shared, sizeof(shared)); assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiNoSpace); assert(!memcmp(shared, before, sizeof(shared)) && !notifications); reset(); shared[16] = 2; assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiSuccess && shared[17] == 1); reset(); fail_notify = 1; assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiNotifyError); assert(h.poisoned && h.pending_header && shared[17] == 1); assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiPoisoned && notifications == 1); for (unsigned fault = 0; fault < 7; ++fault) { reset(); assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiSuccess); reply(0, header, 0); switch (fault) { case 0: shared[1] = 168; break; case 1: shared[4] = 3; break; case 2: shared[20] = 0xa01; break; case 3: shared[28] = 1024; break; case 4: shared[2048] = (4u << 8) | 126; break; // incomplete case 5: shared[2048] &= ~0xff00u; break; case 6: h.legacy = 2; break; } memset(output, 0x5a, sizeof(output)); assert(AdrenoHfiPoll(&h, output, 16, &returned, &error) == AdrenoHfiCorrupt); assert(h.poisoned && h.pending_header && returned == 0); for (unsigned index = 0; index < 16; ++index) assert(output[index] == 0x5a5a5a5a); --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\tests\test_hfi_legacy.c:95 [MATCH: AdrenoHfiSend] --- reset(); shared[16] = 1; memcpy(before, shared, sizeof(shared)); assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiNoSpace); assert(!memcmp(shared, before, sizeof(shared)) && !notifications); reset(); shared[16] = 2; assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiSuccess && shared[17] == 1); reset(); fail_notify = 1; assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiNotifyError); assert(h.poisoned && h.pending_header && shared[17] == 1); assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiPoisoned && notifications == 1); for (unsigned fault = 0; fault < 7; ++fault) { reset(); assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiSuccess); reply(0, header, 0); switch (fault) { case 0: shared[1] = 168; break; case 1: shared[4] = 3; break; case 2: shared[20] = 0xa01; break; case 3: shared[28] = 1024; break; case 4: shared[2048] = (4u << 8) | 126; break; // incomplete case 5: shared[2048] &= ~0xff00u; break; case 6: h.legacy = 2; break; } memset(output, 0x5a, sizeof(output)); assert(AdrenoHfiPoll(&h, output, 16, &returned, &error) == AdrenoHfiCorrupt); assert(h.poisoned && h.pending_header && returned == 0); for (unsigned index = 0; index < 16; ++index) assert(output[index] == 0x5a5a5a5a); } reset(); --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\tests\test_hfi_legacy.c:99 [MATCH: AdrenoHfiSend] --- reset(); shared[16] = 2; assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiSuccess && shared[17] == 1); reset(); fail_notify = 1; assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiNotifyError); assert(h.poisoned && h.pending_header && shared[17] == 1); assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiPoisoned && notifications == 1); for (unsigned fault = 0; fault < 7; ++fault) { reset(); assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiSuccess); reply(0, header, 0); switch (fault) { case 0: shared[1] = 168; break; case 1: shared[4] = 3; break; case 2: shared[20] = 0xa01; break; case 3: shared[28] = 1024; break; case 4: shared[2048] = (4u << 8) | 126; break; // incomplete case 5: shared[2048] &= ~0xff00u; break; case 6: h.legacy = 2; break; } memset(output, 0x5a, sizeof(output)); assert(AdrenoHfiPoll(&h, output, 16, &returned, &error) == AdrenoHfiCorrupt); assert(h.poisoned && h.pending_header && returned == 0); for (unsigned index = 0; index < 16; ++index) assert(output[index] == 0x5a5a5a5a); } reset(); assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiSuccess); reply(0, header + (1u << 20), 0); reply(0, header, 0); assert(AdrenoHfiPoll(&h, output, 16, &returned, &error) == AdrenoHfiSuccess && h.skipped == 1); --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\tests\test_hfi_legacy.c:116 [MATCH: AdrenoHfiSend] --- case 4: shared[2048] = (4u << 8) | 126; break; // incomplete case 5: shared[2048] &= ~0xff00u; break; case 6: h.legacy = 2; break; } memset(output, 0x5a, sizeof(output)); assert(AdrenoHfiPoll(&h, output, 16, &returned, &error) == AdrenoHfiCorrupt); assert(h.poisoned && h.pending_header && returned == 0); for (unsigned index = 0; index < 16; ++index) assert(output[index] == 0x5a5a5a5a); } reset(); assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiSuccess); reply(0, header + (1u << 20), 0); reply(0, header, 0); assert(AdrenoHfiPoll(&h, output, 16, &returned, &error) == AdrenoHfiSuccess && h.skipped == 1); reset(); assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiSuccess); reply(0, header, 7); assert(AdrenoHfiPoll(&h, output, 16, &returned, &error) == AdrenoHfiFirmwareError && error == 7); reset(); assert(AdrenoHfiExchange(&h, 1, NULL, 0, 2, NULL, output, 16, &returned, &error) == AdrenoHfiTimeout); assert(h.poisoned && notifications == 1); reset(); reply_immediately = 1; for (unsigned index = 0; index < 4100; ++index) { shared[16] = shared[17]; assert(AdrenoHfiExchange(&h, 1, NULL, 0, 1, NULL, output, 16, &returned, &error) == AdrenoHfiSuccess); assert(h.sequence == (index + 1) % 4095); } reset(); AdrenoHfiStartup state = {0}; AdrenoHfiStartupResult result; assert(AdrenoHfiStartupRun(&state, &h, NULL, NULL, &result) == AdrenoHfiStartupInvalid); --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\tests\test_hfi_legacy.c:121 [MATCH: AdrenoHfiSend] --- assert(AdrenoHfiPoll(&h, output, 16, &returned, &error) == AdrenoHfiCorrupt); assert(h.poisoned && h.pending_header && returned == 0); for (unsigned index = 0; index < 16; ++index) assert(output[index] == 0x5a5a5a5a); } reset(); assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiSuccess); reply(0, header + (1u << 20), 0); reply(0, header, 0); assert(AdrenoHfiPoll(&h, output, 16, &returned, &error) == AdrenoHfiSuccess && h.skipped == 1); reset(); assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiSuccess); reply(0, header, 7); assert(AdrenoHfiPoll(&h, output, 16, &returned, &error) == AdrenoHfiFirmwareError && error == 7); reset(); assert(AdrenoHfiExchange(&h, 1, NULL, 0, 2, NULL, output, 16, &returned, &error) == AdrenoHfiTimeout); assert(h.poisoned && notifications == 1); reset(); reply_immediately = 1; for (unsigned index = 0; index < 4100; ++index) { shared[16] = shared[17]; assert(AdrenoHfiExchange(&h, 1, NULL, 0, 1, NULL, output, 16, &returned, &error) == AdrenoHfiSuccess); assert(h.sequence == (index + 1) % 4095); } reset(); AdrenoHfiStartup state = {0}; AdrenoHfiStartupResult result; assert(AdrenoHfiStartupRun(&state, &h, NULL, NULL, &result) == AdrenoHfiStartupInvalid); assert(!notifications && !state.attempted && !h.pending_header); assert(cases == 2295); printf("PASS: %u legacy HFI ring/response cases, 4100 sequence exchanges, failure quarantine\n", cases); puts("Software peer only; no real firmware ACK or GPU execution"); return 0; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\tests\test_hfi_legacy.c:29 [MATCH: pending_header] --- shared[2048 + ((at + 2) & 1023)] = error; for (unsigned index = 0; index < words; ++index) shared[2048 + ((at + 3 + index) & 1023)] = 0xabc00000 + index; queue[11] = (at + 3 + words) & 1023; } static int notify(void *cookie) { assert(cookie == &h); ++notifications; if (reply_immediately) reply(0, h.pending_header, 0); return fail_notify; } static void reset(void) { notifications = fail_notify = reply_immediately = 0; memset(&h, 0, sizeof(h)); memset(shared, 0xa5, sizeof(shared)); assert(AdrenoHfiInitializeLegacyStopped(&h, shared, sizeof(shared), 0x60009000, &h, notify) == AdrenoHfiSuccess); assert(h.legacy == 1); } int main(void) { uint32_t input[254], output[16], header, error; size_t returned; for (unsigned index = 0; index < 254; ++index) input[index] = 0xdead0000 + index; reset(); const uint32_t table[] = {0, 120, 6, 12, 2, 2}; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\tests\test_hfi_legacy.c:78 [MATCH: pending_header] --- for (unsigned index = 0; index < words; ++index) assert(shared[1024 + ((at + 1 + index) & 1023)] == input[index]); assert(shared[17] == ((at + words + 1) & 1023)); // The next word is not modern-protocol padding. assert(shared[1024 + shared[17]] == 0); shared[28] = shared[29] = at; const unsigned response_words = words % 17; reply(response_words, header, 0); memset(output, 0x5a, sizeof(output)); assert(AdrenoHfiPoll(&h, output, 16, &returned, &error) == AdrenoHfiSuccess); assert(returned == response_words && !error && !h.pending_header && !h.poisoned); assert(shared[28] == ((at + 3 + response_words) & 1023)); for (unsigned index = 0; index < 16; ++index) assert(output[index] == (index < returned ? 0xabc00000 + index : 0x5a5a5a5a)); ++cases; } } reset(); shared[16] = 1; memcpy(before, shared, sizeof(shared)); assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiNoSpace); assert(!memcmp(shared, before, sizeof(shared)) && !notifications); reset(); shared[16] = 2; assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiSuccess && shared[17] == 1); reset(); fail_notify = 1; assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiNotifyError); assert(h.poisoned && h.pending_header && shared[17] == 1); assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiPoisoned && notifications == 1); for (unsigned fault = 0; fault < 7; ++fault) { reset(); --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\tests\test_hfi_legacy.c:94 [MATCH: pending_header] --- } reset(); shared[16] = 1; memcpy(before, shared, sizeof(shared)); assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiNoSpace); assert(!memcmp(shared, before, sizeof(shared)) && !notifications); reset(); shared[16] = 2; assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiSuccess && shared[17] == 1); reset(); fail_notify = 1; assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiNotifyError); assert(h.poisoned && h.pending_header && shared[17] == 1); assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiPoisoned && notifications == 1); for (unsigned fault = 0; fault < 7; ++fault) { reset(); assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiSuccess); reply(0, header, 0); switch (fault) { case 0: shared[1] = 168; break; case 1: shared[4] = 3; break; case 2: shared[20] = 0xa01; break; case 3: shared[28] = 1024; break; case 4: shared[2048] = (4u << 8) | 126; break; // incomplete case 5: shared[2048] &= ~0xff00u; break; case 6: h.legacy = 2; break; } memset(output, 0x5a, sizeof(output)); assert(AdrenoHfiPoll(&h, output, 16, &returned, &error) == AdrenoHfiCorrupt); assert(h.poisoned && h.pending_header && returned == 0); for (unsigned index = 0; index < 16; ++index) assert(output[index] == 0x5a5a5a5a); } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\tests\test_hfi_legacy.c:112 [MATCH: pending_header] --- case 0: shared[1] = 168; break; case 1: shared[4] = 3; break; case 2: shared[20] = 0xa01; break; case 3: shared[28] = 1024; break; case 4: shared[2048] = (4u << 8) | 126; break; // incomplete case 5: shared[2048] &= ~0xff00u; break; case 6: h.legacy = 2; break; } memset(output, 0x5a, sizeof(output)); assert(AdrenoHfiPoll(&h, output, 16, &returned, &error) == AdrenoHfiCorrupt); assert(h.poisoned && h.pending_header && returned == 0); for (unsigned index = 0; index < 16; ++index) assert(output[index] == 0x5a5a5a5a); } reset(); assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiSuccess); reply(0, header + (1u << 20), 0); reply(0, header, 0); assert(AdrenoHfiPoll(&h, output, 16, &returned, &error) == AdrenoHfiSuccess && h.skipped == 1); reset(); assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiSuccess); reply(0, header, 7); assert(AdrenoHfiPoll(&h, output, 16, &returned, &error) == AdrenoHfiFirmwareError && error == 7); reset(); assert(AdrenoHfiExchange(&h, 1, NULL, 0, 2, NULL, output, 16, &returned, &error) == AdrenoHfiTimeout); assert(h.poisoned && notifications == 1); reset(); reply_immediately = 1; for (unsigned index = 0; index < 4100; ++index) { shared[16] = shared[17]; assert(AdrenoHfiExchange(&h, 1, NULL, 0, 1, NULL, output, 16, &returned, &error) == AdrenoHfiSuccess); assert(h.sequence == (index + 1) % 4095); } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\tests\test_hfi_legacy.c:137 [MATCH: pending_header] --- reset(); reply_immediately = 1; for (unsigned index = 0; index < 4100; ++index) { shared[16] = shared[17]; assert(AdrenoHfiExchange(&h, 1, NULL, 0, 1, NULL, output, 16, &returned, &error) == AdrenoHfiSuccess); assert(h.sequence == (index + 1) % 4095); } reset(); AdrenoHfiStartup state = {0}; AdrenoHfiStartupResult result; assert(AdrenoHfiStartupRun(&state, &h, NULL, NULL, &result) == AdrenoHfiStartupInvalid); assert(!notifications && !state.attempted && !h.pending_header); assert(cases == 2295); printf("PASS: %u legacy HFI ring/response cases, 4100 sequence exchanges, failure quarantine\n", cases); puts("Software peer only; no real firmware ACK or GPU execution"); return 0; } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\tests\test_hfi_legacy.c:53 [MATCH: 0xa04] --- int main(void) { uint32_t input[254], output[16], header, error; size_t returned; for (unsigned index = 0; index < 254; ++index) input[index] = 0xdead0000 + index; reset(); const uint32_t table[] = {0, 120, 6, 12, 2, 2}; assert(!memcmp(shared, table, sizeof(table))); for (unsigned index = 0; index < 2; ++index) { const uint32_t expected[] = {1, 0x6000a000 + index * 4096, index ? 0xa04 : 0xa00, 1024, 0, 0, 1, 1, 1, 0, 0, 0}; assert(!memcmp(shared + 6 + index * 12, expected, sizeof(expected))); } for (unsigned index = 30; index < 4096; ++index) assert(!shared[index]); unsigned cases = 0; const unsigned positions[] = {0, 1, 2, 3, 1019, 1020, 1021, 1022, 1023}; for (unsigned position = 0; position < sizeof(positions) / sizeof(positions[0]); ++position) { for (unsigned words = 0; words < 255; ++words) { reset(); unsigned at = positions[position]; shared[16] = shared[17] = at; assert(AdrenoHfiSend(&h, 1, input, words, &header) == AdrenoHfiSuccess); assert(notifications == 1 && header == (0x100000 | ((words + 1) << 8) | 1)); assert(shared[1024 + at] == header); for (unsigned index = 0; index < words; ++index) assert(shared[1024 + ((at + 1 + index) & 1023)] == input[index]); assert(shared[17] == ((at + words + 1) & 1023)); // The next word is not modern-protocol padding. assert(shared[1024 + shared[17]] == 0); shared[28] = shared[29] = at; --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\tests\test_hfi_legacy.c:125 [MATCH: timeout] --- reset(); assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiSuccess); reply(0, header + (1u << 20), 0); reply(0, header, 0); assert(AdrenoHfiPoll(&h, output, 16, &returned, &error) == AdrenoHfiSuccess && h.skipped == 1); reset(); assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiSuccess); reply(0, header, 7); assert(AdrenoHfiPoll(&h, output, 16, &returned, &error) == AdrenoHfiFirmwareError && error == 7); reset(); assert(AdrenoHfiExchange(&h, 1, NULL, 0, 2, NULL, output, 16, &returned, &error) == AdrenoHfiTimeout); assert(h.poisoned && notifications == 1); reset(); reply_immediately = 1; for (unsigned index = 0; index < 4100; ++index) { shared[16] = shared[17]; assert(AdrenoHfiExchange(&h, 1, NULL, 0, 1, NULL, output, 16, &returned, &error) == AdrenoHfiSuccess); assert(h.sequence == (index + 1) % 4095); } reset(); AdrenoHfiStartup state = {0}; AdrenoHfiStartupResult result; assert(AdrenoHfiStartupRun(&state, &h, NULL, NULL, &result) == AdrenoHfiStartupInvalid); assert(!notifications && !state.attempted && !h.pending_header); assert(cases == 2295); printf("PASS: %u legacy HFI ring/response cases, 4100 sequence exchanges, failure quarantine\n", cases); puts("Software peer only; no real firmware ACK or GPU execution"); return 0; } --- C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\tests\test_hfi_legacy.c:140 [MATCH: ACK] --- assert(AdrenoHfiExchange(&h, 1, NULL, 0, 1, NULL, output, 16, &returned, &error) == AdrenoHfiSuccess); assert(h.sequence == (index + 1) % 4095); } reset(); AdrenoHfiStartup state = {0}; AdrenoHfiStartupResult result; assert(AdrenoHfiStartupRun(&state, &h, NULL, NULL, &result) == AdrenoHfiStartupInvalid); assert(!notifications && !state.attempted && !h.pending_header); assert(cases == 2295); printf("PASS: %u legacy HFI ring/response cases, 4100 sequence exchanges, failure quarantine\n", cases); puts("Software peer only; no real firmware ACK or GPU execution"); return 0; } ######## H: STRUCTURES AND CROSS REFERENCES ######## --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno-gpulist.h:3203 [MATCH: struct hfi_] --- { GEN8_GMUAO_CGC_MODE_CNTL, 0x00020000 }, { GEN8_GMUAO_CGC_DELAY_CNTL, 0x00010111 }, { GEN8_GMUAO_CGC_HYST_CNTL, 0x00005555 }, }; static struct hfi_therm_profile_ctrl therm_profile_8_0_0 = { .feature_en = 1, .feature_rev = 1, .tj_limit = 900, .tskin_addr = 0, .tskin_limit = 0, .tsens_cfg_cnt = 1, .tsens_cfg.limit_u = 1130, .tsens_cfg.limit_l = 10, .tsens_cfg.margin_u = 30, .tsens_cfg.margin_l = 20, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno-gpulist.h:3233 [MATCH: struct hfi_] --- static struct gen8_thermal_mit_cfg therm_mit_cfg_8_0_0 = { .therm = &therm_profile_8_0_0, .tsens_en_cfg = &tsens_en_cfg_8_0_0, }; static const struct hfi_clx_table_v2_cmd gen8_0_0_clx_table = { .version = (2 << 16) | 1, .domain = { /* GFX domain */ { .data0 = CLX_DATA(55, 4, 1, 1), .clxt = 0, .clxh = 0, .urgmode = 1, .lkgen = 0, .currbudget = 100, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno-gpulist.h:3361 [MATCH: struct hfi_] --- .clx_tbl = &gen8_0_0_clx_table, }; extern const struct gen8_snapshot_block_list gen8_2_0_snapshot_block_list; static const struct hfi_clx_table_v2_cmd gen8_2_0_clx_table = { .version = (2 << 16) | 1, .domain = { /* GFX domain */ { .data0 = CLX_DATA(60, 5, 1, 1), .clxt = 0, .clxh = 0, .urgmode = 1, .lkgen = 0, .currbudget = 100, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno-gpulist.h:3385 [MATCH: struct hfi_] --- .currbudget = 50, }, }, }; static const struct hfi_limits_mit_tbl gen8_2_0_limits_mit_tbl[] = { { .feature_id = GMU_MIT_IFF, .domain = GMU_GX_DOMAIN, .feature_rev = 0, .mit_cfg = { .enable = 1, .msg_path = 0, .lkgen = 0, .mode = 0, .sid_val = 0xC, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno-gpulist.h:3589 [MATCH: struct hfi_] --- static struct gen8_thermal_mit_cfg therm_mit_cfg_8_2_0 = { .therm = &therm_profile_8_0_0, .tsens_en_cfg = &tsens_en_cfg_8_2_0, }; static const struct hfi_therm_profile_ctrl therm_profile_8_9_0 = { .feature_en = 1, .feature_rev = 1, .tsens_en = 0xFF, .tj_limit = 900, .tskin_addr = 0, .tskin_limit = 0, .tsens_cfg_cnt = 1, .tsens_cfg.limit_u = 1130, .tsens_cfg.limit_l = 10, .tsens_cfg.margin_u = 30, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno-gpulist.h:4456 [MATCH: struct hfi_] --- .bcl_data = 1, .gen8_snapshot_block_list = &gen8_10_0_snapshot_block_list, .preempt_level = 1, }; static const struct hfi_clx_table_v2_cmd gen8_11_0_clx_table = { .version = (2 << 16) | 1, .domain = { /* GFX domain */ { .data0 = CLX_DATA(60, 5, 0, 1), .clxt = 0, .clxh = 0, .urgmode = 1, .lkgen = 0, .currbudget = 100, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno-gpulist.h:4480 [MATCH: struct hfi_] --- .currbudget = 100, }, }, }; static const struct hfi_clx_table_v2_cmd gen8_14_0_clx_table = { .version = (2 << 16) | 1, .domain = { /* GFX domain */ { .data0 = CLX_DATA(60, 4, 1, 1), .clxt = 10, .clxh = 0, .urgmode = 1, .lkgen = 0, .currbudget = 100, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno-gpulist.h:4504 [MATCH: struct hfi_] --- .currbudget = 100, }, }, }; static const struct hfi_limits_mit_tbl gen8_11_0_limits_mit_tbl[] = { { .feature_id = GMU_MIT_IFF, .domain = GMU_GX_DOMAIN, .feature_rev = 0, .mit_cfg = { .enable = 1, .msg_path = 0, .lkgen = 0, .mode = 0, .sid_val = 0xC, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_a6xx_gmu.c:982 [MATCH: struct a6xx_hfi] --- void a6xx_gmu_irq_enable(struct adreno_device *adreno_dev) { struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct a6xx_gmu_device *gmu = to_a6xx_gmu(adreno_dev); struct a6xx_hfi *hfi = &gmu->hfi; /* Clear pending IRQs and Unmask needed IRQs */ gmu_core_regwrite(device, A6XX_GMU_GMU2HOST_INTR_CLR, 0xffffffff); gmu_core_regwrite(device, A6XX_GMU_AO_HOST_INTERRUPT_CLR, 0xffffffff); gmu_core_regwrite(device, A6XX_GMU_GMU2HOST_INTR_MASK, (unsigned int)~HFI_IRQ_MASK); gmu_core_regwrite(device, A6XX_GMU_AO_HOST_INTERRUPT_MASK, (unsigned int)~GMU_AO_INT_MASK); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_a6xx_gmu.c:1003 [MATCH: struct a6xx_hfi] --- void a6xx_gmu_irq_disable(struct adreno_device *adreno_dev) { struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct a6xx_gmu_device *gmu = to_a6xx_gmu(adreno_dev); struct a6xx_hfi *hfi = &gmu->hfi; /* Disable all IRQs on host */ disable_irq(gmu->irq); disable_irq(hfi->irq); /* Mask all IRQs and clear pending IRQs */ gmu_core_regwrite(device, A6XX_GMU_GMU2HOST_INTR_MASK, 0xffffffff); gmu_core_regwrite(device, A6XX_GMU_AO_HOST_INTERRUPT_MASK, 0xffffffff); gmu_core_regwrite(device, A6XX_GMU_GMU2HOST_INTR_CLR, 0xffffffff); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_a6xx_gmu.c:3503 [MATCH: struct a6xx_hfi] --- } int a6xx_gmu_hfi_probe(struct adreno_device *adreno_dev) { struct a6xx_gmu_device *gmu = to_a6xx_gmu(adreno_dev); struct a6xx_hfi *hfi = &gmu->hfi; struct kgsl_device *device = KGSL_DEVICE(adreno_dev); /* Try with "hfi" irq first. Use Fallback legacy name "kgsl_hfi_irq" if not found. */ hfi->irq = kgsl_request_irq(GMU_PDEV(device), "hfi", "kgsl_hfi_irq", -EINVAL, a6xx_hfi_irq_handler, KGSL_DEVICE(adreno_dev)); return hfi->irq < 0 ? hfi->irq : 0; } int a6xx_gmu_add_to_minidump(struct adreno_device *adreno_dev) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_a6xx_gmu.h:31 [MATCH: struct a6xx_hfi] --- struct a6xx_gmu_device { int irq; const struct firmware *fw_image; struct kgsl_memdesc *dump_mem; struct kgsl_memdesc *gmu_log; struct a6xx_hfi hfi; unsigned int idle_level; /** @qmp: Pointer to qmp struct used for AOP messages*/ struct qmp *qmp; struct kgsl_mailbox mailbox; bool preallocations; unsigned int log_wptr_retention; /** @cm3_fault: whether gmu received a cm3 fault interrupt */ atomic_t cm3_fault; /** * @itcm_shadow: Copy of the itcm block in firmware binary used for --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_a6xx_hfi.c:23 [MATCH: struct a6xx_hfi] --- /* Total header sizes + queue sizes + 16 for alignment */ #define HFIMEM_SIZE (sizeof(struct hfi_queue_table) + 16 + \ (HFI_QUEUE_SIZE * HFI_QUEUE_MAX)) struct a6xx_hfi *to_a6xx_hfi(struct adreno_device *adreno_dev) { struct a6xx_gmu_device *gmu = to_a6xx_gmu(adreno_dev); return &gmu->hfi; } /* Size in below functions are in unit of dwords */ int a6xx_hfi_queue_read(struct a6xx_gmu_device *gmu, uint32_t queue_idx, unsigned int *output, unsigned int max_size) { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_a6xx_hfi.c:222 [MATCH: struct a6xx_hfi] --- } int a6xx_hfi_init(struct adreno_device *adreno_dev) { struct a6xx_gmu_device *gmu = to_a6xx_gmu(adreno_dev); struct a6xx_hfi *hfi = &gmu->hfi; /* Allocates & maps memory for HFI */ if (IS_ERR_OR_NULL(hfi->hfi_mem)) { hfi->hfi_mem = gmu_core_reserve_kernel_block(KGSL_DEVICE(adreno_dev), 0, HFIMEM_SIZE, GMU_NONCACHED_KERNEL, 0); if (!IS_ERR(hfi->hfi_mem)) init_queues(adreno_dev); } return PTR_ERR_OR_ZERO(hfi->hfi_mem); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_a6xx_hfi.c:269 [MATCH: struct a6xx_hfi] --- { struct a6xx_gmu_device *gmu = to_a6xx_gmu(adreno_dev); struct kgsl_device *device = KGSL_DEVICE(adreno_dev); int rc; uint32_t *cmd = data; struct a6xx_hfi *hfi = &gmu->hfi; unsigned int seqnum = atomic_inc_return(&hfi->seqnum); *cmd = MSG_HDR_SET_SEQNUM_SIZE(*cmd, seqnum, size_bytes >> 2); if (ret_cmd == NULL) return a6xx_hfi_cmdq_write(adreno_dev, cmd, size_bytes); ret_cmd->sent_hdr = cmd[0]; rc = a6xx_hfi_cmdq_write(adreno_dev, cmd, size_bytes); if (rc) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_a6xx_hfi.h:12 [MATCH: struct a6xx_hfi] --- #define __ADRENO_A6XX_HFI_H #include "adreno_hfi.h" /** * struct a6xx_hfi - HFI control structure * @seqnum: atomic counter that is incremented for each message sent. The * value of the counter is used as sequence number for HFI message * @bw_table: HFI BW table buffer * @acd_table: HFI table for ACD data */ struct a6xx_hfi { /** @irq: HFI interrupt line */ int irq; atomic_t seqnum; /** @hfi_mem: Memory descriptor for the hfi memory */ --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_a6xx_hfi.h:18 [MATCH: struct a6xx_hfi] --- * @seqnum: atomic counter that is incremented for each message sent. The * value of the counter is used as sequence number for HFI message * @bw_table: HFI BW table buffer * @acd_table: HFI table for ACD data */ struct a6xx_hfi { /** @irq: HFI interrupt line */ int irq; atomic_t seqnum; /** @hfi_mem: Memory descriptor for the hfi memory */ struct kgsl_memdesc *hfi_mem; struct hfi_bwtable_cmd bw_table; struct hfi_acd_table_cmd acd_table; /** @dcvs_table: HFI table for gpu dcvs levels */ struct hfi_dcvstable_cmd dcvs_table; }; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_a6xx_hfi.h:63 [MATCH: struct a6xx_hfi] --- * Return: 0 on success or negative error on failure */ int a6xx_hfi_init(struct adreno_device *adreno_dev); /* Helper function to get to a6xx hfi struct from adreno device */ struct a6xx_hfi *to_a6xx_hfi(struct adreno_device *adreno_dev); /** * a6xx_hfi_queue_write - Write a command to hfi queue * @adreno_dev: Pointer to the adreno device * @queue_idx: destination queue id * @msg: Data to be written to the queue * @size_bytes: Size of the command in bytes * * Return: 0 on success or negative error on failure */ --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_a6xx_hwsched_hfi.c:563 [MATCH: struct a6xx_hfi] --- del_waiter(hfi, &pending_ack); return rc; } static void init_queues(struct a6xx_hfi *hfi) { u32 gmuaddr = hfi->hfi_mem->gmuaddr; struct hfi_queue_table hfi_table = { .qtbl_hdr = { .version = 0, .size = sizeof(struct hfi_queue_table) >> 2, .qhdr0_offset = sizeof(struct hfi_queue_table_header) >> 2, .qhdr_size = sizeof(struct hfi_queue_header) >> 2, .num_q = HFI_QUEUE_MAX, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_a6xx_hwsched_hfi.c:613 [MATCH: struct a6xx_hfi] --- static int hfi_f2h_main(void *arg); int a6xx_hwsched_hfi_init(struct adreno_device *adreno_dev) { struct a6xx_hwsched_hfi *hw_hfi = to_a6xx_hwsched_hfi(adreno_dev); struct a6xx_hfi *hfi = to_a6xx_hfi(adreno_dev); struct kgsl_device *device = KGSL_DEVICE(adreno_dev); if (IS_ERR_OR_NULL(hw_hfi->big_ib)) { hw_hfi->big_ib = gmu_core_reserve_kernel_block(device, 0, HWSCHED_MAX_IBS * sizeof(struct hfi_issue_ib), GMU_NONCACHED_KERNEL, 0); if (IS_ERR(hw_hfi->big_ib)) return PTR_ERR(hw_hfi->big_ib); } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_a6xx_rpmh.c:31 [MATCH: struct a6xx_hfi] --- struct rpmh_arc_vals *pri_rail, struct rpmh_arc_vals *sec_rail, u32 *freqs, u32 *vlvls) { /* Hardcoded values of GMU CX voltage levels */ struct a6xx_gmu_device *gmu = to_a6xx_gmu(adreno_dev); struct a6xx_hfi *hfi = &gmu->hfi; u16 gmu_cx_vlvl[MAX_CX_LEVELS_LEGACY]; u32 cx_votes[MAX_CX_LEVELS_LEGACY]; struct hfi_dcvstable_cmd *table = &hfi->dcvs_table; int ret, i; gmu_cx_vlvl[0] = 0; gmu_cx_vlvl[1] = vlvls[0]; gmu_cx_vlvl[2] = vlvls[1]; table->gmu_level_num = 3; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_a6xx_rpmh.c:128 [MATCH: struct a6xx_hfi] --- static int build_dcvs_table(struct adreno_device *adreno_dev) { struct a6xx_gmu_device *gmu = to_a6xx_gmu(adreno_dev); struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct a6xx_hfi *hfi = &gmu->hfi; struct rpmh_arc_vals gx_arc, cx_arc, mx_arc; int ret; ret = CMD_MSG_HDR(hfi->dcvs_table, H2F_MSG_PERF_TBL); if (ret) return ret; ret = adreno_rpmh_arc_cmds(&gx_arc, "gfx.lvl"); if (ret) return ret; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hfi.c:21 [MATCH: struct hfi_] --- /* Below section is for all structures related to HFI queues */ #define HFI_QUEUE_MAX HFI_QUEUE_DEFAULT_CNT /* Total header sizes + queue sizes + 16 for alignment */ #define HFIMEM_SIZE (sizeof(struct hfi_queue_table) + 16 + \ (HFI_QUEUE_SIZE * HFI_QUEUE_MAX)) #define HOST_QUEUE_START_ADDR(hfi_mem, i) \ ((hfi_mem)->hostptr + HFI_QUEUE_OFFSET(i)) struct gen7_hfi *to_gen7_hfi(struct adreno_device *adreno_dev) { struct gen7_gmu_device *gmu = to_gen7_gmu(adreno_dev); return &gmu->hfi; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hfi.c:40 [MATCH: struct hfi_] --- int gen7_hfi_queue_read(struct gen7_gmu_device *gmu, u32 queue_idx, unsigned int *output, unsigned int max_size) { struct kgsl_device *device = KGSL_DEVICE(gen7_gmu_to_adreno(gmu)); struct kgsl_memdesc *mem_addr = gmu->hfi.hfi_mem; struct hfi_queue_table *tbl = mem_addr->hostptr; struct hfi_queue_header *hdr = &tbl->qhdr[queue_idx]; u32 *queue; u32 msg_hdr; u32 i, read; u32 size; int result = 0; if (hdr->status == HFI_QUEUE_STATUS_DISABLED) return -EINVAL; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hfi.c:106 [MATCH: struct hfi_] --- int gen7_hfi_queue_write(struct adreno_device *adreno_dev, u32 queue_idx, u32 *msg, u32 size_bytes) { struct gen7_gmu_device *gmu = to_gen7_gmu(adreno_dev); struct hfi_queue_table *tbl = gmu->hfi.hfi_mem->hostptr; struct hfi_queue_header *hdr = &tbl->qhdr[queue_idx]; u32 *queue; u32 i, write_idx, read_idx, empty_space; u32 size_dwords = size_bytes >> 2; u32 align_size = ALIGN(size_dwords, SZ_4); u32 id = MSG_HDR_GET_ID(*msg); if (hdr->status == HFI_QUEUE_STATUS_DISABLED || !IS_ALIGNED(size_bytes, sizeof(u32))) return -EINVAL; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hfi.c:188 [MATCH: struct hfi_] --- static void init_queues(struct adreno_device *adreno_dev) { struct gen7_gmu_device *gmu = to_gen7_gmu(adreno_dev); struct kgsl_memdesc *mem_addr = gmu->hfi.hfi_mem; int i; struct hfi_queue_table *tbl; struct hfi_queue_header *hdr; struct { unsigned int idx; unsigned int pri; unsigned int status; } queue[HFI_QUEUE_MAX] = { { HFI_CMD_ID, HFI_CMD_PRI, HFI_QUEUE_STATUS_ENABLED }, { HFI_MSG_ID, HFI_MSG_PRI, HFI_QUEUE_STATUS_ENABLED }, { HFI_DBG_ID, HFI_DBG_PRI, HFI_QUEUE_STATUS_ENABLED }, }; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hfi.c:189 [MATCH: struct hfi_] --- { struct gen7_gmu_device *gmu = to_gen7_gmu(adreno_dev); struct kgsl_memdesc *mem_addr = gmu->hfi.hfi_mem; int i; struct hfi_queue_table *tbl; struct hfi_queue_header *hdr; struct { unsigned int idx; unsigned int pri; unsigned int status; } queue[HFI_QUEUE_MAX] = { { HFI_CMD_ID, HFI_CMD_PRI, HFI_QUEUE_STATUS_ENABLED }, { HFI_MSG_ID, HFI_MSG_PRI, HFI_QUEUE_STATUS_ENABLED }, { HFI_DBG_ID, HFI_DBG_PRI, HFI_QUEUE_STATUS_ENABLED }, }; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hfi.c:203 [MATCH: struct hfi_] --- }; /* Fill Table Header */ tbl = mem_addr->hostptr; tbl->qtbl_hdr.version = 0; tbl->qtbl_hdr.size = sizeof(struct hfi_queue_table) >> 2; tbl->qtbl_hdr.qhdr0_offset = sizeof(struct hfi_queue_table_header) >> 2; tbl->qtbl_hdr.qhdr_size = sizeof(struct hfi_queue_header) >> 2; tbl->qtbl_hdr.num_q = HFI_QUEUE_MAX; tbl->qtbl_hdr.num_active_q = HFI_QUEUE_MAX; memset(&tbl->qhdr[0], 0, sizeof(tbl->qhdr)); /* Fill Individual Queue Headers */ for (i = 0; i < HFI_QUEUE_MAX; i++) { hdr = &tbl->qhdr[i]; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hfi.c:377 [MATCH: struct hfi_] --- return 0; } int gen7_hfi_send_core_fw_start(struct adreno_device *adreno_dev) { struct hfi_core_fw_start_cmd cmd = { .handle = 0x0, }; int ret; ret = CMD_MSG_HDR(cmd, H2F_MSG_CORE_FW_START); if (ret) return ret; return gen7_hfi_send_generic_req(adreno_dev, &cmd, sizeof(cmd)); } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hfi.c:430 [MATCH: struct hfi_] --- int gen7_hfi_send_feature_ctrl(struct adreno_device *adreno_dev, u32 feature, u32 enable, u32 data) { struct pending_cmd ret_cmd = {0}; struct hfi_feature_ctrl_cmd cmd = { .feature = feature, .enable = enable, .data = data, }; int ret; ret = CMD_MSG_HDR(cmd, H2F_MSG_FEATURE_CTRL); if (ret) return ret; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hfi.c:451 [MATCH: struct hfi_] --- } int gen7_hfi_send_get_value(struct adreno_device *adreno_dev, u32 type, u32 subtype) { struct pending_cmd ret_cmd = {0}; struct hfi_get_value_cmd cmd = { .type = type, .subtype = subtype, }; int ret; ret = CMD_MSG_HDR(cmd, H2F_MSG_GET_VALUE); if (ret) return ret; ret = gen7_hfi_send_generic_req_v5(adreno_dev, &cmd, &ret_cmd, sizeof(cmd)); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hfi.c:474 [MATCH: struct hfi_] --- int gen7_hfi_send_set_value(struct adreno_device *adreno_dev, u32 type, u32 subtype, u32 data) { struct pending_cmd ret_cmd = {0}; struct hfi_set_value_cmd cmd = { .type = type, .subtype = subtype, .data = data, }; int ret; ret = CMD_MSG_HDR(cmd, H2F_MSG_SET_VALUE); if (ret) return ret; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hfi.c:498 [MATCH: struct hfi_] --- void adreno_gen7_receive_err_req(struct gen7_gmu_device *gmu, void *rcvd) { struct kgsl_device *device = KGSL_DEVICE(gen7_gmu_to_adreno(gmu)); const struct adreno_gpudev *gpudev = ADRENO_GPU_DEVICE(ADRENO_DEVICE(device)); u64 ticks = gpudev->read_alwayson(ADRENO_DEVICE(device)); struct hfi_err_cmd *cmd = rcvd; dev_err(GMU_PDEV_DEV(device), "HFI Error Received: %d %d %.16s\n", ((cmd->error_code >> 16) & 0xffff), (cmd->error_code & 0xffff), (char *) cmd->data); KGSL_GMU_CORE_FORCE_PANIC(device->gmu_core.gf_panic, GMU_PDEV(device), ticks, GMU_FAULT_F2H_MSG_ERR); } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hfi.c:512 [MATCH: struct hfi_] --- } void adreno_gen7_receive_debug_req(struct gen7_gmu_device *gmu, void *rcvd) { struct kgsl_device *device = KGSL_DEVICE(gen7_gmu_to_adreno(gmu)); struct hfi_debug_cmd *cmd = rcvd; dev_dbg(GMU_PDEV_DEV(device), "HFI Debug Received: %d %d %d\n", cmd->type, cmd->timestamp, cmd->data); } int gen7_hfi_process_queue(struct gen7_gmu_device *gmu, u32 queue_idx, struct pending_cmd *ret_cmd) { struct kgsl_device *device = KGSL_DEVICE(gen7_gmu_to_adreno(gmu)); u32 rcvd[MAX_RCVD_SIZE]; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hfi.c:571 [MATCH: struct hfi_] --- } int gen7_hfi_send_clx_feature_ctrl(struct adreno_device *adreno_dev) { int ret = 0; struct hfi_clx_table_v2_cmd cmd = {0}; if (!adreno_dev->clx_enabled) return 0; /* Make sure the table is valid before enabling feature */ ret = CMD_MSG_HDR(cmd, H2F_MSG_CLX_TBL); if (ret) return ret; ret = gen7_hfi_send_feature_ctrl(adreno_dev, HFI_FEATURE_CLX, 1, 0); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hfi.c:640 [MATCH: struct hfi_] --- static void reset_hfi_queues(struct adreno_device *adreno_dev) { struct gen7_gmu_device *gmu = to_gen7_gmu(adreno_dev); struct kgsl_memdesc *mem_addr = gmu->hfi.hfi_mem; struct hfi_queue_table *tbl = mem_addr->hostptr; struct hfi_queue_header *hdr; unsigned int i; /* Flush HFI queues */ for (i = 0; i < HFI_QUEUE_MAX; i++) { hdr = &tbl->qhdr[i]; if (hdr->status == HFI_QUEUE_STATUS_DISABLED) continue; hdr->read_index = hdr->write_index; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hfi.c:641 [MATCH: struct hfi_] --- static void reset_hfi_queues(struct adreno_device *adreno_dev) { struct gen7_gmu_device *gmu = to_gen7_gmu(adreno_dev); struct kgsl_memdesc *mem_addr = gmu->hfi.hfi_mem; struct hfi_queue_table *tbl = mem_addr->hostptr; struct hfi_queue_header *hdr; unsigned int i; /* Flush HFI queues */ for (i = 0; i < HFI_QUEUE_MAX; i++) { hdr = &tbl->qhdr[i]; if (hdr->status == HFI_QUEUE_STATUS_DISABLED) continue; hdr->read_index = hdr->write_index; } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hfi.c:655 [MATCH: struct hfi_] --- hdr->read_index = hdr->write_index; } } /* Fill the entry and return the dword count written */ static u32 _fill_table_entry(struct hfi_table_entry *entry, u32 count, u32 stride_bytes, u32 *data) { entry->count = count; entry->stride = stride_bytes >> 2; /* entry->stride is in dwords */ memcpy(entry->data, data, stride_bytes * count); /* Return total dword count of entry + data */ return (sizeof(*entry) >> 2) + (entry->count * entry->stride); } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hfi.c:680 [MATCH: struct hfi_] --- struct gen7_dcvs_table *tbl = &gmu->dcvs_table; int ret = 0; /* Starting with GMU HFI Version 2.6.1, use H2F_MSG_TABLE */ if (device->gmu_core.ver.hfi >= HFI_VERSION(2, 6, 1)) { struct hfi_table_cmd *cmd = (struct hfi_table_cmd *)&cmd_buf[0]; u32 dword_off; /* Already setup, so just send cmd */ if (cmd->hdr) return gen7_hfi_send_generic_req(adreno_dev, cmd, MSG_HDR_GET_SIZE(cmd->hdr) << 2); if (tbl->gpu_level_num > MAX_GX_LEVELS || tbl->gmu_level_num > MAX_CX_LEVELS_LEGACY) return -EINVAL; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hfi.c:691 [MATCH: struct hfi_] --- MSG_HDR_GET_SIZE(cmd->hdr) << 2); if (tbl->gpu_level_num > MAX_GX_LEVELS || tbl->gmu_level_num > MAX_CX_LEVELS_LEGACY) return -EINVAL; /* CMD starts with struct hfi_table_cmd data */ cmd->type = HFI_TABLE_GPU_PERF; dword_off = sizeof(*cmd) >> 2; /* Fill in the table entry and data starting at dword_off */ dword_off += _fill_table_entry((struct hfi_table_entry *)&cmd_buf[dword_off], tbl->gpu_level_num, sizeof(struct opp_gx_desc), (u32 *)tbl->gx_votes); /* Fill in the table entry and data starting at dword_off */ dword_off += _fill_table_entry((struct hfi_table_entry *)&cmd_buf[dword_off], --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hfi.c:696 [MATCH: struct hfi_] --- /* CMD starts with struct hfi_table_cmd data */ cmd->type = HFI_TABLE_GPU_PERF; dword_off = sizeof(*cmd) >> 2; /* Fill in the table entry and data starting at dword_off */ dword_off += _fill_table_entry((struct hfi_table_entry *)&cmd_buf[dword_off], tbl->gpu_level_num, sizeof(struct opp_gx_desc), (u32 *)tbl->gx_votes); /* Fill in the table entry and data starting at dword_off */ dword_off += _fill_table_entry((struct hfi_table_entry *)&cmd_buf[dword_off], tbl->gmu_level_num, sizeof(struct opp_desc), (u32 *)tbl->cx_votes); cmd->hdr = CREATE_MSG_HDR(H2F_MSG_TABLE, HFI_MSG_CMD); cmd->hdr = MSG_HDR_SET_SIZE(cmd->hdr, dword_off); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hfi.c:701 [MATCH: struct hfi_] --- dword_off += _fill_table_entry((struct hfi_table_entry *)&cmd_buf[dword_off], tbl->gpu_level_num, sizeof(struct opp_gx_desc), (u32 *)tbl->gx_votes); /* Fill in the table entry and data starting at dword_off */ dword_off += _fill_table_entry((struct hfi_table_entry *)&cmd_buf[dword_off], tbl->gmu_level_num, sizeof(struct opp_desc), (u32 *)tbl->cx_votes); cmd->hdr = CREATE_MSG_HDR(H2F_MSG_TABLE, HFI_MSG_CMD); cmd->hdr = MSG_HDR_SET_SIZE(cmd->hdr, dword_off); ret = gen7_hfi_send_generic_req(adreno_dev, cmd, dword_off << 2); } else { struct hfi_dcvstable_cmd *cmd = (struct hfi_dcvstable_cmd *)&cmd_buf[0]; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hfi.c:710 [MATCH: struct hfi_] --- cmd->hdr = CREATE_MSG_HDR(H2F_MSG_TABLE, HFI_MSG_CMD); cmd->hdr = MSG_HDR_SET_SIZE(cmd->hdr, dword_off); ret = gen7_hfi_send_generic_req(adreno_dev, cmd, dword_off << 2); } else { struct hfi_dcvstable_cmd *cmd = (struct hfi_dcvstable_cmd *)&cmd_buf[0]; /* Already setup, so just send cmd */ if (cmd->hdr) return gen7_hfi_send_generic_req(adreno_dev, cmd, sizeof(*cmd)); if (tbl->gpu_level_num > MAX_GX_LEVELS_LEGACY || tbl->gmu_level_num > MAX_CX_LEVELS_LEGACY) return -EINVAL; ret = CMD_MSG_HDR(*cmd, H2F_MSG_PERF_TBL); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hfi.c:196 [MATCH: HFI_MSG_ID] --- unsigned int idx; unsigned int pri; unsigned int status; } queue[HFI_QUEUE_MAX] = { { HFI_CMD_ID, HFI_CMD_PRI, HFI_QUEUE_STATUS_ENABLED }, { HFI_MSG_ID, HFI_MSG_PRI, HFI_QUEUE_STATUS_ENABLED }, { HFI_DBG_ID, HFI_DBG_PRI, HFI_QUEUE_STATUS_ENABLED }, }; /* Fill Table Header */ tbl = mem_addr->hostptr; tbl->qtbl_hdr.version = 0; tbl->qtbl_hdr.size = sizeof(struct hfi_queue_table) >> 2; tbl->qtbl_hdr.qhdr0_offset = sizeof(struct hfi_queue_table_header) >> 2; tbl->qtbl_hdr.qhdr_size = sizeof(struct hfi_queue_header) >> 2; tbl->qtbl_hdr.num_q = HFI_QUEUE_MAX; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hfi.h:24 [MATCH: struct hfi_] --- */ atomic_t seqnum; /** @hfi_mem: Memory descriptor for the hfi memory */ struct kgsl_memdesc *hfi_mem; /** @bw_table: HFI BW table buffer */ struct hfi_bwtable_cmd bw_table; /** @acd_table: HFI table for ACD data */ struct hfi_acd_table_cmd acd_table; /** @cmdq_lock: Spinlock for accessing the cmdq */ spinlock_t cmdq_lock; /** * @wb_set_record_bitmask: Bitmask to enable or disable the recording * of messages in the GMU scratch. */ unsigned long wb_set_record_bitmask[BITS_TO_LONGS(HFI_MAX_ID)]; }; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hfi.h:26 [MATCH: struct hfi_] --- /** @hfi_mem: Memory descriptor for the hfi memory */ struct kgsl_memdesc *hfi_mem; /** @bw_table: HFI BW table buffer */ struct hfi_bwtable_cmd bw_table; /** @acd_table: HFI table for ACD data */ struct hfi_acd_table_cmd acd_table; /** @cmdq_lock: Spinlock for accessing the cmdq */ spinlock_t cmdq_lock; /** * @wb_set_record_bitmask: Bitmask to enable or disable the recording * of messages in the GMU scratch. */ unsigned long wb_set_record_bitmask[BITS_TO_LONGS(HFI_MAX_ID)]; }; struct gen7_gmu_device; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched.c:93 [MATCH: struct hfi_] --- if (parse_payload) skip_memkind_rb = true; for (i = 0; i < hwsched->mem_alloc_entries; i++) { struct hfi_mem_alloc_entry *entry = &hwsched->mem_alloc_table[i]; if (entry->desc.mem_kind == HFI_MEMKIND_RB && !skip_memkind_rb) kgsl_snapshot_add_section(device, KGSL_SNAPSHOT_SECTION_RB_V2, snapshot, adreno_hwsched_snapshot_rb, entry->md); if (entry->desc.mem_kind == HFI_MEMKIND_SCRATCH) kgsl_snapshot_add_section(device, KGSL_SNAPSHOT_SECTION_GPU_OBJECT_V2, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched.c:376 [MATCH: struct hfi_] --- static int gen7_hwsched_notify_slumber(struct adreno_device *adreno_dev) { struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct kgsl_pwrctrl *pwr = &device->pwrctrl; struct gen7_gmu_device *gmu = to_gen7_gmu(adreno_dev); struct hfi_prep_slumber_cmd req; int ret; ret = CMD_MSG_HDR(req, H2F_MSG_PREPARE_SLUMBER); if (ret) return ret; req.freq = gmu->dcvs_table.gpu_level_num - pwr->default_pwrlevel - 1; req.bw = pwr->pwrlevels[pwr->default_pwrlevel].bus_freq; req.bw |= adreno_gmu_bus_ab_quantize(adreno_dev, 0); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched.c:1030 [MATCH: struct hfi_] --- { struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct kgsl_pwrctrl *pwr = &device->pwrctrl; struct gen7_gmu_device *gmu = to_gen7_gmu(adreno_dev); struct gen7_dcvs_table *table = &gmu->dcvs_table; struct hfi_gx_bw_perf_vote_cmd req = { .ack_type = DCVS_ACK_BLOCK, .freq = INVALID_DCVS_IDX, .bw = INVALID_DCVS_IDX, }; int ret; if (!test_bit(GMU_PRIV_HFI_STARTED, &gmu->flags)) return 0; /* Do not set to XO and lower GPU clock vote from GMU */ --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched.c:1659 [MATCH: struct hfi_] --- return ret; } /* Dump HFI hwsched global mem alloc entries */ for (i = 0; i < hwsched->mem_alloc_entries; i++) { struct hfi_mem_alloc_entry *entry = &hwsched->mem_alloc_table[i]; char hfi_minidump_str[MAX_VA_MINIDUMP_STR_LEN] = {0}; char name[MAX_VA_MINIDUMP_STR_LEN]; u32 rb_id = 0; if (!hfi_get_minidump_string(entry->desc.mem_kind, &hfi_minidump_str[0], sizeof(hfi_minidump_str), &rb_id)) { snprintf(name, sizeof(name), "kgsl_global_%s", hfi_minidump_str); ret = kgsl_add_va_to_minidump(adreno_dev->dev.dev, name, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:153 [MATCH: struct hfi_] --- /* Look up a particular key's value for a given type of payload */ static u32 gen7_hwsched_lookup_key_value_legacy(struct adreno_device *adreno_dev, u32 type, u32 key) { struct hfi_context_bad_cmd_legacy *cmd = adreno_dev->hwsched.ctxt_bad; u32 i = 0, payload_bytes; void *start; if (!cmd->hdr) return 0; payload_bytes = (MSG_HDR_GET_SIZE(cmd->hdr) << 2) - offsetof(struct hfi_context_bad_cmd_legacy, payload); start = &cmd->payload[0]; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:161 [MATCH: struct hfi_] --- if (!cmd->hdr) return 0; payload_bytes = (MSG_HDR_GET_SIZE(cmd->hdr) << 2) - offsetof(struct hfi_context_bad_cmd_legacy, payload); start = &cmd->payload[0]; while (i < payload_bytes) { struct payload_section *payload = start + i; if (payload->type == type) return adreno_hwsched_parse_payload(payload, key); i += struct_size(payload, data, payload->dwords); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:182 [MATCH: struct hfi_] --- struct syncobj_flags { unsigned long mask; const char *name; }; static void _get_syncobj_string(char *str, u32 max_size, struct hfi_syncobj_legacy *syncobj, u32 index) { u32 count = scnprintf(str, max_size, "syncobj[%d] ctxt_id:%llu seqno:%llu flags:", index, syncobj->ctxt_id, syncobj->seq_no); u32 i; bool first = true; static const struct syncobj_flags _flags[] = { GMU_SYNCOBJ_FLAGS, { -1, NULL }}; for (i = 0; _flags[i].name; i++) { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:206 [MATCH: struct hfi_] --- } } } static void log_syncobj(struct gen7_gmu_device *gmu, struct adreno_context *drawctxt, struct hfi_submit_syncobj *cmd, u32 syncobj_read_idx) { struct kgsl_device *device = KGSL_DEVICE(gen7_gmu_to_adreno(gmu)); struct gmu_context_queue_header *hdr = drawctxt->gmu_context_queue.hostptr; struct hfi_syncobj_legacy syncobj; char str[128]; u32 i = 0; for (i = 0; i < cmd->num_syncobj; i++) { if (adreno_gmu_context_queue_read(drawctxt, (u32 *) &syncobj, syncobj_read_idx, sizeof(syncobj) >> 2)) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:210 [MATCH: struct hfi_] --- static void log_syncobj(struct gen7_gmu_device *gmu, struct adreno_context *drawctxt, struct hfi_submit_syncobj *cmd, u32 syncobj_read_idx) { struct kgsl_device *device = KGSL_DEVICE(gen7_gmu_to_adreno(gmu)); struct gmu_context_queue_header *hdr = drawctxt->gmu_context_queue.hostptr; struct hfi_syncobj_legacy syncobj; char str[128]; u32 i = 0; for (i = 0; i < cmd->num_syncobj; i++) { if (adreno_gmu_context_queue_read(drawctxt, (u32 *) &syncobj, syncobj_read_idx, sizeof(syncobj) >> 2)) break; _get_syncobj_string(str, sizeof(str), &syncobj, i); dev_err(GMU_PDEV_DEV(device), "%s\n", str); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:232 [MATCH: struct hfi_] --- struct gen7_gmu_device *gmu = to_gen7_gmu(adreno_dev); struct kgsl_context *context = NULL; struct adreno_context *drawctxt; struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct gmu_context_queue_header *hdr; struct hfi_submit_syncobj cmd; u32 *queue, i; int ret; /* We want to get the context even if it is detached */ read_lock(&device->context_lock); context = idr_find(&device->context_idr, ctxt_id); ret = _kgsl_context_get(context); read_unlock(&device->context_lock); if (!ret) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:277 [MATCH: struct hfi_] --- } static void log_gpu_fault_legacy(struct adreno_device *adreno_dev) { struct device *gmu_pdev_dev = GMU_PDEV_DEV(KGSL_DEVICE(adreno_dev)); struct hfi_context_bad_cmd_legacy *cmd = adreno_dev->hwsched.ctxt_bad; switch (cmd->error) { case GMU_GPU_HW_HANG: dev_crit_ratelimited(gmu_pdev_dev, "MISC: GPU hang detected\n"); break; case GMU_GPU_SW_HANG: dev_crit_ratelimited(gmu_pdev_dev, "gpu timeout ctx %u ts %u\n", cmd->ctxt_id, cmd->ts); break; case GMU_CP_OPCODE_ERROR: --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:419 [MATCH: struct hfi_] --- /* Look up a particular key's value for a given type of payload */ static u32 gen7_hwsched_lookup_key_value(struct adreno_device *adreno_dev, u32 type, u32 key) { struct hfi_context_bad_cmd *cmd = adreno_dev->hwsched.ctxt_bad; u32 i = 0, payload_bytes; void *start; if (!cmd->hdr) return 0; payload_bytes = (MSG_HDR_GET_SIZE(cmd->hdr) << 2) - offsetof(struct hfi_context_bad_cmd, payload); start = &cmd->payload[0]; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:427 [MATCH: struct hfi_] --- if (!cmd->hdr) return 0; payload_bytes = (MSG_HDR_GET_SIZE(cmd->hdr) << 2) - offsetof(struct hfi_context_bad_cmd, payload); start = &cmd->payload[0]; while (i < payload_bytes) { struct payload_section *payload = start + i; if (payload->type == type) return adreno_hwsched_parse_payload(payload, key); i += struct_size(payload, data, payload->dwords); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:446 [MATCH: struct hfi_] --- } static bool log_gpu_fault(struct adreno_device *adreno_dev) { struct device *gmu_pdev_dev = GMU_PDEV_DEV(KGSL_DEVICE(adreno_dev)); struct hfi_context_bad_cmd *cmd = adreno_dev->hwsched.ctxt_bad; /* Return false for non fatal errors */ if (adreno_hwsched_log_nonfatal_gpu_fault(adreno_dev, gmu_pdev_dev, cmd->error)) return false; switch (cmd->error) { case GMU_GPU_HW_HANG: dev_crit_ratelimited(gmu_pdev_dev, "MISC: GPU hang detected\n"); break; case GMU_GPU_SW_HANG: --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:627 [MATCH: struct hfi_] --- static bool is_queue_empty(struct adreno_device *adreno_dev, u32 queue_idx) { struct gen7_gmu_device *gmu = to_gen7_gmu(adreno_dev); struct kgsl_memdesc *mem_addr = gmu->hfi.hfi_mem; struct hfi_queue_table *tbl = mem_addr->hostptr; struct hfi_queue_header *hdr = &tbl->qhdr[queue_idx]; if (hdr->status == HFI_QUEUE_STATUS_DISABLED) return true; if (hdr->read_index == hdr->write_index) return true; /* * This is to ensure that the queue is not read speculatively before the queue empty --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:649 [MATCH: struct hfi_] --- static u32 peek_next_header(struct adreno_device *adreno_dev, struct gen7_gmu_device *gmu, u32 queue_idx) { struct kgsl_memdesc *mem_addr = gmu->hfi.hfi_mem; struct hfi_queue_table *tbl = mem_addr->hostptr; struct hfi_queue_header *hdr = &tbl->qhdr[queue_idx]; u32 *queue; if (is_queue_empty(adreno_dev, queue_idx)) return 0; queue = HOST_QUEUE_START_ADDR(mem_addr, queue_idx); return queue[hdr->read_index]; } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:683 [MATCH: struct hfi_] --- } #define GET_QUERIED_FENCE_INDEX(x) (x / BITS_PER_SYNCOBJ_QUERY) #define GET_QUERIED_FENCE_BIT(x) (x % BITS_PER_SYNCOBJ_QUERY) static bool fence_is_queried(struct hfi_syncobj_query_cmd *cmd, u32 fence_index) { u32 index = GET_QUERIED_FENCE_INDEX(fence_index); u32 bit = GET_QUERIED_FENCE_BIT(fence_index); return (cmd->queries[index].query_bitmask & BIT(bit)); } static void set_fence_signal_bit(struct adreno_device *adreno_dev, struct hfi_syncobj_query_cmd *reply, struct dma_fence *fence, u32 fence_index) { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:692 [MATCH: struct hfi_] --- return (cmd->queries[index].query_bitmask & BIT(bit)); } static void set_fence_signal_bit(struct adreno_device *adreno_dev, struct hfi_syncobj_query_cmd *reply, struct dma_fence *fence, u32 fence_index) { struct device *gmu_pdev_dev = GMU_PDEV_DEV(KGSL_DEVICE(adreno_dev)); u32 index = GET_QUERIED_FENCE_INDEX(fence_index); u32 bit = GET_QUERIED_FENCE_BIT(fence_index); u64 flags = ADRENO_HW_FENCE_SW_STATUS_PENDING; char name[KGSL_FENCE_NAME_LEN]; char value[32] = "unknown"; kgsl_fence_timeline_value_str(fence, value, sizeof(value)); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:717 [MATCH: struct hfi_] --- trace_adreno_hw_fence_query(fence->context, fence->seqno, flags, name, value); } static void gen7_syncobj_query_reply(struct adreno_device *adreno_dev, struct kgsl_drawobj *drawobj, struct hfi_syncobj_query_cmd *cmd) { struct hfi_syncobj_query_cmd reply = {0}; int i; struct kgsl_drawobj_sync *syncobj = SYNCOBJ(drawobj); const struct adreno_gpudev *gpudev = ADRENO_GPU_DEVICE(adreno_dev); for (i = 0; i < syncobj->num_hw_fence; i++) { struct dma_fence *fence = syncobj->hw_fences[i].fence; if (!fence_is_queried(cmd, i)) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:719 [MATCH: struct hfi_] --- } static void gen7_syncobj_query_reply(struct adreno_device *adreno_dev, struct kgsl_drawobj *drawobj, struct hfi_syncobj_query_cmd *cmd) { struct hfi_syncobj_query_cmd reply = {0}; int i; struct kgsl_drawobj_sync *syncobj = SYNCOBJ(drawobj); const struct adreno_gpudev *gpudev = ADRENO_GPU_DEVICE(adreno_dev); for (i = 0; i < syncobj->num_hw_fence; i++) { struct dma_fence *fence = syncobj->hw_fences[i].fence; if (!fence_is_queried(cmd, i)) continue; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:745 [MATCH: struct hfi_] --- gen7_hfi_send_cmd_async(adreno_dev, &reply, sizeof(reply)); } struct syncobj_query_work { /** @cmd: The query command to be processed */ struct hfi_syncobj_query_cmd cmd; /** @context: kgsl context that is waiting for this sync object */ struct kgsl_context *context; /** @work: The work structure to execute syncobj query reply */ struct kthread_work work; }; static void gen7_process_syncobj_query_work(struct kthread_work *work) { struct syncobj_query_work *query_work = container_of(work, struct syncobj_query_work, work); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:756 [MATCH: struct hfi_] --- static void gen7_process_syncobj_query_work(struct kthread_work *work) { struct syncobj_query_work *query_work = container_of(work, struct syncobj_query_work, work); struct hfi_syncobj_query_cmd *cmd = (struct hfi_syncobj_query_cmd *)&query_work->cmd; struct kgsl_context *context = query_work->context; struct kgsl_device *device = context->device; struct adreno_device *adreno_dev = ADRENO_DEVICE(device); struct adreno_hwsched *hwsched = &adreno_dev->hwsched; struct cmd_list_obj *obj; bool missing = true; mutex_lock(&hwsched->mutex); kgsl_mutex_lock(&device->mutex); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:810 [MATCH: struct hfi_] --- static void gen7_trigger_syncobj_query(struct adreno_device *adreno_dev, u32 *rcvd) { struct syncobj_query_work *query_work; struct hfi_syncobj_query_cmd *cmd = (struct hfi_syncobj_query_cmd *)rcvd; struct kgsl_context *context = NULL; struct kgsl_device *device = KGSL_DEVICE(adreno_dev); const struct adreno_gpudev *gpudev = ADRENO_GPU_DEVICE(adreno_dev); int ret; trace_adreno_syncobj_query(cmd->gmu_ctxt_id, cmd->sync_obj_ts, gpudev->read_alwayson(adreno_dev)); /* * We need the context even if it is detached. Hence, we can't use kgsl_context_get here. --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:1183 [MATCH: struct hfi_] --- break; case F2H_MSG_SYNCOBJ_QUERY: gen7_trigger_syncobj_query(adreno_dev, rcvd); break; case F2H_MSG_GMU_CNTR_RELEASE: { struct hfi_gmu_cntr_release_cmd *cmd = (struct hfi_gmu_cntr_release_cmd *) rcvd; adreno_perfcounter_put(adreno_dev, cmd->group_id, cmd->countable, PERFCOUNTER_FLAG_KERNEL); gmu_core_mark_for_coldboot(KGSL_DEVICE(adreno_dev)); } break; } } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:1184 [MATCH: struct hfi_] --- case F2H_MSG_SYNCOBJ_QUERY: gen7_trigger_syncobj_query(adreno_dev, rcvd); break; case F2H_MSG_GMU_CNTR_RELEASE: { struct hfi_gmu_cntr_release_cmd *cmd = (struct hfi_gmu_cntr_release_cmd *) rcvd; adreno_perfcounter_put(adreno_dev, cmd->group_id, cmd->countable, PERFCOUNTER_FLAG_KERNEL); gmu_core_mark_for_coldboot(KGSL_DEVICE(adreno_dev)); } break; } } mutex_unlock(&hw_hfi->msgq_mutex); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:1200 [MATCH: struct hfi_] --- } static void process_log_block(struct adreno_device *adreno_dev, void *data) { struct gen7_gmu_device *gmu = to_gen7_gmu(adreno_dev); struct hfi_log_block *cmd = data; u32 *log_event = gmu->gmu_log->hostptr; u32 start, end; start = cmd->start_index; end = cmd->stop_index; log_event += start * 4; while (start != end) { trace_gmu_event(log_event); log_event += 4; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:1354 [MATCH: struct hfi_] --- } static void init_queues(struct gen7_hfi *hfi) { u32 gmuaddr = hfi->hfi_mem->gmuaddr; struct hfi_queue_table hfi_table = { .qtbl_hdr = { .version = 0, .size = sizeof(struct hfi_queue_table) >> 2, .qhdr0_offset = sizeof(struct hfi_queue_table_header) >> 2, .qhdr_size = sizeof(struct hfi_queue_header) >> 2, .num_q = HFI_QUEUE_MAX, .num_active_q = HFI_QUEUE_MAX, }, .qhdr = { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:1357 [MATCH: struct hfi_] --- { u32 gmuaddr = hfi->hfi_mem->gmuaddr; struct hfi_queue_table hfi_table = { .qtbl_hdr = { .version = 0, .size = sizeof(struct hfi_queue_table) >> 2, .qhdr0_offset = sizeof(struct hfi_queue_table_header) >> 2, .qhdr_size = sizeof(struct hfi_queue_header) >> 2, .num_q = HFI_QUEUE_MAX, .num_active_q = HFI_QUEUE_MAX, }, .qhdr = { DEFINE_QHDR(gmuaddr, HFI_CMD_ID, 0), DEFINE_QHDR(gmuaddr, HFI_MSG_ID, 0), DEFINE_QHDR(gmuaddr, HFI_DBG_ID, 0), --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:1359 [MATCH: struct hfi_] --- struct hfi_queue_table hfi_table = { .qtbl_hdr = { .version = 0, .size = sizeof(struct hfi_queue_table) >> 2, .qhdr0_offset = sizeof(struct hfi_queue_table_header) >> 2, .qhdr_size = sizeof(struct hfi_queue_header) >> 2, .num_q = HFI_QUEUE_MAX, .num_active_q = HFI_QUEUE_MAX, }, .qhdr = { DEFINE_QHDR(gmuaddr, HFI_CMD_ID, 0), DEFINE_QHDR(gmuaddr, HFI_MSG_ID, 0), DEFINE_QHDR(gmuaddr, HFI_DBG_ID, 0), /* 4 DQs for RB priority 0 */ DEFINE_QHDR(gmuaddr, 3, 0), --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:1394 [MATCH: struct hfi_] --- memcpy(hfi->hfi_mem->hostptr, &hfi_table, sizeof(hfi_table)); } /* Total header sizes + queue sizes + 16 for alignment */ #define HFIMEM_SIZE (sizeof(struct hfi_queue_table) + 16 + \ (SZ_4K * HFI_QUEUE_MAX)) static int hfi_f2h_main(void *arg); int gen7_hwsched_hfi_init(struct adreno_device *adreno_dev) { struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct gen7_hwsched_hfi *hw_hfi = to_gen7_hwsched_hfi(adreno_dev); struct gen7_hfi *hfi = to_gen7_hfi(adreno_dev); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:1407 [MATCH: struct hfi_] --- struct gen7_hwsched_hfi *hw_hfi = to_gen7_hwsched_hfi(adreno_dev); struct gen7_hfi *hfi = to_gen7_hfi(adreno_dev); if (IS_ERR_OR_NULL(hw_hfi->big_ib)) { hw_hfi->big_ib = gmu_core_reserve_kernel_block( device, 0, HWSCHED_MAX_IBS * sizeof(struct hfi_issue_ib), GMU_NONCACHED_KERNEL, 0); if (IS_ERR(hw_hfi->big_ib)) return PTR_ERR(hw_hfi->big_ib); } if (ADRENO_FEATURE(adreno_dev, ADRENO_LSR) && IS_ERR_OR_NULL(hw_hfi->big_ib_recurring)) { hw_hfi->big_ib_recurring = gmu_core_reserve_kernel_block( device, 0, HWSCHED_MAX_IBS * sizeof(struct hfi_issue_ib), GMU_NONCACHED_KERNEL, 0); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:1416 [MATCH: struct hfi_] --- } if (ADRENO_FEATURE(adreno_dev, ADRENO_LSR) && IS_ERR_OR_NULL(hw_hfi->big_ib_recurring)) { hw_hfi->big_ib_recurring = gmu_core_reserve_kernel_block( device, 0, HWSCHED_MAX_IBS * sizeof(struct hfi_issue_ib), GMU_NONCACHED_KERNEL, 0); if (IS_ERR(hw_hfi->big_ib_recurring)) return PTR_ERR(hw_hfi->big_ib_recurring); } if (IS_ERR_OR_NULL(hfi->hfi_mem)) { hfi->hfi_mem = gmu_core_reserve_kernel_block( device, 0, HFIMEM_SIZE, GMU_NONCACHED_KERNEL, 0); if (IS_ERR(hfi->hfi_mem)) return PTR_ERR(hfi->hfi_mem); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:1441 [MATCH: struct hfi_] --- return PTR_ERR_OR_ZERO(hw_hfi->f2h_task); } static int mem_alloc_reply(struct adreno_device *adreno_dev, void *rcvd) { struct hfi_mem_alloc_desc desc = {0}; struct hfi_mem_alloc_reply_cmd out = {0}; struct gen7_gmu_device *gmu = to_gen7_gmu(adreno_dev); u32 seqnum; int ret; hfi_get_mem_alloc_desc(rcvd, &desc); ret = adreno_hwsched_process_mem_alloc(adreno_dev, &desc); if (ret) return ret; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:1442 [MATCH: struct hfi_] --- } static int mem_alloc_reply(struct adreno_device *adreno_dev, void *rcvd) { struct hfi_mem_alloc_desc desc = {0}; struct hfi_mem_alloc_reply_cmd out = {0}; struct gen7_gmu_device *gmu = to_gen7_gmu(adreno_dev); u32 seqnum; int ret; hfi_get_mem_alloc_desc(rcvd, &desc); ret = adreno_hwsched_process_mem_alloc(adreno_dev, &desc); if (ret) return ret; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:1467 [MATCH: struct hfi_] --- return gen7_hfi_cmdq_write(adreno_dev, (u32 *)&out, sizeof(out)); } static int gmu_cntr_register_reply(struct adreno_device *adreno_dev, void *rcvd) { struct hfi_gmu_cntr_register_cmd *in = (struct hfi_gmu_cntr_register_cmd *)rcvd; struct hfi_gmu_cntr_register_reply_cmd out = {0}; struct gen7_gmu_device *gmu = to_gen7_gmu(adreno_dev); u32 lo = 0, hi = 0, seqnum; /* * Failure to allocate counter is not fatal. Sending lo = 0, hi = 0 * indicates to GMU that counter allocation failed. */ adreno_perfcounter_get(adreno_dev, in->group_id, in->countable, &lo, &hi, PERFCOUNTER_FLAG_KERNEL); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:1468 [MATCH: struct hfi_] --- } static int gmu_cntr_register_reply(struct adreno_device *adreno_dev, void *rcvd) { struct hfi_gmu_cntr_register_cmd *in = (struct hfi_gmu_cntr_register_cmd *)rcvd; struct hfi_gmu_cntr_register_reply_cmd out = {0}; struct gen7_gmu_device *gmu = to_gen7_gmu(adreno_dev); u32 lo = 0, hi = 0, seqnum; /* * Failure to allocate counter is not fatal. Sending lo = 0, hi = 0 * indicates to GMU that counter allocation failed. */ adreno_perfcounter_get(adreno_dev, in->group_id, in->countable, &lo, &hi, PERFCOUNTER_FLAG_KERNEL); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:1497 [MATCH: struct hfi_] --- static int send_warmboot_start_msg(struct adreno_device *adreno_dev) { struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct gmu_core_device *gmu_core = &device->gmu_core; int ret = 0; struct hfi_start_cmd cmd; if (!gmu_core->warmboot_enabled) return ret; ret = CMD_MSG_HDR(cmd, H2F_MSG_START); if (ret) return ret; cmd.hdr = RECORD_NOP_MSG_HDR(cmd.hdr); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:1518 [MATCH: struct hfi_] --- struct gen7_gmu_device *gmu = to_gen7_gmu(adreno_dev); struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct device *gmu_pdev_dev = GMU_PDEV_DEV(device); u32 seqnum; int ret, rc = 0; struct hfi_start_cmd cmd; u32 rcvd[MAX_RCVD_SIZE]; struct pending_cmd pending_ack = {0}; ret = CMD_MSG_HDR(cmd, H2F_MSG_START); if (ret) return ret; seqnum = atomic_inc_return(&gmu->hfi.seqnum); cmd.hdr = MSG_HDR_SET_SEQNUM_SIZE(cmd.hdr, seqnum, sizeof(cmd) >> 2); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:1601 [MATCH: struct hfi_] --- } static void reset_hfi_queues(struct adreno_device *adreno_dev) { struct gen7_gmu_device *gmu = to_gen7_gmu(adreno_dev); struct hfi_queue_table *tbl = gmu->hfi.hfi_mem->hostptr; u32 i; /* Flush HFI queues */ for (i = 0; i < HFI_QUEUE_MAX; i++) { struct hfi_queue_header *hdr = &tbl->qhdr[i]; if (hdr->status == HFI_QUEUE_STATUS_DISABLED) continue; hdr->read_index = hdr->write_index; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:1752 [MATCH: struct hfi_] --- } u32 gen7_hwsched_hfi_get_value(struct adreno_device *adreno_dev, u32 prop) { struct device *gmu_pdev_dev = GMU_PDEV_DEV(KGSL_DEVICE(adreno_dev)); struct hfi_get_value_cmd cmd; struct gen7_gmu_device *gmu = to_gen7_gmu(adreno_dev); struct gen7_hwsched_hfi *hfi = to_gen7_hwsched_hfi(adreno_dev); struct pending_cmd pending_ack; int rc; u32 seqnum; rc = CMD_MSG_HDR(cmd, H2F_MSG_GET_VALUE); if (rc) return 0; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:1806 [MATCH: struct hfi_] --- struct gen7_gmu_device *gmu = to_gen7_gmu(adreno_dev); struct gen7_hwsched_hfi *hfi = to_gen7_hwsched_hfi(adreno_dev); struct pending_cmd pending_ack; int rc; u32 seqnum; struct hfi_set_value_cmd cmd = { .type = type, .subtype = subtype, .data = data, }; rc = CMD_MSG_HDR(cmd, H2F_MSG_SET_VALUE); if (rc) return 0; seqnum = atomic_inc_return(&gmu->hfi.seqnum); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:1920 [MATCH: struct hfi_] --- } static int gen7_hwsched_hfi_send_warmboot_cmd(struct adreno_device *adreno_dev, struct kgsl_memdesc *desc, u32 flag, bool async, struct pending_cmd *ack) { struct hfi_warmboot_scratch_cmd cmd = {0}; struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct gmu_core_device *gmu_core = &device->gmu_core; int ret; if (!gmu_core->warmboot_enabled) return 0; cmd.scratch_addr = desc->gmuaddr; cmd.scratch_size = desc->size; cmd.flags = flag; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:1949 [MATCH: struct hfi_] --- { struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct gmu_core_device *gmu_core = &device->gmu_core; struct gen7_gmu_device *gmu = to_gen7_gmu(adreno_dev); struct gen7_hwsched_hfi *hfi = to_gen7_hwsched_hfi(adreno_dev); struct hfi_warmboot_scratch_cmd cmd = { .scratch_addr = gmu->gpu_boot_scratch->gmuaddr, .scratch_size = gmu->gpu_boot_scratch->size, .flags = HFI_WARMBOOT_EXEC_SCRATCH, }; int ret = 0; u32 seqnum; if (!gmu_core->warmboot_enabled) return 0; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:2573 [MATCH: struct hfi_] --- static int send_context_register(struct adreno_device *adreno_dev, struct kgsl_context *context) { struct adreno_context *drawctxt = ADRENO_CONTEXT(context); struct hfi_register_ctxt_cmd cmd; struct kgsl_pagetable *pt = context->proc_priv->pagetable; int ret, asid = kgsl_mmu_pagetable_get_asid(pt, context); if (asid < 0) return asid; ret = CMD_MSG_HDR(cmd, H2F_MSG_REGISTER_CONTEXT); if (ret) return ret; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:2608 [MATCH: struct hfi_] --- static int send_context_pointers(struct adreno_device *adreno_dev, struct kgsl_context *context) { struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct hfi_context_pointers_cmd cmd = {0}; struct adreno_context *drawctxt = ADRENO_CONTEXT(context); int ret; ret = CMD_MSG_HDR(cmd, H2F_MSG_CONTEXT_POINTERS); if (ret) return ret; cmd.ctxt_id = context->id; cmd.sop_addr = MEMSTORE_ID_GPU_ADDR(device, context->id, soptimestamp); cmd.eop_addr = MEMSTORE_ID_GPU_ADDR(device, context->id, eoptimestamp); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:2672 [MATCH: struct hfi_] --- return 0; } static void populate_ibs(struct adreno_device *adreno_dev, struct hfi_submit_cmd *cmd, struct kgsl_drawobj_cmd *cmdobj) { struct hfi_issue_ib *issue_ib; struct kgsl_memobj_node *ib; if (cmdobj->numibs > HWSCHED_MAX_DISPATCH_NUMIBS) { struct gen7_hwsched_hfi *hfi = to_gen7_hwsched_hfi(adreno_dev); struct kgsl_memdesc *big_ib; if (test_bit(CMDOBJ_RECURRING_START, &cmdobj->priv)) big_ib = hfi->big_ib_recurring; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:2674 [MATCH: struct hfi_] --- } static void populate_ibs(struct adreno_device *adreno_dev, struct hfi_submit_cmd *cmd, struct kgsl_drawobj_cmd *cmdobj) { struct hfi_issue_ib *issue_ib; struct kgsl_memobj_node *ib; if (cmdobj->numibs > HWSCHED_MAX_DISPATCH_NUMIBS) { struct gen7_hwsched_hfi *hfi = to_gen7_hwsched_hfi(adreno_dev); struct kgsl_memdesc *big_ib; if (test_bit(CMDOBJ_RECURRING_START, &cmdobj->priv)) big_ib = hfi->big_ib_recurring; else big_ib = hfi->big_ib; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:2692 [MATCH: struct hfi_] --- */ cmd->big_ib_gmu_va = big_ib->gmuaddr; cmd->flags |= CMDBATCH_INDIRECT; issue_ib = big_ib->hostptr; } else { issue_ib = (struct hfi_issue_ib *)&cmd[1]; } list_for_each_entry(ib, &cmdobj->cmdlist, node) { issue_ib->addr = ib->gpuaddr; issue_ib->size = ib->size; issue_ib++; } cmd->numibs = cmdobj->numibs; } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:2742 [MATCH: struct hfi_] --- return false; } static void populate_kgsl_fence(struct kgsl_drawobj_sync_hw_fence *hw_fence, struct hfi_syncobj_legacy *obj) { struct kgsl_sync_fence *kfence = (struct kgsl_sync_fence *)hw_fence->fence; struct kgsl_sync_timeline *ktimeline = kfence->parent; unsigned long flags; obj->flags |= BIT(GMU_SYNCOBJ_FLAG_KGSL_FENCE_BIT); spin_lock_irqsave(&ktimeline->lock, flags); if (_is_kgsl_hw_fence_signaled(hw_fence)) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:2770 [MATCH: struct hfi_] --- { struct adreno_context *drawctxt = ADRENO_CONTEXT(drawobj->context); int i; u32 cmd_sizebytes; struct kgsl_drawobj_sync *syncobj = SYNCOBJ(drawobj); struct hfi_submit_syncobj *cmd; struct hfi_syncobj_legacy *obj = NULL; struct kgsl_device *device = KGSL_DEVICE(adreno_dev); u32 seqnum; /* Add hfi_syncobj struct for sync object */ cmd_sizebytes = sizeof(*cmd) + (sizeof(struct hfi_syncobj) * syncobj->num_hw_fence); if (WARN_ON(cmd_sizebytes > HFI_MAX_MSG_SIZE)) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:2771 [MATCH: struct hfi_] --- struct adreno_context *drawctxt = ADRENO_CONTEXT(drawobj->context); int i; u32 cmd_sizebytes; struct kgsl_drawobj_sync *syncobj = SYNCOBJ(drawobj); struct hfi_submit_syncobj *cmd; struct hfi_syncobj_legacy *obj = NULL; struct kgsl_device *device = KGSL_DEVICE(adreno_dev); u32 seqnum; /* Add hfi_syncobj struct for sync object */ cmd_sizebytes = sizeof(*cmd) + (sizeof(struct hfi_syncobj) * syncobj->num_hw_fence); if (WARN_ON(cmd_sizebytes > HFI_MAX_MSG_SIZE)) return -EMSGSIZE; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:2777 [MATCH: struct hfi_] --- struct kgsl_device *device = KGSL_DEVICE(adreno_dev); u32 seqnum; /* Add hfi_syncobj struct for sync object */ cmd_sizebytes = sizeof(*cmd) + (sizeof(struct hfi_syncobj) * syncobj->num_hw_fence); if (WARN_ON(cmd_sizebytes > HFI_MAX_MSG_SIZE)) return -EMSGSIZE; memset(cmdbuf, 0x0, cmd_sizebytes); cmd = cmdbuf; cmd->num_syncobj = syncobj->num_hw_fence; obj = (struct hfi_syncobj_legacy *)&cmd[1]; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:2786 [MATCH: struct hfi_] --- return -EMSGSIZE; memset(cmdbuf, 0x0, cmd_sizebytes); cmd = cmdbuf; cmd->num_syncobj = syncobj->num_hw_fence; obj = (struct hfi_syncobj_legacy *)&cmd[1]; for (i = 0; i < syncobj->num_hw_fence; i++) { struct dma_fence *fence = syncobj->hw_fences[i].fence; if (is_kgsl_fence(fence)) { populate_kgsl_fence(&syncobj->hw_fences[i], obj); } else { int ret = kgsl_hw_fence_add_waiter(device, fence, NULL); if (ret) { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:3040 [MATCH: struct hfi_] --- memset(&hw_fence_ack, 0x0, sizeof(hw_fence_ack)); return ret; } #define DRAWCTXT_SLOT_AVAILABLE(count) \ ((count + 1) < (HW_FENCE_QUEUE_SIZE / sizeof(struct hfi_hw_fence_info))) /** * allocate_hw_fence_entry - Allocate an entry to keep track of a hardware fence. This is free'd * when we know GMU has sent this fence to the TxQueue */ static struct adreno_hw_fence_entry *allocate_hw_fence_entry(struct adreno_device *adreno_dev, struct adreno_context *drawctxt, struct kgsl_sync_fence *kfence) { struct adreno_hwsched *hwsched = &adreno_dev->hwsched; struct adreno_hw_fence_entry *entry; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:3330 [MATCH: struct hfi_] --- /* Size in below functions are in unit of dwords */ static int gen7_hfi_dispatch_queue_write(struct adreno_device *adreno_dev, u32 queue_idx, u32 *msg, u32 size_bytes, struct kgsl_drawobj_cmd *cmdobj, struct adreno_submit_time *time) { struct gen7_gmu_device *gmu = to_gen7_gmu(adreno_dev); struct hfi_queue_table *tbl = gmu->hfi.hfi_mem->hostptr; struct hfi_queue_header *hdr = &tbl->qhdr[queue_idx]; u32 *queue; u32 i, write, empty_space; u32 size_dwords = size_bytes >> 2; u32 align_size = ALIGN(size_dwords, SZ_4); u32 id = MSG_HDR_GET_ID(*msg); if (hdr->status == HFI_QUEUE_STATUS_DISABLED || !IS_ALIGNED(size_bytes, sizeof(u32))) return -EINVAL; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:3392 [MATCH: struct hfi_] --- int gen7_hwsched_submit_drawobj(struct adreno_device *adreno_dev, struct kgsl_drawobj *drawobj) { int ret = 0; u32 cmd_sizebytes, seqnum; struct kgsl_drawobj_cmd *cmdobj = NULL; struct hfi_submit_cmd *cmd; struct adreno_submit_time time = {0}; struct adreno_context *drawctxt = ADRENO_CONTEXT(drawobj->context); static void *cmdbuf; struct gmu_context_queue_header *hdr = NULL; if (cmdbuf == NULL) { struct kgsl_device *device = KGSL_DEVICE(adreno_dev); cmdbuf = devm_kzalloc(&device->pdev->dev, HFI_MAX_MSG_SIZE, GFP_KERNEL); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:3433 [MATCH: struct hfi_] --- if (cmdobj->numibs > HWSCHED_MAX_DISPATCH_NUMIBS || test_bit(CMDOBJ_SKIP, &cmdobj->priv)) cmd_sizebytes = sizeof(*cmd); else cmd_sizebytes = sizeof(*cmd) + (sizeof(struct hfi_issue_ib) * cmdobj->numibs); if (WARN_ON(cmd_sizebytes > HFI_MAX_MSG_SIZE)) return -EMSGSIZE; memset(cmdbuf, 0x0, cmd_sizebytes); cmd = cmdbuf; cmd->ctxt_id = drawobj->context->id; cmd->flags = HFI_CTXT_FLAG_NOTIFY; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:3518 [MATCH: struct hfi_] --- int gen7_hwsched_send_recurring_cmdobj(struct adreno_device *adreno_dev, struct kgsl_drawobj_cmd *cmdobj) { struct adreno_hwsched *hwsched = &adreno_dev->hwsched; struct kgsl_drawobj *drawobj = DRAWOBJ(cmdobj); struct hfi_submit_cmd *cmd; struct kgsl_memobj_node *ib; u32 cmd_sizebytes; int ret; static bool active; if (adreno_gpu_halt(adreno_dev) || adreno_gpu_fault(adreno_dev)) return -EBUSY; if (test_bit(CMDOBJ_RECURRING_STOP, &cmdobj->priv)) { cmdobj->numibs = 0; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:3541 [MATCH: struct hfi_] --- if (cmdobj->numibs > HWSCHED_MAX_DISPATCH_NUMIBS) cmd_sizebytes = sizeof(*cmd); else cmd_sizebytes = sizeof(*cmd) + (sizeof(struct hfi_issue_ib) * cmdobj->numibs); if (WARN_ON(cmd_sizebytes > HFI_MAX_MSG_SIZE)) return -EMSGSIZE; cmd = kzalloc(cmd_sizebytes, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; if (test_bit(CMDOBJ_RECURRING_START, &cmdobj->priv)) { if (!active) { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:3674 [MATCH: struct hfi_] --- struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct gen7_gmu_device *gmu = to_gen7_gmu(adreno_dev); struct gen7_hwsched_hfi *hfi = to_gen7_hwsched_hfi(adreno_dev); struct adreno_context *drawctxt = ADRENO_CONTEXT(context); struct pending_cmd pending_ack; struct hfi_unregister_ctxt_cmd cmd; u32 seqnum; int ret; /* Only send HFI if device is not in SLUMBER */ if (!context->gmu_registered || !test_bit(GMU_PRIV_GPU_STARTED, &gmu->flags)) { drain_context_hw_fences(adreno_dev, drawctxt); return 0; } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:3794 [MATCH: struct hfi_] --- static int register_global_ctxt(struct adreno_device *adreno_dev) { struct adreno_hwsched *hwsched = &adreno_dev->hwsched; struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct hfi_register_ctxt_cmd rcmd = {0}; struct hfi_context_pointers_cmd pcmd = {0}; int ret; if (hwsched->global_ctxt_gmu_registered) return 0; if (adreno_hwsched_context_queue_enabled(adreno_dev) && !hwsched->global_ctxtq.hostptr) { struct gmu_context_queue_header *hdr; ret = gmu_core_alloc_kernel_block(device, &hwsched->global_ctxtq, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:3795 [MATCH: struct hfi_] --- static int register_global_ctxt(struct adreno_device *adreno_dev) { struct adreno_hwsched *hwsched = &adreno_dev->hwsched; struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct hfi_register_ctxt_cmd rcmd = {0}; struct hfi_context_pointers_cmd pcmd = {0}; int ret; if (hwsched->global_ctxt_gmu_registered) return 0; if (adreno_hwsched_context_queue_enabled(adreno_dev) && !hwsched->global_ctxtq.hostptr) { struct gmu_context_queue_header *hdr; ret = gmu_core_alloc_kernel_block(device, &hwsched->global_ctxtq, SZ_4K, GMU_NONCACHED_KERNEL, IOMMU_READ | IOMMU_WRITE | IOMMU_PRIV); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:3850 [MATCH: struct hfi_] --- static int submit_global_ctxt_cmd(struct adreno_device *adreno_dev, u64 gpuaddr, u32 size) { struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct adreno_hwsched *hwsched = &adreno_dev->hwsched; struct { struct hfi_submit_cmd submit_cmd; struct hfi_issue_ib issue_ib; } cmd = {0}; u32 seqnum, cmd_size = sizeof(cmd); static u32 ts; int ret; cmd.submit_cmd.ctxt_id = KGSL_GLOBAL_CTXT_ID; cmd.submit_cmd.ts = ++ts; cmd.submit_cmd.numibs = 1; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:3851 [MATCH: struct hfi_] --- { struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct adreno_hwsched *hwsched = &adreno_dev->hwsched; struct { struct hfi_submit_cmd submit_cmd; struct hfi_issue_ib issue_ib; } cmd = {0}; u32 seqnum, cmd_size = sizeof(cmd); static u32 ts; int ret; cmd.submit_cmd.ctxt_id = KGSL_GLOBAL_CTXT_ID; cmd.submit_cmd.ts = ++ts; cmd.submit_cmd.numibs = 1; cmd.issue_ib.addr = gpuaddr; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:1141 [MATCH: HFI_MSG_ID] --- return; mutex_lock(&hw_hfi->msgq_mutex); for (;;) { next_hdr = peek_next_header(adreno_dev, gmu, HFI_MSG_ID); if (!next_hdr) break; if (MSG_HDR_GET_TYPE(next_hdr) == HFI_MSG_ACK) type = HFI_MSG_ACK; else type = MSG_HDR_GET_ID(next_hdr); if (type != F2H_MSG_CONTEXT_BAD) { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:1152 [MATCH: HFI_MSG_ID] --- type = HFI_MSG_ACK; else type = MSG_HDR_GET_ID(next_hdr); if (type != F2H_MSG_CONTEXT_BAD) { if (gen7_hfi_queue_read(gmu, HFI_MSG_ID, rcvd, sizeof(rcvd)) < 0) break; } switch (type) { case HFI_MSG_ACK: /* * We are assuming that there is only one outstanding ack because hfi * sending thread waits for completion while holding the device mutex * (except when we send H2F_MSG_HW_FENCE_INFO packets) */ --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:1169 [MATCH: HFI_MSG_ID] --- process_hw_fence_ack(adreno_dev, rcvd); else gen7_receive_ack_async(adreno_dev, rcvd); break; case F2H_MSG_CONTEXT_BAD: if (gen7_hfi_queue_read(gmu, HFI_MSG_ID, (u32 *)adreno_dev->hwsched.ctxt_bad, HFI_MAX_MSG_SIZE) < 0) break; process_ctx_bad(adreno_dev); break; case F2H_MSG_TS_RETIRE: adreno_hwsched_log_profiling_info(adreno_dev, rcvd); adreno_scheduler_queue(adreno_dev); break; case F2H_MSG_SYNCOBJ_QUERY: --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:1546 [MATCH: HFI_MSG_ID] --- seqnum); gmu_core_fault_snapshot(device, GMU_FAULT_H2F_MSG_START); goto done; } rc = gen7_hfi_queue_read(gmu, HFI_MSG_ID, rcvd, sizeof(rcvd)); if (rc <= 0) { dev_err(gmu_pdev_dev, "MSG_START: payload error: %d\n", rc); gmu_core_fault_snapshot(device, GMU_FAULT_H2F_MSG_START); goto done; } switch (MSG_HDR_GET_ID(rcvd[0])) { case F2H_MSG_MEM_ALLOC: --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c:2395 [MATCH: HFI_MSG_ID] --- while (!kthread_should_stop()) { wait_event_interruptible(hfi->f2h_wq, kthread_should_stop() || /* If msgq irq is enabled and msgq has messages to process */ (((hfi->irq_mask & HFI_IRQ_MSGQ_MASK) && !is_queue_empty(adreno_dev, HFI_MSG_ID)) || /* Trace buffer has messages to process */ !gmu_core_is_trace_empty(device->gmu_core.trace.md->hostptr) || /* Dbgq has messages to process */ !is_queue_empty(adreno_dev, HFI_DBG_ID))); if (kthread_should_stop()) break; gen7_hwsched_process_msgq(adreno_dev); gmu_core_process_trace_data(KGSL_DEVICE(adreno_dev), --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.h:12 [MATCH: struct hfi_] --- #ifndef _ADRENO_GEN7_HWSCHED_HFI_H_ #define _ADRENO_GEN7_HWSCHED_HFI_H_ /* Maximum number of IBs in a submission */ #define HWSCHED_MAX_NUMIBS \ ((HFI_MAX_MSG_SIZE - offsetof(struct hfi_issue_cmd_cmd, ibs)) \ / sizeof(struct hfi_issue_ib)) /* * This is used to put userspace threads to sleep when hardware fence unack count reaches a * threshold. This bit is cleared in two scenarios: * 1. If the hardware fence unack count drops to a desired threshold. * 2. If there is a GMU/GPU fault. Because we don't want the threads to keep sleeping through fault * recovery, which can easily take 100s of milliseconds to complete. */ #define GEN7_HWSCHED_HW_FENCE_SLEEP_BIT 0x0 --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.h:13 [MATCH: struct hfi_] --- #define _ADRENO_GEN7_HWSCHED_HFI_H_ /* Maximum number of IBs in a submission */ #define HWSCHED_MAX_NUMIBS \ ((HFI_MAX_MSG_SIZE - offsetof(struct hfi_issue_cmd_cmd, ibs)) \ / sizeof(struct hfi_issue_ib)) /* * This is used to put userspace threads to sleep when hardware fence unack count reaches a * threshold. This bit is cleared in two scenarios: * 1. If the hardware fence unack count drops to a desired threshold. * 2. If there is a GMU/GPU fault. Because we don't want the threads to keep sleeping through fault * recovery, which can easily take 100s of milliseconds to complete. */ #define GEN7_HWSCHED_HW_FENCE_SLEEP_BIT 0x0 --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8.h:134 [MATCH: struct hfi_] --- /** * struct gen8_limits_mit_cfg - Container for GPU limits mitigation configuration */ struct gen8_limits_mit_cfg { /** @limits_mit_tbl: Table for GPU limits mitigation features */ const struct hfi_limits_mit_tbl *limits_mit_tbl; /** @len: Number of entries in the table */ u32 len; }; /** * struct therm_tsens_en_cfg - Container for thermal tsense configuration */ struct therm_tsens_en_cfg { /** @tsens_sl_cnt: Temperature sensor count per GPU slice */ u32 tsens_sl_cnt; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8.h:154 [MATCH: struct hfi_] --- /** * struct gen8_thermal_mit_cfg - Container for GPU thermal mitigation configuration */ struct gen8_thermal_mit_cfg { /** @therm: Config for GPU thermal mitigation features */ struct hfi_therm_profile_ctrl *therm; /** @tsens_en_cfg: Config for GPU thermal mitigation features */ const struct therm_tsens_en_cfg *tsens_en_cfg; }; /** * struct adreno_gen8_core - gen8 specific GPU core definitions */ struct adreno_gen8_core { /** @base: Container for the generic GPU definitions */ struct adreno_gpu_core base; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8.h:226 [MATCH: struct hfi_] --- /** @therm_profile: GMU thermal mitigation profile */ struct gen8_thermal_mit_cfg *therm_cfg; /** @limits_mit_cfg: GPU limits mitigation configuration */ const struct gen8_limits_mit_cfg *limits_mit_cfg; /** @clx_tbl: GPU CLX table */ const struct hfi_clx_table_v2_cmd *clx_tbl; /** @gmu_mx_gdsc: This target has separate MX GDSC for the GMU */ bool gmu_mx_gdsc; /** @three_rail_memory: This target has BX rail in addition to GX and MX */ bool three_rail_memory; /** @malu: This target has MALU */ bool malu; }; /** * struct gen8_cp_preemption_record - CP context record for --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hfi.c:22 [MATCH: struct hfi_] --- /* Below section is for all structures related to HFI queues */ #define HFI_QUEUE_MAX HFI_QUEUE_DEFAULT_CNT /* Total header sizes + queue sizes + 16 for alignment */ #define HFIMEM_SIZE (sizeof(struct hfi_queue_table) + 16 + \ (HFI_QUEUE_SIZE * HFI_QUEUE_MAX)) #define HOST_QUEUE_START_ADDR(hfi_mem, i) \ ((hfi_mem)->hostptr + HFI_QUEUE_OFFSET(i)) struct gen8_hfi *to_gen8_hfi(struct adreno_device *adreno_dev) { struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev); return &gmu->hfi; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hfi.c:41 [MATCH: struct hfi_] --- int gen8_hfi_queue_read(struct gen8_gmu_device *gmu, u32 queue_idx, u32 *output, u32 max_size) { struct kgsl_device *device = KGSL_DEVICE(gen8_gmu_to_adreno(gmu)); struct kgsl_memdesc *mem_addr = gmu->hfi.hfi_mem; struct hfi_queue_table *tbl = mem_addr->hostptr; struct hfi_queue_header *hdr = &tbl->qhdr[queue_idx]; u32 *queue; u32 msg_hdr; u32 i, read; u32 size; int result = 0; if (hdr->status == HFI_QUEUE_STATUS_DISABLED) return -EINVAL; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hfi.c:107 [MATCH: struct hfi_] --- int gen8_hfi_queue_write(struct adreno_device *adreno_dev, u32 queue_idx, u32 *msg, u32 size_bytes) { struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev); struct hfi_queue_table *tbl = gmu->hfi.hfi_mem->hostptr; struct hfi_queue_header *hdr = &tbl->qhdr[queue_idx]; u32 *queue; u32 i, write_idx, read_idx, empty_space; u32 size_dwords = size_bytes >> 2; u32 align_size = ALIGN(size_dwords, SZ_4); u32 id = MSG_HDR_GET_ID(*msg); if (hdr->status == HFI_QUEUE_STATUS_DISABLED || !IS_ALIGNED(size_bytes, sizeof(u32))) return -EINVAL; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hfi.c:189 [MATCH: struct hfi_] --- static void init_queues(struct adreno_device *adreno_dev) { struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev); struct kgsl_memdesc *mem_addr = gmu->hfi.hfi_mem; int i; struct hfi_queue_table *tbl; struct hfi_queue_header *hdr; struct { u32 idx; u32 pri; u32 status; } queue[HFI_QUEUE_MAX] = { { HFI_CMD_ID, HFI_CMD_PRI, HFI_QUEUE_STATUS_ENABLED }, { HFI_MSG_ID, HFI_MSG_PRI, HFI_QUEUE_STATUS_ENABLED }, { HFI_DBG_ID, HFI_DBG_PRI, HFI_QUEUE_STATUS_ENABLED }, }; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hfi.c:190 [MATCH: struct hfi_] --- { struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev); struct kgsl_memdesc *mem_addr = gmu->hfi.hfi_mem; int i; struct hfi_queue_table *tbl; struct hfi_queue_header *hdr; struct { u32 idx; u32 pri; u32 status; } queue[HFI_QUEUE_MAX] = { { HFI_CMD_ID, HFI_CMD_PRI, HFI_QUEUE_STATUS_ENABLED }, { HFI_MSG_ID, HFI_MSG_PRI, HFI_QUEUE_STATUS_ENABLED }, { HFI_DBG_ID, HFI_DBG_PRI, HFI_QUEUE_STATUS_ENABLED }, }; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hfi.c:204 [MATCH: struct hfi_] --- }; /* Fill Table Header */ tbl = mem_addr->hostptr; tbl->qtbl_hdr.version = 0; tbl->qtbl_hdr.size = sizeof(struct hfi_queue_table) >> 2; tbl->qtbl_hdr.qhdr0_offset = sizeof(struct hfi_queue_table_header) >> 2; tbl->qtbl_hdr.qhdr_size = sizeof(struct hfi_queue_header) >> 2; tbl->qtbl_hdr.num_q = HFI_QUEUE_MAX; tbl->qtbl_hdr.num_active_q = HFI_QUEUE_MAX; memset(&tbl->qhdr[0], 0, sizeof(tbl->qhdr)); /* Fill Individual Queue Headers */ for (i = 0; i < HFI_QUEUE_MAX; i++) { hdr = &tbl->qhdr[i]; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hfi.c:384 [MATCH: struct hfi_] --- return 0; } int gen8_hfi_send_core_fw_start(struct adreno_device *adreno_dev) { struct hfi_core_fw_start_cmd cmd = { .handle = 0x0, }; int ret; ret = CMD_MSG_HDR(cmd, H2F_MSG_CORE_FW_START); if (ret) return ret; return gen8_hfi_send_generic_req(adreno_dev, &cmd, sizeof(cmd)); } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hfi.c:437 [MATCH: struct hfi_] --- int gen8_hfi_send_feature_ctrl(struct adreno_device *adreno_dev, u32 feature, u32 enable, u32 data) { struct pending_cmd ret_cmd = {0}; struct hfi_feature_ctrl_cmd cmd = { .feature = feature, .enable = enable, .data = data, }; int ret; ret = CMD_MSG_HDR(cmd, H2F_MSG_FEATURE_CTRL); if (ret) return ret; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hfi.c:459 [MATCH: struct hfi_] --- } int gen8_hfi_send_get_value(struct adreno_device *adreno_dev, u32 type, u32 subtype) { struct pending_cmd ret_cmd = {0}; struct hfi_get_value_cmd cmd = { .type = type, .subtype = subtype, }; int ret; ret = CMD_MSG_HDR(cmd, H2F_MSG_GET_VALUE); if (ret) return ret; ret = gen8_hfi_send_generic_req_v5(adreno_dev, &cmd, &ret_cmd, sizeof(cmd)); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hfi.c:482 [MATCH: struct hfi_] --- int gen8_hfi_send_set_value(struct adreno_device *adreno_dev, u32 type, u32 subtype, u32 data) { struct pending_cmd ret_cmd = {0}; struct hfi_set_value_cmd cmd = { .type = type, .subtype = subtype, .data = data, }; int ret; ret = CMD_MSG_HDR(cmd, H2F_MSG_SET_VALUE); if (ret) return ret; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hfi.c:506 [MATCH: struct hfi_] --- void adreno_gen8_receive_err_req(struct gen8_gmu_device *gmu, void *rcvd) { struct kgsl_device *device = KGSL_DEVICE(gen8_gmu_to_adreno(gmu)); const struct adreno_gpudev *gpudev = ADRENO_GPU_DEVICE(ADRENO_DEVICE(device)); u64 ticks = gpudev->read_alwayson(ADRENO_DEVICE(device)); struct hfi_err_cmd *cmd = rcvd; dev_err(GMU_PDEV_DEV(device), "HFI Error Received: %d %d %.16s\n", ((cmd->error_code >> 16) & 0xffff), (cmd->error_code & 0xffff), (char *) cmd->data); KGSL_GMU_CORE_FORCE_PANIC(device->gmu_core.gf_panic, GMU_PDEV(device), ticks, GMU_FAULT_F2H_MSG_ERR); } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hfi.c:520 [MATCH: struct hfi_] --- } void adreno_gen8_receive_debug_req(struct gen8_gmu_device *gmu, void *rcvd) { struct kgsl_device *device = KGSL_DEVICE(gen8_gmu_to_adreno(gmu)); struct hfi_debug_cmd *cmd = rcvd; dev_dbg(GMU_PDEV_DEV(device), "HFI Debug Received: %d %d %d\n", cmd->type, cmd->timestamp, cmd->data); } int gen8_hfi_process_queue(struct gen8_gmu_device *gmu, u32 queue_idx, struct pending_cmd *ret_cmd) { struct kgsl_device *device = KGSL_DEVICE(gen8_gmu_to_adreno(gmu)); struct adreno_device *adreno_dev = ADRENO_DEVICE(device); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hfi.c:600 [MATCH: struct hfi_] --- int gen8_hfi_send_iff_pclx_feature_ctrl(struct adreno_device *adreno_dev) { const struct adreno_gen8_core *gen8_core = to_gen8_core(adreno_dev); struct kgsl_device *device = KGSL_DEVICE(adreno_dev); static struct hfi_table_cmd *tbl_cmd; struct hfi_table_entry *entry; u32 hdr_size, len; int ret; if (!gen8_core->limits_mit_cfg) return 0; len = gen8_core->limits_mit_cfg->len; hdr_size = sizeof(*tbl_cmd) + sizeof(*entry) + (len * sizeof(struct hfi_limits_mit_tbl)); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hfi.c:601 [MATCH: struct hfi_] --- int gen8_hfi_send_iff_pclx_feature_ctrl(struct adreno_device *adreno_dev) { const struct adreno_gen8_core *gen8_core = to_gen8_core(adreno_dev); struct kgsl_device *device = KGSL_DEVICE(adreno_dev); static struct hfi_table_cmd *tbl_cmd; struct hfi_table_entry *entry; u32 hdr_size, len; int ret; if (!gen8_core->limits_mit_cfg) return 0; len = gen8_core->limits_mit_cfg->len; hdr_size = sizeof(*tbl_cmd) + sizeof(*entry) + (len * sizeof(struct hfi_limits_mit_tbl)); if (!tbl_cmd) { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hfi.c:609 [MATCH: struct hfi_] --- if (!gen8_core->limits_mit_cfg) return 0; len = gen8_core->limits_mit_cfg->len; hdr_size = sizeof(*tbl_cmd) + sizeof(*entry) + (len * sizeof(struct hfi_limits_mit_tbl)); if (!tbl_cmd) { tbl_cmd = devm_kzalloc(&device->pdev->dev, hdr_size, GFP_KERNEL); if (!tbl_cmd) return -ENOMEM; } ret = gen8_hfi_send_feature_ctrl(adreno_dev, HFI_FEATURE_IFF_PCLX, 1, 0); if (ret) return ret; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hfi.c:630 [MATCH: struct hfi_] --- tbl_cmd->version = 0; tbl_cmd->type = HFI_TABLE_LIMITS_MITIGATION; entry = tbl_cmd->entry; entry->count = len; entry->stride = sizeof(struct hfi_limits_mit_tbl) >> 2; memcpy(entry->data, gen8_core->limits_mit_cfg->limits_mit_tbl, entry->count * (entry->stride << 2)); return gen8_hfi_send_generic_req(adreno_dev, tbl_cmd, hdr_size); } int gen8_hfi_send_minbw_feature_ctrl(struct adreno_device *adreno_dev) { struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hfi.c:656 [MATCH: struct hfi_] --- } int gen8_hfi_send_clx_feature_ctrl(struct adreno_device *adreno_dev) { const struct adreno_gen8_core *gen8_core = to_gen8_core(adreno_dev); struct hfi_clx_table_v2_cmd cmd = {0}; int ret; if (!adreno_dev->clx_enabled) return 0; if (WARN_ON(!gen8_core->clx_tbl)) { adreno_dev->clx_enabled = false; return 0; } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hfi.c:667 [MATCH: struct hfi_] --- if (WARN_ON(!gen8_core->clx_tbl)) { adreno_dev->clx_enabled = false; return 0; } memcpy(&cmd, gen8_core->clx_tbl, sizeof(struct hfi_clx_table_v2_cmd)); /* Make sure the table is valid before enabling feature */ ret = CMD_MSG_HDR(cmd, H2F_MSG_CLX_TBL); if (ret) return ret; ret = gen8_hfi_send_feature_ctrl(adreno_dev, HFI_FEATURE_CLX, 1, 0); if (ret) return ret; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hfi.c:724 [MATCH: struct hfi_] --- static void reset_hfi_queues(struct adreno_device *adreno_dev) { struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev); struct kgsl_memdesc *mem_addr = gmu->hfi.hfi_mem; struct hfi_queue_table *tbl = mem_addr->hostptr; struct hfi_queue_header *hdr; u32 i; /* Flush HFI queues */ for (i = 0; i < HFI_QUEUE_MAX; i++) { hdr = &tbl->qhdr[i]; if (hdr->status == HFI_QUEUE_STATUS_DISABLED) continue; hdr->read_index = hdr->write_index; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hfi.c:725 [MATCH: struct hfi_] --- static void reset_hfi_queues(struct adreno_device *adreno_dev) { struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev); struct kgsl_memdesc *mem_addr = gmu->hfi.hfi_mem; struct hfi_queue_table *tbl = mem_addr->hostptr; struct hfi_queue_header *hdr; u32 i; /* Flush HFI queues */ for (i = 0; i < HFI_QUEUE_MAX; i++) { hdr = &tbl->qhdr[i]; if (hdr->status == HFI_QUEUE_STATUS_DISABLED) continue; hdr->read_index = hdr->write_index; } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hfi.c:739 [MATCH: struct hfi_] --- hdr->read_index = hdr->write_index; } } /* Fill the entry and return the dword count written */ static u32 _fill_table_entry(struct hfi_table_entry *entry, u32 count, u32 stride_bytes, u32 *data) { entry->count = count; entry->stride = stride_bytes >> 2; /* entry->stride is in dwords */ memcpy(entry->data, data, stride_bytes * count); /* Return total dword count of entry + data */ return (sizeof(*entry) >> 2) + (entry->count * entry->stride); } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hfi.c:759 [MATCH: struct hfi_] --- * Current max size for either is 165 dwords. */ static u32 cmd_buf[200]; struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev); struct gen8_dcvs_table *tbl = &gmu->dcvs_table; struct hfi_table_cmd *cmd = (struct hfi_table_cmd *)&cmd_buf[0]; u32 dword_off; /* Already setup, so just send cmd */ if (cmd->hdr) return gen8_hfi_send_generic_req(adreno_dev, cmd, MSG_HDR_GET_SIZE(cmd->hdr) << 2); if (tbl->gpu_level_num > MAX_GX_LEVELS || tbl->gmu_level_num > MAX_CX_LEVELS) return -EINVAL; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hfi.c:770 [MATCH: struct hfi_] --- MSG_HDR_GET_SIZE(cmd->hdr) << 2); if (tbl->gpu_level_num > MAX_GX_LEVELS || tbl->gmu_level_num > MAX_CX_LEVELS) return -EINVAL; /* CMD starts with struct hfi_table_cmd data */ cmd->type = HFI_TABLE_GPU_PERF; dword_off = sizeof(*cmd) >> 2; /* Fill in the table entry and data starting at dword_off */ dword_off += _fill_table_entry((struct hfi_table_entry *)&cmd_buf[dword_off], tbl->gpu_level_num, sizeof(struct opp_gx_desc), (u32 *)tbl->gx_votes); /* Fill in the table entry and data starting at dword_off */ dword_off += _fill_table_entry((struct hfi_table_entry *)&cmd_buf[dword_off], --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hfi.c:775 [MATCH: struct hfi_] --- /* CMD starts with struct hfi_table_cmd data */ cmd->type = HFI_TABLE_GPU_PERF; dword_off = sizeof(*cmd) >> 2; /* Fill in the table entry and data starting at dword_off */ dword_off += _fill_table_entry((struct hfi_table_entry *)&cmd_buf[dword_off], tbl->gpu_level_num, sizeof(struct opp_gx_desc), (u32 *)tbl->gx_votes); /* Fill in the table entry and data starting at dword_off */ dword_off += _fill_table_entry((struct hfi_table_entry *)&cmd_buf[dword_off], tbl->gmu_level_num, sizeof(struct opp_desc), (u32 *)tbl->cx_votes); cmd->hdr = CREATE_MSG_HDR(H2F_MSG_TABLE, HFI_MSG_CMD); cmd->hdr = MSG_HDR_SET_SIZE(cmd->hdr, dword_off); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hfi.c:780 [MATCH: struct hfi_] --- dword_off += _fill_table_entry((struct hfi_table_entry *)&cmd_buf[dword_off], tbl->gpu_level_num, sizeof(struct opp_gx_desc), (u32 *)tbl->gx_votes); /* Fill in the table entry and data starting at dword_off */ dword_off += _fill_table_entry((struct hfi_table_entry *)&cmd_buf[dword_off], tbl->gmu_level_num, sizeof(struct opp_desc), (u32 *)tbl->cx_votes); cmd->hdr = CREATE_MSG_HDR(H2F_MSG_TABLE, HFI_MSG_CMD); cmd->hdr = MSG_HDR_SET_SIZE(cmd->hdr, dword_off); return gen8_hfi_send_generic_req(adreno_dev, cmd, dword_off << 2); } int gen8_hfi_start(struct adreno_device *adreno_dev) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hfi.c:197 [MATCH: HFI_MSG_ID] --- u32 idx; u32 pri; u32 status; } queue[HFI_QUEUE_MAX] = { { HFI_CMD_ID, HFI_CMD_PRI, HFI_QUEUE_STATUS_ENABLED }, { HFI_MSG_ID, HFI_MSG_PRI, HFI_QUEUE_STATUS_ENABLED }, { HFI_DBG_ID, HFI_DBG_PRI, HFI_QUEUE_STATUS_ENABLED }, }; /* Fill Table Header */ tbl = mem_addr->hostptr; tbl->qtbl_hdr.version = 0; tbl->qtbl_hdr.size = sizeof(struct hfi_queue_table) >> 2; tbl->qtbl_hdr.qhdr0_offset = sizeof(struct hfi_queue_table_header) >> 2; tbl->qtbl_hdr.qhdr_size = sizeof(struct hfi_queue_header) >> 2; tbl->qtbl_hdr.num_q = HFI_QUEUE_MAX; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hfi.c:571 [MATCH: HFI_MSG_ID] --- break; } } /** * gen8_hfi_process_queue with HFI_MSG_ID uses a synchronous HFI which expects * an ACK. Poll again if we processed the queue but didn't receive the expected ACK. * Return -EAGAIN to trigger another polling attempt. */ if ((retry_for_ack) && (queue_idx == HFI_MSG_ID)) return -EAGAIN; return 0; } int gen8_hfi_send_bcl_feature_ctrl(struct adreno_device *adreno_dev) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hfi.c:575 [MATCH: HFI_MSG_ID] --- /** * gen8_hfi_process_queue with HFI_MSG_ID uses a synchronous HFI which expects * an ACK. Poll again if we processed the queue but didn't receive the expected ACK. * Return -EAGAIN to trigger another polling attempt. */ if ((retry_for_ack) && (queue_idx == HFI_MSG_ID)) return -EAGAIN; return 0; } int gen8_hfi_send_bcl_feature_ctrl(struct adreno_device *adreno_dev) { if (!adreno_dev->bcl_enabled) return 0; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hfi.h:25 [MATCH: struct hfi_] --- */ atomic_t seqnum; /** @hfi_mem: Memory descriptor for the hfi memory */ struct kgsl_memdesc *hfi_mem; /** @bw_table: HFI BW table buffer */ struct hfi_bwtable_cmd bw_table; /** @acd_table: HFI table for ACD data */ struct hfi_acd_table_cmd acd_table; /** @cmdq_lock: Spinlock for accessing the cmdq */ spinlock_t cmdq_lock; /** * @wb_set_record_bitmask: Bitmask to enable or disable the recording * of messages in the GMU scratch. */ unsigned long wb_set_record_bitmask[BITS_TO_LONGS(HFI_MAX_ID)]; }; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hfi.h:27 [MATCH: struct hfi_] --- /** @hfi_mem: Memory descriptor for the hfi memory */ struct kgsl_memdesc *hfi_mem; /** @bw_table: HFI BW table buffer */ struct hfi_bwtable_cmd bw_table; /** @acd_table: HFI table for ACD data */ struct hfi_acd_table_cmd acd_table; /** @cmdq_lock: Spinlock for accessing the cmdq */ spinlock_t cmdq_lock; /** * @wb_set_record_bitmask: Bitmask to enable or disable the recording * of messages in the GMU scratch. */ unsigned long wb_set_record_bitmask[BITS_TO_LONGS(HFI_MAX_ID)]; }; struct gen8_gmu_device; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched.c:91 [MATCH: struct hfi_] --- if (parse_payload) skip_memkind_rb = true; for (i = 0; i < hwsched->mem_alloc_entries; i++) { struct hfi_mem_alloc_entry *entry = &hwsched->mem_alloc_table[i]; if (entry->desc.mem_kind == HFI_MEMKIND_RB && !skip_memkind_rb) kgsl_snapshot_add_section(device, KGSL_SNAPSHOT_SECTION_RB_V2, snapshot, adreno_hwsched_snapshot_rb, entry->md); if (entry->desc.mem_kind == HFI_MEMKIND_SCRATCH) kgsl_snapshot_add_section(device, KGSL_SNAPSHOT_SECTION_GPU_OBJECT_V2, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched.c:524 [MATCH: struct hfi_] --- static int gen8_hwsched_notify_slumber(struct adreno_device *adreno_dev) { struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct kgsl_pwrctrl *pwr = &device->pwrctrl; struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev); struct hfi_prep_slumber_cmd req; int ret; ret = CMD_MSG_HDR(req, H2F_MSG_PREPARE_SLUMBER); if (ret) return ret; req.freq = gmu->dcvs_table.gpu_level_num - pwr->default_pwrlevel - 1; req.bw = pwr->pwrlevels[pwr->default_pwrlevel].bus_freq; req.bw |= adreno_gmu_bus_ab_quantize(adreno_dev, 0); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched.c:1188 [MATCH: struct hfi_] --- { struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct kgsl_pwrctrl *pwr = &device->pwrctrl; struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev); struct gen8_dcvs_table *table = &gmu->dcvs_table; struct hfi_gx_bw_perf_vote_cmd req = { .ack_type = DCVS_ACK_BLOCK, .freq = INVALID_DCVS_IDX, .bw = INVALID_DCVS_IDX, }; int ret; if (!test_bit(GMU_PRIV_HFI_STARTED, &gmu->flags)) return 0; /* Do not set to XO and lower GPU clock vote from GMU */ --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched.c:1692 [MATCH: struct hfi_] --- void gen8_hwsched_set_pwrconstraint(struct adreno_device *adreno_dev, u32 context_id) { struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct kgsl_context *context = kgsl_context_get(device, context_id); struct hfi_context_rule_cmd cmd = {0}; int ret; if ((!context) || (!context->gmu_registered) || (device->state != KGSL_STATE_ACTIVE)) goto done; ret = CMD_MSG_HDR(cmd, H2F_MSG_CONTEXT_RULE); if (ret) goto done; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched.c:2219 [MATCH: struct hfi_] --- return ret; } /* Dump HFI hwsched global mem alloc entries */ for (i = 0; i < hwsched->mem_alloc_entries; i++) { struct hfi_mem_alloc_entry *entry = &hwsched->mem_alloc_table[i]; char hfi_minidump_str[MAX_VA_MINIDUMP_STR_LEN] = {0}; char name[MAX_VA_MINIDUMP_STR_LEN]; u32 rb_id = 0; if (!hfi_get_minidump_string(entry->desc.mem_kind, &hfi_minidump_str[0], sizeof(hfi_minidump_str), &rb_id)) { snprintf(name, sizeof(name), "kgsl_global_%s", hfi_minidump_str); ret = kgsl_add_va_to_minidump(adreno_dev->dev.dev, name, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:138 [MATCH: struct hfi_] --- struct syncobj_flags { unsigned long mask; const char *name; }; static void _get_syncobj_string(char *str, u32 max_size, struct hfi_syncobj *syncobj, u32 index) { u32 count = scnprintf(str, max_size, "syncobj[%d] ctxt_id:%llu seqno:%llu flags:", index, syncobj->ctxt_id, syncobj->seq_no); u32 i; bool first = true; static const struct syncobj_flags _flags[] = { GMU_SYNCOBJ_FLAGS, { -1, NULL }}; for (i = 0; _flags[i].name; i++) { if (!(syncobj->flags & _flags[i].mask)) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:161 [MATCH: struct hfi_] --- } } } static void log_syncobj(struct gen8_gmu_device *gmu, struct adreno_context *drawctxt, struct hfi_submit_syncobj *cmd, u32 syncobj_read_idx) { struct kgsl_device *device = KGSL_DEVICE(gen8_gmu_to_adreno(gmu)); struct gmu_context_queue_header *hdr = drawctxt->gmu_context_queue.hostptr; struct hfi_syncobj syncobj; char str[128]; u32 i = 0; for (i = 0; i < cmd->num_syncobj; i++) { if (adreno_gmu_context_queue_read(drawctxt, (u32 *) &syncobj, syncobj_read_idx, sizeof(syncobj) >> 2)) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:165 [MATCH: struct hfi_] --- static void log_syncobj(struct gen8_gmu_device *gmu, struct adreno_context *drawctxt, struct hfi_submit_syncobj *cmd, u32 syncobj_read_idx) { struct kgsl_device *device = KGSL_DEVICE(gen8_gmu_to_adreno(gmu)); struct gmu_context_queue_header *hdr = drawctxt->gmu_context_queue.hostptr; struct hfi_syncobj syncobj; char str[128]; u32 i = 0; for (i = 0; i < cmd->num_syncobj; i++) { if (adreno_gmu_context_queue_read(drawctxt, (u32 *) &syncobj, syncobj_read_idx, sizeof(syncobj) >> 2)) break; _get_syncobj_string(str, sizeof(str), &syncobj, i); dev_err(GMU_PDEV_DEV(device), "%s\n", str); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:187 [MATCH: struct hfi_] --- struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev); struct kgsl_context *context = NULL; struct adreno_context *drawctxt; struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct gmu_context_queue_header *hdr; struct hfi_submit_syncobj cmd; u32 *queue, i; int ret; /* We want to get the context even if it is detached */ read_lock(&device->context_lock); context = idr_find(&device->context_idr, ctxt_id); ret = _kgsl_context_get(context); read_unlock(&device->context_lock); if (!ret) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:233 [MATCH: struct hfi_] --- /* Look up a particular key's value for a given type of payload */ static u32 gen8_hwsched_lookup_key_value(struct adreno_device *adreno_dev, u32 type, u32 key) { struct hfi_context_bad_cmd *cmd = adreno_dev->hwsched.ctxt_bad; u32 i = 0, payload_bytes; void *start; if (!cmd->hdr) return 0; payload_bytes = (MSG_HDR_GET_SIZE(cmd->hdr) << 2) - offsetof(struct hfi_context_bad_cmd, payload); start = &cmd->payload[0]; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:241 [MATCH: struct hfi_] --- if (!cmd->hdr) return 0; payload_bytes = (MSG_HDR_GET_SIZE(cmd->hdr) << 2) - offsetof(struct hfi_context_bad_cmd, payload); start = &cmd->payload[0]; while (i < payload_bytes) { struct payload_section *payload = start + i; if (payload->type == type) return adreno_hwsched_parse_payload(payload, key); i += struct_size(payload, data, payload->dwords); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:271 [MATCH: struct hfi_] --- } static bool log_gpu_fault(struct adreno_device *adreno_dev) { struct device *gmu_pdev_dev = GMU_PDEV_DEV(KGSL_DEVICE(adreno_dev)); struct hfi_context_bad_cmd *cmd = adreno_dev->hwsched.ctxt_bad; /* Return false for non fatal errors */ if (adreno_hwsched_log_nonfatal_gpu_fault(adreno_dev, gmu_pdev_dev, cmd->error)) return false; switch (cmd->error) { case GMU_GPU_HW_HANG: dev_crit_ratelimited(gmu_pdev_dev, "MISC: GPU hang detected\n"); break; case GMU_GPU_SW_HANG: --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:552 [MATCH: struct hfi_] --- static bool is_queue_empty(struct adreno_device *adreno_dev, u32 queue_idx) { struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev); struct kgsl_memdesc *mem_addr = gmu->hfi.hfi_mem; struct hfi_queue_table *tbl = mem_addr->hostptr; struct hfi_queue_header *hdr = &tbl->qhdr[queue_idx]; if (hdr->status == HFI_QUEUE_STATUS_DISABLED) return true; if (hdr->read_index == hdr->write_index) return true; /* * This is to ensure that the queue is not read speculatively before the queue empty --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:574 [MATCH: struct hfi_] --- static u32 peek_next_header(struct adreno_device *adreno_dev, struct gen8_gmu_device *gmu, u32 queue_idx) { struct kgsl_memdesc *mem_addr = gmu->hfi.hfi_mem; struct hfi_queue_table *tbl = mem_addr->hostptr; struct hfi_queue_header *hdr = &tbl->qhdr[queue_idx]; u32 *queue; if (is_queue_empty(adreno_dev, queue_idx)) return 0; queue = HOST_QUEUE_START_ADDR(mem_addr, queue_idx); return queue[hdr->read_index]; } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:603 [MATCH: struct hfi_] --- } #define GET_QUERIED_FENCE_INDEX(x) (x / BITS_PER_SYNCOBJ_QUERY) #define GET_QUERIED_FENCE_BIT(x) (x % BITS_PER_SYNCOBJ_QUERY) static bool fence_is_queried(struct hfi_syncobj_query_cmd *cmd, u32 fence_index) { u32 index = GET_QUERIED_FENCE_INDEX(fence_index); u32 bit = GET_QUERIED_FENCE_BIT(fence_index); return (cmd->queries[index].query_bitmask & BIT(bit)); } static void set_fence_signal_bit(struct adreno_device *adreno_dev, struct hfi_syncobj_query_cmd *reply, struct dma_fence *fence, u32 fence_index) { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:612 [MATCH: struct hfi_] --- return (cmd->queries[index].query_bitmask & BIT(bit)); } static void set_fence_signal_bit(struct adreno_device *adreno_dev, struct hfi_syncobj_query_cmd *reply, struct dma_fence *fence, u32 fence_index) { u32 index = GET_QUERIED_FENCE_INDEX(fence_index); u32 bit = GET_QUERIED_FENCE_BIT(fence_index); u64 flags = ADRENO_HW_FENCE_SW_STATUS_PENDING; char name[KGSL_FENCE_NAME_LEN]; char value[32] = "unknown"; kgsl_fence_timeline_value_str(fence, value, sizeof(value)); if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags)) { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:635 [MATCH: struct hfi_] --- trace_adreno_hw_fence_query(fence->context, fence->seqno, flags, name, value); } static void gen8_syncobj_query_reply(struct adreno_device *adreno_dev, struct kgsl_drawobj *drawobj, struct hfi_syncobj_query_cmd *cmd) { struct hfi_syncobj_query_cmd reply = {0}; int i; struct kgsl_drawobj_sync *syncobj = SYNCOBJ(drawobj); const struct adreno_gpudev *gpudev = ADRENO_GPU_DEVICE(adreno_dev); for (i = 0; i < syncobj->num_hw_fence; i++) { struct dma_fence *fence = syncobj->hw_fences[i].fence; if (!fence_is_queried(cmd, i)) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:637 [MATCH: struct hfi_] --- } static void gen8_syncobj_query_reply(struct adreno_device *adreno_dev, struct kgsl_drawobj *drawobj, struct hfi_syncobj_query_cmd *cmd) { struct hfi_syncobj_query_cmd reply = {0}; int i; struct kgsl_drawobj_sync *syncobj = SYNCOBJ(drawobj); const struct adreno_gpudev *gpudev = ADRENO_GPU_DEVICE(adreno_dev); for (i = 0; i < syncobj->num_hw_fence; i++) { struct dma_fence *fence = syncobj->hw_fences[i].fence; if (!fence_is_queried(cmd, i)) continue; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:663 [MATCH: struct hfi_] --- gen8_hfi_send_cmd_async(adreno_dev, &reply, sizeof(reply)); } struct syncobj_query_work { /** @cmd: The query command to be processed */ struct hfi_syncobj_query_cmd cmd; /** @context: kgsl context that is waiting for this sync object */ struct kgsl_context *context; /** @work: The work structure to execute syncobj query reply */ struct kthread_work work; }; static void gen8_process_syncobj_query_work(struct kthread_work *work) { struct syncobj_query_work *query_work = container_of(work, struct syncobj_query_work, work); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:674 [MATCH: struct hfi_] --- static void gen8_process_syncobj_query_work(struct kthread_work *work) { struct syncobj_query_work *query_work = container_of(work, struct syncobj_query_work, work); struct hfi_syncobj_query_cmd *cmd = (struct hfi_syncobj_query_cmd *)&query_work->cmd; struct kgsl_context *context = query_work->context; struct kgsl_device *device = context->device; struct adreno_device *adreno_dev = ADRENO_DEVICE(device); struct adreno_hwsched *hwsched = &adreno_dev->hwsched; struct cmd_list_obj *obj; bool missing = true; mutex_lock(&hwsched->mutex); kgsl_mutex_lock(&device->mutex); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:728 [MATCH: struct hfi_] --- static void gen8_trigger_syncobj_query(struct adreno_device *adreno_dev, u32 *rcvd) { struct syncobj_query_work *query_work; struct hfi_syncobj_query_cmd *cmd = (struct hfi_syncobj_query_cmd *)rcvd; struct kgsl_context *context = NULL; struct kgsl_device *device = KGSL_DEVICE(adreno_dev); const struct adreno_gpudev *gpudev = ADRENO_GPU_DEVICE(adreno_dev); int ret; trace_adreno_syncobj_query(cmd->gmu_ctxt_id, cmd->sync_obj_ts, gpudev->read_alwayson(adreno_dev)); /* * We need the context even if it is detached. Hence, we can't use kgsl_context_get here. --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:1049 [MATCH: struct hfi_] --- _disable_hw_fence_throttle(adreno_dev, false); } int gen8_hwsched_process_f2h_platform_msg(struct adreno_device *adreno_dev, u32 *rcvd) { struct hfi_msg_platform *msg = (struct hfi_msg_platform *)rcvd; if (msg->sub_type == F2H_ST_MSG_SCALE_GMU) { struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct hfi_scale_gmu_cmd *cmd = (struct hfi_scale_gmu_cmd *)rcvd; u32 index = cmd->gmu_pwrlevel; if ((index > 0) && (index <= device->gmu_core.num_freqs)) return gmu_core_clock_set_rate(device, index - 1); } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:1053 [MATCH: struct hfi_] --- { struct hfi_msg_platform *msg = (struct hfi_msg_platform *)rcvd; if (msg->sub_type == F2H_ST_MSG_SCALE_GMU) { struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct hfi_scale_gmu_cmd *cmd = (struct hfi_scale_gmu_cmd *)rcvd; u32 index = cmd->gmu_pwrlevel; if ((index > 0) && (index <= device->gmu_core.num_freqs)) return gmu_core_clock_set_rate(device, index - 1); } return 0; } void gen8_hwsched_process_msgq(struct adreno_device *adreno_dev) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:1117 [MATCH: struct hfi_] --- break; case F2H_MSG_SYNCOBJ_QUERY: gen8_trigger_syncobj_query(adreno_dev, rcvd); break; case F2H_MSG_GMU_CNTR_RELEASE: { struct hfi_gmu_cntr_release_cmd *cmd = (struct hfi_gmu_cntr_release_cmd *) rcvd; adreno_perfcounter_put(adreno_dev, cmd->group_id, cmd->countable, PERFCOUNTER_FLAG_KERNEL); gmu_core_mark_for_coldboot(KGSL_DEVICE(adreno_dev)); } break; case F2H_MSG_PLATFORM_LA: gen8_hwsched_process_f2h_platform_msg(adreno_dev, rcvd); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:1118 [MATCH: struct hfi_] --- case F2H_MSG_SYNCOBJ_QUERY: gen8_trigger_syncobj_query(adreno_dev, rcvd); break; case F2H_MSG_GMU_CNTR_RELEASE: { struct hfi_gmu_cntr_release_cmd *cmd = (struct hfi_gmu_cntr_release_cmd *) rcvd; adreno_perfcounter_put(adreno_dev, cmd->group_id, cmd->countable, PERFCOUNTER_FLAG_KERNEL); gmu_core_mark_for_coldboot(KGSL_DEVICE(adreno_dev)); } break; case F2H_MSG_PLATFORM_LA: gen8_hwsched_process_f2h_platform_msg(adreno_dev, rcvd); break; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:1137 [MATCH: struct hfi_] --- } static void process_log_block(struct adreno_device *adreno_dev, void *data) { struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev); struct hfi_log_block *cmd = data; u32 *log_event = gmu->gmu_log->hostptr; u32 start, end; start = cmd->start_index; end = cmd->stop_index; log_event += start * 4; while (start != end) { trace_gmu_event(log_event); log_event += 4; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:1296 [MATCH: struct hfi_] --- } static void init_queues(struct gen8_hfi *hfi) { u32 gmuaddr = hfi->hfi_mem->gmuaddr; struct hfi_queue_table hfi_table = { .qtbl_hdr = { .version = 0, .size = sizeof(struct hfi_queue_table) >> 2, .qhdr0_offset = sizeof(struct hfi_queue_table_header) >> 2, .qhdr_size = sizeof(struct hfi_queue_header) >> 2, .num_q = HFI_QUEUE_MAX, .num_active_q = HFI_QUEUE_MAX, }, .qhdr = { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:1299 [MATCH: struct hfi_] --- { u32 gmuaddr = hfi->hfi_mem->gmuaddr; struct hfi_queue_table hfi_table = { .qtbl_hdr = { .version = 0, .size = sizeof(struct hfi_queue_table) >> 2, .qhdr0_offset = sizeof(struct hfi_queue_table_header) >> 2, .qhdr_size = sizeof(struct hfi_queue_header) >> 2, .num_q = HFI_QUEUE_MAX, .num_active_q = HFI_QUEUE_MAX, }, .qhdr = { DEFINE_QHDR(gmuaddr, HFI_CMD_ID, 0), DEFINE_QHDR(gmuaddr, HFI_MSG_ID, 0), DEFINE_QHDR(gmuaddr, HFI_DBG_ID, 0), --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:1301 [MATCH: struct hfi_] --- struct hfi_queue_table hfi_table = { .qtbl_hdr = { .version = 0, .size = sizeof(struct hfi_queue_table) >> 2, .qhdr0_offset = sizeof(struct hfi_queue_table_header) >> 2, .qhdr_size = sizeof(struct hfi_queue_header) >> 2, .num_q = HFI_QUEUE_MAX, .num_active_q = HFI_QUEUE_MAX, }, .qhdr = { DEFINE_QHDR(gmuaddr, HFI_CMD_ID, 0), DEFINE_QHDR(gmuaddr, HFI_MSG_ID, 0), DEFINE_QHDR(gmuaddr, HFI_DBG_ID, 0), }, }; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:1317 [MATCH: struct hfi_] --- memcpy(hfi->hfi_mem->hostptr, &hfi_table, sizeof(hfi_table)); } /* Total header sizes + queue sizes + 16 for alignment */ #define HFIMEM_SIZE (sizeof(struct hfi_queue_table) + 16 + \ (SZ_4K * HFI_QUEUE_MAX)) static int hfi_f2h_main(void *arg); int gen8_hwsched_hfi_init(struct adreno_device *adreno_dev) { struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct gen8_hwsched_hfi *hw_hfi = to_gen8_hwsched_hfi(adreno_dev); struct gen8_hfi *hfi = to_gen8_hfi(adreno_dev); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:1330 [MATCH: struct hfi_] --- struct gen8_hwsched_hfi *hw_hfi = to_gen8_hwsched_hfi(adreno_dev); struct gen8_hfi *hfi = to_gen8_hfi(adreno_dev); if (IS_ERR_OR_NULL(hw_hfi->big_ib)) { hw_hfi->big_ib = gmu_core_reserve_kernel_block( device, 0, HWSCHED_MAX_IBS * sizeof(struct hfi_issue_ib), GMU_NONCACHED_KERNEL, 0); if (IS_ERR(hw_hfi->big_ib)) return PTR_ERR(hw_hfi->big_ib); } if (ADRENO_FEATURE(adreno_dev, ADRENO_LSR) && IS_ERR_OR_NULL(hw_hfi->big_ib_recurring)) { hw_hfi->big_ib_recurring = gmu_core_reserve_kernel_block( device, 0, HWSCHED_MAX_IBS * sizeof(struct hfi_issue_ib), GMU_NONCACHED_KERNEL, 0); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:1339 [MATCH: struct hfi_] --- } if (ADRENO_FEATURE(adreno_dev, ADRENO_LSR) && IS_ERR_OR_NULL(hw_hfi->big_ib_recurring)) { hw_hfi->big_ib_recurring = gmu_core_reserve_kernel_block( device, 0, HWSCHED_MAX_IBS * sizeof(struct hfi_issue_ib), GMU_NONCACHED_KERNEL, 0); if (IS_ERR(hw_hfi->big_ib_recurring)) return PTR_ERR(hw_hfi->big_ib_recurring); } if (IS_ERR_OR_NULL(hfi->hfi_mem)) { hfi->hfi_mem = gmu_core_reserve_kernel_block( device, 0, HFIMEM_SIZE, GMU_NONCACHED_KERNEL, 0); if (IS_ERR(hfi->hfi_mem)) return PTR_ERR(hfi->hfi_mem); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:1364 [MATCH: struct hfi_] --- return PTR_ERR_OR_ZERO(hw_hfi->f2h_task); } static int mem_alloc_reply(struct adreno_device *adreno_dev, void *rcvd) { struct hfi_mem_alloc_desc desc = {0}; struct hfi_mem_alloc_reply_cmd out = {0}; struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev); u32 seqnum; int ret; hfi_get_mem_alloc_desc(rcvd, &desc); ret = adreno_hwsched_process_mem_alloc(adreno_dev, &desc); if (ret) return ret; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:1365 [MATCH: struct hfi_] --- } static int mem_alloc_reply(struct adreno_device *adreno_dev, void *rcvd) { struct hfi_mem_alloc_desc desc = {0}; struct hfi_mem_alloc_reply_cmd out = {0}; struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev); u32 seqnum; int ret; hfi_get_mem_alloc_desc(rcvd, &desc); ret = adreno_hwsched_process_mem_alloc(adreno_dev, &desc); if (ret) return ret; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:1390 [MATCH: struct hfi_] --- return gen8_hfi_cmdq_write(adreno_dev, (u32 *)&out, sizeof(out)); } static int gmu_cntr_register_reply(struct adreno_device *adreno_dev, void *rcvd) { struct hfi_gmu_cntr_register_cmd *in = (struct hfi_gmu_cntr_register_cmd *)rcvd; struct hfi_gmu_cntr_register_reply_cmd out = {0}; struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev); u32 lo = 0, hi = 0, seqnum; /* * Failure to allocate counter is not fatal. Sending lo = 0, hi = 0 * indicates to GMU that counter allocation failed. */ adreno_perfcounter_get(adreno_dev, in->group_id, in->countable, &lo, &hi, PERFCOUNTER_FLAG_KERNEL); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:1391 [MATCH: struct hfi_] --- } static int gmu_cntr_register_reply(struct adreno_device *adreno_dev, void *rcvd) { struct hfi_gmu_cntr_register_cmd *in = (struct hfi_gmu_cntr_register_cmd *)rcvd; struct hfi_gmu_cntr_register_reply_cmd out = {0}; struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev); u32 lo = 0, hi = 0, seqnum; /* * Failure to allocate counter is not fatal. Sending lo = 0, hi = 0 * indicates to GMU that counter allocation failed. */ adreno_perfcounter_get(adreno_dev, in->group_id, in->countable, &lo, &hi, PERFCOUNTER_FLAG_KERNEL); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:1420 [MATCH: struct hfi_] --- static int send_warmboot_start_msg(struct adreno_device *adreno_dev) { struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct gmu_core_device *gmu_core = &device->gmu_core; int ret = 0; struct hfi_start_cmd cmd; if (!gmu_core->warmboot_enabled) return ret; ret = CMD_MSG_HDR(cmd, H2F_MSG_START); if (ret) return ret; cmd.hdr = RECORD_NOP_MSG_HDR(cmd.hdr); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:1440 [MATCH: struct hfi_] --- { struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev); struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct device *gmu_pdev_dev = GMU_PDEV_DEV(device); int ret, rc = 0; struct hfi_start_cmd cmd; u32 seqnum, rcvd[MAX_RCVD_SIZE]; struct pending_cmd pending_ack = {0}; ret = CMD_MSG_HDR(cmd, H2F_MSG_START); if (ret) return ret; seqnum = atomic_inc_return(&gmu->hfi.seqnum); cmd.hdr = MSG_HDR_SET_SEQNUM_SIZE(cmd.hdr, seqnum, sizeof(cmd) >> 2); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:1526 [MATCH: struct hfi_] --- } static void reset_hfi_queues(struct adreno_device *adreno_dev) { struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev); struct hfi_queue_table *tbl = gmu->hfi.hfi_mem->hostptr; u32 i; /* Flush HFI queues */ for (i = 0; i < HFI_QUEUE_MAX; i++) { struct hfi_queue_header *hdr = &tbl->qhdr[i]; if (hdr->status == HFI_QUEUE_STATUS_DISABLED) continue; hdr->read_index = hdr->write_index; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:1661 [MATCH: struct hfi_] --- return 0; } u32 gen8_hwsched_hfi_get_value(struct adreno_device *adreno_dev, u32 prop, u32 subtype) { struct hfi_get_value_cmd cmd; struct device *gmu_pdev_dev = GMU_PDEV_DEV(KGSL_DEVICE(adreno_dev)); struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev); struct gen8_hwsched_hfi *hfi = to_gen8_hwsched_hfi(adreno_dev); struct pending_cmd pending_ack; u32 seqnum; int rc; rc = CMD_MSG_HDR(cmd, H2F_MSG_GET_VALUE); if (rc) return 0; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:1703 [MATCH: struct hfi_] --- struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev); struct gen8_hwsched_hfi *hfi = to_gen8_hwsched_hfi(adreno_dev); struct pending_cmd pending_ack; int rc; u32 seqnum; struct hfi_set_value_cmd cmd = { .type = type, .subtype = subtype, .data = data, }; rc = CMD_MSG_HDR(cmd, H2F_MSG_SET_VALUE); if (rc) return 0; seqnum = atomic_inc_return(&gmu->hfi.seqnum); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:1830 [MATCH: struct hfi_] --- static int gen8_hwsched_hfi_send_warmboot_cmd(struct adreno_device *adreno_dev, struct kgsl_memdesc *desc, u32 flag, bool async, struct pending_cmd *ack) { struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct gmu_core_device *gmu_core = &device->gmu_core; struct hfi_warmboot_scratch_cmd cmd = {0}; int ret; if (!gmu_core->warmboot_enabled) return 0; cmd.scratch_addr = desc->gmuaddr; cmd.scratch_size = desc->size; cmd.flags = flag; ret = CMD_MSG_HDR(cmd, H2F_MSG_WARMBOOT_CMD); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:1858 [MATCH: struct hfi_] --- struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct gmu_core_device *gmu_core = &device->gmu_core; struct device *gmu_pdev_dev = GMU_PDEV_DEV(KGSL_DEVICE(adreno_dev)); struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev); struct gen8_hwsched_hfi *hfi = to_gen8_hwsched_hfi(adreno_dev); struct hfi_warmboot_scratch_cmd cmd = { .scratch_addr = gmu->gpu_boot_scratch->gmuaddr, .scratch_size = gmu->gpu_boot_scratch->size, .flags = HFI_WARMBOOT_EXEC_SCRATCH, }; int ret = 0; u32 seqnum; if (!gmu_core->warmboot_enabled) return 0; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:2038 [MATCH: struct hfi_] --- struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct gen8_hwsched_hfi *hfi = to_gen8_hwsched_hfi(adreno_dev); struct pending_cmd pending_ack; int rc; u32 seqnum; struct hfi_set_value_cmd cmd = { .type = type, .subtype = subtype, .data = val, }; rc = CMD_MSG_HDR(cmd, H2F_MSG_SET_VALUE); if (rc) return rc; seqnum = atomic_inc_return(&gmu->hfi.seqnum); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:2138 [MATCH: struct hfi_] --- } void gen8_hwsched_hfi_get_dcvs_tuning_attrs(struct adreno_device *adreno_dev, u32 subtype, u32 *data) { struct hfi_get_value_cmd cmd; struct device *gmu_pdev_dev = GMU_PDEV_DEV(KGSL_DEVICE(adreno_dev)); struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev); struct gen8_hwsched_hfi *hfi = to_gen8_hwsched_hfi(adreno_dev); struct pending_cmd pending_ack; u32 seqnum; u32 num_values; u32 total_dwords; u32 hdr_size_in_dwords = 2; int ret; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:2288 [MATCH: struct hfi_] --- } static int gen8_hfi_send_thermal_feature_ctrl(struct adreno_device *adreno_dev) { const struct adreno_gen8_core *gen8_core = to_gen8_core(adreno_dev); struct hfi_therm_profile_ctrl *therm; const struct therm_tsens_en_cfg *tsens_en_cfg; struct kgsl_device *device = KGSL_DEVICE(adreno_dev); static struct hfi_thermaltable_cmd cmd = {0}; u32 tsens_en_bits; int ret; if (!test_bit(GMU_THERMAL_MITIGATION, &device->gmu_core.flags) || !gen8_core->therm_cfg || !gen8_core->therm_cfg->therm || !gen8_core->therm_cfg->tsens_en_cfg) return 0; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:2291 [MATCH: struct hfi_] --- { const struct adreno_gen8_core *gen8_core = to_gen8_core(adreno_dev); struct hfi_therm_profile_ctrl *therm; const struct therm_tsens_en_cfg *tsens_en_cfg; struct kgsl_device *device = KGSL_DEVICE(adreno_dev); static struct hfi_thermaltable_cmd cmd = {0}; u32 tsens_en_bits; int ret; if (!test_bit(GMU_THERMAL_MITIGATION, &device->gmu_core.flags) || !gen8_core->therm_cfg || !gen8_core->therm_cfg->therm || !gen8_core->therm_cfg->tsens_en_cfg) return 0; therm = gen8_core->therm_cfg->therm; tsens_en_cfg = gen8_core->therm_cfg->tsens_en_cfg; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:2336 [MATCH: struct hfi_] --- static int gen8_hwsched_build_dcvs_table(struct adreno_device *adreno_dev) { struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct kgsl_pwrctrl *pwr = &device->pwrctrl; struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev); struct hfi_table_cmd *cmd; struct hfi_table_entry *entry; u32 size_config_entry_dwords = (sizeof(*entry) >> 2) + (1 * 4); u32 size_ddr_levels_dwords = (sizeof(*entry) >> 2) + ((pwr->num_pwrlevels + 1) * 3); u32 size_ddr_table_dwords = (sizeof(*entry) >> 2) + (1 * pwr->ddr_table_count); u32 size_table_dwords = (sizeof(*cmd) >> 2) + size_config_entry_dwords + size_ddr_levels_dwords + size_ddr_table_dwords; u32 index; int i, j = 0; /* If cmdbuf is not allocated, allocate it first */ --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:2337 [MATCH: struct hfi_] --- { struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct kgsl_pwrctrl *pwr = &device->pwrctrl; struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev); struct hfi_table_cmd *cmd; struct hfi_table_entry *entry; u32 size_config_entry_dwords = (sizeof(*entry) >> 2) + (1 * 4); u32 size_ddr_levels_dwords = (sizeof(*entry) >> 2) + ((pwr->num_pwrlevels + 1) * 3); u32 size_ddr_table_dwords = (sizeof(*entry) >> 2) + (1 * pwr->ddr_table_count); u32 size_table_dwords = (sizeof(*cmd) >> 2) + size_config_entry_dwords + size_ddr_levels_dwords + size_ddr_table_dwords; u32 index; int i, j = 0; /* If cmdbuf is not allocated, allocate it first */ if (!gmu->dcvs_cmdbuf) { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:2364 [MATCH: struct hfi_] --- /* If there are no changes needed for the table, use the existing table */ if (!pwr->update_dcvs_table) return 0; cmd = (struct hfi_table_cmd *)gmu->dcvs_cmdbuf; cmd->version = 0; cmd->type = HFI_TABLE_DCVS_DATA; index = sizeof(*cmd) >> 2; /* * Fill up config entry * First entry table contains 4 data. * 1) Number of gpu power levels * 2) GMU index to default level * 3) Bus width for the target --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:2377 [MATCH: struct hfi_] --- * 1) Number of gpu power levels * 2) GMU index to default level * 3) Bus width for the target * 4) Max ddr bandwidth across 4 channels */ entry = (struct hfi_table_entry *)&gmu->dcvs_cmdbuf[index]; entry->count = 1; entry->stride = 4; /* Number of power levels */ entry->data[j++] = pwr->num_pwrlevels + 1; /* GMU index to default level */ entry->data[j++] = pwr->num_pwrlevels - pwr->default_pwrlevel; /* Bus width for the target */ entry->data[j++] = pwr->bus_width; /* Number of ddr channels for the target */ entry->data[j++] = adreno_dev->gpucore->num_ddr_channels; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:2394 [MATCH: struct hfi_] --- /* * Fill up ddr levels entry * Second entry table contains default, min and max bus indexes for each power level. */ entry = (struct hfi_table_entry *)&gmu->dcvs_cmdbuf[index]; entry->count = pwr->num_pwrlevels + 1; entry->stride = 3; j = 0; /* GMU has 0 MHz as its lowest level */ entry->data[j++] = 0; entry->data[j++] = 0; entry->data[j++] = 0; /* GPU power levels and associated bus votes */ for (i = pwr->num_pwrlevels - 1; i >= 0; i--) { entry->data[j++] = pwr->pwrlevels[i].bus_freq; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:2415 [MATCH: struct hfi_] --- /* * Fill up ddr table entry * This contains the ddr table */ entry = (struct hfi_table_entry *)&gmu->dcvs_cmdbuf[index]; entry->count = 1; entry->stride = pwr->ddr_table_count; for (i = 0; i < pwr->ddr_table_count; i++) entry->data[i] = pwr->ddr_table[i]; index += size_ddr_table_dwords; /* If index is greater than size, buffer has overflown */ if (index > size_table_dwords) { dev_err(device->dev, "Buffer overflown for dcvs table\n"); return -EINVAL; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:2441 [MATCH: struct hfi_] --- { struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct gmu_core_device *gmu_core = &device->gmu_core; struct kgsl_pwrctrl *pwr = &device->pwrctrl; struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev); struct hfi_table_cmd *cmd; struct hfi_table_entry *entry; u32 index, i; u32 ddr_index; u32 size_first_entry_dwords = (sizeof(*entry) >> 2) + (1 * 1); u32 size_second_entry_dwords = (sizeof(*entry) >> 2) + (1 * (device->gmu_core.num_freqs + 1)); u32 size_table_dwords = (sizeof(*cmd) >> 2) + size_first_entry_dwords + size_second_entry_dwords; /* Return early if the scaling table is already generated */ --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:2442 [MATCH: struct hfi_] --- struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct gmu_core_device *gmu_core = &device->gmu_core; struct kgsl_pwrctrl *pwr = &device->pwrctrl; struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev); struct hfi_table_cmd *cmd; struct hfi_table_entry *entry; u32 index, i; u32 ddr_index; u32 size_first_entry_dwords = (sizeof(*entry) >> 2) + (1 * 1); u32 size_second_entry_dwords = (sizeof(*entry) >> 2) + (1 * (device->gmu_core.num_freqs + 1)); u32 size_table_dwords = (sizeof(*cmd) >> 2) + size_first_entry_dwords + size_second_entry_dwords; /* Return early if the scaling table is already generated */ if (gmu->gmu_scaling_cmdbuf) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:2465 [MATCH: struct hfi_] --- gmu->gmu_scaling_cmdbuf = kcalloc(size_table_dwords, sizeof(*(gmu->gmu_scaling_cmdbuf)), GFP_KERNEL); if (!gmu->gmu_scaling_cmdbuf) return -ENOMEM; cmd = (struct hfi_table_cmd *)gmu->gmu_scaling_cmdbuf; cmd->version = 0; cmd->type = HFI_TABLE_GMU_SCALING_DATA; index = sizeof(*cmd) >> 2; if ((index + size_first_entry_dwords) > size_table_dwords) { kfree(gmu->gmu_scaling_cmdbuf); return -ENOMEM; } /* --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:2479 [MATCH: struct hfi_] --- /* * Fill up first entry * First entry table contains the initial gmu power level */ entry = (struct hfi_table_entry *)&gmu->gmu_scaling_cmdbuf[index]; entry->count = 1; entry->stride = 1; /* * If the ddr threshold is defined for the target, set the initial gmu level as the lowest * gmu power level which is 1. If not, gmu scaling will be disabled. */ entry->data[0] = 1; index += size_first_entry_dwords; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:2503 [MATCH: struct hfi_] --- * index 0 to MAX_CX_LEVEL. The entry represents the threshold the corresponding * gmu power level index needs to cross to be scaled to a higher level. 0 represents * no scaling up on that level. To scale down, the ddr should be below the threshold * at the previos gmu power level index. */ entry = (struct hfi_table_entry *)&gmu->gmu_scaling_cmdbuf[index]; entry->count = 1; entry->stride = device->gmu_core.num_freqs + 1; entry->data[0] = 0; for (i = 0; i < device->gmu_core.num_freqs; i++) { if (!gmu_core->perf_ddr_bw[i]) { entry->data[i + 1] = 0; continue; } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:2536 [MATCH: struct hfi_] --- static int gen8_hfi_send_gmu_dcvs_req(struct adreno_device *adreno_dev) { struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev); struct gmu_core_device *gmu_core = &device->gmu_core; struct hfi_table_cmd *cmd; int ret; /* If KGSL is performing pwrscale, just return */ if (device->host_based_dcvs) return 0; /* Build the table to be send to GMU for GMU based DCVS */ ret = gen8_hwsched_build_dcvs_table(adreno_dev); if (ret) return ret; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:2548 [MATCH: struct hfi_] --- /* Build the table to be send to GMU for GMU based DCVS */ ret = gen8_hwsched_build_dcvs_table(adreno_dev); if (ret) return ret; cmd = (struct hfi_table_cmd *)gmu->dcvs_cmdbuf; ret = gen8_hfi_send_feature_ctrl(adreno_dev, HFI_FEATURE_DCVS, 1, GMU_GPU_DCVS_OBJ_PARITY); if (ret) return ret; ret = gen8_hfi_send_generic_req(adreno_dev, cmd, MSG_HDR_GET_SIZE(cmd->hdr) << 2); if (ret) return ret; /* Do not scale gmu if perf_ddr_bw is not configured */ if (!gmu_core->perf_ddr_bw[0]) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:2565 [MATCH: struct hfi_] --- ret = gen8_hwsched_build_gmu_scaling_table(adreno_dev); if (ret) return ret; cmd = (struct hfi_table_cmd *)gmu->gmu_scaling_cmdbuf; return gen8_hfi_send_generic_req(adreno_dev, cmd, MSG_HDR_GET_SIZE(cmd->hdr) << 2); } static int gen8_hwsched_feature_ctrl(struct adreno_device *adreno_dev) { struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev); int ret; ret = gen8_hfi_send_acd_feature_ctrl(adreno_dev); if (ret) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:3041 [MATCH: struct hfi_] --- static int send_context_register(struct adreno_device *adreno_dev, struct kgsl_context *context) { struct adreno_context *drawctxt = ADRENO_CONTEXT(context); struct hfi_register_ctxt_cmd cmd; struct kgsl_pagetable *pt = context->proc_priv->pagetable; int ret, asid = kgsl_mmu_pagetable_get_asid(pt, context); if (asid < 0) return asid; ret = CMD_MSG_HDR(cmd, H2F_MSG_REGISTER_CONTEXT); if (ret) return ret; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:3076 [MATCH: struct hfi_] --- static int send_context_pointers(struct adreno_device *adreno_dev, struct kgsl_context *context) { struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct hfi_context_pointers_cmd cmd = {0}; struct adreno_context *drawctxt = ADRENO_CONTEXT(context); struct kgsl_process_private *proc_priv = drawctxt->base.proc_priv; struct kgsl_memdesc md = proc_priv->profile.md; int ret; ret = CMD_MSG_HDR(cmd, H2F_MSG_CONTEXT_POINTERS); if (ret) return ret; cmd.ctxt_id = context->id; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:3153 [MATCH: struct hfi_] --- return 0; } static void populate_ibs(struct adreno_device *adreno_dev, struct hfi_submit_cmd *cmd, struct kgsl_drawobj_cmd *cmdobj) { struct hfi_issue_ib *issue_ib; struct kgsl_memobj_node *ib; if (cmdobj->numibs > HWSCHED_MAX_DISPATCH_NUMIBS) { struct gen8_hwsched_hfi *hfi = to_gen8_hwsched_hfi(adreno_dev); struct kgsl_memdesc *big_ib; if (test_bit(CMDOBJ_RECURRING_START, &cmdobj->priv)) big_ib = hfi->big_ib_recurring; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:3155 [MATCH: struct hfi_] --- } static void populate_ibs(struct adreno_device *adreno_dev, struct hfi_submit_cmd *cmd, struct kgsl_drawobj_cmd *cmdobj) { struct hfi_issue_ib *issue_ib; struct kgsl_memobj_node *ib; if (cmdobj->numibs > HWSCHED_MAX_DISPATCH_NUMIBS) { struct gen8_hwsched_hfi *hfi = to_gen8_hwsched_hfi(adreno_dev); struct kgsl_memdesc *big_ib; if (test_bit(CMDOBJ_RECURRING_START, &cmdobj->priv)) big_ib = hfi->big_ib_recurring; else big_ib = hfi->big_ib; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:3173 [MATCH: struct hfi_] --- */ cmd->big_ib_gmu_va = big_ib->gmuaddr; cmd->flags |= CMDBATCH_INDIRECT; issue_ib = big_ib->hostptr; } else { issue_ib = (struct hfi_issue_ib *)&cmd[1]; } list_for_each_entry(ib, &cmdobj->cmdlist, node) { issue_ib->addr = ib->gpuaddr; issue_ib->size = ib->size; issue_ib++; } cmd->numibs = cmdobj->numibs; } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:3221 [MATCH: struct hfi_] --- return false; } static void populate_kgsl_fence(struct kgsl_drawobj_sync_hw_fence *hw_fence, struct hfi_syncobj *obj) { struct kgsl_sync_fence *kfence = (struct kgsl_sync_fence *)hw_fence->fence; struct kgsl_sync_timeline *ktimeline = kfence->parent; unsigned long flags; obj->flags |= BIT(GMU_SYNCOBJ_FLAG_KGSL_FENCE_BIT); spin_lock_irqsave(&ktimeline->lock, flags); if (_is_kgsl_hw_fence_signaled(hw_fence)) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:3249 [MATCH: struct hfi_] --- { struct adreno_context *drawctxt = ADRENO_CONTEXT(drawobj->context); int i; u32 cmd_sizebytes, seqnum; struct kgsl_drawobj_sync *syncobj = SYNCOBJ(drawobj); struct hfi_submit_syncobj *cmd; struct hfi_syncobj *obj = NULL; struct kgsl_device *device = KGSL_DEVICE(adreno_dev); /* Add hfi_syncobj struct for sync object */ cmd_sizebytes = sizeof(*cmd) + (sizeof(struct hfi_syncobj) * syncobj->num_hw_fence); if (WARN_ON(cmd_sizebytes > HFI_MAX_MSG_SIZE)) return -EMSGSIZE; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:3250 [MATCH: struct hfi_] --- struct adreno_context *drawctxt = ADRENO_CONTEXT(drawobj->context); int i; u32 cmd_sizebytes, seqnum; struct kgsl_drawobj_sync *syncobj = SYNCOBJ(drawobj); struct hfi_submit_syncobj *cmd; struct hfi_syncobj *obj = NULL; struct kgsl_device *device = KGSL_DEVICE(adreno_dev); /* Add hfi_syncobj struct for sync object */ cmd_sizebytes = sizeof(*cmd) + (sizeof(struct hfi_syncobj) * syncobj->num_hw_fence); if (WARN_ON(cmd_sizebytes > HFI_MAX_MSG_SIZE)) return -EMSGSIZE; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:3255 [MATCH: struct hfi_] --- struct hfi_syncobj *obj = NULL; struct kgsl_device *device = KGSL_DEVICE(adreno_dev); /* Add hfi_syncobj struct for sync object */ cmd_sizebytes = sizeof(*cmd) + (sizeof(struct hfi_syncobj) * syncobj->num_hw_fence); if (WARN_ON(cmd_sizebytes > HFI_MAX_MSG_SIZE)) return -EMSGSIZE; memset(cmdbuf, 0x0, cmd_sizebytes); cmd = cmdbuf; cmd->num_syncobj = syncobj->num_hw_fence; obj = (struct hfi_syncobj *)&cmd[1]; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:3264 [MATCH: struct hfi_] --- return -EMSGSIZE; memset(cmdbuf, 0x0, cmd_sizebytes); cmd = cmdbuf; cmd->num_syncobj = syncobj->num_hw_fence; obj = (struct hfi_syncobj *)&cmd[1]; for (i = 0; i < syncobj->num_hw_fence; i++) { struct dma_fence *fence = syncobj->hw_fences[i].fence; if (is_kgsl_fence(fence)) { populate_kgsl_fence(&syncobj->hw_fences[i], obj); } else { int ret = kgsl_hw_fence_add_waiter(device, fence, &obj->hash_index); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:3521 [MATCH: struct hfi_] --- memset(&gen8_hw_fence_ack, 0x0, sizeof(gen8_hw_fence_ack)); return ret; } #define DRAWCTXT_SLOT_AVAILABLE(count) \ ((count + 1) < (HW_FENCE_QUEUE_SIZE / sizeof(struct hfi_hw_fence_info))) /** * allocate_hw_fence_entry - Allocate an entry to keep track of a hardware fence. This is free'd * when we know GMU has sent this fence to the TxQueue */ static struct adreno_hw_fence_entry *allocate_hw_fence_entry(struct adreno_device *adreno_dev, struct adreno_context *drawctxt, struct kgsl_sync_fence *kfence) { struct adreno_hwsched *hwsched = &adreno_dev->hwsched; struct adreno_hw_fence_entry *entry; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:3811 [MATCH: struct hfi_] --- int gen8_hwsched_submit_drawobj(struct adreno_device *adreno_dev, struct kgsl_drawobj *drawobj) { int ret = 0; u32 cmd_sizebytes, seqnum; struct kgsl_drawobj_cmd *cmdobj = NULL; struct hfi_submit_cmd *cmd; struct adreno_submit_time time = {0}; struct adreno_context *drawctxt = ADRENO_CONTEXT(drawobj->context); static void *cmdbuf; struct gmu_context_queue_header *hdr = NULL; if (cmdbuf == NULL) { struct kgsl_device *device = KGSL_DEVICE(adreno_dev); cmdbuf = devm_kzalloc(&device->pdev->dev, HFI_MAX_MSG_SIZE, GFP_KERNEL); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:3852 [MATCH: struct hfi_] --- if (cmdobj->numibs > HWSCHED_MAX_DISPATCH_NUMIBS || test_bit(CMDOBJ_SKIP, &cmdobj->priv)) cmd_sizebytes = sizeof(*cmd); else cmd_sizebytes = sizeof(*cmd) + (sizeof(struct hfi_issue_ib) * cmdobj->numibs); if (WARN_ON(cmd_sizebytes > HFI_MAX_MSG_SIZE)) return -EMSGSIZE; memset(cmdbuf, 0x0, cmd_sizebytes); cmd = cmdbuf; cmd->ctxt_id = drawobj->context->id; cmd->flags = HFI_CTXT_FLAG_NOTIFY; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:3934 [MATCH: struct hfi_] --- int gen8_hwsched_send_recurring_cmdobj(struct adreno_device *adreno_dev, struct kgsl_drawobj_cmd *cmdobj) { struct adreno_hwsched *hwsched = &adreno_dev->hwsched; struct kgsl_drawobj *drawobj = DRAWOBJ(cmdobj); struct hfi_submit_cmd *cmd; struct kgsl_memobj_node *ib; u32 cmd_sizebytes; int ret; static bool active; if (adreno_gpu_halt(adreno_dev) || adreno_gpu_fault(adreno_dev)) return -EBUSY; if (test_bit(CMDOBJ_RECURRING_STOP, &cmdobj->priv)) { cmdobj->numibs = 0; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:3957 [MATCH: struct hfi_] --- if (cmdobj->numibs > HWSCHED_MAX_DISPATCH_NUMIBS) cmd_sizebytes = sizeof(*cmd); else cmd_sizebytes = sizeof(*cmd) + (sizeof(struct hfi_issue_ib) * cmdobj->numibs); if (WARN_ON(cmd_sizebytes > HFI_MAX_MSG_SIZE)) return -EMSGSIZE; cmd = kzalloc(cmd_sizebytes, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; if (test_bit(CMDOBJ_RECURRING_START, &cmdobj->priv)) { if (!active) { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:4126 [MATCH: struct hfi_] --- struct device *gmu_pdev_dev = GMU_PDEV_DEV(KGSL_DEVICE(adreno_dev)); struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev); struct gen8_hwsched_hfi *hfi = to_gen8_hwsched_hfi(adreno_dev); struct adreno_context *drawctxt = ADRENO_CONTEXT(context); struct pending_cmd pending_ack; struct hfi_unregister_ctxt_cmd cmd; struct kgsl_process_private *proc_priv = drawctxt->base.proc_priv; u32 seqnum; int ret; /* Only send HFI if device is not in SLUMBER */ if (!context->gmu_registered || !test_bit(GMU_PRIV_GPU_STARTED, &gmu->flags)) { drain_context_hw_fences(adreno_dev, drawctxt); proc_priv->profile.gmu_registered = false; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:4297 [MATCH: struct hfi_] --- int gen8_hwsched_soft_reset(struct adreno_device *adreno_dev, struct kgsl_context *context, bool ctx_guilty) { struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev); struct hfi_context_bad_cmd *in = (struct hfi_context_bad_cmd *)adreno_dev->hwsched.ctxt_bad; int ret; if (!test_bit(ADRENO_HWSCHED_GPU_SOFT_RESET, &adreno_dev->hwsched.flags)) return -EOPNOTSUPP; if (adreno_dev->hwsched.reset_type != GMU_GPU_SOFT_RESET) return -EINVAL; if (!test_bit(GMU_PRIV_GPU_STARTED, &gmu->flags)) return 0; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:4477 [MATCH: struct hfi_] --- } int gen8_hwsched_set_dcvs_profile(struct adreno_device *adreno_dev, struct kgsl_process_private *proc_priv) { struct hfi_profile_register cmd = {0}; struct hfi_msg_platform msg = {0}; struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev); struct kgsl_memdesc md = proc_priv->profile.md; int ret; /* Only send HFI if device is not in SLUMBER */ if (!test_bit(GMU_PRIV_GPU_STARTED, &gmu->flags)) return 0; msg.sub_type = H2F_ST_MSG_PROFILE_REGISTER; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:4478 [MATCH: struct hfi_] --- int gen8_hwsched_set_dcvs_profile(struct adreno_device *adreno_dev, struct kgsl_process_private *proc_priv) { struct hfi_profile_register cmd = {0}; struct hfi_msg_platform msg = {0}; struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev); struct kgsl_memdesc md = proc_priv->profile.md; int ret; /* Only send HFI if device is not in SLUMBER */ if (!test_bit(GMU_PRIV_GPU_STARTED, &gmu->flags)) return 0; msg.sub_type = H2F_ST_MSG_PROFILE_REGISTER; CMD_MSG_HDR(msg, H2F_MSG_PLATFORM_LA); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:4237 [MATCH: enum hfi] --- return gen8_hwsched_disable_hw_fence_throttle(adreno_dev); } static int gen8_hwsched_hfi_msg_reply(struct adreno_device *adreno_dev, enum hfi_msg_type msg, u32 hdr) { struct hfi_msg_ret_cmd out = {0}; struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev); u32 seqnum; out.hdr = ACK_MSG_HDR(msg); seqnum = atomic_inc_return(&gmu->hfi.seqnum); out.hdr = MSG_HDR_SET_SEQNUM_SIZE(out.hdr, seqnum, sizeof(out) >> 2); out.error = GMU_SUCCESS; out.req_hdr = hdr; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:1075 [MATCH: HFI_MSG_ID] --- return; mutex_lock(&hw_hfi->msgq_mutex); for (;;) { next_hdr = peek_next_header(adreno_dev, gmu, HFI_MSG_ID); if (!next_hdr) break; if (MSG_HDR_GET_TYPE(next_hdr) == HFI_MSG_ACK) type = HFI_MSG_ACK; else type = MSG_HDR_GET_ID(next_hdr); if (type != F2H_MSG_CONTEXT_BAD) { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:1086 [MATCH: HFI_MSG_ID] --- type = HFI_MSG_ACK; else type = MSG_HDR_GET_ID(next_hdr); if (type != F2H_MSG_CONTEXT_BAD) { if (gen8_hfi_queue_read(gmu, HFI_MSG_ID, rcvd, sizeof(rcvd)) < 0) break; } switch (type) { case HFI_MSG_ACK: /* * We are assuming that there is only one outstanding ack because hfi * sending thread waits for completion while holding the device mutex * (except when we send H2F_MSG_HW_FENCE_INFO packets) */ --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:1103 [MATCH: HFI_MSG_ID] --- process_hw_fence_ack(adreno_dev, rcvd); else gen8_receive_ack_async(adreno_dev, rcvd); break; case F2H_MSG_CONTEXT_BAD: if (gen8_hfi_queue_read(gmu, HFI_MSG_ID, (u32 *)adreno_dev->hwsched.ctxt_bad, HFI_MAX_MSG_SIZE) < 0) break; process_ctx_bad(adreno_dev); break; case F2H_MSG_TS_RETIRE: adreno_hwsched_log_profiling_info(adreno_dev, rcvd); adreno_scheduler_queue(adreno_dev); break; case F2H_MSG_SYNCOBJ_QUERY: --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:1468 [MATCH: HFI_MSG_ID] --- seqnum); gmu_core_fault_snapshot(device, GMU_FAULT_H2F_MSG_START); goto done; } rc = gen8_hfi_queue_read(gmu, HFI_MSG_ID, rcvd, sizeof(rcvd)); if (rc <= 0) { dev_err(gmu_pdev_dev, "MSG_START: payload error: %d\n", rc); gmu_core_fault_snapshot(device, GMU_FAULT_H2F_MSG_START); goto done; } switch (MSG_HDR_GET_ID(rcvd[0])) { case F2H_MSG_MEM_ALLOC: --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c:2881 [MATCH: HFI_MSG_ID] --- while (!kthread_should_stop()) { wait_event_interruptible(hfi->f2h_wq, kthread_should_stop() || /* If msgq irq is enabled and msgq has messages to process */ (((hfi->irq_mask & HFI_IRQ_MSGQ_MASK) && !is_queue_empty(adreno_dev, HFI_MSG_ID)) || /* Trace buffer has messages to process */ !gmu_core_is_trace_empty(device->gmu_core.trace.md->hostptr) || /* Dbgq has messages to process */ !is_queue_empty(adreno_dev, HFI_DBG_ID))); if (kthread_should_stop()) break; gen8_hwsched_process_msgq(adreno_dev); gmu_core_process_trace_data(KGSL_DEVICE(adreno_dev), --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.h:12 [MATCH: struct hfi_] --- #ifndef _ADRENO_GEN8_HWSCHED_HFI_H_ #define _ADRENO_GEN8_HWSCHED_HFI_H_ /* Maximum number of IBs in a submission */ #define HWSCHED_MAX_NUMIBS \ ((HFI_MAX_MSG_SIZE - offsetof(struct hfi_issue_cmd_cmd, ibs)) \ / sizeof(struct hfi_issue_ib)) /* * This is used to put userspace threads to sleep when hardware fence unack count reaches a * threshold. This bit is cleared in two scenarios: * 1. If the hardware fence unack count drops to a desired threshold. * 2. If there is a GMU/GPU fault. Because we don't want the threads to keep sleeping through fault * recovery, which can easily take 100s of milliseconds to complete. */ #define GEN8_HWSCHED_HW_FENCE_SLEEP_BIT 0x0 --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.h:13 [MATCH: struct hfi_] --- #define _ADRENO_GEN8_HWSCHED_HFI_H_ /* Maximum number of IBs in a submission */ #define HWSCHED_MAX_NUMIBS \ ((HFI_MAX_MSG_SIZE - offsetof(struct hfi_issue_cmd_cmd, ibs)) \ / sizeof(struct hfi_issue_ib)) /* * This is used to put userspace threads to sleep when hardware fence unack count reaches a * threshold. This bit is cleared in two scenarios: * 1. If the hardware fence unack count drops to a desired threshold. * 2. If there is a GMU/GPU fault. Because we don't want the threads to keep sleeping through fault * recovery, which can easily take 100s of milliseconds to complete. */ #define GEN8_HWSCHED_HW_FENCE_SLEEP_BIT 0x0 --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.h:43 [MATCH: struct hfi_] --- * or when soccp vote fails */ #define GEN8_HWSCHED_HW_FENCE_ABORT_BIT 0x2 #define MAX_THROTTLE_LVLS 3 struct hfi_tsens_cfg { /** @limit_u: deci-C value for upper trigger point */ u32 limit_u; /** @limit_l: deci-C value for lower trigger point */ u32 limit_l; /** @margin_u: deci-C value for upper trigger intercept margin */ u32 margin_u; /** @margin_l: deci-C value for lower trigger intercept margin */ u32 margin_l; } __packed; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.h:54 [MATCH: struct hfi_] --- u32 margin_u; /** @margin_l: deci-C value for lower trigger intercept margin */ u32 margin_l; } __packed; struct hfi_tsens_throttle_param { /** @throttle_hyst: Microsecond wait between each throttle level */ u32 throttle_hyst; /** @num_throttle_cnt: Number of entries in throttle_levels */ u32 num_throttle_cnt; /** @throttle_lvls: Percent of original clock to throttle per level */ u32 throttle_lvls[MAX_THROTTLE_LVLS]; } __packed; struct hfi_therm_profile_ctrl { /** @feature_en: Feature enable status */ --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.h:63 [MATCH: struct hfi_] --- u32 num_throttle_cnt; /** @throttle_lvls: Percent of original clock to throttle per level */ u32 throttle_lvls[MAX_THROTTLE_LVLS]; } __packed; struct hfi_therm_profile_ctrl { /** @feature_en: Feature enable status */ u16 feature_en; /** @feature_rev: Feature revision */ u16 feature_rev; /** @tsens_en: tsens sensor enable status */ u32 tsens_en; /** @tj_limit: deci-C value for tj limit */ u32 tj_limit; /** @tskin_addr: unused */ u32 tskin_addr; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.h:79 [MATCH: struct hfi_] --- /** @tskin_limit: unused */ u32 tskin_limit; /** @tsens_cfg_cnt: Count of tsens configuration structs */ u32 tsens_cfg_cnt; /** @tsens_cfg: Struct of tsens configurations */ struct hfi_tsens_cfg tsens_cfg; /** @throttle_cfg: Struct of throttle configurations */ struct hfi_tsens_throttle_param throttle_cfg; } __packed; /* H2F */ struct hfi_thermaltable_cmd { /** @hdr: HFI header message */ u32 hdr; /** @version: Version identifier for the format used for domains */ u32 version; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.h:81 [MATCH: struct hfi_] --- /** @tsens_cfg_cnt: Count of tsens configuration structs */ u32 tsens_cfg_cnt; /** @tsens_cfg: Struct of tsens configurations */ struct hfi_tsens_cfg tsens_cfg; /** @throttle_cfg: Struct of throttle configurations */ struct hfi_tsens_throttle_param throttle_cfg; } __packed; /* H2F */ struct hfi_thermaltable_cmd { /** @hdr: HFI header message */ u32 hdr; /** @version: Version identifier for the format used for domains */ u32 version; /** @ctrl: Thermal profile control information */ struct hfi_therm_profile_ctrl ctrl; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.h:85 [MATCH: struct hfi_] --- /** @throttle_cfg: Struct of throttle configurations */ struct hfi_tsens_throttle_param throttle_cfg; } __packed; /* H2F */ struct hfi_thermaltable_cmd { /** @hdr: HFI header message */ u32 hdr; /** @version: Version identifier for the format used for domains */ u32 version; /** @ctrl: Thermal profile control information */ struct hfi_therm_profile_ctrl ctrl; } __packed; struct gen8_hwsched_hfi { /** @irq_mask: Store the hfi interrupt mask */ --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.h:91 [MATCH: struct hfi_] --- /** @hdr: HFI header message */ u32 hdr; /** @version: Version identifier for the format used for domains */ u32 version; /** @ctrl: Thermal profile control information */ struct hfi_therm_profile_ctrl ctrl; } __packed; struct gen8_hwsched_hfi { /** @irq_mask: Store the hfi interrupt mask */ u32 irq_mask; /** @msglock: To protect the list of un-ACKed hfi packets */ rwlock_t msglock; /** @msglist: List of un-ACKed hfi packets */ struct list_head msglist; /** @f2h_task: Task for processing gmu fw to host packets */ --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:357 [MATCH: struct hfi_] --- /* Gfx buffer needs to be secure */ #define HFI_MEMFLAG_GFX_SECURE BIT(12) /** * struct hfi_queue_table_header - HFI queue table structure * @version: HFI protocol version * @size: queue table size in dwords * @qhdr0_offset: first queue header offset (dwords) in this table * @qhdr_size: queue header size * @num_q: number of queues defined in this table * @num_active_q: number of active queues */ struct hfi_queue_table_header { u32 version; u32 size; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:365 [MATCH: struct hfi_] --- * @qhdr0_offset: first queue header offset (dwords) in this table * @qhdr_size: queue header size * @num_q: number of queues defined in this table * @num_active_q: number of active queues */ struct hfi_queue_table_header { u32 version; u32 size; u32 qhdr0_offset; u32 qhdr_size; u32 num_q; u32 num_active_q; } __packed; /** * struct gmu_context_queue_header - GMU context queue header structure --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:408 [MATCH: struct hfi_] --- u32 unused2; u32 unused3; } __packed; /** * struct hfi_queue_header - HFI queue header structure * @status: active: 1; inactive: 0 * @start_addr: starting address of the queue in GMU VA space * @type: queue type encoded the priority, ID and send/recevie types * @queue_size: size of the queue * @msg_size: size of the message if each message has fixed size. * Otherwise, 0 means variable size of message in the queue. * @read_index: read index of the queue * @write_index: write index of the queue */ struct hfi_queue_header { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:418 [MATCH: struct hfi_] --- * @msg_size: size of the message if each message has fixed size. * Otherwise, 0 means variable size of message in the queue. * @read_index: read index of the queue * @write_index: write index of the queue */ struct hfi_queue_header { u32 status; u32 start_addr; u32 type; u32 queue_size; u32 msg_size; u32 unused0; u32 unused1; u32 unused2; u32 unused3; u32 unused4; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:456 [MATCH: struct hfi_] --- #define HFI_QUEUE_DEFAULT_CNT 3 #define HFI_QUEUE_DISPATCH_MAX_CNT 14 #define HFI_QUEUE_HDR_MAX (HFI_QUEUE_DEFAULT_CNT + HFI_QUEUE_DISPATCH_MAX_CNT) struct hfi_queue_table { struct hfi_queue_table_header qtbl_hdr; struct hfi_queue_header qhdr[HFI_QUEUE_HDR_MAX]; } __packed; #define HFI_QUEUE_OFFSET(i) \ (ALIGN(sizeof(struct hfi_queue_table), SZ_16) + \ ((i) * HFI_QUEUE_SIZE)) #define GMU_QUEUE_START_ADDR(gmuaddr, i) \ (gmuaddr + HFI_QUEUE_OFFSET(i)) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:457 [MATCH: struct hfi_] --- #define HFI_QUEUE_DEFAULT_CNT 3 #define HFI_QUEUE_DISPATCH_MAX_CNT 14 #define HFI_QUEUE_HDR_MAX (HFI_QUEUE_DEFAULT_CNT + HFI_QUEUE_DISPATCH_MAX_CNT) struct hfi_queue_table { struct hfi_queue_table_header qtbl_hdr; struct hfi_queue_header qhdr[HFI_QUEUE_HDR_MAX]; } __packed; #define HFI_QUEUE_OFFSET(i) \ (ALIGN(sizeof(struct hfi_queue_table), SZ_16) + \ ((i) * HFI_QUEUE_SIZE)) #define GMU_QUEUE_START_ADDR(gmuaddr, i) \ (gmuaddr + HFI_QUEUE_OFFSET(i)) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:462 [MATCH: struct hfi_] --- struct hfi_queue_table_header qtbl_hdr; struct hfi_queue_header qhdr[HFI_QUEUE_HDR_MAX]; } __packed; #define HFI_QUEUE_OFFSET(i) \ (ALIGN(sizeof(struct hfi_queue_table), SZ_16) + \ ((i) * HFI_QUEUE_SIZE)) #define GMU_QUEUE_START_ADDR(gmuaddr, i) \ (gmuaddr + HFI_QUEUE_OFFSET(i)) #define HOST_QUEUE_START_ADDR(hfi_mem, i) \ ((hfi_mem)->hostptr + HFI_QUEUE_OFFSET(i)) #define MSG_HDR_GET_ID(hdr) ((hdr) & 0xFF) #define MSG_HDR_GET_SIZE(hdr) (((hdr) >> 8) & 0xFF) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:576 [MATCH: struct hfi_] --- GMU_MIT_PCLX, GMU_MIT_MAX, }; /* H2F */ struct hfi_gmu_init_cmd { u32 hdr; u32 seg_id; u32 dbg_buffer_addr; u32 dbg_buffer_size; u32 boot_state; } __packed; /* H2F */ struct hfi_fw_version_cmd { u32 hdr; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:585 [MATCH: struct hfi_] --- u32 dbg_buffer_size; u32 boot_state; } __packed; /* H2F */ struct hfi_fw_version_cmd { u32 hdr; u32 supported_ver; } __packed; /* H2F */ struct hfi_bwtable_cmd { u32 hdr; u32 bw_level_num; u32 cnoc_cmds_num; u32 ddr_cmds_num; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:591 [MATCH: struct hfi_] --- u32 hdr; u32 supported_ver; } __packed; /* H2F */ struct hfi_bwtable_cmd { u32 hdr; u32 bw_level_num; u32 cnoc_cmds_num; u32 ddr_cmds_num; u32 cnoc_wait_bitmask; u32 ddr_wait_bitmask; u32 cnoc_cmd_addrs[MAX_CNOC_CMDS]; u32 cnoc_cmd_data[MAX_CNOC_LEVELS][MAX_CNOC_CMDS]; u32 ddr_cmd_addrs[MAX_BW_CMDS]; u32 ddr_cmd_data[MAX_BW_LEVELS][MAX_BW_CMDS]; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:617 [MATCH: struct hfi_] --- u32 vote; u32 freq; } __packed; /* H2F */ struct hfi_dcvstable_v1_cmd { u32 hdr; u32 gpu_level_num; u32 gmu_level_num; struct opp_desc gx_votes[MAX_GX_LEVELS_LEGACY]; struct opp_desc cx_votes[MAX_CX_LEVELS_LEGACY]; } __packed; /* H2F */ struct hfi_dcvstable_cmd { u32 hdr; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:626 [MATCH: struct hfi_] --- struct opp_desc gx_votes[MAX_GX_LEVELS_LEGACY]; struct opp_desc cx_votes[MAX_CX_LEVELS_LEGACY]; } __packed; /* H2F */ struct hfi_dcvstable_cmd { u32 hdr; u32 gpu_level_num; u32 gmu_level_num; struct opp_gx_desc gx_votes[MAX_GX_LEVELS_LEGACY]; struct opp_desc cx_votes[MAX_CX_LEVELS_LEGACY]; } __packed; /* H2F */ struct hfi_table_entry { u32 count; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:635 [MATCH: struct hfi_] --- struct opp_gx_desc gx_votes[MAX_GX_LEVELS_LEGACY]; struct opp_desc cx_votes[MAX_CX_LEVELS_LEGACY]; } __packed; /* H2F */ struct hfi_table_entry { u32 count; u32 stride; u32 data[]; } __packed; struct hfi_table_cmd { u32 hdr; u32 version; u32 type; struct hfi_table_entry entry[]; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:641 [MATCH: struct hfi_] --- u32 count; u32 stride; u32 data[]; } __packed; struct hfi_table_cmd { u32 hdr; u32 version; u32 type; struct hfi_table_entry entry[]; } __packed; #define MAX_ACD_STRIDE 2 #define MAX_ACD_NUM_LEVELS KGSL_MAX_PWRLEVELS /* H2F */ --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:645 [MATCH: struct hfi_] --- struct hfi_table_cmd { u32 hdr; u32 version; u32 type; struct hfi_table_entry entry[]; } __packed; #define MAX_ACD_STRIDE 2 #define MAX_ACD_NUM_LEVELS KGSL_MAX_PWRLEVELS /* H2F */ struct hfi_acd_table_cmd { u32 hdr; u32 version; u32 enable_by_level; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:652 [MATCH: struct hfi_] --- #define MAX_ACD_STRIDE 2 #define MAX_ACD_NUM_LEVELS KGSL_MAX_PWRLEVELS /* H2F */ struct hfi_acd_table_cmd { u32 hdr; u32 version; u32 enable_by_level; u32 stride; u32 num_levels; u32 data[MAX_ACD_NUM_LEVELS * MAX_ACD_STRIDE]; } __packed; #define CLX_DOMAINS_V2 2 struct clx_domain_v2 { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:684 [MATCH: struct hfi_] --- /** @currbudget: Current Budget */ u32 currbudget; } __packed; /* H2F */ struct hfi_clx_table_v2_cmd { /** @hdr: HFI header message */ u32 hdr; /** @version: Version identifier for the format used for domains */ u32 version; /** @domain: GFX and MXC Domain information */ struct clx_domain_v2 domain[CLX_DOMAINS_V2]; } __packed; struct limits_mitigation_cfg { /** @enable: Enable limits mitigation for this domain */ --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:719 [MATCH: struct hfi_] --- /** @curr_limit: Max current in mA during mitigation */ u32 curr_limit; } __packed; /* H2F */ struct hfi_limits_mit_tbl { /** @feature_id: Value from enum gmu_limits_mit_feature */ u8 feature_id; /** @domain: Value from enum gmu_rail_domain */ u8 domain; /** @feature_rev: Feature revision */ u16 feature_rev; /** @mit_cfg: Mitigation config */ struct limits_mitigation_cfg mit_cfg; } __packed; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:731 [MATCH: struct hfi_] --- /** @mit_cfg: Mitigation config */ struct limits_mitigation_cfg mit_cfg; } __packed; /* H2F */ struct hfi_test_cmd { u32 hdr; u32 data; } __packed; /* H2F */ struct hfi_start_cmd { u32 hdr; } __packed; /* H2F */ --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:737 [MATCH: struct hfi_] --- u32 hdr; u32 data; } __packed; /* H2F */ struct hfi_start_cmd { u32 hdr; } __packed; /* H2F */ struct hfi_feature_ctrl_cmd { u32 hdr; u32 feature; u32 enable; u32 data; } __packed; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:742 [MATCH: struct hfi_] --- struct hfi_start_cmd { u32 hdr; } __packed; /* H2F */ struct hfi_feature_ctrl_cmd { u32 hdr; u32 feature; u32 enable; u32 data; } __packed; /* H2F */ struct hfi_get_value_cmd { u32 hdr; u32 type; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:750 [MATCH: struct hfi_] --- u32 enable; u32 data; } __packed; /* H2F */ struct hfi_get_value_cmd { u32 hdr; u32 type; u32 subtype; } __packed; /* Internal */ struct hfi_get_value_req { struct hfi_get_value_cmd cmd; u32 data[16]; } __packed; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:757 [MATCH: struct hfi_] --- u32 type; u32 subtype; } __packed; /* Internal */ struct hfi_get_value_req { struct hfi_get_value_cmd cmd; u32 data[16]; } __packed; /* F2H */ struct hfi_get_value_reply_cmd { u32 hdr; u32 req_hdr; u32 data[16]; } __packed; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:758 [MATCH: struct hfi_] --- u32 subtype; } __packed; /* Internal */ struct hfi_get_value_req { struct hfi_get_value_cmd cmd; u32 data[16]; } __packed; /* F2H */ struct hfi_get_value_reply_cmd { u32 hdr; u32 req_hdr; u32 data[16]; } __packed; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:763 [MATCH: struct hfi_] --- struct hfi_get_value_cmd cmd; u32 data[16]; } __packed; /* F2H */ struct hfi_get_value_reply_cmd { u32 hdr; u32 req_hdr; u32 data[16]; } __packed; /* H2F */ struct hfi_set_value_cmd { u32 hdr; u32 type; u32 subtype; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:770 [MATCH: struct hfi_] --- u32 req_hdr; u32 data[16]; } __packed; /* H2F */ struct hfi_set_value_cmd { u32 hdr; u32 type; u32 subtype; u32 data; } __packed; /* H2F */ struct hfi_core_fw_start_cmd { u32 hdr; u32 handle; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:778 [MATCH: struct hfi_] --- u32 subtype; u32 data; } __packed; /* H2F */ struct hfi_core_fw_start_cmd { u32 hdr; u32 handle; } __packed; struct hfi_mem_alloc_desc_legacy { u64 gpu_addr; u32 flags; u32 mem_kind; u32 host_mem_handle; u32 gmu_mem_handle; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:783 [MATCH: struct hfi_] --- struct hfi_core_fw_start_cmd { u32 hdr; u32 handle; } __packed; struct hfi_mem_alloc_desc_legacy { u64 gpu_addr; u32 flags; u32 mem_kind; u32 host_mem_handle; u32 gmu_mem_handle; u32 gmu_addr; u32 size; /* Bytes */ } __packed; struct hfi_mem_alloc_desc { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:793 [MATCH: struct hfi_] --- u32 gmu_mem_handle; u32 gmu_addr; u32 size; /* Bytes */ } __packed; struct hfi_mem_alloc_desc { u64 gpu_addr; u32 flags; u32 mem_kind; u32 host_mem_handle; u32 gmu_mem_handle; u32 gmu_addr; u32 size; /* Bytes */ /** * @align: bits[0:7] specify alignment requirement of the GMU VA specified as a power of * two. bits[8:15] specify alignment requirement for the size of the GMU mapping. For --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:809 [MATCH: struct hfi_] --- * example, a decimal value of 20 = (1 << 20) = 1 MB alignment */ u32 align; } __packed; struct hfi_mem_alloc_entry { struct hfi_mem_alloc_desc desc; struct kgsl_memdesc *md; }; /* F2H */ struct hfi_mem_alloc_cmd_legacy { u32 hdr; u32 reserved; /* Padding to ensure alignment of 'desc' below */ struct hfi_mem_alloc_desc_legacy desc; } __packed; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:810 [MATCH: struct hfi_] --- */ u32 align; } __packed; struct hfi_mem_alloc_entry { struct hfi_mem_alloc_desc desc; struct kgsl_memdesc *md; }; /* F2H */ struct hfi_mem_alloc_cmd_legacy { u32 hdr; u32 reserved; /* Padding to ensure alignment of 'desc' below */ struct hfi_mem_alloc_desc_legacy desc; } __packed; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:815 [MATCH: struct hfi_] --- struct hfi_mem_alloc_desc desc; struct kgsl_memdesc *md; }; /* F2H */ struct hfi_mem_alloc_cmd_legacy { u32 hdr; u32 reserved; /* Padding to ensure alignment of 'desc' below */ struct hfi_mem_alloc_desc_legacy desc; } __packed; struct hfi_mem_alloc_cmd { u32 hdr; u32 version; struct hfi_mem_alloc_desc desc; } __packed; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:818 [MATCH: struct hfi_] --- /* F2H */ struct hfi_mem_alloc_cmd_legacy { u32 hdr; u32 reserved; /* Padding to ensure alignment of 'desc' below */ struct hfi_mem_alloc_desc_legacy desc; } __packed; struct hfi_mem_alloc_cmd { u32 hdr; u32 version; struct hfi_mem_alloc_desc desc; } __packed; /* H2F */ struct hfi_mem_alloc_reply_cmd { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:821 [MATCH: struct hfi_] --- u32 hdr; u32 reserved; /* Padding to ensure alignment of 'desc' below */ struct hfi_mem_alloc_desc_legacy desc; } __packed; struct hfi_mem_alloc_cmd { u32 hdr; u32 version; struct hfi_mem_alloc_desc desc; } __packed; /* H2F */ struct hfi_mem_alloc_reply_cmd { u32 hdr; u32 req_hdr; struct hfi_mem_alloc_desc desc; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:824 [MATCH: struct hfi_] --- } __packed; struct hfi_mem_alloc_cmd { u32 hdr; u32 version; struct hfi_mem_alloc_desc desc; } __packed; /* H2F */ struct hfi_mem_alloc_reply_cmd { u32 hdr; u32 req_hdr; struct hfi_mem_alloc_desc desc; } __packed; /* H2F */ --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:828 [MATCH: struct hfi_] --- u32 version; struct hfi_mem_alloc_desc desc; } __packed; /* H2F */ struct hfi_mem_alloc_reply_cmd { u32 hdr; u32 req_hdr; struct hfi_mem_alloc_desc desc; } __packed; /* H2F */ struct hfi_gx_bw_perf_vote_cmd { u32 hdr; u32 ack_type; u32 freq; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:831 [MATCH: struct hfi_] --- /* H2F */ struct hfi_mem_alloc_reply_cmd { u32 hdr; u32 req_hdr; struct hfi_mem_alloc_desc desc; } __packed; /* H2F */ struct hfi_gx_bw_perf_vote_cmd { u32 hdr; u32 ack_type; u32 freq; u32 bw; } __packed; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:835 [MATCH: struct hfi_] --- u32 req_hdr; struct hfi_mem_alloc_desc desc; } __packed; /* H2F */ struct hfi_gx_bw_perf_vote_cmd { u32 hdr; u32 ack_type; u32 freq; u32 bw; } __packed; /* H2F */ struct hfi_fw_halt_cmd { u32 hdr; u32 en_halt; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:843 [MATCH: struct hfi_] --- u32 freq; u32 bw; } __packed; /* H2F */ struct hfi_fw_halt_cmd { u32 hdr; u32 en_halt; } __packed; /* H2F */ struct hfi_prep_slumber_cmd { u32 hdr; u32 bw; u32 freq; } __packed; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:849 [MATCH: struct hfi_] --- u32 hdr; u32 en_halt; } __packed; /* H2F */ struct hfi_prep_slumber_cmd { u32 hdr; u32 bw; u32 freq; } __packed; /* F2H */ struct hfi_err_cmd { u32 hdr; u32 error_code; u32 data[16]; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:856 [MATCH: struct hfi_] --- u32 bw; u32 freq; } __packed; /* F2H */ struct hfi_err_cmd { u32 hdr; u32 error_code; u32 data[16]; } __packed; /* F2H */ struct hfi_debug_cmd { u32 hdr; u32 type; u32 timestamp; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:863 [MATCH: struct hfi_] --- u32 error_code; u32 data[16]; } __packed; /* F2H */ struct hfi_debug_cmd { u32 hdr; u32 type; u32 timestamp; u32 data; } __packed; /* F2H */ struct hfi_trace_cmd { u32 hdr; u32 version; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:871 [MATCH: struct hfi_] --- u32 timestamp; u32 data; } __packed; /* F2H */ struct hfi_trace_cmd { u32 hdr; u32 version; u64 identifier; } __packed; /* Trace packet definition */ struct gmu_trace_packet { u32 hdr; u32 trace_id; u64 ticks; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:886 [MATCH: struct hfi_] --- u64 ticks; u32 payload[]; } __packed; /* F2H */ struct hfi_gmu_cntr_register_cmd { u32 hdr; u32 group_id; u32 countable; } __packed; /* H2F */ struct hfi_gmu_cntr_register_reply_cmd { u32 hdr; u32 req_hdr; u32 group_id; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:893 [MATCH: struct hfi_] --- u32 group_id; u32 countable; } __packed; /* H2F */ struct hfi_gmu_cntr_register_reply_cmd { u32 hdr; u32 req_hdr; u32 group_id; u32 countable; u32 cntr_lo; u32 cntr_hi; } __packed; /* F2H */ struct hfi_gmu_cntr_release_cmd { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:903 [MATCH: struct hfi_] --- u32 cntr_lo; u32 cntr_hi; } __packed; /* F2H */ struct hfi_gmu_cntr_release_cmd { u32 hdr; u32 group_id; u32 countable; } __packed; /* H2F */ struct hfi_register_ctxt_cmd { u32 hdr; u32 ctxt_id; u32 flags; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:910 [MATCH: struct hfi_] --- u32 group_id; u32 countable; } __packed; /* H2F */ struct hfi_register_ctxt_cmd { u32 hdr; u32 ctxt_id; u32 flags; u64 pt_addr; u32 ctxt_idr; u32 ctxt_bank; } __packed; /* H2F */ struct hfi_unregister_ctxt_cmd { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:920 [MATCH: struct hfi_] --- u32 ctxt_idr; u32 ctxt_bank; } __packed; /* H2F */ struct hfi_unregister_ctxt_cmd { u32 hdr; u32 ctxt_id; u32 ts; } __packed; struct hfi_issue_ib { u64 addr; u32 size; } __packed; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:926 [MATCH: struct hfi_] --- u32 hdr; u32 ctxt_id; u32 ts; } __packed; struct hfi_issue_ib { u64 addr; u32 size; } __packed; /* H2F */ /* The length of *buf will be embedded in the hdr */ struct hfi_issue_cmd_raw_cmd { u32 hdr; u32 *buf; } __packed; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:933 [MATCH: struct hfi_] --- u32 size; } __packed; /* H2F */ /* The length of *buf will be embedded in the hdr */ struct hfi_issue_cmd_raw_cmd { u32 hdr; u32 *buf; } __packed; /* Internal */ struct hfi_issue_cmd_raw_req { u32 queue; u32 ctxt_id; u32 len; u32 *buf; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:939 [MATCH: struct hfi_] --- u32 hdr; u32 *buf; } __packed; /* Internal */ struct hfi_issue_cmd_raw_req { u32 queue; u32 ctxt_id; u32 len; u32 *buf; } __packed; /* H2F */ struct hfi_ts_notify_cmd { u32 hdr; u32 ctxt_id; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:947 [MATCH: struct hfi_] --- u32 len; u32 *buf; } __packed; /* H2F */ struct hfi_ts_notify_cmd { u32 hdr; u32 ctxt_id; u32 ts; } __packed; #define CMDBATCH_SUCCESS 0 #define CMDBATCH_RETIRED 1 #define CMDBATCH_ERROR 2 #define CMDBATCH_SKIP 3 --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:985 [MATCH: struct hfi_] --- { BIT(GMU_SYNCOBJ_FLAG_QUERY_SW_STATUS_BIT), "QUERIED"}, \ { BIT(GMU_SYNCOBJ_FLAG_SW_STATUS_SIGNALED_BIT), "SW_SIGNALED"}, \ { BIT(GMU_SYNCOBJ_FLAG_SW_STATUS_PENDING_BIT), "SW_PENDING"} /* F2H */ struct hfi_ts_retire_cmd { u32 hdr; u32 ctxt_id; u32 ts; u32 type; u64 submitted_to_rb; u64 sop; u64 eop; u64 retired_on_gmu; u64 active; u32 version; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:999 [MATCH: struct hfi_] --- u64 active; u32 version; } __packed; /* H2F */ struct hfi_context_pointers_cmd { u32 hdr; u32 ctxt_id; u64 sop_addr; u64 eop_addr; u64 user_ctxt_record_addr; u32 version; u32 gmu_context_queue_addr; u32 dcvs_profile_addr; } __packed; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:1011 [MATCH: struct hfi_] --- u32 gmu_context_queue_addr; u32 dcvs_profile_addr; } __packed; /* H2F */ struct hfi_context_rule_cmd { u32 hdr; u32 ctxt_id; u32 type; u32 sub_type; } __packed; struct fault_info { u32 ctxt_id; u32 policy; u32 ts; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:1025 [MATCH: struct hfi_] --- u32 policy; u32 ts; } __packed; /* F2H */ struct hfi_context_bad_cmd { u32 hdr; u32 version; struct fault_info gc; struct fault_info lpac; u32 error; u32 payload[]; } __packed; /* F2H */ struct hfi_context_bad_cmd_legacy { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:1035 [MATCH: struct hfi_] --- u32 error; u32 payload[]; } __packed; /* F2H */ struct hfi_context_bad_cmd_legacy { u32 hdr; u32 ctxt_id; u32 policy; u32 ts; u32 error; u32 payload[]; } __packed; /* H2F */ struct hfi_msg_ret_cmd { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:1052 [MATCH: struct hfi_] --- u32 req_hdr; u32 error; } __packed; /* H2F */ struct hfi_submit_cmd { u32 hdr; u32 ctxt_id; u32 flags; u32 ts; u32 profile_gpuaddr_lo; u32 profile_gpuaddr_hi; u32 numibs; u32 big_ib_gmu_va; } __packed; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:1064 [MATCH: struct hfi_] --- u32 numibs; u32 big_ib_gmu_va; } __packed; /* This structure is only used for hw fence feature on gen7 hwsched targets */ struct hfi_syncobj_legacy { /** @ctxt_id: dma fence context id for external fence and gmu context id for kgsl fence */ u64 ctxt_id; /** @seq_no: Sequence number (or timestamp) of this fence */ u64 seq_no; /** @flags: Flags for this fence */ u64 flags; } __packed; struct hfi_syncobj { /** --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:1073 [MATCH: struct hfi_] --- u64 seq_no; /** @flags: Flags for this fence */ u64 flags; } __packed; struct hfi_syncobj { /** * @header: bits[0:15]: size of this packet in dwords, bits[15:23]: version, * bits[24:31] unused */ u32 header; /** @hash_index: hash index of external input fence */ u32 hash_index; /** @ctxt_id: dma fence context id for external fence and gmu context id for kgsl fence */ u64 ctxt_id; /** @seq_no: Sequence number (or timestamp) of this fence */ --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:1089 [MATCH: struct hfi_] --- u64 seq_no; /** @flags: Flags for this fence */ u64 flags; } __packed; struct hfi_submit_syncobj { u32 hdr; u32 version; u32 flags; u32 timestamp; u32 num_syncobj; } __packed; #define HFI_SYNCOBJ_LEGACY_HW_FENCE_MAX \ ((HFI_MAX_MSG_SIZE - sizeof(struct hfi_submit_syncobj)) \ / sizeof(struct hfi_syncobj_legacy)) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:1098 [MATCH: struct hfi_] --- u32 timestamp; u32 num_syncobj; } __packed; #define HFI_SYNCOBJ_LEGACY_HW_FENCE_MAX \ ((HFI_MAX_MSG_SIZE - sizeof(struct hfi_submit_syncobj)) \ / sizeof(struct hfi_syncobj_legacy)) #define HFI_SYNCOBJ_HW_FENCE_MAX \ ((HFI_MAX_MSG_SIZE - sizeof(struct hfi_submit_syncobj)) \ / sizeof(struct hfi_syncobj)) struct hfi_log_block { u32 hdr; u32 version; u32 start_index; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:1099 [MATCH: struct hfi_] --- u32 num_syncobj; } __packed; #define HFI_SYNCOBJ_LEGACY_HW_FENCE_MAX \ ((HFI_MAX_MSG_SIZE - sizeof(struct hfi_submit_syncobj)) \ / sizeof(struct hfi_syncobj_legacy)) #define HFI_SYNCOBJ_HW_FENCE_MAX \ ((HFI_MAX_MSG_SIZE - sizeof(struct hfi_submit_syncobj)) \ / sizeof(struct hfi_syncobj)) struct hfi_log_block { u32 hdr; u32 version; u32 start_index; u32 stop_index; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:1102 [MATCH: struct hfi_] --- #define HFI_SYNCOBJ_LEGACY_HW_FENCE_MAX \ ((HFI_MAX_MSG_SIZE - sizeof(struct hfi_submit_syncobj)) \ / sizeof(struct hfi_syncobj_legacy)) #define HFI_SYNCOBJ_HW_FENCE_MAX \ ((HFI_MAX_MSG_SIZE - sizeof(struct hfi_submit_syncobj)) \ / sizeof(struct hfi_syncobj)) struct hfi_log_block { u32 hdr; u32 version; u32 start_index; u32 stop_index; } __packed; enum hfi_warmboot_cmd_type { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:1103 [MATCH: struct hfi_] --- ((HFI_MAX_MSG_SIZE - sizeof(struct hfi_submit_syncobj)) \ / sizeof(struct hfi_syncobj_legacy)) #define HFI_SYNCOBJ_HW_FENCE_MAX \ ((HFI_MAX_MSG_SIZE - sizeof(struct hfi_submit_syncobj)) \ / sizeof(struct hfi_syncobj)) struct hfi_log_block { u32 hdr; u32 version; u32 start_index; u32 stop_index; } __packed; enum hfi_warmboot_cmd_type { HFI_WARMBOOT_SET_SCRATCH = 0, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:1105 [MATCH: struct hfi_] --- #define HFI_SYNCOBJ_HW_FENCE_MAX \ ((HFI_MAX_MSG_SIZE - sizeof(struct hfi_submit_syncobj)) \ / sizeof(struct hfi_syncobj)) struct hfi_log_block { u32 hdr; u32 version; u32 start_index; u32 stop_index; } __packed; enum hfi_warmboot_cmd_type { HFI_WARMBOOT_SET_SCRATCH = 0, HFI_WARMBOOT_EXEC_SCRATCH, HFI_WARMBOOT_QUERY_SCRATCH, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:1118 [MATCH: struct hfi_] --- HFI_WARMBOOT_SET_SCRATCH = 0, HFI_WARMBOOT_EXEC_SCRATCH, HFI_WARMBOOT_QUERY_SCRATCH, }; struct hfi_warmboot_scratch_cmd { /** @hdr: Header for the scratch command packet */ u32 hdr; /** @version: Version of the scratch command packet */ u32 version; /** @flags: Set, Execute or Query scratch flag */ u32 flags; /** @scratch_addr: Address of the scratch */ u32 scratch_addr; /** @scratch_size: Size of the scratch in bytes*/ u32 scratch_size; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:1134 [MATCH: struct hfi_] --- } __packed; /* Request GMU to add this fence to TxQueue without checking whether this is retired or not */ #define HW_FENCE_FLAG_SKIP_MEMSTORE 0x1 struct hfi_hw_fence_info { /** @hdr: Header for the fence info packet */ u32 hdr; /** @version: Version of the fence info packet */ u32 version; /** @gmu_ctxt_id: GMU Context id to which this fence belongs */ u32 gmu_ctxt_id; /** @error: Any error code associated with this fence */ u32 error; /** @ctxt_id: Context id for which hw fence is to be triggered */ u64 ctxt_id; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:1158 [MATCH: struct hfi_] --- /* The software fence corresponding to the queried hardware fence has not signaled */ #define ADRENO_HW_FENCE_SW_STATUS_PENDING BIT(0) /* The software fence corresponding to the queried hardware fence has signaled */ #define ADRENO_HW_FENCE_SW_STATUS_SIGNALED BIT(1) struct hfi_syncobj_query { /** * @query_bitmask: Bitmask representing the sync object descriptors to be queried. For * example, to query the second sync object descriptor(index=1) in a sync object, * bit(1) should be set in this bitmask. */ u32 query_bitmask; } __packed; #define MAX_SYNCOBJ_QUERY_BITS 128 #define BITS_PER_SYNCOBJ_QUERY 32 --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:1171 [MATCH: struct hfi_] --- #define MAX_SYNCOBJ_QUERY_BITS 128 #define BITS_PER_SYNCOBJ_QUERY 32 #define MAX_SYNCOBJ_QUERY_DWORDS (MAX_SYNCOBJ_QUERY_BITS / BITS_PER_SYNCOBJ_QUERY) struct hfi_syncobj_query_cmd { /** @hdr: Header for the fence info packet */ u32 hdr; /** @version: Version of the fence info packet */ u32 version; /** @gmu_ctxt_id: GMU Context id to which this SYNC object belongs */ u32 gmu_ctxt_id; /** @sync_obj_ts: Timestamp of this SYNC object */ u32 sync_obj_ts; /** @queries: Array of query bitmasks */ struct hfi_syncobj_query queries[MAX_SYNCOBJ_QUERY_DWORDS]; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:1181 [MATCH: struct hfi_] --- /** @gmu_ctxt_id: GMU Context id to which this SYNC object belongs */ u32 gmu_ctxt_id; /** @sync_obj_ts: Timestamp of this SYNC object */ u32 sync_obj_ts; /** @queries: Array of query bitmasks */ struct hfi_syncobj_query queries[MAX_SYNCOBJ_QUERY_DWORDS]; } __packed; /** * struct pending_cmd - data structure to track outstanding HFI * command messages */ struct pending_cmd { /** @sent_hdr: Header of the un-ack'd hfi packet */ u32 sent_hdr; /** @results: Array to store the ack packet */ --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:1199 [MATCH: struct hfi_] --- struct completion complete; /** @node: to add it to the list of hfi packets waiting for ack */ struct list_head node; }; struct hfi_msg_platform { /** @hdr: Header for the platform specific msg */ u32 hdr; /** @sub_type: Sub type for the platform msg */ u32 sub_type; } __packed; struct hfi_scale_gmu_cmd { /** @header: Header for the scale gmu packet */ struct hfi_msg_platform header; /** @gmu_pwrlevel: Gmu index of gmu power level to scale to */ --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:1206 [MATCH: struct hfi_] --- u32 hdr; /** @sub_type: Sub type for the platform msg */ u32 sub_type; } __packed; struct hfi_scale_gmu_cmd { /** @header: Header for the scale gmu packet */ struct hfi_msg_platform header; /** @gmu_pwrlevel: Gmu index of gmu power level to scale to */ u32 gmu_pwrlevel; } __packed; /* Platform specific H2F subtype message for GMU */ enum h2f_platform_action { H2F_ST_MSG_PROFILE_REGISTER, }; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:1208 [MATCH: struct hfi_] --- u32 sub_type; } __packed; struct hfi_scale_gmu_cmd { /** @header: Header for the scale gmu packet */ struct hfi_msg_platform header; /** @gmu_pwrlevel: Gmu index of gmu power level to scale to */ u32 gmu_pwrlevel; } __packed; /* Platform specific H2F subtype message for GMU */ enum h2f_platform_action { H2F_ST_MSG_PROFILE_REGISTER, }; /* H2F */ --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:1219 [MATCH: struct hfi_] --- enum h2f_platform_action { H2F_ST_MSG_PROFILE_REGISTER, }; /* H2F */ struct hfi_profile_register { /** @header: Header for the profile register packet */ struct hfi_msg_platform header; /** @version: Version of the profile register packet */ u32 version; /** @gmu_addr: Address of the GMU to store DCVS profile */ u32 gmu_addr; /** @attrs_addr: Address of the KGSL shared profile attrs */ u32 attrs_addr; } __packed; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:1221 [MATCH: struct hfi_] --- }; /* H2F */ struct hfi_profile_register { /** @header: Header for the profile register packet */ struct hfi_msg_platform header; /** @version: Version of the profile register packet */ u32 version; /** @gmu_addr: Address of the GMU to store DCVS profile */ u32 gmu_addr; /** @attrs_addr: Address of the KGSL shared profile attrs */ u32 attrs_addr; } __packed; static inline int _CMD_MSG_HDR(u32 *hdr, int id, size_t size) { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:1253 [MATCH: struct hfi_] --- #define RECORD_NOP_MSG_HDR(hdr) \ ((hdr) | (HFI_MSG_RECORD | HFI_MSG_NOP)) /* Maximum number of IBs in a submission */ #define HWSCHED_MAX_DISPATCH_NUMIBS \ ((HFI_MAX_MSG_SIZE - sizeof(struct hfi_submit_cmd)) \ / sizeof(struct hfi_issue_ib)) /** * struct payload_section - Container of keys values * * There may be a variable number of payload sections appended * to the context bad HFI message. Each payload section contains * a variable number of key-value pairs, both key and value being * single dword each. */ --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:1254 [MATCH: struct hfi_] --- ((hdr) | (HFI_MSG_RECORD | HFI_MSG_NOP)) /* Maximum number of IBs in a submission */ #define HWSCHED_MAX_DISPATCH_NUMIBS \ ((HFI_MAX_MSG_SIZE - sizeof(struct hfi_submit_cmd)) \ / sizeof(struct hfi_issue_ib)) /** * struct payload_section - Container of keys values * * There may be a variable number of payload sections appended * to the context bad HFI message. Each payload section contains * a variable number of key-value pairs, both key and value being * single dword each. */ struct payload_section { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:1466 [MATCH: struct hfi_] --- * This function makes sure that kgsl has consumed f2h packets * before GMU sees the updated read index. This avoids a corner * case where GMU might over-write f2h packets that have not yet * been consumed by kgsl. */ static inline void hfi_update_read_idx(struct hfi_queue_header *hdr, u32 index) { /* * This is to make sure packets are consumed before gmu sees the updated * read index */ mb(); hdr->read_index = index; } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:1513 [MATCH: struct hfi_] --- * out: Pointer to copy the descriptor data to * * This function checks for the F2H_MSG_MEM_ALLOC packet version and based on that gets the * descriptor data from the packet. */ static inline void hfi_get_mem_alloc_desc(void *rcvd, struct hfi_mem_alloc_desc *out) { struct hfi_mem_alloc_cmd_legacy *in_legacy = (struct hfi_mem_alloc_cmd_legacy *)rcvd; struct hfi_mem_alloc_cmd *in = (struct hfi_mem_alloc_cmd *)rcvd; if (in->version > 0) memcpy(out, &in->desc, sizeof(in->desc)); else memcpy(out, &in_legacy->desc, sizeof(in_legacy->desc)); } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:1515 [MATCH: struct hfi_] --- * This function checks for the F2H_MSG_MEM_ALLOC packet version and based on that gets the * descriptor data from the packet. */ static inline void hfi_get_mem_alloc_desc(void *rcvd, struct hfi_mem_alloc_desc *out) { struct hfi_mem_alloc_cmd_legacy *in_legacy = (struct hfi_mem_alloc_cmd_legacy *)rcvd; struct hfi_mem_alloc_cmd *in = (struct hfi_mem_alloc_cmd *)rcvd; if (in->version > 0) memcpy(out, &in->desc, sizeof(in->desc)); else memcpy(out, &in_legacy->desc, sizeof(in_legacy->desc)); } /** * hfi_get_gmu_va_alignment - Get the alignment (in bytes) for a GMU VA --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:1516 [MATCH: struct hfi_] --- * descriptor data from the packet. */ static inline void hfi_get_mem_alloc_desc(void *rcvd, struct hfi_mem_alloc_desc *out) { struct hfi_mem_alloc_cmd_legacy *in_legacy = (struct hfi_mem_alloc_cmd_legacy *)rcvd; struct hfi_mem_alloc_cmd *in = (struct hfi_mem_alloc_cmd *)rcvd; if (in->version > 0) memcpy(out, &in->desc, sizeof(in->desc)); else memcpy(out, &in_legacy->desc, sizeof(in_legacy->desc)); } /** * hfi_get_gmu_va_alignment - Get the alignment (in bytes) for a GMU VA * align: Alignment specified as a power of two (2^n) in bits[0:7] --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:1593 [MATCH: struct hfi_] --- */ int adreno_hwsched_ctxt_unregister_wait_completion( struct adreno_device *adreno_dev, struct device *dev, struct kgsl_context *context, struct pending_cmd *ack, void (*process_msgq)(struct adreno_device *adreno_dev), struct hfi_unregister_ctxt_cmd *cmd); /** * hfi_get_minidump_string - Get the va-minidump string from entry * mem_kind: mem_kind type * hfi_minidump_str: Pointer to the output string * size: Max size of the hfi_minidump_str * rb_id: Pointer to the rb_id count * * This function return 0 on valid mem_kind and copies the VA-MINIDUMP string to * hfi_minidump_str else return error --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:101 [MATCH: enum hfi] --- #define DEFAULT_MINBW_IDX 0x1 #define HFI_MINBW_DEFAULT (DEFAULT_MINBW_HYST | (DEFAULT_MINBW_IDX << 16)) /* Types to be used with H2F_MSG_TABLE */ enum hfi_table_type { HFI_TABLE_BW_VOTE = 0, HFI_TABLE_GPU_PERF = 1, HFI_TABLE_DIDT = 2, HFI_TABLE_ACD = 3, HFI_TABLE_CLX_V1 = 4, HFI_TABLE_CLX_V2 = 5, HFI_TABLE_THERM = 6, HFI_TABLE_DCVS_DATA = 7, HFI_TABLE_SYS_TIME_DATA = 8, HFI_TABLE_GMU_SCALING_DATA = 9, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:175 [MATCH: enum hfi] --- #define HFI_CTXT_FLAG_PREEMPT_STYLE_FG 2 /* Default sampling interval in units of 50 us */ #define HFI_FEATURE_GMU_STATS_INTERVAL 4 enum hfi_mem_kind { /** @HFI_MEMKIND_GENERIC: Used for requesting generic memory */ HFI_MEMKIND_GENERIC = 0, /** @HFI_MEMKIND_RB: Used for requesting ringbuffer memory */ HFI_MEMKIND_RB, /** @HFI_MEMKIND_SCRATCH: Used for requesting scratch memory */ HFI_MEMKIND_SCRATCH, /** * @HFI_MEMKIND_CSW_SMMU_INFO: Used for requesting SMMU record for * preemption context switching */ --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:496 [MATCH: enum hfi] --- #define HFI_RSP_TIMEOUT 1000 /* msec */ #define HFI_IRQ_MSGQ_MASK BIT(0) enum hfi_msg_type { H2F_MSG_INIT = 0, H2F_MSG_FW_VER = 1, H2F_MSG_LM_CFG = 2, H2F_MSG_BW_VOTE_TBL = 3, H2F_MSG_PERF_TBL = 4, H2F_MSG_TEST = 5, H2F_MSG_ACD_TBL = 7, H2F_MSG_CLX_TBL = 8, H2F_MSG_THERM_TBL = 9, H2F_MSG_START = 10, --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:1112 [MATCH: enum hfi] --- u32 version; u32 start_index; u32 stop_index; } __packed; enum hfi_warmboot_cmd_type { HFI_WARMBOOT_SET_SCRATCH = 0, HFI_WARMBOOT_EXEC_SCRATCH, HFI_WARMBOOT_QUERY_SCRATCH, }; struct hfi_warmboot_scratch_cmd { /** @hdr: Header for the scratch command packet */ u32 hdr; /** @version: Version of the scratch command packet */ u32 version; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h:18 [MATCH: HFI_MSG_ID] --- #define MAX_RCVD_PAYLOAD_SIZE 32 /* dwords */ #define MAX_RCVD_SIZE (MAX_RCVD_PAYLOAD_SIZE + 3) /* dwords */ #define HFI_MAX_MSG_SIZE (SZ_1K) #define HFI_CMD_ID 0 #define HFI_MSG_ID 1 #define HFI_DBG_ID 2 #define HFI_DSP_ID_0 3 #define HFI_CMD_IDX 0 #define HFI_MSG_IDX 1 #define HFI_DBG_IDX 2 #define HFI_DSP_IDX_BASE 3 #define HFI_DSP_IDX_0 3 #define HFI_CMD_IDX_LEGACY 0 --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched.c:71 [MATCH: struct hfi_] --- if (desc_flags & HFI_MEMFLAG_GFX_SECURE) *flags |= KGSL_MEMFLAGS_SECURE; } static int reserve_preempt_record_va(struct adreno_device *adreno_dev, struct hfi_mem_alloc_entry *entry, u64 flags, u32 priv) { struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct hfi_mem_alloc_desc *desc = &entry->desc; int ret = 0; if (!entry->md->gpuaddr) { ret = kgsl_get_global_gpuaddr(device, entry->md, desc->size, flags, priv); if (ret) return ret; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched.c:74 [MATCH: struct hfi_] --- static int reserve_preempt_record_va(struct adreno_device *adreno_dev, struct hfi_mem_alloc_entry *entry, u64 flags, u32 priv) { struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct hfi_mem_alloc_desc *desc = &entry->desc; int ret = 0; if (!entry->md->gpuaddr) { ret = kgsl_get_global_gpuaddr(device, entry->md, desc->size, flags, priv); if (ret) return ret; } if (!(entry->desc.flags & HFI_MEMFLAG_GMU_ACC)) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched.c:95 [MATCH: struct hfi_] --- return ret; } static int alloc_map_preempt_record(struct adreno_device *adreno_dev, struct kgsl_memdesc **md, struct hfi_mem_alloc_entry *entry, u64 offset, u64 flags, u32 priv) { u64 ctxt_record_size = adreno_dev->total_ctxt_record_sz; u64 curr_gmem_size = adreno_gmem_size(adreno_dev); u64 md_size = ctxt_record_size - curr_gmem_size; struct hfi_mem_alloc_desc *desc = &entry->desc; if (*md) return 0; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched.c:101 [MATCH: struct hfi_] --- u64 flags, u32 priv) { u64 ctxt_record_size = adreno_dev->total_ctxt_record_sz; u64 curr_gmem_size = adreno_gmem_size(adreno_dev); u64 md_size = ctxt_record_size - curr_gmem_size; struct hfi_mem_alloc_desc *desc = &entry->desc; if (*md) return 0; if (offset >= (entry->md->size)) return -ENOSPC; *md = kgsl_alloc_map_gpu_global(KGSL_DEVICE(adreno_dev), entry->md->gpuaddr + offset, md_size, 0, flags, priv, (entry->desc.mem_kind == HFI_MEMKIND_CSW_PRIV_SECURE) ? --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched.c:133 [MATCH: struct hfi_] --- get_gmu_vma_id(desc->flags), gmu_core_get_attrs(desc->flags), desc->align); } static int alloc_map_non_gmem(struct adreno_device *adreno_dev, struct hfi_mem_alloc_entry *entry, u64 flags, u32 priv) { struct adreno_hwsched *hwsched = &adreno_dev->hwsched; u64 ctxt_record_sz = adreno_dev->total_ctxt_record_sz, offset = 0; u64 curr_gmem_size = adreno_gmem_size(adreno_dev); bool no_rb0_gmem = false; int i; /* Check whether GMU has removed GMEM size from RB0 context record */ if (entry->desc.size == ((ctxt_record_sz * KGSL_PRIORITY_MAX_RB_LEVELS) - curr_gmem_size)) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched.c:163 [MATCH: struct hfi_] --- return 0; } static int process_preempt_record_mem_alloc(struct adreno_device *adreno_dev, struct hfi_mem_alloc_entry *entry) { u64 flags = 0; u32 priv = 0; int ret; if (!entry->md) { struct gmu_core_device *gmu = &KGSL_DEVICE(adreno_dev)->gmu_core; if (gmu->global_entries == ARRAY_SIZE(gmu->gmu_globals)) return -ENOMEM; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched.c:188 [MATCH: struct hfi_] --- return ret; return alloc_map_non_gmem(adreno_dev, entry, flags, priv); } static struct hfi_mem_alloc_entry *lookup_mem_alloc_table( struct adreno_device *adreno_dev, struct hfi_mem_alloc_desc *desc) { struct adreno_hwsched *hwsched = &adreno_dev->hwsched; int i; for (i = 0; i < hwsched->mem_alloc_entries; i++) { struct hfi_mem_alloc_entry *entry = &hwsched->mem_alloc_table[i]; if ((entry->desc.mem_kind == desc->mem_kind) && (entry->desc.gmu_mem_handle == desc->gmu_mem_handle)) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched.c:189 [MATCH: struct hfi_] --- return alloc_map_non_gmem(adreno_dev, entry, flags, priv); } static struct hfi_mem_alloc_entry *lookup_mem_alloc_table( struct adreno_device *adreno_dev, struct hfi_mem_alloc_desc *desc) { struct adreno_hwsched *hwsched = &adreno_dev->hwsched; int i; for (i = 0; i < hwsched->mem_alloc_entries; i++) { struct hfi_mem_alloc_entry *entry = &hwsched->mem_alloc_table[i]; if ((entry->desc.mem_kind == desc->mem_kind) && (entry->desc.gmu_mem_handle == desc->gmu_mem_handle)) return entry; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched.c:195 [MATCH: struct hfi_] --- { struct adreno_hwsched *hwsched = &adreno_dev->hwsched; int i; for (i = 0; i < hwsched->mem_alloc_entries; i++) { struct hfi_mem_alloc_entry *entry = &hwsched->mem_alloc_table[i]; if ((entry->desc.mem_kind == desc->mem_kind) && (entry->desc.gmu_mem_handle == desc->gmu_mem_handle)) return entry; } return NULL; } static struct hfi_mem_alloc_entry *get_mem_alloc_entry( --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched.c:205 [MATCH: struct hfi_] --- } return NULL; } static struct hfi_mem_alloc_entry *get_mem_alloc_entry( struct adreno_device *adreno_dev, struct hfi_mem_alloc_desc *desc) { struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct device *gmu_pdev_dev = GMU_PDEV_DEV(device); struct adreno_hwsched *hwsched = &adreno_dev->hwsched; struct hfi_mem_alloc_entry *entry = lookup_mem_alloc_table(adreno_dev, desc); u64 flags = 0; u32 priv = 0; int ret; const char *memkind_string = desc->mem_kind < HFI_MEMKIND_MAX ? --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched.c:206 [MATCH: struct hfi_] --- return NULL; } static struct hfi_mem_alloc_entry *get_mem_alloc_entry( struct adreno_device *adreno_dev, struct hfi_mem_alloc_desc *desc) { struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct device *gmu_pdev_dev = GMU_PDEV_DEV(device); struct adreno_hwsched *hwsched = &adreno_dev->hwsched; struct hfi_mem_alloc_entry *entry = lookup_mem_alloc_table(adreno_dev, desc); u64 flags = 0; u32 priv = 0; int ret; const char *memkind_string = desc->mem_kind < HFI_MEMKIND_MAX ? hfi_memkind_strings[desc->mem_kind] : "UNKNOWN"; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched.c:211 [MATCH: struct hfi_] --- struct adreno_device *adreno_dev, struct hfi_mem_alloc_desc *desc) { struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct device *gmu_pdev_dev = GMU_PDEV_DEV(device); struct adreno_hwsched *hwsched = &adreno_dev->hwsched; struct hfi_mem_alloc_entry *entry = lookup_mem_alloc_table(adreno_dev, desc); u64 flags = 0; u32 priv = 0; int ret; const char *memkind_string = desc->mem_kind < HFI_MEMKIND_MAX ? hfi_memkind_strings[desc->mem_kind] : "UNKNOWN"; if (entry) return entry; if (desc->mem_kind >= HFI_MEMKIND_MAX) { --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched.c:352 [MATCH: struct hfi_] --- kmem_cache_free(obj_cache, obj); hwsched->inflight--; } int adreno_hwsched_process_mem_alloc(struct adreno_device *adreno_dev, struct hfi_mem_alloc_desc *mad) { struct hfi_mem_alloc_entry *entry; entry = get_mem_alloc_entry(adreno_dev, mad); if (IS_ERR(entry)) return PTR_ERR(entry); if (entry->md) { mad->gpu_addr = entry->md->gpuaddr; mad->gmu_addr = entry->md->gmuaddr; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched.c:354 [MATCH: struct hfi_] --- } int adreno_hwsched_process_mem_alloc(struct adreno_device *adreno_dev, struct hfi_mem_alloc_desc *mad) { struct hfi_mem_alloc_entry *entry; entry = get_mem_alloc_entry(adreno_dev, mad); if (IS_ERR(entry)) return PTR_ERR(entry); if (entry->md) { mad->gpu_addr = entry->md->gpuaddr; mad->gmu_addr = entry->md->gmuaddr; } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched.c:374 [MATCH: struct hfi_] --- mad->host_mem_handle = mad->gmu_mem_handle; return 0; } static struct hfi_mem_alloc_entry *get_preempt_record_entry(struct adreno_device *adreno_dev, unsigned long flags) { struct adreno_hwsched *hwsched = &adreno_dev->hwsched; u32 mem_kind = flags & KGSL_CONTEXT_SECURE ? HFI_MEMKIND_CSW_PRIV_SECURE : HFI_MEMKIND_CSW_PRIV_NON_SECURE; u32 i; for (i = 0; i < hwsched->mem_alloc_entries; i++) { struct hfi_mem_alloc_entry *entry = &hwsched->mem_alloc_table[i]; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched.c:383 [MATCH: struct hfi_] --- u32 mem_kind = flags & KGSL_CONTEXT_SECURE ? HFI_MEMKIND_CSW_PRIV_SECURE : HFI_MEMKIND_CSW_PRIV_NON_SECURE; u32 i; for (i = 0; i < hwsched->mem_alloc_entries; i++) { struct hfi_mem_alloc_entry *entry = &hwsched->mem_alloc_table[i]; if (entry->desc.mem_kind == mem_kind) return entry; } return NULL; } static int adreno_hwsched_alloc_preempt_record_gmem(struct adreno_device *adreno_dev, struct adreno_context *drawctxt) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched.c:398 [MATCH: struct hfi_] --- struct adreno_context *drawctxt) { struct adreno_hwsched *hwsched = &adreno_dev->hwsched; struct kgsl_context *context = &drawctxt->base; struct kgsl_device *device = context->device; struct hfi_mem_alloc_entry *entry = NULL; struct kgsl_memdesc *pr_md, **md = NULL; u32 priv = 0, level = adreno_get_level(context); u64 curr_gmem_size = adreno_gmem_size(adreno_dev); u64 flags = 0; int ret = 0; if (context->flags & KGSL_CONTEXT_LPAC) return 0; if (!ADRENO_FEATURE(adreno_dev, ADRENO_PREEMPTION) || --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched.c:2146 [MATCH: struct hfi_] --- struct kgsl_drawobj *drawobj = NULL; struct kgsl_device *device = KGSL_DEVICE(adreno_dev); struct kgsl_context *context = NULL; struct cmd_list_obj *obj; struct adreno_hwsched *hwsched = &adreno_dev->hwsched; struct hfi_context_bad_cmd_legacy *cmd = hwsched->ctxt_bad; if (hwsched->recurring_cmdobj) srcu_notifier_call_chain(&device->nh, GPU_SSR_BEGIN, NULL); if (cmd->error == GMU_SYNCOBJ_TIMEOUT_ERROR) { print_fault_syncobj(adreno_dev, cmd->ctxt_id, cmd->ts); gmu_core_fault_snapshot(device, GMU_FAULT_PANIC_NONE); return; } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched.c:2226 [MATCH: struct hfi_] --- struct kgsl_context *context_lpac = NULL; struct cmd_list_obj *obj; struct cmd_list_obj *obj_lpac; const struct adreno_gpudev *gpudev = ADRENO_GPU_DEVICE(adreno_dev); struct adreno_hwsched *hwsched = &adreno_dev->hwsched; struct hfi_context_bad_cmd *cmd = hwsched->ctxt_bad; int ret = 0; bool ctx_guilty = false; if (hwsched->recurring_cmdobj) srcu_notifier_call_chain(&device->nh, GPU_SSR_BEGIN, NULL); /* Do not do soft reset for a IOMMU fault (because IOMMU hardware needs a reset too) */ if (fault & ADRENO_IOMMU_STALL_ON_PAGE_FAULT) adreno_dev->hwsched.reset_type = GMU_GPU_HARD_RESET; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched.c:2863 [MATCH: struct hfi_] --- int adreno_hwsched_ctxt_unregister_wait_completion( struct adreno_device *adreno_dev, struct device *dev, struct kgsl_context *context, struct pending_cmd *ack, void (*process_msgq)(struct adreno_device *adreno_dev), struct hfi_unregister_ctxt_cmd *cmd) { struct kgsl_device *device = KGSL_DEVICE(adreno_dev); const struct adreno_gpudev *gpudev = ADRENO_GPU_DEVICE(adreno_dev); struct adreno_context *drawctxt = ADRENO_CONTEXT(context); int rb = adreno_get_level(context); int ret; bool fast = adreno_is_fast_context_destroy_enabled(adreno_dev); u64 start, end; char prefix[60]; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched.c:2925 [MATCH: struct hfi_] --- return 0; } u32 adreno_hwsched_get_payload_rb_key_legacy(struct adreno_device *adreno_dev, u32 rb_id, u32 key) { struct hfi_context_bad_cmd_legacy *cmd = adreno_dev->hwsched.ctxt_bad; u32 i = 0, payload_bytes; void *start; if (!cmd->hdr) return 0; payload_bytes = (MSG_HDR_GET_SIZE(cmd->hdr) << 2) - offsetof(struct hfi_context_bad_cmd_legacy, payload); start = &cmd->payload[0]; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched.c:2933 [MATCH: struct hfi_] --- if (!cmd->hdr) return 0; payload_bytes = (MSG_HDR_GET_SIZE(cmd->hdr) << 2) - offsetof(struct hfi_context_bad_cmd_legacy, payload); start = &cmd->payload[0]; while (i < payload_bytes) { struct payload_section *payload = start + i; if (payload->type == PAYLOAD_RB) { u32 id = adreno_hwsched_parse_payload(payload, KEY_RB_ID); if (id == rb_id) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched.c:2955 [MATCH: struct hfi_] --- return 0; } u32 adreno_hwsched_get_payload_rb_key(struct adreno_device *adreno_dev, u32 rb_id, u32 key) { struct hfi_context_bad_cmd *cmd = adreno_dev->hwsched.ctxt_bad; u32 i = 0, payload_bytes; void *start; if (!cmd->hdr) return 0; payload_bytes = (MSG_HDR_GET_SIZE(cmd->hdr) << 2) - offsetof(struct hfi_context_bad_cmd, payload); start = &cmd->payload[0]; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched.c:2963 [MATCH: struct hfi_] --- if (!cmd->hdr) return 0; payload_bytes = (MSG_HDR_GET_SIZE(cmd->hdr) << 2) - offsetof(struct hfi_context_bad_cmd, payload); start = &cmd->payload[0]; while (i < payload_bytes) { struct payload_section *payload = start + i; if (payload->type == PAYLOAD_RB) { u32 id = adreno_hwsched_parse_payload(payload, KEY_RB_ID); if (id == rb_id) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched.c:3024 [MATCH: struct hfi_] --- } static void adreno_hwsched_lookup_key_value(struct adreno_device *adreno_dev, u32 type, u32 key, u32 *ptr, u32 num_values) { struct hfi_context_bad_cmd *cmd = adreno_dev->hwsched.ctxt_bad; u32 i = 0, payload_bytes; void *start; if (!cmd->hdr) return; payload_bytes = (MSG_HDR_GET_SIZE(cmd->hdr) << 2) - offsetof(struct hfi_context_bad_cmd, payload); start = &cmd->payload[0]; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched.c:3032 [MATCH: struct hfi_] --- if (!cmd->hdr) return; payload_bytes = (MSG_HDR_GET_SIZE(cmd->hdr) << 2) - offsetof(struct hfi_context_bad_cmd, payload); start = &cmd->payload[0]; while (i < payload_bytes) { struct payload_section *payload = start + i; /* key-value pair is 'num_values + 1' dwords */ if ((payload->type == type) && (payload->data[i] == key)) { u32 j = 1; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched.c:3102 [MATCH: struct hfi_] --- return non_fatal; } int adreno_hwsched_poll_msg_queue_write_index(struct kgsl_memdesc *hfi_mem) { struct hfi_queue_table *tbl = hfi_mem->hostptr; struct hfi_queue_header *hdr = &tbl->qhdr[HFI_MSG_ID]; unsigned long timeout = jiffies + msecs_to_jiffies(HFI_RSP_TIMEOUT); while (time_before(jiffies, timeout)) { if (hdr->write_index != hdr->read_index) goto done; /* Wait for up to 100 us before trying again */ usleep_range((POLL_SLEEP_US >> 2) + 1, POLL_SLEEP_US); cpu_relax(); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched.c:3319 [MATCH: struct hfi_] --- spin_unlock(&drawctxt->lock); } void adreno_hwsched_log_profiling_info(struct adreno_device *adreno_dev, u32 *rcvd) { struct hfi_ts_retire_cmd *cmd = (struct hfi_ts_retire_cmd *)rcvd; struct kgsl_context *context; struct retire_info info = {0}; struct kgsl_device *device = KGSL_DEVICE(adreno_dev); context = kgsl_context_get(device, cmd->ctxt_id); if (context == NULL) return; info.timestamp = cmd->ts; info.rb_id = adreno_get_level(context); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched.c:3381 [MATCH: struct hfi_] --- struct adreno_hwsched *hwsched = &adreno_dev->hwsched; struct kgsl_memdesc *md = NULL; u32 i; for (i = 0; i < hwsched->mem_alloc_entries; i++) { struct hfi_mem_alloc_desc *desc = &hwsched->mem_alloc_table[i].desc; if (desc->flags & HFI_MEMFLAG_HOST_INIT) { md = hwsched->mem_alloc_table[i].md; if (md->hostptr) memset(md->hostptr, 0x0, md->size); } } if (!(adreno_is_preemption_enabled(adreno_dev) && ADRENO_FEATURE(adreno_dev, ADRENO_DEFER_GMEM_ALLOC))) --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched.h:62 [MATCH: struct hfi_] --- /** * struct adreno_hw_fence_entry - A structure to store hardware fence and the context */ struct adreno_hw_fence_entry { /** @cmd: H2F_MSG_HW_FENCE_INFO packet for this hardware fence */ struct hfi_hw_fence_info cmd; /** @kfence: Pointer to the kgsl fence */ struct kgsl_sync_fence *kfence; /** @drawctxt: Pointer to the context */ struct adreno_context *drawctxt; /** @node: list node to add it to a list */ struct list_head node; /** @reset_node: list node to add it to post reset list of hardware fences */ struct list_head reset_node; }; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched.h:121 [MATCH: struct hfi_] --- /** * struct adreno_hwsched - Container for the hardware scheduler */ struct adreno_hwsched { /** @mem_alloc_table: Array of HFI memory allocation entries */ struct hfi_mem_alloc_entry mem_alloc_table[32]; /** @mem_alloc_entries: Number of entries in the memory allocation table */ u32 mem_alloc_entries; /** @mutex: Mutex needed to run dispatcher function */ struct mutex mutex; /** @flags: Container for the dispatcher internal flags */ unsigned long flags; /** @inflight: Number of active submissions to the dispatch queues */ u32 inflight; /** @jobs - Array of dispatch job lists for each priority level */ struct llist_head jobs[16]; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched.h:222 [MATCH: struct hfi_] --- * descriptor and updates the descriptor with the allocated memory addresses. * * Return: 0 on success, or a negative error code on failure. */ int adreno_hwsched_process_mem_alloc(struct adreno_device *adreno_dev, struct hfi_mem_alloc_desc *mad); /** * adreno_hwsched_start() - activate the hwsched dispatcher * @adreno_dev: pointer to the adreno device * * Enable dispatcher thread to execute */ void adreno_hwsched_start(struct adreno_device *adreno_dev); /** * adreno_hwsched_init() - Initialize the hwsched --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched_snapshot.c:123 [MATCH: struct hfi_] --- } bool adreno_hwsched_parse_payload_rb_legacy(struct adreno_device *adreno_dev, struct kgsl_snapshot *snapshot) { struct hfi_context_bad_cmd_legacy *cmd = adreno_dev->hwsched.ctxt_bad; u32 i = 0, payload_bytes; void *start; bool ret = false; /* Skip if we didn't receive a context bad HFI */ if (!cmd->hdr) return false; payload_bytes = (MSG_HDR_GET_SIZE(cmd->hdr) << 2) - offsetof(struct hfi_context_bad_cmd_legacy, payload); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched_snapshot.c:133 [MATCH: struct hfi_] --- /* Skip if we didn't receive a context bad HFI */ if (!cmd->hdr) return false; payload_bytes = (MSG_HDR_GET_SIZE(cmd->hdr) << 2) - offsetof(struct hfi_context_bad_cmd_legacy, payload); start = &cmd->payload[0]; while (i < payload_bytes) { struct payload_section *payload = start + i; if (payload->type == PAYLOAD_RB) { adreno_hwsched_snapshot_rb_payload(adreno_dev, snapshot, payload); ret = true; } --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched_snapshot.c:154 [MATCH: struct hfi_] --- } bool adreno_hwsched_parse_payload_rb(struct adreno_device *adreno_dev, struct kgsl_snapshot *snapshot) { struct hfi_context_bad_cmd *cmd = adreno_dev->hwsched.ctxt_bad; u32 i = 0, payload_bytes; void *start; bool ret = false; /* Skip if we didn't receive a context bad HFI */ if (!cmd->hdr) return false; payload_bytes = (MSG_HDR_GET_SIZE(cmd->hdr) << 2) - offsetof(struct hfi_context_bad_cmd, payload); --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched_snapshot.c:164 [MATCH: struct hfi_] --- /* Skip if we didn't receive a context bad HFI */ if (!cmd->hdr) return false; payload_bytes = (MSG_HDR_GET_SIZE(cmd->hdr) << 2) - offsetof(struct hfi_context_bad_cmd, payload); start = &cmd->payload[0]; while (i < payload_bytes) { struct payload_section *payload = start + i; if (payload->type == PAYLOAD_RB) { adreno_hwsched_snapshot_rb_payload(adreno_dev, snapshot, payload); ret = true; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_rpmh.c:248 [MATCH: struct hfi_] --- } return -EINVAL; } void adreno_rpmh_build_bw_table_cmd(struct hfi_bwtable_cmd *cmd, struct rpmh_bw_votes *ddr, struct rpmh_bw_votes *cnoc) { u32 i, j; cmd->bw_level_num = ddr->num_levels; cmd->ddr_cmds_num = ddr->num_cmds; cmd->ddr_wait_bitmask = ddr->wait_bitmask; for (i = 0; i < ddr->num_cmds; i++) cmd->ddr_cmd_addrs[i] = ddr->addrs[i]; --- C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_rpmh.h:120 [MATCH: struct hfi_] --- * adreno_rpmh_build_bw_table_cmd - Build bandwidth table command * @cmd: Pointer to the hfi_bwtable_cmd structure