SWEETGPU A618 — SOURCE GAP AUDIT
Files: 458
Generated: 2026-11-26T21:18:16

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\a5xx_reg.h =====
L31: #define A5XX_INT_CP_CACHE_FLUSH_TS       20
  #define A5XX_INT_CP_WT_DONE_TS           18
  #define A5XX_INT_UNKNOWN_1               19
  #define A5XX_INT_UNUSED_2                21
  #define A5XX_INT_RBBM_ATB_BUS_OVERFLOW   22
L40: #define A5XX_INT_GPMU_FIRMWARE           29
  #define A5XX_INT_DEBBUS_INTR_1           27
  #define A5XX_INT_GPMU_VOLTAGE_DROOP      28
  #define A5XX_INT_ISDB_CPU_IRQ            30
  #define A5XX_INT_ISDB_UNDER_DEBUG        31
L90: #define A5XX_CP_CONTEXT_SWITCH_CNTL      0x83B
  #define A5XX_CP_PM4_INSTR_BASE_LO        0x838
  #define A5XX_CP_PM4_INSTR_BASE_HI        0x839
  #define A5XX_CP_CONTEXT_SWITCH_RESTORE_ADDR_LO   0x83C
  #define A5XX_CP_CONTEXT_SWITCH_RESTORE_ADDR_HI   0x83D
L91: #define A5XX_CP_CONTEXT_SWITCH_RESTORE_ADDR_LO   0x83C
  #define A5XX_CP_PM4_INSTR_BASE_HI        0x839
  #define A5XX_CP_CONTEXT_SWITCH_CNTL      0x83B
  #define A5XX_CP_CONTEXT_SWITCH_RESTORE_ADDR_HI   0x83D
  #define A5XX_CP_CONTEXT_SWITCH_SAVE_ADDR_LO   0x83E
L92: #define A5XX_CP_CONTEXT_SWITCH_RESTORE_ADDR_HI   0x83D
  #define A5XX_CP_CONTEXT_SWITCH_CNTL      0x83B
  #define A5XX_CP_CONTEXT_SWITCH_RESTORE_ADDR_LO   0x83C
  #define A5XX_CP_CONTEXT_SWITCH_SAVE_ADDR_LO   0x83E
  #define A5XX_CP_CONTEXT_SWITCH_SAVE_ADDR_HI   0x83F
L93: #define A5XX_CP_CONTEXT_SWITCH_SAVE_ADDR_LO   0x83E
  #define A5XX_CP_CONTEXT_SWITCH_RESTORE_ADDR_LO   0x83C
  #define A5XX_CP_CONTEXT_SWITCH_RESTORE_ADDR_HI   0x83D
  #define A5XX_CP_CONTEXT_SWITCH_SAVE_ADDR_HI   0x83F
  #define A5XX_CP_CONTEXT_SWITCH_SMMU_INFO_LO   0x840
L94: #define A5XX_CP_CONTEXT_SWITCH_SAVE_ADDR_HI   0x83F
  #define A5XX_CP_CONTEXT_SWITCH_RESTORE_ADDR_HI   0x83D
  #define A5XX_CP_CONTEXT_SWITCH_SAVE_ADDR_LO   0x83E
  #define A5XX_CP_CONTEXT_SWITCH_SMMU_INFO_LO   0x840
  #define A5XX_CP_CONTEXT_SWITCH_SMMU_INFO_HI   0x841
L95: #define A5XX_CP_CONTEXT_SWITCH_SMMU_INFO_LO   0x840
  #define A5XX_CP_CONTEXT_SWITCH_SAVE_ADDR_LO   0x83E
  #define A5XX_CP_CONTEXT_SWITCH_SAVE_ADDR_HI   0x83F
  #define A5XX_CP_CONTEXT_SWITCH_SMMU_INFO_HI   0x841
  #define A5XX_CP_ADDR_MODE_CNTL           0x860
L96: #define A5XX_CP_CONTEXT_SWITCH_SMMU_INFO_HI   0x841
  #define A5XX_CP_CONTEXT_SWITCH_SAVE_ADDR_HI   0x83F
  #define A5XX_CP_CONTEXT_SWITCH_SMMU_INFO_LO   0x840
  #define A5XX_CP_ADDR_MODE_CNTL           0x860
  #define A5XX_CP_ME_STAT_DATA             0xB14

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\a6xx_reg.h =====
L25: #define A6XX_INT_CP_CACHE_FLUSH_TS      20
  #define A6XX_INT_CP_RB_DONE_TS          17
  #define A6XX_INT_CP_WT_DONE_TS          18
  #define A6XX_INT_RBBM_ATB_BUS_OVERFLOW  22
  #define A6XX_INT_RBBM_HANG_DETECT       23
L53: #define A6XX_CP_SQE_CNTL                 0x808
  #define A6XX_CP_RB_RPTR                  0x806
  #define A6XX_CP_RB_WPTR                  0x807
  #define A6XX_CP_CP2GMU_STATUS            0x812
  #define A6XX_CP_HW_FAULT                 0x821
L54: #define A6XX_CP_CP2GMU_STATUS            0x812
  #define A6XX_CP_RB_WPTR                  0x807
  #define A6XX_CP_SQE_CNTL                 0x808
  #define A6XX_CP_HW_FAULT                 0x821
  #define A6XX_CP_INTERRUPT_STATUS         0x823
L59: #define A6XX_CP_SQE_INSTR_BASE_LO        0x830
  #define A6XX_CP_PROTECT_STATUS           0x824
  #define A6XX_CP_STATUS_1                 0x825
  #define A6XX_CP_SQE_INSTR_BASE_HI        0x831
  #define A6XX_CP_MISC_CNTL                0x840
L60: #define A6XX_CP_SQE_INSTR_BASE_HI        0x831
  #define A6XX_CP_STATUS_1                 0x825
  #define A6XX_CP_SQE_INSTR_BASE_LO        0x830
  #define A6XX_CP_MISC_CNTL                0x840
  #define A6XX_CP_APRIV_CNTL               0X844
L71: #define A6XX_CP_CONTEXT_SWITCH_CNTL      0x8A0
  #define A6XX_CP_PROTECT_CNTL             0x84F
  #define A6XX_CP_PROTECT_REG              0x850
  #define A6XX_CP_CONTEXT_SWITCH_SMMU_INFO_LO   0x8A1
  #define A6XX_CP_CONTEXT_SWITCH_SMMU_INFO_HI   0x8A2
L72: #define A6XX_CP_CONTEXT_SWITCH_SMMU_INFO_LO   0x8A1
  #define A6XX_CP_PROTECT_REG              0x850
  #define A6XX_CP_CONTEXT_SWITCH_CNTL      0x8A0
  #define A6XX_CP_CONTEXT_SWITCH_SMMU_INFO_HI   0x8A2
  #define A6XX_CP_CONTEXT_SWITCH_PRIV_NON_SECURE_RESTORE_ADDR_LO   0x8A3
L73: #define A6XX_CP_CONTEXT_SWITCH_SMMU_INFO_HI   0x8A2
  #define A6XX_CP_CONTEXT_SWITCH_CNTL      0x8A0
  #define A6XX_CP_CONTEXT_SWITCH_SMMU_INFO_LO   0x8A1
  #define A6XX_CP_CONTEXT_SWITCH_PRIV_NON_SECURE_RESTORE_ADDR_LO   0x8A3
  #define A6XX_CP_CONTEXT_SWITCH_PRIV_NON_SECURE_RESTORE_ADDR_HI   0x8A4
L74: #define A6XX_CP_CONTEXT_SWITCH_PRIV_NON_SECURE_RESTORE_ADDR_LO   0x8A3
  #define A6XX_CP_CONTEXT_SWITCH_SMMU_INFO_LO   0x8A1
  #define A6XX_CP_CONTEXT_SWITCH_SMMU_INFO_HI   0x8A2
  #define A6XX_CP_CONTEXT_SWITCH_PRIV_NON_SECURE_RESTORE_ADDR_HI   0x8A4
  #define A6XX_CP_CONTEXT_SWITCH_PRIV_SECURE_RESTORE_ADDR_LO   0x8A5
L75: #define A6XX_CP_CONTEXT_SWITCH_PRIV_NON_SECURE_RESTORE_ADDR_HI   0x8A4
  #define A6XX_CP_CONTEXT_SWITCH_SMMU_INFO_HI   0x8A2
  #define A6XX_CP_CONTEXT_SWITCH_PRIV_NON_SECURE_RESTORE_ADDR_LO   0x8A3
  #define A6XX_CP_CONTEXT_SWITCH_PRIV_SECURE_RESTORE_ADDR_LO   0x8A5
  #define A6XX_CP_CONTEXT_SWITCH_PRIV_SECURE_RESTORE_ADDR_HI   0x8A6
L76: #define A6XX_CP_CONTEXT_SWITCH_PRIV_SECURE_RESTORE_ADDR_LO   0x8A5
  #define A6XX_CP_CONTEXT_SWITCH_PRIV_NON_SECURE_RESTORE_ADDR_LO   0x8A3
  #define A6XX_CP_CONTEXT_SWITCH_PRIV_NON_SECURE_RESTORE_ADDR_HI   0x8A4
  #define A6XX_CP_CONTEXT_SWITCH_PRIV_SECURE_RESTORE_ADDR_HI   0x8A6
  #define A6XX_CP_CONTEXT_SWITCH_NON_PRIV_RESTORE_ADDR_LO   0x8A7
L77: #define A6XX_CP_CONTEXT_SWITCH_PRIV_SECURE_RESTORE_ADDR_HI   0x8A6
  #define A6XX_CP_CONTEXT_SWITCH_PRIV_NON_SECURE_RESTORE_ADDR_HI   0x8A4
  #define A6XX_CP_CONTEXT_SWITCH_PRIV_SECURE_RESTORE_ADDR_LO   0x8A5
  #define A6XX_CP_CONTEXT_SWITCH_NON_PRIV_RESTORE_ADDR_LO   0x8A7
  #define A6XX_CP_CONTEXT_SWITCH_NON_PRIV_RESTORE_ADDR_HI   0x8A8
L78: #define A6XX_CP_CONTEXT_SWITCH_NON_PRIV_RESTORE_ADDR_LO   0x8A7
  #define A6XX_CP_CONTEXT_SWITCH_PRIV_SECURE_RESTORE_ADDR_LO   0x8A5
  #define A6XX_CP_CONTEXT_SWITCH_PRIV_SECURE_RESTORE_ADDR_HI   0x8A6
  #define A6XX_CP_CONTEXT_SWITCH_NON_PRIV_RESTORE_ADDR_HI   0x8A8
  #define A6XX_CP_CONTEXT_SWITCH_LEVEL_STATUS 0x8AB
L79: #define A6XX_CP_CONTEXT_SWITCH_NON_PRIV_RESTORE_ADDR_HI   0x8A8
  #define A6XX_CP_CONTEXT_SWITCH_PRIV_SECURE_RESTORE_ADDR_HI   0x8A6
  #define A6XX_CP_CONTEXT_SWITCH_NON_PRIV_RESTORE_ADDR_LO   0x8A7
  #define A6XX_CP_CONTEXT_SWITCH_LEVEL_STATUS 0x8AB
  #define A6XX_CP_PERFCTR_CP_SEL_0         0x8D0
L80: #define A6XX_CP_CONTEXT_SWITCH_LEVEL_STATUS 0x8AB
  #define A6XX_CP_CONTEXT_SWITCH_NON_PRIV_RESTORE_ADDR_LO   0x8A7
  #define A6XX_CP_CONTEXT_SWITCH_NON_PRIV_RESTORE_ADDR_HI   0x8A8
  #define A6XX_CP_PERFCTR_CP_SEL_0         0x8D0
  #define A6XX_CP_PERFCTR_CP_SEL_1         0x8D1
L99: #define A6XX_CP_SQE_STAT_ADDR            0x908
  #define A6XX_CP_CRASH_DUMP_CNTL          0x902
  #define A6XX_CP_CRASH_DUMP_STATUS        0x903
  #define A6XX_CP_SQE_STAT_DATA            0x909
  #define A6XX_CP_DRAW_STATE_ADDR          0x90A
L100: #define A6XX_CP_SQE_STAT_DATA            0x909
  #define A6XX_CP_CRASH_DUMP_STATUS        0x903
  #define A6XX_CP_SQE_STAT_ADDR            0x908
  #define A6XX_CP_DRAW_STATE_ADDR          0x90A
  #define A6XX_CP_DRAW_STATE_DATA          0x90B
L107: #define A6XX_CP_SQE_UCODE_DBG_ADDR       0x910
  #define A6XX_CP_MEM_POOL_DBG_ADDR        0x90E
  #define A6XX_CP_MEM_POOL_DBG_DATA        0x90F
  #define A6XX_CP_SQE_UCODE_DBG_DATA       0x911
  #define A6XX_CP_IB1_BASE                 0x928
L108: #define A6XX_CP_SQE_UCODE_DBG_DATA       0x911
  #define A6XX_CP_MEM_POOL_DBG_DATA        0x90F
  #define A6XX_CP_SQE_UCODE_DBG_ADDR       0x910
  #define A6XX_CP_IB1_BASE                 0x928
  #define A6XX_CP_IB1_BASE_HI              0x929
L128: #define A6XX_CP_SQE_AC_UCODE_DBG_ADDR    0xB27
  #define A6XX_CP_LPAC_DRAW_STATE_DATA     0xB0B
  #define A6XX_CP_LPAC_ROQ_DBG_ADDR        0xB0C
  #define A6XX_CP_SQE_AC_UCODE_DBG_DATA    0xB28
  #define A6XX_CP_SQE_AC_STAT_ADDR         0xB29
L129: #define A6XX_CP_SQE_AC_UCODE_DBG_DATA    0xB28
  #define A6XX_CP_LPAC_ROQ_DBG_ADDR        0xB0C
  #define A6XX_CP_SQE_AC_UCODE_DBG_ADDR    0xB27
  #define A6XX_CP_SQE_AC_STAT_ADDR         0xB29
  #define A6XX_CP_SQE_AC_STAT_DATA         0xB2A
L130: #define A6XX_CP_SQE_AC_STAT_ADDR         0xB29
  #define A6XX_CP_SQE_AC_UCODE_DBG_ADDR    0xB27
  #define A6XX_CP_SQE_AC_UCODE_DBG_DATA    0xB28
  #define A6XX_CP_SQE_AC_STAT_DATA         0xB2A
  #define A6XX_CP_LPAC_ROQ_THRESHOLDS_1    0xB32
L131: #define A6XX_CP_SQE_AC_STAT_DATA         0xB2A
  #define A6XX_CP_SQE_AC_UCODE_DBG_DATA    0xB28
  #define A6XX_CP_SQE_AC_STAT_ADDR         0xB29
  #define A6XX_CP_LPAC_ROQ_THRESHOLDS_1    0xB32
  #define A6XX_CP_LPAC_ROQ_THRESHOLDS_2    0xB33
L543: #define A6XX_RBBM_CLOCK_CNTL_GMU_GX      0x00118
  #define A6XX_RBBM_CLOCK_HYST_GPC         0x00116
  #define A6XX_RBBM_CLOCK_DELAY_HLSQ_2	 0x00117
  #define A6XX_RBBM_CLOCK_DELAY_GMU_GX     0x00119
  #define A6XX_RBBM_CLOCK_CNTL_TEX_FCHE    0x00120
L544: #define A6XX_RBBM_CLOCK_DELAY_GMU_GX     0x00119
  #define A6XX_RBBM_CLOCK_DELAY_HLSQ_2	 0x00117
  #define A6XX_RBBM_CLOCK_CNTL_GMU_GX      0x00118
  #define A6XX_RBBM_CLOCK_CNTL_TEX_FCHE    0x00120
  #define A6XX_RBBM_CLOCK_DELAY_TEX_FCHE   0x00121
L548: #define A6XX_RBBM_CLOCK_HYST_GMU_GX      0x0011a
  #define A6XX_RBBM_CLOCK_DELAY_TEX_FCHE   0x00121
  #define A6XX_RBBM_CLOCK_HYST_TEX_FCHE    0x00122
  #define A6XX_RBBM_CLOCK_MODE_HLSQ	 0x0011b
  #define A6XX_RBBM_CLOCK_DELAY_HLSQ       0x0011c
L562: #define A6XX_GMUAO_GMU_CGC_MODE_CNTL     0x23b09
  #define A6XX_RBBM_CLOCK_CNTL_GLC         0x0012b
  
  #define A6XX_GMUAO_GMU_CGC_DELAY_CNTL    0x23b0a
  #define A6XX_GMUAO_GMU_CGC_HYST_CNTL     0x23b0b
L563: #define A6XX_GMUAO_GMU_CGC_DELAY_CNTL    0x23b0a
  
  #define A6XX_GMUAO_GMU_CGC_MODE_CNTL     0x23b09
  #define A6XX_GMUAO_GMU_CGC_HYST_CNTL     0x23b0b
  #define A6XX_GMUCX_GMU_WFI_CONFIG        0x1f802
L564: #define A6XX_GMUAO_GMU_CGC_HYST_CNTL     0x23b0b
  #define A6XX_GMUAO_GMU_CGC_MODE_CNTL     0x23b09
  #define A6XX_GMUAO_GMU_CGC_DELAY_CNTL    0x23b0a
  #define A6XX_GMUCX_GMU_WFI_CONFIG        0x1f802
  #define A6XX_GMUGX_GMU_SP_RF_CONTROL_0   0x1a883
L565: #define A6XX_GMUCX_GMU_WFI_CONFIG        0x1f802
  #define A6XX_GMUAO_GMU_CGC_DELAY_CNTL    0x23b0a
  #define A6XX_GMUAO_GMU_CGC_HYST_CNTL     0x23b0b
  #define A6XX_GMUGX_GMU_SP_RF_CONTROL_0   0x1a883
  #define A6XX_GMUGX_GMU_SP_RF_CONTROL_1   0x1a884

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno.c =====
L9: #include <linux/firmware.h>
  #include <linux/delay.h>
  #include <linux/devfreq.h>
  #include <linux/input.h>
  #include <linux/interconnect.h>
L42: #include "kgsl_gmu_core.h"
  #include "adreno_trace.h"
  #include "kgsl_bus.h"
  #include "kgsl_power_trace.h"
  #include "kgsl_reclaim.h"
L76: /** @ctxt_record_size: Size of preemption record in KB */
  */
  u32 hw_version;
  u32 ctxt_record_size;
  /** aqe_size: Size of AQE in preemption record in KB */
L78: /** aqe_size: Size of AQE in preemption record in KB */
  /** @ctxt_record_size: Size of preemption record in KB */
  u32 ctxt_record_size;
  u32 aqe_size;
  } __packed;
L106: static bool adreno_preemption_enable;
  
  static struct adreno_device device_3d0;
  static u32 kgsl_gpu_sku_override = U32_MAX;
  static u32 kgsl_gpu_speed_bin_override = U32_MAX;
L132: struct kgsl_memdesc *memdesc = ADRENO_FW(adreno_dev, ADRENO_FW_SQE)->memdesc;
  int adreno_populate_ctxt_record_size(struct adreno_device *adreno_dev)
  {
  struct ctxt_record_info *info;
  u32 *hostptr;
L143: * SQE firmware inserts context record magic at offset 5.
  
  /*
  * The pointer to context record table is stored at offset 6.
  * The values are stored at [23:0].
L189: const struct firmware **fw;
  struct adreno_fw_work {
  struct work_struct work;
  const char *name;
  struct device *device;
L200: fw_work->ret = firmware_request_nowarn(fw_work->fw, fw_work->name, fw_work->device);
  container_of(work, struct adreno_fw_work, work);
  
  }
  
L211: * Dispatch firmware_request_nowarn() to a workqueue thread rather than calling
  
  /*
  * it directly. When the GPU device is first opened, request_firmware() would
  * otherwise be called from within the path_openat() call chain
L212: * it directly. When the GPU device is first opened, request_firmware() would
  /*
  * Dispatch firmware_request_nowarn() to a workqueue thread rather than calling
  * otherwise be called from within the path_openat() call chain
  * (open -> kgsl_open -> ... -> adreno_request_firmware). The kernel tracks
L214: * (open -> kgsl_open -> ... -> adreno_request_firmware). The kernel tracks
  * it directly. When the GPU device is first opened, request_firmware() would
  * otherwise be called from within the path_openat() call chain
  * symlink traversal depth in current->nameidata->total_link_count, which is
  * never reset between nested path_openat() calls. With multiple firmware files,
L216: * never reset between nested path_openat() calls. With multiple firmware files,
  * (open -> kgsl_open -> ... -> adreno_request_firmware). The kernel tracks
  * symlink traversal depth in current->nameidata->total_link_count, which is
  * compressed variants, and symlinks in the firmware search paths (e.g.
  * /lib -> /usr/lib), total_link_count can reach MAXSYMLINKS (40), causing
L217: * compressed variants, and symlinks in the firmware search paths (e.g.
  * symlink traversal depth in current->nameidata->total_link_count, which is
  * never reset between nested path_openat() calls. With multiple firmware files,
  * /lib -> /usr/lib), total_link_count can reach MAXSYMLINKS (40), causing
  * request_firmware() to fail with -ELOOP. A workqueue thread has
L219: * request_firmware() to fail with -ELOOP. A workqueue thread has
  * compressed variants, and symlinks in the firmware search paths (e.g.
  * /lib -> /usr/lib), total_link_count can reach MAXSYMLINKS (40), causing
  * current->nameidata == NULL, so total_link_count is reset for every lookup.
  */
L222: int adreno_request_firmware(const struct firmware **fw, const char *name,
  * current->nameidata == NULL, so total_link_count is reset for every lookup.
  */
  struct device *device, bool log_error)
  {
L243: dev_err(device, "Firmware request for %s failed with error %d\n",
  ret = adreno_fw_dispatch(&work);
  if (ret && log_error)
  name, ret);
  kfree(work.name);
L253: int adreno_get_firmware(struct adreno_device *adreno_dev,
  }
  
  const char *fwfile, struct adreno_firmware *firmware)
  {
L254: const char *fwfile, struct adreno_firmware *firmware)
  
  int adreno_get_firmware(struct adreno_device *adreno_dev,
  {
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
L257: const struct firmware *fw = NULL;
  {
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
  int ret;
  
L260: if (!IS_ERR_OR_NULL(firmware->memdesc))
  int ret;
  
  return 0;
  
L263: ret = adreno_request_firmware(&fw, fwfile, &device->pdev->dev, true);
  return 0;
  
  
  if (ret)
L268: firmware->memdesc = kgsl_allocate_global(device, fw->size - 4, 0,
  return ret;
  
  KGSL_MEMFLAGS_GPUREADONLY, KGSL_MEMDESC_UCODE,
  "ucode");
L272: ret = PTR_ERR_OR_ZERO(firmware->memdesc);
  "ucode");
  
  if (!ret) {
  memcpy(firmware->memdesc->hostptr, &fw->data[4], fw->size - 4);
L274: memcpy(firmware->memdesc->hostptr, &fw->data[4], fw->size - 4);
  ret = PTR_ERR_OR_ZERO(firmware->memdesc);
  if (!ret) {
  firmware->size = (fw->size - 4) / sizeof(u32);
  firmware->version = get_ucode_version((u32 *)fw->data);
L275: firmware->size = (fw->size - 4) / sizeof(u32);
  if (!ret) {
  memcpy(firmware->memdesc->hostptr, &fw->data[4], fw->size - 4);
  firmware->version = get_ucode_version((u32 *)fw->data);
  }
L276: firmware->version = get_ucode_version((u32 *)fw->data);
  memcpy(firmware->memdesc->hostptr, &fw->data[4], fw->size - 4);
  firmware->size = (fw->size - 4) / sizeof(u32);
  }
  
L279: release_firmware(fw);
  }
  
  return ret;
  }
L306: const char *firmware_name = NULL;
  struct device_node *np, *mem_np;
  struct device *dev = &device->pdev->dev;
  const struct firmware *fw;
  void *mem_region = NULL;
L307: const struct firmware *fw;
  struct device *dev = &device->pdev->dev;
  const char *firmware_name = NULL;
  void *mem_region = NULL;
  phys_addr_t mem_phys;

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno.h =====
L9: #include <linux/firmware.h>
  #define __ADRENO_H
  
  #include <linux/iopoll.h>
  #include <linux/of.h>
L19: #include "adreno_ringbuffer.h"
  #include "adreno_perfcounter.h"
  #include "adreno_profile.h"
  #include "kgsl_sharedmem.h"
  
L22: /* Used to point CP to the SMMU record during preemption */
  #include "kgsl_sharedmem.h"
  
  #define SET_PSEUDO_SMMU_INFO 0
  /* Used to inform CP where to save preemption data at the time of switch out */
L23: #define SET_PSEUDO_SMMU_INFO 0
  
  /* Used to point CP to the SMMU record during preemption */
  /* Used to inform CP where to save preemption data at the time of switch out */
  #define SET_PSEUDO_PRIV_NON_SECURE_SAVE_ADDR 1
L24: /* Used to inform CP where to save preemption data at the time of switch out */
  /* Used to point CP to the SMMU record during preemption */
  #define SET_PSEUDO_SMMU_INFO 0
  #define SET_PSEUDO_PRIV_NON_SECURE_SAVE_ADDR 1
  /* Used to inform CP where to save secure preemption data at the time of switch out */
L26: /* Used to inform CP where to save secure preemption data at the time of switch out */
  /* Used to inform CP where to save preemption data at the time of switch out */
  #define SET_PSEUDO_PRIV_NON_SECURE_SAVE_ADDR 1
  #define SET_PSEUDO_PRIV_SECURE_SAVE_ADDR 2
  /* Used to inform CP where to save per context non-secure data at the time of switch out */
L30: /* Used to inform CP where to save preemption counter data at the time of switch out */
  /* Used to inform CP where to save per context non-secure data at the time of switch out */
  #define SET_PSEUDO_NON_PRIV_SAVE_ADDR 3
  #define SET_PSEUDO_COUNTER 4
  
L33: /* Index to preemption scratch buffer to store current QOS value */
  #define SET_PSEUDO_COUNTER 4
  
  #define QOS_VALUE_IDX KGSL_PRIORITY_MAX_RB_LEVELS
  
L64: #define ADRENO_GMU_CHIPID(_id) \
  #define ADRENO_CHIPID_PATCH(_id) FIELD_GET(GENMASK(7, 0), _id)
  
  (FIELD_PREP(GENMASK(31, 24), ADRENO_CHIPID_CORE(_id)) | \
  FIELD_PREP(GENMASK(23, 16), ADRENO_CHIPID_MAJOR(_id)) | \
L74: #define ADRENO_GMU_REV(_rev) \
  #define ADRENO_REV_PATCH(_rev) FIELD_GET(GENMASK(7, 0), _rev)
  
  (FIELD_PREP(GENMASK(31, 24), ADRENO_REV_MAJOR(_rev)) | \
  FIELD_PREP(GENMASK(23, 16), ADRENO_REV_MINOR(_rev)) | \
L83: * Disable local interrupts and CPU preemption to avoid interruptions
  
  /*
  * while holding the CP semaphore; otherwise, it could stall the CP.
  * Make sure to call ADRENO_RELEASE_CP_SEMAPHORE after calling the
L140: /* The GPU supports preemption */
  /* The GPU supports content protection */
  #define ADRENO_CONTENT_PROTECTION BIT(1)
  #define ADRENO_PREEMPTION BIT(2)
  /* The GPMU supports Limits Management */
L141: #define ADRENO_PREEMPTION BIT(2)
  #define ADRENO_CONTENT_PROTECTION BIT(1)
  /* The GPU supports preemption */
  /* The GPMU supports Limits Management */
  #define ADRENO_LM BIT(3)
L148: /* The GMU supports IFPC power management*/
  /* The core has soft fault detection available */
  #define ADRENO_SOFT_FAULT_DETECT BIT(5)
  #define ADRENO_IFPC BIT(6)
  /* The core supports IO-coherent memory */
L153: * The GMU supports Adaptive Clock Distribution (ACD)
  #define ADRENO_IOCOHERENT BIT(7)
  /*
  * for droop mitigation
  */
L157: /* Cooperative reset enabled GMU */
  */
  #define ADRENO_ACD BIT(8)
  #define ADRENO_COOP_RESET BIT(9)
  /* Indicates that the specific target is no longer supported */
L161: /* The target supports ringbuffer level APRIV */
  /* Indicates that the specific target is no longer supported */
  #define ADRENO_DEPRECATED BIT(10)
  #define ADRENO_APRIV BIT(11)
  /* The GMU supports Battery Current Limiting */
L163: /* The GMU supports Battery Current Limiting */
  /* The target supports ringbuffer level APRIV */
  #define ADRENO_APRIV BIT(11)
  #define ADRENO_BCL BIT(12)
  /* L3 voting is supported with L3 constraints */
L169: /* Late Stage Reprojection (LSR) enablment for GMU */
  /* LPAC is supported  */
  #define ADRENO_LPAC BIT(14)
  #define ADRENO_LSR BIT(15)
  /* GMU and kernel supports hardware fences */
L171: /* GMU and kernel supports hardware fences */
  /* Late Stage Reprojection (LSR) enablment for GMU */
  #define ADRENO_LSR BIT(15)
  #define ADRENO_HW_FENCE BIT(16)
  /* Dynamic Mode Switching supported on this target */
L178: #define ADRENO_GMU_WARMBOOT BIT(19)
  #define ADRENO_AQE BIT(18)
  /* Warm Boot supported on this target */
  /* The GPU supports CLX */
  #define ADRENO_CLX BIT(20)
L181: /* Enable GMU support for GMU based thermal mitigation */
  /* The GPU supports CLX */
  #define ADRENO_CLX BIT(20)
  #define ADRENO_GMU_THERMAL_MITIGATION BIT(21)
  /* GMU Based DCVS */
L182: #define ADRENO_GMU_THERMAL_MITIGATION BIT(21)
  #define ADRENO_CLX BIT(20)
  /* Enable GMU support for GMU based thermal mitigation */
  /* GMU Based DCVS */
  #define ADRENO_GMU_BASED_DCVS BIT(22)
L183: /* GMU Based DCVS */
  /* Enable GMU support for GMU based thermal mitigation */
  #define ADRENO_GMU_THERMAL_MITIGATION BIT(21)
  #define ADRENO_GMU_BASED_DCVS BIT(22)
  /* RT hint feature for RB0 workloads */
L184: #define ADRENO_GMU_BASED_DCVS BIT(22)
  #define ADRENO_GMU_THERMAL_MITIGATION BIT(21)
  /* GMU Based DCVS */
  /* RT hint feature for RB0 workloads */
  #define ADRENO_RT_HINT BIT(23)
L187: /* Defer allocation of preemption record gmem memory when needed */
  /* RT hint feature for RB0 workloads */
  #define ADRENO_RT_HINT BIT(23)
  #define ADRENO_DEFER_GMEM_ALLOC BIT(24)
  /* The GMU supports MINBW voting */
L189: /* The GMU supports MINBW voting */
  /* Defer allocation of preemption record gmem memory when needed */
  #define ADRENO_DEFER_GMEM_ALLOC BIT(24)
  #define ADRENO_GMU_MINBW BIT(25)
  /* Enable GMU Based DCVS profile */
L190: #define ADRENO_GMU_MINBW BIT(25)
  #define ADRENO_DEFER_GMEM_ALLOC BIT(24)
  /* The GMU supports MINBW voting */
  /* Enable GMU Based DCVS profile */
  #define ADRENO_DCVS_PROFILE BIT(26)
L191: /* Enable GMU Based DCVS profile */
  /* The GMU supports MINBW voting */
  #define ADRENO_GMU_MINBW BIT(25)
  #define ADRENO_DCVS_PROFILE BIT(26)
  /* Enable TSENSE power savings during sleep */
L195: /* Enable GMU Based AB voting */
  /* Enable TSENSE power savings during sleep */
  #define ADRENO_TSENSE_DYNAMIC_PERIOD BIT(27)
  #define ADRENO_GMU_AB BIT(28)
  /* Enable GMU Fast Context Destroy optimization */

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_a5xx.c =====
L9: #include <linux/firmware.h>
  #include <linux/clk/qcom.h>
  #include <linux/delay.h>
  #include <linux/of.h>
  #include <linux/of_device.h>
L14: #include <linux/firmware/qcom/qcom_scm_addon.h>
  #include <linux/version.h>
  #if IS_ENABLED(CONFIG_QCOM_SCM_ADDON)
  #endif
  #include <linux/slab.h>
L43: * Number of times to check if the GPMU firmware is initialized before
  
  /**
  * giving up and returning failure.
  */
L60: (1 << A5XX_INT_CP_CACHE_FLUSH_TS) |		\
  (1 << A5XX_INT_RBBM_GPC_ERROR) |		\
  (1 << A5XX_INT_CP_HW_ERROR) |	\
  (1 << A5XX_INT_RBBM_ATB_BUS_OVERFLOW) |	\
  (1 << A5XX_INT_MISC_HANG_DETECT) |		\
L66: (1 << A5XX_INT_GPMU_FIRMWARE) |                \
  (1 << A5XX_INT_UCHE_TRAP_INTR) |		\
  (1 << A5XX_INT_CP_SW) |			\
  (1 << A5XX_INT_GPMU_VOLTAGE_DROOP))
  
L187: ret = a5xx_ringbuffer_init(adreno_dev);
  int ret;
  
  if (ret)
  return ret;
L237: /* A5XX_CP_PROTECT_REG_17 will be used for SMMU */
  /* UCHE */
  {  A5XX_CP_PROTECT_REG_0 + 16, 0xe80, 4 },
  /* A5XX_CP_PROTECT_REG_18 - A5XX_CP_PROTECT_REG_31 are available */
  };
L264: * For a530 and a540 the SMMU region is 0x20000 bytes long and 0x10000
  
  /*
  * bytes on all other targets. The base offset for both is 0x40000.
  * Write it to the next available slot
L438: /* GPMU firmware is supposed to turn off SPTP & RAC GDSCs. */
  } else if (test_bit(ADRENO_DEVICE_GPMU_INITIALIZED,
  &adreno_dev->priv)) {
  kgsl_regread(device, A5XX_GPMU_SP_PWR_CLK_STATUS, &reg);
  if (reg & BIT(20))
L446: * GPMU firmware is supposed to set GMEM to non-retention.
  dev_warn(device->dev, "RBCCU GDSC is not disabled\n");
  /*
  * Bit 14 is the memory core force on bit.
  */
L518: * the GPMU firmware
  /*
  * Prebuild the cmd stream to send to the GPU to load
  */
  while (size > 0) {
L547: * _load_gpmu_firmware() - Load the ucode into the GPMU RAM
  
  /*
  * @adreno_dev: Pointer to adreno device
  */
L550: static int _load_gpmu_firmware(struct adreno_device *adreno_dev)
  * @adreno_dev: Pointer to adreno device
  */
  {
  uint32_t *data;
L553: const struct firmware *fw = NULL;
  {
  uint32_t *data;
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
  const struct adreno_a5xx_core *a5xx_core = to_a5xx_core(adreno_dev);
L558: u32 gmu_major = 1;
  uint32_t *cmds, cmd_size;
  int ret =  -EINVAL;
  
  if (!a5xx_has_gpmu(adreno_dev))
L563: /* a530 used GMU major 1 and A540 used GMU major 3 */
  return 0;
  
  if (adreno_is_a540(adreno_dev))
  gmu_major = 3;
L565: gmu_major = 3;
  /* a530 used GMU major 1 and A540 used GMU major 3 */
  if (adreno_is_a540(adreno_dev))
  
  /* gpmu fw already saved and verified so do nothing new */
L574: ret = adreno_request_firmware(&fw, a5xx_core->gpmufw_name,
  return 0;
  
  &device->pdev->dev, true);
  if (ret || fw == NULL)
L584: if (data[1] != GPMU_FIRMWARE_ID)
  goto err;
  
  goto err;
  ret = _read_fw2_block_header(device, &data[2],
L587: data[0] - 2, GPMU_FIRMWARE_ID, gmu_major, 0);
  goto err;
  ret = _read_fw2_block_header(device, &data[2],
  if (ret)
  goto err;
L600: "GPMU firmware block size is larger than RAM size\n");
  if (cmd_size > GPMU_INST_RAM_SIZE) {
  dev_err(device->dev,
  goto err;
  }
L608: release_firmware(fw);
  err:
  if (fw)
  
  return ret;
L643: struct adreno_ringbuffer *rb = adreno_dev->cur_rb;
  static int _gpmu_send_init_cmds(struct adreno_device *adreno_dev)
  {
  uint32_t *cmds;
  uint32_t size = adreno_dev->gpmu_cmds_size;
L651: cmds = adreno_ringbuffer_allocspace(rb, size);
  return -EINVAL;
  
  if (IS_ERR(cmds))
  return PTR_ERR(cmds);
L660: ret = a5xx_ringbuffer_submit(rb, NULL, true);
  memcpy(cmds, adreno_dev->gpmu_cmds, size << 2);
  
  if (!ret) {
  ret = adreno_spin_idle(adreno_dev, 2000);
L694: /* Kick off GPMU firmware */
  kgsl_regwrite(device, A5XX_GPMU_WFI_CONFIG, 0x00004014);
  }
  kgsl_regwrite(device, A5XX_GPMU_CM3_SYSRESET, 0);
  /*
L697: * The hardware team's estimation of GPMU firmware initialization
  kgsl_regwrite(device, A5XX_GPMU_CM3_SYSRESET, 0);
  /*
  * latency is about 3000 cycles, that's about 5 to 24 usec.
  */
L707: "GPMU firmware initialization timed out\n");
  if (reg != 0xBABEFACE) {
  dev_err(device->dev,
  return -ETIMEDOUT;
  }
L716: "GPMU firmware initialization failed: %d\n",
  if (reg) {
  dev_err(device->dev,
  reg);
  return -EIO;
L735: 1 << A5XX_INT_GPMU_FIRMWARE);
  kgsl_regwrite(device,
  A5XX_RBBM_INT_CLEAR_CMD,
  return ret;
  }

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_a5xx.h =====
L32: * Use the 'firmware-name' device tree property instead.
  /**
  * @zap_name: Specifies the name of the CPZ zap file. This field is deprecated.
  */
  const char *zap_name;
L46: /* Size of each CP preemption record */
  
  #define A5XX_CP_CTXRECORD_MAGIC_REF     0x27C4BAFCUL
  #define A5XX_CP_CTXRECORD_SIZE_IN_BYTES     0x10000
  /* Size of the preemption counter block (in bytes) */
L48: /* Size of the preemption counter block (in bytes) */
  /* Size of each CP preemption record */
  #define A5XX_CP_CTXRECORD_SIZE_IN_BYTES     0x10000
  #define A5XX_CP_CTXRECORD_PREEMPTION_COUNTER_SIZE   (16 * 4)
  
L49: #define A5XX_CP_CTXRECORD_PREEMPTION_COUNTER_SIZE   (16 * 4)
  #define A5XX_CP_CTXRECORD_SIZE_IN_BYTES     0x10000
  /* Size of the preemption counter block (in bytes) */
  
  /**
L52: * struct a5xx_cp_preemption_record - CP context record for
  
  /**
  * preemption.
  * @magic: (00) Value at this offset must be equal to
L53: * preemption.
  /**
  * struct a5xx_cp_preemption_record - CP context record for
  * @magic: (00) Value at this offset must be equal to
  * A5XX_CP_CTXRECORD_MAGIC_REF.
L57: * we must set to zero for all ringbuffers.
  * A5XX_CP_CTXRECORD_MAGIC_REF.
  * @info: (04) Type of record. Written non-zero (usually) by CP.
  * @data: (08) DATA field in SET_RENDER_MODE or checkpoint packets.
  * Written by CP when switching out. Not used on switch-in.
L66: * counter: (40) Pointer to preemption counter
  * @rptr_addr: (24) RB_RPTR_ADDR_LO|HI saved and restored.
  * rbase: (32) RB_BASE_LO|HI saved and restored.
  */
  struct a5xx_cp_preemption_record {
L68: struct a5xx_cp_preemption_record {
  * counter: (40) Pointer to preemption counter
  */
  uint32_t  magic;
  uint32_t  info;
L80: #define A5XX_CP_SMMU_INFO_MAGIC_REF     0x3618CDA3UL
  };
  
  
  /**
L83: * struct a5xx_cp_smmu_info - CP preemption SMMU info.
  
  /**
  * @magic: (00) The value at this offset must be equal to
  * A5XX_CP_SMMU_INFO_MAGIC_REF.
L85: * A5XX_CP_SMMU_INFO_MAGIC_REF.
  * struct a5xx_cp_smmu_info - CP preemption SMMU info.
  * @magic: (00) The value at this offset must be equal to
  * @_pad4: (04) Reserved/padding
  * @ttbr0: (08) Base address of the page table for the
L91: struct a5xx_cp_smmu_info {
  * @context_idr: (16) Context Identification Register value.
  */
  uint32_t  magic;
  uint32_t  _pad4;
L190: #define GPMU_FIRMWARE_ID		2
  #define LM_DCVS_LIMIT			1
  /* FW file tages */
  #define GPMU_SEQUENCE_ID		3
  #define GPMU_INST_RAM_SIZE		0xFFF
L225: /* Preemption functions */
  }
  
  void a5xx_preemption_trigger(struct adreno_device *adreno_dev);
  void a5xx_preemption_schedule(struct adreno_device *adreno_dev);
L226: void a5xx_preemption_trigger(struct adreno_device *adreno_dev);
  
  /* Preemption functions */
  void a5xx_preemption_schedule(struct adreno_device *adreno_dev);
  void a5xx_preemption_start(struct adreno_device *adreno_dev);
L227: void a5xx_preemption_schedule(struct adreno_device *adreno_dev);
  /* Preemption functions */
  void a5xx_preemption_trigger(struct adreno_device *adreno_dev);
  void a5xx_preemption_start(struct adreno_device *adreno_dev);
  int a5xx_preemption_init(struct adreno_device *adreno_dev);
L228: void a5xx_preemption_start(struct adreno_device *adreno_dev);
  void a5xx_preemption_trigger(struct adreno_device *adreno_dev);
  void a5xx_preemption_schedule(struct adreno_device *adreno_dev);
  int a5xx_preemption_init(struct adreno_device *adreno_dev);
  
L229: int a5xx_preemption_init(struct adreno_device *adreno_dev);
  void a5xx_preemption_schedule(struct adreno_device *adreno_dev);
  void a5xx_preemption_start(struct adreno_device *adreno_dev);
  
  /**
L232: * a5xx_preemption_post_ibsubmit - Insert commands following a submission
  
  /**
  * @adreno_dev: Adreno GPU handle
  * @cmds: Pointer to the ringbuffer to insert opcodes
L234: * @cmds: Pointer to the ringbuffer to insert opcodes
  * a5xx_preemption_post_ibsubmit - Insert commands following a submission
  * @adreno_dev: Adreno GPU handle
  *
  * Return: The number of opcodes written to @cmds
L238: u32 a5xx_preemption_post_ibsubmit(struct adreno_device *adreno_dev, u32 *cmds);
  * Return: The number of opcodes written to @cmds
  */
  
  /**
L241: * a5xx_preemption_post_ibsubmit - Insert opcodes before a submission
  
  /**
  * @adreno_dev: Adreno GPU handle
  * @rb: The ringbuffer being written
L243: * @rb: The ringbuffer being written
  * a5xx_preemption_post_ibsubmit - Insert opcodes before a submission
  * @adreno_dev: Adreno GPU handle
  * @drawctxt: The draw context being written
  * @cmds: Pointer to the ringbuffer to insert opcodes
L245: * @cmds: Pointer to the ringbuffer to insert opcodes
  * @rb: The ringbuffer being written
  * @drawctxt: The draw context being written
  *
  * Return: The number of opcodes written to @cmds
L249: u32 a5xx_preemption_pre_ibsubmit(struct adreno_device *adreno_dev,
  * Return: The number of opcodes written to @cmds
  */
  struct adreno_ringbuffer *rb, struct adreno_context *drawctxt,
  u32 *cmds);
L250: struct adreno_ringbuffer *rb, struct adreno_context *drawctxt,
  */
  u32 a5xx_preemption_pre_ibsubmit(struct adreno_device *adreno_dev,
  u32 *cmds);
  
L260: * a5xx_ringbuffer_init - Initialize the ringbuffers
  
  /**
  * @adreno_dev: An Adreno GPU handle
  *
L263: * Initialize the ringbuffer(s) for a5xx.
  * @adreno_dev: An Adreno GPU handle
  *
  * Return: 0 on success or negative on failure
  */
L266: int a5xx_ringbuffer_init(struct adreno_device *adreno_dev);
  * Return: 0 on success or negative on failure
  */
  
  /**

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_a5xx_packets.h =====
L535: 0x00000030, /* [0x01FF] A5X_HLSQ_CONTEXT_SWITCH_CS_SW_3_CTX_0 (0xE7DC)*/
  0x00000001, /* [0x01FD] A5X_SP_CS_CONFIG_CTX_0 (0xE589)*/
  0x40E7DC01, /* [0x01FE] == TYPE4 == */
  0x48E7DD01, /* [0x0200] == TYPE4 == */
  0x00000002, /* [0x0201] A5X_HLSQ_CONTEXT_SWITCH_CS_SW_4_CTX_0 (0xE7DD)*/
L537: 0x00000002, /* [0x0201] A5X_HLSQ_CONTEXT_SWITCH_CS_SW_4_CTX_0 (0xE7DD)*/
  0x00000030, /* [0x01FF] A5X_HLSQ_CONTEXT_SWITCH_CS_SW_3_CTX_0 (0xE7DC)*/
  0x48E7DD01, /* [0x0200] == TYPE4 == */
  0x40E7B001, /* [0x0202] == TYPE4 == */
  0x00000003, /* [0x0203] A5X_HLSQ_CS_NDRANGE_0_CTX_0 (0xE7B0)*/

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_a5xx_perfcounter.c =====
L70: struct adreno_ringbuffer *rb = &adreno_dev->ringbuffers[0];
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
  struct adreno_perfcount_register *reg = &group->regs[counter];
  u32 cmds[3];
  int ret;
L83: ret = a5xx_ringbuffer_addcmds(adreno_dev, rb, NULL,
  
  /* submit to highest priority RB always */
  F_NOTPROTECTED, cmds, 3, 0, NULL);
  
L98: ret = adreno_ringbuffer_waittimestamp(rb, rb->timestamp,
  
  /* wait for the above commands submitted to complete */
  ADRENO_IDLE_TIMEOUT);
  

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_a5xx_preempt.c =====
L14: offsetof(struct a5xx_cp_preemption_record, _field)
  
  #define PREEMPT_RECORD(_field) \
  
  #define PREEMPT_SMMU_RECORD(_field) \
L16: #define PREEMPT_SMMU_RECORD(_field) \
  offsetof(struct a5xx_cp_preemption_record, _field)
  
  offsetof(struct a5xx_cp_smmu_info, _field)
  
L17: offsetof(struct a5xx_cp_smmu_info, _field)
  
  #define PREEMPT_SMMU_RECORD(_field) \
  
  static void _update_wptr(struct adreno_device *adreno_dev, bool reset_timer)
L22: struct adreno_ringbuffer *rb = adreno_dev->cur_rb;
  {
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
  unsigned int wptr;
  unsigned long flags;
L33: * In case something got submitted while preemption was on
  kgsl_regwrite(device, A5XX_CP_RB_WPTR, rb->wptr);
  /*
  * going, reset the timer.
  */
L46: static void _a5xx_preemption_done(struct adreno_device *adreno_dev)
  }
  
  {
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
L59: kgsl_regread(device, A5XX_CP_CONTEXT_SWITCH_CNTL, &status);
  return;
  
  
  if (status != 0) {
L63: "Preemption not complete: status=%X cur=%d R/W=%X/%X next=%d R/W=%X/%X\n",
  if (status != 0) {
  dev_err(device->dev,
  status, adreno_dev->cur_rb->id,
  adreno_get_rptr(adreno_dev->cur_rb),
L97: static void _a5xx_preemption_fault(struct adreno_device *adreno_dev)
  }
  
  {
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
L103: * If the power is on check the preemption status one more time - if it
  
  /*
  * was successful then just transition to the complete state
  */
L107: kgsl_regread(device, A5XX_CP_CONTEXT_SWITCH_CNTL, &status);
  */
  if (kgsl_state_is_awake(device)) {
  
  if (status == 0) {
L119: "Preemption timed out: cur=%d R/W=%X/%X, next=%d R/W=%X/%X\n",
  
  dev_err(device->dev,
  adreno_dev->cur_rb->id,
  adreno_get_rptr(adreno_dev->cur_rb),
L130: static void _a5xx_preemption_worker(struct work_struct *work)
  }
  
  {
  struct adreno_preemption *preempt = container_of(work,
L132: struct adreno_preemption *preempt = container_of(work,
  static void _a5xx_preemption_worker(struct work_struct *work)
  {
  struct adreno_preemption, work);
  struct adreno_device *adreno_dev = container_of(preempt,
L133: struct adreno_preemption, work);
  {
  struct adreno_preemption *preempt = container_of(work,
  struct adreno_device *adreno_dev = container_of(preempt,
  struct adreno_device, preempt);
L142: _a5xx_preemption_fault(adreno_dev);
  
  if (adreno_in_preempt_state(adreno_dev, ADRENO_PREEMPT_FAULTED))
  
  kgsl_mutex_unlock(&device->mutex);
L147: /* Find the highest priority active ringbuffer */
  }
  
  static struct adreno_ringbuffer *a5xx_next_ringbuffer(
  struct adreno_device *adreno_dev)
L148: static struct adreno_ringbuffer *a5xx_next_ringbuffer(
  
  /* Find the highest priority active ringbuffer */
  struct adreno_device *adreno_dev)
  {
L151: struct adreno_ringbuffer *rb;
  struct adreno_device *adreno_dev)
  {
  unsigned long flags;
  unsigned int i;
L155: FOR_EACH_RINGBUFFER(adreno_dev, rb, i) {
  unsigned int i;
  
  bool empty;
  
L169: void a5xx_preemption_trigger(struct adreno_device *adreno_dev)
  }
  
  {
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
L172: struct kgsl_iommu *iommu = KGSL_IOMMU(device);
  {
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
  struct adreno_ringbuffer *next;
  uint64_t ttbr0;
L173: struct adreno_ringbuffer *next;
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
  struct kgsl_iommu *iommu = KGSL_IOMMU(device);
  uint64_t ttbr0;
  unsigned int contextidr;
L183: /* Get the next ringbuffer to preempt in */
  return;
  
  next = a5xx_next_ringbuffer(adreno_dev);
  
L184: next = a5xx_next_ringbuffer(adreno_dev);
  
  /* Get the next ringbuffer to preempt in */
  
  /*
L187: * Nothing to do if every ringbuffer is empty or if the current
  
  /*
  * ringbuffer is the only active one
  */
L188: * ringbuffer is the only active one
  /*
  * Nothing to do if every ringbuffer is empty or if the current
  */
  if (next == NULL || next == adreno_dev->cur_rb) {
L193: * we were looking for a new ringbuffer
  /*
  * Update any critical things that might have been skipped while
  */
  
L223: kgsl_sharedmem_writel(next->preemption_desc,
  SCRATCH_RB_OFFSET(next->id, contextidr));
  
  PREEMPT_RECORD(wptr), next->wptr);
  
L228: /* And write it to the smmu info */
  spin_unlock_irqrestore(&next->preempt_lock, flags);
  
  if (kgsl_mmu_is_perprocess(&device->mmu)) {
  kgsl_sharedmem_writeq(iommu->smmu_info,

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_a5xx_ringbuffer.c =====
L10: #include "adreno_ringbuffer.h"
  #include "adreno_a5xx.h"
  #include "adreno_pm4types.h"
  #include "adreno_trace.h"
  #include "kgsl_trace.h"
L16: struct adreno_ringbuffer *rb,
  static int a5xx_rb_pagetable_switch(struct kgsl_device *device,
  struct adreno_context *drawctxt,
  struct kgsl_pagetable *pagetable, u32 *cmds)
  {
L25: cmds[0] = cp_type7_packet(CP_SMMU_TABLE_UPDATE, 3);
  return 0;
  
  cmds[1] = lower_32_bits(ttbr0);
  cmds[2] = upper_32_bits(ttbr0);
L52: #define RB_SOPTIMESTAMP(device, rb) \
  }
  
  MEMSTORE_RB_GPU_ADDR(device, rb, soptimestamp)
  #define CTXT_SOPTIMESTAMP(device, drawctxt) \
L53: MEMSTORE_RB_GPU_ADDR(device, rb, soptimestamp)
  
  #define RB_SOPTIMESTAMP(device, rb) \
  #define CTXT_SOPTIMESTAMP(device, drawctxt) \
  MEMSTORE_ID_GPU_ADDR(device, (drawctxt)->base.id, soptimestamp)
L54: #define CTXT_SOPTIMESTAMP(device, drawctxt) \
  #define RB_SOPTIMESTAMP(device, rb) \
  MEMSTORE_RB_GPU_ADDR(device, rb, soptimestamp)
  MEMSTORE_ID_GPU_ADDR(device, (drawctxt)->base.id, soptimestamp)
  
L55: MEMSTORE_ID_GPU_ADDR(device, (drawctxt)->base.id, soptimestamp)
  MEMSTORE_RB_GPU_ADDR(device, rb, soptimestamp)
  #define CTXT_SOPTIMESTAMP(device, drawctxt) \
  
  #define RB_EOPTIMESTAMP(device, rb) \
L57: #define RB_EOPTIMESTAMP(device, rb) \
  MEMSTORE_ID_GPU_ADDR(device, (drawctxt)->base.id, soptimestamp)
  
  MEMSTORE_RB_GPU_ADDR(device, rb, eoptimestamp)
  #define CTXT_EOPTIMESTAMP(device, drawctxt) \
L58: MEMSTORE_RB_GPU_ADDR(device, rb, eoptimestamp)
  
  #define RB_EOPTIMESTAMP(device, rb) \
  #define CTXT_EOPTIMESTAMP(device, drawctxt) \
  MEMSTORE_ID_GPU_ADDR(device, (drawctxt)->base.id, eoptimestamp)
L59: #define CTXT_EOPTIMESTAMP(device, drawctxt) \
  #define RB_EOPTIMESTAMP(device, rb) \
  MEMSTORE_RB_GPU_ADDR(device, rb, eoptimestamp)
  MEMSTORE_ID_GPU_ADDR(device, (drawctxt)->base.id, eoptimestamp)
  
L60: MEMSTORE_ID_GPU_ADDR(device, (drawctxt)->base.id, eoptimestamp)
  MEMSTORE_RB_GPU_ADDR(device, rb, eoptimestamp)
  #define CTXT_EOPTIMESTAMP(device, drawctxt) \
  
  int a5xx_ringbuffer_submit(struct adreno_ringbuffer *rb,
L62: int a5xx_ringbuffer_submit(struct adreno_ringbuffer *rb,
  MEMSTORE_ID_GPU_ADDR(device, (drawctxt)->base.id, eoptimestamp)
  
  struct adreno_submit_time *time, bool sync)
  {
L73: u32 *cmds = adreno_ringbuffer_allocspace(rb, 3);
  
  if (sync) {
  
  if (IS_ERR(cmds))
L97: int a5xx_ringbuffer_init(struct adreno_device *adreno_dev)
  }
  
  {
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
L110: adreno_dev->cur_rb = &(adreno_dev->ringbuffers[0]);
  return PTR_ERR(device->scratch);
  
  
  if (!adreno_preemption_feature_set(adreno_dev)) {
L112: if (!adreno_preemption_feature_set(adreno_dev)) {
  adreno_dev->cur_rb = &(adreno_dev->ringbuffers[0]);
  
  adreno_dev->num_ringbuffers = 1;
  return adreno_ringbuffer_setup(adreno_dev,
L113: adreno_dev->num_ringbuffers = 1;
  
  if (!adreno_preemption_feature_set(adreno_dev)) {
  return adreno_ringbuffer_setup(adreno_dev,
  &adreno_dev->ringbuffers[0], 0);
L114: return adreno_ringbuffer_setup(adreno_dev,
  if (!adreno_preemption_feature_set(adreno_dev)) {
  adreno_dev->num_ringbuffers = 1;
  &adreno_dev->ringbuffers[0], 0);
  }
L115: &adreno_dev->ringbuffers[0], 0);
  adreno_dev->num_ringbuffers = 1;
  return adreno_ringbuffer_setup(adreno_dev,
  }
  
L118: adreno_dev->num_ringbuffers = ARRAY_SIZE(adreno_dev->ringbuffers);
  }
  
  
  for (i = 0; i < adreno_dev->num_ringbuffers; i++) {
L120: for (i = 0; i < adreno_dev->num_ringbuffers; i++) {
  adreno_dev->num_ringbuffers = ARRAY_SIZE(adreno_dev->ringbuffers);
  
  int ret;
  
L123: ret = adreno_ringbuffer_setup(adreno_dev,
  int ret;
  
  &adreno_dev->ringbuffers[i], i);
  if (ret)
L124: &adreno_dev->ringbuffers[i], i);
  
  ret = adreno_ringbuffer_setup(adreno_dev,
  if (ret)
  return ret;
L129: timer_setup(&adreno_dev->preempt.timer, adreno_preemption_timer, 0);
  }
  
  a5xx_preemption_init(adreno_dev);
  return 0;
L130: a5xx_preemption_init(adreno_dev);
  
  timer_setup(&adreno_dev->preempt.timer, adreno_preemption_timer, 0);
  return 0;
  }
L136: int a5xx_ringbuffer_addcmds(struct adreno_device *adreno_dev,
  #define A5XX_SUBMIT_MAX 64
  
  struct adreno_ringbuffer *rb, struct adreno_context *drawctxt,
  u32 flags, u32 *in, u32 dwords, u32 timestamp,
L137: struct adreno_ringbuffer *rb, struct adreno_context *drawctxt,
  
  int a5xx_ringbuffer_addcmds(struct adreno_device *adreno_dev,
  u32 flags, u32 *in, u32 dwords, u32 timestamp,
  struct adreno_submit_time *time)
L138: u32 flags, u32 *in, u32 dwords, u32 timestamp,
  int a5xx_ringbuffer_addcmds(struct adreno_device *adreno_dev,
  struct adreno_ringbuffer *rb, struct adreno_context *drawctxt,
  struct adreno_submit_time *time)
  {
L154: rb->timestamp++;
  return -EPROTO;
  
  
  if (drawctxt)
L157: drawctxt->internal_timestamp = rb->timestamp;
  
  if (drawctxt)
  
  cmds = adreno_ringbuffer_allocspace(rb, size);

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_a5xx_snapshot.c =====
L130: struct adreno_firmware *fw = ADRENO_FW(adreno_dev, ADRENO_FW_PM4);
  struct kgsl_snapshot_debug *header = (struct kgsl_snapshot_debug *)buf;
  unsigned int *data = (unsigned int *)(buf + sizeof(*header));
  size_t size = fw->size;
  
L153: struct adreno_firmware *fw = ADRENO_FW(adreno_dev, ADRENO_FW_PFP);
  struct kgsl_snapshot_debug *header = (struct kgsl_snapshot_debug *)buf;
  unsigned int *data = (unsigned int *)(buf + sizeof(*header));
  int size = fw->size;
  
L737: /* IF the SMMU is stalled we cannot do a crash dump */
  return;
  
  if (adreno_smmu_is_stalled(ADRENO_DEVICE(device)))
  return;
L738: if (adreno_smmu_is_stalled(ADRENO_DEVICE(device)))
  
  /* IF the SMMU is stalled we cannot do a crash dump */
  return;
  
L1010: /* Preemption record */
  a5xx_snapshot_shader(device, snapshot);
  
  adreno_snapshot_preemption_record(device, snapshot);
  }
L1011: adreno_snapshot_preemption_record(device, snapshot);
  
  /* Preemption record */
  }
  

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_a6xx.c =====
L24: #include "kgsl_gmu_core.h"
  #include "adreno_pm4types.h"
  #include "adreno_trace.h"
  #include "kgsl_trace.h"
  #include "kgsl_util.h"
L28: /* IFPC & Preemption static powerup restore list */
  #include "kgsl_util.h"
  
  static u32 a6xx_pwrup_reglist[] = {
  A6XX_VSC_ADDR_MODE_CNTL,
L57: A6XX_RB_CONTEXT_SWITCH_GMEM_SAVE_RESTORE,
  A6XX_SP_NC_MODE_CNTL,
  A6XX_PC_DBG_ECO_CNTL,
  A6XX_UCHE_GBIF_GX_CONFIG,
  A6XX_UCHE_CLIENT_PF,
L146: if (!gmu_core_isenabled(device))
  kgsl_regwrite(device, offset, value);
  
  return 0;
  
L150: for (i = 0; i < GMU_CORE_LONG_WAKEUP_RETRY_LIMIT; i++) {
  
  ts1 = a6xx_read_alwayson(adreno_dev);
  /*
  * Make sure the previous register write is posted before
L157: kgsl_regread(device, A6XX_GMU_AHB_FENCE_STATUS, &status);
  mb();
  
  
  /*
L167: udelay(GMU_CORE_WAKEUP_DELAY_US);
  
  /* Wait a small amount of time before trying again */
  
  /* Try to write the fenced register again */
L173: if (i < GMU_CORE_SHORT_WAKEUP_RETRY_LIMIT)
  }
  
  return 0;
  
L176: if (i == GMU_CORE_LONG_WAKEUP_RETRY_LIMIT) {
  return 0;
  
  ts2 = a6xx_read_alwayson(adreno_dev);
  dev_err(adreno_dev->dev.dev,
L179: "Timed out waiting %d usecs to write fenced register 0x%x, timestamps: %llx %llx\n",
  ts2 = a6xx_read_alwayson(adreno_dev);
  dev_err(adreno_dev->dev.dev,
  i * GMU_CORE_WAKEUP_DELAY_US, offset, ts1, ts2);
  return -ETIMEDOUT;
L180: i * GMU_CORE_WAKEUP_DELAY_US, offset, ts1, ts2);
  dev_err(adreno_dev->dev.dev,
  "Timed out waiting %d usecs to write fenced register 0x%x, timestamps: %llx %llx\n",
  return -ETIMEDOUT;
  }
L186: i * GMU_CORE_WAKEUP_DELAY_US, offset);
  dev_err(adreno_dev->dev.dev,
  "Waited %d usecs to write fenced register 0x%x\n",
  
  return 0;
L270: static int a6xx_nogmu_init(struct adreno_device *adreno_dev)
  }
  
  {
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
L275: ret = a6xx_ringbuffer_init(adreno_dev);
  int ret;
  
  if (ret)
  return ret;
L283: /* Try to map the GMU wrapper region if applicable */
  return ret;
  
  ret = kgsl_regmap_add_region(&device->regmap, device->pdev,
  "gmu_wrapper", -EINVAL, NULL, NULL);
L285: "gmu_wrapper", -EINVAL, NULL, NULL);
  /* Try to map the GMU wrapper region if applicable */
  ret = kgsl_regmap_add_region(&device->regmap, device->pdev,
  if (ret && ret != -ENODEV)
  dev_err(device->dev, "Couldn't map the GMU wrapper registers\n");
L287: dev_err(device->dev, "Couldn't map the GMU wrapper registers\n");
  "gmu_wrapper", -EINVAL, NULL, NULL);
  if (ret && ret != -ENODEV)
  
  adreno_create_profile_buffer(adreno_dev);
L339: __get_gmu_ao_cgc_mode_cntl(struct adreno_device *adreno_dev)
  
  static inline unsigned int
  {
  if (adreno_is_a612(adreno_dev))
L356: __get_gmu_ao_cgc_delay_cntl(struct adreno_device *adreno_dev)
  
  static inline unsigned int
  {
  if (adreno_is_a612(adreno_dev))
L367: __get_gmu_ao_cgc_hyst_cntl(struct adreno_device *adreno_dev)
  
  static inline unsigned int
  {
  if (adreno_is_a612(adreno_dev))
L377: static unsigned int __get_gmu_wfi_config(struct adreno_device *adreno_dev)
  }
  
  {
  unsigned int rev = ADRENO_GPUREV(adreno_dev);
L392: kgsl_regread(device, A6XX_GPU_GMU_GX_SPTPRAC_CLOCK_CONTROL, &val);
  u32 val = 0;
  
  val &= ~1;
  kgsl_regwrite(device, A6XX_GPU_GMU_GX_SPTPRAC_CLOCK_CONTROL,
L394: kgsl_regwrite(device, A6XX_GPU_GMU_GX_SPTPRAC_CLOCK_CONTROL,
  kgsl_regread(device, A6XX_GPU_GMU_GX_SPTPRAC_CLOCK_CONTROL, &val);
  val &= ~1;
  val | (enable ? 1 : 0));
  }
L408: if (gmu_core_isenabled(device)) {
  on = false;
  
  gmu_core_regwrite(device, A6XX_GPU_GMU_AO_GMU_CGC_MODE_CNTL,
  on ? __get_gmu_ao_cgc_mode_cntl(adreno_dev) : 0);
L409: gmu_core_regwrite(device, A6XX_GPU_GMU_AO_GMU_CGC_MODE_CNTL,
  
  if (gmu_core_isenabled(device)) {
  on ? __get_gmu_ao_cgc_mode_cntl(adreno_dev) : 0);
  gmu_core_regwrite(device, A6XX_GPU_GMU_AO_GMU_CGC_DELAY_CNTL,
L410: on ? __get_gmu_ao_cgc_mode_cntl(adreno_dev) : 0);
  if (gmu_core_isenabled(device)) {
  gmu_core_regwrite(device, A6XX_GPU_GMU_AO_GMU_CGC_MODE_CNTL,
  gmu_core_regwrite(device, A6XX_GPU_GMU_AO_GMU_CGC_DELAY_CNTL,
  on ? __get_gmu_ao_cgc_delay_cntl(adreno_dev) : 0);
L411: gmu_core_regwrite(device, A6XX_GPU_GMU_AO_GMU_CGC_DELAY_CNTL,
  gmu_core_regwrite(device, A6XX_GPU_GMU_AO_GMU_CGC_MODE_CNTL,
  on ? __get_gmu_ao_cgc_mode_cntl(adreno_dev) : 0);
  on ? __get_gmu_ao_cgc_delay_cntl(adreno_dev) : 0);
  gmu_core_regwrite(device, A6XX_GPU_GMU_AO_GMU_CGC_HYST_CNTL,
L412: on ? __get_gmu_ao_cgc_delay_cntl(adreno_dev) : 0);
  on ? __get_gmu_ao_cgc_mode_cntl(adreno_dev) : 0);
  gmu_core_regwrite(device, A6XX_GPU_GMU_AO_GMU_CGC_DELAY_CNTL,
  gmu_core_regwrite(device, A6XX_GPU_GMU_AO_GMU_CGC_HYST_CNTL,
  on ? __get_gmu_ao_cgc_hyst_cntl(adreno_dev) : 0);
L413: gmu_core_regwrite(device, A6XX_GPU_GMU_AO_GMU_CGC_HYST_CNTL,
  gmu_core_regwrite(device, A6XX_GPU_GMU_AO_GMU_CGC_DELAY_CNTL,
  on ? __get_gmu_ao_cgc_delay_cntl(adreno_dev) : 0);
  on ? __get_gmu_ao_cgc_hyst_cntl(adreno_dev) : 0);
  gmu_core_regwrite(device, A6XX_GMU_CX_GMU_WFI_CONFIG,
L414: on ? __get_gmu_ao_cgc_hyst_cntl(adreno_dev) : 0);
  on ? __get_gmu_ao_cgc_delay_cntl(adreno_dev) : 0);
  gmu_core_regwrite(device, A6XX_GPU_GMU_AO_GMU_CGC_HYST_CNTL,
  gmu_core_regwrite(device, A6XX_GMU_CX_GMU_WFI_CONFIG,
  on ? __get_gmu_wfi_config(adreno_dev) : 0);

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_a6xx.h =====
L13: #include "adreno_a6xx_gmu.h"
  
  #include "a6xx_reg.h"
  #include "adreno_a6xx_rgmu.h"
  
L14: #include "adreno_a6xx_rgmu.h"
  #include "a6xx_reg.h"
  #include "adreno_a6xx_gmu.h"
  
  extern const struct adreno_power_ops a6xx_gmu_power_ops;
L16: extern const struct adreno_power_ops a6xx_gmu_power_ops;
  #include "adreno_a6xx_rgmu.h"
  
  extern const struct adreno_power_ops a6xx_rgmu_power_ops;
  extern const struct adreno_power_ops a630_gmu_power_ops;
L17: extern const struct adreno_power_ops a6xx_rgmu_power_ops;
  
  extern const struct adreno_power_ops a6xx_gmu_power_ops;
  extern const struct adreno_power_ops a630_gmu_power_ops;
  extern const struct adreno_power_ops a6xx_hwsched_power_ops;
L18: extern const struct adreno_power_ops a630_gmu_power_ops;
  extern const struct adreno_power_ops a6xx_gmu_power_ops;
  extern const struct adreno_power_ops a6xx_rgmu_power_ops;
  extern const struct adreno_power_ops a6xx_hwsched_power_ops;
  
L23: int (*hfi_probe)(struct adreno_device *adreno_dev);
  struct a6xx_gpudev {
  struct adreno_gpudev base;
  void (*hfi_remove)(struct adreno_device *adreno_dev);
  void (*handle_watchdog)(struct adreno_device *adreno_dev);
L24: void (*hfi_remove)(struct adreno_device *adreno_dev);
  struct adreno_gpudev base;
  int (*hfi_probe)(struct adreno_device *adreno_dev);
  void (*handle_watchdog)(struct adreno_device *adreno_dev);
  };
L29: extern const struct a6xx_gpudev adreno_a6xx_gmu_gpudev;
  
  extern const struct a6xx_gpudev adreno_a630_gpudev;
  extern const struct a6xx_gpudev adreno_a6xx_hwsched_gpudev;
  
L36: /** @gmu: Container for the a6xx GMU device */
  */
  struct a6xx_device {
  struct a6xx_gmu_device gmu;
  /** @rgmu: Container for the a6xx rGMU device */
L37: struct a6xx_gmu_device gmu;
  struct a6xx_device {
  /** @gmu: Container for the a6xx GMU device */
  /** @rgmu: Container for the a6xx rGMU device */
  struct a6xx_rgmu_device rgmu;
L38: /** @rgmu: Container for the a6xx rGMU device */
  /** @gmu: Container for the a6xx GMU device */
  struct a6xx_gmu_device gmu;
  struct a6xx_rgmu_device rgmu;
  /** @adreno_dev: Container for the generic adreno device */
L39: struct a6xx_rgmu_device rgmu;
  struct a6xx_gmu_device gmu;
  /** @rgmu: Container for the a6xx rGMU device */
  /** @adreno_dev: Container for the generic adreno device */
  struct adreno_device adreno_dev;
L50: /** @gmu_major: The maximum GMU version supported by the core */
  /** @base: Container for the generic GPU definitions */
  struct adreno_gpu_core base;
  u32 gmu_major;
  /** @gmu_minor: The minimum GMU version supported by the core */
L51: u32 gmu_major;
  struct adreno_gpu_core base;
  /** @gmu_major: The maximum GMU version supported by the core */
  /** @gmu_minor: The minimum GMU version supported by the core */
  u32 gmu_minor;
L52: /** @gmu_minor: The minimum GMU version supported by the core */
  /** @gmu_major: The maximum GMU version supported by the core */
  u32 gmu_major;
  u32 gmu_minor;
  /** @prim_fifo_threshold: target specific value for PC_DBG_ECO_CNTL */
L53: u32 gmu_minor;
  u32 gmu_major;
  /** @gmu_minor: The minimum GMU version supported by the core */
  /** @prim_fifo_threshold: target specific value for PC_DBG_ECO_CNTL */
  unsigned int prim_fifo_threshold;
L56: /** @sqefw_name: Name of the SQE microcode file */
  /** @prim_fifo_threshold: target specific value for PC_DBG_ECO_CNTL */
  unsigned int prim_fifo_threshold;
  const char *sqefw_name;
  /** @gmufw_name: Name of the GMU firmware file */
L57: const char *sqefw_name;
  unsigned int prim_fifo_threshold;
  /** @sqefw_name: Name of the SQE microcode file */
  /** @gmufw_name: Name of the GMU firmware file */
  const char *gmufw_name;
L58: /** @gmufw_name: Name of the GMU firmware file */
  /** @sqefw_name: Name of the SQE microcode file */
  const char *sqefw_name;
  const char *gmufw_name;
  /**
L59: const char *gmufw_name;
  const char *sqefw_name;
  /** @gmufw_name: Name of the GMU firmware file */
  /**
  * @zap_name: Specifies the name of the CPZ zap file. This field is deprecated.
L62: * Use the 'firmware-name' device tree property instead.
  /**
  * @zap_name: Specifies the name of the CPZ zap file. This field is deprecated.
  */
  const char *zap_name;
L85: /** @ctxt_record_size: Size of the preemption record in bytes */
  /** @gx_cpr_toggle: True to toggle GX CPR FSM to avoid CPR stalls */
  bool gx_cpr_toggle;
  u64 ctxt_record_size;
  /** @gmu_hub_clk_freq: Gmu hub interface clock frequency */
L87: /** @gmu_hub_clk_freq: Gmu hub interface clock frequency */
  /** @ctxt_record_size: Size of the preemption record in bytes */
  u64 ctxt_record_size;
  u64 gmu_hub_clk_freq;
  };
L88: u64 gmu_hub_clk_freq;
  u64 ctxt_record_size;
  /** @gmu_hub_clk_freq: Gmu hub interface clock frequency */
  };
  
L106: * struct a6xx_cp_preemption_record - CP context record for
  
  /**
  * preemption.
  * @magic: (00) Value at this offset must be equal to
L107: * preemption.
  /**
  * struct a6xx_cp_preemption_record - CP context record for
  * @magic: (00) Value at this offset must be equal to
  * A6XX_CP_CTXRECORD_MAGIC_REF.
L111: * we must set to zero for all ringbuffers.
  * A6XX_CP_CTXRECORD_MAGIC_REF.
  * @info: (04) Type of record. Written non-zero (usually) by CP.
  * @errno: (08) Error code. Initialize this to A6XX_CP_CTXRECORD_ERROR_NONE.
  * CP will update to another value if a preemption error occurs.
L113: * CP will update to another value if a preemption error occurs.
  * we must set to zero for all ringbuffers.
  * @errno: (08) Error code. Initialize this to A6XX_CP_CTXRECORD_ERROR_NONE.
  * @data: (12) DATA field in YIELD and SET_MARKER packets.
  * Written by CP when switching out. Not used on switch-in. Initialized to 0.
L122: * counter: (48) Pointer to preemption counter.
  * @rptr_addr: (32) RB_RPTR_ADDR_LO|HI saved and restored. We must initialize.
  * rbase: (40) RB_BASE_LO|HI saved and restored.
  */
  struct a6xx_cp_preemption_record {
L124: struct a6xx_cp_preemption_record {
  * counter: (48) Pointer to preemption counter.
  */
  uint32_t  magic;
  uint32_t  info;

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_a6xx_gmu.c =====
L10: #include <linux/firmware.h>
  #include <linux/delay.h>
  #include <linux/dma-map-ops.h>
  #include <linux/interconnect.h>
  #include <linux/io.h>
L26: #include "kgsl_gmu_core.h"
  #include "kgsl_bus.h"
  #include "kgsl_device.h"
  #include "kgsl_trace.h"
  #include "kgsl_util.h"
L37: static struct gmu_vma_entry a6xx_gmu_vma_legacy[] = {
  ((((vlvl) & 0xFFFF) << 16) | (((sec) & 0xFF) << 8) | ((pri) & 0xFF))
  
  [GMU_ITCM] = {
  .start = 0x00000,
L38: [GMU_ITCM] = {
  
  static struct gmu_vma_entry a6xx_gmu_vma_legacy[] = {
  .start = 0x00000,
  .size = SZ_16K
L42: [GMU_ICACHE] = {
  .size = SZ_16K
  },
  .start = 0x04000,
  .size = (SZ_256K - SZ_16K),
L47: [GMU_DTCM] = {
  .next_va = 0x4000
  },
  .start = 0x40000,
  .size = SZ_16K
L51: [GMU_DCACHE] = {
  .size = SZ_16K
  },
  .start = 0x44000,
  .size = (SZ_256K - SZ_16K),
L56: [GMU_NONCACHED_KERNEL] = {
  .next_va = 0x44000
  },
  .start = 0x60000000,
  .size = SZ_512M,
L63: static struct gmu_vma_entry a6xx_gmu_vma[] = {
  };
  
  [GMU_ITCM] = {
  .start = 0x00000000,
L64: [GMU_ITCM] = {
  
  static struct gmu_vma_entry a6xx_gmu_vma[] = {
  .start = 0x00000000,
  .size = SZ_16K
L68: [GMU_CACHE] = {
  .size = SZ_16K
  },
  .start = SZ_16K,
  .size = (SZ_16M - SZ_16K),
L73: [GMU_DTCM] = {
  .next_va = SZ_16K
  },
  .start = SZ_256M + SZ_16K,
  .size = SZ_16K
L77: [GMU_DCACHE] = {
  .size = SZ_16K
  },
  .start = 0x0,
  .size = 0x0
L81: [GMU_NONCACHED_KERNEL] = {
  .size = 0x0
  },
  .start = 0x60000000,
  .size = SZ_512M,
L111: struct a6xx_gmu_device *gmu = container_of(kobj, struct a6xx_gmu_device, log_kobj);
  struct kobj_attribute *attr, const char *buf, size_t count)
  {
  bool val;
  int ret;
L119: gmu->log_stream_enable = val;
  return ret;
  
  return count;
  }
L125: struct a6xx_gmu_device *gmu = container_of(kobj, struct a6xx_gmu_device, log_kobj);
  static ssize_t log_stream_enable_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
  {
  
  return scnprintf(buf, PAGE_SIZE, "%d\n", gmu->log_stream_enable);
L127: return scnprintf(buf, PAGE_SIZE, "%d\n", gmu->log_stream_enable);
  struct a6xx_gmu_device *gmu = container_of(kobj, struct a6xx_gmu_device, log_kobj);
  
  }
  
L133: struct a6xx_gmu_device *gmu = container_of(kobj, struct a6xx_gmu_device, log_kobj);
  struct kobj_attribute *attr, const char *buf, size_t count)
  {
  u32 val;
  int ret;
L141: gmu->log_group_mask = val;
  return ret;
  
  return count;
  }
L147: struct a6xx_gmu_device *gmu = container_of(kobj, struct a6xx_gmu_device, log_kobj);
  static ssize_t log_group_mask_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
  {
  
  return scnprintf(buf, PAGE_SIZE, "%x\n", gmu->log_group_mask);
L149: return scnprintf(buf, PAGE_SIZE, "%x\n", gmu->log_group_mask);
  struct a6xx_gmu_device *gmu = container_of(kobj, struct a6xx_gmu_device, log_kobj);
  
  }
  
L173: struct a6xx_gmu_device *gmu = container_of(kobj, struct a6xx_gmu_device, stats_kobj);
  struct kobj_attribute *attr, const char *buf, size_t count)
  {
  bool val;
  int ret;
L181: gmu->stats_enable = val;
  return ret;
  
  return count;
  }
L187: struct a6xx_gmu_device *gmu = container_of(kobj, struct a6xx_gmu_device, stats_kobj);
  static ssize_t stats_enable_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
  {
  
  return scnprintf(buf, PAGE_SIZE, "%d\n", gmu->stats_enable);
L189: return scnprintf(buf, PAGE_SIZE, "%d\n", gmu->stats_enable);
  struct a6xx_gmu_device *gmu = container_of(kobj, struct a6xx_gmu_device, stats_kobj);
  
  }
  
L195: struct a6xx_gmu_device *gmu = container_of(kobj, struct a6xx_gmu_device, stats_kobj);
  struct kobj_attribute *attr, const char *buf, size_t count)
  {
  u32 val;
  int ret;
L203: gmu->stats_mask = val;
  return ret;
  
  return count;
  }
L209: struct a6xx_gmu_device *gmu = container_of(kobj, struct a6xx_gmu_device, stats_kobj);
  static ssize_t stats_mask_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
  {
  
  return scnprintf(buf, PAGE_SIZE, "%x\n", gmu->stats_mask);
L211: return scnprintf(buf, PAGE_SIZE, "%x\n", gmu->stats_mask);
  struct a6xx_gmu_device *gmu = container_of(kobj, struct a6xx_gmu_device, stats_kobj);
  
  }
  

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_a6xx_gmu.h =====
L6: #ifndef __ADRENO_A6XX_GMU_H
  * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
  */
  #define __ADRENO_A6XX_GMU_H
  
L7: #define __ADRENO_A6XX_GMU_H
  */
  #ifndef __ADRENO_A6XX_GMU_H
  
  #include <linux/mailbox_client.h>
L12: #include "adreno_a6xx_hfi.h"
  #include <linux/soc/qcom/qcom_aoss.h>
  
  #include "kgsl_gmu_core.h"
  
L13: #include "kgsl_gmu_core.h"
  
  #include "adreno_a6xx_hfi.h"
  
  /**
L16: * struct a6xx_gmu_device - GMU device structure
  
  /**
  * @irq: GMU interrupt number
  * @fw_image: GMU FW image
L17: * @irq: GMU interrupt number
  /**
  * struct a6xx_gmu_device - GMU device structure
  * @fw_image: GMU FW image
  * @dump_mem: pointer to GMU debug dump memory
L18: * @fw_image: GMU FW image
  * struct a6xx_gmu_device - GMU device structure
  * @irq: GMU interrupt number
  * @dump_mem: pointer to GMU debug dump memory
  * @gmu_log: gmu event log memory
L19: * @dump_mem: pointer to GMU debug dump memory
  * @irq: GMU interrupt number
  * @fw_image: GMU FW image
  * @gmu_log: gmu event log memory
  * @hfi: HFI controller
L20: * @gmu_log: gmu event log memory
  * @fw_image: GMU FW image
  * @dump_mem: pointer to GMU debug dump memory
  * @hfi: HFI controller
  * @idle_level: Minimal GPU idle power level
L21: * @hfi: HFI controller
  * @dump_mem: pointer to GMU debug dump memory
  * @gmu_log: gmu event log memory
  * @idle_level: Minimal GPU idle power level
  * @mailbox: Messages to AOP for ACD enable/disable go through this
L26: struct a6xx_gmu_device {
  * @log_wptr_retention: Store the log wptr offset on slumber
  */
  int irq;
  const struct firmware *fw_image;
L28: const struct firmware *fw_image;
  struct a6xx_gmu_device {
  int irq;
  struct kgsl_memdesc *dump_mem;
  struct kgsl_memdesc *gmu_log;
L30: struct kgsl_memdesc *gmu_log;
  const struct firmware *fw_image;
  struct kgsl_memdesc *dump_mem;
  struct a6xx_hfi hfi;
  unsigned int idle_level;
L31: struct a6xx_hfi hfi;
  struct kgsl_memdesc *dump_mem;
  struct kgsl_memdesc *gmu_log;
  unsigned int idle_level;
  /** @qmp: Pointer to qmp struct used for AOP messages*/
L38: /** @cm3_fault: whether gmu received a cm3 fault interrupt */
  bool preallocations;
  unsigned int log_wptr_retention;
  atomic_t cm3_fault;
  /**
L41: * @itcm_shadow: Copy of the itcm block in firmware binary used for
  atomic_t cm3_fault;
  /**
  * snapshot
  */
L45: /** @flags: Internal gmu flags */
  */
  void *itcm_shadow;
  unsigned long flags;
  /** @rscc_virt: Pointer where RSCC block is mapped */
L49: /** @log_stream_enable: GMU log streaming enable. Disabled by default */
  /** @rscc_virt: Pointer where RSCC block is mapped */
  void __iomem *rscc_virt;
  bool log_stream_enable;
  /** @log_group_mask: Allows overriding default GMU log group mask */
L51: /** @log_group_mask: Allows overriding default GMU log group mask */
  /** @log_stream_enable: GMU log streaming enable. Disabled by default */
  bool log_stream_enable;
  u32 log_group_mask;
  struct kobject log_kobj;
L60: /** @stats_enable: GMU stats feature enable */
  /** @pdc_seq_base: Base address of PDC seq registers */
  void __iomem *pdc_seq_base;
  bool stats_enable;
  /** @stats_mask: GMU performance countables to enable */
L62: /** @stats_mask: GMU performance countables to enable */
  /** @stats_enable: GMU stats feature enable */
  bool stats_enable;
  u32 stats_mask;
  /** @stats_interval: GMU performance counters sampling interval */
L64: /** @stats_interval: GMU performance counters sampling interval */
  /** @stats_mask: GMU performance countables to enable */
  u32 stats_mask;
  u32 stats_interval;
  /** @stats_kobj: kernel object for GMU stats directory in sysfs */
L66: /** @stats_kobj: kernel object for GMU stats directory in sysfs */
  /** @stats_interval: GMU performance counters sampling interval */
  u32 stats_interval;
  struct kobject stats_kobj;
  };
L70: /* Helper function to get to a6xx gmu device from adreno device */
  };
  
  struct a6xx_gmu_device *to_a6xx_gmu(struct adreno_device *adreno_dev);
  
L71: struct a6xx_gmu_device *to_a6xx_gmu(struct adreno_device *adreno_dev);
  
  /* Helper function to get to a6xx gmu device from adreno device */
  
  /* Helper function to get to adreno device from a6xx gmu device */
L73: /* Helper function to get to adreno device from a6xx gmu device */
  struct a6xx_gmu_device *to_a6xx_gmu(struct adreno_device *adreno_dev);
  
  struct adreno_device *a6xx_gmu_to_adreno(struct a6xx_gmu_device *gmu);
  
L74: struct adreno_device *a6xx_gmu_to_adreno(struct a6xx_gmu_device *gmu);
  
  /* Helper function to get to adreno device from a6xx gmu device */
  
  /**
L87: * a6xx_gmu_gx_is_on - Check if GX is on
  
  /**
  * @adreno_dev: Pointer to the adreno device
  *
L93: bool a6xx_gmu_gx_is_on(struct adreno_device *adreno_dev);
  * is on or off
  */
  
  /**
L96: * a6xx_gmu_device_snapshot - A6XX GMU snapshot function
  
  /**
  * @device: Device being snapshotted
  * @snapshot: Pointer to the snapshot instance

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_a6xx_gmu_snapshot.c =====
L10: #include "adreno_a6xx_gmu.h"
  #include "adreno.h"
  #include "adreno_a6xx.h"
  #include "adreno_snapshot.h"
  #include "kgsl_device.h"
L13: #include "kgsl_gmu_core.h"
  #include "adreno_snapshot.h"
  #include "kgsl_device.h"
  
  static const unsigned int a6xx_gmu_gx_registers[] = {
L15: static const unsigned int a6xx_gmu_gx_registers[] = {
  #include "kgsl_gmu_core.h"
  
  /* GMU GX */
  0x1A800, 0x1A800, 0x1A810, 0x1A813, 0x1A816, 0x1A816, 0x1A818, 0x1A81B,
L16: /* GMU GX */
  
  static const unsigned int a6xx_gmu_gx_registers[] = {
  0x1A800, 0x1A800, 0x1A810, 0x1A813, 0x1A816, 0x1A816, 0x1A818, 0x1A81B,
  0x1A81E, 0x1A81E, 0x1A820, 0x1A823, 0x1A826, 0x1A826, 0x1A828, 0x1A82B,
L24: static const unsigned int a6xx_gmu_tcm_registers[] = {
  };
  
  /* ITCM */
  0x1B400, 0x1C3FF,
L31: static const unsigned int a6xx_gmu_registers[] = {
  };
  
  /* GMU CX */
  0x1F400, 0x1F407, 0x1F410, 0x1F412, 0x1F500, 0x1F500, 0x1F507, 0x1F50A,
L32: /* GMU CX */
  
  static const unsigned int a6xx_gmu_registers[] = {
  0x1F400, 0x1F407, 0x1F410, 0x1F412, 0x1F500, 0x1F500, 0x1F507, 0x1F50A,
  0x1F800, 0x1F804, 0x1F807, 0x1F808, 0x1F80B, 0x1F80C, 0x1F80F, 0x1F81C,
L42: /* GMU AO */
  0x1F980, 0x1F986, 0x1F990, 0x1F99E, 0x1F9C0, 0x1F9C0, 0x1F9C5, 0x1F9CC,
  0x1F9E0, 0x1F9E2, 0x1F9F0, 0x1F9F0, 0x1FA00, 0x1FA01,
  0x23B00, 0x23B16,
  };
L46: static const unsigned int a660_gmu_registers[] = {
  };
  
  /* GMU CX */
  0x1F408, 0x1F40D, 0x1F40F, 0x1F40F, 0x1F50B, 0x1F50B, 0x1F860, 0x1F860,
L47: /* GMU CX */
  
  static const unsigned int a660_gmu_registers[] = {
  0x1F408, 0x1F40D, 0x1F40F, 0x1F40F, 0x1F50B, 0x1F50B, 0x1F860, 0x1F860,
  0x1F870, 0x1F877, 0x1F8C4, 0x1F8C4, 0x1F8F0, 0x1F8F1, 0x1F948, 0x1F94A,
L53: /* GMU AO LPAC */
  0x1FA02, 0x1FA03, 0x20000, 0x20001, 0x20004, 0x20004, 0x20008, 0x20012,
  0x20018, 0x20018,
  0x23B30, 0x23B30,
  };
L57: static const unsigned int a6xx_gmu_gpucc_registers[] = {
  };
  
  /* GPU CC */
  0x24000, 0x24012, 0x24040, 0x24052, 0x24400, 0x24404, 0x24407, 0x2440B,
L68: static const unsigned int a662_gmu_gpucc_registers[] = {
  };
  
  /* GPU CC */
  0x24000, 0x2400e, 0x24400, 0x2440e, 0x24800, 0x24805, 0x24c00, 0x24cff,
L79: static const unsigned int a663_gmu_gpucc_registers[] = {
  };
  
  /* GPU CC */
  0x24000, 0x2400e, 0x24400, 0x2440e, 0x25800, 0x25804, 0x25c00, 0x25c04,
L158: static size_t a6xx_gmu_snapshot_dtcm(struct kgsl_device *device,
  };
  
  u8 *buf, size_t remain, void *priv)
  {
L161: struct gmu_core_device *gmu_core = &device->gmu_core;
  u8 *buf, size_t remain, void *priv)
  {
  struct kgsl_snapshot_gmu_mem *mem_hdr =
  (struct kgsl_snapshot_gmu_mem *)buf;
L162: struct kgsl_snapshot_gmu_mem *mem_hdr =
  {
  struct gmu_core_device *gmu_core = &device->gmu_core;
  (struct kgsl_snapshot_gmu_mem *)buf;
  u32 *data = (u32 *)(buf + sizeof(*mem_hdr));
L163: (struct kgsl_snapshot_gmu_mem *)buf;
  struct gmu_core_device *gmu_core = &device->gmu_core;
  struct kgsl_snapshot_gmu_mem *mem_hdr =
  u32 *data = (u32 *)(buf + sizeof(*mem_hdr));
  u32 i;
L167: if (remain < gmu_core->vma[GMU_DTCM].size + sizeof(*mem_hdr)) {
  u32 i;
  
  SNAPSHOT_ERR_NOMEM(device, "GMU DTCM Memory");
  return 0;
L168: SNAPSHOT_ERR_NOMEM(device, "GMU DTCM Memory");
  
  if (remain < gmu_core->vma[GMU_DTCM].size + sizeof(*mem_hdr)) {
  return 0;
  }
L172: mem_hdr->type = SNAPSHOT_GMU_MEM_BIN_BLOCK;
  }
  
  mem_hdr->hostaddr = 0;
  mem_hdr->gmuaddr = gmu_core->vma[GMU_DTCM].start;
L174: mem_hdr->gmuaddr = gmu_core->vma[GMU_DTCM].start;
  mem_hdr->type = SNAPSHOT_GMU_MEM_BIN_BLOCK;
  mem_hdr->hostaddr = 0;
  mem_hdr->gpuaddr = 0;
  
L178: for (i = 0; i < (gmu_core->vma[GMU_DTCM].size >> 2); i++)
  
  /* FIXME: use a bulk read? */
  gmu_core_regread(device, A6XX_GMU_CM3_DTCM_START + i, data++);
  
L179: gmu_core_regread(device, A6XX_GMU_CM3_DTCM_START + i, data++);
  /* FIXME: use a bulk read? */
  for (i = 0; i < (gmu_core->vma[GMU_DTCM].size >> 2); i++)
  
  return gmu_core->vma[GMU_DTCM].size + sizeof(*mem_hdr);
L181: return gmu_core->vma[GMU_DTCM].size + sizeof(*mem_hdr);
  gmu_core_regread(device, A6XX_GMU_CM3_DTCM_START + i, data++);
  
  }
  
L184: static size_t a6xx_gmu_snapshot_itcm(struct kgsl_device *device,
  }
  
  u8 *buf, size_t remain, void *priv)
  {
L187: struct gmu_core_device *gmu_core = &device->gmu_core;
  u8 *buf, size_t remain, void *priv)
  {
  struct kgsl_snapshot_gmu_mem *mem_hdr =
  (struct kgsl_snapshot_gmu_mem *)buf;
L188: struct kgsl_snapshot_gmu_mem *mem_hdr =
  {
  struct gmu_core_device *gmu_core = &device->gmu_core;
  (struct kgsl_snapshot_gmu_mem *)buf;
  void *dest = buf + sizeof(*mem_hdr);
L189: (struct kgsl_snapshot_gmu_mem *)buf;
  struct gmu_core_device *gmu_core = &device->gmu_core;
  struct kgsl_snapshot_gmu_mem *mem_hdr =
  void *dest = buf + sizeof(*mem_hdr);
  struct a6xx_gmu_device *gmu = (struct a6xx_gmu_device *)priv;
L191: struct a6xx_gmu_device *gmu = (struct a6xx_gmu_device *)priv;
  (struct kgsl_snapshot_gmu_mem *)buf;
  void *dest = buf + sizeof(*mem_hdr);
  
  if (!gmu->itcm_shadow) {

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_a6xx_hfi.c =====
L12: #include "adreno_a6xx_hfi.h"
  #include "adreno.h"
  #include "adreno_a6xx.h"
  #include "kgsl_device.h"
  #include "kgsl_trace.h"
L16: /* Below section is for all structures related to HFI queues */
  #include "kgsl_trace.h"
  
  #define HFI_QUEUE_MAX HFI_QUEUE_DEFAULT_CNT
  
L17: #define HFI_QUEUE_MAX HFI_QUEUE_DEFAULT_CNT
  
  /* Below section is for all structures related to HFI queues */
  
  /* Total header sizes + queue sizes + 16 for alignment */
L20: #define HFIMEM_SIZE (sizeof(struct hfi_queue_table) + 16 + \
  
  /* Total header sizes + queue sizes + 16 for alignment */
  (HFI_QUEUE_SIZE * HFI_QUEUE_MAX))
  
L21: (HFI_QUEUE_SIZE * HFI_QUEUE_MAX))
  /* Total header sizes + queue sizes + 16 for alignment */
  #define HFIMEM_SIZE (sizeof(struct hfi_queue_table) + 16 + \
  
  struct a6xx_hfi *to_a6xx_hfi(struct adreno_device *adreno_dev)
L23: struct a6xx_hfi *to_a6xx_hfi(struct adreno_device *adreno_dev)
  (HFI_QUEUE_SIZE * HFI_QUEUE_MAX))
  
  {
  struct a6xx_gmu_device *gmu = to_a6xx_gmu(adreno_dev);
L25: struct a6xx_gmu_device *gmu = to_a6xx_gmu(adreno_dev);
  struct a6xx_hfi *to_a6xx_hfi(struct adreno_device *adreno_dev)
  {
  
  return &gmu->hfi;
L27: return &gmu->hfi;
  struct a6xx_gmu_device *gmu = to_a6xx_gmu(adreno_dev);
  
  }
  
L31: int a6xx_hfi_queue_read(struct a6xx_gmu_device *gmu, uint32_t queue_idx,
  
  /* Size in below functions are in unit of dwords */
  unsigned int *output, unsigned int max_size)
  {
L34: struct kgsl_device *device = KGSL_DEVICE(a6xx_gmu_to_adreno(gmu));
  unsigned int *output, unsigned int max_size)
  {
  struct kgsl_memdesc *mem_addr = gmu->hfi.hfi_mem;
  struct hfi_queue_table *tbl = mem_addr->hostptr;
L35: struct kgsl_memdesc *mem_addr = gmu->hfi.hfi_mem;
  {
  struct kgsl_device *device = KGSL_DEVICE(a6xx_gmu_to_adreno(gmu));
  struct hfi_queue_table *tbl = mem_addr->hostptr;
  struct hfi_queue_header *hdr = &tbl->qhdr[queue_idx];
L36: struct hfi_queue_table *tbl = mem_addr->hostptr;
  struct kgsl_device *device = KGSL_DEVICE(a6xx_gmu_to_adreno(gmu));
  struct kgsl_memdesc *mem_addr = gmu->hfi.hfi_mem;
  struct hfi_queue_header *hdr = &tbl->qhdr[queue_idx];
  uint32_t *queue;
L37: struct hfi_queue_header *hdr = &tbl->qhdr[queue_idx];
  struct kgsl_memdesc *mem_addr = gmu->hfi.hfi_mem;
  struct hfi_queue_table *tbl = mem_addr->hostptr;
  uint32_t *queue;
  uint32_t msg_hdr;
L44: if (hdr->status == HFI_QUEUE_STATUS_DISABLED)
  int result = 0;
  
  return -EINVAL;
  
L58: dev_err(GMU_PDEV_DEV(device),
  
  if (size > (max_size >> 2)) {
  "HFI message too big: hdr:0x%x rd idx=%d\n",
  msg_hdr, hdr->read_index);
L59: "HFI message too big: hdr:0x%x rd idx=%d\n",
  if (size > (max_size >> 2)) {
  dev_err(GMU_PDEV_DEV(device),
  msg_hdr, hdr->read_index);
  result = -EMSGSIZE;
L75: dev_err(GMU_PDEV_DEV(device),
  } else {
  /* In case FW messed up */
  "Read index %d greater than queue size %d\n",
  hdr->read_index, hdr->queue_size);
L81: if (GMU_VER_MAJOR(device->gmu_core.ver.hfi) >= 2)
  }
  
  read = ALIGN(read, SZ_4) % hdr->queue_size;
  
L85: if (MSG_HDR_GET_TYPE(msg_hdr) == HFI_MSG_ACK)
  
  /* For acks, trace the packet for which this ack was sent */
  trace_kgsl_hfi_receive(MSG_HDR_GET_ID(output[1]),
  MSG_HDR_GET_SIZE(output[1]),
L86: trace_kgsl_hfi_receive(MSG_HDR_GET_ID(output[1]),
  /* For acks, trace the packet for which this ack was sent */
  if (MSG_HDR_GET_TYPE(msg_hdr) == HFI_MSG_ACK)
  MSG_HDR_GET_SIZE(output[1]),
  MSG_HDR_GET_SEQNUM(output[1]));
L90: trace_kgsl_hfi_receive(MSG_HDR_GET_ID(msg_hdr),
  MSG_HDR_GET_SEQNUM(output[1]));
  else
  MSG_HDR_GET_SIZE(msg_hdr), MSG_HDR_GET_SEQNUM(msg_hdr));
  
L93: hfi_update_read_idx(hdr, read);
  MSG_HDR_GET_SIZE(msg_hdr), MSG_HDR_GET_SEQNUM(msg_hdr));
  
  
  done:
L100: int a6xx_hfi_queue_write(struct adreno_device *adreno_dev, uint32_t queue_idx,
  
  /* Size in below functions are in unit of dwords */
  uint32_t *msg, u32 size_bytes)
  {
L103: struct a6xx_gmu_device *gmu = to_a6xx_gmu(adreno_dev);
  uint32_t *msg, u32 size_bytes)
  {
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
  struct hfi_queue_table *tbl = gmu->hfi.hfi_mem->hostptr;
L105: struct hfi_queue_table *tbl = gmu->hfi.hfi_mem->hostptr;
  struct a6xx_gmu_device *gmu = to_a6xx_gmu(adreno_dev);
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
  struct hfi_queue_header *hdr = &tbl->qhdr[queue_idx];
  uint32_t *queue;
L106: struct hfi_queue_header *hdr = &tbl->qhdr[queue_idx];
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
  struct hfi_queue_table *tbl = gmu->hfi.hfi_mem->hostptr;
  uint32_t *queue;
  uint32_t i, write_idx, read_idx, empty_space;
L113: if (hdr->status == HFI_QUEUE_STATUS_DISABLED || !IS_ALIGNED(size_bytes, sizeof(u32)))
  uint32_t id = MSG_HDR_GET_ID(*msg);
  
  return -EINVAL;
  
L116: queue = HOST_QUEUE_START_ADDR(gmu->hfi.hfi_mem, queue_idx);
  return -EINVAL;
  
  
  write_idx = hdr->write_index;
L134: if (GMU_VER_MAJOR(device->gmu_core.ver.hfi) >= 2) {
  
  /* Cookify any non used data at the end of the write buffer */
  for (; i < align_size; i++) {
  queue[write_idx] = 0xFAFAFAFA;
L141: trace_kgsl_hfi_send(id, size_dwords, MSG_HDR_GET_SEQNUM(*msg));
  }
  
  
  hfi_update_write_idx(&hdr->write_index, write_idx);

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_a6xx_hfi.h =====
L6: #ifndef __ADRENO_A6XX_HFI_H
  * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
  */
  #define __ADRENO_A6XX_HFI_H
  
L7: #define __ADRENO_A6XX_HFI_H
  */
  #ifndef __ADRENO_A6XX_HFI_H
  
  #include "adreno_hfi.h"
L9: #include "adreno_hfi.h"
  #define __ADRENO_A6XX_HFI_H
  
  
  /**
L12: * 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
L14: *	value of the counter is used as sequence number for HFI message
  * struct a6xx_hfi - HFI control structure
  * @seqnum: atomic counter that is incremented for each message sent. The
  * @bw_table: HFI BW table buffer
  * @acd_table: HFI table for ACD data
L15: * @bw_table: HFI BW table buffer
  * @seqnum: atomic counter that is incremented for each message sent. The
  *	value of the counter is used as sequence number for HFI message
  * @acd_table: HFI table for ACD data
  */
L16: * @acd_table: HFI table for ACD data
  *	value of the counter is used as sequence number for HFI message
  * @bw_table: HFI BW table buffer
  */
  struct a6xx_hfi {
L18: struct a6xx_hfi {
  * @acd_table: HFI table for ACD data
  */
  /** @irq: HFI interrupt line */
  int irq;
L19: /** @irq: HFI interrupt line */
  */
  struct a6xx_hfi {
  int irq;
  atomic_t seqnum;
L22: /** @hfi_mem: Memory descriptor for the hfi memory */
  int irq;
  atomic_t seqnum;
  struct kgsl_memdesc *hfi_mem;
  struct hfi_bwtable_cmd bw_table;
L23: struct kgsl_memdesc *hfi_mem;
  atomic_t seqnum;
  /** @hfi_mem: Memory descriptor for the hfi memory */
  struct hfi_bwtable_cmd bw_table;
  struct hfi_acd_table_cmd acd_table;
L24: struct hfi_bwtable_cmd bw_table;
  /** @hfi_mem: Memory descriptor for the hfi memory */
  struct kgsl_memdesc *hfi_mem;
  struct hfi_acd_table_cmd acd_table;
  /** @dcvs_table: HFI table for gpu dcvs levels */
L25: struct hfi_acd_table_cmd acd_table;
  struct kgsl_memdesc *hfi_mem;
  struct hfi_bwtable_cmd bw_table;
  /** @dcvs_table: HFI table for gpu dcvs levels */
  struct hfi_dcvstable_cmd dcvs_table;
L26: /** @dcvs_table: HFI table for gpu dcvs levels */
  struct hfi_bwtable_cmd bw_table;
  struct hfi_acd_table_cmd acd_table;
  struct hfi_dcvstable_cmd dcvs_table;
  };
L27: struct hfi_dcvstable_cmd dcvs_table;
  struct hfi_acd_table_cmd acd_table;
  /** @dcvs_table: HFI table for gpu dcvs levels */
  };
  
L30: struct a6xx_gmu_device;
  };
  
  
  /* a6xx_hfi_irq_handler - IRQ handler for HFI interripts */
L32: /* a6xx_hfi_irq_handler - IRQ handler for HFI interripts */
  struct a6xx_gmu_device;
  
  irqreturn_t a6xx_hfi_irq_handler(int irq, void *data);
  
L33: irqreturn_t a6xx_hfi_irq_handler(int irq, void *data);
  
  /* a6xx_hfi_irq_handler - IRQ handler for HFI interripts */
  
  /**
L36: * a6xx_hfi_start - Send the various HFIs during device boot up
  
  /**
  * @adreno_dev: Pointer to the adreno device
  *
L41: int a6xx_hfi_start(struct adreno_device *adreno_dev);
  * Return: 0 on success or negative error on failure
  */
  
  /**
L44: * a6xx_hfi_start - Send the various HFIs during device boot up
  
  /**
  * @adreno_dev: Pointer to the adreno device
  *
L49: void a6xx_hfi_stop(struct adreno_device *adreno_dev);
  * Return: 0 on success or negative error on failure
  */
  
  /**
L52: * a6xx_hfi_init - Initialize hfi resources
  
  /**
  * @adreno_dev: Pointer to the adreno device
  *
L55: * This function allocates and sets up hfi queues
  * @adreno_dev: Pointer to the adreno device
  *
  * when a process creates the very first kgsl instance
  *
L60: int a6xx_hfi_init(struct adreno_device *adreno_dev);
  * Return: 0 on success or negative error on failure
  */
  
  /* Helper function to get to a6xx hfi struct from adreno device */
L62: /* Helper function to get to a6xx hfi struct from adreno device */
  int a6xx_hfi_init(struct adreno_device *adreno_dev);
  
  struct a6xx_hfi *to_a6xx_hfi(struct adreno_device *adreno_dev);
  
L63: struct a6xx_hfi *to_a6xx_hfi(struct adreno_device *adreno_dev);
  
  /* Helper function to get to a6xx hfi struct from adreno device */
  
  /**
L66: * a6xx_hfi_queue_write - Write a command to hfi queue
  
  /**
  * @adreno_dev: Pointer to the adreno device
  * @queue_idx: destination queue id
L74: int a6xx_hfi_queue_write(struct adreno_device *adreno_dev, u32 queue_idx,
  * Return: 0 on success or negative error on failure
  */
  u32 *msg, u32 size_bytes);
  
L78: * a6xx_hfi_queue_read - Read data from hfi queue
  
  /**
  * @gmu: Pointer to the a6xx gmu device
  * @queue_idx: queue id to read from

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_a6xx_hwsched.c =====
L12: #include "adreno_hfi.h"
  #include "adreno_a6xx.h"
  #include "adreno_a6xx_hwsched.h"
  #include "adreno_snapshot.h"
  #include "kgsl_bus.h"
L16: #include "kgsl_gmu_core.h"
  #include "kgsl_bus.h"
  #include "kgsl_device.h"
  #include "kgsl_trace.h"
  #include "kgsl_util.h"
L29: a6xx_gmu_snapshot(adreno_dev, snapshot);
  bool parse_payload;
  
  
  adreno_hwsched_parse_fault_cmdobj(adreno_dev, snapshot);
L34: * First try to dump ringbuffers using context bad HFI payloads
  
  /*
  * because they have all the ringbuffer parameters. If ringbuffer
  * payloads are not present, fall back to dumping ringbuffers
L35: * because they have all the ringbuffer parameters. If ringbuffer
  /*
  * First try to dump ringbuffers using context bad HFI payloads
  * payloads are not present, fall back to dumping ringbuffers
  * based on MEMKIND_RB
L36: * payloads are not present, fall back to dumping ringbuffers
  * First try to dump ringbuffers using context bad HFI payloads
  * because they have all the ringbuffer parameters. If ringbuffer
  * based on MEMKIND_RB
  */
L39: if (GMU_VER_MINOR(device->gmu_core.ver.hfi) < 2)
  * based on MEMKIND_RB
  */
  parse_payload = adreno_hwsched_parse_payload_rb_legacy(adreno_dev, snapshot);
  else
L48: struct hfi_mem_alloc_entry *entry = &hwsched->mem_alloc_table[i];
  
  for (i = 0; i < hwsched->mem_alloc_entries; i++) {
  
  if (entry->desc.mem_kind == HFI_MEMKIND_RB && !skip_memkind_rb)
L50: if (entry->desc.mem_kind == HFI_MEMKIND_RB && !skip_memkind_rb)
  struct hfi_mem_alloc_entry *entry = &hwsched->mem_alloc_table[i];
  
  kgsl_snapshot_add_section(device,
  KGSL_SNAPSHOT_SECTION_RB_V2,
L56: if (entry->desc.mem_kind == HFI_MEMKIND_SCRATCH)
  entry->md);
  
  kgsl_snapshot_add_section(device,
  KGSL_SNAPSHOT_SECTION_GPU_OBJECT_V2,
L62: if (entry->desc.mem_kind == HFI_MEMKIND_PROFILE)
  entry->md);
  
  kgsl_snapshot_add_section(device,
  KGSL_SNAPSHOT_SECTION_GPU_OBJECT_V2,
L68: if (entry->desc.mem_kind == HFI_MEMKIND_CSW_SMMU_INFO)
  entry->md);
  
  kgsl_snapshot_add_section(device,
  KGSL_SNAPSHOT_SECTION_GPU_OBJECT_V2,
L74: if (entry->desc.mem_kind == HFI_MEMKIND_CSW_PRIV_NON_SECURE)
  entry->md);
  
  adreno_hwsched_snapshot_preemption_records(device, snapshot,
  entry->md);
L75: adreno_hwsched_snapshot_preemption_records(device, snapshot,
  
  if (entry->desc.mem_kind == HFI_MEMKIND_CSW_PRIV_NON_SECURE)
  entry->md);
  
L78: if (entry->desc.mem_kind == HFI_MEMKIND_PREEMPT_SCRATCH)
  entry->md);
  
  kgsl_snapshot_add_section(device,
  KGSL_SNAPSHOT_SECTION_GPU_OBJECT_V2,
L86: static void a6xx_hwsched_gmu_suspend(struct adreno_device *adreno_dev, bool force)
  }
  
  {
  a6xx_gmu_suspend(adreno_dev, force);
L88: a6xx_gmu_suspend(adreno_dev, force);
  static void a6xx_hwsched_gmu_suspend(struct adreno_device *adreno_dev, bool force)
  {
  adreno_hwsched_reset_hfi_mem(adreno_dev);
  }
L89: adreno_hwsched_reset_hfi_mem(adreno_dev);
  {
  a6xx_gmu_suspend(adreno_dev, force);
  }
  
L92: static int a6xx_hwsched_gmu_first_boot(struct adreno_device *adreno_dev)
  }
  
  {
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
L96: struct a6xx_gmu_device *gmu = to_a6xx_gmu(adreno_dev);
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
  struct kgsl_pwrctrl *pwr = &device->pwrctrl;
  int level, ret = 0;
  
L101: a6xx_gmu_aop_send_acd_state(gmu, adreno_dev->acd_enabled);
  kgsl_pwrctrl_request_state(device, KGSL_STATE_AWARE);
  
  
  ret = kgsl_pwrctrl_enable_cx_gdsc(device);
L107: ret = gmu_core_enable_clks(device, device->gmu_core.num_freqs - 1);
  return ret;
  
  if (ret)
  goto gdsc_off;
L111: ret = a6xx_gmu_load_fw(adreno_dev);
  goto gdsc_off;
  
  if (ret)
  goto clks_gdsc_off;
L115: ret = a6xx_gmu_itcm_shadow(adreno_dev);
  goto clks_gdsc_off;
  
  if (ret)
  goto clks_gdsc_off;
L119: if (!test_bit(GMU_PRIV_PDC_RSC_LOADED, &gmu->flags)) {
  goto clks_gdsc_off;
  
  ret = a6xx_load_pdc_ucode(adreno_dev);
  if (ret)
L125: set_bit(GMU_PRIV_PDC_RSC_LOADED, &gmu->flags);
  
  a6xx_load_rsc_ucode(adreno_dev);
  }
  
L128: a6xx_gmu_register_config(adreno_dev);
  }
  
  
  a6xx_gmu_version_info(adreno_dev);
L130: a6xx_gmu_version_info(adreno_dev);
  a6xx_gmu_register_config(adreno_dev);
  
  
  if (GMU_VER_MINOR(device->gmu_core.ver.hfi) < 2)
L132: if (GMU_VER_MINOR(device->gmu_core.ver.hfi) < 2)
  a6xx_gmu_version_info(adreno_dev);
  
  set_bit(ADRENO_HWSCHED_CTX_BAD_LEGACY, &adreno_dev->hwsched.flags);
  
L135: a6xx_gmu_irq_enable(adreno_dev);
  set_bit(ADRENO_HWSCHED_CTX_BAD_LEGACY, &adreno_dev->hwsched.flags);
  
  
  /* Vote for minimal DDR BW for GMU to init */

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_a6xx_hwsched.h =====
L10: #include "adreno_a6xx_hwsched_hfi.h"
  #define _ADRENO_A6XX_HWSCHED_H_
  
  
  /**
L18: /** @hwsched_hfi: Container for hwscheduling specific hfi resources */
  /** @a6xx_dev: Container for the a6xx device */
  struct a6xx_device a6xx_dev;
  struct a6xx_hwsched_hfi hwsched_hfi;
  };
L19: struct a6xx_hwsched_hfi hwsched_hfi;
  struct a6xx_device a6xx_dev;
  /** @hwsched_hfi: Container for hwscheduling specific hfi resources */
  };
  
L28: * The target specific probe function for hwsched enabled gmu targets.
  * @gpucore: Pointer to the gpucore
  *
  *
  * Return: 0 on success or negative error on failure
L36: * a6xx_hwsched_reset_replay - Restart the gmu and gpu
  
  /**
  * @adreno_dev: Pointer to the adreno device
  *
L39: * Restart the GMU and GPU and replay the inflight commands
  * @adreno_dev: Pointer to the adreno device
  *
  
  * Return: 0 on success or negative error on failure
L50: * Snapshot the faulty ib and then snapshot rest of a6xx gmu things
  * @snapshot: Pointer to the snapshot instance
  *
  */
  void a6xx_hwsched_snapshot(struct adreno_device *adreno_dev,
L68: * a6xx_hwsched_send_recurring_cmdobj - Dispatch IBs to GMU
  
  /**
  * @adreno_dev: Pointer to adreno device structure
  * @cmdobj: The command object which needs to be submitted
L73: * recurring IBs to the GMU. Upon receiving ipc interrupt GMU will submit
  *
  * This function is used to register the context if needed and submit
  * recurring IBs to GPU.
  

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_a6xx_hwsched_hfi.c =====
L7: #include <linux/iommu.h>
  */
  
  
  #include "adreno.h"
L12: #include "adreno_hfi.h"
  #include "adreno_a6xx.h"
  #include "adreno_a6xx_hwsched.h"
  #include "adreno_perfcounter.h"
  #include "adreno_pm4types.h"
L18: #include "kgsl_gmu_core.h"
  #include "kgsl_device.h"
  #include "kgsl_eventlog.h"
  #include "kgsl_pwrctrl.h"
  #include "kgsl_trace.h"
L23: #define HFI_QUEUE_MAX (HFI_QUEUE_DEFAULT_CNT + HFI_QUEUE_DISPATCH_MAX_CNT)
  #include "kgsl_util.h"
  
  
  #define DEFINE_QHDR(gmuaddr, id, prio) \
L25: #define DEFINE_QHDR(gmuaddr, id, prio) \
  #define HFI_QUEUE_MAX (HFI_QUEUE_DEFAULT_CNT + HFI_QUEUE_DISPATCH_MAX_CNT)
  
  {\
  .status = 1, \
L28: .start_addr = GMU_QUEUE_START_ADDR(gmuaddr, id), \
  {\
  .status = 1, \
  .type = QUEUE_HDR_TYPE(id, prio, 0, 0), \
  .queue_size = SZ_4K >> 2, \
L48: } a6xx_hfi_dqs[KGSL_PRIORITY_MAX_RB_LEVELS] = {
  /** @offset: Next dqid to use for roundrobin context assignment */
  u32 offset;
  { 4, 0, }, /* RB0 */
  { 4, 4, }, /* RB1 */
L55: static int a6xx_hfi_dispatch_queue_write(struct adreno_device *adreno_dev, uint32_t queue_idx,
  };
  
  uint32_t *msg, u32 size_bytes, struct kgsl_drawobj_cmd *cmdobj,
  struct adreno_submit_time *time);
L59: struct a6xx_hwsched_hfi *to_a6xx_hwsched_hfi(
  struct adreno_submit_time *time);
  
  struct adreno_device *adreno_dev)
  {
L67: return &a6xx_hwsched->hwsched_hfi;
  struct a6xx_hwsched_device, a6xx_dev);
  
  }
  
L70: static void add_waiter(struct a6xx_hwsched_hfi *hfi, u32 hdr,
  }
  
  struct pending_cmd *ack)
  {
L76: write_lock_irq(&hfi->msglock);
  
  init_completion(&ack->complete);
  list_add_tail(&ack->node, &hfi->msglist);
  write_unlock_irq(&hfi->msglock);
L77: list_add_tail(&ack->node, &hfi->msglist);
  init_completion(&ack->complete);
  write_lock_irq(&hfi->msglock);
  write_unlock_irq(&hfi->msglock);
  
L78: write_unlock_irq(&hfi->msglock);
  write_lock_irq(&hfi->msglock);
  list_add_tail(&ack->node, &hfi->msglist);
  
  ack->sent_hdr = hdr;
L83: static void del_waiter(struct a6xx_hwsched_hfi *hfi, struct pending_cmd *ack)
  }
  
  {
  write_lock_irq(&hfi->msglock);
L85: write_lock_irq(&hfi->msglock);
  static void del_waiter(struct a6xx_hwsched_hfi *hfi, struct pending_cmd *ack)
  {
  list_del(&ack->node);
  write_unlock_irq(&hfi->msglock);
L87: write_unlock_irq(&hfi->msglock);
  write_lock_irq(&hfi->msglock);
  list_del(&ack->node);
  }
  
L92: struct a6xx_hwsched_hfi *hfi = to_a6xx_hwsched_hfi(adreno_dev);
  static void a6xx_receive_ack_async(struct adreno_device *adreno_dev, void *rcvd)
  {
  struct device *gmu_pdev_dev = GMU_PDEV_DEV(KGSL_DEVICE(adreno_dev));
  struct pending_cmd *cmd = NULL;
L93: struct device *gmu_pdev_dev = GMU_PDEV_DEV(KGSL_DEVICE(adreno_dev));
  {
  struct a6xx_hwsched_hfi *hfi = to_a6xx_hwsched_hfi(adreno_dev);
  struct pending_cmd *cmd = NULL;
  u32 waiters[64], num_waiters = 0, i;
L102: dev_err_ratelimited(gmu_pdev_dev,
  
  if (size_bytes > sizeof(cmd->results))
  "Ack result too big: %d Truncating to: %ld\n",
  size_bytes, sizeof(cmd->results));
L106: read_lock(&hfi->msglock);
  size_bytes, sizeof(cmd->results));
  
  
  list_for_each_entry(cmd, &hfi->msglist, node) {
L108: list_for_each_entry(cmd, &hfi->msglist, node) {
  read_lock(&hfi->msglock);
  
  if (CMP_HFI_ACK_HDR(cmd->sent_hdr, req_hdr)) {
  memcpy(cmd->results, ack,
L109: if (CMP_HFI_ACK_HDR(cmd->sent_hdr, req_hdr)) {
  
  list_for_each_entry(cmd, &hfi->msglist, node) {
  memcpy(cmd->results, ack,
  min_t(u32, size_bytes,
L114: read_unlock(&hfi->msglock);
  sizeof(cmd->results)));
  complete(&cmd->complete);
  return;
  }
L122: read_unlock(&hfi->msglock);
  }
  
  
  /* Didn't find the sender, list the waiter */
L125: dev_err_ratelimited(gmu_pdev_dev,
  
  /* Didn't find the sender, list the waiter */
  "Unexpectedly got id %d seqnum %d. Total waiters: %d Top %d Waiters:\n",
  MSG_HDR_GET_ID(req_hdr), MSG_HDR_GET_SEQNUM(req_hdr),
L131: dev_err_ratelimited(gmu_pdev_dev,
  
  for (i = 0; i < num_waiters && i < 5; i++)
  " id %d seqnum %d\n",
  MSG_HDR_GET_ID(waiters[i]),
L141: struct hfi_context_bad_cmd_legacy *cmd = adreno_dev->hwsched.ctxt_bad;
  u32 type, u32 key)
  {
  u32 i = 0, payload_bytes;
  void *start;
L149: offsetof(struct hfi_context_bad_cmd_legacy, payload);
  
  payload_bytes = (MSG_HDR_GET_SIZE(cmd->hdr) << 2) -
  
  start = &cmd->payload[0];
L167: struct device *gmu_pdev_dev = GMU_PDEV_DEV(KGSL_DEVICE(adreno_dev));
  static void log_gpu_fault_legacy(struct adreno_device *adreno_dev)
  {
  struct hfi_context_bad_cmd_legacy *cmd = adreno_dev->hwsched.ctxt_bad;
  

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_a6xx_hwsched_hfi.h =====
L7: #ifndef _ADRENO_A6XX_HWSCHED_HFI_H_
  */
  
  #define _ADRENO_A6XX_HWSCHED_HFI_H_
  
L8: #define _ADRENO_A6XX_HWSCHED_HFI_H_
  
  #ifndef _ADRENO_A6XX_HWSCHED_HFI_H_
  
  struct a6xx_hwsched_hfi {
L10: struct a6xx_hwsched_hfi {
  #define _ADRENO_A6XX_HWSCHED_HFI_H_
  
  /** @irq_mask: Store the hfi interrupt mask */
  u32 irq_mask;
L11: /** @irq_mask: Store the hfi interrupt mask */
  
  struct a6xx_hwsched_hfi {
  u32 irq_mask;
  /** @msglock: To protect the list of un-ACKed hfi packets */
L13: /** @msglock: To protect the list of un-ACKed hfi packets */
  /** @irq_mask: Store the hfi interrupt mask */
  u32 irq_mask;
  rwlock_t msglock;
  /** @msglist: List of un-ACKed hfi packets */
L15: /** @msglist: List of un-ACKed hfi packets */
  /** @msglock: To protect the list of un-ACKed hfi packets */
  rwlock_t msglock;
  struct list_head msglist;
  /** @f2h_task: Task for processing gmu fw to host packets */
L17: /** @f2h_task: Task for processing gmu fw to host packets */
  /** @msglist: List of un-ACKed hfi packets */
  struct list_head msglist;
  struct task_struct *f2h_task;
  /** @f2h_wq: Waitqueue for the f2h_task */
L21: /** @big_ib: GMU buffer to hold big IBs */
  /** @f2h_wq: Waitqueue for the f2h_task */
  wait_queue_head_t f2h_wq;
  struct kgsl_memdesc *big_ib;
  /** @big_ib_recurring: GMU buffer to hold big recurring IBs */
L23: /** @big_ib_recurring: GMU buffer to hold big recurring IBs */
  /** @big_ib: GMU buffer to hold big IBs */
  struct kgsl_memdesc *big_ib;
  struct kgsl_memdesc *big_ib_recurring;
  /** @perfctr_scratch: Buffer to hold perfcounter PM4 commands */
L34: * a6xx_hwsched_hfi_probe - Probe hwsched hfi resources
  
  /**
  * @adreno_dev: Pointer to adreno device structure
  *
L39: int a6xx_hwsched_hfi_probe(struct adreno_device *adreno_dev);
  * Return: 0 on success and negative error on failure.
  */
  
  /**
L42: * a6xx_hwsched_hfi_remove - Release hwsched hfi resources
  
  /**
  * @adreno_dev: Pointer to adreno device structure
  */
L45: void a6xx_hwsched_hfi_remove(struct adreno_device *adreno_dev);
  * @adreno_dev: Pointer to adreno device structure
  */
  
  /**
L48: * a6xx_hwsched_hfi_init - Initialize hfi resources
  
  /**
  * @adreno_dev: Pointer to adreno device structure
  *
L51: * This function is used to initialize hfi resources
  * @adreno_dev: Pointer to adreno device structure
  *
  * once before the very first gmu boot
  *
L52: * once before the very first gmu boot
  *
  * This function is used to initialize hfi resources
  *
  * Return: 0 on success and negative error on failure.
L56: int a6xx_hwsched_hfi_init(struct adreno_device *adreno_dev);
  * Return: 0 on success and negative error on failure.
  */
  
  /**
L59: * a6xx_hwsched_hfi_start - Start hfi resources
  
  /**
  * @adreno_dev: Pointer to adreno device structure
  *
L62: * Send the various hfi packets before booting the gpu
  * @adreno_dev: Pointer to adreno device structure
  *
  *
  * Return: 0 on success and negative error on failure.
L66: int a6xx_hwsched_hfi_start(struct adreno_device *adreno_dev);
  * Return: 0 on success and negative error on failure.
  */
  
  /**
L69: * a6xx_hwsched_hfi_stop - Stop the hfi resources
  
  /**
  * @adreno_dev: Pointer to the adreno device
  *
L72: * This function does the hfi cleanup when powering down the gmu
  * @adreno_dev: Pointer to the adreno device
  *
  */
  void a6xx_hwsched_hfi_stop(struct adreno_device *adreno_dev);
L74: void a6xx_hwsched_hfi_stop(struct adreno_device *adreno_dev);
  * This function does the hfi cleanup when powering down the gmu
  */
  
  /**
L77: * a6xx_hwched_cp_init - Send CP_INIT via HFI
  
  /**
  * @adreno_dev: Pointer to adreno device structure
  *
L81: * GPU out of secure mode using hfi raw packets.
  *
  * This function is used to send CP INIT packet and bring
  *
  * Return: 0 on success and negative error on failure.
L85: int a6xx_hwsched_cp_init(struct adreno_device *adreno_dev);
  * Return: 0 on success and negative error on failure.
  */
  
  /**
L102: * a6xx_hfi_send_cmd_async - Send an hfi packet
  
  /**
  * @adreno_dev: Pointer to adreno device structure
  * @data: Data to be sent in the hfi packet
L104: * @data: Data to be sent in the hfi packet
  * a6xx_hfi_send_cmd_async - Send an hfi packet
  * @adreno_dev: Pointer to adreno device structure
  * @size_bytes: Size of the packet in bytes
  *
L107: * Send data in the form of an HFI packet to gmu and wait for
  * @size_bytes: Size of the packet in bytes
  *
  * it's ack asynchronously
  *
L112: int a6xx_hfi_send_cmd_async(struct adreno_device *adreno_dev, void *data, u32 size_bytes);
  * Return: 0 on success and negative error on failure.
  */
  
  /**

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_a6xx_perfcounter.c =====
L9: #include "adreno_a6xx_hwsched_hfi.h"
  #include "adreno.h"
  #include "adreno_a6xx.h"
  #include "adreno_perfcounter.h"
  #include "adreno_pm4types.h"
L43: * retention in the GMU.
  /*
  * a650 and a660 currently have the perfcounter values saved via
  */
  if (adreno_is_a650(adreno_dev) || adreno_is_a660(adreno_dev))
L99: struct adreno_ringbuffer *rb = &adreno_dev->ringbuffers[0];
  {
  struct adreno_perfcount_register *reg = &group->regs[counter];
  u32 cmds[3];
  int ret;
L111: ret = a6xx_ringbuffer_addcmds(adreno_dev, rb, NULL,
  
  /* submit to highest priority RB always */
  F_NOTPROTECTED, cmds, 3, 0, NULL);
  if (ret)
L125: ret = adreno_ringbuffer_waittimestamp(rb, rb->timestamp,
  
  /* wait for the above commands submitted to complete */
  ADRENO_IDLE_TIMEOUT);
  
L305: static void a6xx_write_gmu_counter_enable(struct kgsl_device *device,
  }
  
  struct adreno_perfcount_register *reg, u32 bit, u32 countable)
  {
L317: static int a6xx_counter_gmu_xoclk_enable(struct adreno_device *adreno_dev,
  }
  
  const struct adreno_perfcount_group *group,
  unsigned int counter, unsigned int countable)
L341: a6xx_write_gmu_counter_enable(device, reg, counter * 8, countable);
  counter -= 6;
  
  
  reg->value = 0;
L345: kgsl_regwrite(device, A6XX_GMU_CX_GMU_POWER_COUNTER_ENABLE, 1);
  reg->value = 0;
  
  
  return 0;
L350: static int a6xx_counter_gmu_gmuclk_enable(struct adreno_device *adreno_dev,
  }
  
  const struct adreno_perfcount_group *group,
  unsigned int counter, unsigned int countable)
L361: * The two counters are stuck into GMU_CX_GMU_POWER_COUNTER_SELECT_1
  
  /*
  * at bit offset 16 and 24
  */
L364: a6xx_write_gmu_counter_enable(device, reg,
  * at bit offset 16 and 24
  */
  16 + (counter * 8), countable);
  
L367: kgsl_regwrite(device, A6XX_GMU_CX_GMU_POWER_COUNTER_ENABLE, 1);
  16 + (counter * 8), countable);
  
  
  reg->value = 0;
L373: static int a6xx_counter_gmu_perf_enable(struct adreno_device *adreno_dev,
  }
  
  const struct adreno_perfcount_group *group,
  unsigned int counter, unsigned int countable)
L391: a6xx_write_gmu_counter_enable(device, reg, counter * 8, countable);
  counter -= 4;
  
  
  kgsl_regwrite(device, A6XX_GMU_CX_GMU_PERF_COUNTER_ENABLE, 1);
L393: kgsl_regwrite(device, A6XX_GMU_CX_GMU_PERF_COUNTER_ENABLE, 1);
  a6xx_write_gmu_counter_enable(device, reg, counter * 8, countable);
  
  
  reg->value = 0;
L740: #define GMU_COUNTER(lo, hi, sel) \
  };
  
  { .countable = KGSL_PERFCOUNTER_NOT_USED, \
  .offset = lo, .offset_hi = hi, .select = sel }
L744: #define GMU_COUNTER_RESERVED(lo, hi, sel) \
  .offset = lo, .offset_hi = hi, .select = sel }
  
  { .countable = KGSL_PERFCOUNTER_BROKEN, \
  .offset = lo, .offset_hi = hi, .select = sel }
L748: static struct adreno_perfcount_register a6xx_perfcounters_gmu_xoclk[] = {
  .offset = lo, .offset_hi = hi, .select = sel }
  
  /*
  * COUNTER_XOCLK_0 and COUNTER_XOCLK_4 are used for the GPU
L754: GMU_COUNTER_RESERVED(A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_0_L,
  * are not re-used.
  */
  A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_0_H,
  A6XX_GMU_CX_GMU_POWER_COUNTER_SELECT_0),
L755: A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_0_H,
  */
  GMU_COUNTER_RESERVED(A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_0_L,
  A6XX_GMU_CX_GMU_POWER_COUNTER_SELECT_0),
  GMU_COUNTER(A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_1_L,
L756: A6XX_GMU_CX_GMU_POWER_COUNTER_SELECT_0),
  GMU_COUNTER_RESERVED(A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_0_L,
  A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_0_H,
  GMU_COUNTER(A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_1_L,
  A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_1_H,
L757: GMU_COUNTER(A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_1_L,
  A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_0_H,
  A6XX_GMU_CX_GMU_POWER_COUNTER_SELECT_0),
  A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_1_H,
  A6XX_GMU_CX_GMU_POWER_COUNTER_SELECT_0),
L758: A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_1_H,
  A6XX_GMU_CX_GMU_POWER_COUNTER_SELECT_0),
  GMU_COUNTER(A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_1_L,
  A6XX_GMU_CX_GMU_POWER_COUNTER_SELECT_0),
  GMU_COUNTER(A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_2_L,
L759: A6XX_GMU_CX_GMU_POWER_COUNTER_SELECT_0),
  GMU_COUNTER(A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_1_L,
  A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_1_H,
  GMU_COUNTER(A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_2_L,
  A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_2_H,
L760: GMU_COUNTER(A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_2_L,
  A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_1_H,
  A6XX_GMU_CX_GMU_POWER_COUNTER_SELECT_0),
  A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_2_H,
  A6XX_GMU_CX_GMU_POWER_COUNTER_SELECT_0),
L761: A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_2_H,
  A6XX_GMU_CX_GMU_POWER_COUNTER_SELECT_0),
  GMU_COUNTER(A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_2_L,
  A6XX_GMU_CX_GMU_POWER_COUNTER_SELECT_0),
  GMU_COUNTER(A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_3_L,
L762: A6XX_GMU_CX_GMU_POWER_COUNTER_SELECT_0),
  GMU_COUNTER(A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_2_L,
  A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_2_H,
  GMU_COUNTER(A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_3_L,
  A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_3_H,
L763: GMU_COUNTER(A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_3_L,
  A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_2_H,
  A6XX_GMU_CX_GMU_POWER_COUNTER_SELECT_0),
  A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_3_H,
  A6XX_GMU_CX_GMU_POWER_COUNTER_SELECT_0),
L764: A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_3_H,
  A6XX_GMU_CX_GMU_POWER_COUNTER_SELECT_0),
  GMU_COUNTER(A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_3_L,
  A6XX_GMU_CX_GMU_POWER_COUNTER_SELECT_0),
  GMU_COUNTER_RESERVED(A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_4_L,

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_a6xx_preempt.c =====
L14: offsetof(struct a6xx_cp_preemption_record, _field)
  
  #define PREEMPT_RECORD(_field) \
  
  #define PREEMPT_SMMU_RECORD(_field) \
L16: #define PREEMPT_SMMU_RECORD(_field) \
  offsetof(struct a6xx_cp_preemption_record, _field)
  
  offsetof(struct a6xx_cp_smmu_info, _field)
  
L17: offsetof(struct a6xx_cp_smmu_info, _field)
  
  #define PREEMPT_SMMU_RECORD(_field) \
  
  static void _update_wptr(struct adreno_device *adreno_dev, bool reset_timer,
L23: struct adreno_ringbuffer *rb = adreno_dev->cur_rb;
  {
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
  unsigned long flags;
  int ret = 0;
L62: gmu_core_fault_snapshot(device, GMU_FAULT_PANIC_NONE);
  /* If WPTR update fails, set the fault and trigger recovery */
  if (ret) {
  adreno_scheduler_fault(adreno_dev,
  ADRENO_GMU_FAULT_SKIP_SNAPSHOT);
L64: ADRENO_GMU_FAULT_SKIP_SNAPSHOT);
  gmu_core_fault_snapshot(device, GMU_FAULT_PANIC_NONE);
  adreno_scheduler_fault(adreno_dev,
  }
  }
L73: if (!gmu_core_isenabled(device))
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
  
  return;
  
L79: gmu_core_regwrite(device,
  if (adreno_is_a660(adreno_dev) ||
  adreno_is_a663(adreno_dev))
  A6XX_GMU_PWR_COL_PREEMPT_KEEPALIVE, 0x1);
  else
L80: A6XX_GMU_PWR_COL_PREEMPT_KEEPALIVE, 0x1);
  adreno_is_a663(adreno_dev))
  gmu_core_regwrite(device,
  else
  gmu_core_regrmw(device,
L82: gmu_core_regrmw(device,
  A6XX_GMU_PWR_COL_PREEMPT_KEEPALIVE, 0x1);
  else
  A6XX_GMU_AO_SPARE_CNTL, 0x0, 0x2);
  } else {
L83: A6XX_GMU_AO_SPARE_CNTL, 0x0, 0x2);
  else
  gmu_core_regrmw(device,
  } else {
  if (adreno_is_a660(adreno_dev) ||
L87: gmu_core_regwrite(device,
  if (adreno_is_a660(adreno_dev) ||
  adreno_is_a663(adreno_dev))
  A6XX_GMU_PWR_COL_PREEMPT_KEEPALIVE, 0x0);
  else
L88: A6XX_GMU_PWR_COL_PREEMPT_KEEPALIVE, 0x0);
  adreno_is_a663(adreno_dev))
  gmu_core_regwrite(device,
  else
  gmu_core_regrmw(device,
L90: gmu_core_regrmw(device,
  A6XX_GMU_PWR_COL_PREEMPT_KEEPALIVE, 0x0);
  else
  A6XX_GMU_AO_SPARE_CNTL, 0x2, 0x0);
  }
L91: A6XX_GMU_AO_SPARE_CNTL, 0x2, 0x0);
  else
  gmu_core_regrmw(device,
  }
  }
L95: static void _a6xx_preemption_done(struct adreno_device *adreno_dev)
  }
  
  {
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
L108: kgsl_regread(device, A6XX_CP_CONTEXT_SWITCH_CNTL, &status);
  return;
  
  
  if (status & 0x1) {
L112: "Preemption not complete: status=%X cur=%d R/W=%X/%X next=%d R/W=%X/%X\n",
  if (status & 0x1) {
  dev_err(device->dev,
  status, adreno_dev->cur_rb->id,
  adreno_get_rptr(adreno_dev->cur_rb),
L129: * In normal scenarios, preemption keep alive bit is cleared during
  
  /*
  * CP interrupt callback. However, if preemption is successful
  * immediately after preemption timer expires or there is a preemption
L130: * CP interrupt callback. However, if preemption is successful
  /*
  * In normal scenarios, preemption keep alive bit is cleared during
  * immediately after preemption timer expires or there is a preemption
  * interrupt with non-zero status, the state is transitioned to complete
L131: * immediately after preemption timer expires or there is a preemption
  * In normal scenarios, preemption keep alive bit is cleared during
  * CP interrupt callback. However, if preemption is successful
  * interrupt with non-zero status, the state is transitioned to complete
  * state. Once dispatcher is scheduled, it calls this function.
L134: * We can now safely clear the preemption keepalive bit, allowing
  * interrupt with non-zero status, the state is transitioned to complete
  * state. Once dispatcher is scheduled, it calls this function.
  * power collapse to resume its regular activity.
  */
L141: kgsl_regread(device,  A6XX_CP_CONTEXT_SWITCH_LEVEL_STATUS, &status);
  kgsl_delete_timer_sync(&adreno_dev->preempt.timer);
  
  
  trace_adreno_preempt_done(adreno_dev->cur_rb->id, adreno_dev->next_rb->id,
L162: static void _a6xx_preemption_fault(struct adreno_device *adreno_dev)
  }
  
  {
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
L168: * If the power is on check the preemption status one more time - if it
  
  /*
  * was successful then just transition to the complete state
  */
L172: kgsl_regread(device, A6XX_CP_CONTEXT_SWITCH_CNTL, &status);
  */
  if (kgsl_state_is_awake(device)) {
  
  if (!(status & 0x1)) {
L184: "Preemption Fault: cur=%d R/W=0x%x/0x%x, next=%d R/W=0x%x/0x%x\n",
  
  dev_err(device->dev,
  adreno_dev->cur_rb->id,
  adreno_get_rptr(adreno_dev->cur_rb),
L195: static void _a6xx_preemption_worker(struct work_struct *work)
  }
  
  {
  struct adreno_preemption *preempt = container_of(work,
L197: struct adreno_preemption *preempt = container_of(work,
  static void _a6xx_preemption_worker(struct work_struct *work)
  {
  struct adreno_preemption, work);
  struct adreno_device *adreno_dev = container_of(preempt,
L198: struct adreno_preemption, work);
  {
  struct adreno_preemption *preempt = container_of(work,
  struct adreno_device *adreno_dev = container_of(preempt,
  struct adreno_device, preempt);

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_a6xx_rgmu.c =====
L10: #include <linux/firmware.h>
  #include <linux/component.h>
  #include <linux/delay.h>
  #include <linux/io.h>
  #include <linux/of.h>
L17: #include "adreno_a6xx_rgmu.h"
  #include "adreno.h"
  #include "adreno_a6xx.h"
  #include "adreno_snapshot.h"
  #include "kgsl_bus.h"
L23: #define RGMU_CLK_FREQ 200000000
  #include "kgsl_util.h"
  
  
  /* RGMU timeouts */
L25: /* RGMU timeouts */
  #define RGMU_CLK_FREQ 200000000
  
  #define RGMU_IDLE_TIMEOUT		100	/* ms */
  #define RGMU_START_TIMEOUT		100	/* ms */
L26: #define RGMU_IDLE_TIMEOUT		100	/* ms */
  
  /* RGMU timeouts */
  #define RGMU_START_TIMEOUT		100	/* ms */
  #define GPU_START_TIMEOUT		100	/* ms */
L27: #define RGMU_START_TIMEOUT		100	/* ms */
  /* RGMU timeouts */
  #define RGMU_IDLE_TIMEOUT		100	/* ms */
  #define GPU_START_TIMEOUT		100	/* ms */
  #define GLM_SLEEP_TIMEOUT		10	/* ms */
L28: #define GPU_START_TIMEOUT		100	/* ms */
  #define RGMU_IDLE_TIMEOUT		100	/* ms */
  #define RGMU_START_TIMEOUT		100	/* ms */
  #define GLM_SLEEP_TIMEOUT		10	/* ms */
  
L31: static const unsigned int a6xx_rgmu_registers[] = {
  #define GLM_SLEEP_TIMEOUT		10	/* ms */
  
  /* GMU CX */
  0x1F80F, 0x1F83D, 0x1F840, 0x1F8D8, 0x1F990, 0x1F99E, 0x1F9C0, 0x1F9CC,
L32: /* GMU CX */
  
  static const unsigned int a6xx_rgmu_registers[] = {
  0x1F80F, 0x1F83D, 0x1F840, 0x1F8D8, 0x1F990, 0x1F99E, 0x1F9C0, 0x1F9CC,
  /* GMU AO */
L34: /* GMU AO */
  /* GMU CX */
  0x1F80F, 0x1F83D, 0x1F840, 0x1F8D8, 0x1F990, 0x1F99E, 0x1F9C0, 0x1F9CC,
  0x23B03, 0x23B16, 0x23B80, 0x23B82,
  /* GPU CC */
L44: static struct a6xx_rgmu_device *to_a6xx_rgmu(struct adreno_device *adreno_dev)
  };
  
  {
  struct a6xx_device *a6xx_dev = container_of(adreno_dev,
L49: return &a6xx_dev->rgmu;
  struct a6xx_device, adreno_dev);
  
  }
  
L52: static irqreturn_t a6xx_rgmu_irq_handler(int irq, void *data)
  }
  
  {
  struct kgsl_device *device = data;
L55: struct a6xx_rgmu_device *rgmu = to_a6xx_rgmu(ADRENO_DEVICE(device));
  {
  struct kgsl_device *device = data;
  unsigned int status = 0;
  
L58: gmu_core_regread(device, A6XX_GMU_AO_HOST_INTERRUPT_STATUS, &status);
  unsigned int status = 0;
  
  
  if (status & RGMU_AO_IRQ_FENCE_ERR) {
L60: if (status & RGMU_AO_IRQ_FENCE_ERR) {
  gmu_core_regread(device, A6XX_GMU_AO_HOST_INTERRUPT_STATUS, &status);
  
  unsigned int fence_status;
  
L63: gmu_core_regread(device, A6XX_GMU_AHB_FENCE_STATUS,
  unsigned int fence_status;
  
  &fence_status);
  gmu_core_regwrite(device, A6XX_GMU_AO_HOST_INTERRUPT_CLR,
L65: gmu_core_regwrite(device, A6XX_GMU_AO_HOST_INTERRUPT_CLR,
  gmu_core_regread(device, A6XX_GMU_AHB_FENCE_STATUS,
  &fence_status);
  status);
  
L68: dev_err_ratelimited(&rgmu->pdev->dev,
  status);
  
  "FENCE error interrupt received %x\n", fence_status);
  }
L72: if (status & ~RGMU_AO_IRQ_MASK)
  }
  
  dev_err_ratelimited(&rgmu->pdev->dev,
  "Unhandled RGMU interrupts 0x%lx\n",
L73: dev_err_ratelimited(&rgmu->pdev->dev,
  
  if (status & ~RGMU_AO_IRQ_MASK)
  "Unhandled RGMU interrupts 0x%lx\n",
  status & ~RGMU_AO_IRQ_MASK);
L74: "Unhandled RGMU interrupts 0x%lx\n",
  if (status & ~RGMU_AO_IRQ_MASK)
  dev_err_ratelimited(&rgmu->pdev->dev,
  status & ~RGMU_AO_IRQ_MASK);
  
L75: status & ~RGMU_AO_IRQ_MASK);
  dev_err_ratelimited(&rgmu->pdev->dev,
  "Unhandled RGMU interrupts 0x%lx\n",
  
  return IRQ_HANDLED;
L80: static irqreturn_t a6xx_oob_irq_handler(int irq, void *data)
  }
  
  {
  struct kgsl_device *device = data;
L84: struct a6xx_rgmu_device *rgmu = to_a6xx_rgmu(adreno_dev);
  struct kgsl_device *device = data;
  struct adreno_device *adreno_dev = ADRENO_DEVICE(device);
  unsigned int status = 0;
  
L87: gmu_core_regread(device, A6XX_GMU_GMU2HOST_INTR_INFO, &status);
  unsigned int status = 0;
  
  
  if (status & RGMU_OOB_IRQ_ERR_MSG) {
L89: if (status & RGMU_OOB_IRQ_ERR_MSG) {
  gmu_core_regread(device, A6XX_GMU_GMU2HOST_INTR_INFO, &status);
  
  gmu_core_regwrite(device, A6XX_GMU_GMU2HOST_INTR_CLR, status);
  
L90: gmu_core_regwrite(device, A6XX_GMU_GMU2HOST_INTR_CLR, status);
  
  if (status & RGMU_OOB_IRQ_ERR_MSG) {
  
  dev_err_ratelimited(&rgmu->pdev->dev,
L92: dev_err_ratelimited(&rgmu->pdev->dev,
  gmu_core_regwrite(device, A6XX_GMU_GMU2HOST_INTR_CLR, status);
  
  "RGMU oob irq error\n");
  adreno_scheduler_fault(adreno_dev, ADRENO_GMU_FAULT);
L93: "RGMU oob irq error\n");
  
  dev_err_ratelimited(&rgmu->pdev->dev,
  adreno_scheduler_fault(adreno_dev, ADRENO_GMU_FAULT);
  }

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_a6xx_rgmu.h =====
L6: #ifndef __ADRENO_A6XX_RGMU_H
  * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
  */
  #define __ADRENO_A6XX_RGMU_H
  
L7: #define __ADRENO_A6XX_RGMU_H
  */
  #ifndef __ADRENO_A6XX_RGMU_H
  
  #define RGMU_AO_IRQ_FENCE_ERR		BIT(3)
L9: #define RGMU_AO_IRQ_FENCE_ERR		BIT(3)
  #define __ADRENO_A6XX_RGMU_H
  
  #define RGMU_AO_IRQ_MASK			RGMU_AO_IRQ_FENCE_ERR
  
L10: #define RGMU_AO_IRQ_MASK			RGMU_AO_IRQ_FENCE_ERR
  
  #define RGMU_AO_IRQ_FENCE_ERR		BIT(3)
  
  #define RGMU_OOB_IRQ_ERR_MSG		BIT(24)
L12: #define RGMU_OOB_IRQ_ERR_MSG		BIT(24)
  #define RGMU_AO_IRQ_MASK			RGMU_AO_IRQ_FENCE_ERR
  
  #define RGMU_OOB_IRQ_ACK_MASK		GENMASK(23, 16)
  #define RGMU_OOB_IRQ_ERR_MSG_MASK	GENMASK(31, 24)
L13: #define RGMU_OOB_IRQ_ACK_MASK		GENMASK(23, 16)
  
  #define RGMU_OOB_IRQ_ERR_MSG		BIT(24)
  #define RGMU_OOB_IRQ_ERR_MSG_MASK	GENMASK(31, 24)
  #define RGMU_OOB_IRQ_MASK		RGMU_OOB_IRQ_ERR_MSG_MASK
L14: #define RGMU_OOB_IRQ_ERR_MSG_MASK	GENMASK(31, 24)
  #define RGMU_OOB_IRQ_ERR_MSG		BIT(24)
  #define RGMU_OOB_IRQ_ACK_MASK		GENMASK(23, 16)
  #define RGMU_OOB_IRQ_MASK		RGMU_OOB_IRQ_ERR_MSG_MASK
  
L15: #define RGMU_OOB_IRQ_MASK		RGMU_OOB_IRQ_ERR_MSG_MASK
  #define RGMU_OOB_IRQ_ACK_MASK		GENMASK(23, 16)
  #define RGMU_OOB_IRQ_ERR_MSG_MASK	GENMASK(31, 24)
  
  #define MAX_RGMU_CLKS  8
L17: #define MAX_RGMU_CLKS  8
  #define RGMU_OOB_IRQ_MASK		RGMU_OOB_IRQ_ERR_MSG_MASK
  
  
  enum {
L20: /* @RGMU_PRIV_FIRST_BOOT_DONE: The very first ggpu boot is done */
  
  enum {
  RGMU_PRIV_FIRST_BOOT_DONE,
  /* @RGMU_PRIV_GPU_STARTED: GPU has been started */
L21: RGMU_PRIV_FIRST_BOOT_DONE,
  enum {
  /* @RGMU_PRIV_FIRST_BOOT_DONE: The very first ggpu boot is done */
  /* @RGMU_PRIV_GPU_STARTED: GPU has been started */
  RGMU_PRIV_GPU_STARTED,
L22: /* @RGMU_PRIV_GPU_STARTED: GPU has been started */
  /* @RGMU_PRIV_FIRST_BOOT_DONE: The very first ggpu boot is done */
  RGMU_PRIV_FIRST_BOOT_DONE,
  RGMU_PRIV_GPU_STARTED,
  /* @RGMU_PRIV_PM_SUSPEND: The rgmu driver is suspended */
L23: RGMU_PRIV_GPU_STARTED,
  RGMU_PRIV_FIRST_BOOT_DONE,
  /* @RGMU_PRIV_GPU_STARTED: GPU has been started */
  /* @RGMU_PRIV_PM_SUSPEND: The rgmu driver is suspended */
  RGMU_PRIV_PM_SUSPEND,
L24: /* @RGMU_PRIV_PM_SUSPEND: The rgmu driver is suspended */
  /* @RGMU_PRIV_GPU_STARTED: GPU has been started */
  RGMU_PRIV_GPU_STARTED,
  RGMU_PRIV_PM_SUSPEND,
  };
L25: RGMU_PRIV_PM_SUSPEND,
  RGMU_PRIV_GPU_STARTED,
  /* @RGMU_PRIV_PM_SUSPEND: The rgmu driver is suspended */
  };
  
L29: * struct a6xx_rgmu_device - rGMU device structure
  
  /**
  * @ver: RGMU firmware version
  * @rgmu_interrupt_num: RGMU interrupt number
L30: * @ver: RGMU firmware version
  /**
  * struct a6xx_rgmu_device - rGMU device structure
  * @rgmu_interrupt_num: RGMU interrupt number
  * @oob_interrupt_num: number of RGMU asserted OOB interrupt
L31: * @rgmu_interrupt_num: RGMU interrupt number
  * struct a6xx_rgmu_device - rGMU device structure
  * @ver: RGMU firmware version
  * @oob_interrupt_num: number of RGMU asserted OOB interrupt
  * @fw_hostptr: Buffer which holds the RGMU firmware
L32: * @oob_interrupt_num: number of RGMU asserted OOB interrupt
  * @ver: RGMU firmware version
  * @rgmu_interrupt_num: RGMU interrupt number
  * @fw_hostptr: Buffer which holds the RGMU firmware
  * @fw_size: Size of RGMU firmware buffer
L33: * @fw_hostptr: Buffer which holds the RGMU firmware
  * @rgmu_interrupt_num: RGMU interrupt number
  * @oob_interrupt_num: number of RGMU asserted OOB interrupt
  * @fw_size: Size of RGMU firmware buffer
  * @clks: RGMU clocks including the GPU
L34: * @fw_size: Size of RGMU firmware buffer
  * @oob_interrupt_num: number of RGMU asserted OOB interrupt
  * @fw_hostptr: Buffer which holds the RGMU firmware
  * @clks: RGMU clocks including the GPU
  * @gpu_clk: Pointer to GPU core clock
L35: * @clks: RGMU clocks including the GPU
  * @fw_hostptr: Buffer which holds the RGMU firmware
  * @fw_size: Size of RGMU firmware buffer
  * @gpu_clk: Pointer to GPU core clock
  * @rgmu_clk: Pointer to rgmu clock
L37: * @rgmu_clk: Pointer to rgmu clock
  * @clks: RGMU clocks including the GPU
  * @gpu_clk: Pointer to GPU core clock
  * @flags: RGMU flags
  * @idle_level: Minimal GPU idle power level
L38: * @flags: RGMU flags
  * @gpu_clk: Pointer to GPU core clock
  * @rgmu_clk: Pointer to rgmu clock
  * @idle_level: Minimal GPU idle power level
  * @fault_count: RGMU fault count
L40: * @fault_count: RGMU fault count
  * @flags: RGMU flags
  * @idle_level: Minimal GPU idle power level
  */
  struct a6xx_rgmu_device {
L42: struct a6xx_rgmu_device {
  * @fault_count: RGMU fault count
  */
  u32 ver;
  struct platform_device *pdev;
L45: unsigned int rgmu_interrupt_num;
  u32 ver;
  struct platform_device *pdev;
  unsigned int oob_interrupt_num;
  unsigned int *fw_hostptr;
L53: struct clk *rgmu_clk;
  int num_clks;
  struct clk *gpu_clk;
  unsigned int idle_level;
  unsigned int fault_count;
L56: /** @flags: rgmu internal flags */
  unsigned int idle_level;
  unsigned int fault_count;
  unsigned long flags;
  /** @num_oob_perfcntr: Number of active oob_perfcntr requests */
L63: * a6xx_rgmu_device_probe - Probe a6xx rgmu resources
  
  /**
  * @pdev: Pointer to the platform device
  * @chipid: Chipid of the target

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_a6xx_ringbuffer.c =====
L10: #include "adreno_ringbuffer.h"
  #include "adreno_a6xx.h"
  #include "adreno_pm4types.h"
  #include "adreno_trace.h"
  #include "kgsl_trace.h"
L15: struct adreno_ringbuffer *rb, struct adreno_context *drawctxt,
  
  static int a6xx_rb_pagetable_switch(struct adreno_device *adreno_dev,
  struct kgsl_pagetable *pagetable, u32 *cmds)
  {
L26: cmds[count++] = cp_type7_packet(CP_SMMU_TABLE_UPDATE, 3);
  return 0;
  
  cmds[count++] = lower_32_bits(ttbr0);
  cmds[count++] = upper_32_bits(ttbr0);
L57: static int a6xx_rb_context_switch(struct adreno_device *adreno_dev,
  }
  
  struct adreno_ringbuffer *rb,
  struct adreno_context *drawctxt)
L58: struct adreno_ringbuffer *rb,
  
  static int a6xx_rb_context_switch(struct adreno_device *adreno_dev,
  struct adreno_context *drawctxt)
  {
L94: cmds[count++] = lower_32_bits(MEMSTORE_RB_GPU_ADDR(device, rb,
  
  cmds[count++] = cp_type7_packet(CP_MEM_WRITE, 3);
  current_context));
  cmds[count++] = upper_32_bits(MEMSTORE_RB_GPU_ADDR(device, rb,
L96: cmds[count++] = upper_32_bits(MEMSTORE_RB_GPU_ADDR(device, rb,
  cmds[count++] = lower_32_bits(MEMSTORE_RB_GPU_ADDR(device, rb,
  current_context));
  current_context));
  cmds[count++] = drawctxt->base.id;
L101: cmds[count++] = lower_32_bits(MEMSTORE_ID_GPU_ADDR(device,
  
  cmds[count++] = cp_type7_packet(CP_MEM_WRITE, 3);
  KGSL_MEMSTORE_GLOBAL, current_context));
  cmds[count++] = upper_32_bits(MEMSTORE_ID_GPU_ADDR(device,
L102: KGSL_MEMSTORE_GLOBAL, current_context));
  cmds[count++] = cp_type7_packet(CP_MEM_WRITE, 3);
  cmds[count++] = lower_32_bits(MEMSTORE_ID_GPU_ADDR(device,
  cmds[count++] = upper_32_bits(MEMSTORE_ID_GPU_ADDR(device,
  KGSL_MEMSTORE_GLOBAL, current_context));
L103: cmds[count++] = upper_32_bits(MEMSTORE_ID_GPU_ADDR(device,
  cmds[count++] = lower_32_bits(MEMSTORE_ID_GPU_ADDR(device,
  KGSL_MEMSTORE_GLOBAL, current_context));
  KGSL_MEMSTORE_GLOBAL, current_context));
  cmds[count++] = drawctxt->base.id;
L104: KGSL_MEMSTORE_GLOBAL, current_context));
  KGSL_MEMSTORE_GLOBAL, current_context));
  cmds[count++] = upper_32_bits(MEMSTORE_ID_GPU_ADDR(device,
  cmds[count++] = drawctxt->base.id;
  
L107: cmds[count++] = cp_type7_packet(CP_EVENT_WRITE, 1);
  cmds[count++] = drawctxt->base.id;
  
  cmds[count++] = 0x31;
  
L110: return a6xx_ringbuffer_addcmds(adreno_dev, rb, NULL, F_NOTPROTECTED,
  cmds[count++] = 0x31;
  
  cmds, count, 0, NULL);
  }
L114: #define RB_SOPTIMESTAMP(device, rb) \
  }
  
  MEMSTORE_RB_GPU_ADDR(device, rb, soptimestamp)
  #define CTXT_SOPTIMESTAMP(device, drawctxt) \
L115: MEMSTORE_RB_GPU_ADDR(device, rb, soptimestamp)
  
  #define RB_SOPTIMESTAMP(device, rb) \
  #define CTXT_SOPTIMESTAMP(device, drawctxt) \
  MEMSTORE_ID_GPU_ADDR(device, (drawctxt)->base.id, soptimestamp)
L116: #define CTXT_SOPTIMESTAMP(device, drawctxt) \
  #define RB_SOPTIMESTAMP(device, rb) \
  MEMSTORE_RB_GPU_ADDR(device, rb, soptimestamp)
  MEMSTORE_ID_GPU_ADDR(device, (drawctxt)->base.id, soptimestamp)
  
L117: MEMSTORE_ID_GPU_ADDR(device, (drawctxt)->base.id, soptimestamp)
  MEMSTORE_RB_GPU_ADDR(device, rb, soptimestamp)
  #define CTXT_SOPTIMESTAMP(device, drawctxt) \
  
  #define RB_EOPTIMESTAMP(device, rb) \
L119: #define RB_EOPTIMESTAMP(device, rb) \
  MEMSTORE_ID_GPU_ADDR(device, (drawctxt)->base.id, soptimestamp)
  
  MEMSTORE_RB_GPU_ADDR(device, rb, eoptimestamp)
  #define CTXT_EOPTIMESTAMP(device, drawctxt) \
L120: MEMSTORE_RB_GPU_ADDR(device, rb, eoptimestamp)
  
  #define RB_EOPTIMESTAMP(device, rb) \
  #define CTXT_EOPTIMESTAMP(device, drawctxt) \
  MEMSTORE_ID_GPU_ADDR(device, (drawctxt)->base.id, eoptimestamp)
L121: #define CTXT_EOPTIMESTAMP(device, drawctxt) \
  #define RB_EOPTIMESTAMP(device, rb) \
  MEMSTORE_RB_GPU_ADDR(device, rb, eoptimestamp)
  MEMSTORE_ID_GPU_ADDR(device, (drawctxt)->base.id, eoptimestamp)
  
L122: MEMSTORE_ID_GPU_ADDR(device, (drawctxt)->base.id, eoptimestamp)
  MEMSTORE_RB_GPU_ADDR(device, rb, eoptimestamp)
  #define CTXT_EOPTIMESTAMP(device, drawctxt) \
  
  int a6xx_ringbuffer_submit(struct adreno_ringbuffer *rb,
L124: int a6xx_ringbuffer_submit(struct adreno_ringbuffer *rb,
  MEMSTORE_ID_GPU_ADDR(device, (drawctxt)->base.id, eoptimestamp)
  
  struct adreno_submit_time *time, bool sync)
  {
L136: u32 *cmds = adreno_ringbuffer_allocspace(rb, 3);
  
  if (sync && !ADRENO_FEATURE(adreno_dev, ADRENO_APRIV)) {
  
  if (IS_ERR(cmds))
L169: gmu_core_fault_snapshot(device, GMU_FAULT_PANIC_NONE);
  * recovery.
  */
  adreno_scheduler_fault(adreno_dev,
  ADRENO_GMU_FAULT_SKIP_SNAPSHOT);
L171: ADRENO_GMU_FAULT_SKIP_SNAPSHOT);
  gmu_core_fault_snapshot(device, GMU_FAULT_PANIC_NONE);
  adreno_scheduler_fault(adreno_dev,
  }
  
L177: int a6xx_ringbuffer_init(struct adreno_device *adreno_dev)
  }
  
  {
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
L188: adreno_dev->cur_rb = &(adreno_dev->ringbuffers[0]);
  return ret;
  
  
  if (!adreno_preemption_feature_set(adreno_dev)) {
L190: if (!adreno_preemption_feature_set(adreno_dev)) {
  adreno_dev->cur_rb = &(adreno_dev->ringbuffers[0]);
  
  adreno_dev->num_ringbuffers = 1;
  return adreno_ringbuffer_setup(adreno_dev,
L191: adreno_dev->num_ringbuffers = 1;
  
  if (!adreno_preemption_feature_set(adreno_dev)) {
  return adreno_ringbuffer_setup(adreno_dev,
  &adreno_dev->ringbuffers[0], 0);
L192: return adreno_ringbuffer_setup(adreno_dev,
  if (!adreno_preemption_feature_set(adreno_dev)) {
  adreno_dev->num_ringbuffers = 1;
  &adreno_dev->ringbuffers[0], 0);
  }

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_a6xx_rpmh.c =====
L9: #include "adreno_hfi.h"
  #include "adreno.h"
  #include "adreno_a6xx.h"
  #include "adreno_rpmh.h"
  #include "kgsl_bus.h"
L15: * setup_gmu_arc_votes - Build the gmu voting table
  
  /*
  * @adreno_dev: Pointer to adreno device
  * @pri_rail: Pointer to primary power rail vlvl table
L19: * @freqs: List of GMU frequencies
  * @pri_rail: Pointer to primary power rail vlvl table
  * @sec_rail: Pointer to second/dependent power rail vlvl table
  * @vlvls: List of GMU voltage levels
  *
L20: * @vlvls: List of GMU voltage levels
  * @sec_rail: Pointer to second/dependent power rail vlvl table
  * @freqs: List of GMU frequencies
  *
  * This function initializes the cx votes for all gmu frequencies
L22: * This function initializes the cx votes for all gmu frequencies
  * @vlvls: List of GMU voltage levels
  *
  * for gmu dcvs
  */
L23: * for gmu dcvs
  *
  * This function initializes the cx votes for all gmu frequencies
  */
  static int setup_cx_arc_votes(struct adreno_device *adreno_dev,
L29: /* Hardcoded values of GMU CX voltage levels */
  u32 *freqs, u32 *vlvls)
  {
  struct a6xx_gmu_device *gmu = to_a6xx_gmu(adreno_dev);
  struct a6xx_hfi *hfi = &gmu->hfi;
L30: struct a6xx_gmu_device *gmu = to_a6xx_gmu(adreno_dev);
  {
  /* Hardcoded values of GMU CX voltage levels */
  struct a6xx_hfi *hfi = &gmu->hfi;
  u16 gmu_cx_vlvl[MAX_CX_LEVELS_LEGACY];
L31: struct a6xx_hfi *hfi = &gmu->hfi;
  /* Hardcoded values of GMU CX voltage levels */
  struct a6xx_gmu_device *gmu = to_a6xx_gmu(adreno_dev);
  u16 gmu_cx_vlvl[MAX_CX_LEVELS_LEGACY];
  u32 cx_votes[MAX_CX_LEVELS_LEGACY];
L32: u16 gmu_cx_vlvl[MAX_CX_LEVELS_LEGACY];
  struct a6xx_gmu_device *gmu = to_a6xx_gmu(adreno_dev);
  struct a6xx_hfi *hfi = &gmu->hfi;
  u32 cx_votes[MAX_CX_LEVELS_LEGACY];
  struct hfi_dcvstable_cmd *table = &hfi->dcvs_table;
L34: struct hfi_dcvstable_cmd *table = &hfi->dcvs_table;
  u16 gmu_cx_vlvl[MAX_CX_LEVELS_LEGACY];
  u32 cx_votes[MAX_CX_LEVELS_LEGACY];
  int ret, i;
  
L37: gmu_cx_vlvl[0] = 0;
  int ret, i;
  
  gmu_cx_vlvl[1] = vlvls[0];
  gmu_cx_vlvl[2] = vlvls[1];
L38: gmu_cx_vlvl[1] = vlvls[0];
  
  gmu_cx_vlvl[0] = 0;
  gmu_cx_vlvl[2] = vlvls[1];
  
L39: gmu_cx_vlvl[2] = vlvls[1];
  gmu_cx_vlvl[0] = 0;
  gmu_cx_vlvl[1] = vlvls[0];
  
  table->gmu_level_num = 3;
L41: table->gmu_level_num = 3;
  gmu_cx_vlvl[2] = vlvls[1];
  
  
  table->cx_votes[0].freq = 0;
L48: sec_rail, gmu_cx_vlvl, table->gmu_level_num);
  
  ret = adreno_rpmh_setup_volt_dependency_tbl(cx_votes, pri_rail,
  if (!ret) {
  for (i = 0; i < table->gmu_level_num; i++)
L50: for (i = 0; i < table->gmu_level_num; i++)
  sec_rail, gmu_cx_vlvl, table->gmu_level_num);
  if (!ret) {
  table->cx_votes[i].vote = cx_votes[i];
  }
L59: * @hfi: Pointer to hfi device
  /*
  * setup_gx_arc_votes - Build the gpu dcvs voting table
  * @pri_rail: Pointer to primary power rail vlvl table
  * @sec_rail: Pointer to second/dependent power rail vlvl table
L71: struct a6xx_gmu_device *gmu = to_a6xx_gmu(adreno_dev);
  {
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
  struct kgsl_pwrctrl *pwr = &device->pwrctrl;
  struct hfi_dcvstable_cmd *table = &gmu->hfi.dcvs_table;
L73: struct hfi_dcvstable_cmd *table = &gmu->hfi.dcvs_table;
  struct a6xx_gmu_device *gmu = to_a6xx_gmu(adreno_dev);
  struct kgsl_pwrctrl *pwr = &device->pwrctrl;
  u32 index;
  u16 vlvl_tbl[MAX_GX_LEVELS];
L84: dev_err(GMU_PDEV_DEV(device),
  if (table->gpu_level_num > pri_rail->num ||
  table->gpu_level_num > ARRAY_SIZE(vlvl_tbl)) {
  "Defined more GPU DCVS levels than RPMh can support\n");
  return -ERANGE;
L93: /* Disable cx vote in gmu dcvs table if it is not supported in DT */
  table->gx_votes[0].freq = 0;
  table->gx_votes[0].dep_vote = 0;
  if (pwr->pwrlevels[0].cx_level == 0xffffffff)
  table->gx_votes[0].dep_vote = 0xffffffff;
L97: /* GMU power levels are in ascending order */
  table->gx_votes[0].dep_vote = 0xffffffff;
  
  for (index = 1, i = pwr->num_pwrlevels - 1; i >= 0; i--, index++) {
  u32 cx_vlvl = pwr->pwrlevels[i].cx_level;
L107: dev_err(GMU_PDEV_DEV(device), "Unsupported cx corner: %u\n",
  &table->gx_votes[index].dep_vote);
  if (ret) {
  cx_vlvl);
  return ret;
L126: struct a6xx_gmu_device *gmu = to_a6xx_gmu(adreno_dev);
  static int build_dcvs_table(struct adreno_device *adreno_dev)
  {
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
  struct a6xx_hfi *hfi = &gmu->hfi;
L128: struct a6xx_hfi *hfi = &gmu->hfi;
  struct a6xx_gmu_device *gmu = to_a6xx_gmu(adreno_dev);
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
  struct rpmh_arc_vals gx_arc, cx_arc, mx_arc;
  int ret;
L132: ret = CMD_MSG_HDR(hfi->dcvs_table, H2F_MSG_PERF_TBL);
  int ret;
  
  if (ret)
  return ret;
L149: device->gmu_core.freqs, device->gmu_core.vlvls);
  
  ret = setup_cx_arc_votes(adreno_dev, &cx_arc, &mx_arc,
  if (ret)
  return ret;
L156: /* BIT(3) is used to vote for GPU performance mode through GMU */
  }
  
  #define ACV_GPU_PERFMODE_VOTE	BIT(3)
  
L167: struct a6xx_gmu_device *gmu = to_a6xx_gmu(adreno_dev);
  static int build_bw_table(struct adreno_device *adreno_dev)
  {
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
  struct kgsl_pwrctrl *pwr = &device->pwrctrl;

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_a6xx_snapshot.c =====
L320: static const unsigned int a6xx_gmu_wrapper_registers[] = {
  };
  
  /* GMU CX */
  0x1f840, 0x1f840, 0x1f844, 0x1f845, 0x1f887, 0x1f889, 0x1f8d0, 0x1f8d0,
L321: /* GMU CX */
  
  static const unsigned int a6xx_gmu_wrapper_registers[] = {
  0x1f840, 0x1f840, 0x1f844, 0x1f845, 0x1f887, 0x1f889, 0x1f8d0, 0x1f8d0,
  /* GMU AO*/
L323: /* GMU AO*/
  /* GMU CX */
  0x1f840, 0x1f840, 0x1f844, 0x1f845, 0x1f887, 0x1f889, 0x1f8d0, 0x1f8d0,
  0x23b0C, 0x23b0E, 0x23b15, 0x23b15,
  };
L327: static const unsigned int a6xx_holi_gmu_wrapper_registers[] = {
  };
  
  /* GMU SPTPRAC */
  0x1a880, 0x1a881,
L328: /* GMU SPTPRAC */
  
  static const unsigned int a6xx_holi_gmu_wrapper_registers[] = {
  0x1a880, 0x1a881,
  /* GMU CX */
L330: /* GMU CX */
  /* GMU SPTPRAC */
  0x1a880, 0x1a881,
  0x1f840, 0x1f840, 0x1f844, 0x1f845, 0x1f887, 0x1f889, 0x1f8d0, 0x1f8d0,
  /* GMU AO*/
L332: /* GMU AO*/
  /* GMU CX */
  0x1f840, 0x1f840, 0x1f844, 0x1f845, 0x1f887, 0x1f889, 0x1f8d0, 0x1f8d0,
  0x23b0c, 0x23b0e, 0x23b15, 0x23b15,
  };
L354: A6XX_DBGBUS_GMU_CX       = 0x13,
  A6XX_DBGBUS_A2D          = 0x11,
  A6XX_DBGBUS_CCUFCHE      = 0x12,
  A6XX_DBGBUS_RBP          = 0x14,
  A6XX_DBGBUS_DCS          = 0x15,
L359: A6XX_DBGBUS_GMU_GX       = 0x18,
  A6XX_DBGBUS_RBBM_CFG     = 0x16,
  A6XX_DBGBUS_CX           = 0x17,
  A6XX_DBGBUS_TPFCHE       = 0x19,
  A6XX_DBGBUS_GBIF_GX      = 0x1a,
L415: { A6XX_DBGBUS_GMU_GX, 0x100, },
  { A6XX_DBGBUS_DCS, 0x100, },
  { A6XX_DBGBUS_RBBM_CFG, 0x100, },
  { A6XX_DBGBUS_TPFCHE, 0x100, },
  { A6XX_DBGBUS_GPC, 0x100, },
L442: { A6XX_DBGBUS_GMU_CX, 0x100, },
  
  static const struct adreno_debugbus_block a6xx_cx_dbgc_debugbus_blocks[] = {
  { A6XX_DBGBUS_CX, 0x100, },
  };
L1268: /* GMU_GX data is read using the GMU_CX block id on A630 */
  
  block_id = block->block_id;
  if ((adreno_is_a630(adreno_dev) || adreno_is_a615_family(adreno_dev)) &&
  (block_id == A6XX_DBGBUS_GMU_GX))
L1270: (block_id == A6XX_DBGBUS_GMU_GX))
  /* GMU_GX data is read using the GMU_CX block id on A630 */
  if ((adreno_is_a630(adreno_dev) || adreno_is_a615_family(adreno_dev)) &&
  block_id = A6XX_DBGBUS_GMU_CX;
  
L1271: block_id = A6XX_DBGBUS_GMU_CX;
  if ((adreno_is_a630(adreno_dev) || adreno_is_a615_family(adreno_dev)) &&
  (block_id == A6XX_DBGBUS_GMU_GX))
  
  for (i = 0; i < dwords; i++)
L1574: /* IF the SMMU is stalled we cannot do a crash dump */
  return;
  
  if (adreno_smmu_is_stalled(ADRENO_DEVICE(device)))
  return;
L1575: if (adreno_smmu_is_stalled(ADRENO_DEVICE(device)))
  
  /* IF the SMMU is stalled we cannot do a crash dump */
  return;
  
L1674: * GMU and GPU snapshot. Debugbus data can be accessed
  /*
  * Dump debugbus data here to capture it for both
  * even if the gx headswitch or sptprac is off. If gx
  * headswitch is off, data for gx blocks will show as
L1692: if (!gmu_core_isenabled(device)) {
  }
  
  if (adreno_is_a619_holi(adreno_dev))
  adreno_snapshot_registers(device, snapshot,
L1695: a6xx_holi_gmu_wrapper_registers,
  if (adreno_is_a619_holi(adreno_dev))
  adreno_snapshot_registers(device, snapshot,
  ARRAY_SIZE(a6xx_holi_gmu_wrapper_registers) / 2);
  else
L1696: ARRAY_SIZE(a6xx_holi_gmu_wrapper_registers) / 2);
  adreno_snapshot_registers(device, snapshot,
  a6xx_holi_gmu_wrapper_registers,
  else
  adreno_snapshot_registers(device, snapshot,
L1699: a6xx_gmu_wrapper_registers,
  else
  adreno_snapshot_registers(device, snapshot,
  ARRAY_SIZE(a6xx_gmu_wrapper_registers) / 2);
  }
L1700: ARRAY_SIZE(a6xx_gmu_wrapper_registers) / 2);
  adreno_snapshot_registers(device, snapshot,
  a6xx_gmu_wrapper_registers,
  }
  
L1703: sptprac_on = a6xx_gmu_sptprac_is_on(adreno_dev);
  }
  
  
  if (!adreno_gx_is_on(adreno_dev))
L1755: /* CP_SQE indexed registers */
  }
  
  kgsl_snapshot_indexed_registers(device, snapshot,
  A6XX_CP_SQE_STAT_ADDR, A6XX_CP_SQE_STAT_DATA, 0, 0x33);
L1757: A6XX_CP_SQE_STAT_ADDR, A6XX_CP_SQE_STAT_DATA, 0, 0x33);
  /* CP_SQE indexed registers */
  kgsl_snapshot_indexed_registers(device, snapshot,
  
  /* CP_DRAW_STATE */
L1764: /* SQE_UCODE Cache */
  0, 0x100);
  
  kgsl_snapshot_indexed_registers(device, snapshot,
  A6XX_CP_SQE_UCODE_DBG_ADDR, A6XX_CP_SQE_UCODE_DBG_DATA,
L1766: A6XX_CP_SQE_UCODE_DBG_ADDR, A6XX_CP_SQE_UCODE_DBG_DATA,
  /* SQE_UCODE Cache */
  kgsl_snapshot_indexed_registers(device, snapshot,
  0, 0x8000);
  
L1774: A6XX_CP_SQE_AC_STAT_ADDR, A6XX_CP_SQE_AC_STAT_DATA,
  
  kgsl_snapshot_indexed_registers(device, snapshot,
  0, 0x33);
  kgsl_snapshot_indexed_registers(device, snapshot,
L1780: A6XX_CP_SQE_AC_UCODE_DBG_ADDR,
  A6XX_CP_LPAC_DRAW_STATE_DATA, 0, 0x100);
  kgsl_snapshot_indexed_registers(device, snapshot,
  A6XX_CP_SQE_AC_UCODE_DBG_DATA, 0, 0x8000);
  
L1781: A6XX_CP_SQE_AC_UCODE_DBG_DATA, 0, 0x8000);
  kgsl_snapshot_indexed_registers(device, snapshot,
  A6XX_CP_SQE_AC_UCODE_DBG_ADDR,
  
  kgsl_regread(device, A6XX_CP_LPAC_ROQ_THRESHOLDS_2, &roq_size);

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_compat.c =====
L53: if (device->memstore->hostptr) {
  }
  memset(&shadowprop, 0, sizeof(shadowprop));
  /* Give a token address to identify memstore */
  shadowprop.gpuaddr = (unsigned int)
L54: /* Give a token address to identify memstore */
  memset(&shadowprop, 0, sizeof(shadowprop));
  if (device->memstore->hostptr) {
  shadowprop.gpuaddr = (unsigned int)
  KGSL_MEMSTORE_TOKEN_ADDRESS;
L56: KGSL_MEMSTORE_TOKEN_ADDRESS;
  /* Give a token address to identify memstore */
  shadowprop.gpuaddr = (unsigned int)
  shadowprop.size =
  (unsigned int) device->memstore->size;
L58: (unsigned int) device->memstore->size;
  KGSL_MEMSTORE_TOKEN_ADDRESS;
  shadowprop.size =
  /*
  * GSL needs this to be set, even if it
L64: KGSL_FLAGS_PER_CONTEXT_TIMESTAMPS;
  */
  shadowprop.flags = KGSL_FLAGS_INITIALIZED |
  }
  if (copy_to_user(param->value, &shadowprop,

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_coresight.c =====
L101: /* GMU takes care of DBGC interrupt mask for HWSCHED */
  adreno_dev->coresight_en_cnt--;
  
  if (!adreno_dev->coresight_en_cnt) {
  if (adreno_dev->hwsched_enabled)
L104: gmu_core_set_vrb_register(device->gmu_core.vrb,
  if (!adreno_dev->coresight_en_cnt) {
  if (adreno_dev->hwsched_enabled)
  VRB_DBGC_FAULT_ENABLE, 0);
  else
L198: /* GMU takes care of DBGC interrupt mask for HWSCHED */
  adreno_dev->coresight_en_cnt++;
  
  if (adreno_dev->coresight_en_cnt == 1) {
  if (adreno_dev->hwsched_enabled)
L201: gmu_core_set_vrb_register(device->gmu_core.vrb,
  if (adreno_dev->coresight_en_cnt == 1) {
  if (adreno_dev->hwsched_enabled)
  VRB_DBGC_FAULT_ENABLE, 1);
  else

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_debugfs.c =====
L236: case KGSL_CMD_SYNCPOINT_TYPE_TIMESTAMP: {
  {
  switch (sync_event->type) {
  seq_printf(s, "sync: ctx: %u ts: %u",
  sync_event->context->id, sync_event->timestamp);
L238: sync_event->context->id, sync_event->timestamp);
  case KGSL_CMD_SYNCPOINT_TYPE_TIMESTAMP: {
  seq_printf(s, "sync: ctx: %u ts: %u",
  break;
  }
L327: seq_printf(s, "\t %u ", drawobj->timestamp);
  seq_puts(s, " markerobj ");
  
  
  seq_puts(s, " priv: ");
L385: seq_puts(s, "timestamps: ");
  seq_puts(s, "\n");
  
  kgsl_readtimestamp(drawctxt->base.device, &drawctxt->base,
  KGSL_TIMESTAMP_QUEUED, &queued);
L386: kgsl_readtimestamp(drawctxt->base.device, &drawctxt->base,
  
  seq_puts(s, "timestamps: ");
  KGSL_TIMESTAMP_QUEUED, &queued);
  kgsl_readtimestamp(drawctxt->base.device, &drawctxt->base,
L387: KGSL_TIMESTAMP_QUEUED, &queued);
  seq_puts(s, "timestamps: ");
  kgsl_readtimestamp(drawctxt->base.device, &drawctxt->base,
  kgsl_readtimestamp(drawctxt->base.device, &drawctxt->base,
  KGSL_TIMESTAMP_CONSUMED, &consumed);
L388: kgsl_readtimestamp(drawctxt->base.device, &drawctxt->base,
  kgsl_readtimestamp(drawctxt->base.device, &drawctxt->base,
  KGSL_TIMESTAMP_QUEUED, &queued);
  KGSL_TIMESTAMP_CONSUMED, &consumed);
  kgsl_readtimestamp(drawctxt->base.device, &drawctxt->base,
L389: KGSL_TIMESTAMP_CONSUMED, &consumed);
  KGSL_TIMESTAMP_QUEUED, &queued);
  kgsl_readtimestamp(drawctxt->base.device, &drawctxt->base,
  kgsl_readtimestamp(drawctxt->base.device, &drawctxt->base,
  KGSL_TIMESTAMP_RETIRED, &retired);
L390: kgsl_readtimestamp(drawctxt->base.device, &drawctxt->base,
  kgsl_readtimestamp(drawctxt->base.device, &drawctxt->base,
  KGSL_TIMESTAMP_CONSUMED, &consumed);
  KGSL_TIMESTAMP_RETIRED, &retired);
  seq_printf(s, "queued: %u consumed: %u retired: %u global:%u\n",
L391: KGSL_TIMESTAMP_RETIRED, &retired);
  KGSL_TIMESTAMP_CONSUMED, &consumed);
  kgsl_readtimestamp(drawctxt->base.device, &drawctxt->base,
  seq_printf(s, "queued: %u consumed: %u retired: %u global:%u\n",
  queued, consumed, retired,
L394: drawctxt->internal_timestamp);
  seq_printf(s, "queued: %u consumed: %u retired: %u global:%u\n",
  queued, consumed, retired,
  
  seq_puts(s, "drawqueue:\n");
L408: seq_printf(s, "\t%d: %pS created: %u\n", event->timestamp,
  spin_lock(&drawctxt->base.events.lock);
  list_for_each_entry(event, &drawctxt->base.events.events, node)
  event->func, event->created);
  spin_unlock(&drawctxt->base.events.lock);
L469: const struct gmu_dev_ops *ops = GMU_DEVICE_OPS(device);
  {
  struct kgsl_device *device = data;
  
  if (ops && ops->bcl_sid_set)
L480: const struct gmu_dev_ops *ops = GMU_DEVICE_OPS(device);
  {
  struct kgsl_device *device = data;
  
  if (ops && ops->bcl_sid_get)
L492: const struct gmu_dev_ops *ops = GMU_DEVICE_OPS(device);
  {
  struct kgsl_device *device = data;
  
  if (ops && ops->bcl_sid_set)
L503: const struct gmu_dev_ops *ops = GMU_DEVICE_OPS(device);
  {
  struct kgsl_device *device = data;
  
  if (ops && ops->bcl_sid_get)
L515: const struct gmu_dev_ops *ops = GMU_DEVICE_OPS(device);
  {
  struct kgsl_device *device = data;
  
  if (ops && ops->bcl_sid_set)
L526: const struct gmu_dev_ops *ops = GMU_DEVICE_OPS(device);
  {
  struct kgsl_device *device = data;
  
  if (ops && ops->bcl_sid_get)
L628: struct gmu_core_device *gmu = &device->gmu_core;
  struct adreno_device *adreno_dev = data;
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
  
  *val = (u64)gmu->warmboot_enabled;
L630: *val = (u64)gmu->warmboot_enabled;
  struct gmu_core_device *gmu = &device->gmu_core;
  
  return 0;
  }
L636: * and all hfi messages will be recorded, so that warmboot can happen on subsequent slumber
  /*
  * When warmboot feature is enabled from debugfs, the first slumber exit will be a cold boot
  * exit. When warmboot feature is disabled from debugfs, every slumber exit will be a coldboot.
  */
L643: struct gmu_core_device *gmu_core = &device->gmu_core;
  struct adreno_device *adreno_dev = data;
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
  
  if (gmu_core->warmboot_enabled == val)
L645: if (gmu_core->warmboot_enabled == val)
  struct gmu_core_device *gmu_core = &device->gmu_core;
  
  return 0;
  
L648: return adreno_power_cycle_bool(adreno_dev, &gmu_core->warmboot_enabled, val);
  return 0;
  
  }
  
L658: if (!gmu_core_dev_ifpc_isenabled(KGSL_DEVICE(adreno_dev)))
  u32 hyst;
  
  return -EINVAL;
  
L685: const struct gmu_dev_ops *ops = GMU_DEVICE_OPS(device);
  {
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
  
  if (ops && ops->minbw_idle_level_set)
L696: /* Only 24 bits are allowed by GMU for this feature */
  u32 minbw_val;
  
  if (val & 0xffffffffff000000)
  return -EINVAL;
L702: (!ADRENO_FEATURE(adreno_dev, ADRENO_GMU_MINBW)))
  /* We cannot use minBW if IFPC or minBW is disabled */
  if (!ADRENO_FEATURE(adreno_dev, ADRENO_IFPC) ||
  return 0;
  
L720: static int _gmu_fp_store(void *data, u64 val)
  DEFINE_DEBUGFS_ATTRIBUTE(minbw_fops, _minbw_data_show, _minbw_data_store, "%llu\n");
  
  {
  struct adreno_device *adreno_dev = data;
L725: /* Max allowed GMU fault settings are 9 bits */
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
  
  val = FIELD_GET(GENMASK(GMU_FAULT_MAX, 0), val);
  

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_dispatch.c =====
L15: #include "kgsl_gmu_core.h"
  #include "kgsl_bus.h"
  #include "kgsl_eventlog.h"
  #include "kgsl_util.h"
  
L39: * Maximum ringbuffer inflight for the single submitting context case - this
  
  /*
  * should be sufficiently high to keep the GPU loaded
  */
L60: ((struct adreno_ringbuffer *) \
  
  #define DRAWQUEUE_RB(_drawqueue) \
  container_of((_drawqueue),\
  struct adreno_ringbuffer, dispatch_q))
L62: struct adreno_ringbuffer, dispatch_q))
  ((struct adreno_ringbuffer *) \
  container_of((_drawqueue),\
  
  #define DRAWQUEUE(_ringbuffer) (&(_ringbuffer)->dispatch_q)
L64: #define DRAWQUEUE(_ringbuffer) (&(_ringbuffer)->dispatch_q)
  struct adreno_ringbuffer, dispatch_q))
  
  
  static bool adreno_drawqueue_is_empty(struct adreno_dispatcher_drawqueue *drawqueue)
L77: struct adreno_ringbuffer *rb = DRAWQUEUE_RB(drawqueue);
  struct adreno_dispatcher_drawqueue *drawqueue)
  {
  struct adreno_device *adreno_dev = ADRENO_RB_DEVICE(rb);
  
L98: * _retire_timestamp() - Retire object without sending it
  
  /**
  * to the hardware
  * @drawobj: Pointer to the object to retire
L104: * memstore from the CPU, kick off the event engine to handle
  * In some cases ibs can be retired by the software
  * without going to the GPU.  In those cases, update the
  * expired events and destroy the ib.
  */
L107: static void _retire_timestamp(struct kgsl_drawobj *drawobj)
  * expired events and destroy the ib.
  */
  {
  struct kgsl_context *context = drawobj->context;
L112: struct adreno_ringbuffer *rb = drawctxt->rb;
  struct adreno_context *drawctxt = ADRENO_CONTEXT(context);
  struct kgsl_device *device = context->device;
  struct retire_info info = {0};
  
L116: * Write the start and end timestamp to the memstore to keep the
  
  /*
  * accounting sane
  */
L119: kgsl_sharedmem_writel(device->memstore,
  * accounting sane
  */
  KGSL_MEMSTORE_OFFSET(context->id, soptimestamp),
  drawobj->timestamp);
L120: KGSL_MEMSTORE_OFFSET(context->id, soptimestamp),
  */
  kgsl_sharedmem_writel(device->memstore,
  drawobj->timestamp);
  
L121: drawobj->timestamp);
  kgsl_sharedmem_writel(device->memstore,
  KGSL_MEMSTORE_OFFSET(context->id, soptimestamp),
  
  kgsl_sharedmem_writel(device->memstore,
L123: kgsl_sharedmem_writel(device->memstore,
  drawobj->timestamp);
  
  KGSL_MEMSTORE_OFFSET(context->id, eoptimestamp),
  drawobj->timestamp);
L124: KGSL_MEMSTORE_OFFSET(context->id, eoptimestamp),
  
  kgsl_sharedmem_writel(device->memstore,
  drawobj->timestamp);
  
L125: drawobj->timestamp);
  kgsl_sharedmem_writel(device->memstore,
  KGSL_MEMSTORE_OFFSET(context->id, eoptimestamp),
  
  drawctxt->submitted_timestamp = drawobj->timestamp;
L127: drawctxt->submitted_timestamp = drawobj->timestamp;
  drawobj->timestamp);
  
  
  /* Retire pending GPU events for the object */
L135: info.timestamp = drawobj->timestamp;
  info.rb_id = rb->id;
  info.wptr = rb->wptr;
  
  msm_perf_events_update(MSM_PERF_GFX, MSM_PERF_RETIRED,
L139: context->id, drawobj->timestamp,
  msm_perf_events_update(MSM_PERF_GFX, MSM_PERF_RETIRED,
  pid_nr(context->proc_priv->pid),
  !!(drawobj->flags & KGSL_DRAWOBJ_END_OF_FRAME));
  
L152: log_kgsl_cmdbatch_retired_event(context->id, drawobj->timestamp,
  drawobj->flags, rb->dispatch_q.inflight, 0);
  
  context->priority, drawobj->flags, 0, 0);
  
L180: * return true if this is a marker command and the dependent timestamp has
  
  /*
  * retired
  */
L188: kgsl_check_timestamp(drawobj->device, drawobj->context,
  
  return (drawobj->flags & KGSL_DRAWOBJ_MARKER) &&
  markerobj->marker_timestamp);
  }
L189: markerobj->marker_timestamp);
  return (drawobj->flags & KGSL_DRAWOBJ_MARKER) &&
  kgsl_check_timestamp(drawobj->device, drawobj->context,
  }
  
L206: _retire_timestamp(drawobj);
  if (_marker_expired(cmdobj)) {
  _pop_drawobj(drawctxt);
  return 0;
  }
L215: * keep the timestamp accounting correct. If
  * this one in the queue. This means that we
  * need to dispatch the command so that we can
  * skip isn't set then we block this queue
  * until the dependent timestamp expires
L217: * until the dependent timestamp expires
  * keep the timestamp accounting correct. If
  * skip isn't set then we block this queue
  */
  return test_bit(CMDOBJ_SKIP, &cmdobj->priv) ? 1 : -EAGAIN;
L260: _retire_timestamp(drawobj);
  if (test_bit(KGSL_BINDOBJ_STATE_DONE, &bindobj->state)) {
  _pop_drawobj(drawctxt);
  return 0;
  }
L281: * a) next drawobj that needs to be sent to ringbuffer
  * Retires all expired marker and sync objs from the context
  * queue and returns one of the below
  * b) -EAGAIN for syncobj with syncpoints pending.
  * c) -EAGAIN for markerobj whose marker timestamp has not expired yet.
L283: * c) -EAGAIN for markerobj whose marker timestamp has not expired yet.
  * a) next drawobj that needs to be sent to ringbuffer
  * b) -EAGAIN for syncobj with syncpoints pending.
  * c) NULL for no commands remaining in drawqueue.
  */

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_dispatch.h =====
L17: * Maximum size of the dispatcher ringbuffer - the actual inflight size will be
  
  /*
  * smaller then this but this size will allow for a larger range of inflight
  * sizes that can be chosen at runtime
L64: * @inflight: Number of drawobj operations pending in the ringbuffer
  * @state: Current state of the dispatcher (active or paused)
  * @timer: Timer to monitor the progress of the drawobjs
  * @pending: Priority list of contexts waiting to submit drawobjs
  * @kobj: kobject for the dispatcher directory in the device sysfs node

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_drawctxt.c =====
L22: static int _check_context_timestamp(struct kgsl_device *device,
  }
  
  struct kgsl_context *context, unsigned int timestamp)
  {
L23: struct kgsl_context *context, unsigned int timestamp)
  
  static int _check_context_timestamp(struct kgsl_device *device,
  {
  /* Bail if the drawctxt has been invalidated or destroyed */
L29: return kgsl_check_timestamp(device, context, timestamp);
  return 1;
  
  }
  
L48: kgsl_readtimestamp(device, context, KGSL_TIMESTAMP_QUEUED, &queue);
  char buf[120];
  
  kgsl_readtimestamp(device, context, KGSL_TIMESTAMP_CONSUMED, &start);
  kgsl_readtimestamp(device, context, KGSL_TIMESTAMP_RETIRED, &retire);
L49: kgsl_readtimestamp(device, context, KGSL_TIMESTAMP_CONSUMED, &start);
  
  kgsl_readtimestamp(device, context, KGSL_TIMESTAMP_QUEUED, &queue);
  kgsl_readtimestamp(device, context, KGSL_TIMESTAMP_RETIRED, &retire);
  
L50: kgsl_readtimestamp(device, context, KGSL_TIMESTAMP_RETIRED, &retire);
  kgsl_readtimestamp(device, context, KGSL_TIMESTAMP_QUEUED, &queue);
  kgsl_readtimestamp(device, context, KGSL_TIMESTAMP_CONSUMED, &start);
  
  /*
L74: context->id, queue, drawctxt->submitted_timestamp,
  dev_err(device->dev,
  "  context[%u]: queue=%u, submit=%u, start=%u, retire=%u\n",
  start, retire);
  
L97: context->id, drawobj->timestamp);
  dev_err(device->dev,
  "  context[%u] (ts=%u) Active sync points:\n",
  
  kgsl_dump_syncpoints(device, syncobj);
L130: * adreno_drawctxt_wait() - sleep until a timestamp expires
  
  /**
  * @adreno_dev: pointer to the adreno_device struct
  * @drawctxt: Pointer to the draw context to sleep for
L133: * @timetamp: Timestamp to wait on
  * @adreno_dev: pointer to the adreno_device struct
  * @drawctxt: Pointer to the draw context to sleep for
  * @timeout: Number of jiffies to wait (0 for infinite)
  *
L136: * Register an event to wait for a timestamp on a context and sleep until it
  * @timeout: Number of jiffies to wait (0 for infinite)
  *
  * has past.  Returns < 0 on error, -ETIMEDOUT if the timeout expires or 0
  * on success
L142: uint32_t timestamp, unsigned int timeout)
  int adreno_drawctxt_wait(struct adreno_device *adreno_dev,
  struct kgsl_context *context,
  {
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
L155: trace_adreno_drawctxt_wait_start(-1, context->id, timestamp);
  return -EDEADLK;
  
  
  ret = kgsl_add_event(device, &context->events, timestamp,
L157: ret = kgsl_add_event(device, &context->events, timestamp,
  trace_adreno_drawctxt_wait_start(-1, context->id, timestamp);
  
  wait_callback, (void *) drawctxt);
  if (ret)
L170: _check_context_timestamp(device, context, timestamp),
  
  ret_temp = wait_event_interruptible_timeout(drawctxt->waiting,
  msecs_to_jiffies(timeout));
  
L174: kgsl_cancel_event(device, &context->events, timestamp,
  
  if (ret_temp <= 0) {
  wait_callback, (void *)drawctxt);
  
L192: trace_adreno_drawctxt_wait_done(-1, context->id, timestamp, ret);
  
  done:
  return ret;
  }
L197: * adreno_drawctxt_wait_rb() - Wait for the last RB timestamp at which this
  
  /**
  * context submitted a command to the corresponding RB
  * @adreno_dev: The device on which the timestamp is active
L199: * @adreno_dev: The device on which the timestamp is active
  * adreno_drawctxt_wait_rb() - Wait for the last RB timestamp at which this
  * context submitted a command to the corresponding RB
  * @context: The context which subbmitted command to RB
  * @timestamp: The RB timestamp of last command submitted to RB by context
L201: * @timestamp: The RB timestamp of last command submitted to RB by context
  * @adreno_dev: The device on which the timestamp is active
  * @context: The context which subbmitted command to RB
  * @timeout: Timeout value for the wait
  * Caller must hold the device mutex
L207: uint32_t timestamp, unsigned int timeout)
  static int adreno_drawctxt_wait_rb(struct adreno_device *adreno_dev,
  struct kgsl_context *context,
  {
  struct adreno_context *drawctxt = ADRENO_CONTEXT(context);
L214: * then return immediately - we may end up waiting for a timestamp
  /*
  * If the context is invalid (OR) not submitted commands to GPU
  * that will never come
  */
L222: timestamp);
  
  trace_adreno_drawctxt_wait_start(drawctxt->rb->id, context->id,
  
  ret = adreno_ringbuffer_waittimestamp(drawctxt->rb, timestamp, timeout);
L224: ret = adreno_ringbuffer_waittimestamp(drawctxt->rb, timestamp, timeout);
  timestamp);
  
  done:
  trace_adreno_drawctxt_wait_done(drawctxt->rb->id, context->id,
L227: timestamp, ret);
  done:
  trace_adreno_drawctxt_wait_done(drawctxt->rb->id, context->id,
  return ret;
  }
L273: * set the timestamp to the last value since the context is invalidated
  
  /*
  * and we want the pending events for this context to go away
  */
L276: kgsl_sharedmem_writel(device->memstore,
  * and we want the pending events for this context to go away
  */
  KGSL_MEMSTORE_OFFSET(context->id, soptimestamp),
  drawctxt->timestamp);
L277: KGSL_MEMSTORE_OFFSET(context->id, soptimestamp),
  */
  kgsl_sharedmem_writel(device->memstore,
  drawctxt->timestamp);
  
L278: drawctxt->timestamp);
  kgsl_sharedmem_writel(device->memstore,
  KGSL_MEMSTORE_OFFSET(context->id, soptimestamp),
  
  kgsl_sharedmem_writel(device->memstore,
L280: kgsl_sharedmem_writel(device->memstore,
  drawctxt->timestamp);
  
  KGSL_MEMSTORE_OFFSET(context->id, eoptimestamp),
  drawctxt->timestamp);

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_drawctxt.h =====
L27: * @timestamp: Last issued context-specific timestamp
  /**
  * struct adreno_context - Adreno GPU draw context
  * @internal_timestamp: Global timestamp of the last issued command
  *			NOTE: guarded by device->mutex, not drawctxt->mutex!
L28: * @internal_timestamp: Global timestamp of the last issued command
  * struct adreno_context - Adreno GPU draw context
  * @timestamp: Last issued context-specific timestamp
  *			NOTE: guarded by device->mutex, not drawctxt->mutex!
  * @type: Context type (GL, CL, RS)
L37: * @waiting: Workqueue structure for contexts waiting for a timestamp or event
  * @drawqueue_tail: Tail of the drawqueue queue
  * @wq: Workqueue structure for contexts to sleep pending room in the queue
  * @timeout: Workqueue structure for contexts waiting to invalidate
  * @queued: Number of commands queued in the drawqueue
L42: * @queued_timestamp: The last timestamp that was queued on this context
  * @fault_policy: GFT fault policy set in _skip_cmd();
  * @debug_root: debugfs entry for this context.
  * @rb: The ringbuffer in which this context submits commands.
  * @submitted_timestamp: The last timestamp that was submitted for this context
L43: * @rb: The ringbuffer in which this context submits commands.
  * @debug_root: debugfs entry for this context.
  * @queued_timestamp: The last timestamp that was queued on this context
  * @submitted_timestamp: The last timestamp that was submitted for this context
  * @submit_retire_ticks: Array to hold command obj execution times from submit
L44: * @submitted_timestamp: The last timestamp that was submitted for this context
  * @queued_timestamp: The last timestamp that was queued on this context
  * @rb: The ringbuffer in which this context submits commands.
  * @submit_retire_ticks: Array to hold command obj execution times from submit
  *                       to retire
L54: unsigned int timestamp;
  struct adreno_context {
  struct kgsl_context base;
  unsigned int internal_timestamp;
  unsigned int type;
L55: unsigned int internal_timestamp;
  struct kgsl_context base;
  unsigned int timestamp;
  unsigned int type;
  spinlock_t lock;
L71: unsigned int queued_timestamp;
  unsigned int fault_policy;
  struct dentry *debug_root;
  struct adreno_ringbuffer *rb;
  unsigned int submitted_timestamp;
L72: struct adreno_ringbuffer *rb;
  struct dentry *debug_root;
  unsigned int queued_timestamp;
  unsigned int submitted_timestamp;
  uint64_t submit_retire_ticks[SUBMIT_RETIRE_TICKS_SIZE];
L73: unsigned int submitted_timestamp;
  unsigned int queued_timestamp;
  struct adreno_ringbuffer *rb;
  uint64_t submit_retire_ticks[SUBMIT_RETIRE_TICKS_SIZE];
  int ticks_index;
L79: /** @gmu_context_queue: Queue to dispatch submissions to GMU */
  struct list_head active_node;
  unsigned long active_time;
  struct kgsl_memdesc gmu_context_queue;
  /** @gmu_hw_fence_queue: Queue for GMU to store hardware fences for this context */
L80: struct kgsl_memdesc gmu_context_queue;
  unsigned long active_time;
  /** @gmu_context_queue: Queue to dispatch submissions to GMU */
  /** @gmu_hw_fence_queue: Queue for GMU to store hardware fences for this context */
  struct kgsl_memdesc gmu_hw_fence_queue;
L81: /** @gmu_hw_fence_queue: Queue for GMU to store hardware fences for this context */
  /** @gmu_context_queue: Queue to dispatch submissions to GMU */
  struct kgsl_memdesc gmu_context_queue;
  struct kgsl_memdesc gmu_hw_fence_queue;
  /** @hw_fence_list: List of hardware fences(sorted by timestamp) not yet submitted to GMU */
L82: struct kgsl_memdesc gmu_hw_fence_queue;
  struct kgsl_memdesc gmu_context_queue;
  /** @gmu_hw_fence_queue: Queue for GMU to store hardware fences for this context */
  /** @hw_fence_list: List of hardware fences(sorted by timestamp) not yet submitted to GMU */
  struct list_head hw_fence_list;
L83: /** @hw_fence_list: List of hardware fences(sorted by timestamp) not yet submitted to GMU */
  /** @gmu_hw_fence_queue: Queue for GMU to store hardware fences for this context */
  struct kgsl_memdesc gmu_hw_fence_queue;
  struct list_head hw_fence_list;
  /** @hw_fence_inflight_list: List of hardware fences submitted to GMU */
L85: /** @hw_fence_inflight_list: List of hardware fences submitted to GMU */
  /** @hw_fence_list: List of hardware fences(sorted by timestamp) not yet submitted to GMU */
  struct list_head hw_fence_list;
  struct list_head hw_fence_inflight_list;
  /** @hw_fence_count: Number of hardware fences not yet sent to Tx Queue */
L89: /** @syncobj_timestamp: Timestamp to check whether GMU has consumed a syncobj */
  /** @hw_fence_count: Number of hardware fences not yet sent to Tx Queue */
  u32 hw_fence_count;
  u32 syncobj_timestamp;
  /**
L90: u32 syncobj_timestamp;
  u32 hw_fence_count;
  /** @syncobj_timestamp: Timestamp to check whether GMU has consumed a syncobj */
  /**
  * @gmu_hw_fence_ready_ts: This timestamp is used to figure out whether a hardware fence
L92: * @gmu_hw_fence_ready_ts: This timestamp is used to figure out whether a hardware fence
  u32 syncobj_timestamp;
  /**
  * is ready to be submitted to GMU at the time of its creation or not. This timestamp
  * tracks the timestamp of the most recently submitted cmdbatch submission to the GMU
L93: * is ready to be submitted to GMU at the time of its creation or not. This timestamp
  /**
  * @gmu_hw_fence_ready_ts: This timestamp is used to figure out whether a hardware fence
  * tracks the timestamp of the most recently submitted cmdbatch submission to the GMU
  * context queue for this context. This is different from the internal_timestamp (which gets
L94: * tracks the timestamp of the most recently submitted cmdbatch submission to the GMU
  * @gmu_hw_fence_ready_ts: This timestamp is used to figure out whether a hardware fence
  * is ready to be submitted to GMU at the time of its creation or not. This timestamp
  * context queue for this context. This is different from the internal_timestamp (which gets
  * reset to 0 in some cases).
L95: * context queue for this context. This is different from the internal_timestamp (which gets
  * is ready to be submitted to GMU at the time of its creation or not. This timestamp
  * tracks the timestamp of the most recently submitted cmdbatch submission to the GMU
  * reset to 0 in some cases).
  */
L98: u32 gmu_hw_fence_ready_ts;
  * reset to 0 in some cases).
  */
  /**
  * @hw_fence_last_ts: This tracks the latest timestamp for which a hw fence was created.
L100: * @hw_fence_last_ts: This tracks the latest timestamp for which a hw fence was created.
  u32 gmu_hw_fence_ready_ts;
  /**
  * This is used to figure out if a new fence has an out-of-order timestamp.
  */
L101: * This is used to figure out if a new fence has an out-of-order timestamp.
  /**
  * @hw_fence_last_ts: This tracks the latest timestamp for which a hw fence was created.
  */
  u32 hw_fence_last_ts;
L139: struct adreno_ringbuffer;
  void adreno_drawctxt_destroy(struct kgsl_context *context);
  
  struct adreno_dispatcher_drawqueue;
  
L144: uint32_t timestamp, unsigned int timeout);
  int adreno_drawctxt_wait(struct adreno_device *adreno_dev,
  struct kgsl_context *context,
  
  void adreno_drawctxt_invalidate(struct kgsl_device *device,
L164: * adreno_put_drawctxt_on_timestamp - Put the refcount on the drawctxt when the
  
  /**
  * timestamp expires
  * @device: A KGSL device handle
L165: * timestamp expires
  /**
  * adreno_put_drawctxt_on_timestamp - Put the refcount on the drawctxt when the
  * @device: A KGSL device handle
  * @drawctxt: The draw context to put away

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7.c =====
L27: /* IFPC & Preemption static powerup restore list */
  #include "kgsl_util.h"
  
  static const u32 gen7_pwrup_reglist[] = {
  GEN7_UCHE_TRAP_BASE_LO,
L40: GEN7_RB_CONTEXT_SWITCH_GMEM_SAVE_RESTORE,
  GEN7_UCHE_MODE_CNTL,
  GEN7_RB_NC_MODE_CNTL,
  GEN7_UCHE_GBIF_GX_CONFIG,
  GEN7_UCHE_CLIENT_PF,
L59: GEN7_RB_CONTEXT_SWITCH_GMEM_SAVE_RESTORE,
  GEN7_RB_NC_MODE_CNTL,
  GEN7_SP_NC_MODE_CNTL,
  GEN7_UCHE_GBIF_GX_CONFIG,
  GEN7_UCHE_CLIENT_PF,
L209: GEN7_RB_CONTEXT_SWITCH_GMEM_SAVE_RESTORE,
  GEN7_GRAS_NC_MODE_CNTL,
  GEN7_SP_NC_MODE_CNTL,
  GEN7_UCHE_GBIF_GX_CONFIG,
  GEN7_UCHE_CLIENT_PF,
L218: struct gen7_gmu_device *gmu = to_gen7_gmu(adreno_dev);
  struct kgsl_device *device = data;
  struct adreno_device *adreno_dev = ADRENO_DEVICE(device);
  u32 debug_val = (u32) val;
  int ret;
L227: ret = gen7_hfi_send_set_value(adreno_dev, HFI_VALUE_DBG, F_PWR_ACD_CALIBRATE, debug_val);
  goto err;
  
  if (!ret)
  gmu->acd_debug_val = debug_val;
L229: gmu->acd_debug_val = debug_val;
  ret = gen7_hfi_send_set_value(adreno_dev, HFI_VALUE_DBG, F_PWR_ACD_CALIBRATE, debug_val);
  if (!ret)
  
  adreno_active_count_put(adreno_dev);
L241: struct gen7_gmu_device *gmu = to_gen7_gmu(adreno_dev);
  struct kgsl_device *device = data;
  struct adreno_device *adreno_dev = ADRENO_DEVICE(device);
  
  *val = (u64) gmu->acd_debug_val;
L243: *val = (u64) gmu->acd_debug_val;
  struct gen7_gmu_device *gmu = to_gen7_gmu(adreno_dev);
  
  
  return 0;
L250: void gen7_cp_init_cmds(struct adreno_device *adreno_dev, u32 *cmds)
  DEFINE_DEBUGFS_ATTRIBUTE(acd_cal_fops, acd_calibrate_get, acd_calibrate_set, "%llu\n");
  
  {
  u32 i = 0, mask = 0;
L267: /* Disable save/restore of performance counters across preemption */
  mask |= BIT(3);
  
  mask |= BIT(6);
  
L309: for (i = 0; i < GMU_CORE_LONG_WAKEUP_RETRY_LIMIT; i++) {
  kgsl_regwrite(device, offset, value);
  ts1 = gpudev->read_alwayson(adreno_dev);
  /*
  * Make sure the previous register write is posted before
L316: gmu_core_regread(device, GEN7_GMU_AHB_FENCE_STATUS, &status);
  mb();
  
  
  /*
L326: udelay(GMU_CORE_WAKEUP_DELAY_US);
  
  /* Wait a small amount of time before trying again */
  
  /* Try to write the fenced register again */
L332: if (i < GMU_CORE_SHORT_WAKEUP_RETRY_LIMIT)
  }
  
  return 0;
  
L335: if (i == GMU_CORE_LONG_WAKEUP_RETRY_LIMIT) {
  return 0;
  
  ts2 = gpudev->read_alwayson(adreno_dev);
  dev_err(device->dev,
L338: "Timed out waiting %d usecs to write fenced register 0x%x, timestamps: %llx %llx\n",
  ts2 = gpudev->read_alwayson(adreno_dev);
  dev_err(device->dev,
  i * GMU_CORE_WAKEUP_DELAY_US, offset, ts1, ts2);
  return -ETIMEDOUT;
L339: i * GMU_CORE_WAKEUP_DELAY_US, offset, ts1, ts2);
  dev_err(device->dev,
  "Timed out waiting %d usecs to write fenced register 0x%x, timestamps: %llx %llx\n",
  return -ETIMEDOUT;
  }
L345: i * GMU_CORE_WAKEUP_DELAY_US, offset);
  dev_info(device->dev,
  "Waited %d usecs to write fenced register 0x%x\n",
  
  return 0;
L519: addr = GEN7_CP_SQE_UCODE_DBG_ADDR;
  switch (pipe) {
  case PIPE_BR:
  data = GEN7_CP_SQE_UCODE_DBG_DATA;
  break;
L520: data = GEN7_CP_SQE_UCODE_DBG_DATA;
  case PIPE_BR:
  addr = GEN7_CP_SQE_UCODE_DBG_ADDR;
  break;
  case PIPE_BV:
L523: addr = GEN7_CP_BV_SQE_UCODE_DBG_ADDR;
  break;
  case PIPE_BV:
  data = GEN7_CP_BV_SQE_UCODE_DBG_DATA;
  break;
L524: data = GEN7_CP_BV_SQE_UCODE_DBG_DATA;
  case PIPE_BV:
  addr = GEN7_CP_BV_SQE_UCODE_DBG_ADDR;
  break;
  case PIPE_LPAC:
L527: addr = GEN7_CP_SQE_AC_UCODE_DBG_ADDR;
  break;
  case PIPE_LPAC:
  data = GEN7_CP_SQE_AC_UCODE_DBG_DATA;
  break;
L528: data = GEN7_CP_SQE_AC_UCODE_DBG_DATA;
  case PIPE_LPAC:
  addr = GEN7_CP_SQE_AC_UCODE_DBG_ADDR;
  break;
  default:
L605: gmu_core_regwrite(device, gen7_core->ao_hwcg[i].offset,
  
  for (i = 0; i < gen7_core->ao_hwcg_count; i++)
  on ? gen7_core->ao_hwcg[i].val : 0);
  
L699: /* Static IFPC + preemption registers */
  }
  
  if (adreno_is_gen7_no_cb_family(adreno_dev)) {
  reglist[items].regs = gen7_pwrup_reglist_no_cb;
L710: lock->preemption_list_len = reglist[items].count;
  reglist[items].count = ARRAY_SIZE(gen7_pwrup_reglist);
  }
  items++;
  
L736: * 2. Static IFPC + preemption registers
  * The overall register list is composed of
  * 1. Static IFPC restore only registers
  * 3. Dynamic IFPC + preemption registers (ex: perfcounter selects)
  *
L737: * 3. Dynamic IFPC + preemption registers (ex: perfcounter selects)
  * 1. Static IFPC restore only registers
  * 2. Static IFPC + preemption registers
  *
  * The first two lists are static. Size of these lists are stored as

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7.h =====
L13: #include "adreno_gen7_gmu.h"
  
  #include "gen7_reg.h"
  
  /* Forward struct declaration */
L18: extern const struct adreno_power_ops gen7_gmu_power_ops;
  struct gen7_snapshot_block_list;
  
  extern const struct adreno_power_ops gen7_hwsched_power_ops;
  extern const struct adreno_perfcounters adreno_gen7_perfcounters;
L27: int (*hfi_probe)(struct adreno_device *adreno_dev);
  struct gen7_gpudev {
  struct adreno_gpudev base;
  void (*hfi_remove)(struct adreno_device *adreno_dev);
  void (*handle_watchdog)(struct adreno_device *adreno_dev);
L28: void (*hfi_remove)(struct adreno_device *adreno_dev);
  struct adreno_gpudev base;
  int (*hfi_probe)(struct adreno_device *adreno_dev);
  void (*handle_watchdog)(struct adreno_device *adreno_dev);
  };
L32: extern const struct gen7_gpudev adreno_gen7_gmu_gpudev;
  };
  
  extern const struct gen7_gpudev adreno_gen7_hwsched_gpudev;
  extern const struct gen7_gpudev adreno_gen7_9_0_hwsched_gpudev;
L40: /** @gmu: Container for the gen7 GMU device */
  */
  struct gen7_device {
  struct gen7_gmu_device gmu;
  /** @adreno_dev: Container for the generic adreno device */
L41: struct gen7_gmu_device gmu;
  struct gen7_device {
  /** @gmu: Container for the gen7 GMU device */
  /** @adreno_dev: Container for the generic adreno device */
  struct adreno_device adreno_dev;
L86: /** @gmu_fw_version: Minimum firmware version required to support this core */
  /** @base: Container for the generic GPU definitions */
  struct adreno_gpu_core base;
  u32 gmu_fw_version;
  /** @sqefw_name: Name of the SQE microcode file */
L87: u32 gmu_fw_version;
  struct adreno_gpu_core base;
  /** @gmu_fw_version: Minimum firmware version required to support this core */
  /** @sqefw_name: Name of the SQE microcode file */
  const char *sqefw_name;
L88: /** @sqefw_name: Name of the SQE microcode file */
  /** @gmu_fw_version: Minimum firmware version required to support this core */
  u32 gmu_fw_version;
  const char *sqefw_name;
  /** @aqefw_name: Name of the AQE microcode file */
L89: const char *sqefw_name;
  u32 gmu_fw_version;
  /** @sqefw_name: Name of the SQE microcode file */
  /** @aqefw_name: Name of the AQE microcode file */
  const char *aqefw_name;
L92: /** @gmufw_name: Name of the GMU firmware file */
  /** @aqefw_name: Name of the AQE microcode file */
  const char *aqefw_name;
  const char *gmufw_name;
  /** @gmufw_name: Name of the backup GMU firmware file */
L93: const char *gmufw_name;
  const char *aqefw_name;
  /** @gmufw_name: Name of the GMU firmware file */
  /** @gmufw_name: Name of the backup GMU firmware file */
  const char *gmufw_bak_name;
L94: /** @gmufw_name: Name of the backup GMU firmware file */
  /** @gmufw_name: Name of the GMU firmware file */
  const char *gmufw_name;
  const char *gmufw_bak_name;
  /**
L95: const char *gmufw_bak_name;
  const char *gmufw_name;
  /** @gmufw_name: Name of the backup GMU firmware file */
  /**
  * @zap_name: Specifies the name of the CPZ zap file. This field is deprecated.
L98: * Use the 'firmware-name' device tree property instead.
  /**
  * @zap_name: Specifies the name of the CPZ zap file. This field is deprecated.
  */
  const char *zap_name;
L117: /** @ctxt_record_size: Size of the preemption record in bytes */
  /** @protected_regs: Array of protected registers for the target */
  const struct gen7_protected_regs *protected_regs;
  u64 ctxt_record_size;
  /** @gen7_snapshot_block_list: Device-specific blocks dumped in the snapshot */
L121: /** @gmu_hub_clk_freq: Gmu hub interface clock frequency */
  /** @gen7_snapshot_block_list: Device-specific blocks dumped in the snapshot */
  const struct gen7_snapshot_block_list *gen7_snapshot_block_list;
  u64 gmu_hub_clk_freq;
  /**
L122: u64 gmu_hub_clk_freq;
  const struct gen7_snapshot_block_list *gen7_snapshot_block_list;
  /** @gmu_hub_clk_freq: Gmu hub interface clock frequency */
  /**
  * @bcl_data: bit 0 contains response type for bcl alarms and bits 1:21 controls sid vals
L126: * gmu fw sets default throttle levels.
  * @bcl_data: bit 0 contains response type for bcl alarms and bits 1:21 controls sid vals
  * to configure throttle levels for bcl alarm levels 0-2. If sid vals are not set,
  */
  u32 bcl_data;
L129: /** @preempt_level: Preemption level valid ranges [0 to 2] */
  */
  u32 bcl_data;
  u32 preempt_level;
  /** @qos_value: GPU qos value to set for each RB. */
L147: * @gmu_chipid: If non-zero, the exact value programmed into
  u32 noc_timeout_us;
  /**
  * GEN7_GMU_GENERAL_10 to tell the GMU firmware which chip it is
  * running on.
L148: * GEN7_GMU_GENERAL_10 to tell the GMU firmware which chip it is
  /**
  * @gmu_chipid: If non-zero, the exact value programmed into
  * running on.
  */
L151: u32 gmu_chipid;
  * running on.
  */
  };
  
L155: * struct gen7_cp_preemption_record - CP context record for
  
  /**
  * preemption.
  * @magic: (00) Value at this offset must be equal to
L156: * preemption.
  /**
  * struct gen7_cp_preemption_record - CP context record for
  * @magic: (00) Value at this offset must be equal to
  * GEN7_CP_CTXRECORD_MAGIC_REF.
L160: * we must set to zero for all ringbuffers.
  * GEN7_CP_CTXRECORD_MAGIC_REF.
  * @info: (04) Type of record. Written non-zero (usually) by CP.
  * @errno: (08) Error code. Initialize this to GEN7_CP_CTXRECORD_ERROR_NONE.
  * CP will update to another value if a preemption error occurs.
L162: * CP will update to another value if a preemption error occurs.
  * we must set to zero for all ringbuffers.
  * @errno: (08) Error code. Initialize this to GEN7_CP_CTXRECORD_ERROR_NONE.
  * @data: (12) DATA field in YIELD and SET_MARKER packets.
  * Written by CP when switching out. Not used on switch-in. Initialized to 0.
L171: * counter: (48) Pointer to preemption counter.
  * @rptr_addr: (32) RB_RPTR_ADDR_LO|HI saved and restored. We must initialize.
  * rbase: (40) RB_BASE_LO|HI saved and restored.
  * @bv_rptr_addr: (56) BV_RB_RPTR_ADDR_LO|HI save and restored. We must initialize.
  */
L174: struct gen7_cp_preemption_record {
  * @bv_rptr_addr: (56) BV_RB_RPTR_ADDR_LO|HI save and restored. We must initialize.
  */
  u32 magic;
  u32 info;

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_0_0_snapshot.h =====
L35: DEBUGBUS_GMU_GX,
  DEBUGBUS_UFC_0,
  DEBUGBUS_UFC_1,
  DEBUGBUS_DBGC,
  DEBUGBUS_GPC_BR,
L210: static const u32 gen7_0_0_gmu_registers[] = {
  static_assert(IS_ALIGNED(sizeof(gen7_0_0_gpu_registers), 8));
  
  0x10001, 0x10001, 0x10003, 0x10003, 0x10401, 0x10401, 0x10403, 0x10403,
  0x10801, 0x10801, 0x10803, 0x10803, 0x10c01, 0x10c01, 0x10c03, 0x10c03,
L241: static_assert(IS_ALIGNED(sizeof(gen7_0_0_gmu_registers), 8));
  UINT_MAX, UINT_MAX,
  };
  
  static const u32 gen7_0_0_gmugx_registers[] = {
L243: static const u32 gen7_0_0_gmugx_registers[] = {
  static_assert(IS_ALIGNED(sizeof(gen7_0_0_gmu_registers), 8));
  
  0x1a400, 0x1a41f, 0x1a440, 0x1a45f, 0x1a480, 0x1a49f, 0x1a4c0, 0x1a4df,
  0x1a500, 0x1a51f, 0x1a540, 0x1a55f, 0x1a580, 0x1a59f, 0x1a5c0, 0x1a5df,
L257: static_assert(IS_ALIGNED(sizeof(gen7_0_0_gmugx_registers), 8));
  UINT_MAX, UINT_MAX,
  };
  
  static const u32 gen7_0_0_noncontext_pipe_br_registers[] = {

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_11_0_snapshot.h =====
L34: DEBUGBUS_GMU_GX,
  DEBUGBUS_UFC_0,
  DEBUGBUS_UFC_1,
  DEBUGBUS_DBGC,
  DEBUGBUS_GPC_BR,
L74: DEBUGBUS_GMU_CX,
  static const u32 gen7_11_0_cx_debugbus_blocks[] = {
  DEBUGBUS_CX,
  DEBUGBUS_GBIF_CX,
  };
L216: * Block   : ['GMUAO', 'GMUCX', 'GMUCX_RAM']
  
  /*
  * Pipeline: PIPE_NONE
  * pairs   : 126 (Regs:334)
L220: static const u32 gen7_11_0_gmu_registers[] = {
  * pairs   : 126 (Regs:334)
  */
  0x1f400, 0x1f40b, 0x1f40f, 0x1f411, 0x1f500, 0x1f500, 0x1f507, 0x1f507,
  0x1f509, 0x1f50b, 0x1f705, 0x1f705, 0x1f710, 0x1f711, 0x1f713, 0x1f716,
L250: static_assert(IS_ALIGNED(sizeof(gen7_11_0_gmu_registers), 8));
  UINT_MAX, UINT_MAX,
  };
  
  static const u32 gen7_11_0_gmu_ao_registers[] = {
L252: static const u32 gen7_11_0_gmu_ao_registers[] = {
  static_assert(IS_ALIGNED(sizeof(gen7_11_0_gmu_registers), 8));
  
  0x10001, 0x10001, 0x10003, 0x10003, 0x10401, 0x10401, 0x10403, 0x10403,
  0x10801, 0x10801, 0x10803, 0x10803, 0x10c01, 0x10c01, 0x10c03, 0x10c03,
L259: static_assert(IS_ALIGNED(sizeof(gen7_11_0_gmu_ao_registers), 8));
  UINT_MAX, UINT_MAX,
  };
  
  /*
L262: * Block   : ['GMUGX']
  
  /*
  * Pipeline: PIPE_NONE
  * pairs   : 4 (Regs:48)
L266: static const u32 gen7_11_0_gmugx_registers[] = {
  * pairs   : 4 (Regs:48)
  */
  0x1a802, 0x1a802, 0x1a883, 0x1a884, 0x1a900, 0x1a92b, 0x1a940, 0x1a940,
  UINT_MAX, UINT_MAX,
L270: static_assert(IS_ALIGNED(sizeof(gen7_11_0_gmugx_registers), 8));
  UINT_MAX, UINT_MAX,
  };
  
  /*
L310: * Block   : ['GMUAO', 'GMUCX', 'GMUGX', 'GRAS', 'PC', 'RBBM']
  /*
  * Block   : ['BROADCAST', 'CP', 'CX_DBGC', 'CX_MISC', 'DBGC', 'GBIF']
  * Block   : ['RDVM', 'UCHE', 'VFD', 'VPC', 'VSC']
  * Pipeline: PIPE_BR
L331: * Block   : ['GMUAO', 'GMUCX', 'GMUGX', 'GRAS', 'PC', 'RBBM']
  /*
  * Block   : ['BROADCAST', 'CP', 'CX_DBGC', 'CX_MISC', 'DBGC', 'GBIF']
  * Block   : ['RDVM', 'UCHE', 'VFD', 'VPC', 'VSC']
  * Pipeline: PIPE_BV
L352: * Block   : ['GMUAO', 'GMUCX', 'GMUGX', 'GRAS', 'PC', 'RBBM']
  /*
  * Block   : ['BROADCAST', 'CP', 'CX_DBGC', 'CX_MISC', 'DBGC', 'GBIF']
  * Block   : ['RDVM', 'UCHE', 'VFD', 'VPC', 'VSC']
  * Pipeline: PIPE_LPAC
L1174: { GEN7_CP_SQE_STAT_ADDR, GEN7_CP_SQE_STAT_DATA, 0x00040},
  
  static struct gen7_cp_indexed_reg gen7_11_0_cp_indexed_reg_list[] = {
  { GEN7_CP_DRAW_STATE_ADDR, GEN7_CP_DRAW_STATE_DATA, 0x00100},
  { GEN7_CP_ROQ_DBG_ADDR, GEN7_CP_ROQ_DBG_DATA, 0x00800},
L1177: { GEN7_CP_SQE_UCODE_DBG_ADDR, GEN7_CP_SQE_UCODE_DBG_DATA, 0x08000},
  { GEN7_CP_DRAW_STATE_ADDR, GEN7_CP_DRAW_STATE_DATA, 0x00100},
  { GEN7_CP_ROQ_DBG_ADDR, GEN7_CP_ROQ_DBG_DATA, 0x00800},
  { GEN7_CP_BV_DRAW_STATE_ADDR, GEN7_CP_BV_DRAW_STATE_DATA, 0x00100},
  { GEN7_CP_BV_ROQ_DBG_ADDR, GEN7_CP_BV_ROQ_DBG_DATA, 0x00800},
L1180: { GEN7_CP_BV_SQE_UCODE_DBG_ADDR, GEN7_CP_BV_SQE_UCODE_DBG_DATA, 0x08000},
  { GEN7_CP_BV_DRAW_STATE_ADDR, GEN7_CP_BV_DRAW_STATE_DATA, 0x00100},
  { GEN7_CP_BV_ROQ_DBG_ADDR, GEN7_CP_BV_ROQ_DBG_DATA, 0x00800},
  { GEN7_CP_BV_SQE_STAT_ADDR, GEN7_CP_BV_SQE_STAT_DATA, 0x00040},
  { GEN7_CP_RESOURCE_TABLE_DBG_ADDR, GEN7_CP_RESOURCE_TABLE_DBG_DATA, 0x04100},
L1181: { GEN7_CP_BV_SQE_STAT_ADDR, GEN7_CP_BV_SQE_STAT_DATA, 0x00040},
  { GEN7_CP_BV_ROQ_DBG_ADDR, GEN7_CP_BV_ROQ_DBG_DATA, 0x00800},
  { GEN7_CP_BV_SQE_UCODE_DBG_ADDR, GEN7_CP_BV_SQE_UCODE_DBG_DATA, 0x08000},
  { GEN7_CP_RESOURCE_TABLE_DBG_ADDR, GEN7_CP_RESOURCE_TABLE_DBG_DATA, 0x04100},
  { GEN7_CP_LPAC_DRAW_STATE_ADDR, GEN7_CP_LPAC_DRAW_STATE_DATA, 0x00100},
L1185: { GEN7_CP_SQE_AC_UCODE_DBG_ADDR, GEN7_CP_SQE_AC_UCODE_DBG_DATA, 0x08000},
  { GEN7_CP_LPAC_DRAW_STATE_ADDR, GEN7_CP_LPAC_DRAW_STATE_DATA, 0x00100},
  { GEN7_CP_LPAC_ROQ_DBG_ADDR, GEN7_CP_LPAC_ROQ_DBG_DATA, 0x00200},
  { GEN7_CP_SQE_AC_STAT_ADDR, GEN7_CP_SQE_AC_STAT_DATA, 0x00040},
  { GEN7_CP_LPAC_FIFO_DBG_ADDR, GEN7_CP_LPAC_FIFO_DBG_DATA, 0x00040},
L1186: { GEN7_CP_SQE_AC_STAT_ADDR, GEN7_CP_SQE_AC_STAT_DATA, 0x00040},
  { GEN7_CP_LPAC_ROQ_DBG_ADDR, GEN7_CP_LPAC_ROQ_DBG_DATA, 0x00200},
  { GEN7_CP_SQE_AC_UCODE_DBG_ADDR, GEN7_CP_SQE_AC_UCODE_DBG_DATA, 0x08000},
  { GEN7_CP_LPAC_FIFO_DBG_ADDR, GEN7_CP_LPAC_FIFO_DBG_DATA, 0x00040},
  };

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_14_0_snapshot.h =====
L27: DEBUGBUS_GMU_GX,
  DEBUGBUS_UFC_0,
  DEBUGBUS_UFC_1,
  DEBUGBUS_DBGC,
  DEBUGBUS_GPC_BR,
L115: static const u32 gen7_14_0_gmu_registers[] = {
  static_assert(IS_ALIGNED(sizeof(gen7_14_0_cx_misc_registers), 8));
  
  0x10001, 0x10001, 0x10003, 0x10003, 0x10401, 0x10401, 0x10403, 0x10403,
  0x10801, 0x10801, 0x10803, 0x10803, 0x10c01, 0x10c01, 0x10c03, 0x10c03,
L145: static_assert(IS_ALIGNED(sizeof(gen7_14_0_gmu_registers), 8));
  UINT_MAX, UINT_MAX,
  };
  
  static const u32 gen7_14_0_gmu_gx_registers[] = {
L147: static const u32 gen7_14_0_gmu_gx_registers[] = {
  static_assert(IS_ALIGNED(sizeof(gen7_14_0_gmu_registers), 8));
  
  0x1a802, 0x1a802, 0x1a883, 0x1a884, 0x1a900, 0x1a92b, 0x1a940, 0x1a940,
  UINT_MAX, UINT_MAX,
L151: static_assert(IS_ALIGNED(sizeof(gen7_14_0_gmu_gx_registers), 8));
  UINT_MAX, UINT_MAX,
  };
  
  static const u32 gen7_14_0_rscc_registers[] = {
L451: { GEN7_CP_SQE_STAT_ADDR, GEN7_CP_SQE_STAT_DATA, 0x40},
  
  static struct gen7_cp_indexed_reg gen7_14_0_cp_indexed_reg_list[] = {
  { GEN7_CP_DRAW_STATE_ADDR, GEN7_CP_DRAW_STATE_DATA, 0x100},
  { GEN7_CP_ROQ_DBG_ADDR, GEN7_CP_ROQ_DBG_DATA, 0x800},
L454: { GEN7_CP_SQE_UCODE_DBG_ADDR, GEN7_CP_SQE_UCODE_DBG_DATA, 0x8000},
  { GEN7_CP_DRAW_STATE_ADDR, GEN7_CP_DRAW_STATE_DATA, 0x100},
  { GEN7_CP_ROQ_DBG_ADDR, GEN7_CP_ROQ_DBG_DATA, 0x800},
  };
  

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_2_0_snapshot.h =====
L36: DEBUGBUS_GMU_GX,
  DEBUGBUS_UFC_0,
  DEBUGBUS_UFC_1,
  DEBUGBUS_DBGC,
  DEBUGBUS_GPC_BR,
L227: static const u32 gen7_2_0_gmu_registers[] = {
  static_assert(IS_ALIGNED(sizeof(gen7_2_0_gpu_registers), 8));
  
  0x10001, 0x10001, 0x10003, 0x10003, 0x10401, 0x10401, 0x10403, 0x10403,
  0x10801, 0x10801, 0x10803, 0x10803, 0x10c01, 0x10c01, 0x10c03, 0x10c03,
L265: static_assert(IS_ALIGNED(sizeof(gen7_2_0_gmu_registers), 8));
  UINT_MAX, UINT_MAX,
  };
  
  static const u32 gen7_2_0_gmugx_registers[] = {
L267: static const u32 gen7_2_0_gmugx_registers[] = {
  static_assert(IS_ALIGNED(sizeof(gen7_2_0_gmu_registers), 8));
  
  0x1a400, 0x1a41f, 0x1a440, 0x1a45f, 0x1a480, 0x1a49f, 0x1a4c0, 0x1a4df,
  0x1a500, 0x1a51f, 0x1a540, 0x1a55f, 0x1a580, 0x1a59f, 0x1a5c0, 0x1a5df,
L282: static_assert(IS_ALIGNED(sizeof(gen7_2_0_gmugx_registers), 8));
  UINT_MAX, UINT_MAX,
  };
  
  static const u32 gen7_2_0_noncontext_pipe_br_registers[] = {

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_3_0_snapshot.h =====
L29: DEBUGBUS_GMU_GX,
  DEBUGBUS_UFC_0,
  DEBUGBUS_UFC_1,
  DEBUGBUS_DBGC,
  DEBUGBUS_GPC_BR,
L124: static const u32 gen7_3_0_gmu_registers[] = {
  static_assert(IS_ALIGNED(sizeof(gen7_3_0_gpu_registers), 8));
  
  0x10001, 0x10001, 0x10003, 0x10003, 0x10401, 0x10401, 0x10403, 0x10403,
  0x10801, 0x10801, 0x10803, 0x10803, 0x10c01, 0x10c01, 0x10c03, 0x10c03,
L154: static_assert(IS_ALIGNED(sizeof(gen7_3_0_gmu_registers), 8));
  UINT_MAX, UINT_MAX,
  };
  
  static const u32 gen7_3_0_gmu_gx_registers[] = {
L156: static const u32 gen7_3_0_gmu_gx_registers[] = {
  static_assert(IS_ALIGNED(sizeof(gen7_3_0_gmu_registers), 8));
  
  0x1a802, 0x1a802, 0x1a883, 0x1a884, 0x1a900, 0x1a92b, 0x1a940, 0x1a940,
  UINT_MAX, UINT_MAX,
L160: static_assert(IS_ALIGNED(sizeof(gen7_3_0_gmu_gx_registers), 8));
  UINT_MAX, UINT_MAX,
  };
  
  static const u32 gen7_3_0_noncontext_pipe_bv_registers[] = {
L337: { GEN7_CP_SQE_STAT_ADDR, GEN7_CP_SQE_STAT_DATA, 0x33},
  
  static struct gen7_cp_indexed_reg gen7_3_0_cp_indexed_reg_list[] = {
  { GEN7_CP_DRAW_STATE_ADDR, GEN7_CP_DRAW_STATE_DATA, 0x100},
  { GEN7_CP_SQE_UCODE_DBG_ADDR, GEN7_CP_SQE_UCODE_DBG_DATA, 0x8000},
L339: { GEN7_CP_SQE_UCODE_DBG_ADDR, GEN7_CP_SQE_UCODE_DBG_DATA, 0x8000},
  { GEN7_CP_SQE_STAT_ADDR, GEN7_CP_SQE_STAT_DATA, 0x33},
  { GEN7_CP_DRAW_STATE_ADDR, GEN7_CP_DRAW_STATE_DATA, 0x100},
  };
  

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_5_0_snapshot.h =====
L11: static const u32 gen7_5_0_gmu_registers[] = {
  #include "adreno_gen7_2_0_snapshot.h"
  
  0x1a803, 0x1a803, 0x1a805, 0x1a806, 0x1a84e, 0x1a84e, 0x1a856, 0x1a856,
  0x1f400, 0x1f40d, 0x1f40f, 0x1f411, 0x1f500, 0x1f500, 0x1f507, 0x1f507,
L43: static_assert(IS_ALIGNED(sizeof(gen7_5_0_gmu_registers), 8));
  0x23b30, 0x23b30, UINT_MAX, UINT_MAX,
  };
  
  static const u32 gen7_5_0_gmu_ao_registers[] = {
L45: static const u32 gen7_5_0_gmu_ao_registers[] = {
  static_assert(IS_ALIGNED(sizeof(gen7_5_0_gmu_registers), 8));
  
  0x10001, 0x10001, 0x10003, 0x10003, 0x10401, 0x10401, 0x10403, 0x10403,
  0x10801, 0x10801, 0x10803, 0x10803, 0x10c01, 0x10c01, 0x10c03, 0x10c03,
L52: static_assert(IS_ALIGNED(sizeof(gen7_5_0_gmu_ao_registers), 8));
  UINT_MAX, UINT_MAX,
  };
  
  static const u32 gen7_5_0_gmugx_registers[] = {
L54: static const u32 gen7_5_0_gmugx_registers[] = {
  static_assert(IS_ALIGNED(sizeof(gen7_5_0_gmu_ao_registers), 8));
  
  0x1a800, 0x1a802, 0x1a804, 0x1a804, 0x1a816, 0x1a816, 0x1a81e, 0x1a81e,
  0x1a826, 0x1a826, 0x1a82e, 0x1a82e, 0x1a836, 0x1a836, 0x1a83e, 0x1a83e,
L61: static_assert(IS_ALIGNED(sizeof(gen7_5_0_gmugx_registers), 8));
  0x1a900, 0x1a92b, 0x1a940, 0x1a940, UINT_MAX, UINT_MAX,
  };
  
  static const u32 gen7_5_0_gmugx_blk_dec0_dec1_registers[] = {
L63: static const u32 gen7_5_0_gmugx_blk_dec0_dec1_registers[] = {
  static_assert(IS_ALIGNED(sizeof(gen7_5_0_gmugx_registers), 8));
  
  0x1a400, 0x1a41f, 0x1a440, 0x1a45f, 0x1a480, 0x1a49f, 0x1a4c0, 0x1a4df,
  0x1a500, 0x1a51f, 0x1a540, 0x1a55f, 0x1a580, 0x1a59f, 0x1a5c0, 0x1a5df,
L74: static_assert(IS_ALIGNED(sizeof(gen7_5_0_gmugx_blk_dec0_dec1_registers), 8));
  0x1a7fc, 0x1a7fd, UINT_MAX, UINT_MAX,
  };
  
  /*

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_9_0_snapshot.h =====
L36: DEBUGBUS_GMU_GX,
  DEBUGBUS_UFC_0,
  DEBUGBUS_UFC_1,
  DEBUGBUS_DBGC,
  DEBUGBUS_GPC_BR,
L116: DEBUGBUS_GMU_CX,
  static const u32 gen7_9_0_cx_debugbus_blocks[] = {
  DEBUGBUS_CX,
  DEBUGBUS_GBIF_CX,
  };
L292: * Block   : ['GMUAO', 'GMUCX', 'GMUCX_RAM']
  
  /*
  * Pipeline: PIPE_NONE
  * pairs   : 134 (Regs:429)
L296: static const u32 gen7_9_0_gmu_registers[] = {
  * pairs   : 134 (Regs:429)
  */
  0x10001, 0x10001, 0x10003, 0x10003, 0x10401, 0x10401, 0x10403, 0x10403,
  0x10801, 0x10801, 0x10803, 0x10803, 0x10c01, 0x10c01, 0x10c03, 0x10c03,
L333: static_assert(IS_ALIGNED(sizeof(gen7_9_0_gmu_registers), 8));
  UINT_MAX, UINT_MAX,
  };
  
  /*
L336: * Block   : ['GMUGX']
  
  /*
  * Pipeline: PIPE_NONE
  * pairs   : 44 (Regs:454)
L340: static const u32 gen7_9_0_gmugx_registers[] = {
  * pairs   : 44 (Regs:454)
  */
  0x1a400, 0x1a41f, 0x1a440, 0x1a45f, 0x1a480, 0x1a49f, 0x1a4c0, 0x1a4df,
  0x1a500, 0x1a51f, 0x1a540, 0x1a55f, 0x1a580, 0x1a59f, 0x1a600, 0x1a61f,
L354: static_assert(IS_ALIGNED(sizeof(gen7_9_0_gmugx_registers), 8));
  UINT_MAX, UINT_MAX,
  };
  
  /*
L397: * Block   : ['GMUAO', 'GMUCX', 'GMUGX', 'GRAS', 'GXCLKCTL', 'PC']
  /*
  * Block   : ['BROADCAST', 'CP', 'CX_DBGC', 'CX_MISC', 'DBGC', 'GBIF']
  * Block   : ['RBBM', 'RDVM', 'UCHE', 'VFD', 'VPC', 'VSC']
  * Pipeline: PIPE_BR
L418: * Block   : ['GMUAO', 'GMUCX', 'GMUGX', 'GRAS', 'GXCLKCTL', 'PC']
  /*
  * Block   : ['BROADCAST', 'CP', 'CX_DBGC', 'CX_MISC', 'DBGC', 'GBIF']
  * Block   : ['RBBM', 'RDVM', 'UCHE', 'VFD', 'VPC', 'VSC']
  * Pipeline: PIPE_BV
L439: * Block   : ['GMUAO', 'GMUCX', 'GMUGX', 'GRAS', 'GXCLKCTL', 'PC']
  /*
  * Block   : ['BROADCAST', 'CP', 'CX_DBGC', 'CX_MISC', 'DBGC', 'GBIF']
  * Block   : ['RBBM', 'RDVM', 'UCHE', 'VFD', 'VPC', 'VSC']
  * Pipeline: PIPE_LPAC
L1298: { GEN7_CP_SQE_STAT_ADDR, GEN7_CP_SQE_STAT_DATA, 0x00040},
  
  static struct gen7_cp_indexed_reg gen7_9_0_cp_indexed_reg_list[] = {
  { GEN7_CP_DRAW_STATE_ADDR, GEN7_CP_DRAW_STATE_DATA, 0x00200},
  { GEN7_CP_ROQ_DBG_ADDR, GEN7_CP_ROQ_DBG_DATA, 0x00800},
L1301: { GEN7_CP_SQE_UCODE_DBG_ADDR, GEN7_CP_SQE_UCODE_DBG_DATA, 0x08000},
  { GEN7_CP_DRAW_STATE_ADDR, GEN7_CP_DRAW_STATE_DATA, 0x00200},
  { GEN7_CP_ROQ_DBG_ADDR, GEN7_CP_ROQ_DBG_DATA, 0x00800},
  { GEN7_CP_BV_DRAW_STATE_ADDR, GEN7_CP_BV_DRAW_STATE_DATA, 0x00200},
  { GEN7_CP_BV_ROQ_DBG_ADDR, GEN7_CP_BV_ROQ_DBG_DATA, 0x00800},
L1304: { GEN7_CP_BV_SQE_UCODE_DBG_ADDR, GEN7_CP_BV_SQE_UCODE_DBG_DATA, 0x08000},
  { GEN7_CP_BV_DRAW_STATE_ADDR, GEN7_CP_BV_DRAW_STATE_DATA, 0x00200},
  { GEN7_CP_BV_ROQ_DBG_ADDR, GEN7_CP_BV_ROQ_DBG_DATA, 0x00800},
  { GEN7_CP_BV_SQE_STAT_ADDR, GEN7_CP_BV_SQE_STAT_DATA, 0x00040},
  { GEN7_CP_RESOURCE_TABLE_DBG_ADDR, GEN7_CP_RESOURCE_TABLE_DBG_DATA, 0x04100},
L1305: { GEN7_CP_BV_SQE_STAT_ADDR, GEN7_CP_BV_SQE_STAT_DATA, 0x00040},
  { GEN7_CP_BV_ROQ_DBG_ADDR, GEN7_CP_BV_ROQ_DBG_DATA, 0x00800},
  { GEN7_CP_BV_SQE_UCODE_DBG_ADDR, GEN7_CP_BV_SQE_UCODE_DBG_DATA, 0x08000},
  { GEN7_CP_RESOURCE_TABLE_DBG_ADDR, GEN7_CP_RESOURCE_TABLE_DBG_DATA, 0x04100},
  { GEN7_CP_LPAC_DRAW_STATE_ADDR, GEN7_CP_LPAC_DRAW_STATE_DATA, 0x00200},
L1309: { GEN7_CP_SQE_AC_UCODE_DBG_ADDR, GEN7_CP_SQE_AC_UCODE_DBG_DATA, 0x08000},
  { GEN7_CP_LPAC_DRAW_STATE_ADDR, GEN7_CP_LPAC_DRAW_STATE_DATA, 0x00200},
  { GEN7_CP_LPAC_ROQ_DBG_ADDR, GEN7_CP_LPAC_ROQ_DBG_DATA, 0x00200},
  { GEN7_CP_SQE_AC_STAT_ADDR, GEN7_CP_SQE_AC_STAT_DATA, 0x00040},
  { GEN7_CP_LPAC_FIFO_DBG_ADDR, GEN7_CP_LPAC_FIFO_DBG_DATA, 0x00040},
L1310: { GEN7_CP_SQE_AC_STAT_ADDR, GEN7_CP_SQE_AC_STAT_DATA, 0x00040},
  { GEN7_CP_LPAC_ROQ_DBG_ADDR, GEN7_CP_LPAC_ROQ_DBG_DATA, 0x00200},
  { GEN7_CP_SQE_AC_UCODE_DBG_ADDR, GEN7_CP_SQE_AC_UCODE_DBG_DATA, 0x08000},
  { GEN7_CP_LPAC_FIFO_DBG_ADDR, GEN7_CP_LPAC_FIFO_DBG_DATA, 0x00040},
  { GEN7_CP_AQE_ROQ_DBG_ADDR_0, GEN7_CP_AQE_ROQ_DBG_DATA_0, 0x00100},

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_coresight.c =====
L67: { GEN7_DBGC_SMMU_FAULT_BLOCK_HALT_CFG },
  { GEN7_DBGC_AHB_DBG_CNTL },
  { GEN7_DBGC_CFG_DBGBUS_MISC_MODE },
  };
  

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_gmu.c =====
L10: #include <linux/firmware.h>
  #include <linux/delay.h>
  #include <linux/dma-map-ops.h>
  #include <linux/interconnect.h>
  #include <linux/io.h>
L24: #include "kgsl_gmu_core.h"
  #include "kgsl_bus.h"
  #include "kgsl_device.h"
  #include "kgsl_trace.h"
  #include "kgsl_util.h"
L28: static struct gmu_vma_entry gen7_gmu_vma[] = {
  #include "kgsl_util.h"
  
  [GMU_ITCM] = {
  .start = 0x00000000,
L29: [GMU_ITCM] = {
  
  static struct gmu_vma_entry gen7_gmu_vma[] = {
  .start = 0x00000000,
  .size = SZ_16K,
L33: [GMU_CACHE] = {
  .size = SZ_16K,
  },
  .start = SZ_16K,
  .size = (SZ_16M - SZ_16K),
L38: [GMU_DTCM] = {
  .next_va = SZ_16K,
  },
  .start = SZ_256M + SZ_16K,
  .size = SZ_16K,
L42: [GMU_DCACHE] = {
  .size = SZ_16K,
  },
  .start = 0x0,
  .size = 0x0,
L46: [GMU_NONCACHED_KERNEL] = {
  .size = 0x0,
  },
  .start = 0x60000000,
  .size = SZ_512M,
L51: [GMU_NONCACHED_KERNEL_EXTENDED] = {
  .next_va = 0x60000000,
  },
  .start = 0xc0000000,
  .size = SZ_512M,
L59: * adreno_gmu_chipid_based() - Return true for targets where Chipid
  
  /**
  * should be passed to GMU instead of GPU REV
  * @adreno_dev: A pointer to the adreno_device
L60: * should be passed to GMU instead of GPU REV
  /**
  * adreno_gmu_chipid_based() - Return true for targets where Chipid
  * @adreno_dev: A pointer to the adreno_device
  */
L63: static inline int adreno_gmu_chipid_based(struct adreno_device *adreno_dev)
  * @adreno_dev: A pointer to the adreno_device
  */
  {
  return adreno_is_gen7_0_0(adreno_dev) || adreno_is_gen7_0_1(adreno_dev) ||
L72: struct gen7_gmu_device *gmu = container_of(kobj, struct gen7_gmu_device, log_kobj);
  struct kobj_attribute *attr, const char *buf, size_t count)
  {
  bool val;
  int ret;
L80: gmu->log_stream_enable = val;
  return ret;
  
  gmu_core_mark_for_coldboot(KGSL_DEVICE(gen7_gmu_to_adreno(gmu)));
  return count;
L81: gmu_core_mark_for_coldboot(KGSL_DEVICE(gen7_gmu_to_adreno(gmu)));
  
  gmu->log_stream_enable = val;
  return count;
  }
L87: struct gen7_gmu_device *gmu = container_of(kobj, struct gen7_gmu_device, log_kobj);
  static ssize_t log_stream_enable_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
  {
  
  return scnprintf(buf, PAGE_SIZE, "%d\n", gmu->log_stream_enable);
L89: return scnprintf(buf, PAGE_SIZE, "%d\n", gmu->log_stream_enable);
  struct gen7_gmu_device *gmu = container_of(kobj, struct gen7_gmu_device, log_kobj);
  
  }
  
L95: struct gen7_gmu_device *gmu = container_of(kobj, struct gen7_gmu_device, log_kobj);
  struct kobj_attribute *attr, const char *buf, size_t count)
  {
  u32 val;
  int ret;
L103: gmu->log_group_mask = val;
  return ret;
  
  gmu_core_mark_for_coldboot(KGSL_DEVICE(gen7_gmu_to_adreno(gmu)));
  return count;
L104: gmu_core_mark_for_coldboot(KGSL_DEVICE(gen7_gmu_to_adreno(gmu)));
  
  gmu->log_group_mask = val;
  return count;
  }
L110: struct gen7_gmu_device *gmu = container_of(kobj, struct gen7_gmu_device, log_kobj);
  static ssize_t log_group_mask_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
  {
  
  return scnprintf(buf, PAGE_SIZE, "%x\n", gmu->log_group_mask);
L112: return scnprintf(buf, PAGE_SIZE, "%x\n", gmu->log_group_mask);
  struct gen7_gmu_device *gmu = container_of(kobj, struct gen7_gmu_device, log_kobj);
  
  }
  
L136: struct gen7_gmu_device *gmu = container_of(kobj, struct gen7_gmu_device, stats_kobj);
  struct kobj_attribute *attr, const char *buf, size_t count)
  {
  bool val;
  int ret;
L144: gmu->stats_enable = val;
  return ret;
  
  gmu_core_mark_for_coldboot(KGSL_DEVICE(gen7_gmu_to_adreno(gmu)));
  return count;
L145: gmu_core_mark_for_coldboot(KGSL_DEVICE(gen7_gmu_to_adreno(gmu)));
  
  gmu->stats_enable = val;
  return count;
  }
L151: struct gen7_gmu_device *gmu = container_of(kobj, struct gen7_gmu_device, stats_kobj);
  static ssize_t stats_enable_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
  {
  
  return scnprintf(buf, PAGE_SIZE, "%d\n", gmu->stats_enable);
L153: return scnprintf(buf, PAGE_SIZE, "%d\n", gmu->stats_enable);
  struct gen7_gmu_device *gmu = container_of(kobj, struct gen7_gmu_device, stats_kobj);
  
  }
  
L159: struct gen7_gmu_device *gmu = container_of(kobj, struct gen7_gmu_device, stats_kobj);
  struct kobj_attribute *attr, const char *buf, size_t count)
  {
  u32 val;
  int ret;
L167: gmu->stats_mask = val;
  return ret;
  
  gmu_core_mark_for_coldboot(KGSL_DEVICE(gen7_gmu_to_adreno(gmu)));
  return count;
L168: gmu_core_mark_for_coldboot(KGSL_DEVICE(gen7_gmu_to_adreno(gmu)));
  
  gmu->stats_mask = val;
  return count;
  }

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_gmu.h =====
L6: #ifndef __ADRENO_GEN7_GMU_H
  * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
  */
  #define __ADRENO_GEN7_GMU_H
  
L7: #define __ADRENO_GEN7_GMU_H
  */
  #ifndef __ADRENO_GEN7_GMU_H
  
  #include <linux/mailbox_client.h>
L12: #include "adreno_gen7_hfi.h"
  #include <linux/soc/qcom/qcom_aoss.h>
  
  #include "kgsl_gmu_core.h"
  
L13: #include "kgsl_gmu_core.h"
  
  #include "adreno_gen7_hfi.h"
  
  struct gen7_dcvs_table {
L17: u32 gmu_level_num;
  struct gen7_dcvs_table {
  u32 gpu_level_num;
  struct opp_gx_desc gx_votes[MAX_GX_LEVELS];
  struct opp_desc cx_votes[MAX_CX_LEVELS_LEGACY];
L23: * struct gen7_gmu_device - GMU device structure
  
  /**
  * @ver: GMU Version information
  * @irq: GMU interrupt number
L24: * @ver: GMU Version information
  /**
  * struct gen7_gmu_device - GMU device structure
  * @irq: GMU interrupt number
  * @fw_image: GMU FW image
L25: * @irq: GMU interrupt number
  * struct gen7_gmu_device - GMU device structure
  * @ver: GMU Version information
  * @fw_image: GMU FW image
  * @gmu_log: gmu event log memory
L26: * @fw_image: GMU FW image
  * @ver: GMU Version information
  * @irq: GMU interrupt number
  * @gmu_log: gmu event log memory
  * @hfi: HFI controller
L27: * @gmu_log: gmu event log memory
  * @irq: GMU interrupt number
  * @fw_image: GMU FW image
  * @hfi: HFI controller
  * @idle_level: Minimal GPU idle power level
L28: * @hfi: HFI controller
  * @fw_image: GMU FW image
  * @gmu_log: gmu event log memory
  * @idle_level: Minimal GPU idle power level
  * @mailbox: Messages to AOP for ACD enable/disable go through this
L33: struct gen7_gmu_device {
  * @log_wptr_retention: Store the log wptr offset on slumber
  */
  int irq;
  const struct firmware *fw_image;
L35: const struct firmware *fw_image;
  struct gen7_gmu_device {
  int irq;
  struct kgsl_memdesc *gmu_log;
  /** @gmu_init_scratch: Memory to store the initial HFI messages */
L36: struct kgsl_memdesc *gmu_log;
  int irq;
  const struct firmware *fw_image;
  /** @gmu_init_scratch: Memory to store the initial HFI messages */
  struct kgsl_memdesc *gmu_init_scratch;
L37: /** @gmu_init_scratch: Memory to store the initial HFI messages */
  const struct firmware *fw_image;
  struct kgsl_memdesc *gmu_log;
  struct kgsl_memdesc *gmu_init_scratch;
  /** @gpu_boot_scratch: Memory to store the bootup HFI messages */
L38: struct kgsl_memdesc *gmu_init_scratch;
  struct kgsl_memdesc *gmu_log;
  /** @gmu_init_scratch: Memory to store the initial HFI messages */
  /** @gpu_boot_scratch: Memory to store the bootup HFI messages */
  struct kgsl_memdesc *gpu_boot_scratch;
L39: /** @gpu_boot_scratch: Memory to store the bootup HFI messages */
  /** @gmu_init_scratch: Memory to store the initial HFI messages */
  struct kgsl_memdesc *gmu_init_scratch;
  struct kgsl_memdesc *gpu_boot_scratch;
  struct gen7_hfi hfi;
L41: struct gen7_hfi hfi;
  /** @gpu_boot_scratch: Memory to store the bootup HFI messages */
  struct kgsl_memdesc *gpu_boot_scratch;
  unsigned int idle_level;
  /** @qmp: Pointer to qmp struct used for AOP messages*/
L47: /** @cm3_fault: whether gmu received a cm3 fault interrupt */
  struct kgsl_mailbox mailbox;
  unsigned int log_wptr_retention;
  atomic_t cm3_fault;
  /**
L50: * @itcm_shadow: Copy of the itcm block in firmware binary used for
  atomic_t cm3_fault;
  /**
  * snapshot
  */
L54: /** @flags: Internal gmu flags */
  */
  void *itcm_shadow;
  unsigned long flags;
  /** @rscc_virt: Pointer where RSCC block is mapped */
L58: /** @log_stream_enable: GMU log streaming enable. Disabled by default */
  /** @rscc_virt: Pointer where RSCC block is mapped */
  void __iomem *rscc_virt;
  bool log_stream_enable;
  /** @log_group_mask: Allows overriding default GMU log group mask */
L60: /** @log_group_mask: Allows overriding default GMU log group mask */
  /** @log_stream_enable: GMU log streaming enable. Disabled by default */
  bool log_stream_enable;
  u32 log_group_mask;
  struct kobject log_kobj;
L69: /** @stats_enable: GMU stats feature enable */
  /** @acd_debug_val: DVM value to calibrate ACD for a level */
  u32 acd_debug_val;
  bool stats_enable;
  /** @stats_mask: GMU performance countables to enable */
L71: /** @stats_mask: GMU performance countables to enable */
  /** @stats_enable: GMU stats feature enable */
  bool stats_enable;
  u32 stats_mask;
  /** @stats_interval: GMU performance counters sampling interval */
L73: /** @stats_interval: GMU performance counters sampling interval */
  /** @stats_mask: GMU performance countables to enable */
  u32 stats_mask;
  u32 stats_interval;
  /** @stats_kobj: kernel object for GMU stats directory in sysfs */
L75: /** @stats_kobj: kernel object for GMU stats directory in sysfs */
  /** @stats_interval: GMU performance counters sampling interval */
  u32 stats_interval;
  struct kobject stats_kobj;
  /** @cp_init_hdr: raw command header for cp_init */
L77: /** @cp_init_hdr: raw command header for cp_init */
  /** @stats_kobj: kernel object for GMU stats directory in sysfs */
  struct kobject stats_kobj;
  u32 cp_init_hdr;
  /** @switch_to_unsec_hdr: raw command header for switch to unsecure packet */
L78: u32 cp_init_hdr;
  struct kobject stats_kobj;
  /** @cp_init_hdr: raw command header for cp_init */
  /** @switch_to_unsec_hdr: raw command header for switch to unsecure packet */
  u32 switch_to_unsec_hdr;
L85: /* Helper function to get to gen7 gmu device from adreno device */
  };
  
  struct gen7_gmu_device *to_gen7_gmu(struct adreno_device *adreno_dev);
  

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_gmu_snapshot.c =====
L10: #include "adreno_gen7_gmu.h"
  #include "adreno.h"
  #include "adreno_gen7.h"
  #include "adreno_snapshot.h"
  #include "adreno_gen7_0_0_snapshot.h"
L16: #include "kgsl_gmu_core.h"
  #include "adreno_gen7_6_0_snapshot.h"
  #include "kgsl_device.h"
  
  static size_t gen7_gmu_snapshot_dtcm(struct kgsl_device *device,
L18: static size_t gen7_gmu_snapshot_dtcm(struct kgsl_device *device,
  #include "kgsl_gmu_core.h"
  
  u8 *buf, size_t remain, void *priv)
  {
L21: struct gmu_core_device *gmu_core = &device->gmu_core;
  u8 *buf, size_t remain, void *priv)
  {
  struct kgsl_snapshot_gmu_mem *mem_hdr =
  (struct kgsl_snapshot_gmu_mem *)buf;
L22: struct kgsl_snapshot_gmu_mem *mem_hdr =
  {
  struct gmu_core_device *gmu_core = &device->gmu_core;
  (struct kgsl_snapshot_gmu_mem *)buf;
  struct adreno_device *adreno_dev = ADRENO_DEVICE(device);
L23: (struct kgsl_snapshot_gmu_mem *)buf;
  struct gmu_core_device *gmu_core = &device->gmu_core;
  struct kgsl_snapshot_gmu_mem *mem_hdr =
  struct adreno_device *adreno_dev = ADRENO_DEVICE(device);
  u32 *data = (u32 *)(buf + sizeof(*mem_hdr));
L28: if (remain < gmu_core->vma[GMU_DTCM].size + sizeof(*mem_hdr)) {
  u32 i;
  
  SNAPSHOT_ERR_NOMEM(device, "GMU DTCM Memory");
  return 0;
L29: SNAPSHOT_ERR_NOMEM(device, "GMU DTCM Memory");
  
  if (remain < gmu_core->vma[GMU_DTCM].size + sizeof(*mem_hdr)) {
  return 0;
  }
L33: mem_hdr->type = SNAPSHOT_GMU_MEM_BIN_BLOCK;
  }
  
  mem_hdr->hostaddr = 0;
  mem_hdr->gmuaddr = gmu_core->vma[GMU_DTCM].start;
L35: mem_hdr->gmuaddr = gmu_core->vma[GMU_DTCM].start;
  mem_hdr->type = SNAPSHOT_GMU_MEM_BIN_BLOCK;
  mem_hdr->hostaddr = 0;
  mem_hdr->gpuaddr = 0;
  
L39: * Read of GMU TCMs over side-band debug controller interface is
  
  /*
  * supported on gen7_2_x family
  */
L50: for (i = 0; i < (gmu_core->vma[GMU_DTCM].size >> 2); i++)
  kgsl_regwrite(device, GEN7_CX_DBGC_TCM_DBG_ADDR, BIT(20) | BIT(31));
  
  kgsl_regread(device, GEN7_CX_DBGC_TCM_DBG_DATA, data++);
  } else {
L53: for (i = 0; i < (gmu_core->vma[GMU_DTCM].size >> 2); i++)
  kgsl_regread(device, GEN7_CX_DBGC_TCM_DBG_DATA, data++);
  } else {
  gmu_core_regread(device, GEN7_GMU_CM3_DTCM_START + i, data++);
  }
L54: gmu_core_regread(device, GEN7_GMU_CM3_DTCM_START + i, data++);
  } else {
  for (i = 0; i < (gmu_core->vma[GMU_DTCM].size >> 2); i++)
  }
  
L57: return gmu_core->vma[GMU_DTCM].size + sizeof(*mem_hdr);
  }
  
  }
  
L60: static size_t gen7_gmu_snapshot_itcm(struct kgsl_device *device,
  }
  
  u8 *buf, size_t remain, void *priv)
  {
L63: struct gmu_core_device *gmu_core = &device->gmu_core;
  u8 *buf, size_t remain, void *priv)
  {
  struct kgsl_snapshot_gmu_mem *mem_hdr =
  (struct kgsl_snapshot_gmu_mem *)buf;
L64: struct kgsl_snapshot_gmu_mem *mem_hdr =
  {
  struct gmu_core_device *gmu_core = &device->gmu_core;
  (struct kgsl_snapshot_gmu_mem *)buf;
  void *dest = buf + sizeof(*mem_hdr);
L65: (struct kgsl_snapshot_gmu_mem *)buf;
  struct gmu_core_device *gmu_core = &device->gmu_core;
  struct kgsl_snapshot_gmu_mem *mem_hdr =
  void *dest = buf + sizeof(*mem_hdr);
  struct gen7_gmu_device *gmu = (struct gen7_gmu_device *)priv;
L67: struct gen7_gmu_device *gmu = (struct gen7_gmu_device *)priv;
  (struct kgsl_snapshot_gmu_mem *)buf;
  void *dest = buf + sizeof(*mem_hdr);
  
  if (!gmu->itcm_shadow) {
L69: if (!gmu->itcm_shadow) {
  struct gen7_gmu_device *gmu = (struct gen7_gmu_device *)priv;
  
  dev_err(GMU_PDEV_DEV(device),
  "No memory allocated for ITCM shadow capture\n");
L70: dev_err(GMU_PDEV_DEV(device),
  
  if (!gmu->itcm_shadow) {
  "No memory allocated for ITCM shadow capture\n");
  return 0;
L75: if (remain < gmu_core->vma[GMU_ITCM].size + sizeof(*mem_hdr)) {
  }
  
  SNAPSHOT_ERR_NOMEM(device, "GMU ITCM Memory");
  return 0;
L76: SNAPSHOT_ERR_NOMEM(device, "GMU ITCM Memory");
  
  if (remain < gmu_core->vma[GMU_ITCM].size + sizeof(*mem_hdr)) {
  return 0;
  }
L80: mem_hdr->type = SNAPSHOT_GMU_MEM_BIN_BLOCK;
  }
  
  mem_hdr->hostaddr = 0;
  mem_hdr->gmuaddr = gmu_core->vma[GMU_ITCM].start;
L82: mem_hdr->gmuaddr = gmu_core->vma[GMU_ITCM].start;
  mem_hdr->type = SNAPSHOT_GMU_MEM_BIN_BLOCK;
  mem_hdr->hostaddr = 0;
  mem_hdr->gpuaddr = 0;
  
L85: memcpy(dest, gmu->itcm_shadow, gmu_core->vma[GMU_ITCM].size);
  mem_hdr->gpuaddr = 0;
  
  
  return gmu_core->vma[GMU_ITCM].size + sizeof(*mem_hdr);
L87: return gmu_core->vma[GMU_ITCM].size + sizeof(*mem_hdr);
  memcpy(dest, gmu->itcm_shadow, gmu_core->vma[GMU_ITCM].size);
  
  }
  
L90: static void gen7_gmu_snapshot_memories(struct kgsl_device *device,
  }
  
  struct gen7_gmu_device *gmu, struct kgsl_snapshot *snapshot)
  {
L91: struct gen7_gmu_device *gmu, struct kgsl_snapshot *snapshot)
  
  static void gen7_gmu_snapshot_memories(struct kgsl_device *device,
  {
  struct gmu_mem_type_desc desc;

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hfi.c =====
L12: #include "adreno_gen7_gmu.h"
  #include "adreno.h"
  #include "adreno_gen7.h"
  #include "adreno_gen7_hfi.h"
  #include "kgsl_device.h"
L13: #include "adreno_gen7_hfi.h"
  #include "adreno_gen7.h"
  #include "adreno_gen7_gmu.h"
  #include "kgsl_device.h"
  #include "kgsl_trace.h"
L17: /* Below section is for all structures related to HFI queues */
  #include "kgsl_trace.h"
  
  #define HFI_QUEUE_MAX HFI_QUEUE_DEFAULT_CNT
  
L18: #define HFI_QUEUE_MAX HFI_QUEUE_DEFAULT_CNT
  
  /* Below section is for all structures related to HFI queues */
  
  /* Total header sizes + queue sizes + 16 for alignment */
L21: #define HFIMEM_SIZE (sizeof(struct hfi_queue_table) + 16 + \
  
  /* Total header sizes + queue sizes + 16 for alignment */
  (HFI_QUEUE_SIZE * HFI_QUEUE_MAX))
  
L22: (HFI_QUEUE_SIZE * HFI_QUEUE_MAX))
  /* Total header sizes + queue sizes + 16 for alignment */
  #define HFIMEM_SIZE (sizeof(struct hfi_queue_table) + 16 + \
  
  #define HOST_QUEUE_START_ADDR(hfi_mem, i) \
L24: #define HOST_QUEUE_START_ADDR(hfi_mem, i) \
  (HFI_QUEUE_SIZE * HFI_QUEUE_MAX))
  
  ((hfi_mem)->hostptr + HFI_QUEUE_OFFSET(i))
  
L25: ((hfi_mem)->hostptr + HFI_QUEUE_OFFSET(i))
  
  #define HOST_QUEUE_START_ADDR(hfi_mem, i) \
  
  struct gen7_hfi *to_gen7_hfi(struct adreno_device *adreno_dev)
L27: struct gen7_hfi *to_gen7_hfi(struct adreno_device *adreno_dev)
  ((hfi_mem)->hostptr + HFI_QUEUE_OFFSET(i))
  
  {
  struct gen7_gmu_device *gmu = to_gen7_gmu(adreno_dev);
L29: struct gen7_gmu_device *gmu = to_gen7_gmu(adreno_dev);
  struct gen7_hfi *to_gen7_hfi(struct adreno_device *adreno_dev)
  {
  
  return &gmu->hfi;
L31: return &gmu->hfi;
  struct gen7_gmu_device *gmu = to_gen7_gmu(adreno_dev);
  
  }
  
L35: int gen7_hfi_queue_read(struct gen7_gmu_device *gmu, u32 queue_idx,
  
  /* Size in below functions are in unit of dwords */
  unsigned int *output, unsigned int max_size)
  {
L38: struct kgsl_device *device = KGSL_DEVICE(gen7_gmu_to_adreno(gmu));
  unsigned int *output, unsigned int max_size)
  {
  struct kgsl_memdesc *mem_addr = gmu->hfi.hfi_mem;
  struct hfi_queue_table *tbl = mem_addr->hostptr;
L39: struct kgsl_memdesc *mem_addr = gmu->hfi.hfi_mem;
  {
  struct kgsl_device *device = KGSL_DEVICE(gen7_gmu_to_adreno(gmu));
  struct hfi_queue_table *tbl = mem_addr->hostptr;
  struct hfi_queue_header *hdr = &tbl->qhdr[queue_idx];
L40: struct hfi_queue_table *tbl = mem_addr->hostptr;
  struct kgsl_device *device = KGSL_DEVICE(gen7_gmu_to_adreno(gmu));
  struct kgsl_memdesc *mem_addr = gmu->hfi.hfi_mem;
  struct hfi_queue_header *hdr = &tbl->qhdr[queue_idx];
  u32 *queue;
L41: struct hfi_queue_header *hdr = &tbl->qhdr[queue_idx];
  struct kgsl_memdesc *mem_addr = gmu->hfi.hfi_mem;
  struct hfi_queue_table *tbl = mem_addr->hostptr;
  u32 *queue;
  u32 msg_hdr;
L48: if (hdr->status == HFI_QUEUE_STATUS_DISABLED)
  int result = 0;
  
  return -EINVAL;
  
L62: dev_err(GMU_PDEV_DEV(device),
  
  if (size > (max_size >> 2)) {
  "HFI message too big: hdr:0x%x rd idx=%d\n",
  msg_hdr, hdr->read_index);
L63: "HFI message too big: hdr:0x%x rd idx=%d\n",
  if (size > (max_size >> 2)) {
  dev_err(GMU_PDEV_DEV(device),
  msg_hdr, hdr->read_index);
  result = -EMSGSIZE;
L79: dev_err(GMU_PDEV_DEV(device),
  } else {
  /* In case FW messed up */
  "Read index %d greater than queue size %d\n",
  hdr->read_index, hdr->queue_size);
L87: hfi_update_read_idx(hdr, read);
  read = ALIGN(read, SZ_4) % hdr->queue_size;
  
  
  /* For acks, trace the packet for which this ack was sent */
L90: if (MSG_HDR_GET_TYPE(msg_hdr) == HFI_MSG_ACK)
  
  /* For acks, trace the packet for which this ack was sent */
  trace_kgsl_hfi_receive(MSG_HDR_GET_ID(output[1]),
  MSG_HDR_GET_SIZE(output[1]),
L91: trace_kgsl_hfi_receive(MSG_HDR_GET_ID(output[1]),
  /* For acks, trace the packet for which this ack was sent */
  if (MSG_HDR_GET_TYPE(msg_hdr) == HFI_MSG_ACK)
  MSG_HDR_GET_SIZE(output[1]),
  MSG_HDR_GET_SEQNUM(output[1]));
L95: trace_kgsl_hfi_receive(MSG_HDR_GET_ID(msg_hdr),
  MSG_HDR_GET_SEQNUM(output[1]));
  else
  MSG_HDR_GET_SIZE(msg_hdr), MSG_HDR_GET_SEQNUM(msg_hdr));
  
L102: int gen7_hfi_queue_write(struct adreno_device *adreno_dev, u32 queue_idx,
  }
  
  u32 *msg, u32 size_bytes)
  {
L105: struct gen7_gmu_device *gmu = to_gen7_gmu(adreno_dev);
  u32 *msg, u32 size_bytes)
  {
  struct hfi_queue_table *tbl = gmu->hfi.hfi_mem->hostptr;
  struct hfi_queue_header *hdr = &tbl->qhdr[queue_idx];
L106: struct hfi_queue_table *tbl = gmu->hfi.hfi_mem->hostptr;
  {
  struct gen7_gmu_device *gmu = to_gen7_gmu(adreno_dev);
  struct hfi_queue_header *hdr = &tbl->qhdr[queue_idx];
  u32 *queue;
L107: struct hfi_queue_header *hdr = &tbl->qhdr[queue_idx];
  struct gen7_gmu_device *gmu = to_gen7_gmu(adreno_dev);
  struct hfi_queue_table *tbl = gmu->hfi.hfi_mem->hostptr;
  u32 *queue;
  u32 i, write_idx, read_idx, empty_space;
L114: if (hdr->status == HFI_QUEUE_STATUS_DISABLED || !IS_ALIGNED(size_bytes, sizeof(u32)))
  u32 id = MSG_HDR_GET_ID(*msg);
  
  return -EINVAL;
  
L117: queue = HOST_QUEUE_START_ADDR(gmu->hfi.hfi_mem, queue_idx);
  return -EINVAL;
  
  
  write_idx = hdr->write_index;

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hfi.h =====
L6: #ifndef __ADRENO_GEN7_HFI_H
  * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
  */
  #define __ADRENO_GEN7_HFI_H
  
L7: #define __ADRENO_GEN7_HFI_H
  */
  #ifndef __ADRENO_GEN7_HFI_H
  
  #include "adreno_hfi.h"
L9: #include "adreno_hfi.h"
  #define __ADRENO_GEN7_HFI_H
  
  
  /**
L12: * struct gen7_hfi - HFI control structure
  
  /**
  */
  struct gen7_hfi {
L14: struct gen7_hfi {
  * struct gen7_hfi - HFI control structure
  */
  /** @irq: HFI interrupt line */
  int irq;
L15: /** @irq: HFI interrupt line */
  */
  struct gen7_hfi {
  int irq;
  /** @seqnum: atomic counter that is incremented for each message sent.
L18: *   The value of the counter is used as sequence number for HFI message.
  int irq;
  /** @seqnum: atomic counter that is incremented for each message sent.
  */
  atomic_t seqnum;
L21: /** @hfi_mem: Memory descriptor for the hfi memory */
  */
  atomic_t seqnum;
  struct kgsl_memdesc *hfi_mem;
  /** @bw_table: HFI BW table buffer */
L22: struct kgsl_memdesc *hfi_mem;
  atomic_t seqnum;
  /** @hfi_mem: Memory descriptor for the hfi memory */
  /** @bw_table: HFI BW table buffer */
  struct hfi_bwtable_cmd bw_table;
L23: /** @bw_table: HFI BW table buffer */
  /** @hfi_mem: Memory descriptor for the hfi memory */
  struct kgsl_memdesc *hfi_mem;
  struct hfi_bwtable_cmd bw_table;
  /** @acd_table: HFI table for ACD data */
L24: struct hfi_bwtable_cmd bw_table;
  struct kgsl_memdesc *hfi_mem;
  /** @bw_table: HFI BW table buffer */
  /** @acd_table: HFI table for ACD data */
  struct hfi_acd_table_cmd acd_table;
L25: /** @acd_table: HFI table for ACD data */
  /** @bw_table: HFI BW table buffer */
  struct hfi_bwtable_cmd bw_table;
  struct hfi_acd_table_cmd acd_table;
  /** @cmdq_lock: Spinlock for accessing the cmdq */
L26: struct hfi_acd_table_cmd acd_table;
  struct hfi_bwtable_cmd bw_table;
  /** @acd_table: HFI table for ACD data */
  /** @cmdq_lock: Spinlock for accessing the cmdq */
  spinlock_t cmdq_lock;
L31: * of messages in the GMU scratch.
  /**
  * @wb_set_record_bitmask: Bitmask to enable or disable the recording
  */
  unsigned long wb_set_record_bitmask[BITS_TO_LONGS(HFI_MAX_ID)];
L33: unsigned long wb_set_record_bitmask[BITS_TO_LONGS(HFI_MAX_ID)];
  * of messages in the GMU scratch.
  */
  };
  
L36: struct gen7_gmu_device;
  };
  
  
  /* gen7_hfi_irq_handler - IRQ handler for HFI interripts */
L38: /* gen7_hfi_irq_handler - IRQ handler for HFI interripts */
  struct gen7_gmu_device;
  
  irqreturn_t gen7_hfi_irq_handler(int irq, void *data);
  
L39: irqreturn_t gen7_hfi_irq_handler(int irq, void *data);
  
  /* gen7_hfi_irq_handler - IRQ handler for HFI interripts */
  
  /**
L42: * gen7_hfi_start - Send the various HFIs during device boot up
  
  /**
  * @adreno_dev: Pointer to the adreno device
  *
L47: int gen7_hfi_start(struct adreno_device *adreno_dev);
  * Return: 0 on success or negative error on failure
  */
  
  /**
L50: * gen7_hfi_start - Send the various HFIs during device boot up
  
  /**
  * @adreno_dev: Pointer to the adreno device
  *
L55: void gen7_hfi_stop(struct adreno_device *adreno_dev);
  * Return: 0 on success or negative error on failure
  */
  
  /**
L58: * gen7_hfi_init - Initialize hfi resources
  
  /**
  * @adreno_dev: Pointer to the adreno device
  *
L61: * This function allocates and sets up hfi queues
  * @adreno_dev: Pointer to the adreno device
  *
  * when a process creates the very first kgsl instance
  *
L66: int gen7_hfi_init(struct adreno_device *adreno_dev);
  * Return: 0 on success or negative error on failure
  */
  
  /* Helper function to get to gen7 hfi struct from adreno device */
L68: /* Helper function to get to gen7 hfi struct from adreno device */
  int gen7_hfi_init(struct adreno_device *adreno_dev);
  
  struct gen7_hfi *to_gen7_hfi(struct adreno_device *adreno_dev);
  
L69: struct gen7_hfi *to_gen7_hfi(struct adreno_device *adreno_dev);
  
  /* Helper function to get to gen7 hfi struct from adreno device */
  
  /**
L72: * gen7_hfi_queue_write - Write a command to hfi queue
  
  /**
  * @adreno_dev: Pointer to the adreno device
  * @queue_idx: destination queue id
L80: int gen7_hfi_queue_write(struct adreno_device *adreno_dev, u32 queue_idx,
  * Return: 0 on success or negative error on failure
  */
  u32 *msg, u32 size_bytes);
  
L84: * gen7_hfi_queue_read - Read data from hfi queue
  
  /**
  * @gmu: Pointer to the gen7 gmu device
  * @queue_idx: queue id to read from

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched.c =====
L15: #include "kgsl_gmu_core.h"
  #include "kgsl_bus.h"
  #include "kgsl_device.h"
  #include "kgsl_trace.h"
  #include "kgsl_util.h"
L21: struct gen7_hwsched_hfi *hfi = to_gen7_hwsched_hfi(adreno_dev);
  static void _wakeup_hw_fence_waiters(struct adreno_device *adreno_dev, u32 fault)
  {
  struct adreno_hwsched_hw_fence *hwf = &adreno_dev->hwsched.hw_fence;
  bool lock = !in_interrupt();
L51: kgsl_delete_timer(&hfi->hw_fence_timer);
  wake_up_all(&hwf->unack_wq);
  
  }
  
L74: gen7_gmu_snapshot(adreno_dev, snapshot);
  bool parse_payload;
  
  
  adreno_hwsched_parse_fault_cmdobj(adreno_dev, snapshot);
L79: * First try to dump ringbuffers using context bad HFI payloads
  
  /*
  * because they have all the ringbuffer parameters. If ringbuffer
  * payloads are not present, fall back to dumping ringbuffers
L80: * because they have all the ringbuffer parameters. If ringbuffer
  /*
  * First try to dump ringbuffers using context bad HFI payloads
  * payloads are not present, fall back to dumping ringbuffers
  * based on MEMKIND_RB
L81: * payloads are not present, fall back to dumping ringbuffers
  * First try to dump ringbuffers using context bad HFI payloads
  * because they have all the ringbuffer parameters. If ringbuffer
  * based on MEMKIND_RB
  */
L84: if (GMU_VER_MINOR(device->gmu_core.ver.hfi) < 2)
  * based on MEMKIND_RB
  */
  parse_payload = adreno_hwsched_parse_payload_rb_legacy(adreno_dev, snapshot);
  else
L93: struct hfi_mem_alloc_entry *entry = &hwsched->mem_alloc_table[i];
  
  for (i = 0; i < hwsched->mem_alloc_entries; i++) {
  
  if (entry->desc.mem_kind == HFI_MEMKIND_RB && !skip_memkind_rb)
L95: if (entry->desc.mem_kind == HFI_MEMKIND_RB && !skip_memkind_rb)
  struct hfi_mem_alloc_entry *entry = &hwsched->mem_alloc_table[i];
  
  kgsl_snapshot_add_section(device,
  KGSL_SNAPSHOT_SECTION_RB_V2,
L101: if (entry->desc.mem_kind == HFI_MEMKIND_SCRATCH)
  entry->md);
  
  kgsl_snapshot_add_section(device,
  KGSL_SNAPSHOT_SECTION_GPU_OBJECT_V2,
L107: if (entry->desc.mem_kind == HFI_MEMKIND_PROFILE)
  entry->md);
  
  kgsl_snapshot_add_section(device,
  KGSL_SNAPSHOT_SECTION_GPU_OBJECT_V2,
L113: if (entry->desc.mem_kind == HFI_MEMKIND_CSW_SMMU_INFO)
  entry->md);
  
  kgsl_snapshot_add_section(device,
  KGSL_SNAPSHOT_SECTION_GPU_OBJECT_V2,
L119: if (entry->desc.mem_kind == HFI_MEMKIND_CSW_PRIV_NON_SECURE)
  entry->md);
  
  adreno_hwsched_snapshot_preemption_records(device, snapshot,
  entry->md);
L120: adreno_hwsched_snapshot_preemption_records(device, snapshot,
  
  if (entry->desc.mem_kind == HFI_MEMKIND_CSW_PRIV_NON_SECURE)
  entry->md);
  
L123: if (entry->desc.mem_kind == HFI_MEMKIND_PREEMPT_SCRATCH)
  entry->md);
  
  kgsl_snapshot_add_section(device,
  KGSL_SNAPSHOT_SECTION_GPU_OBJECT_V2,
L129: if (entry->desc.mem_kind == HFI_MEMKIND_AQE_BUFFER)
  entry->md);
  
  kgsl_snapshot_add_section(device,
  KGSL_SNAPSHOT_SECTION_GPU_OBJECT_V2,
L135: if (entry->desc.mem_kind == HFI_MEMKIND_HW_FENCE) {
  entry->md);
  
  struct gmu_mem_type_desc desc;
  
L136: struct gmu_mem_type_desc desc;
  
  if (entry->desc.mem_kind == HFI_MEMKIND_HW_FENCE) {
  
  desc.memdesc = entry->md;
L139: desc.type = SNAPSHOT_GMU_MEM_HW_FENCE;
  
  desc.memdesc = entry->md;
  
  kgsl_snapshot_add_section(device,
L142: KGSL_SNAPSHOT_SECTION_GMU_MEMORY,
  
  kgsl_snapshot_add_section(device,
  snapshot, adreno_snapshot_gmu_mem, &desc);
  }
L143: snapshot, adreno_snapshot_gmu_mem, &desc);
  kgsl_snapshot_add_section(device,
  KGSL_SNAPSHOT_SECTION_GMU_MEMORY,
  }
  
L152: static void gen7_hwsched_gmu_suspend(struct adreno_device *adreno_dev, bool force)
  }
  
  {
  gen7_gmu_suspend(adreno_dev, force);
L154: gen7_gmu_suspend(adreno_dev, force);
  static void gen7_hwsched_gmu_suspend(struct adreno_device *adreno_dev, bool force)
  {
  adreno_hwsched_reset_hfi_mem(adreno_dev);
  }
L155: adreno_hwsched_reset_hfi_mem(adreno_dev);
  {
  gen7_gmu_suspend(adreno_dev, force);
  }
  
L158: static int gen7_hwsched_gmu_first_boot(struct adreno_device *adreno_dev)
  }
  
  {
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
L162: struct gen7_gmu_device *gmu = to_gen7_gmu(adreno_dev);
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
  struct kgsl_pwrctrl *pwr = &device->pwrctrl;
  int level, ret = 0;
  
L167: gen7_gmu_aop_send_acd_state(gmu, adreno_dev->acd_enabled);
  kgsl_pwrctrl_request_state(device, KGSL_STATE_AWARE);
  
  
  ret = kgsl_pwrctrl_enable_cx_gdsc(device);
L173: ret = gmu_core_enable_clks(device, device->gmu_core.num_freqs - 1);
  return ret;
  
  if (ret)
  goto gdsc_off;
L187: ret = gen7_gmu_load_fw(adreno_dev);
  gen7_cx_timer_init(adreno_dev);
  
  if (ret)
  goto clks_gdsc_off;

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched.h =====
L10: #include "adreno_gen7_hwsched_hfi.h"
  #define _ADRENO_GEN7_HWSCHED_H_
  
  
  /**
L18: /** @hwsched_hfi: Container for hwscheduling specific hfi resources */
  /** @gen7_dev: Container for the gen7 device */
  struct gen7_device gen7_dev;
  struct gen7_hwsched_hfi hwsched_hfi;
  };
L19: struct gen7_hwsched_hfi hwsched_hfi;
  struct gen7_device gen7_dev;
  /** @hwsched_hfi: Container for hwscheduling specific hfi resources */
  };
  
L28: * The target specific probe function for hwsched enabled gmu targets.
  * @gpucore: Pointer to the gpucore
  *
  *
  * Return: 0 on success or negative error on failure
L36: * gen7_hwsched_reset_replay - Restart the gmu and gpu and replay inflight cmdbatches
  
  /**
  * @adreno_dev: Pointer to the adreno device
  *
L48: * Snapshot the faulty ib and then snapshot rest of gen7 gmu things
  * @snapshot: Pointer to the snapshot instance
  *
  */
  void gen7_hwsched_snapshot(struct adreno_device *adreno_dev,
L66: * gen7_hwsched_send_recurring_cmdobj - Dispatch IBs to GMU
  
  /**
  * @adreno_dev: Pointer to adreno device structure
  * @cmdobj: The command object which needs to be submitted
L71: * recurring IBs to the GMU. Upon receiving ipc interrupt GMU will submit
  *
  * This function is used to register the context if needed and submit
  * recurring IBs to GPU.
  

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.c =====
L7: #include <linux/iommu.h>
  */
  
  
  #include "adreno.h"
L12: #include "adreno_hfi.h"
  #include "adreno_gen7.h"
  #include "adreno_gen7_hwsched.h"
  #include "adreno_pm4types.h"
  #include "adreno_trace.h"
L17: #include "kgsl_gmu_core.h"
  #include "kgsl_device.h"
  #include "kgsl_eventlog.h"
  #include "kgsl_pwrctrl.h"
  #include "kgsl_timeline.h"
L23: #define HFI_QUEUE_MAX (HFI_QUEUE_DEFAULT_CNT + HFI_QUEUE_DISPATCH_MAX_CNT)
  #include "kgsl_util.h"
  
  
  #define DEFINE_QHDR(gmuaddr, id, prio) \
L25: #define DEFINE_QHDR(gmuaddr, id, prio) \
  #define HFI_QUEUE_MAX (HFI_QUEUE_DEFAULT_CNT + HFI_QUEUE_DISPATCH_MAX_CNT)
  
  {\
  .status = 1, \
L28: .start_addr = GMU_QUEUE_START_ADDR(gmuaddr, id), \
  {\
  .status = 1, \
  .type = QUEUE_HDR_TYPE(id, prio, 0, 0), \
  .queue_size = SZ_4K >> 2, \
L48: } gen7_hfi_dqs[KGSL_PRIORITY_MAX_RB_LEVELS] = {
  /** @offset: Next dqid to use for roundrobin context assignment */
  u32 offset;
  { 4, 0, }, /* RB0 */
  { 4, 4, }, /* RB1 */
L53: }, gen7_hfi_dqs_lpac[KGSL_PRIORITY_MAX_RB_LEVELS + 1] = {
  { 3, 8, }, /* RB2 */
  { 3, 11, }, /* RB3 */
  { 4, 0, }, /* RB0 */
  { 4, 4, }, /* RB1 */
L63: struct gen7_hwsched_hfi *to_gen7_hwsched_hfi(
  struct pending_cmd hw_fence_ack;
  
  struct adreno_device *adreno_dev)
  {
L71: return &gen7_hwsched->hwsched_hfi;
  struct gen7_hwsched_device, gen7_dev);
  
  }
  
L74: int gen7_hfi_send_lpac_feature_ctrl(struct adreno_device *adreno_dev)
  }
  
  {
  if (!adreno_dev->lpac_enabled)
L79: return gen7_hfi_send_feature_ctrl(adreno_dev, HFI_FEATURE_LPAC, 1, 0);
  return 0;
  
  }
  
L82: static void add_waiter(struct gen7_hwsched_hfi *hfi, u32 hdr,
  }
  
  struct pending_cmd *ack)
  {
L88: write_lock_irq(&hfi->msglock);
  
  init_completion(&ack->complete);
  list_add_tail(&ack->node, &hfi->msglist);
  write_unlock_irq(&hfi->msglock);
L89: list_add_tail(&ack->node, &hfi->msglist);
  init_completion(&ack->complete);
  write_lock_irq(&hfi->msglock);
  write_unlock_irq(&hfi->msglock);
  
L90: write_unlock_irq(&hfi->msglock);
  write_lock_irq(&hfi->msglock);
  list_add_tail(&ack->node, &hfi->msglist);
  
  ack->sent_hdr = hdr;
L95: static void del_waiter(struct gen7_hwsched_hfi *hfi, struct pending_cmd *ack)
  }
  
  {
  write_lock_irq(&hfi->msglock);
L97: write_lock_irq(&hfi->msglock);
  static void del_waiter(struct gen7_hwsched_hfi *hfi, struct pending_cmd *ack)
  {
  list_del(&ack->node);
  write_unlock_irq(&hfi->msglock);
L99: write_unlock_irq(&hfi->msglock);
  write_lock_irq(&hfi->msglock);
  list_del(&ack->node);
  }
  
L104: struct device *gmu_pdev_dev = GMU_PDEV_DEV(KGSL_DEVICE(adreno_dev));
  static void gen7_receive_ack_async(struct adreno_device *adreno_dev, void *rcvd)
  {
  struct gen7_hwsched_hfi *hfi = to_gen7_hwsched_hfi(adreno_dev);
  struct pending_cmd *cmd = NULL;
L105: struct gen7_hwsched_hfi *hfi = to_gen7_hwsched_hfi(adreno_dev);
  {
  struct device *gmu_pdev_dev = GMU_PDEV_DEV(KGSL_DEVICE(adreno_dev));
  struct pending_cmd *cmd = NULL;
  u32 waiters[64], num_waiters = 0, i;
L114: dev_err_ratelimited(gmu_pdev_dev,
  
  if (size_bytes > sizeof(cmd->results))
  "Ack result too big: %d Truncating to: %ld\n",
  size_bytes, sizeof(cmd->results));
L118: read_lock(&hfi->msglock);
  size_bytes, sizeof(cmd->results));
  
  
  list_for_each_entry(cmd, &hfi->msglist, node) {
L120: list_for_each_entry(cmd, &hfi->msglist, node) {
  read_lock(&hfi->msglock);
  
  if (CMP_HFI_ACK_HDR(cmd->sent_hdr, req_hdr)) {
  memcpy(cmd->results, ack,
L121: if (CMP_HFI_ACK_HDR(cmd->sent_hdr, req_hdr)) {
  
  list_for_each_entry(cmd, &hfi->msglist, node) {
  memcpy(cmd->results, ack,
  min_t(u32, size_bytes,
L126: read_unlock(&hfi->msglock);
  sizeof(cmd->results)));
  complete(&cmd->complete);
  return;
  }
L134: read_unlock(&hfi->msglock);
  }
  
  
  /* Didn't find the sender, list the waiter */
L137: dev_err_ratelimited(gmu_pdev_dev,
  
  /* Didn't find the sender, list the waiter */
  "Unexpectedly got id %d seqnum %d. Total waiters: %d Top %d Waiters:\n",
  MSG_HDR_GET_ID(req_hdr), MSG_HDR_GET_SEQNUM(req_hdr),
L143: dev_err_ratelimited(gmu_pdev_dev,
  
  for (i = 0; i < num_waiters && i < 5; i++)
  " id %d seqnum %d\n",
  MSG_HDR_GET_ID(waiters[i]),
L153: struct hfi_context_bad_cmd_legacy *cmd = adreno_dev->hwsched.ctxt_bad;
  u32 type, u32 key)
  {
  u32 i = 0, payload_bytes;
  void *start;

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_hwsched_hfi.h =====
L7: #ifndef _ADRENO_GEN7_HWSCHED_HFI_H_
  */
  
  #define _ADRENO_GEN7_HWSCHED_HFI_H_
  
L8: #define _ADRENO_GEN7_HWSCHED_HFI_H_
  
  #ifndef _ADRENO_GEN7_HWSCHED_HFI_H_
  
  /* Maximum number of IBs in a submission */
L12: ((HFI_MAX_MSG_SIZE - offsetof(struct hfi_issue_cmd_cmd, ibs)) \
  /* Maximum number of IBs in a submission */
  #define HWSCHED_MAX_NUMIBS \
  / sizeof(struct hfi_issue_ib))
  
L13: / sizeof(struct hfi_issue_ib))
  #define HWSCHED_MAX_NUMIBS \
  ((HFI_MAX_MSG_SIZE - offsetof(struct hfi_issue_cmd_cmd, ibs)) \
  
  /*
L19: * 2. If there is a GMU/GPU fault. Because we don't want the threads to keep sleeping through fault
  * threshold. This bit is cleared in two scenarios:
  * 1. If the hardware fence unack count drops to a desired threshold.
  *    recovery, which can easily take 100s of milliseconds to complete.
  */
L29: * GEN7_HWSCHED_HW_FENCE_MAX_BIT will be set. Say, a GMU/GPU fault happens and
  * will be cleared, but we still want to avoid creating any more hardware fences. For example, if
  * hardware fence unack count reaches a maximum threshold, both GEN7_HWSCHED_HW_FENCE_SLEEP_BIT and
  * GEN7_HWSCHED_HW_FENCE_SLEEP_BIT will be cleared to wake up any sleeping threads. But,
  * GEN7_HWSCHED_HW_FENCE_MAX_BIT will remain set to avoid creating any new hardware fences until
L41: struct gen7_hwsched_hfi {
  #define GEN7_HWSCHED_HW_FENCE_ABORT_BIT 0x2
  
  /** @irq_mask: Store the hfi interrupt mask */
  u32 irq_mask;
L42: /** @irq_mask: Store the hfi interrupt mask */
  
  struct gen7_hwsched_hfi {
  u32 irq_mask;
  /** @msglock: To protect the list of un-ACKed hfi packets */
L44: /** @msglock: To protect the list of un-ACKed hfi packets */
  /** @irq_mask: Store the hfi interrupt mask */
  u32 irq_mask;
  rwlock_t msglock;
  /** @msglist: List of un-ACKed hfi packets */
L46: /** @msglist: List of un-ACKed hfi packets */
  /** @msglock: To protect the list of un-ACKed hfi packets */
  rwlock_t msglock;
  struct list_head msglist;
  /** @f2h_task: Task for processing gmu fw to host packets */
L48: /** @f2h_task: Task for processing gmu fw to host packets */
  /** @msglist: List of un-ACKed hfi packets */
  struct list_head msglist;
  struct task_struct *f2h_task;
  /** @f2h_wq: Waitqueue for the f2h_task */
L52: /** @big_ib: GMU buffer to hold big IBs */
  /** @f2h_wq: Waitqueue for the f2h_task */
  wait_queue_head_t f2h_wq;
  struct kgsl_memdesc *big_ib;
  /** @big_ib_recurring: GMU buffer to hold big recurring IBs */
L54: /** @big_ib_recurring: GMU buffer to hold big recurring IBs */
  /** @big_ib: GMU buffer to hold big IBs */
  struct kgsl_memdesc *big_ib;
  struct kgsl_memdesc *big_ib_recurring;
  /** @perfctr_scratch: Buffer to hold perfcounter PM4 commands */
L71: /** @defer_hw_fence_work: The work structure to send deferred hardware fences to GMU */
  /** @detached_hw_fences_list: List of hardware fences belonging to detached contexts */
  struct list_head detached_hw_fence_list;
  struct kthread_work defer_hw_fence_work;
  };
L78: * gen7_hwsched_hfi_probe - Probe hwsched hfi resources
  
  /**
  * @adreno_dev: Pointer to adreno device structure
  *
L83: int gen7_hwsched_hfi_probe(struct adreno_device *adreno_dev);
  * Return: 0 on success and negative error on failure.
  */
  
  /**
L86: * gen7_hwsched_hfi_remove - Release hwsched hfi resources
  
  /**
  * @adreno_dev: Pointer to adreno device structure
  */
L89: void gen7_hwsched_hfi_remove(struct adreno_device *adreno_dev);
  * @adreno_dev: Pointer to adreno device structure
  */
  
  /**
L92: * gen7_hwsched_hfi_init - Initialize hfi resources
  
  /**
  * @adreno_dev: Pointer to adreno device structure
  *
L95: * This function is used to initialize hfi resources
  * @adreno_dev: Pointer to adreno device structure
  *
  * once before the very first gmu boot
  *
L96: * once before the very first gmu boot
  *
  * This function is used to initialize hfi resources
  *
  * Return: 0 on success and negative error on failure.
L100: int gen7_hwsched_hfi_init(struct adreno_device *adreno_dev);
  * Return: 0 on success and negative error on failure.
  */
  
  /**
L103: * gen7_hwsched_hfi_start - Start hfi resources
  
  /**
  * @adreno_dev: Pointer to adreno device structure
  *
L106: * Send the various hfi packets before booting the gpu
  * @adreno_dev: Pointer to adreno device structure
  *
  *
  * Return: 0 on success and negative error on failure.
L110: int gen7_hwsched_hfi_start(struct adreno_device *adreno_dev);
  * Return: 0 on success and negative error on failure.
  */
  
  /**
L113: * gen7_hwsched_hfi_stop - Stop the hfi resources
  
  /**
  * @adreno_dev: Pointer to the adreno device
  *
L116: * This function does the hfi cleanup when powering down the gmu
  * @adreno_dev: Pointer to the adreno device
  *
  */
  void gen7_hwsched_hfi_stop(struct adreno_device *adreno_dev);
L118: void gen7_hwsched_hfi_stop(struct adreno_device *adreno_dev);
  * This function does the hfi cleanup when powering down the gmu
  */
  
  /**
L121: * gen7_hwched_cp_init - Send CP_INIT via HFI
  
  /**
  * @adreno_dev: Pointer to adreno device structure
  *
L125: * GPU out of secure mode using hfi raw packets.
  *
  * This function is used to send CP INIT packet and bring
  *
  * Return: 0 on success and negative error on failure.

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_perfcounter.c =====
L9: #include "adreno_gen7_hwsched_hfi.h"
  #include "adreno.h"
  #include "adreno_gen7.h"
  #include "adreno_perfcounter.h"
  #include "adreno_pm4types.h"
L74: struct adreno_ringbuffer *rb = &adreno_dev->ringbuffers[0];
  {
  struct adreno_perfcount_register *reg = &group->regs[counter];
  u32 cmds[3];
  int ret;
L86: ret = gen7_ringbuffer_addcmds(adreno_dev, rb, NULL,
  
  /* submit to highest priority RB always */
  F_NOTPROTECTED, cmds, 3, 0, NULL);
  if (ret)
L100: ret = adreno_ringbuffer_waittimestamp(rb, rb->timestamp,
  
  /* wait for the above commands submitted to complete */
  ADRENO_IDLE_TIMEOUT);
  
L243: static void gen7_write_gmu_counter_enable(struct kgsl_device *device,
  }
  
  struct adreno_perfcount_register *reg, u32 bit, u32 countable)
  {
L249: static int gen7_counter_gmu_xoclk_enable(struct adreno_device *adreno_dev,
  }
  
  const struct adreno_perfcount_group *group,
  unsigned int counter, unsigned int countable)
L273: gen7_write_gmu_counter_enable(device, reg, counter * 8, countable);
  counter = 0;
  
  
  reg->value = 0;
L277: kgsl_regwrite(device, GEN7_GMU_CX_GMU_POWER_COUNTER_ENABLE, 1);
  reg->value = 0;
  
  
  return 0;
L282: static int gen7_counter_gmu_gmuclk_enable(struct adreno_device *adreno_dev,
  }
  
  const struct adreno_perfcount_group *group,
  unsigned int counter, unsigned int countable)
L293: * The two counters are stuck into GMU_CX_GMU_POWER_COUNTER_SELECT_1
  
  /*
  * at bit offset 16 and 24
  */
L296: gen7_write_gmu_counter_enable(device, reg,
  * at bit offset 16 and 24
  */
  16 + (counter * 8), countable);
  
L299: kgsl_regwrite(device, GEN7_GMU_CX_GMU_POWER_COUNTER_ENABLE, 1);
  16 + (counter * 8), countable);
  
  
  reg->value = 0;
L305: static int gen7_counter_gmu_perf_enable(struct adreno_device *adreno_dev,
  }
  
  const struct adreno_perfcount_group *group,
  unsigned int counter, unsigned int countable)
L323: gen7_write_gmu_counter_enable(device, reg, counter * 8, countable);
  counter -= 4;
  
  
  kgsl_regwrite(device, GEN7_GMU_CX_GMU_PERF_COUNTER_ENABLE, 1);
L325: kgsl_regwrite(device, GEN7_GMU_CX_GMU_PERF_COUNTER_ENABLE, 1);
  gen7_write_gmu_counter_enable(device, reg, counter * 8, countable);
  
  
  reg->value = 0;
L929: #define GMU_COUNTER(lo, hi, sel) \
  };
  
  { .countable = KGSL_PERFCOUNTER_NOT_USED, \
  .offset = lo, .offset_hi = hi, .select = sel }
L933: #define GMU_COUNTER_RESERVED(lo, hi, sel) \
  .offset = lo, .offset_hi = hi, .select = sel }
  
  { .countable = KGSL_PERFCOUNTER_BROKEN, \
  .offset = lo, .offset_hi = hi, .select = sel }
L937: static struct adreno_perfcount_register gen7_perfcounters_gmu_xoclk[] = {
  .offset = lo, .offset_hi = hi, .select = sel }
  
  /*
  * COUNTER_XOCLK_0 and COUNTER_XOCLK_4 are used for the GPU
L943: GMU_COUNTER_RESERVED(GEN7_GMU_CX_GMU_POWER_COUNTER_XOCLK_0_L,
  * are not re-used.
  */
  GEN7_GMU_CX_GMU_POWER_COUNTER_XOCLK_0_H,
  GEN7_GMU_CX_GMU_POWER_COUNTER_SELECT_0),
L944: GEN7_GMU_CX_GMU_POWER_COUNTER_XOCLK_0_H,
  */
  GMU_COUNTER_RESERVED(GEN7_GMU_CX_GMU_POWER_COUNTER_XOCLK_0_L,
  GEN7_GMU_CX_GMU_POWER_COUNTER_SELECT_0),
  GMU_COUNTER(GEN7_GMU_CX_GMU_POWER_COUNTER_XOCLK_1_L,
L945: GEN7_GMU_CX_GMU_POWER_COUNTER_SELECT_0),
  GMU_COUNTER_RESERVED(GEN7_GMU_CX_GMU_POWER_COUNTER_XOCLK_0_L,
  GEN7_GMU_CX_GMU_POWER_COUNTER_XOCLK_0_H,
  GMU_COUNTER(GEN7_GMU_CX_GMU_POWER_COUNTER_XOCLK_1_L,
  GEN7_GMU_CX_GMU_POWER_COUNTER_XOCLK_1_H,
L946: GMU_COUNTER(GEN7_GMU_CX_GMU_POWER_COUNTER_XOCLK_1_L,
  GEN7_GMU_CX_GMU_POWER_COUNTER_XOCLK_0_H,
  GEN7_GMU_CX_GMU_POWER_COUNTER_SELECT_0),
  GEN7_GMU_CX_GMU_POWER_COUNTER_XOCLK_1_H,
  GEN7_GMU_CX_GMU_POWER_COUNTER_SELECT_0),
L947: GEN7_GMU_CX_GMU_POWER_COUNTER_XOCLK_1_H,
  GEN7_GMU_CX_GMU_POWER_COUNTER_SELECT_0),
  GMU_COUNTER(GEN7_GMU_CX_GMU_POWER_COUNTER_XOCLK_1_L,
  GEN7_GMU_CX_GMU_POWER_COUNTER_SELECT_0),
  GMU_COUNTER(GEN7_GMU_CX_GMU_POWER_COUNTER_XOCLK_2_L,
L948: GEN7_GMU_CX_GMU_POWER_COUNTER_SELECT_0),
  GMU_COUNTER(GEN7_GMU_CX_GMU_POWER_COUNTER_XOCLK_1_L,
  GEN7_GMU_CX_GMU_POWER_COUNTER_XOCLK_1_H,
  GMU_COUNTER(GEN7_GMU_CX_GMU_POWER_COUNTER_XOCLK_2_L,
  GEN7_GMU_CX_GMU_POWER_COUNTER_XOCLK_2_H,
L949: GMU_COUNTER(GEN7_GMU_CX_GMU_POWER_COUNTER_XOCLK_2_L,
  GEN7_GMU_CX_GMU_POWER_COUNTER_XOCLK_1_H,
  GEN7_GMU_CX_GMU_POWER_COUNTER_SELECT_0),
  GEN7_GMU_CX_GMU_POWER_COUNTER_XOCLK_2_H,
  GEN7_GMU_CX_GMU_POWER_COUNTER_SELECT_0),
L950: GEN7_GMU_CX_GMU_POWER_COUNTER_XOCLK_2_H,
  GEN7_GMU_CX_GMU_POWER_COUNTER_SELECT_0),
  GMU_COUNTER(GEN7_GMU_CX_GMU_POWER_COUNTER_XOCLK_2_L,
  GEN7_GMU_CX_GMU_POWER_COUNTER_SELECT_0),
  GMU_COUNTER(GEN7_GMU_CX_GMU_POWER_COUNTER_XOCLK_3_L,
L951: GEN7_GMU_CX_GMU_POWER_COUNTER_SELECT_0),
  GMU_COUNTER(GEN7_GMU_CX_GMU_POWER_COUNTER_XOCLK_2_L,
  GEN7_GMU_CX_GMU_POWER_COUNTER_XOCLK_2_H,
  GMU_COUNTER(GEN7_GMU_CX_GMU_POWER_COUNTER_XOCLK_3_L,
  GEN7_GMU_CX_GMU_POWER_COUNTER_XOCLK_3_H,
L952: GMU_COUNTER(GEN7_GMU_CX_GMU_POWER_COUNTER_XOCLK_3_L,
  GEN7_GMU_CX_GMU_POWER_COUNTER_XOCLK_2_H,
  GEN7_GMU_CX_GMU_POWER_COUNTER_SELECT_0),
  GEN7_GMU_CX_GMU_POWER_COUNTER_XOCLK_3_H,
  GEN7_GMU_CX_GMU_POWER_COUNTER_SELECT_0),
L953: GEN7_GMU_CX_GMU_POWER_COUNTER_XOCLK_3_H,
  GEN7_GMU_CX_GMU_POWER_COUNTER_SELECT_0),
  GMU_COUNTER(GEN7_GMU_CX_GMU_POWER_COUNTER_XOCLK_3_L,
  GEN7_GMU_CX_GMU_POWER_COUNTER_SELECT_0),
  GMU_COUNTER_RESERVED(GEN7_GMU_CX_GMU_POWER_COUNTER_XOCLK_4_L,
L954: GEN7_GMU_CX_GMU_POWER_COUNTER_SELECT_0),
  GMU_COUNTER(GEN7_GMU_CX_GMU_POWER_COUNTER_XOCLK_3_L,
  GEN7_GMU_CX_GMU_POWER_COUNTER_XOCLK_3_H,
  GMU_COUNTER_RESERVED(GEN7_GMU_CX_GMU_POWER_COUNTER_XOCLK_4_L,
  GEN7_GMU_CX_GMU_POWER_COUNTER_XOCLK_4_H,

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_preempt.c =====
L14: offsetof(struct gen7_cp_preemption_record, _field)
  
  #define PREEMPT_RECORD(_field) \
  
  #define PREEMPT_SMMU_RECORD(_field) \
L16: #define PREEMPT_SMMU_RECORD(_field) \
  offsetof(struct gen7_cp_preemption_record, _field)
  
  offsetof(struct gen7_cp_smmu_info, _field)
  
L17: offsetof(struct gen7_cp_smmu_info, _field)
  
  #define PREEMPT_SMMU_RECORD(_field) \
  
  static void _update_wptr(struct adreno_device *adreno_dev, bool reset_timer,
L23: struct adreno_ringbuffer *rb = adreno_dev->cur_rb;
  {
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
  unsigned long flags;
  int ret = 0;
L62: gmu_core_fault_snapshot(device, GMU_FAULT_PANIC_NONE);
  /* If WPTR update fails, set the fault and trigger recovery */
  if (ret) {
  adreno_scheduler_fault(adreno_dev,
  ADRENO_GMU_FAULT_SKIP_SNAPSHOT);
L64: ADRENO_GMU_FAULT_SKIP_SNAPSHOT);
  gmu_core_fault_snapshot(device, GMU_FAULT_PANIC_NONE);
  adreno_scheduler_fault(adreno_dev,
  }
  }
L73: gmu_core_regwrite(device,
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
  
  GEN7_GMU_PWR_COL_PREEMPT_KEEPALIVE, (val ? 1 : 0));
  }
L74: GEN7_GMU_PWR_COL_PREEMPT_KEEPALIVE, (val ? 1 : 0));
  
  gmu_core_regwrite(device,
  }
  
L77: static void _gen7_preemption_done(struct adreno_device *adreno_dev)
  }
  
  {
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
L90: kgsl_regread(device, GEN7_CP_CONTEXT_SWITCH_CNTL, &status);
  return;
  
  
  if (status & 0x1) {
L94: "Preemption not complete: status=%X cur=%d R/W=%X/%X next=%d R/W=%X/%X\n",
  if (status & 0x1) {
  dev_err(device->dev,
  status, adreno_dev->cur_rb->id,
  adreno_get_rptr(adreno_dev->cur_rb),
L112: kgsl_regread(device, GEN7_CP_CONTEXT_SWITCH_LEVEL_STATUS, &status);
  kgsl_delete_timer_sync(&adreno_dev->preempt.timer);
  
  
  trace_adreno_preempt_done(adreno_dev->cur_rb->id, adreno_dev->next_rb->id,
L133: static void _gen7_preemption_fault(struct adreno_device *adreno_dev)
  }
  
  {
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
L139: * If the power is on check the preemption status one more time - if it
  
  /*
  * was successful then just transition to the complete state
  */
L143: kgsl_regread(device, GEN7_CP_CONTEXT_SWITCH_CNTL, &status);
  */
  if (kgsl_state_is_awake(device)) {
  
  if (!(status & 0x1)) {
L155: "Preemption Fault: cur=%d R/W=0x%x/0x%x, next=%d R/W=0x%x/0x%x\n",
  
  dev_err(device->dev,
  adreno_dev->cur_rb->id,
  adreno_get_rptr(adreno_dev->cur_rb),
L166: static void _gen7_preemption_worker(struct work_struct *work)
  }
  
  {
  struct adreno_preemption *preempt = container_of(work,
L168: struct adreno_preemption *preempt = container_of(work,
  static void _gen7_preemption_worker(struct work_struct *work)
  {
  struct adreno_preemption, work);
  struct adreno_device *adreno_dev = container_of(preempt,
L169: struct adreno_preemption, work);
  {
  struct adreno_preemption *preempt = container_of(work,
  struct adreno_device *adreno_dev = container_of(preempt,
  struct adreno_device, preempt);
L178: _gen7_preemption_fault(adreno_dev);
  
  if (adreno_in_preempt_state(adreno_dev, ADRENO_PREEMPT_FAULTED))
  
  kgsl_mutex_unlock(&device->mutex);
L183: /* Find the highest priority active ringbuffer */
  }
  
  static struct adreno_ringbuffer *gen7_next_ringbuffer(
  struct adreno_device *adreno_dev)
L184: static struct adreno_ringbuffer *gen7_next_ringbuffer(
  
  /* Find the highest priority active ringbuffer */
  struct adreno_device *adreno_dev)
  {
L187: struct adreno_ringbuffer *rb;
  struct adreno_device *adreno_dev)
  {
  unsigned long flags;
  unsigned int i;
L191: FOR_EACH_RINGBUFFER(adreno_dev, rb, i) {
  unsigned int i;
  
  bool empty;
  
L205: void gen7_preemption_trigger(struct adreno_device *adreno_dev, bool atomic)
  }
  
  {
  const struct adreno_gen7_core *gen7_core = to_gen7_core(adreno_dev);
L209: struct kgsl_iommu *iommu = KGSL_IOMMU(device);
  const struct adreno_gen7_core *gen7_core = to_gen7_core(adreno_dev);
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
  struct adreno_ringbuffer *next;
  u64 ttbr0, gpuaddr;
L210: struct adreno_ringbuffer *next;
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
  struct kgsl_iommu *iommu = KGSL_IOMMU(device);
  u64 ttbr0, gpuaddr;
  u32 contextidr, cntl;
L214: struct adreno_preemption *preempt = &adreno_dev->preempt;
  u32 contextidr, cntl;
  unsigned long flags;
  
  /* Put ourselves into a possible trigger state */
L221: /* Get the next ringbuffer to preempt in */
  return;
  
  next = gen7_next_ringbuffer(adreno_dev);
  
L222: next = gen7_next_ringbuffer(adreno_dev);
  
  /* Get the next ringbuffer to preempt in */
  
  /*

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_ringbuffer.c =====
L10: #include "adreno_ringbuffer.h"
  #include "adreno_gen7.h"
  #include "adreno_pm4types.h"
  #include "adreno_trace.h"
  #include "kgsl_trace.h"
L23: struct adreno_ringbuffer *rb, struct adreno_context *drawctxt,
  
  static int gen7_rb_pagetable_switch(struct adreno_device *adreno_dev,
  struct kgsl_pagetable *pagetable, u32 *cmds)
  {
L35: cmds[count++] = cp_type7_packet(CP_SMMU_TABLE_UPDATE, 3);
  
  /* CP switches the pagetable and flushes the Caches */
  cmds[count++] = lower_32_bits(ttbr0);
  cmds[count++] = upper_32_bits(ttbr0);
L60: static int gen7_rb_context_switch(struct adreno_device *adreno_dev,
  }
  
  struct adreno_ringbuffer *rb,
  struct adreno_context *drawctxt)
L61: struct adreno_ringbuffer *rb,
  
  static int gen7_rb_context_switch(struct adreno_device *adreno_dev,
  struct adreno_context *drawctxt)
  {
L91: cmds[count++] = cp_type7_packet(CP_EVENT_WRITE, 1);
  cmds[count++] = CP_SET_THREAD_BOTH;
  
  /* Add event ID for LRZ flush as packet payload */
  cmds[count++] = LRZ_CACHE_FLUSH;
L118: struct kgsl_iommu *iommu = KGSL_IOMMU(device);
  }
  } else {
  
  u32 offset = GEN7_SMMU_BASE + (iommu->cb0_offset >> 2) + 0x0d;
L120: u32 offset = GEN7_SMMU_BASE + (iommu->cb0_offset >> 2) + 0x0d;
  struct kgsl_iommu *iommu = KGSL_IOMMU(device);
  
  
  /*
L135: cmds[count++] = lower_32_bits(MEMSTORE_RB_GPU_ADDR(device, rb,
  
  cmds[count++] = cp_type7_packet(CP_MEM_WRITE, 3);
  current_context));
  cmds[count++] = upper_32_bits(MEMSTORE_RB_GPU_ADDR(device, rb,
L137: cmds[count++] = upper_32_bits(MEMSTORE_RB_GPU_ADDR(device, rb,
  cmds[count++] = lower_32_bits(MEMSTORE_RB_GPU_ADDR(device, rb,
  current_context));
  current_context));
  cmds[count++] = drawctxt->base.id;
L142: cmds[count++] = lower_32_bits(MEMSTORE_ID_GPU_ADDR(device,
  
  cmds[count++] = cp_type7_packet(CP_MEM_WRITE, 3);
  KGSL_MEMSTORE_GLOBAL, current_context));
  cmds[count++] = upper_32_bits(MEMSTORE_ID_GPU_ADDR(device,
L143: KGSL_MEMSTORE_GLOBAL, current_context));
  cmds[count++] = cp_type7_packet(CP_MEM_WRITE, 3);
  cmds[count++] = lower_32_bits(MEMSTORE_ID_GPU_ADDR(device,
  cmds[count++] = upper_32_bits(MEMSTORE_ID_GPU_ADDR(device,
  KGSL_MEMSTORE_GLOBAL, current_context));
L144: cmds[count++] = upper_32_bits(MEMSTORE_ID_GPU_ADDR(device,
  cmds[count++] = lower_32_bits(MEMSTORE_ID_GPU_ADDR(device,
  KGSL_MEMSTORE_GLOBAL, current_context));
  KGSL_MEMSTORE_GLOBAL, current_context));
  cmds[count++] = drawctxt->base.id;
L145: KGSL_MEMSTORE_GLOBAL, current_context));
  KGSL_MEMSTORE_GLOBAL, current_context));
  cmds[count++] = upper_32_bits(MEMSTORE_ID_GPU_ADDR(device,
  cmds[count++] = drawctxt->base.id;
  
L148: cmds[count++] = cp_type7_packet(CP_EVENT_WRITE, 1);
  cmds[count++] = drawctxt->base.id;
  
  cmds[count++] = 0x31;
  
L151: if (adreno_is_preemption_enabled(adreno_dev) && drawctxt->base.user_ctxt_record) {
  cmds[count++] = 0x31;
  
  u64 gpuaddr = drawctxt->base.user_ctxt_record->memdesc.gpuaddr;
  
L160: return gen7_ringbuffer_addcmds(adreno_dev, rb, NULL, F_NOTPROTECTED,
  }
  
  cmds, count, 0, NULL);
  }
L164: #define RB_SOPTIMESTAMP(device, rb) \
  }
  
  MEMSTORE_RB_GPU_ADDR(device, rb, soptimestamp)
  #define CTXT_SOPTIMESTAMP(device, drawctxt) \
L165: MEMSTORE_RB_GPU_ADDR(device, rb, soptimestamp)
  
  #define RB_SOPTIMESTAMP(device, rb) \
  #define CTXT_SOPTIMESTAMP(device, drawctxt) \
  MEMSTORE_ID_GPU_ADDR(device, (drawctxt)->base.id, soptimestamp)
L166: #define CTXT_SOPTIMESTAMP(device, drawctxt) \
  #define RB_SOPTIMESTAMP(device, rb) \
  MEMSTORE_RB_GPU_ADDR(device, rb, soptimestamp)
  MEMSTORE_ID_GPU_ADDR(device, (drawctxt)->base.id, soptimestamp)
  
L167: MEMSTORE_ID_GPU_ADDR(device, (drawctxt)->base.id, soptimestamp)
  MEMSTORE_RB_GPU_ADDR(device, rb, soptimestamp)
  #define CTXT_SOPTIMESTAMP(device, drawctxt) \
  
  #define RB_EOPTIMESTAMP(device, rb) \
L169: #define RB_EOPTIMESTAMP(device, rb) \
  MEMSTORE_ID_GPU_ADDR(device, (drawctxt)->base.id, soptimestamp)
  
  MEMSTORE_RB_GPU_ADDR(device, rb, eoptimestamp)
  #define CTXT_EOPTIMESTAMP(device, drawctxt) \
L170: MEMSTORE_RB_GPU_ADDR(device, rb, eoptimestamp)
  
  #define RB_EOPTIMESTAMP(device, rb) \
  #define CTXT_EOPTIMESTAMP(device, drawctxt) \
  MEMSTORE_ID_GPU_ADDR(device, (drawctxt)->base.id, eoptimestamp)
L171: #define CTXT_EOPTIMESTAMP(device, drawctxt) \
  #define RB_EOPTIMESTAMP(device, rb) \
  MEMSTORE_RB_GPU_ADDR(device, rb, eoptimestamp)
  MEMSTORE_ID_GPU_ADDR(device, (drawctxt)->base.id, eoptimestamp)
  
L172: MEMSTORE_ID_GPU_ADDR(device, (drawctxt)->base.id, eoptimestamp)
  MEMSTORE_RB_GPU_ADDR(device, rb, eoptimestamp)
  #define CTXT_EOPTIMESTAMP(device, drawctxt) \
  
  int gen7_ringbuffer_submit(struct adreno_ringbuffer *rb,
L174: int gen7_ringbuffer_submit(struct adreno_ringbuffer *rb,
  MEMSTORE_ID_GPU_ADDR(device, (drawctxt)->base.id, eoptimestamp)
  
  struct adreno_submit_time *time)
  {
L206: gmu_core_fault_snapshot(device, GMU_FAULT_PANIC_NONE);
  * recovery.
  */
  adreno_scheduler_fault(adreno_dev,
  ADRENO_GMU_FAULT_SKIP_SNAPSHOT);
L208: ADRENO_GMU_FAULT_SKIP_SNAPSHOT);
  gmu_core_fault_snapshot(device, GMU_FAULT_PANIC_NONE);
  adreno_scheduler_fault(adreno_dev,
  }
  
L214: int gen7_ringbuffer_init(struct adreno_device *adreno_dev)
  }
  
  {
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
L225: adreno_dev->cur_rb = &(adreno_dev->ringbuffers[0]);
  return ret;
  
  
  if (!adreno_preemption_feature_set(adreno_dev)) {

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_rpmh.c =====
L14: * setup_gmu_arc_votes - Build the gmu voting table
  
  /*
  * @gmu: Pointer to gmu device
  * @pri_rail: Pointer to primary power rail vlvl table
L15: * @gmu: Pointer to gmu device
  /*
  * setup_gmu_arc_votes - Build the gmu voting table
  * @pri_rail: Pointer to primary power rail vlvl table
  * @sec_rail: Pointer to second/dependent power rail vlvl table
L19: * This function initializes the cx votes for all gmu frequencies
  * @sec_rail: Pointer to second/dependent power rail vlvl table
  *
  * for gmu dcvs
  */
L20: * for gmu dcvs
  *
  * This function initializes the cx votes for all gmu frequencies
  */
  static int setup_cx_arc_votes(struct gen7_gmu_device *gmu,
L22: static int setup_cx_arc_votes(struct gen7_gmu_device *gmu,
  * for gmu dcvs
  */
  struct rpmh_arc_vals *pri_rail, struct rpmh_arc_vals *sec_rail)
  {
L25: struct kgsl_device *device = KGSL_DEVICE(gen7_gmu_to_adreno(gmu));
  struct rpmh_arc_vals *pri_rail, struct rpmh_arc_vals *sec_rail)
  {
  /* Hardcoded values of GMU CX voltage levels */
  u16 gmu_cx_vlvl[MAX_CX_LEVELS_LEGACY];
L26: /* Hardcoded values of GMU CX voltage levels */
  {
  struct kgsl_device *device = KGSL_DEVICE(gen7_gmu_to_adreno(gmu));
  u16 gmu_cx_vlvl[MAX_CX_LEVELS_LEGACY];
  u32 cx_votes[MAX_CX_LEVELS_LEGACY];
L27: u16 gmu_cx_vlvl[MAX_CX_LEVELS_LEGACY];
  struct kgsl_device *device = KGSL_DEVICE(gen7_gmu_to_adreno(gmu));
  /* Hardcoded values of GMU CX voltage levels */
  u32 cx_votes[MAX_CX_LEVELS_LEGACY];
  struct gen7_dcvs_table *table = &gmu->dcvs_table;
L29: struct gen7_dcvs_table *table = &gmu->dcvs_table;
  u16 gmu_cx_vlvl[MAX_CX_LEVELS_LEGACY];
  u32 cx_votes[MAX_CX_LEVELS_LEGACY];
  u32 *freqs = device->gmu_core.freqs;
  u32 *vlvls = device->gmu_core.vlvls;
L30: u32 *freqs = device->gmu_core.freqs;
  u32 cx_votes[MAX_CX_LEVELS_LEGACY];
  struct gen7_dcvs_table *table = &gmu->dcvs_table;
  u32 *vlvls = device->gmu_core.vlvls;
  int ret, i;
L31: u32 *vlvls = device->gmu_core.vlvls;
  struct gen7_dcvs_table *table = &gmu->dcvs_table;
  u32 *freqs = device->gmu_core.freqs;
  int ret, i;
  
L34: gmu_cx_vlvl[0] = 0;
  int ret, i;
  
  gmu_cx_vlvl[1] = vlvls[0];
  gmu_cx_vlvl[2] = vlvls[1];
L35: gmu_cx_vlvl[1] = vlvls[0];
  
  gmu_cx_vlvl[0] = 0;
  gmu_cx_vlvl[2] = vlvls[1];
  
L36: gmu_cx_vlvl[2] = vlvls[1];
  gmu_cx_vlvl[0] = 0;
  gmu_cx_vlvl[1] = vlvls[0];
  
  table->gmu_level_num = 3;
L38: table->gmu_level_num = 3;
  gmu_cx_vlvl[2] = vlvls[1];
  
  
  table->cx_votes[0].freq = 0;
L45: sec_rail, gmu_cx_vlvl, table->gmu_level_num);
  
  ret = adreno_rpmh_setup_volt_dependency_tbl(cx_votes, pri_rail,
  if (!ret) {
  for (i = 0; i < table->gmu_level_num; i++)
L47: for (i = 0; i < table->gmu_level_num; i++)
  sec_rail, gmu_cx_vlvl, table->gmu_level_num);
  if (!ret) {
  table->cx_votes[i].vote = cx_votes[i];
  }
L56: * @hfi: Pointer to hfi device
  /*
  * setup_gx_arc_votes - Build the gpu dcvs voting table
  * @pri_rail: Pointer to primary power rail vlvl table
  * @sec_rail: Pointer to second/dependent power rail vlvl table
L68: struct gen7_gmu_device *gmu = to_gen7_gmu(adreno_dev);
  {
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
  struct kgsl_pwrctrl *pwr = &device->pwrctrl;
  struct gen7_dcvs_table *table = &gmu->dcvs_table;
L70: struct gen7_dcvs_table *table = &gmu->dcvs_table;
  struct gen7_gmu_device *gmu = to_gen7_gmu(adreno_dev);
  struct kgsl_pwrctrl *pwr = &device->pwrctrl;
  u32 index;
  u16 vlvl_tbl[MAX_GX_LEVELS];
L89: /* Disable cx vote in gmu dcvs table if it is not supported in DT */
  table->gx_votes[0].freq = 0;
  table->gx_votes[0].dep_vote = 0;
  if (pwr->pwrlevels[0].cx_level == 0xffffffff)
  table->gx_votes[0].dep_vote = 0xffffffff;
L93: /* GMU power levels are in ascending order */
  table->gx_votes[0].dep_vote = 0xffffffff;
  
  for (index = 1, i = pwr->num_pwrlevels - 1; i >= 0; i--, index++) {
  u32 cx_vlvl = pwr->pwrlevels[i].cx_level;
L122: struct gen7_gmu_device *gmu = to_gen7_gmu(adreno_dev);
  static int build_dcvs_table(struct adreno_device *adreno_dev)
  {
  struct rpmh_arc_vals gx_arc, cx_arc, mx_arc;
  int ret;
L138: ret = setup_cx_arc_votes(gmu, &cx_arc, &mx_arc);
  return ret;
  
  if (ret)
  return ret;
L153: struct gen7_gmu_device *gmu = to_gen7_gmu(adreno_dev);
  static int build_bw_table(struct adreno_device *adreno_dev)
  {
  const struct adreno_gen7_core *gen7_core = to_gen7_core(adreno_dev);
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
L171: adreno_dev->gmu_ab);
  ddr = adreno_rpmh_build_bw_votes(adreno_ddr_bcms, ARRAY_SIZE(adreno_ddr_bcms),
  pwr->ddr_table, pwr->ddr_table_count, perfmode_vote, perfmode_lvl,
  if (IS_ERR(ddr))
  return PTR_ERR(ddr);
L186: adreno_dev->gmu_ab);
  cnoc = adreno_rpmh_build_bw_votes(adreno_cnoc_bcms,
  ARRAY_SIZE(adreno_cnoc_bcms), cnoc_table, count, 0, 0,
  
  if (cnoc_table != default_cnoc_table)
L196: ret = CMD_MSG_HDR(gmu->hfi.bw_table, H2F_MSG_BW_VOTE_TBL);
  }
  
  if (ret)
  return ret;
L200: adreno_rpmh_build_bw_table_cmd(&gmu->hfi.bw_table, ddr, cnoc);
  return ret;
  
  
  adreno_rpmh_free_bw_votes(ddr);

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_snapshot.c =====
L39: .gmu_regs = gen7_0_0_gmu_registers,
  .external_core_regs = gen7_0_0_external_core_regs,
  .num_external_core_regs = ARRAY_SIZE(gen7_0_0_external_core_regs),
  .gmu_gx_regs = gen7_0_0_gmugx_registers,
  .rscc_regs = gen7_0_0_rscc_registers,
L40: .gmu_gx_regs = gen7_0_0_gmugx_registers,
  .num_external_core_regs = ARRAY_SIZE(gen7_0_0_external_core_regs),
  .gmu_regs = gen7_0_0_gmu_registers,
  .rscc_regs = gen7_0_0_rscc_registers,
  .reg_list = gen7_0_0_reg_list,
L65: .gmu_regs = gen7_2_0_gmu_registers,
  .external_core_regs = gen7_2_0_external_core_regs,
  .num_external_core_regs = ARRAY_SIZE(gen7_2_0_external_core_regs),
  .gmu_gx_regs = gen7_2_0_gmugx_registers,
  .rscc_regs = gen7_2_0_rscc_registers,
L66: .gmu_gx_regs = gen7_2_0_gmugx_registers,
  .num_external_core_regs = ARRAY_SIZE(gen7_2_0_external_core_regs),
  .gmu_regs = gen7_2_0_gmu_registers,
  .rscc_regs = gen7_2_0_rscc_registers,
  .reg_list = gen7_2_0_reg_list,
L91: .gmu_regs = gen7_3_0_gmu_registers,
  .external_core_regs = gen7_3_0_external_core_regs,
  .num_external_core_regs = ARRAY_SIZE(gen7_3_0_external_core_regs),
  .gmu_gx_regs = gen7_3_0_gmu_gx_registers,
  .rscc_regs = gen7_0_0_rscc_registers,
L92: .gmu_gx_regs = gen7_3_0_gmu_gx_registers,
  .num_external_core_regs = ARRAY_SIZE(gen7_3_0_external_core_regs),
  .gmu_regs = gen7_3_0_gmu_registers,
  .rscc_regs = gen7_0_0_rscc_registers,
  .reg_list = gen7_3_0_reg_list,
L117: .gmu_regs = gen7_5_0_gmu_registers,
  .external_core_regs = gen7_5_0_external_core_regs,
  .num_external_core_regs = ARRAY_SIZE(gen7_5_0_external_core_regs),
  .gmu_ao_regs = gen7_5_0_gmu_ao_registers,
  .gmu_gx_regs = gen7_5_0_gmugx_registers,
L118: .gmu_ao_regs = gen7_5_0_gmu_ao_registers,
  .num_external_core_regs = ARRAY_SIZE(gen7_5_0_external_core_regs),
  .gmu_regs = gen7_5_0_gmu_registers,
  .gmu_gx_regs = gen7_5_0_gmugx_registers,
  .gmu_gx_blk_dec0_dec1_regs = gen7_5_0_gmugx_blk_dec0_dec1_registers,
L119: .gmu_gx_regs = gen7_5_0_gmugx_registers,
  .gmu_regs = gen7_5_0_gmu_registers,
  .gmu_ao_regs = gen7_5_0_gmu_ao_registers,
  .gmu_gx_blk_dec0_dec1_regs = gen7_5_0_gmugx_blk_dec0_dec1_registers,
  .rscc_regs = gen7_2_0_rscc_registers,
L120: .gmu_gx_blk_dec0_dec1_regs = gen7_5_0_gmugx_blk_dec0_dec1_registers,
  .gmu_ao_regs = gen7_5_0_gmu_ao_registers,
  .gmu_gx_regs = gen7_5_0_gmugx_registers,
  .rscc_regs = gen7_2_0_rscc_registers,
  .reg_list = gen7_2_0_reg_list,
L145: .gmu_regs = gen7_2_0_gmu_registers,
  .external_core_regs = gen7_6_0_external_core_regs,
  .num_external_core_regs = ARRAY_SIZE(gen7_6_0_external_core_regs),
  .gmu_gx_regs = gen7_2_0_gmugx_registers,
  .rscc_regs = gen7_2_0_rscc_registers,
L146: .gmu_gx_regs = gen7_2_0_gmugx_registers,
  .num_external_core_regs = ARRAY_SIZE(gen7_6_0_external_core_regs),
  .gmu_regs = gen7_2_0_gmu_registers,
  .rscc_regs = gen7_2_0_rscc_registers,
  .reg_list = gen7_2_0_reg_list,
L171: .gmu_regs = gen7_9_0_gmu_registers,
  .external_core_regs = gen7_9_0_external_core_regs,
  .num_external_core_regs = ARRAY_SIZE(gen7_9_0_external_core_regs),
  .gmu_gx_regs = gen7_9_0_gmugx_registers,
  .rscc_regs = gen7_9_0_rscc_registers,
L172: .gmu_gx_regs = gen7_9_0_gmugx_registers,
  .num_external_core_regs = ARRAY_SIZE(gen7_9_0_external_core_regs),
  .gmu_regs = gen7_9_0_gmu_registers,
  .rscc_regs = gen7_9_0_rscc_registers,
  .reg_list = gen7_9_0_reg_list,
L195: .gmu_regs = gen7_9_0_gmu_registers,
  .cx_debugbus_blocks = gen7_9_0_cx_debugbus_blocks,
  .cx_debugbus_blocks_len = ARRAY_SIZE(gen7_9_0_cx_debugbus_blocks),
  .gmu_gx_regs = gen7_9_0_gmugx_registers,
  .rscc_regs = gen7_9_0_rscc_registers,
L196: .gmu_gx_regs = gen7_9_0_gmugx_registers,
  .cx_debugbus_blocks_len = ARRAY_SIZE(gen7_9_0_cx_debugbus_blocks),
  .gmu_regs = gen7_9_0_gmu_registers,
  .rscc_regs = gen7_9_0_rscc_registers,
  .reg_list = gen7_9_0_reg_list,
L221: .gmu_regs = gen7_14_0_gmu_registers,
  .external_core_regs = gen7_14_0_external_core_regs,
  .num_external_core_regs = ARRAY_SIZE(gen7_14_0_external_core_regs),
  .gmu_gx_regs = gen7_14_0_gmu_gx_registers,
  .rscc_regs = gen7_14_0_rscc_registers,
L222: .gmu_gx_regs = gen7_14_0_gmu_gx_registers,
  .num_external_core_regs = ARRAY_SIZE(gen7_14_0_external_core_regs),
  .gmu_regs = gen7_14_0_gmu_registers,
  .rscc_regs = gen7_14_0_rscc_registers,
  .reg_list = gen7_14_0_reg_list,
L247: .gmu_regs = gen7_11_0_gmu_registers,
  .external_core_regs = gen7_11_0_external_core_regs,
  .num_external_core_regs = ARRAY_SIZE(gen7_11_0_external_core_regs),
  .gmu_ao_regs = gen7_11_0_gmu_ao_registers,
  .gmu_gx_regs = gen7_11_0_gmugx_registers,
L248: .gmu_ao_regs = gen7_11_0_gmu_ao_registers,
  .num_external_core_regs = ARRAY_SIZE(gen7_11_0_external_core_regs),
  .gmu_regs = gen7_11_0_gmu_registers,
  .gmu_gx_regs = gen7_11_0_gmugx_registers,
  .rscc_regs = gen7_11_0_rscc_registers,
L249: .gmu_gx_regs = gen7_11_0_gmugx_registers,
  .gmu_regs = gen7_11_0_gmu_registers,
  .gmu_ao_regs = gen7_11_0_gmu_ao_registers,
  .rscc_regs = gen7_11_0_rscc_registers,
  .reg_list = gen7_11_0_reg_list,
L274: .gmu_regs = gen7_11_0_gmu_registers,
  .external_core_regs = gen7_15_0_external_core_regs,
  .num_external_core_regs = ARRAY_SIZE(gen7_15_0_external_core_regs),
  .gmu_ao_regs = gen7_11_0_gmu_ao_registers,
  .gmu_gx_regs = gen7_11_0_gmugx_registers,
L275: .gmu_ao_regs = gen7_11_0_gmu_ao_registers,
  .num_external_core_regs = ARRAY_SIZE(gen7_15_0_external_core_regs),
  .gmu_regs = gen7_11_0_gmu_registers,
  .gmu_gx_regs = gen7_11_0_gmugx_registers,
  .rscc_regs = gen7_11_0_rscc_registers,
L276: .gmu_gx_regs = gen7_11_0_gmugx_registers,
  .gmu_regs = gen7_11_0_gmu_registers,
  .gmu_ao_regs = gen7_11_0_gmu_ao_registers,
  .rscc_regs = gen7_11_0_rscc_registers,
  .reg_list = gen7_11_0_reg_list,
L301: .gmu_regs = gen7_14_0_gmu_registers,
  .external_core_regs = gen7_17_0_external_core_regs,
  .num_external_core_regs = ARRAY_SIZE(gen7_17_0_external_core_regs),
  .gmu_gx_regs = gen7_14_0_gmu_gx_registers,
  .rscc_regs = gen7_17_0_rscc_registers,
L302: .gmu_gx_regs = gen7_14_0_gmu_gx_registers,
  .num_external_core_regs = ARRAY_SIZE(gen7_17_0_external_core_regs),
  .gmu_regs = gen7_14_0_gmu_registers,
  .rscc_regs = gen7_17_0_rscc_registers,
  .reg_list = gen7_14_0_reg_list,
L362: return (adreno_smmu_is_stalled(ADRENO_DEVICE(device)) || (!device->snapshot_crashdumper) ||
  static bool CD_SCRIPT_CHECK(struct kgsl_device *device)
  {
  IS_ERR_OR_NULL(gen7_capturescript) ||
  IS_ERR_OR_NULL(gen7_crashdump_registers) ||
L1674: * host. Program the GEN7_CP_SQE_UCODE_DBG_ADDR with 0x70d3 offset
  * CP ROQ dump units is 4 dwords. The number of units is stored
  * in CP_ROQ_THRESHOLDS_2[31:20], but it is not accessible to
  * and read the value CP_ROQ_THRESHOLDS_2 from
  * GEN7_CP_SQE_UCODE_DBG_DATA
L1676: * GEN7_CP_SQE_UCODE_DBG_DATA
  * host. Program the GEN7_CP_SQE_UCODE_DBG_ADDR with 0x70d3 offset
  * and read the value CP_ROQ_THRESHOLDS_2 from
  */
  kgsl_regwrite(device, GEN7_CP_SQE_UCODE_DBG_ADDR, 0x70d3);
L1678: kgsl_regwrite(device, GEN7_CP_SQE_UCODE_DBG_ADDR, 0x70d3);
  * GEN7_CP_SQE_UCODE_DBG_DATA
  */
  kgsl_regread(device, GEN7_CP_SQE_UCODE_DBG_DATA, &roq_size);
  roq_size = roq_size >> 20;

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen7_snapshot.h =====
L131: /* gmu_regs : List of GMU registers */
  /* num_external_core_regs : length of external core registers list */
  size_t num_external_core_regs;
  const u32 *gmu_regs;
  /* gmu_ao_regs : List of GMU registers for ao areas */
L132: const u32 *gmu_regs;
  size_t num_external_core_regs;
  /* gmu_regs : List of GMU registers */
  /* gmu_ao_regs : List of GMU registers for ao areas */
  const u32 *gmu_ao_regs;
L133: /* gmu_ao_regs : List of GMU registers for ao areas */
  /* gmu_regs : List of GMU registers */
  const u32 *gmu_regs;
  const u32 *gmu_ao_regs;
  /* gmu_gx_regs : List of GMU GX registers */
L134: const u32 *gmu_ao_regs;
  const u32 *gmu_regs;
  /* gmu_ao_regs : List of GMU registers for ao areas */
  /* gmu_gx_regs : List of GMU GX registers */
  const u32 *gmu_gx_regs;
L135: /* gmu_gx_regs : List of GMU GX registers */
  /* gmu_ao_regs : List of GMU registers for ao areas */
  const u32 *gmu_ao_regs;
  const u32 *gmu_gx_regs;
  /* gmu_gx_blk_dec0_dec1_regs : List of GMU GX registers for blk dec0 and dec1 areas*/
L136: const u32 *gmu_gx_regs;
  const u32 *gmu_ao_regs;
  /* gmu_gx_regs : List of GMU GX registers */
  /* gmu_gx_blk_dec0_dec1_regs : List of GMU GX registers for blk dec0 and dec1 areas*/
  const u32 *gmu_gx_blk_dec0_dec1_regs;
L137: /* gmu_gx_blk_dec0_dec1_regs : List of GMU GX registers for blk dec0 and dec1 areas*/
  /* gmu_gx_regs : List of GMU GX registers */
  const u32 *gmu_gx_regs;
  const u32 *gmu_gx_blk_dec0_dec1_regs;
  /* rscc_regs : List of RSCC registers */
L138: const u32 *gmu_gx_blk_dec0_dec1_regs;
  const u32 *gmu_gx_regs;
  /* gmu_gx_blk_dec0_dec1_regs : List of GMU GX registers for blk dec0 and dec1 areas*/
  /* rscc_regs : List of RSCC registers */
  const u32 *rscc_regs;
L200: DEBUGBUS_GMU_GX           = 55,
  DEBUGBUS_UFC_0            = 47,
  DEBUGBUS_UFC_1            = 48,
  DEBUGBUS_DBGC             = 59,
  DEBUGBUS_CX               = 60,
L203: DEBUGBUS_GMU_CX           = 61,
  DEBUGBUS_DBGC             = 59,
  DEBUGBUS_CX               = 60,
  DEBUGBUS_GPC_BR           = 62,
  DEBUGBUS_GPC_BV           = 63,
L288: DEBUGBUS_GMU_CX,
  
  static const u32 gen7_cx_dbgc_debugbus_blocks[] = {
  DEBUGBUS_CX,
  DEBUGBUS_GBIF_CX,
L373: { GEN7_CP_SQE_STAT_ADDR, GEN7_CP_SQE_STAT_DATA, 0x40},
  
  static struct gen7_cp_indexed_reg gen7_cp_indexed_reg_list[] = {
  { GEN7_CP_DRAW_STATE_ADDR, GEN7_CP_DRAW_STATE_DATA, 0x100},
  { GEN7_CP_SQE_UCODE_DBG_ADDR, GEN7_CP_SQE_UCODE_DBG_DATA, 0x8000},
L375: { GEN7_CP_SQE_UCODE_DBG_ADDR, GEN7_CP_SQE_UCODE_DBG_DATA, 0x8000},
  { GEN7_CP_SQE_STAT_ADDR, GEN7_CP_SQE_STAT_DATA, 0x40},
  { GEN7_CP_DRAW_STATE_ADDR, GEN7_CP_DRAW_STATE_DATA, 0x100},
  { GEN7_CP_BV_SQE_STAT_ADDR, GEN7_CP_BV_SQE_STAT_DATA, 0x40},
  { GEN7_CP_BV_DRAW_STATE_ADDR, GEN7_CP_BV_DRAW_STATE_DATA, 0x100},
L376: { GEN7_CP_BV_SQE_STAT_ADDR, GEN7_CP_BV_SQE_STAT_DATA, 0x40},
  { GEN7_CP_DRAW_STATE_ADDR, GEN7_CP_DRAW_STATE_DATA, 0x100},
  { GEN7_CP_SQE_UCODE_DBG_ADDR, GEN7_CP_SQE_UCODE_DBG_DATA, 0x8000},
  { GEN7_CP_BV_DRAW_STATE_ADDR, GEN7_CP_BV_DRAW_STATE_DATA, 0x100},
  { GEN7_CP_BV_SQE_UCODE_DBG_ADDR, GEN7_CP_BV_SQE_UCODE_DBG_DATA, 0x8000},
L378: { GEN7_CP_BV_SQE_UCODE_DBG_ADDR, GEN7_CP_BV_SQE_UCODE_DBG_DATA, 0x8000},
  { GEN7_CP_BV_SQE_STAT_ADDR, GEN7_CP_BV_SQE_STAT_DATA, 0x40},
  { GEN7_CP_BV_DRAW_STATE_ADDR, GEN7_CP_BV_DRAW_STATE_DATA, 0x100},
  { GEN7_CP_SQE_AC_STAT_ADDR, GEN7_CP_SQE_AC_STAT_DATA, 0x40},
  { GEN7_CP_LPAC_DRAW_STATE_ADDR, GEN7_CP_LPAC_DRAW_STATE_DATA, 0x100},
L379: { GEN7_CP_SQE_AC_STAT_ADDR, GEN7_CP_SQE_AC_STAT_DATA, 0x40},
  { GEN7_CP_BV_DRAW_STATE_ADDR, GEN7_CP_BV_DRAW_STATE_DATA, 0x100},
  { GEN7_CP_BV_SQE_UCODE_DBG_ADDR, GEN7_CP_BV_SQE_UCODE_DBG_DATA, 0x8000},
  { GEN7_CP_LPAC_DRAW_STATE_ADDR, GEN7_CP_LPAC_DRAW_STATE_DATA, 0x100},
  { GEN7_CP_SQE_AC_UCODE_DBG_ADDR, GEN7_CP_SQE_AC_UCODE_DBG_DATA, 0x8000},
L381: { GEN7_CP_SQE_AC_UCODE_DBG_ADDR, GEN7_CP_SQE_AC_UCODE_DBG_DATA, 0x8000},
  { GEN7_CP_SQE_AC_STAT_ADDR, GEN7_CP_SQE_AC_STAT_DATA, 0x40},
  { GEN7_CP_LPAC_DRAW_STATE_ADDR, GEN7_CP_LPAC_DRAW_STATE_DATA, 0x100},
  { GEN7_CP_LPAC_FIFO_DBG_ADDR, GEN7_CP_LPAC_FIFO_DBG_DATA, 0x40},
  };

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8.c =====
L67: #define CP_HW_SQEREADBRUSTOVF 8
  #define CP_HW_MRBFAULT 5
  #define CP_HW_VSDFAULT 6
  #define CP_HW_EVENTENGINEOVF 9
  #define CP_HW_UCODEERROR 10
L79: BIT(CP_HW_SQEREADBRUSTOVF) |	\
  BIT(CP_HW_MRBFAULT) |		\
  BIT(CP_HW_VSDFAULT) |		\
  BIT(CP_HW_EVENTENGINEOVF) |	\
  BIT(CP_HW_UCODEERROR))
L95: #define CP_SW_SMMUFAULT 12
  #define CP_SW_REGISTERPROTECTIONERROR 10
  #define CP_SW_ILLEGALINSTRUCTION 11
  #define CP_SW_VBIFRESPCLIENT 13
  #define CP_SW_VBIFRESPTYPE 19
L117: BIT(CP_SW_SMMUFAULT) |			\
  BIT(CP_SW_REGISTERPROTECTIONERROR) |	\
  BIT(CP_SW_ILLEGALINSTRUCTION) |	\
  BIT(CP_SW_VBIFRESPCLIENT) |		\
  BIT(CP_SW_VBIFRESPTYPE) |		\
L129: /* IFPC & Preemption static powerup restore list */
  extern u32 adreno_slice_mask_override;
  
  static const u32 gen8_pwrup_reglist[] = {
  GEN8_UCHE_MODE_CNTL,
L232: /* IFPC & Preemption static powerup restore list for gen8_3_0 */
  };
  
  static const u32 gen8_3_0_pwrup_reglist[] = {
  GEN8_UCHE_MODE_CNTL,
L281: /* IFPC & Preemption static powerup restore list for gen8_11_0 */
  };
  
  static const u32 gen8_11_0_pwrup_reglist[] = {
  GEN8_RB_CMP_NC_MODE_CNTL,
L597: /* IFPC + Preemption static powerup restore list for gen8_1_0 */
  };
  
  static const u32 gen8_1_0_pwrup_reglist[] = {
  GEN8_SP_HLSQ_TIMEOUT_THRESHOLD_DP,
L644: /* Dynamic IFPC + Preemption extlist for gen8_1_0 */
  };
  
  static const struct gen8_pwrup_extlist gen8_1_0_pwrup_extlist[] = {
  { GEN8_GRAS_TSEFE_DBG_ECO_CNTL, BIT(PIPE_BV) | BIT(PIPE_BR) },
L654: { GEN8_PC_CONTEXT_SWITCH_STABILIZE_CNTL_1, BIT(PIPE_BV) | BIT(PIPE_BR) },
  { GEN8_PC_CHICKEN_BITS_3, BIT(PIPE_BV) | BIT(PIPE_BR) },
  { GEN8_PC_CHICKEN_BITS_4, BIT(PIPE_BV) | BIT(PIPE_BR) },
  { GEN8_PC_VIS_STREAM_CNTL, BIT(PIPE_BV) | BIT(PIPE_BR) },
  { GEN8_RB_CCU_NC_MODE_CNTL, BIT(PIPE_BR) },
L674: { GEN8_RB_CONTEXT_SWITCH_GMEM_SAVE_RESTORE, BIT(PIPE_BR) },
  { GEN8_CP_PROTECT_REG_PIPE + 15, BIT(PIPE_BR) | BIT(PIPE_BV) | BIT(PIPE_LPAC) },
  { GEN8_RB_GC_GMEM_PROTECT, BIT(PIPE_BR) },
  };
  
L771: { GEN8_RB_CONTEXT_SWITCH_GMEM_SAVE_RESTORE, BIT(PIPE_BR)},
  { GEN8_RB_CMP_DBG_ECO_CNTL, BIT(PIPE_BR)},
  { GEN8_RB_GC_GMEM_PROTECT, BIT(PIPE_BR)},
  { GEN8_VPC_FLATSHADE_MODE_CNTL, BIT(PIPE_BV) | BIT(PIPE_BR)},
  { GEN8_PC_CHICKEN_BITS_1, BIT(PIPE_BV) | BIT(PIPE_BR)},
L779: { GEN8_PC_CONTEXT_SWITCH_STABILIZE_CNTL_1, BIT(PIPE_BR) | BIT(PIPE_BV)},
  { GEN8_PC_AUTO_VERTEX_STRIDE, BIT(PIPE_BR) | BIT(PIPE_BV)},
  { GEN8_PC_VIS_STREAM_CNTL, BIT(PIPE_BR) | BIT(PIPE_BV)},
  { GEN8_VFD_CB_BV_THRESHOLD, BIT(PIPE_BV) | BIT(PIPE_BR)},
  { GEN8_VFD_CB_BR_THRESHOLD, BIT(PIPE_BV) | BIT(PIPE_BR)},
L796: { GEN8_PC_CONTEXT_SWITCH_STABILIZE_CNTL_1, BIT(PIPE_BV) | BIT(PIPE_BR) },
  { GEN8_PC_CHICKEN_BITS_3, BIT(PIPE_BV) | BIT(PIPE_BR) },
  { GEN8_PC_CHICKEN_BITS_4, BIT(PIPE_BV) | BIT(PIPE_BR) },
  { GEN8_PC_VIS_STREAM_CNTL, BIT(PIPE_BV) | BIT(PIPE_BR) },
  { GEN8_RB_CCU_CNTL, BIT(PIPE_BR) },
L819: { GEN8_RB_CONTEXT_SWITCH_GMEM_SAVE_RESTORE, BIT(PIPE_BR) },
  { GEN8_RB_GC_GMEM_PROTECT, BIT(PIPE_BR) },
  { GEN8_RB_LPAC_GMEM_PROTECT, BIT(PIPE_BR) },
  };
  
L834: { GEN8_RB_CONTEXT_SWITCH_GMEM_SAVE_RESTORE, BIT(PIPE_BR)},
  { GEN8_RB_CMP_DBG_ECO_CNTL, BIT(PIPE_BR)},
  { GEN8_RB_GC_GMEM_PROTECT, BIT(PIPE_BR)},
  { GEN8_VPC_FLATSHADE_MODE_CNTL, BIT(PIPE_BV) | BIT(PIPE_BR)},
  { GEN8_PC_CHICKEN_BITS_1, BIT(PIPE_BV) | BIT(PIPE_BR)},
L842: { GEN8_PC_CONTEXT_SWITCH_STABILIZE_CNTL_1, BIT(PIPE_BR) | BIT(PIPE_BV)},
  { GEN8_PC_AUTO_VERTEX_STRIDE, BIT(PIPE_BR) | BIT(PIPE_BV)},
  { GEN8_PC_VIS_STREAM_CNTL, BIT(PIPE_BR) | BIT(PIPE_BV)},
  { GEN8_VFD_CB_BV_THRESHOLD, BIT(PIPE_BV) | BIT(PIPE_BR)},
  { GEN8_VFD_CB_BR_THRESHOLD, BIT(PIPE_BV) | BIT(PIPE_BR)},
L863: { GEN8_PC_CONTEXT_SWITCH_STABILIZE_CNTL_1, BIT(PIPE_BV) | BIT(PIPE_BR) },
  { GEN8_PC_AUTO_VERTEX_STRIDE, BIT(PIPE_BV) | BIT(PIPE_BR) },
  { GEN8_PC_VIS_STREAM_CNTL, BIT(PIPE_BV) | BIT(PIPE_BR) },
  { GEN8_PC_CHICKEN_BITS_1, BIT(PIPE_BV) | BIT(PIPE_BR) },
  { GEN8_PC_CHICKEN_BITS_2, BIT(PIPE_BV) | BIT(PIPE_BR) },
L873: { GEN8_RB_CONTEXT_SWITCH_GMEM_SAVE_RESTORE, BIT(PIPE_BR) },
  { GEN8_RB_CCU_NC_MODE_CNTL, BIT(PIPE_BR) },
  { GEN8_RB_CMP_NC_MODE_CNTL, BIT(PIPE_BR) },
  { GEN8_RB_DBG_ECO_CNTL, BIT(PIPE_BV) | BIT(PIPE_BR) },
  { GEN8_RB_RBP_CNTL, BIT(PIPE_BV) | BIT(PIPE_BR) },
L893: { GEN8_GPU_CX_MISC_SMMU_INTR_MASK0, BIT(PIPE_NONE), 0, 0, 0, },
  BIT(PIPE_AQE1) | BIT(PIPE_DDE_BR) | BIT(PIPE_DDE_BV), 0, 0, 0, },
  { GEN8_CP_MULTIDRAW_CNTL, BIT(PIPE_NONE), 0, 0, 0, },
  { GEN8_GPU_CX_MISC_SMMU_INTR_MASK1, BIT(PIPE_NONE), 0, 0, 0, },
  { GEN8_UCHE_MODE_CNTL, BIT(PIPE_NONE), 0, 0, 0, },
L894: { GEN8_GPU_CX_MISC_SMMU_INTR_MASK1, BIT(PIPE_NONE), 0, 0, 0, },
  { GEN8_CP_MULTIDRAW_CNTL, BIT(PIPE_NONE), 0, 0, 0, },
  { GEN8_GPU_CX_MISC_SMMU_INTR_MASK0, BIT(PIPE_NONE), 0, 0, 0, },
  { GEN8_UCHE_MODE_CNTL, BIT(PIPE_NONE), 0, 0, 0, },
  { GEN8_UCHE_CACHE_WAYS, BIT(PIPE_NONE), 0, 0, 0, },
L955: struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev);
  struct kgsl_device *device = data;
  struct adreno_device *adreno_dev = ADRENO_DEVICE(device);
  u32 debug_val = (u32) val;
  int ret;
L964: ret = gen8_hfi_send_set_value(adreno_dev, HFI_VALUE_DBG,
  goto err;
  
  F_PWR_ACD_CALIBRATE, debug_val);
  if (!ret)
L967: gmu->acd_debug_val = debug_val;
  F_PWR_ACD_CALIBRATE, debug_val);
  if (!ret)
  
  adreno_active_count_put(adreno_dev);
L979: struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev);
  struct kgsl_device *device = data;
  struct adreno_device *adreno_dev = ADRENO_DEVICE(device);
  
  *val = (u64) gmu->acd_debug_val;
L981: *val = (u64) gmu->acd_debug_val;
  struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev);
  
  
  return 0;
L1105: void gen8_cp_init_cmds(struct adreno_device *adreno_dev, u32 *cmds)
  };
  
  {
  u32 i = 0, mask = 0;
L1122: /* Disable save/restore of performance counters across preemption */
  mask |= BIT(3);
  
  mask |= BIT(6);
  
L1160: for (i = 0; i < GMU_CORE_LONG_WAKEUP_RETRY_LIMIT; i++) {
  kgsl_regwrite(device, offset, value);
  ts1 = gpudev->read_alwayson(adreno_dev);
  /*
  * Make sure the previous register write is posted before
L1167: gmu_core_regread(device, GEN8_GMUAO_AHB_FENCE_STATUS, &status);
  mb();
  
  
  /*

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8.h =====
L12: #include "adreno_gen8_gmu.h"
  #include <linux/delay.h>
  
  #include "adreno_gen8_hwsched_hfi.h"
  #include "gen8_reg.h"
L13: #include "adreno_gen8_hwsched_hfi.h"
  
  #include "adreno_gen8_gmu.h"
  #include "gen8_reg.h"
  
L30: extern const struct adreno_power_ops gen8_gmu_power_ops;
  struct gen8_snapshot_block_list;
  
  extern const struct adreno_power_ops gen8_hwsched_power_ops;
  extern const struct adreno_perfcounters adreno_gen8_perfcounters;
L37: int (*hfi_probe)(struct adreno_device *adreno_dev);
  struct gen8_gpudev {
  struct adreno_gpudev base;
  void (*hfi_remove)(struct adreno_device *adreno_dev);
  void (*handle_watchdog)(struct adreno_device *adreno_dev);
L38: void (*hfi_remove)(struct adreno_device *adreno_dev);
  struct adreno_gpudev base;
  int (*hfi_probe)(struct adreno_device *adreno_dev);
  void (*handle_watchdog)(struct adreno_device *adreno_dev);
  };
L42: extern const struct gen8_gpudev adreno_gen8_gmu_gpudev;
  };
  
  extern const struct gen8_gpudev adreno_gen8_hwsched_gpudev;
  
L57: 2 if the register fits into IFPC + preemption static list
  * list_type: 0 If the register already present in any of exisiting static pwrup list
  1 if the register fits into IFPC static pwrup only list
  3 if the register fits into external powerup list
  */
L67: /** @gmu: Container for the gen8 GMU device */
  */
  struct gen8_device {
  struct gen8_gmu_device gmu;
  /** @adreno_dev: Container for the generic adreno device */
L68: struct gen8_gmu_device gmu;
  struct gen8_device {
  /** @gmu: Container for the gen8 GMU device */
  /** @adreno_dev: Container for the generic adreno device */
  struct adreno_device adreno_dev;
L134: const struct hfi_limits_mit_tbl *limits_mit_tbl;
  struct gen8_limits_mit_cfg {
  /** @limits_mit_tbl: Table for GPU limits mitigation features */
  /** @len: Number of entries in the table */
  u32 len;
L154: struct hfi_therm_profile_ctrl *therm;
  struct gen8_thermal_mit_cfg {
  /** @therm: Config for GPU thermal mitigation features */
  /** @tsens_en_cfg: Config for GPU thermal mitigation features */
  const struct therm_tsens_en_cfg *tsens_en_cfg;
L165: /** @gmu_fw_version: Minimum firmware version required to support this core */
  /** @base: Container for the generic GPU definitions */
  struct adreno_gpu_core base;
  u32 gmu_fw_version;
  /** @sqefw_name: Name of the SQE microcode file */
L166: u32 gmu_fw_version;
  struct adreno_gpu_core base;
  /** @gmu_fw_version: Minimum firmware version required to support this core */
  /** @sqefw_name: Name of the SQE microcode file */
  const char *sqefw_name;
L167: /** @sqefw_name: Name of the SQE microcode file */
  /** @gmu_fw_version: Minimum firmware version required to support this core */
  u32 gmu_fw_version;
  const char *sqefw_name;
  /** @aqefw_name: Name of the AQE microcode file */
L168: const char *sqefw_name;
  u32 gmu_fw_version;
  /** @sqefw_name: Name of the SQE microcode file */
  /** @aqefw_name: Name of the AQE microcode file */
  const char *aqefw_name;
L171: /** @gmufw_name: Name of the GMU firmware file */
  /** @aqefw_name: Name of the AQE microcode file */
  const char *aqefw_name;
  const char *gmufw_name;
  /**
L172: const char *gmufw_name;
  const char *aqefw_name;
  /** @gmufw_name: Name of the GMU firmware file */
  /**
  * @zap_name: Specifies the name of the CPZ zap file. This field is deprecated.
L175: * Use the 'firmware-name' device tree property instead.
  /**
  * @zap_name: Specifies the name of the CPZ zap file. This field is deprecated.
  */
  const char *zap_name;
L192: /** @ctxt_record_size: Size of the preemption record in bytes */
  /** @nonctxt_regs: Array of non context register list */
  const struct gen8_nonctxt_regs *nonctxt_regs;
  u64 ctxt_record_size;
  /** @gen8_snapshot_block_list: Device-specific blocks dumped in the snapshot */
L196: /** @gmu_hub_clk_freq: Gmu hub interface clock frequency */
  /** @gen8_snapshot_block_list: Device-specific blocks dumped in the snapshot */
  const struct gen8_snapshot_block_list *gen8_snapshot_block_list;
  u64 gmu_hub_clk_freq;
  /**
L197: u64 gmu_hub_clk_freq;
  const struct gen8_snapshot_block_list *gen8_snapshot_block_list;
  /** @gmu_hub_clk_freq: Gmu hub interface clock frequency */
  /**
  * @bcl_data: bit 0 contains response type for bcl alarms and bits 1:21 controls sid vals
L201: * gmu fw sets default throttle levels.
  * @bcl_data: bit 0 contains response type for bcl alarms and bits 1:21 controls sid vals
  * to configure throttle levels for bcl alarm levels 0-2. If sid vals are not set,
  */
  u32 bcl_data;
L204: /** @preempt_level: Preemption level valid ranges [0 to 2] */
  */
  u32 bcl_data;
  u32 preempt_level;
  /** @qos_value: GPU qos value to set for each RB. */
L221: /** @therm_profile: GMU thermal mitigation profile */
  /** @cl_no_ft_timeout_ms: Use this timeout for CL NO_FT instead of infinite */
  u32 cl_no_ft_timeout_ms;
  struct gen8_thermal_mit_cfg *therm_cfg;
  /** @limits_mit_cfg: GPU limits mitigation configuration */
L226: const struct hfi_clx_table_v2_cmd *clx_tbl;
  const struct gen8_limits_mit_cfg *limits_mit_cfg;
  /** @clx_tbl: GPU CLX table */
  /** @gmu_mx_gdsc: This target has separate MX GDSC for the GMU */
  bool gmu_mx_gdsc;
L227: /** @gmu_mx_gdsc: This target has separate MX GDSC for the GMU */
  /** @clx_tbl: GPU CLX table */
  const struct hfi_clx_table_v2_cmd *clx_tbl;
  bool gmu_mx_gdsc;
  /** @three_rail_memory: This target has BX rail in addition to GX and MX */
L228: bool gmu_mx_gdsc;
  const struct hfi_clx_table_v2_cmd *clx_tbl;
  /** @gmu_mx_gdsc: This target has separate MX GDSC for the GMU */
  /** @three_rail_memory: This target has BX rail in addition to GX and MX */
  bool three_rail_memory;
L236: * struct gen8_cp_preemption_record - CP context record for
  
  /**
  * preemption.
  * @magic: (00) Value at this offset must be equal to
L237: * preemption.
  /**
  * struct gen8_cp_preemption_record - CP context record for
  * @magic: (00) Value at this offset must be equal to
  * GEN8_CP_CTXRECORD_MAGIC_REF.
L241: * we must set to zero for all ringbuffers.
  * GEN8_CP_CTXRECORD_MAGIC_REF.
  * @info: (04) Type of record. Written non-zero (usually) by CP.
  * @errno: (08) Error code. Initialize this to GEN8_CP_CTXRECORD_ERROR_NONE.
  * CP will update to another value if a preemption error occurs.

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_0_0_snapshot.h =====
L217: * Block   : ['GMUAO', 'GMUCX', 'GMUCX_RAM']
  
  /*
  * REGION  : UNSLICE
  * Pipeline: PIPE_NONE
L222: static const u32 gen8_0_0_gmu_registers[] = {
  * pairs   : 161 (Regs:614)
  */
  0x10001, 0x10001, 0x10003, 0x10003, 0x10401, 0x10401, 0x10403, 0x10403,
  0x10801, 0x10801, 0x10803, 0x10803, 0x10c01, 0x10c01, 0x10c03, 0x10c03,
L264: static_assert(IS_ALIGNED(sizeof(gen8_0_0_gmu_registers), 8));
  UINT_MAX, UINT_MAX,
  };
  
  /*
L267: * Block   : ['GMUGX']
  
  /*
  * REGION  : UNSLICE
  * Pipeline: PIPE_NONE
L272: static const u32 gen8_0_0_gmugx_registers[] = {
  * pairs   : 15 (Regs:174)
  */
  0x0dc00, 0x0dc0d, 0x0dc10, 0x0dc11, 0x0dc13, 0x0dc15, 0x0dc18, 0x0dc1a,
  0x0dc1c, 0x0dc2f, 0x0dc40, 0x0dc42, 0x0dc60, 0x0dc7f, 0x0dc88, 0x0dc90,
L279: static_assert(IS_ALIGNED(sizeof(gen8_0_0_gmugx_registers), 8));
  UINT_MAX, UINT_MAX,
  };
  
  /*
L282: * Block   : ['GMUGX']
  
  /*
  * REGION  : SLICE
  * Pipeline: PIPE_NONE
L287: static const u32 gen8_0_0_gmugx_slice_registers[] = {
  * pairs   : 23 (Regs:312)
  */
  0x0e400, 0x0e401, 0x0e404, 0x0e40a, 0x0e40e, 0x0e42f, 0x0e438, 0x0e440,
  0x0e448, 0x0e449, 0x0e450, 0x0e46f, 0x0e478, 0x0e480, 0x0e488, 0x0e489,
L296: static_assert(IS_ALIGNED(sizeof(gen8_0_0_gmugx_slice_registers), 8));
  UINT_MAX, UINT_MAX,
  };
  
  /*
L502: * Block   : ['BROADCAST', 'CX_DBGC', 'CX_MISC', 'DBGC', 'GBIF', 'GMUAO']
  
  /*
  * Block   : ['GMUCX', 'GMUGX', 'GRAS', 'PC', 'RBBM']
  * Block   : ['RDVM', 'UCHE', 'VFD', 'VPC', 'VSC']
L503: * Block   : ['GMUCX', 'GMUGX', 'GRAS', 'PC', 'RBBM']
  /*
  * Block   : ['BROADCAST', 'CX_DBGC', 'CX_MISC', 'DBGC', 'GBIF', 'GMUAO']
  * Block   : ['RDVM', 'UCHE', 'VFD', 'VPC', 'VSC']
  * REGION  : UNSLICE
L519: * Block   : ['BROADCAST', 'CX_DBGC', 'CX_MISC', 'DBGC', 'GBIF', 'GMUAO']
  
  /*
  * Block   : ['GMUCX', 'GMUGX', 'GRAS', 'PC', 'RBBM']
  * Block   : ['RDVM', 'UCHE', 'VFD', 'VPC', 'VSC']
L520: * Block   : ['GMUCX', 'GMUGX', 'GRAS', 'PC', 'RBBM']
  /*
  * Block   : ['BROADCAST', 'CX_DBGC', 'CX_MISC', 'DBGC', 'GBIF', 'GMUAO']
  * Block   : ['RDVM', 'UCHE', 'VFD', 'VPC', 'VSC']
  * REGION  : SLICE
L539: * Block   : ['BROADCAST', 'CX_DBGC', 'CX_MISC', 'DBGC', 'GBIF', 'GMUAO']
  
  /*
  * Block   : ['GMUCX', 'GMUGX', 'GRAS', 'PC', 'RBBM']
  * Block   : ['RDVM', 'UCHE', 'VFD', 'VPC', 'VSC']
L540: * Block   : ['GMUCX', 'GMUGX', 'GRAS', 'PC', 'RBBM']
  /*
  * Block   : ['BROADCAST', 'CX_DBGC', 'CX_MISC', 'DBGC', 'GBIF', 'GMUAO']
  * Block   : ['RDVM', 'UCHE', 'VFD', 'VPC', 'VSC']
  * REGION  : UNSLICE
L556: * Block   : ['BROADCAST', 'CX_DBGC', 'CX_MISC', 'DBGC', 'GBIF', 'GMUAO']
  
  /*
  * Block   : ['GMUCX', 'GMUGX', 'GRAS', 'PC', 'RBBM']
  * Block   : ['RDVM', 'UCHE', 'VFD', 'VPC', 'VSC']
L557: * Block   : ['GMUCX', 'GMUGX', 'GRAS', 'PC', 'RBBM']
  /*
  * Block   : ['BROADCAST', 'CX_DBGC', 'CX_MISC', 'DBGC', 'GBIF', 'GMUAO']
  * Block   : ['RDVM', 'UCHE', 'VFD', 'VPC', 'VSC']
  * REGION  : SLICE
L576: * Block   : ['BROADCAST', 'CX_DBGC', 'CX_MISC', 'DBGC', 'GBIF', 'GMUAO']
  
  /*
  * Block   : ['GMUCX', 'GMUGX', 'GRAS', 'PC', 'RBBM']
  * Block   : ['RDVM', 'UCHE', 'VFD', 'VPC', 'VSC']
L577: * Block   : ['GMUCX', 'GMUGX', 'GRAS', 'PC', 'RBBM']
  /*
  * Block   : ['BROADCAST', 'CX_DBGC', 'CX_MISC', 'DBGC', 'GBIF', 'GMUAO']
  * Block   : ['RDVM', 'UCHE', 'VFD', 'VPC', 'VSC']
  * REGION  : UNSLICE
L1794: { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_BR, 0x00040},
  */
  static struct gen8_cp_indexed_reg gen8_0_0_cp_indexed_reg_list[] = {
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_BV, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_LPAC, 0x00040},
L1795: { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_BV, 0x00040},
  static struct gen8_cp_indexed_reg gen8_0_0_cp_indexed_reg_list[] = {
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_BR, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_LPAC, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_AQE0, 0x00040},
L1796: { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_LPAC, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_BR, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_BV, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_AQE0, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_AQE1, 0x00040},
L1797: { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_AQE0, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_BV, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_LPAC, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_AQE1, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_DDE_BR, 0x00040},
L1798: { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_AQE1, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_LPAC, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_AQE0, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_DDE_BR, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_DDE_BV, 0x00040},
L1799: { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_DDE_BR, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_AQE0, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_AQE1, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_DDE_BV, 0x00040},
  { GEN8_CP_DRAW_STATE_ADDR_PIPE, GEN8_CP_DRAW_STATE_DATA_PIPE, UNSLICE, PIPE_BR, 0x00200},
L1800: { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_DDE_BV, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_AQE1, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_DDE_BR, 0x00040},
  { GEN8_CP_DRAW_STATE_ADDR_PIPE, GEN8_CP_DRAW_STATE_DATA_PIPE, UNSLICE, PIPE_BR, 0x00200},
  { GEN8_CP_DRAW_STATE_ADDR_PIPE, GEN8_CP_DRAW_STATE_DATA_PIPE, UNSLICE, PIPE_BV, 0x00200},
L1811: { GEN8_CP_SQE_UCODE_DBG_ADDR_PIPE, GEN8_CP_SQE_UCODE_DBG_DATA_PIPE,
  { GEN8_CP_ROQ_DBG_ADDR_PIPE, GEN8_CP_ROQ_DBG_DATA_PIPE, UNSLICE, PIPE_DDE_BR, 0x00100},
  { GEN8_CP_ROQ_DBG_ADDR_PIPE, GEN8_CP_ROQ_DBG_DATA_PIPE, UNSLICE, PIPE_DDE_BV, 0x00100},
  UNSLICE, PIPE_BR, 0x08000},
  { GEN8_CP_SQE_UCODE_DBG_ADDR_PIPE, GEN8_CP_SQE_UCODE_DBG_DATA_PIPE,
L1813: { GEN8_CP_SQE_UCODE_DBG_ADDR_PIPE, GEN8_CP_SQE_UCODE_DBG_DATA_PIPE,
  { GEN8_CP_SQE_UCODE_DBG_ADDR_PIPE, GEN8_CP_SQE_UCODE_DBG_DATA_PIPE,
  UNSLICE, PIPE_BR, 0x08000},
  UNSLICE, PIPE_BV, 0x08000},
  { GEN8_CP_SQE_UCODE_DBG_ADDR_PIPE, GEN8_CP_SQE_UCODE_DBG_DATA_PIPE,
L1815: { GEN8_CP_SQE_UCODE_DBG_ADDR_PIPE, GEN8_CP_SQE_UCODE_DBG_DATA_PIPE,
  { GEN8_CP_SQE_UCODE_DBG_ADDR_PIPE, GEN8_CP_SQE_UCODE_DBG_DATA_PIPE,
  UNSLICE, PIPE_BV, 0x08000},
  UNSLICE, PIPE_LPAC, 0x08000},
  { GEN8_CP_SQE_UCODE_DBG_ADDR_PIPE, GEN8_CP_SQE_UCODE_DBG_DATA_PIPE,
L1817: { GEN8_CP_SQE_UCODE_DBG_ADDR_PIPE, GEN8_CP_SQE_UCODE_DBG_DATA_PIPE,
  { GEN8_CP_SQE_UCODE_DBG_ADDR_PIPE, GEN8_CP_SQE_UCODE_DBG_DATA_PIPE,
  UNSLICE, PIPE_LPAC, 0x08000},
  UNSLICE, PIPE_AQE0, 0x08000},
  { GEN8_CP_SQE_UCODE_DBG_ADDR_PIPE, GEN8_CP_SQE_UCODE_DBG_DATA_PIPE,

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_1_0_snapshot.h =====
L15: * CX blocks (GBIF_CX, GMU_CX, CX) are handled by gen8_cx_debugbus_blocks.
  * The data file puts DEBUGBUS_GBIF_GX_GC_US_I_0 in the main debugbus_blocks list,
  * so we use an empty list here and include it in gen8_1_0_debugbus_blocks instead.
  */
  static const u32 gen8_1_0_gbif_debugbus_blocks[] = {
L24: /* Note: CX blocks (GBIF_CX, GMU_CX, CX) are handled by gen8_cx_debugbus_blocks */
  /* GBIF_GX block - included here per android_DXX_gen8_1_0_data.h */
  DEBUGBUS_GBIF_GX_GC_US_I_0,
  DEBUGBUS_GMU_GX_GC_US_I_0,
  DEBUGBUS_DBGC_GC_US_I_0,
L25: DEBUGBUS_GMU_GX_GC_US_I_0,
  DEBUGBUS_GBIF_GX_GC_US_I_0,
  /* Note: CX blocks (GBIF_CX, GMU_CX, CX) are handled by gen8_cx_debugbus_blocks */
  DEBUGBUS_DBGC_GC_US_I_0,
  DEBUGBUS_RBBM_GC_US_I_0,
L73: DEBUGBUS_GMU_GC_S_0_I_0,
  DEBUGBUS_CCRE_GC_S_0_I_0,
  DEBUGBUS_CGC_GC_S_0_I_0,
  DEBUGBUS_SLICE_GC_S_0_I_0,
  DEBUGBUS_HLSQ_SPTP_STAR_GC_S_0_I_0,
L117: DEBUGBUS_GMU_GC_S_1_I_0,
  DEBUGBUS_CCRE_GC_S_1_I_0,
  DEBUGBUS_CGC_GC_S_1_I_0,
  DEBUGBUS_SLICE_GC_S_1_I_0,
  DEBUGBUS_HLSQ_SPTP_STAR_GC_S_1_I_0,
L161: DEBUGBUS_GMU_GC_S_2_I_0,
  DEBUGBUS_CCRE_GC_S_2_I_0,
  DEBUGBUS_CGC_GC_S_2_I_0,
  DEBUGBUS_SLICE_GC_S_2_I_0,
  DEBUGBUS_HLSQ_SPTP_STAR_GC_S_2_I_0,
L205: DEBUGBUS_GMU_GC_S_3_I_0,
  DEBUGBUS_CCRE_GC_S_3_I_0,
  DEBUGBUS_CGC_GC_S_3_I_0,
  DEBUGBUS_SLICE_GC_S_3_I_0,
  DEBUGBUS_HLSQ_SPTP_STAR_GC_S_3_I_0,
L420: * Block   : ['GMUGX']
  
  /*
  * REGION  : UNSLICE
  * Pipeline: PIPE_NONE
L425: static const u32 gen8_1_0_gmugx_registers[] = {
  * pairs   : 15 (Regs:174)
  */
  0x0dc00, 0x0dc0d, 0x0dc10, 0x0dc11, 0x0dc13, 0x0dc15, 0x0dc18, 0x0dc1a,
  0x0dc1c, 0x0dc2f, 0x0dc40, 0x0dc42, 0x0dc60, 0x0dc7f, 0x0dc88, 0x0dc90,
L432: static_assert(IS_ALIGNED(sizeof(gen8_1_0_gmugx_registers), 8));
  UINT_MAX, UINT_MAX,
  };
  
  /*
L435: * Block   : ['GMUGX']
  
  /*
  * REGION  : SLICE
  * Pipeline: PIPE_NONE
L440: static const u32 gen8_1_0_gmugx_slice_registers[] = {
  * pairs   : 23 (Regs:314)
  */
  0x0e400, 0x0e401, 0x0e404, 0x0e40a, 0x0e40c, 0x0e42f, 0x0e438, 0x0e440,
  0x0e448, 0x0e449, 0x0e450, 0x0e46f, 0x0e478, 0x0e480, 0x0e488, 0x0e489,
L449: static_assert(IS_ALIGNED(sizeof(gen8_1_0_gmugx_slice_registers), 8));
  UINT_MAX, UINT_MAX,
  };
  
  /*
L452: * Block   : ['GMUAO']
  
  /*
  * REGION  : UNSLICE
  * Pipeline: PIPE_NONE
L457: static const u32 gen8_1_0_gmuao_registers[] = {
  * pairs   : 63 (Regs:290)
  */
  0x10001, 0x10001, 0x10003, 0x10003, 0x10401, 0x10401, 0x10403, 0x10403,
  0x10801, 0x10801, 0x10803, 0x10803, 0x10c01, 0x10c01, 0x10c03, 0x10c03,
L476: static_assert(IS_ALIGNED(sizeof(gen8_1_0_gmuao_registers), 8));
  UINT_MAX, UINT_MAX,
  };
  
  /*
L479: * Block   : ['GMUCX', 'GMUCX_RAM']
  
  /*
  * REGION  : UNSLICE
  * Pipeline: PIPE_NONE
L484: static const u32 gen8_1_0_gmucx_registers[] = {
  * pairs   : 154 (Regs:819)
  */
  0x1f400, 0x1f40b, 0x1f40f, 0x1f411, 0x1f500, 0x1f500, 0x1f507, 0x1f507,
  0x1f509, 0x1f50b, 0x1f700, 0x1f701, 0x1f704, 0x1f706, 0x1f708, 0x1f709,
L526: static_assert(IS_ALIGNED(sizeof(gen8_1_0_gmucx_registers), 8));
  UINT_MAX, UINT_MAX,
  };
  
  /*
L1808: { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_BR, 0x00040},
  */
  static struct gen8_cp_indexed_reg gen8_1_0_cp_indexed_reg_list[] = {
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_BV, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_LPAC, 0x00040},
L1809: { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_BV, 0x00040},
  static struct gen8_cp_indexed_reg gen8_1_0_cp_indexed_reg_list[] = {
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_BR, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_LPAC, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_AQE0, 0x00040},
L1810: { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_LPAC, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_BR, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_BV, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_AQE0, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_AQE1, 0x00040},
L1811: { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_AQE0, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_BV, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_LPAC, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_AQE1, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_DDE_BR, 0x00040},
L1812: { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_AQE1, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_LPAC, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_AQE0, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_DDE_BR, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_DDE_BV, 0x00040},
L1813: { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_DDE_BR, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_AQE0, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_AQE1, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_DDE_BV, 0x00040},
  { GEN8_CP_DRAW_STATE_ADDR_PIPE, GEN8_CP_DRAW_STATE_DATA_PIPE, UNSLICE, PIPE_BR, 0x00200},
L1814: { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_DDE_BV, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_AQE1, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_DDE_BR, 0x00040},
  { GEN8_CP_DRAW_STATE_ADDR_PIPE, GEN8_CP_DRAW_STATE_DATA_PIPE, UNSLICE, PIPE_BR, 0x00200},
  { GEN8_CP_DRAW_STATE_ADDR_PIPE, GEN8_CP_DRAW_STATE_DATA_PIPE, UNSLICE, PIPE_BV, 0x00200},
L1825: { GEN8_CP_SQE_UCODE_DBG_ADDR_PIPE, GEN8_CP_SQE_UCODE_DBG_DATA_PIPE, UNSLICE,
  { GEN8_CP_ROQ_DBG_ADDR_PIPE, GEN8_CP_ROQ_DBG_DATA_PIPE, UNSLICE, PIPE_DDE_BR, 0x00200},
  { GEN8_CP_ROQ_DBG_ADDR_PIPE, GEN8_CP_ROQ_DBG_DATA_PIPE, UNSLICE, PIPE_DDE_BV, 0x00200},
  PIPE_BR, 0x0a000},
  { GEN8_CP_SQE_UCODE_DBG_ADDR_PIPE, GEN8_CP_SQE_UCODE_DBG_DATA_PIPE, UNSLICE,
L1827: { GEN8_CP_SQE_UCODE_DBG_ADDR_PIPE, GEN8_CP_SQE_UCODE_DBG_DATA_PIPE, UNSLICE,
  { GEN8_CP_SQE_UCODE_DBG_ADDR_PIPE, GEN8_CP_SQE_UCODE_DBG_DATA_PIPE, UNSLICE,
  PIPE_BR, 0x0a000},
  PIPE_BV, 0x0a000},
  { GEN8_CP_SQE_UCODE_DBG_ADDR_PIPE, GEN8_CP_SQE_UCODE_DBG_DATA_PIPE, UNSLICE,
L1829: { GEN8_CP_SQE_UCODE_DBG_ADDR_PIPE, GEN8_CP_SQE_UCODE_DBG_DATA_PIPE, UNSLICE,
  { GEN8_CP_SQE_UCODE_DBG_ADDR_PIPE, GEN8_CP_SQE_UCODE_DBG_DATA_PIPE, UNSLICE,
  PIPE_BV, 0x0a000},
  PIPE_LPAC, 0x0a000},
  { GEN8_CP_SQE_UCODE_DBG_ADDR_PIPE, GEN8_CP_SQE_UCODE_DBG_DATA_PIPE, UNSLICE,
L1831: { GEN8_CP_SQE_UCODE_DBG_ADDR_PIPE, GEN8_CP_SQE_UCODE_DBG_DATA_PIPE, UNSLICE,
  { GEN8_CP_SQE_UCODE_DBG_ADDR_PIPE, GEN8_CP_SQE_UCODE_DBG_DATA_PIPE, UNSLICE,
  PIPE_LPAC, 0x0a000},
  PIPE_AQE0, 0x0a000},
  { GEN8_CP_SQE_UCODE_DBG_ADDR_PIPE, GEN8_CP_SQE_UCODE_DBG_DATA_PIPE, UNSLICE,

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_10_0_snapshot.h =====
L19: DEBUGBUS_GMU_GX_GC_US_I_0,
  /* GBIF_GX block */
  DEBUGBUS_GBIF_GX_GC_US_I_0,
  DEBUGBUS_DBGC_GC_US_I_0,
  DEBUGBUS_RBBM_GC_US_I_0,
L67: DEBUGBUS_GMU_GC_S_0_I_0,
  DEBUGBUS_CCRE_GC_S_0_I_0,
  DEBUGBUS_CGC_GC_S_0_I_0,
  DEBUGBUS_SLICE_GC_S_0_I_0,
  DEBUGBUS_HLSQ_SPTP_STAR_GC_S_0_I_0,
L111: DEBUGBUS_GMU_GC_S_1_I_0,
  DEBUGBUS_CCRE_GC_S_1_I_0,
  DEBUGBUS_CGC_GC_S_1_I_0,
  DEBUGBUS_SLICE_GC_S_1_I_0,
  DEBUGBUS_HLSQ_SPTP_STAR_GC_S_1_I_0,
L155: DEBUGBUS_GMU_GC_S_2_I_0,
  DEBUGBUS_CCRE_GC_S_2_I_0,
  DEBUGBUS_CGC_GC_S_2_I_0,
  DEBUGBUS_SLICE_GC_S_2_I_0,
  DEBUGBUS_HLSQ_SPTP_STAR_GC_S_2_I_0,

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_11_0_snapshot.h =====
L11: DEBUGBUS_GMU_GX_GC_US_I_0,
  
  static const u32 gen8_11_0_debugbus_blocks[] = {
  DEBUGBUS_DBGC_GC_US_I_0,
  DEBUGBUS_RBBM_GC_US_I_0,
L58: DEBUGBUS_GMU_GC_S_0_I_0,
  DEBUGBUS_CCRE_GC_S_0_I_0,
  DEBUGBUS_CGC_GC_S_0_I_0,
  DEBUGBUS_SLICE_GC_S_0_I_0,
  DEBUGBUS_HLSQ_SPTP_STAR_GC_S_0_I_0,
L115: DEBUGBUS_GMU_GC_S_1_I_0,
  DEBUGBUS_CCRE_GC_S_1_I_0,
  DEBUGBUS_CGC_GC_S_1_I_0,
  DEBUGBUS_SLICE_GC_S_1_I_0,
  DEBUGBUS_HLSQ_SPTP_STAR_GC_S_1_I_0,
L172: DEBUGBUS_GMU_GC_S_2_I_0,
  DEBUGBUS_CCRE_GC_S_2_I_0,
  DEBUGBUS_CGC_GC_S_2_I_0,
  DEBUGBUS_SLICE_GC_S_2_I_0,
  DEBUGBUS_HLSQ_SPTP_STAR_GC_S_2_I_0,
L211: { DEBUGBUS_GMU_CX_GC_US_I_0, 127 },
  static struct gen8_debugbus_info gen8_11_0_cx_debugbus_blocks_sized[] = {
  { DEBUGBUS_GBIF_CX_GC_US_I_0, 31 },
  { DEBUGBUS_CX_GC_US_I_0, 132 },
  };
L217: { DEBUGBUS_GMU_GX_GC_US_I_0, 63 },
  static struct gen8_debugbus_info gen8_11_0_gx_debugbus_blocks_sized[] = {
  { DEBUGBUS_GBIF_GX_GC_US_I_0, 31 },
  { DEBUGBUS_DBGC_GC_US_I_0, 127 },
  { DEBUGBUS_RBBM_GC_US_I_0, 63 },
L264: { DEBUGBUS_GMU_GC_S_0_I_0, 63 },
  { DEBUGBUS_CCRE_GC_S_0_I_0, 79 },
  { DEBUGBUS_CGC_GC_S_0_I_0, 15 },
  { DEBUGBUS_SLICE_GC_S_0_I_0, 7 },
  { DEBUGBUS_HLSQ_SPTP_STAR_GC_S_0_I_0, 7 },
L321: { DEBUGBUS_GMU_GC_S_1_I_0, 63 },
  { DEBUGBUS_CCRE_GC_S_1_I_0, 79 },
  { DEBUGBUS_CGC_GC_S_1_I_0, 15 },
  { DEBUGBUS_SLICE_GC_S_1_I_0, 7 },
  { DEBUGBUS_HLSQ_SPTP_STAR_GC_S_1_I_0, 7 },
L378: { DEBUGBUS_GMU_GC_S_2_I_0, 63 },
  { DEBUGBUS_CCRE_GC_S_2_I_0, 79 },
  { DEBUGBUS_CGC_GC_S_2_I_0, 15 },
  { DEBUGBUS_SLICE_GC_S_2_I_0, 7 },
  { DEBUGBUS_HLSQ_SPTP_STAR_GC_S_2_I_0, 7 },
L632: * Block   : ['GMUGX']
  
  /*
  * REGION  : UNSLICE
  * Pipeline: PIPE_NONE
L637: static const u32 gen8_11_0_gmugx_registers[] = {
  * pairs   : 16 (Regs:180)
  */
  0x0dc00, 0x0dc0d, 0x0dc10, 0x0dc11, 0x0dc13, 0x0dc16, 0x0dc18, 0x0dc1a,
  0x0dc1c, 0x0dc2f, 0x0dc40, 0x0dc42, 0x0dc60, 0x0dc7f, 0x0dc88, 0x0dc90,
L644: static_assert(IS_ALIGNED(sizeof(gen8_11_0_gmugx_registers), 8));
  UINT_MAX, UINT_MAX,
  };
  
  /*
L647: * Block   : ['GMUGX']
  
  /*
  * REGION  : SLICE
  * Pipeline: PIPE_NONE
L652: static const u32 gen8_11_0_gmugx_slice_registers[] = {
  * pairs   : 25 (Regs:331)
  */
  0x0e400, 0x0e402, 0x0e404, 0x0e40a, 0x0e40c, 0x0e42f, 0x0e438, 0x0e440,
  0x0e448, 0x0e449, 0x0e450, 0x0e46f, 0x0e478, 0x0e480, 0x0e488, 0x0e489,
L662: static_assert(IS_ALIGNED(sizeof(gen8_11_0_gmugx_slice_registers), 8));
  UINT_MAX, UINT_MAX,
  };
  
  /*
L665: * Block   : ['GMUAO']
  
  /*
  * REGION  : UNSLICE
  * Pipeline: PIPE_NONE
L670: static const u32 gen8_11_0_gmuao_registers[] = {
  * pairs   : 60 (Regs:87)
  */
  0x10001, 0x10001, 0x10003, 0x10003, 0x10401, 0x10401, 0x10403, 0x10403,
  0x10801, 0x10801, 0x10803, 0x10803, 0x10c01, 0x10c01, 0x10c03, 0x10c03,
L687: static_assert(IS_ALIGNED(sizeof(gen8_11_0_gmuao_registers), 8));
  UINT_MAX, UINT_MAX,
  };
  
  /*
L690: * Block   : ['GMUCX', 'GMUCX_RAM']
  
  /*
  * REGION  : UNSLICE
  * Pipeline: PIPE_NONE
L695: static const u32 gen8_11_0_gmucx_registers[] = {
  * pairs   : 150 (Regs:768)
  */
  0x1f400, 0x1f40b, 0x1f40f, 0x1f411, 0x1f500, 0x1f500, 0x1f507, 0x1f507,
  0x1f509, 0x1f50b, 0x1f700, 0x1f701, 0x1f704, 0x1f706, 0x1f708, 0x1f709,
L735: static_assert(IS_ALIGNED(sizeof(gen8_11_0_gmucx_registers), 8));
  UINT_MAX, UINT_MAX,
  };
  
  /*
L941: * Block   : ['BROADCAST', 'CX_DBGC', 'CX_MISC', 'DBGC', 'GBIF', 'GMUAO']
  
  /*
  * Block   : ['GMUCX', 'GMUGX', 'GRAS', 'PC', 'RBBM']
  * Block   : ['RDVM', 'UCHE', 'VFD', 'VPC', 'VSC']
L942: * Block   : ['GMUCX', 'GMUGX', 'GRAS', 'PC', 'RBBM']
  /*
  * Block   : ['BROADCAST', 'CX_DBGC', 'CX_MISC', 'DBGC', 'GBIF', 'GMUAO']
  * Block   : ['RDVM', 'UCHE', 'VFD', 'VPC', 'VSC']
  * REGION  : UNSLICE
L958: * Block   : ['BROADCAST', 'CX_DBGC', 'CX_MISC', 'DBGC', 'GBIF', 'GMUAO']
  
  /*
  * Block   : ['GMUCX', 'GMUGX', 'GRAS', 'PC', 'RBBM']
  * Block   : ['RDVM', 'UCHE', 'VFD', 'VPC', 'VSC']
L959: * Block   : ['GMUCX', 'GMUGX', 'GRAS', 'PC', 'RBBM']
  /*
  * Block   : ['BROADCAST', 'CX_DBGC', 'CX_MISC', 'DBGC', 'GBIF', 'GMUAO']
  * Block   : ['RDVM', 'UCHE', 'VFD', 'VPC', 'VSC']
  * REGION  : SLICE
L978: * Block   : ['BROADCAST', 'CX_DBGC', 'CX_MISC', 'DBGC', 'GBIF', 'GMUAO']
  
  /*
  * Block   : ['GMUCX', 'GMUGX', 'GRAS', 'PC', 'RBBM']
  * Block   : ['RDVM', 'UCHE', 'VFD', 'VPC', 'VSC']
L979: * Block   : ['GMUCX', 'GMUGX', 'GRAS', 'PC', 'RBBM']
  /*
  * Block   : ['BROADCAST', 'CX_DBGC', 'CX_MISC', 'DBGC', 'GBIF', 'GMUAO']
  * Block   : ['RDVM', 'UCHE', 'VFD', 'VPC', 'VSC']
  * REGION  : UNSLICE
L995: * Block   : ['BROADCAST', 'CX_DBGC', 'CX_MISC', 'DBGC', 'GBIF', 'GMUAO']
  
  /*
  * Block   : ['GMUCX', 'GMUGX', 'GRAS', 'PC', 'RBBM']
  * Block   : ['RDVM', 'UCHE', 'VFD', 'VPC', 'VSC']
L996: * Block   : ['GMUCX', 'GMUGX', 'GRAS', 'PC', 'RBBM']
  /*
  * Block   : ['BROADCAST', 'CX_DBGC', 'CX_MISC', 'DBGC', 'GBIF', 'GMUAO']
  * Block   : ['RDVM', 'UCHE', 'VFD', 'VPC', 'VSC']
  * REGION  : SLICE
L1015: * Block   : ['BROADCAST', 'CX_DBGC', 'CX_MISC', 'DBGC', 'GBIF', 'GMUAO']
  
  /*
  * Block   : ['GMUCX', 'GMUGX', 'GRAS', 'PC', 'RBBM']
  * Block   : ['RDVM', 'UCHE', 'VFD', 'VPC', 'VSC']

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_2_0_snapshot.h =====
L12: DEBUGBUS_GMU_GX_GC_US_I_0,
  
  static const u32 gen8_2_0_debugbus_blocks[] = {
  DEBUGBUS_DBGC_GC_US_I_0,
  DEBUGBUS_RBBM_GC_US_I_0,
L59: DEBUGBUS_GMU_GC_S_0_I_0,
  DEBUGBUS_CCRE_GC_S_0_I_0,
  DEBUGBUS_CGC_GC_S_0_I_0,
  DEBUGBUS_SLICE_GC_S_0_I_0,
  DEBUGBUS_HLSQ_SPTP_STAR_GC_S_0_I_0,
L102: DEBUGBUS_GMU_GC_S_1_I_0,
  DEBUGBUS_CCRE_GC_S_1_I_0,
  DEBUGBUS_CGC_GC_S_1_I_0,
  DEBUGBUS_SLICE_GC_S_1_I_0,
  DEBUGBUS_HLSQ_SPTP_STAR_GC_S_1_I_0,
L145: DEBUGBUS_GMU_GC_S_2_I_0,
  DEBUGBUS_CCRE_GC_S_2_I_0,
  DEBUGBUS_CGC_GC_S_2_I_0,
  DEBUGBUS_SLICE_GC_S_2_I_0,
  DEBUGBUS_HLSQ_SPTP_STAR_GC_S_2_I_0,
L380: * Block   : ['GMUGX']
  
  /*
  * REGION  : UNSLICE
  * Pipeline: PIPE_NONE
L385: static const u32 gen8_2_0_gmugx_registers[] = {
  * pairs   : 15 (Regs:174)
  */
  0x0dc00, 0x0dc0d, 0x0dc10, 0x0dc11, 0x0dc13, 0x0dc15, 0x0dc18, 0x0dc1a,
  0x0dc1c, 0x0dc2f, 0x0dc40, 0x0dc42, 0x0dc60, 0x0dc7f, 0x0dc88, 0x0dc90,
L392: static_assert(IS_ALIGNED(sizeof(gen8_2_0_gmugx_registers), 8));
  UINT_MAX, UINT_MAX,
  };
  
  /*
L395: * Block   : ['GMUGX']
  
  /*
  * REGION  : SLICE
  * Pipeline: PIPE_NONE
L400: static const u32 gen8_2_0_gmugx_slice_registers[] = {
  * pairs   : 23 (Regs:314)
  */
  0x0e400, 0x0e401, 0x0e404, 0x0e40a, 0x0e40c, 0x0e42f, 0x0e438, 0x0e440,
  0x0e448, 0x0e449, 0x0e450, 0x0e46f, 0x0e478, 0x0e480, 0x0e488, 0x0e489,
L409: static_assert(IS_ALIGNED(sizeof(gen8_2_0_gmugx_slice_registers), 8));
  UINT_MAX, UINT_MAX,
  };
  
  /*
L412: * Block   : ['GMUAO']
  
  /*
  * REGION  : UNSLICE
  * Pipeline: PIPE_NONE
L417: static const u32 gen8_2_0_gmuao_registers[] = {
  * pairs   : 55 (Regs:77)
  */
  0x10001, 0x10001, 0x10003, 0x10003, 0x10401, 0x10401, 0x10403, 0x10403,
  0x10801, 0x10801, 0x10803, 0x10803, 0x10c01, 0x10c01, 0x10c03, 0x10c03,
L434: static_assert(IS_ALIGNED(sizeof(gen8_2_0_gmuao_registers), 8));
  UINT_MAX, UINT_MAX,
  };
  
  /*
L437: * Block   : ['GMUCX', 'GMUCX_RAM']
  
  /*
  * REGION  : UNSLICE
  * Pipeline: PIPE_NONE
L442: static const u32 gen8_2_0_gmucx_registers[] = {
  * pairs   : 136 (Regs:710)
  */
  0x1f400, 0x1f40b, 0x1f40f, 0x1f411, 0x1f500, 0x1f500, 0x1f507, 0x1f507,
  0x1f509, 0x1f50b, 0x1f700, 0x1f701, 0x1f704, 0x1f706, 0x1f708, 0x1f709,
L479: static_assert(IS_ALIGNED(sizeof(gen8_2_0_gmucx_registers), 8));
  UINT_MAX, UINT_MAX,
  };
  
  /*
L683: * Block   : ['BROADCAST', 'CX_DBGC', 'CX_MISC', 'DBGC', 'GBIF', 'GMUAO']
  
  /*
  * Block   : ['GMUCX', 'GMUGX', 'GRAS', 'PC', 'RBBM']
  * Block   : ['RDVM', 'UCHE', 'VFD', 'VPC', 'VSC']
L684: * Block   : ['GMUCX', 'GMUGX', 'GRAS', 'PC', 'RBBM']
  /*
  * Block   : ['BROADCAST', 'CX_DBGC', 'CX_MISC', 'DBGC', 'GBIF', 'GMUAO']
  * Block   : ['RDVM', 'UCHE', 'VFD', 'VPC', 'VSC']
  * REGION  : UNSLICE
L700: * Block   : ['BROADCAST', 'CX_DBGC', 'CX_MISC', 'DBGC', 'GBIF', 'GMUAO']
  
  /*
  * Block   : ['GMUCX', 'GMUGX', 'GRAS', 'PC', 'RBBM']
  * Block   : ['RDVM', 'UCHE', 'VFD', 'VPC', 'VSC']
L701: * Block   : ['GMUCX', 'GMUGX', 'GRAS', 'PC', 'RBBM']
  /*
  * Block   : ['BROADCAST', 'CX_DBGC', 'CX_MISC', 'DBGC', 'GBIF', 'GMUAO']
  * Block   : ['RDVM', 'UCHE', 'VFD', 'VPC', 'VSC']
  * REGION  : SLICE
L720: * Block   : ['BROADCAST', 'CX_DBGC', 'CX_MISC', 'DBGC', 'GBIF', 'GMUAO']
  
  /*
  * Block   : ['GMUCX', 'GMUGX', 'GRAS', 'PC', 'RBBM']
  * Block   : ['RDVM', 'UCHE', 'VFD', 'VPC', 'VSC']
L721: * Block   : ['GMUCX', 'GMUGX', 'GRAS', 'PC', 'RBBM']
  /*
  * Block   : ['BROADCAST', 'CX_DBGC', 'CX_MISC', 'DBGC', 'GBIF', 'GMUAO']
  * Block   : ['RDVM', 'UCHE', 'VFD', 'VPC', 'VSC']
  * REGION  : UNSLICE
L737: * Block   : ['BROADCAST', 'CX_DBGC', 'CX_MISC', 'DBGC', 'GBIF', 'GMUAO']
  
  /*
  * Block   : ['GMUCX', 'GMUGX', 'GRAS', 'PC', 'RBBM']
  * Block   : ['RDVM', 'UCHE', 'VFD', 'VPC', 'VSC']
L738: * Block   : ['GMUCX', 'GMUGX', 'GRAS', 'PC', 'RBBM']
  /*
  * Block   : ['BROADCAST', 'CX_DBGC', 'CX_MISC', 'DBGC', 'GBIF', 'GMUAO']
  * Block   : ['RDVM', 'UCHE', 'VFD', 'VPC', 'VSC']
  * REGION  : SLICE
L757: * Block   : ['BROADCAST', 'CX_DBGC', 'CX_MISC', 'DBGC', 'GBIF', 'GMUAO']
  
  /*
  * Block   : ['GMUCX', 'GMUGX', 'GRAS', 'PC', 'RBBM']
  * Block   : ['RDVM', 'UCHE', 'VFD', 'VPC', 'VSC']
L758: * Block   : ['GMUCX', 'GMUGX', 'GRAS', 'PC', 'RBBM']
  /*
  * Block   : ['BROADCAST', 'CX_DBGC', 'CX_MISC', 'DBGC', 'GBIF', 'GMUAO']
  * Block   : ['RDVM', 'UCHE', 'VFD', 'VPC', 'VSC']
  * REGION  : UNSLICE
L2140: { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_BR, 0x00040},
  
  static struct gen8_cp_indexed_reg gen8_2_0_cp_indexed_reg_list[] = {
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_BV, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_LPAC, 0x00040},
L2141: { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_BV, 0x00040},
  static struct gen8_cp_indexed_reg gen8_2_0_cp_indexed_reg_list[] = {
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_BR, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_LPAC, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_AQE0, 0x00040},
L2142: { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_LPAC, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_BR, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_BV, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_AQE0, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_AQE1, 0x00040},
L2143: { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_AQE0, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_BV, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_LPAC, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_AQE1, 0x00040},
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_DDE_BR, 0x00040},

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_3_0_snapshot.h =====
L12: DEBUGBUS_GMU_GX_GC_US_I_0,
  
  static const u32 gen8_3_0_debugbus_blocks[] = {
  DEBUGBUS_DBGC_GC_US_I_0,
  DEBUGBUS_RBBM_GC_US_I_0,
L54: DEBUGBUS_GMU_GC_S_0_I_0,
  DEBUGBUS_CCRE_GC_S_0_I_0,
  DEBUGBUS_CGC_GC_S_0_I_0,
  DEBUGBUS_SLICE_GC_S_0_I_0,
  DEBUGBUS_HLSQ_SPTP_STAR_GC_S_0_I_0,
L168: * Block   : ['GMUAO', 'GMUCX', 'GMUCX_RAM']
  
  /*
  * REGION  : UNSLICE
  * Pipeline: PIPE_NONE
L173: static const u32 gen8_3_0_gmu_registers[] = {
  * pairs   : 160 (Regs:616)
  */
  0x10001, 0x10001, 0x10003, 0x10003, 0x10401, 0x10401, 0x10403, 0x10403,
  0x10801, 0x10801, 0x10803, 0x10803, 0x10c01, 0x10c01, 0x10c03, 0x10c03,
L215: static_assert(IS_ALIGNED(sizeof(gen8_3_0_gmu_registers), 8));
  UINT_MAX, UINT_MAX,
  };
  
  /*
L218: * Block   : ['GMUGX']
  
  /*
  * REGION  : UNSLICE
  * Pipeline: PIPE_NONE
L223: static const u32 gen8_3_0_gmugx_registers[] = {
  * pairs   : 17 (Regs:170)
  */
  0x0dc00, 0x0dc0d, 0x0dc10, 0x0dc11, 0x0dc13, 0x0dc15, 0x0dc18, 0x0dc1a,
  0x0dc1c, 0x0dc23, 0x0dc26, 0x0dc2b, 0x0dc2e, 0x0dc2f, 0x0dc40, 0x0dc42,
L231: static_assert(IS_ALIGNED(sizeof(gen8_3_0_gmugx_registers), 8));
  UINT_MAX, UINT_MAX,
  };
  
  /*
L234: * Block   : ['GMUGX']
  
  /*
  * REGION  : SLICE
  * Pipeline: PIPE_NONE
L239: static const u32 gen8_3_0_gmugx_slice_registers[] = {
  * pairs   : 19 (Regs:224)
  */
  0x0e400, 0x0e401, 0x0e404, 0x0e404, 0x0e406, 0x0e408, 0x0e40a, 0x0e40a,
  0x0e40e, 0x0e42f, 0x0e438, 0x0e440, 0x0e448, 0x0e449, 0x0e490, 0x0e4af,
L247: static_assert(IS_ALIGNED(sizeof(gen8_3_0_gmugx_slice_registers), 8));
  UINT_MAX, UINT_MAX,
  };
  
  /*
L670: { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_BR, 0x00040},
  */
  static struct gen8_cp_indexed_reg gen8_3_0_cp_indexed_reg_list[] = {
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_BV, 0x00040},
  { GEN8_CP_DRAW_STATE_ADDR_PIPE, GEN8_CP_DRAW_STATE_DATA_PIPE, UNSLICE, PIPE_BR, 0x00200},
L671: { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_BV, 0x00040},
  static struct gen8_cp_indexed_reg gen8_3_0_cp_indexed_reg_list[] = {
  { GEN8_CP_SQE_STAT_ADDR_PIPE, GEN8_CP_SQE_STAT_DATA_PIPE, UNSLICE, PIPE_BR, 0x00040},
  { GEN8_CP_DRAW_STATE_ADDR_PIPE, GEN8_CP_DRAW_STATE_DATA_PIPE, UNSLICE, PIPE_BR, 0x00200},
  { GEN8_CP_DRAW_STATE_ADDR_PIPE, GEN8_CP_DRAW_STATE_DATA_PIPE, UNSLICE, PIPE_BV, 0x00200},
L676: { GEN8_CP_SQE_UCODE_DBG_ADDR_PIPE, GEN8_CP_SQE_UCODE_DBG_DATA_PIPE,
  { GEN8_CP_ROQ_DBG_ADDR_PIPE, GEN8_CP_ROQ_DBG_DATA_PIPE, UNSLICE, PIPE_BR, 0x00800},
  { GEN8_CP_ROQ_DBG_ADDR_PIPE, GEN8_CP_ROQ_DBG_DATA_PIPE, UNSLICE, PIPE_BV, 0x00800},
  UNSLICE, PIPE_BR, 0x08000},
  { GEN8_CP_SQE_UCODE_DBG_ADDR_PIPE, GEN8_CP_SQE_UCODE_DBG_DATA_PIPE,
L678: { GEN8_CP_SQE_UCODE_DBG_ADDR_PIPE, GEN8_CP_SQE_UCODE_DBG_DATA_PIPE,
  { GEN8_CP_SQE_UCODE_DBG_ADDR_PIPE, GEN8_CP_SQE_UCODE_DBG_DATA_PIPE,
  UNSLICE, PIPE_BR, 0x08000},
  UNSLICE, PIPE_BV, 0x08000},
  { GEN8_CP_RESOURCE_TABLE_DBG_ADDR_BV, GEN8_CP_RESOURCE_TABLE_DBG_DATA_BV,
L688: static struct gen8_reg_list gen8_3_0_gmu_gx_regs[] = {
  };
  
  { UNSLICE, gen8_3_0_gmugx_registers },
  { SLICE, gen8_3_0_gmugx_slice_registers },
L689: { UNSLICE, gen8_3_0_gmugx_registers },
  
  static struct gen8_reg_list gen8_3_0_gmu_gx_regs[] = {
  { SLICE, gen8_3_0_gmugx_slice_registers },
  };
L690: { SLICE, gen8_3_0_gmugx_slice_registers },
  static struct gen8_reg_list gen8_3_0_gmu_gx_regs[] = {
  { UNSLICE, gen8_3_0_gmugx_registers },
  };
  

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_6_0_snapshot.h =====
L12: DEBUGBUS_GMU_GX_GC_US_I_0,
  
  static const u32 gen8_6_0_debugbus_blocks[] = {
  DEBUGBUS_DBGC_GC_US_I_0,
  DEBUGBUS_RBBM_GC_US_I_0,
L57: DEBUGBUS_GMU_GC_S_0_I_0,
  DEBUGBUS_CCRE_GC_S_0_I_0,
  DEBUGBUS_CGC_GC_S_0_I_0,
  DEBUGBUS_SLICE_GC_S_0_I_0,
  DEBUGBUS_HLSQ_SPTP_STAR_GC_S_0_I_0,
L100: DEBUGBUS_GMU_GC_S_1_I_0,
  DEBUGBUS_CCRE_GC_S_1_I_0,
  DEBUGBUS_CGC_GC_S_1_I_0,
  DEBUGBUS_SLICE_GC_S_1_I_0,
  DEBUGBUS_HLSQ_SPTP_STAR_GC_S_1_I_0,
L314: * Block   : ['GMUGX']
  
  /*
  * REGION  : UNSLICE
  * Pipeline: PIPE_NONE
L319: static const u32 gen8_6_0_gmu_registers[] = {
  * pairs   : 160 (Regs:616)
  */
  0x10001, 0x10001, 0x10003, 0x10003, 0x10401, 0x10401, 0x10403, 0x10403,
  0x10801, 0x10801, 0x10803, 0x10803, 0x10c01, 0x10c01, 0x10c03, 0x10c03,
L361: static_assert(IS_ALIGNED(sizeof(gen8_6_0_gmu_registers), 8));
  UINT_MAX, UINT_MAX,
  };
  
  /*
L364: * Block   : ['BROADCAST', 'CX_DBGC', 'CX_MISC', 'DBGC', 'GBIF', 'GMUAO']
  
  /*
  * Block   : ['GMUCX', 'GMUGX', 'GRAS', 'PC', 'RBBM']
  * Block   : ['RDVM', 'UCHE', 'VFD', 'VPC', 'VSC']
L365: * Block   : ['GMUCX', 'GMUGX', 'GRAS', 'PC', 'RBBM']
  /*
  * Block   : ['BROADCAST', 'CX_DBGC', 'CX_MISC', 'DBGC', 'GBIF', 'GMUAO']
  * Block   : ['RDVM', 'UCHE', 'VFD', 'VPC', 'VSC']
  * REGION  : SLICE
L384: * Block   : ['BROADCAST', 'CX_DBGC', 'CX_MISC', 'DBGC', 'GBIF', 'GMUAO']
  
  /*
  * Block   : ['GMUCX', 'GMUGX', 'GRAS', 'PC', 'RBBM']
  * Block   : ['RDVM', 'UCHE', 'VFD', 'VPC', 'VSC']
L385: * Block   : ['GMUCX', 'GMUGX', 'GRAS', 'PC', 'RBBM']
  /*
  * Block   : ['BROADCAST', 'CX_DBGC', 'CX_MISC', 'DBGC', 'GBIF', 'GMUAO']
  * Block   : ['RDVM', 'UCHE', 'VFD', 'VPC', 'VSC']
  * REGION  : SLICE
L607: static struct gen8_reg_list gen8_6_0_gmu_gx_registers[] = {
  };
  
  { UNSLICE, gen8_0_0_gmugx_registers },
  { UNSLICE, gen8_0_0_gx_clkctl_ahb2phy_broadcast_swman_registers },
L608: { UNSLICE, gen8_0_0_gmugx_registers },
  
  static struct gen8_reg_list gen8_6_0_gmu_gx_registers[] = {
  { UNSLICE, gen8_0_0_gx_clkctl_ahb2phy_broadcast_swman_registers },
  { UNSLICE, gen8_0_0_gx_clkctl_ahb2phy_swman_registers },
L614: { SLICE, gen8_0_0_gmugx_slice_registers },
  { UNSLICE, gen8_6_0_gx_clkctl_gx_clkctl_reg_registers },
  { UNSLICE, gen8_6_0_acd_acd_registers },
  };
  #endif /*_ADRENO_GEN8_6_0_SNAPSHOT_H */

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_9_0_snapshot.h =====
L12: DEBUGBUS_GMU_GX_GC_US_I_0,
  
  static const u32 gen8_9_0_debugbus_blocks[] = {
  DEBUGBUS_DBGC_GC_US_I_0,
  DEBUGBUS_RBBM_GC_US_I_0,
L57: DEBUGBUS_GMU_GC_S_0_I_0,
  DEBUGBUS_CCRE_GC_S_0_I_0,
  DEBUGBUS_CGC_GC_S_0_I_0,
  DEBUGBUS_SLICE_GC_S_0_I_0,
  DEBUGBUS_HLSQ_SPTP_STAR_GC_S_0_I_0,
L100: DEBUGBUS_GMU_GC_S_1_I_0,
  DEBUGBUS_CCRE_GC_S_1_I_0,
  DEBUGBUS_CGC_GC_S_1_I_0,
  DEBUGBUS_SLICE_GC_S_1_I_0,
  DEBUGBUS_HLSQ_SPTP_STAR_GC_S_1_I_0,

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_coresight.c =====
L59: { GEN8_DBGC_SMMU_FAULT_BLOCK_HALT_CFG },
  { GEN8_DBGC_AHB_DBG_CNTL },
  { GEN8_DBGC_CFG_DBGBUS_MISC_MODE },
  };
  
L156: static ADRENO_CORESIGHT_ATTR(cfg_smmu_fault_block_halt, &gen8_coresight_regs[45]);
  static ADRENO_CORESIGHT_ATTR(ahb_dbg_cntl, &gen8_coresight_regs[43]);
  static ADRENO_CORESIGHT_ATTR(cfg_dbgbus_misc_mode, &gen8_coresight_regs[44]);
  
  /*CX debug registers*/
L298: &coresight_attr_cfg_smmu_fault_block_halt.attr.attr,
  &coresight_attr_ahb_dbg_cntl.attr.attr,
  &coresight_attr_cfg_dbgbus_misc_mode.attr.attr,
  NULL,
  };

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_gmu.c =====
L10: #include <linux/firmware.h>
  #include <linux/delay.h>
  #include <linux/dma-map-ops.h>
  #include <linux/interconnect.h>
  #include <linux/io.h>
L25: #include "kgsl_gmu_core.h"
  #include "kgsl_device.h"
  #include "kgsl_trace.h"
  #include "kgsl_util.h"
  
L28: static struct gmu_vma_entry gen8_gmu_vma[] = {
  #include "kgsl_util.h"
  
  [GMU_ITCM] = {
  .start = 0x00000000,
L29: [GMU_ITCM] = {
  
  static struct gmu_vma_entry gen8_gmu_vma[] = {
  .start = 0x00000000,
  .size = SZ_16K,
L33: [GMU_CACHE] = {
  .size = SZ_16K,
  },
  .start = SZ_16K,
  .size = (SZ_16M - SZ_16K),
L38: [GMU_DTCM] = {
  .next_va = SZ_16K,
  },
  .start = SZ_256M + SZ_16K,
  .size = SZ_16K,
L42: [GMU_DCACHE] = {
  .size = SZ_16K,
  },
  .start = 0x0,
  .size = 0x0,
L46: [GMU_NONCACHED_KERNEL] = {
  .size = 0x0,
  },
  .start = 0x60000000,
  .size = SZ_512M,
L51: [GMU_NONCACHED_KERNEL_EXTENDED] = {
  .next_va = 0x60000000,
  },
  .start = 0xc0000000,
  .size = SZ_512M,
L61: struct gen8_gmu_device *gmu = container_of(kobj, struct gen8_gmu_device, log_kobj);
  struct kobj_attribute *attr, const char *buf, size_t count)
  {
  bool val;
  int ret;
L69: gmu->log_stream_enable = val;
  return ret;
  
  gmu_core_mark_for_coldboot(KGSL_DEVICE(gen8_gmu_to_adreno(gmu)));
  return count;
L70: gmu_core_mark_for_coldboot(KGSL_DEVICE(gen8_gmu_to_adreno(gmu)));
  
  gmu->log_stream_enable = val;
  return count;
  }
L76: struct gen8_gmu_device *gmu = container_of(kobj, struct gen8_gmu_device, log_kobj);
  static ssize_t log_stream_enable_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
  {
  
  return scnprintf(buf, PAGE_SIZE, "%d\n", gmu->log_stream_enable);
L78: return scnprintf(buf, PAGE_SIZE, "%d\n", gmu->log_stream_enable);
  struct gen8_gmu_device *gmu = container_of(kobj, struct gen8_gmu_device, log_kobj);
  
  }
  
L84: struct gen8_gmu_device *gmu = container_of(kobj, struct gen8_gmu_device, log_kobj);
  struct kobj_attribute *attr, const char *buf, size_t count)
  {
  u32 val;
  int ret;
L92: gmu->log_group_mask = val;
  return ret;
  
  gmu_core_mark_for_coldboot(KGSL_DEVICE(gen8_gmu_to_adreno(gmu)));
  return count;
L93: gmu_core_mark_for_coldboot(KGSL_DEVICE(gen8_gmu_to_adreno(gmu)));
  
  gmu->log_group_mask = val;
  return count;
  }
L99: struct gen8_gmu_device *gmu = container_of(kobj, struct gen8_gmu_device, log_kobj);
  static ssize_t log_group_mask_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
  {
  
  return scnprintf(buf, PAGE_SIZE, "%x\n", gmu->log_group_mask);
L101: return scnprintf(buf, PAGE_SIZE, "%x\n", gmu->log_group_mask);
  struct gen8_gmu_device *gmu = container_of(kobj, struct gen8_gmu_device, log_kobj);
  
  }
  
L125: struct gen8_gmu_device *gmu = container_of(kobj, struct gen8_gmu_device, stats_kobj);
  struct kobj_attribute *attr, const char *buf, size_t count)
  {
  bool val;
  int ret;
L133: gmu->stats_enable = val;
  return ret;
  
  gmu_core_mark_for_coldboot(KGSL_DEVICE(gen8_gmu_to_adreno(gmu)));
  return count;
L134: gmu_core_mark_for_coldboot(KGSL_DEVICE(gen8_gmu_to_adreno(gmu)));
  
  gmu->stats_enable = val;
  return count;
  }
L140: struct gen8_gmu_device *gmu = container_of(kobj, struct gen8_gmu_device, stats_kobj);
  static ssize_t stats_enable_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
  {
  
  return scnprintf(buf, PAGE_SIZE, "%d\n", gmu->stats_enable);
L142: return scnprintf(buf, PAGE_SIZE, "%d\n", gmu->stats_enable);
  struct gen8_gmu_device *gmu = container_of(kobj, struct gen8_gmu_device, stats_kobj);
  
  }
  
L148: struct gen8_gmu_device *gmu = container_of(kobj, struct gen8_gmu_device, stats_kobj);
  struct kobj_attribute *attr, const char *buf, size_t count)
  {
  u32 val;
  int ret;
L156: gmu->stats_mask = val;
  return ret;
  
  gmu_core_mark_for_coldboot(KGSL_DEVICE(gen8_gmu_to_adreno(gmu)));
  return count;
L157: gmu_core_mark_for_coldboot(KGSL_DEVICE(gen8_gmu_to_adreno(gmu)));
  
  gmu->stats_mask = val;
  return count;
  }
L163: struct gen8_gmu_device *gmu = container_of(kobj, struct gen8_gmu_device, stats_kobj);
  static ssize_t stats_mask_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
  {
  
  return scnprintf(buf, PAGE_SIZE, "%x\n", gmu->stats_mask);
L165: return scnprintf(buf, PAGE_SIZE, "%x\n", gmu->stats_mask);
  struct gen8_gmu_device *gmu = container_of(kobj, struct gen8_gmu_device, stats_kobj);
  
  }
  
L171: struct gen8_gmu_device *gmu = container_of(kobj, struct gen8_gmu_device, stats_kobj);
  struct kobj_attribute *attr, const char *buf, size_t count)
  {
  u32 val;
  int ret;

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_gmu.h =====
L7: #ifndef __ADRENO_GEN8_GMU_H
  */
  
  #define __ADRENO_GEN8_GMU_H
  
L8: #define __ADRENO_GEN8_GMU_H
  
  #ifndef __ADRENO_GEN8_GMU_H
  
  #include <linux/soc/qcom/qcom_aoss.h>
L12: #include "adreno_gen8_hfi.h"
  #include <linux/soc/qcom/qcom_aoss.h>
  
  #include "kgsl_gmu_core.h"
  
L13: #include "kgsl_gmu_core.h"
  
  #include "adreno_gen8_hfi.h"
  
  struct gen8_dcvs_table {
L17: u32 gmu_level_num;
  struct gen8_dcvs_table {
  u32 gpu_level_num;
  struct opp_gx_desc gx_votes[MAX_GX_LEVELS];
  struct opp_desc cx_votes[MAX_CX_LEVELS];
L23: * struct gen8_gmu_device - GMU device structure
  
  /**
  * @ver: GMU Version information
  * @irq: GMU interrupt number
L24: * @ver: GMU Version information
  /**
  * struct gen8_gmu_device - GMU device structure
  * @irq: GMU interrupt number
  * @fw_image: GMU FW image
L25: * @irq: GMU interrupt number
  * struct gen8_gmu_device - GMU device structure
  * @ver: GMU Version information
  * @fw_image: GMU FW image
  * @gmu_log: gmu event log memory
L26: * @fw_image: GMU FW image
  * @ver: GMU Version information
  * @irq: GMU interrupt number
  * @gmu_log: gmu event log memory
  * @hfi: HFI controller
L27: * @gmu_log: gmu event log memory
  * @irq: GMU interrupt number
  * @fw_image: GMU FW image
  * @hfi: HFI controller
  * @idle_level: Minimal GPU idle power level
L28: * @hfi: HFI controller
  * @fw_image: GMU FW image
  * @gmu_log: gmu event log memory
  * @idle_level: Minimal GPU idle power level
  * @log_wptr_retention: Store the log wptr offset on slumber
L32: struct gen8_gmu_device {
  * @log_wptr_retention: Store the log wptr offset on slumber
  */
  int irq;
  const struct firmware *fw_image;
L34: const struct firmware *fw_image;
  struct gen8_gmu_device {
  int irq;
  struct kgsl_memdesc *gmu_log;
  /** @gmu_init_scratch: Memory to store the initial HFI messages */
L35: struct kgsl_memdesc *gmu_log;
  int irq;
  const struct firmware *fw_image;
  /** @gmu_init_scratch: Memory to store the initial HFI messages */
  struct kgsl_memdesc *gmu_init_scratch;
L36: /** @gmu_init_scratch: Memory to store the initial HFI messages */
  const struct firmware *fw_image;
  struct kgsl_memdesc *gmu_log;
  struct kgsl_memdesc *gmu_init_scratch;
  /** @gpu_boot_scratch: Memory to store the bootup HFI messages */
L37: struct kgsl_memdesc *gmu_init_scratch;
  struct kgsl_memdesc *gmu_log;
  /** @gmu_init_scratch: Memory to store the initial HFI messages */
  /** @gpu_boot_scratch: Memory to store the bootup HFI messages */
  struct kgsl_memdesc *gpu_boot_scratch;
L38: /** @gpu_boot_scratch: Memory to store the bootup HFI messages */
  /** @gmu_init_scratch: Memory to store the initial HFI messages */
  struct kgsl_memdesc *gmu_init_scratch;
  struct kgsl_memdesc *gpu_boot_scratch;
  struct gen8_hfi hfi;
L40: struct gen8_hfi hfi;
  /** @gpu_boot_scratch: Memory to store the bootup HFI messages */
  struct kgsl_memdesc *gpu_boot_scratch;
  u32 idle_level;
  /** @qmp: aoss_qmp handle */
L45: /** @cm3_fault: whether gmu received a cm3 fault interrupt */
  struct qmp *qmp;
  u32 log_wptr_retention;
  atomic_t cm3_fault;
  /**
L48: * @itcm_shadow: Copy of the itcm block in firmware binary used for
  atomic_t cm3_fault;
  /**
  * snapshot
  */
L52: /** @flags: Internal gmu flags */
  */
  void *itcm_shadow;
  unsigned long flags;
  /** @rscc_virt: Pointer where RSCC block is mapped */
L56: /** @log_stream_enable: GMU log streaming enable. Disabled by default */
  /** @rscc_virt: Pointer where RSCC block is mapped */
  void __iomem *rscc_virt;
  bool log_stream_enable;
  /** @log_group_mask: Allows overriding default GMU log group mask */
L58: /** @log_group_mask: Allows overriding default GMU log group mask */
  /** @log_stream_enable: GMU log streaming enable. Disabled by default */
  bool log_stream_enable;
  u32 log_group_mask;
  struct kobject log_kobj;
L65: /** @stats_enable: GMU stats feature enable */
  /** @acd_debug_val: DVM value to calibrate ACD for a level */
  u32 acd_debug_val;
  bool stats_enable;
  /** @stats_mask: GMU performance countables to enable */
L67: /** @stats_mask: GMU performance countables to enable */
  /** @stats_enable: GMU stats feature enable */
  bool stats_enable;
  u32 stats_mask;
  /** @stats_interval: GMU performance counters sampling interval */
L69: /** @stats_interval: GMU performance counters sampling interval */
  /** @stats_mask: GMU performance countables to enable */
  u32 stats_mask;
  u32 stats_interval;
  /** @stats_kobj: kernel object for GMU stats directory in sysfs */
L71: /** @stats_kobj: kernel object for GMU stats directory in sysfs */
  /** @stats_interval: GMU performance counters sampling interval */
  u32 stats_interval;
  struct kobject stats_kobj;
  /** @cp_init_hdr: raw command header for cp_init */
L73: /** @cp_init_hdr: raw command header for cp_init */
  /** @stats_kobj: kernel object for GMU stats directory in sysfs */
  struct kobject stats_kobj;
  u32 cp_init_hdr;
  /** @switch_to_unsec_hdr: raw command header for switch to unsecure packet */
L74: u32 cp_init_hdr;
  struct kobject stats_kobj;
  /** @cp_init_hdr: raw command header for cp_init */
  /** @switch_to_unsec_hdr: raw command header for switch to unsecure packet */
  u32 switch_to_unsec_hdr;
L79: /** @dcvs_cmdbuf: Pointer to the table to pass DCVS data to GMU */
  /** @dcvs_table: Table for gpu dcvs levels */
  struct gen8_dcvs_table dcvs_table;
  u32 *dcvs_cmdbuf;
  /** @gmu_scaling_cmdbuf: Pointer to the table to pass GMU power levels */

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_gmu_snapshot.c =====
L9: #include "adreno_gen8_gmu.h"
  #include "adreno.h"
  #include "adreno_gen8.h"
  #include "adreno_gen8_0_0_snapshot.h"
  #include "adreno_snapshot.h"
L14: #include "kgsl_gmu_core.h"
  #include "gen8_reg.h"
  #include "kgsl_device.h"
  
  static size_t gen8_gmu_snapshot_dtcm(struct kgsl_device *device,
L16: static size_t gen8_gmu_snapshot_dtcm(struct kgsl_device *device,
  #include "kgsl_gmu_core.h"
  
  u8 *buf, size_t remain, void *priv)
  {
L19: struct gmu_core_device *gmu_core = &device->gmu_core;
  u8 *buf, size_t remain, void *priv)
  {
  struct kgsl_snapshot_gmu_mem *mem_hdr =
  (struct kgsl_snapshot_gmu_mem *)buf;
L20: struct kgsl_snapshot_gmu_mem *mem_hdr =
  {
  struct gmu_core_device *gmu_core = &device->gmu_core;
  (struct kgsl_snapshot_gmu_mem *)buf;
  u32 *data = (u32 *)(buf + sizeof(*mem_hdr));
L21: (struct kgsl_snapshot_gmu_mem *)buf;
  struct gmu_core_device *gmu_core = &device->gmu_core;
  struct kgsl_snapshot_gmu_mem *mem_hdr =
  u32 *data = (u32 *)(buf + sizeof(*mem_hdr));
  u32 i;
L25: if (remain < gmu_core->vma[GMU_DTCM].size + sizeof(*mem_hdr)) {
  u32 i;
  
  SNAPSHOT_ERR_NOMEM(device, "GMU DTCM Memory");
  return 0;
L26: SNAPSHOT_ERR_NOMEM(device, "GMU DTCM Memory");
  
  if (remain < gmu_core->vma[GMU_DTCM].size + sizeof(*mem_hdr)) {
  return 0;
  }
L30: mem_hdr->type = SNAPSHOT_GMU_MEM_BIN_BLOCK;
  }
  
  mem_hdr->hostaddr = 0;
  mem_hdr->gmuaddr = gmu_core->vma[GMU_DTCM].start;
L32: mem_hdr->gmuaddr = gmu_core->vma[GMU_DTCM].start;
  mem_hdr->type = SNAPSHOT_GMU_MEM_BIN_BLOCK;
  mem_hdr->hostaddr = 0;
  mem_hdr->gpuaddr = 0;
  
L36: * Read of GMU TCMs over side-band debug controller interface is
  
  /*
  * supported on gen8 family
  * region [20]: Dump ITCM/DTCM. Select 1 for DTCM.
L44: for (i = 0; i < (gmu_core->vma[GMU_DTCM].size >> 2); i++)
  kgsl_regwrite(device, GEN8_CX_DBGC_TCM_DBG_ADDR, BIT(20) | BIT(31));
  
  kgsl_regread(device, GEN8_CX_DBGC_TCM_DBG_DATA, data++);
  
L47: return gmu_core->vma[GMU_DTCM].size + sizeof(*mem_hdr);
  kgsl_regread(device, GEN8_CX_DBGC_TCM_DBG_DATA, data++);
  
  }
  
L50: static size_t gen8_gmu_snapshot_itcm(struct kgsl_device *device,
  }
  
  u8 *buf, size_t remain, void *priv)
  {
L53: struct gmu_core_device *gmu_core = &device->gmu_core;
  u8 *buf, size_t remain, void *priv)
  {
  struct kgsl_snapshot_gmu_mem *mem_hdr =
  (struct kgsl_snapshot_gmu_mem *)buf;
L54: struct kgsl_snapshot_gmu_mem *mem_hdr =
  {
  struct gmu_core_device *gmu_core = &device->gmu_core;
  (struct kgsl_snapshot_gmu_mem *)buf;
  void *dest = buf + sizeof(*mem_hdr);
L55: (struct kgsl_snapshot_gmu_mem *)buf;
  struct gmu_core_device *gmu_core = &device->gmu_core;
  struct kgsl_snapshot_gmu_mem *mem_hdr =
  void *dest = buf + sizeof(*mem_hdr);
  struct gen8_gmu_device *gmu = (struct gen8_gmu_device *)priv;
L57: struct gen8_gmu_device *gmu = (struct gen8_gmu_device *)priv;
  (struct kgsl_snapshot_gmu_mem *)buf;
  void *dest = buf + sizeof(*mem_hdr);
  
  if (!gmu->itcm_shadow) {
L59: if (!gmu->itcm_shadow) {
  struct gen8_gmu_device *gmu = (struct gen8_gmu_device *)priv;
  
  dev_err(GMU_PDEV_DEV(device),
  "No memory allocated for ITCM shadow capture\n");
L60: dev_err(GMU_PDEV_DEV(device),
  
  if (!gmu->itcm_shadow) {
  "No memory allocated for ITCM shadow capture\n");
  return 0;
L65: if (remain < gmu_core->vma[GMU_ITCM].size + sizeof(*mem_hdr)) {
  }
  
  SNAPSHOT_ERR_NOMEM(device, "GMU ITCM Memory");
  return 0;
L66: SNAPSHOT_ERR_NOMEM(device, "GMU ITCM Memory");
  
  if (remain < gmu_core->vma[GMU_ITCM].size + sizeof(*mem_hdr)) {
  return 0;
  }
L70: mem_hdr->type = SNAPSHOT_GMU_MEM_BIN_BLOCK;
  }
  
  mem_hdr->hostaddr = 0;
  mem_hdr->gmuaddr = gmu_core->vma[GMU_ITCM].start;
L72: mem_hdr->gmuaddr = gmu_core->vma[GMU_ITCM].start;
  mem_hdr->type = SNAPSHOT_GMU_MEM_BIN_BLOCK;
  mem_hdr->hostaddr = 0;
  mem_hdr->gpuaddr = 0;
  
L75: memcpy(dest, gmu->itcm_shadow, gmu_core->vma[GMU_ITCM].size);
  mem_hdr->gpuaddr = 0;
  
  
  return gmu_core->vma[GMU_ITCM].size + sizeof(*mem_hdr);
L77: return gmu_core->vma[GMU_ITCM].size + sizeof(*mem_hdr);
  memcpy(dest, gmu->itcm_shadow, gmu_core->vma[GMU_ITCM].size);
  
  }
  
L80: static void gen8_gmu_snapshot_memories(struct kgsl_device *device,
  }
  
  struct gen8_gmu_device *gmu, struct kgsl_snapshot *snapshot)
  {
L81: struct gen8_gmu_device *gmu, struct kgsl_snapshot *snapshot)
  
  static void gen8_gmu_snapshot_memories(struct kgsl_device *device,
  {
  struct gmu_mem_type_desc desc;
L83: struct gmu_mem_type_desc desc;
  struct gen8_gmu_device *gmu, struct kgsl_snapshot *snapshot)
  {
  struct kgsl_memdesc *md;
  struct gmu_core_device *gmu_core = &device->gmu_core;
L85: struct gmu_core_device *gmu_core = &device->gmu_core;
  struct gmu_mem_type_desc desc;
  struct kgsl_memdesc *md;
  int i;
  

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hfi.c =====
L12: #include "adreno_gen8_gmu.h"
  #include "adreno.h"
  #include "adreno_gen8.h"
  #include "adreno_gen8_hfi.h"
  #include "kgsl_device.h"
L13: #include "adreno_gen8_hfi.h"
  #include "adreno_gen8.h"
  #include "adreno_gen8_gmu.h"
  #include "kgsl_device.h"
  #include "kgsl_gmu_core.h"
L15: #include "kgsl_gmu_core.h"
  #include "adreno_gen8_hfi.h"
  #include "kgsl_device.h"
  #include "kgsl_trace.h"
  
L18: /* Below section is for all structures related to HFI queues */
  #include "kgsl_trace.h"
  
  #define HFI_QUEUE_MAX HFI_QUEUE_DEFAULT_CNT
  
L19: #define HFI_QUEUE_MAX HFI_QUEUE_DEFAULT_CNT
  
  /* Below section is for all structures related to HFI queues */
  
  /* Total header sizes + queue sizes + 16 for alignment */
L22: #define HFIMEM_SIZE (sizeof(struct hfi_queue_table) + 16 + \
  
  /* Total header sizes + queue sizes + 16 for alignment */
  (HFI_QUEUE_SIZE * HFI_QUEUE_MAX))
  
L23: (HFI_QUEUE_SIZE * HFI_QUEUE_MAX))
  /* Total header sizes + queue sizes + 16 for alignment */
  #define HFIMEM_SIZE (sizeof(struct hfi_queue_table) + 16 + \
  
  #define HOST_QUEUE_START_ADDR(hfi_mem, i) \
L25: #define HOST_QUEUE_START_ADDR(hfi_mem, i) \
  (HFI_QUEUE_SIZE * HFI_QUEUE_MAX))
  
  ((hfi_mem)->hostptr + HFI_QUEUE_OFFSET(i))
  
L26: ((hfi_mem)->hostptr + HFI_QUEUE_OFFSET(i))
  
  #define HOST_QUEUE_START_ADDR(hfi_mem, i) \
  
  struct gen8_hfi *to_gen8_hfi(struct adreno_device *adreno_dev)
L28: struct gen8_hfi *to_gen8_hfi(struct adreno_device *adreno_dev)
  ((hfi_mem)->hostptr + HFI_QUEUE_OFFSET(i))
  
  {
  struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev);
L30: struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev);
  struct gen8_hfi *to_gen8_hfi(struct adreno_device *adreno_dev)
  {
  
  return &gmu->hfi;
L32: return &gmu->hfi;
  struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev);
  
  }
  
L36: int gen8_hfi_queue_read(struct gen8_gmu_device *gmu, u32 queue_idx,
  
  /* Size in below functions are in unit of dwords */
  u32 *output, u32 max_size)
  {
L39: struct kgsl_device *device = KGSL_DEVICE(gen8_gmu_to_adreno(gmu));
  u32 *output, u32 max_size)
  {
  struct kgsl_memdesc *mem_addr = gmu->hfi.hfi_mem;
  struct hfi_queue_table *tbl = mem_addr->hostptr;
L40: struct kgsl_memdesc *mem_addr = gmu->hfi.hfi_mem;
  {
  struct kgsl_device *device = KGSL_DEVICE(gen8_gmu_to_adreno(gmu));
  struct hfi_queue_table *tbl = mem_addr->hostptr;
  struct hfi_queue_header *hdr = &tbl->qhdr[queue_idx];
L41: struct hfi_queue_table *tbl = mem_addr->hostptr;
  struct kgsl_device *device = KGSL_DEVICE(gen8_gmu_to_adreno(gmu));
  struct kgsl_memdesc *mem_addr = gmu->hfi.hfi_mem;
  struct hfi_queue_header *hdr = &tbl->qhdr[queue_idx];
  u32 *queue;
L42: struct hfi_queue_header *hdr = &tbl->qhdr[queue_idx];
  struct kgsl_memdesc *mem_addr = gmu->hfi.hfi_mem;
  struct hfi_queue_table *tbl = mem_addr->hostptr;
  u32 *queue;
  u32 msg_hdr;
L49: if (hdr->status == HFI_QUEUE_STATUS_DISABLED)
  int result = 0;
  
  return -EINVAL;
  
L63: dev_err(GMU_PDEV_DEV(device),
  
  if (size > (max_size >> 2)) {
  "HFI message too big: hdr:0x%x rd idx=%d\n",
  msg_hdr, hdr->read_index);
L64: "HFI message too big: hdr:0x%x rd idx=%d\n",
  if (size > (max_size >> 2)) {
  dev_err(GMU_PDEV_DEV(device),
  msg_hdr, hdr->read_index);
  result = -EMSGSIZE;
L80: dev_err(GMU_PDEV_DEV(device),
  } else {
  /* In case FW messed up */
  "Read index %d greater than queue size %d\n",
  hdr->read_index, hdr->queue_size);
L88: hfi_update_read_idx(hdr, read);
  read = ALIGN(read, SZ_4) % hdr->queue_size;
  
  
  /* For acks, trace the packet for which this ack was sent */
L91: if (MSG_HDR_GET_TYPE(msg_hdr) == HFI_MSG_ACK)
  
  /* For acks, trace the packet for which this ack was sent */
  trace_kgsl_hfi_receive(MSG_HDR_GET_ID(output[1]),
  MSG_HDR_GET_SIZE(output[1]),
L92: trace_kgsl_hfi_receive(MSG_HDR_GET_ID(output[1]),
  /* For acks, trace the packet for which this ack was sent */
  if (MSG_HDR_GET_TYPE(msg_hdr) == HFI_MSG_ACK)
  MSG_HDR_GET_SIZE(output[1]),
  MSG_HDR_GET_SEQNUM(output[1]));
L96: trace_kgsl_hfi_receive(MSG_HDR_GET_ID(msg_hdr),
  MSG_HDR_GET_SEQNUM(output[1]));
  else
  MSG_HDR_GET_SIZE(msg_hdr), MSG_HDR_GET_SEQNUM(msg_hdr));
  
L103: int gen8_hfi_queue_write(struct adreno_device *adreno_dev, u32 queue_idx,
  }
  
  u32 *msg, u32 size_bytes)
  {
L106: struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev);
  u32 *msg, u32 size_bytes)
  {
  struct hfi_queue_table *tbl = gmu->hfi.hfi_mem->hostptr;
  struct hfi_queue_header *hdr = &tbl->qhdr[queue_idx];
L107: struct hfi_queue_table *tbl = gmu->hfi.hfi_mem->hostptr;
  {
  struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev);
  struct hfi_queue_header *hdr = &tbl->qhdr[queue_idx];
  u32 *queue;
L108: struct hfi_queue_header *hdr = &tbl->qhdr[queue_idx];
  struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev);
  struct hfi_queue_table *tbl = gmu->hfi.hfi_mem->hostptr;
  u32 *queue;
  u32 i, write_idx, read_idx, empty_space;
L115: if (hdr->status == HFI_QUEUE_STATUS_DISABLED || !IS_ALIGNED(size_bytes, sizeof(u32)))
  u32 id = MSG_HDR_GET_ID(*msg);
  
  return -EINVAL;
  

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hfi.h =====
L7: #ifndef __ADRENO_GEN8_HFI_H
  */
  
  #define __ADRENO_GEN8_HFI_H
  
L8: #define __ADRENO_GEN8_HFI_H
  
  #ifndef __ADRENO_GEN8_HFI_H
  
  #include "adreno_hfi.h"
L10: #include "adreno_hfi.h"
  #define __ADRENO_GEN8_HFI_H
  
  
  /**
L13: * struct gen8_hfi - HFI control structure
  
  /**
  */
  struct gen8_hfi {
L15: struct gen8_hfi {
  * struct gen8_hfi - HFI control structure
  */
  /** @irq: HFI interrupt line */
  int irq;
L16: /** @irq: HFI interrupt line */
  */
  struct gen8_hfi {
  int irq;
  /** @seqnum: atomic counter that is incremented for each message sent.
L19: *   The value of the counter is used as sequence number for HFI message.
  int irq;
  /** @seqnum: atomic counter that is incremented for each message sent.
  */
  atomic_t seqnum;
L22: /** @hfi_mem: Memory descriptor for the hfi memory */
  */
  atomic_t seqnum;
  struct kgsl_memdesc *hfi_mem;
  /** @bw_table: HFI BW table buffer */
L23: struct kgsl_memdesc *hfi_mem;
  atomic_t seqnum;
  /** @hfi_mem: Memory descriptor for the hfi memory */
  /** @bw_table: HFI BW table buffer */
  struct hfi_bwtable_cmd bw_table;
L24: /** @bw_table: HFI BW table buffer */
  /** @hfi_mem: Memory descriptor for the hfi memory */
  struct kgsl_memdesc *hfi_mem;
  struct hfi_bwtable_cmd bw_table;
  /** @acd_table: HFI table for ACD data */
L25: struct hfi_bwtable_cmd bw_table;
  struct kgsl_memdesc *hfi_mem;
  /** @bw_table: HFI BW table buffer */
  /** @acd_table: HFI table for ACD data */
  struct hfi_acd_table_cmd acd_table;
L26: /** @acd_table: HFI table for ACD data */
  /** @bw_table: HFI BW table buffer */
  struct hfi_bwtable_cmd bw_table;
  struct hfi_acd_table_cmd acd_table;
  /** @cmdq_lock: Spinlock for accessing the cmdq */
L27: struct hfi_acd_table_cmd acd_table;
  struct hfi_bwtable_cmd bw_table;
  /** @acd_table: HFI table for ACD data */
  /** @cmdq_lock: Spinlock for accessing the cmdq */
  spinlock_t cmdq_lock;
L32: * of messages in the GMU scratch.
  /**
  * @wb_set_record_bitmask: Bitmask to enable or disable the recording
  */
  unsigned long wb_set_record_bitmask[BITS_TO_LONGS(HFI_MAX_ID)];
L34: unsigned long wb_set_record_bitmask[BITS_TO_LONGS(HFI_MAX_ID)];
  * of messages in the GMU scratch.
  */
  };
  
L37: struct gen8_gmu_device;
  };
  
  
  /* gen8_hfi_irq_handler - IRQ handler for HFI interripts */
L39: /* gen8_hfi_irq_handler - IRQ handler for HFI interripts */
  struct gen8_gmu_device;
  
  irqreturn_t gen8_hfi_irq_handler(int irq, void *data);
  
L40: irqreturn_t gen8_hfi_irq_handler(int irq, void *data);
  
  /* gen8_hfi_irq_handler - IRQ handler for HFI interripts */
  
  /**
L43: * gen8_hfi_start - Send the various HFIs during device boot up
  
  /**
  * @adreno_dev: Pointer to the adreno device
  *
L48: int gen8_hfi_start(struct adreno_device *adreno_dev);
  * Return: 0 on success or negative error on failure
  */
  
  /**
L51: * gen8_hfi_start - Send the various HFIs during device boot up
  
  /**
  * @adreno_dev: Pointer to the adreno device
  *
L56: void gen8_hfi_stop(struct adreno_device *adreno_dev);
  * Return: 0 on success or negative error on failure
  */
  
  /**
L59: * gen8_hfi_init - Initialize hfi resources
  
  /**
  * @adreno_dev: Pointer to the adreno device
  *
L62: * This function allocates and sets up hfi queues
  * @adreno_dev: Pointer to the adreno device
  *
  * when a process creates the very first kgsl instance
  *
L67: int gen8_hfi_init(struct adreno_device *adreno_dev);
  * Return: 0 on success or negative error on failure
  */
  
  /* Helper function to get to gen8 hfi struct from adreno device */
L69: /* Helper function to get to gen8 hfi struct from adreno device */
  int gen8_hfi_init(struct adreno_device *adreno_dev);
  
  struct gen8_hfi *to_gen8_hfi(struct adreno_device *adreno_dev);
  
L70: struct gen8_hfi *to_gen8_hfi(struct adreno_device *adreno_dev);
  
  /* Helper function to get to gen8 hfi struct from adreno device */
  
  /**
L73: * gen8_hfi_queue_write - Write a command to hfi queue
  
  /**
  * @adreno_dev: Pointer to the adreno device
  * @queue_idx: destination queue id
L81: int gen8_hfi_queue_write(struct adreno_device *adreno_dev, u32 queue_idx,
  * Return: 0 on success or negative error on failure
  */
  u32 *msg, u32 size_bytes);
  
L85: * gen8_hfi_queue_read - Read data from hfi queue
  
  /**
  * @gmu: Pointer to the gen8 gmu device
  * @queue_idx: queue id to read from

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched.c =====
L15: #include "kgsl_gmu_core.h"
  #include "kgsl_bus.h"
  #include "kgsl_device.h"
  #include "kgsl_trace.h"
  #include "kgsl_util.h"
L21: struct gen8_hwsched_hfi *hfi = to_gen8_hwsched_hfi(adreno_dev);
  static void _wakeup_hw_fence_waiters(struct adreno_device *adreno_dev, u32 fault)
  {
  struct adreno_hwsched_hw_fence *hwf = &adreno_dev->hwsched.hw_fence;
  bool lock = !in_interrupt();
L52: kgsl_delete_timer(&hfi->hw_fence_timer);
  wake_up_all(&hwf->unack_wq);
  
  }
  
L75: gen8_gmu_snapshot(adreno_dev, snapshot);
  bool parse_payload;
  
  
  adreno_hwsched_parse_fault_cmdobj(adreno_dev, snapshot);
L80: * First try to dump ringbuffers using context bad HFI payloads
  
  /*
  * because they have all the ringbuffer parameters. If ringbuffer
  * payloads are not present, fall back to dumping ringbuffers
L81: * because they have all the ringbuffer parameters. If ringbuffer
  /*
  * First try to dump ringbuffers using context bad HFI payloads
  * payloads are not present, fall back to dumping ringbuffers
  * based on MEMKIND_RB
L82: * payloads are not present, fall back to dumping ringbuffers
  * First try to dump ringbuffers using context bad HFI payloads
  * because they have all the ringbuffer parameters. If ringbuffer
  * based on MEMKIND_RB
  */
L91: struct hfi_mem_alloc_entry *entry = &hwsched->mem_alloc_table[i];
  
  for (i = 0; i < hwsched->mem_alloc_entries; i++) {
  
  if (entry->desc.mem_kind == HFI_MEMKIND_RB && !skip_memkind_rb)
L93: if (entry->desc.mem_kind == HFI_MEMKIND_RB && !skip_memkind_rb)
  struct hfi_mem_alloc_entry *entry = &hwsched->mem_alloc_table[i];
  
  kgsl_snapshot_add_section(device,
  KGSL_SNAPSHOT_SECTION_RB_V2,
L99: if (entry->desc.mem_kind == HFI_MEMKIND_SCRATCH)
  entry->md);
  
  kgsl_snapshot_add_section(device,
  KGSL_SNAPSHOT_SECTION_GPU_OBJECT_V2,
L105: if (entry->desc.mem_kind == HFI_MEMKIND_PROFILE)
  entry->md);
  
  kgsl_snapshot_add_section(device,
  KGSL_SNAPSHOT_SECTION_GPU_OBJECT_V2,
L111: if (entry->desc.mem_kind == HFI_MEMKIND_CSW_SMMU_INFO)
  entry->md);
  
  kgsl_snapshot_add_section(device,
  KGSL_SNAPSHOT_SECTION_GPU_OBJECT_V2,
L117: if (entry->desc.mem_kind == HFI_MEMKIND_CSW_PRIV_NON_SECURE)
  entry->md);
  
  adreno_hwsched_snapshot_preemption_records(device, snapshot,
  entry->md);
L118: adreno_hwsched_snapshot_preemption_records(device, snapshot,
  
  if (entry->desc.mem_kind == HFI_MEMKIND_CSW_PRIV_NON_SECURE)
  entry->md);
  
L121: if (entry->desc.mem_kind == HFI_MEMKIND_PREEMPT_SCRATCH)
  entry->md);
  
  kgsl_snapshot_add_section(device,
  KGSL_SNAPSHOT_SECTION_GPU_OBJECT_V2,
L127: if (entry->desc.mem_kind == HFI_MEMKIND_AQE_BUFFER)
  entry->md);
  
  kgsl_snapshot_add_section(device,
  KGSL_SNAPSHOT_SECTION_GPU_OBJECT_V2,
L133: if (entry->desc.mem_kind == HFI_MEMKIND_HW_FENCE) {
  entry->md);
  
  struct gmu_mem_type_desc desc;
  
L134: struct gmu_mem_type_desc desc;
  
  if (entry->desc.mem_kind == HFI_MEMKIND_HW_FENCE) {
  
  desc.memdesc = entry->md;
L137: desc.type = SNAPSHOT_GMU_MEM_HW_FENCE;
  
  desc.memdesc = entry->md;
  kgsl_snapshot_add_section(device,
  KGSL_SNAPSHOT_SECTION_GMU_MEMORY,
L139: KGSL_SNAPSHOT_SECTION_GMU_MEMORY,
  desc.type = SNAPSHOT_GMU_MEM_HW_FENCE;
  kgsl_snapshot_add_section(device,
  snapshot, adreno_snapshot_gmu_mem, &desc);
  }
L140: snapshot, adreno_snapshot_gmu_mem, &desc);
  kgsl_snapshot_add_section(device,
  KGSL_SNAPSHOT_SECTION_GMU_MEMORY,
  }
  
L163: dev_err(GMU_PDEV_DEV(KGSL_DEVICE(adreno_dev)),
  if (of_property_read_u32(node, "qcom,hw-fence-table-entries",
  &shadow_num_entries)) {
  "qcom,hw-fence-table-entries property not found\n");
  shadow_num_entries = 8192;
L174: gmu_core_set_vrb_register(device->gmu_core.vrb,
  * Any errors are logged within the VRB set API if a failure occurs.
  */
  VRB_HW_FENCE_SHADOW_NUM_ENTRIES, shadow_num_entries);
  }
L181: struct device *gmu_pdev_dev = GMU_PDEV_DEV(device);
  {
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
  struct adreno_hwsched_hw_fence *hwf = &adreno_dev->hwsched.hw_fence;
  
L187: if (!gmu_core_soccp_vote(device, pwr_on))
  return;
  
  return;
  
L200: adreno_hwsched_log_remove_pending_hw_fences(adreno_dev, gmu_pdev_dev);
  * for debug purposes.
  */
  gmu_core_mark_for_coldboot(KGSL_DEVICE(adreno_dev));
  
L201: gmu_core_mark_for_coldboot(KGSL_DEVICE(adreno_dev));
  */
  adreno_hwsched_log_remove_pending_hw_fences(adreno_dev, gmu_pdev_dev);
  
  adreno_hwsched_deregister_hw_fence(adreno_dev);
L206: static void gen8_hwsched_gmu_suspend(struct adreno_device *adreno_dev, bool force)
  }
  
  {
  gen8_gmu_suspend(adreno_dev, force);
L208: gen8_gmu_suspend(adreno_dev, force);
  static void gen8_hwsched_gmu_suspend(struct adreno_device *adreno_dev, bool force)
  {
  adreno_hwsched_reset_hfi_mem(adreno_dev);
  }
L209: adreno_hwsched_reset_hfi_mem(adreno_dev);
  {
  gen8_gmu_suspend(adreno_dev, force);
  }
  

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched.h =====
L10: #include "adreno_gen8_hwsched_hfi.h"
  #define _ADRENO_GEN8_HWSCHED_H_
  
  
  /**
L13: * enum gen8_gmu_dcvs_obj - Type of DCVS object to be used for GMU based DCVS
  
  /**
  * @GMU_GPU_DCVS_OBJ_OFF: DCVS disabled
  * @GMU_GPU_DCVS_OBJ_DEPRECATED: Deprecated object
L14: * @GMU_GPU_DCVS_OBJ_OFF: DCVS disabled
  /**
  * enum gen8_gmu_dcvs_obj - Type of DCVS object to be used for GMU based DCVS
  * @GMU_GPU_DCVS_OBJ_DEPRECATED: Deprecated object
  * @GMU_GPU_DCVS_OBJ_DOS: DCVS Old School algorithm
L15: * @GMU_GPU_DCVS_OBJ_DEPRECATED: Deprecated object
  * enum gen8_gmu_dcvs_obj - Type of DCVS object to be used for GMU based DCVS
  * @GMU_GPU_DCVS_OBJ_OFF: DCVS disabled
  * @GMU_GPU_DCVS_OBJ_DOS: DCVS Old School algorithm
  * @GMU_GPU_DCVS_OBJ_PARITY: Parity algorithm based on host based DCVS
L16: * @GMU_GPU_DCVS_OBJ_DOS: DCVS Old School algorithm
  * @GMU_GPU_DCVS_OBJ_OFF: DCVS disabled
  * @GMU_GPU_DCVS_OBJ_DEPRECATED: Deprecated object
  * @GMU_GPU_DCVS_OBJ_PARITY: Parity algorithm based on host based DCVS
  * @GMU_GPU_DCVS_OBJ_MAX: enum to define max allowed object
L17: * @GMU_GPU_DCVS_OBJ_PARITY: Parity algorithm based on host based DCVS
  * @GMU_GPU_DCVS_OBJ_DEPRECATED: Deprecated object
  * @GMU_GPU_DCVS_OBJ_DOS: DCVS Old School algorithm
  * @GMU_GPU_DCVS_OBJ_MAX: enum to define max allowed object
  */
L18: * @GMU_GPU_DCVS_OBJ_MAX: enum to define max allowed object
  * @GMU_GPU_DCVS_OBJ_DOS: DCVS Old School algorithm
  * @GMU_GPU_DCVS_OBJ_PARITY: Parity algorithm based on host based DCVS
  */
  enum gen8_gmu_dcvs_obj {
L20: enum gen8_gmu_dcvs_obj {
  * @GMU_GPU_DCVS_OBJ_MAX: enum to define max allowed object
  */
  GMU_GPU_DCVS_OBJ_OFF = 0,
  GMU_GPU_DCVS_OBJ_DEPRECATED = 1,
L21: GMU_GPU_DCVS_OBJ_OFF = 0,
  */
  enum gen8_gmu_dcvs_obj {
  GMU_GPU_DCVS_OBJ_DEPRECATED = 1,
  GMU_GPU_DCVS_OBJ_DOS = 2,
L22: GMU_GPU_DCVS_OBJ_DEPRECATED = 1,
  enum gen8_gmu_dcvs_obj {
  GMU_GPU_DCVS_OBJ_OFF = 0,
  GMU_GPU_DCVS_OBJ_DOS = 2,
  GMU_GPU_DCVS_OBJ_PARITY = 3,
L23: GMU_GPU_DCVS_OBJ_DOS = 2,
  GMU_GPU_DCVS_OBJ_OFF = 0,
  GMU_GPU_DCVS_OBJ_DEPRECATED = 1,
  GMU_GPU_DCVS_OBJ_PARITY = 3,
  GMU_GPU_DCVS_OBJ_MAX,
L24: GMU_GPU_DCVS_OBJ_PARITY = 3,
  GMU_GPU_DCVS_OBJ_DEPRECATED = 1,
  GMU_GPU_DCVS_OBJ_DOS = 2,
  GMU_GPU_DCVS_OBJ_MAX,
  };
L25: GMU_GPU_DCVS_OBJ_MAX,
  GMU_GPU_DCVS_OBJ_DOS = 2,
  GMU_GPU_DCVS_OBJ_PARITY = 3,
  };
  
L34: /** @hwsched_hfi: Container for hwscheduling specific hfi resources */
  /** @gen8_dev: Container for the gen8 device */
  struct gen8_device gen8_dev;
  struct gen8_hwsched_hfi hwsched_hfi;
  };
L35: struct gen8_hwsched_hfi hwsched_hfi;
  struct gen8_device gen8_dev;
  /** @hwsched_hfi: Container for hwscheduling specific hfi resources */
  };
  
L44: * The target specific probe function for hwsched enabled gmu targets.
  * @gpucore: Pointer to the gpucore
  *
  *
  * Return: 0 on success or negative error on failure
L52: * gen8_hwsched_reset_replay - Restart the gmu and gpu and replay inflight cmdbatches
  
  /**
  * @adreno_dev: Pointer to the adreno device
  *
L64: * Snapshot the faulty ib and then snapshot rest of gen8 gmu things
  * @snapshot: Pointer to the snapshot instance
  *
  */
  void gen8_hwsched_snapshot(struct adreno_device *adreno_dev,
L82: * gen8_hwsched_send_recurring_cmdobj - Dispatch IBs to GMU
  
  /**
  * @adreno_dev: Pointer to adreno device structure
  * @cmdobj: The command object which needs to be submitted
L87: * recurring IBs to the GMU. Upon receiving ipc interrupt GMU will submit
  *
  * This function is used to register the context if needed and submit
  * recurring IBs to GPU.
  
L110: * gen8_hwsched_set_pwrconstraint - Send perf hint to GMU
  
  /**
  * @adreno_dev: A handle to adreno device
  * @context_id: Id for the context associated with hint

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.c =====
L7: #include <linux/iommu.h>
  */
  
  
  #include "adreno.h"
L12: #include "adreno_hfi.h"
  #include "adreno_gen8.h"
  #include "adreno_gen8_hwsched.h"
  #include "adreno_pm4types.h"
  #include "adreno_trace.h"
L17: #include "kgsl_gmu_core.h"
  #include "kgsl_device.h"
  #include "kgsl_eventlog.h"
  #include "kgsl_pwrctrl.h"
  #include "kgsl_timeline.h"
L22: #define HFI_QUEUE_MAX (HFI_QUEUE_DEFAULT_CNT)
  #include "kgsl_util.h"
  
  
  #define DEFINE_QHDR(gmuaddr, id, prio) \
L24: #define DEFINE_QHDR(gmuaddr, id, prio) \
  #define HFI_QUEUE_MAX (HFI_QUEUE_DEFAULT_CNT)
  
  {\
  .status = 1, \
L27: .start_addr = GMU_QUEUE_START_ADDR(gmuaddr, id), \
  {\
  .status = 1, \
  .type = QUEUE_HDR_TYPE(id, prio, 0, 0), \
  .queue_size = SZ_4K >> 2, \
L40: /* The GMU buffer address corresponds to the beginning of
  }
  
  * half the size of the shared buffer.
  */
L43: #define GMU_BUF_ADDR(md) ((md.gmuaddr) + (md.size >> 1))
  * half the size of the shared buffer.
  */
  
  struct pending_cmd gen8_hw_fence_ack;
L47: struct gen8_hwsched_hfi *to_gen8_hwsched_hfi(
  struct pending_cmd gen8_hw_fence_ack;
  
  struct adreno_device *adreno_dev)
  {
L55: return &gen8_hwsched->hwsched_hfi;
  struct gen8_hwsched_device, gen8_dev);
  
  }
  
L58: int gen8_hfi_send_lpac_feature_ctrl(struct adreno_device *adreno_dev)
  }
  
  {
  if (!adreno_dev->lpac_enabled)
L63: return gen8_hfi_send_feature_ctrl(adreno_dev, HFI_FEATURE_LPAC, 1, 0);
  return 0;
  
  }
  
L66: static void add_waiter(struct gen8_hwsched_hfi *hfi, u32 hdr,
  }
  
  struct pending_cmd *ack)
  {
L72: write_lock_irq(&hfi->msglock);
  
  init_completion(&ack->complete);
  list_add_tail(&ack->node, &hfi->msglist);
  write_unlock_irq(&hfi->msglock);
L73: list_add_tail(&ack->node, &hfi->msglist);
  init_completion(&ack->complete);
  write_lock_irq(&hfi->msglock);
  write_unlock_irq(&hfi->msglock);
  
L74: write_unlock_irq(&hfi->msglock);
  write_lock_irq(&hfi->msglock);
  list_add_tail(&ack->node, &hfi->msglist);
  
  ack->sent_hdr = hdr;
L79: static void del_waiter(struct gen8_hwsched_hfi *hfi, struct pending_cmd *ack)
  }
  
  {
  write_lock_irq(&hfi->msglock);
L81: write_lock_irq(&hfi->msglock);
  static void del_waiter(struct gen8_hwsched_hfi *hfi, struct pending_cmd *ack)
  {
  list_del(&ack->node);
  write_unlock_irq(&hfi->msglock);
L83: write_unlock_irq(&hfi->msglock);
  write_lock_irq(&hfi->msglock);
  list_del(&ack->node);
  }
  
L88: struct device *gmu_pdev_dev = GMU_PDEV_DEV(KGSL_DEVICE(adreno_dev));
  static void gen8_receive_ack_async(struct adreno_device *adreno_dev, void *rcvd)
  {
  struct gen8_hwsched_hfi *hfi = to_gen8_hwsched_hfi(adreno_dev);
  struct pending_cmd *cmd = NULL;
L89: struct gen8_hwsched_hfi *hfi = to_gen8_hwsched_hfi(adreno_dev);
  {
  struct device *gmu_pdev_dev = GMU_PDEV_DEV(KGSL_DEVICE(adreno_dev));
  struct pending_cmd *cmd = NULL;
  u32 waiters[64], num_waiters = 0, i;
L98: dev_err_ratelimited(gmu_pdev_dev,
  
  if (size_bytes > sizeof(cmd->results))
  "Ack result too big: %d Truncating to: %ld\n",
  size_bytes, sizeof(cmd->results));
L102: read_lock(&hfi->msglock);
  size_bytes, sizeof(cmd->results));
  
  
  list_for_each_entry(cmd, &hfi->msglist, node) {
L104: list_for_each_entry(cmd, &hfi->msglist, node) {
  read_lock(&hfi->msglock);
  
  if (CMP_HFI_ACK_HDR(cmd->sent_hdr, req_hdr)) {
  memcpy(cmd->results, ack,
L105: if (CMP_HFI_ACK_HDR(cmd->sent_hdr, req_hdr)) {
  
  list_for_each_entry(cmd, &hfi->msglist, node) {
  memcpy(cmd->results, ack,
  min_t(u32, size_bytes,
L110: read_unlock(&hfi->msglock);
  sizeof(cmd->results)));
  complete(&cmd->complete);
  return;
  }
L118: read_unlock(&hfi->msglock);
  }
  
  
  /* Didn't find the sender, list the waiter */
L121: dev_err_ratelimited(gmu_pdev_dev,
  
  /* Didn't find the sender, list the waiter */
  "Unexpectedly got id %d seqnum %d. Total waiters: %d Top %d Waiters:\n",
  MSG_HDR_GET_ID(req_hdr), MSG_HDR_GET_SEQNUM(req_hdr),
L127: dev_err_ratelimited(gmu_pdev_dev,
  
  for (i = 0; i < num_waiters && i < 5; i++)
  " id %d seqnum %d\n",
  MSG_HDR_GET_ID(waiters[i]),
L138: 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,

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_hwsched_hfi.h =====
L7: #ifndef _ADRENO_GEN8_HWSCHED_HFI_H_
  */
  
  #define _ADRENO_GEN8_HWSCHED_HFI_H_
  
L8: #define _ADRENO_GEN8_HWSCHED_HFI_H_
  
  #ifndef _ADRENO_GEN8_HWSCHED_HFI_H_
  
  /* Maximum number of IBs in a submission */
L12: ((HFI_MAX_MSG_SIZE - offsetof(struct hfi_issue_cmd_cmd, ibs)) \
  /* Maximum number of IBs in a submission */
  #define HWSCHED_MAX_NUMIBS \
  / sizeof(struct hfi_issue_ib))
  
L13: / sizeof(struct hfi_issue_ib))
  #define HWSCHED_MAX_NUMIBS \
  ((HFI_MAX_MSG_SIZE - offsetof(struct hfi_issue_cmd_cmd, ibs)) \
  
  /*
L19: * 2. If there is a GMU/GPU fault. Because we don't want the threads to keep sleeping through fault
  * threshold. This bit is cleared in two scenarios:
  * 1. If the hardware fence unack count drops to a desired threshold.
  *    recovery, which can easily take 100s of milliseconds to complete.
  */
L29: * GEN8_HWSCHED_HW_FENCE_MAX_BIT will be set. Say, a GMU/GPU fault happens and
  * will be cleared, but we still want to avoid creating any more hardware fences. For example, if
  * hardware fence unack count reaches a maximum threshold, both GEN8_HWSCHED_HW_FENCE_SLEEP_BIT and
  * GEN8_HWSCHED_HW_FENCE_SLEEP_BIT will be cleared to wake up any sleeping threads. But,
  * GEN8_HWSCHED_HW_FENCE_MAX_BIT will remain set to avoid creating any new hardware fences until
L43: struct hfi_tsens_cfg {
  
  #define MAX_THROTTLE_LVLS 3
  /** @limit_u: deci-C value for upper trigger point */
  u32 limit_u;
L54: struct hfi_tsens_throttle_param {
  } __packed;
  
  /** @throttle_hyst: Microsecond wait between each throttle level */
  u32 throttle_hyst;
L63: struct hfi_therm_profile_ctrl {
  } __packed;
  
  /** @feature_en: Feature enable status */
  u16 feature_en;
L79: struct hfi_tsens_cfg tsens_cfg;
  u32 tsens_cfg_cnt;
  /** @tsens_cfg: Struct of tsens configurations */
  /** @throttle_cfg: Struct of throttle configurations */
  struct hfi_tsens_throttle_param throttle_cfg;
L81: struct hfi_tsens_throttle_param throttle_cfg;
  struct hfi_tsens_cfg tsens_cfg;
  /** @throttle_cfg: Struct of throttle configurations */
  } __packed;
  
L85: struct hfi_thermaltable_cmd {
  
  /* H2F */
  /** @hdr: HFI header message */
  u32 hdr;
L86: /** @hdr: HFI header message */
  /* H2F */
  struct hfi_thermaltable_cmd {
  u32 hdr;
  /** @version: Version identifier for the format used for domains */
L91: struct hfi_therm_profile_ctrl ctrl;
  u32 version;
  /** @ctrl: Thermal profile control information */
  } __packed;
  
L94: struct gen8_hwsched_hfi {
  } __packed;
  
  /** @irq_mask: Store the hfi interrupt mask */
  u32 irq_mask;
L95: /** @irq_mask: Store the hfi interrupt mask */
  
  struct gen8_hwsched_hfi {
  u32 irq_mask;
  /** @msglock: To protect the list of un-ACKed hfi packets */
L97: /** @msglock: To protect the list of un-ACKed hfi packets */
  /** @irq_mask: Store the hfi interrupt mask */
  u32 irq_mask;
  rwlock_t msglock;
  /** @msglist: List of un-ACKed hfi packets */
L99: /** @msglist: List of un-ACKed hfi packets */
  /** @msglock: To protect the list of un-ACKed hfi packets */
  rwlock_t msglock;
  struct list_head msglist;
  /** @f2h_task: Task for processing gmu fw to host packets */
L101: /** @f2h_task: Task for processing gmu fw to host packets */
  /** @msglist: List of un-ACKed hfi packets */
  struct list_head msglist;
  struct task_struct *f2h_task;
  /** @f2h_wq: Waitqueue for the f2h_task */
L105: /** @big_ib: GMU buffer to hold big IBs */
  /** @f2h_wq: Waitqueue for the f2h_task */
  wait_queue_head_t f2h_wq;
  struct kgsl_memdesc *big_ib;
  /** @big_ib_recurring: GMU buffer to hold big recurring IBs */
L107: /** @big_ib_recurring: GMU buffer to hold big recurring IBs */
  /** @big_ib: GMU buffer to hold big IBs */
  struct kgsl_memdesc *big_ib;
  struct kgsl_memdesc *big_ib_recurring;
  /** @msg_mutex: Mutex for accessing the msgq */
L122: /** @defer_hw_fence_work: The work structure to send deferred hardware fences to GMU */
  /** @detached_hw_fences_list: List of hardware fences belonging to detached contexts */
  struct list_head detached_hw_fence_list;
  struct kthread_work defer_hw_fence_work;
  };
L129: * gen8_hwsched_hfi_probe - Probe hwsched hfi resources
  
  /**
  * @adreno_dev: Pointer to adreno device structure
  *
L134: int gen8_hwsched_hfi_probe(struct adreno_device *adreno_dev);
  * Return: 0 on success and negative error on failure.
  */
  
  /**
L137: * gen8_hwsched_hfi_remove - Release hwsched hfi resources
  
  /**
  * @adreno_dev: Pointer to adreno device structure
  */
L140: void gen8_hwsched_hfi_remove(struct adreno_device *adreno_dev);
  * @adreno_dev: Pointer to adreno device structure
  */
  
  /**
L143: * gen8_hwsched_hfi_init - Initialize hfi resources
  
  /**
  * @adreno_dev: Pointer to adreno device structure
  *
L146: * This function is used to initialize hfi resources
  * @adreno_dev: Pointer to adreno device structure
  *
  * once before the very first gmu boot
  *
L147: * once before the very first gmu boot
  *
  * This function is used to initialize hfi resources
  *
  * Return: 0 on success and negative error on failure.
L151: int gen8_hwsched_hfi_init(struct adreno_device *adreno_dev);
  * Return: 0 on success and negative error on failure.
  */
  
  /**

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_perfcounter.c =====
L31: * Use a busy loop as this is called with interrupts and preemption disabled.
  /*
  * Poll RBBM_PERFCTR_FLUSH_HOST_STATUS to wait for perfcounter flush completion.
  */
  for (i = 0; i < 10; i++) {
L206: static void gen8_write_gmu_counter_enable(struct kgsl_device *device,
  }
  
  struct adreno_perfcount_register *reg, u32 bit, u32 countable)
  {
L212: static int gen8_counter_gmu_pwr_enable(struct adreno_device *adreno_dev,
  }
  
  const struct adreno_perfcount_group *group,
  u32 counter, u32 countable)
L224: gen8_write_gmu_counter_enable(device, reg, offset << 3, countable);
  return -EINVAL;
  
  
  kgsl_regwrite(device, GEN8_GMUCX_POWER_COUNTER_ENABLE, 1);
L226: kgsl_regwrite(device, GEN8_GMUCX_POWER_COUNTER_ENABLE, 1);
  gen8_write_gmu_counter_enable(device, reg, offset << 3, countable);
  
  
  reg->value = 0;
L232: static int gen8_counter_gmu_perf_enable(struct adreno_device *adreno_dev,
  }
  
  const struct adreno_perfcount_group *group,
  u32 counter, u32 countable)
L244: gen8_write_gmu_counter_enable(device, reg, offset << 3, countable);
  return -EINVAL;
  
  
  kgsl_regwrite(device, GEN8_GMUCX_PERF_COUNTER_ENABLE, 1);
L246: kgsl_regwrite(device, GEN8_GMUCX_PERF_COUNTER_ENABLE, 1);
  gen8_write_gmu_counter_enable(device, reg, offset << 3, countable);
  
  
  reg->value = 0;
L860: #define GMU_COUNTER(lo, hi, sel) \
  };
  
  { .countable = KGSL_PERFCOUNTER_NOT_USED, \
  .offset = lo, .offset_hi = hi, .select = sel }
L864: #define GMU_COUNTER_RESERVED(lo, hi, sel) \
  .offset = lo, .offset_hi = hi, .select = sel }
  
  { .countable = KGSL_PERFCOUNTER_BROKEN, \
  .offset = lo, .offset_hi = hi, .select = sel }
L868: static struct adreno_perfcount_register gen8_perfcounters_gmu_xoclk[] = {
  .offset = lo, .offset_hi = hi, .select = sel }
  
  /*
  * COUNTER_XOCLK_0 and COUNTER_XOCLK_4 are used for the GPU
L874: GMU_COUNTER_RESERVED(GEN8_GMUCX_POWER_COUNTER_XOCLK_L_0,
  * are not re-used.
  */
  GEN8_GMUCX_POWER_COUNTER_XOCLK_H_0,
  GEN8_GMUCX_POWER_COUNTER_SELECT_XOCLK_0),
L875: GEN8_GMUCX_POWER_COUNTER_XOCLK_H_0,
  */
  GMU_COUNTER_RESERVED(GEN8_GMUCX_POWER_COUNTER_XOCLK_L_0,
  GEN8_GMUCX_POWER_COUNTER_SELECT_XOCLK_0),
  GMU_COUNTER(GEN8_GMUCX_POWER_COUNTER_XOCLK_L_1,
L876: GEN8_GMUCX_POWER_COUNTER_SELECT_XOCLK_0),
  GMU_COUNTER_RESERVED(GEN8_GMUCX_POWER_COUNTER_XOCLK_L_0,
  GEN8_GMUCX_POWER_COUNTER_XOCLK_H_0,
  GMU_COUNTER(GEN8_GMUCX_POWER_COUNTER_XOCLK_L_1,
  GEN8_GMUCX_POWER_COUNTER_XOCLK_H_1,
L877: GMU_COUNTER(GEN8_GMUCX_POWER_COUNTER_XOCLK_L_1,
  GEN8_GMUCX_POWER_COUNTER_XOCLK_H_0,
  GEN8_GMUCX_POWER_COUNTER_SELECT_XOCLK_0),
  GEN8_GMUCX_POWER_COUNTER_XOCLK_H_1,
  GEN8_GMUCX_POWER_COUNTER_SELECT_XOCLK_0),
L878: GEN8_GMUCX_POWER_COUNTER_XOCLK_H_1,
  GEN8_GMUCX_POWER_COUNTER_SELECT_XOCLK_0),
  GMU_COUNTER(GEN8_GMUCX_POWER_COUNTER_XOCLK_L_1,
  GEN8_GMUCX_POWER_COUNTER_SELECT_XOCLK_0),
  GMU_COUNTER(GEN8_GMUCX_POWER_COUNTER_XOCLK_L_2,
L879: GEN8_GMUCX_POWER_COUNTER_SELECT_XOCLK_0),
  GMU_COUNTER(GEN8_GMUCX_POWER_COUNTER_XOCLK_L_1,
  GEN8_GMUCX_POWER_COUNTER_XOCLK_H_1,
  GMU_COUNTER(GEN8_GMUCX_POWER_COUNTER_XOCLK_L_2,
  GEN8_GMUCX_POWER_COUNTER_XOCLK_H_2,
L880: GMU_COUNTER(GEN8_GMUCX_POWER_COUNTER_XOCLK_L_2,
  GEN8_GMUCX_POWER_COUNTER_XOCLK_H_1,
  GEN8_GMUCX_POWER_COUNTER_SELECT_XOCLK_0),
  GEN8_GMUCX_POWER_COUNTER_XOCLK_H_2,
  GEN8_GMUCX_POWER_COUNTER_SELECT_XOCLK_0),
L881: GEN8_GMUCX_POWER_COUNTER_XOCLK_H_2,
  GEN8_GMUCX_POWER_COUNTER_SELECT_XOCLK_0),
  GMU_COUNTER(GEN8_GMUCX_POWER_COUNTER_XOCLK_L_2,
  GEN8_GMUCX_POWER_COUNTER_SELECT_XOCLK_0),
  GMU_COUNTER(GEN8_GMUCX_POWER_COUNTER_XOCLK_L_3,
L882: GEN8_GMUCX_POWER_COUNTER_SELECT_XOCLK_0),
  GMU_COUNTER(GEN8_GMUCX_POWER_COUNTER_XOCLK_L_2,
  GEN8_GMUCX_POWER_COUNTER_XOCLK_H_2,
  GMU_COUNTER(GEN8_GMUCX_POWER_COUNTER_XOCLK_L_3,
  GEN8_GMUCX_POWER_COUNTER_XOCLK_H_3,
L883: GMU_COUNTER(GEN8_GMUCX_POWER_COUNTER_XOCLK_L_3,
  GEN8_GMUCX_POWER_COUNTER_XOCLK_H_2,
  GEN8_GMUCX_POWER_COUNTER_SELECT_XOCLK_0),
  GEN8_GMUCX_POWER_COUNTER_XOCLK_H_3,
  GEN8_GMUCX_POWER_COUNTER_SELECT_XOCLK_0),
L884: GEN8_GMUCX_POWER_COUNTER_XOCLK_H_3,
  GEN8_GMUCX_POWER_COUNTER_SELECT_XOCLK_0),
  GMU_COUNTER(GEN8_GMUCX_POWER_COUNTER_XOCLK_L_3,
  GEN8_GMUCX_POWER_COUNTER_SELECT_XOCLK_0),
  GMU_COUNTER_RESERVED(GEN8_GMUCX_POWER_COUNTER_XOCLK_L_4,
L885: GEN8_GMUCX_POWER_COUNTER_SELECT_XOCLK_0),
  GMU_COUNTER(GEN8_GMUCX_POWER_COUNTER_XOCLK_L_3,
  GEN8_GMUCX_POWER_COUNTER_XOCLK_H_3,
  GMU_COUNTER_RESERVED(GEN8_GMUCX_POWER_COUNTER_XOCLK_L_4,
  GEN8_GMUCX_POWER_COUNTER_XOCLK_H_4,
L886: GMU_COUNTER_RESERVED(GEN8_GMUCX_POWER_COUNTER_XOCLK_L_4,
  GEN8_GMUCX_POWER_COUNTER_XOCLK_H_3,
  GEN8_GMUCX_POWER_COUNTER_SELECT_XOCLK_0),
  GEN8_GMUCX_POWER_COUNTER_XOCLK_H_4,
  GEN8_GMUCX_POWER_COUNTER_SELECT_XOCLK_1),
L887: GEN8_GMUCX_POWER_COUNTER_XOCLK_H_4,
  GEN8_GMUCX_POWER_COUNTER_SELECT_XOCLK_0),
  GMU_COUNTER_RESERVED(GEN8_GMUCX_POWER_COUNTER_XOCLK_L_4,
  GEN8_GMUCX_POWER_COUNTER_SELECT_XOCLK_1),
  GMU_COUNTER(GEN8_GMUCX_POWER_COUNTER_XOCLK_L_5,
L888: GEN8_GMUCX_POWER_COUNTER_SELECT_XOCLK_1),
  GMU_COUNTER_RESERVED(GEN8_GMUCX_POWER_COUNTER_XOCLK_L_4,
  GEN8_GMUCX_POWER_COUNTER_XOCLK_H_4,
  GMU_COUNTER(GEN8_GMUCX_POWER_COUNTER_XOCLK_L_5,
  GEN8_GMUCX_POWER_COUNTER_XOCLK_H_5,
L889: GMU_COUNTER(GEN8_GMUCX_POWER_COUNTER_XOCLK_L_5,
  GEN8_GMUCX_POWER_COUNTER_XOCLK_H_4,
  GEN8_GMUCX_POWER_COUNTER_SELECT_XOCLK_1),
  GEN8_GMUCX_POWER_COUNTER_XOCLK_H_5,
  GEN8_GMUCX_POWER_COUNTER_SELECT_XOCLK_1),
L890: GEN8_GMUCX_POWER_COUNTER_XOCLK_H_5,
  GEN8_GMUCX_POWER_COUNTER_SELECT_XOCLK_1),
  GMU_COUNTER(GEN8_GMUCX_POWER_COUNTER_XOCLK_L_5,
  GEN8_GMUCX_POWER_COUNTER_SELECT_XOCLK_1),
  GMU_COUNTER(GEN8_GMUCX_POWER_COUNTER_XOCLK_L_6,
L891: GEN8_GMUCX_POWER_COUNTER_SELECT_XOCLK_1),
  GMU_COUNTER(GEN8_GMUCX_POWER_COUNTER_XOCLK_L_5,
  GEN8_GMUCX_POWER_COUNTER_XOCLK_H_5,
  GMU_COUNTER(GEN8_GMUCX_POWER_COUNTER_XOCLK_L_6,
  GEN8_GMUCX_POWER_COUNTER_XOCLK_H_6,
L892: GMU_COUNTER(GEN8_GMUCX_POWER_COUNTER_XOCLK_L_6,
  GEN8_GMUCX_POWER_COUNTER_XOCLK_H_5,
  GEN8_GMUCX_POWER_COUNTER_SELECT_XOCLK_1),
  GEN8_GMUCX_POWER_COUNTER_XOCLK_H_6,
  GEN8_GMUCX_POWER_COUNTER_SELECT_XOCLK_1),

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_preempt.c =====
L14: offsetof(struct gen8_cp_preemption_record, _field)
  
  #define PREEMPT_RECORD(_field) \
  
  #define PREEMPT_SMMU_RECORD(_field) \
L16: #define PREEMPT_SMMU_RECORD(_field) \
  offsetof(struct gen8_cp_preemption_record, _field)
  
  offsetof(struct gen8_cp_smmu_info, _field)
  
L17: offsetof(struct gen8_cp_smmu_info, _field)
  
  #define PREEMPT_SMMU_RECORD(_field) \
  
  static void _update_wptr(struct adreno_device *adreno_dev, bool reset_timer,
L23: struct adreno_ringbuffer *rb = adreno_dev->cur_rb;
  {
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
  unsigned long flags;
  int ret = 0;
L62: gmu_core_fault_snapshot(device, GMU_FAULT_PANIC_NONE);
  /* If WPTR update fails, set the fault and trigger recovery */
  if (ret) {
  adreno_scheduler_fault(adreno_dev,
  ADRENO_GMU_FAULT_SKIP_SNAPSHOT);
L64: ADRENO_GMU_FAULT_SKIP_SNAPSHOT);
  gmu_core_fault_snapshot(device, GMU_FAULT_PANIC_NONE);
  adreno_scheduler_fault(adreno_dev,
  }
  }
L73: gmu_core_regwrite(device,
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
  
  GEN8_GMUCX_PWR_COL_PREEMPTION_KEEPALIVE, (val ? 1 : 0));
  }
L74: GEN8_GMUCX_PWR_COL_PREEMPTION_KEEPALIVE, (val ? 1 : 0));
  
  gmu_core_regwrite(device,
  }
  
L77: static void _gen8_preemption_done(struct adreno_device *adreno_dev)
  }
  
  {
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
L90: kgsl_regread(device, GEN8_CP_CONTEXT_SWITCH_CNTL, &status);
  return;
  
  
  if (status & 0x1) {
L94: "Preemption not complete: status=%X cur=%d R/W=%X/%X next=%d R/W=%X/%X\n",
  if (status & 0x1) {
  dev_err(device->dev,
  status, adreno_dev->cur_rb->id,
  adreno_get_rptr(adreno_dev->cur_rb),
L112: kgsl_regread(device, GEN8_CP_CONTEXT_SWITCH_LEVEL_STATUS, &status);
  kgsl_delete_timer_sync(&adreno_dev->preempt.timer);
  
  
  trace_adreno_preempt_done(adreno_dev->cur_rb->id, adreno_dev->next_rb->id,
L133: static void _gen8_preemption_fault(struct adreno_device *adreno_dev)
  }
  
  {
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
L139: * If the power is on check the preemption status one more time - if it
  
  /*
  * was successful then just transition to the complete state
  */
L143: kgsl_regread(device, GEN8_CP_CONTEXT_SWITCH_CNTL, &status);
  */
  if (kgsl_state_is_awake(device)) {
  
  if (!(status & 0x1)) {
L155: "Preemption Fault: cur=%d R/W=0x%x/0x%x, next=%d R/W=0x%x/0x%x\n",
  
  dev_err(device->dev,
  adreno_dev->cur_rb->id,
  adreno_get_rptr(adreno_dev->cur_rb),
L166: static void _gen8_preemption_worker(struct work_struct *work)
  }
  
  {
  struct adreno_preemption *preempt = container_of(work,
L168: struct adreno_preemption *preempt = container_of(work,
  static void _gen8_preemption_worker(struct work_struct *work)
  {
  struct adreno_preemption, work);
  struct adreno_device *adreno_dev = container_of(preempt,
L169: struct adreno_preemption, work);
  {
  struct adreno_preemption *preempt = container_of(work,
  struct adreno_device *adreno_dev = container_of(preempt,
  struct adreno_device, preempt);
L178: _gen8_preemption_fault(adreno_dev);
  
  if (adreno_in_preempt_state(adreno_dev, ADRENO_PREEMPT_FAULTED))
  
  kgsl_mutex_unlock(&device->mutex);
L183: /* Find the highest priority active ringbuffer */
  }
  
  static struct adreno_ringbuffer *gen8_next_ringbuffer(
  struct adreno_device *adreno_dev)
L184: static struct adreno_ringbuffer *gen8_next_ringbuffer(
  
  /* Find the highest priority active ringbuffer */
  struct adreno_device *adreno_dev)
  {
L187: struct adreno_ringbuffer *rb;
  struct adreno_device *adreno_dev)
  {
  unsigned long flags;
  u32 i;
L191: FOR_EACH_RINGBUFFER(adreno_dev, rb, i) {
  u32 i;
  
  bool empty;
  
L205: void gen8_preemption_trigger(struct adreno_device *adreno_dev, bool atomic)
  }
  
  {
  const struct adreno_gen8_core *gen8_core = to_gen8_core(adreno_dev);
L209: struct kgsl_iommu *iommu = KGSL_IOMMU(device);
  const struct adreno_gen8_core *gen8_core = to_gen8_core(adreno_dev);
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
  struct adreno_ringbuffer *next;
  u64 ttbr0, gpuaddr;
L210: struct adreno_ringbuffer *next;
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
  struct kgsl_iommu *iommu = KGSL_IOMMU(device);
  u64 ttbr0, gpuaddr;
  u32 contextidr, cntl;
L214: struct adreno_preemption *preempt = &adreno_dev->preempt;
  u32 contextidr, cntl;
  unsigned long flags;
  
  /* Put ourselves into a possible trigger state */
L221: /* Get the next ringbuffer to preempt in */
  return;
  
  next = gen8_next_ringbuffer(adreno_dev);
  
L222: next = gen8_next_ringbuffer(adreno_dev);
  
  /* Get the next ringbuffer to preempt in */
  
  /*

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_ringbuffer.c =====
L10: #include "adreno_ringbuffer.h"
  #include "adreno_gen8.h"
  #include "adreno_pm4types.h"
  #include "adreno_trace.h"
  #include "kgsl_trace.h"
L23: struct adreno_ringbuffer *rb, struct adreno_context *drawctxt,
  
  static int gen8_rb_pagetable_switch(struct adreno_device *adreno_dev,
  struct kgsl_pagetable *pagetable, u32 *cmds)
  {
L35: cmds[count++] = cp_type7_packet(CP_SMMU_TABLE_UPDATE, 3);
  
  /* CP switches the pagetable and flushes the Caches */
  cmds[count++] = lower_32_bits(ttbr0);
  cmds[count++] = upper_32_bits(ttbr0);
L60: static int gen8_rb_context_switch(struct adreno_device *adreno_dev,
  }
  
  struct adreno_ringbuffer *rb,
  struct adreno_context *drawctxt)
L61: struct adreno_ringbuffer *rb,
  
  static int gen8_rb_context_switch(struct adreno_device *adreno_dev,
  struct adreno_context *drawctxt)
  {
L91: cmds[count++] = cp_type7_packet(CP_EVENT_WRITE, 1);
  cmds[count++] = CP_SET_THREAD_BOTH;
  
  /* Add event ID for LRZ flush as packet payload */
  cmds[count++] = LRZ_CACHE_FLUSH;
L120: struct kgsl_iommu *iommu = KGSL_IOMMU(device);
  }
  } else {
  
  u32 offset = GEN8_SMMU_BASE + (iommu->cb0_offset >> 2) + 0x0d;
L122: u32 offset = GEN8_SMMU_BASE + (iommu->cb0_offset >> 2) + 0x0d;
  struct kgsl_iommu *iommu = KGSL_IOMMU(device);
  
  
  /*
L137: cmds[count++] = lower_32_bits(MEMSTORE_RB_GPU_ADDR(device, rb,
  
  cmds[count++] = cp_type7_packet(CP_MEM_WRITE, 3);
  current_context));
  cmds[count++] = upper_32_bits(MEMSTORE_RB_GPU_ADDR(device, rb,
L139: cmds[count++] = upper_32_bits(MEMSTORE_RB_GPU_ADDR(device, rb,
  cmds[count++] = lower_32_bits(MEMSTORE_RB_GPU_ADDR(device, rb,
  current_context));
  current_context));
  cmds[count++] = drawctxt->base.id;
L144: cmds[count++] = lower_32_bits(MEMSTORE_ID_GPU_ADDR(device,
  
  cmds[count++] = cp_type7_packet(CP_MEM_WRITE, 3);
  KGSL_MEMSTORE_GLOBAL, current_context));
  cmds[count++] = upper_32_bits(MEMSTORE_ID_GPU_ADDR(device,
L145: KGSL_MEMSTORE_GLOBAL, current_context));
  cmds[count++] = cp_type7_packet(CP_MEM_WRITE, 3);
  cmds[count++] = lower_32_bits(MEMSTORE_ID_GPU_ADDR(device,
  cmds[count++] = upper_32_bits(MEMSTORE_ID_GPU_ADDR(device,
  KGSL_MEMSTORE_GLOBAL, current_context));
L146: cmds[count++] = upper_32_bits(MEMSTORE_ID_GPU_ADDR(device,
  cmds[count++] = lower_32_bits(MEMSTORE_ID_GPU_ADDR(device,
  KGSL_MEMSTORE_GLOBAL, current_context));
  KGSL_MEMSTORE_GLOBAL, current_context));
  cmds[count++] = drawctxt->base.id;
L147: KGSL_MEMSTORE_GLOBAL, current_context));
  KGSL_MEMSTORE_GLOBAL, current_context));
  cmds[count++] = upper_32_bits(MEMSTORE_ID_GPU_ADDR(device,
  cmds[count++] = drawctxt->base.id;
  
L150: cmds[count++] = cp_type7_packet(CP_EVENT_WRITE, 1);
  cmds[count++] = drawctxt->base.id;
  
  cmds[count++] = 0x31;
  
L153: if (adreno_is_preemption_enabled(adreno_dev) && drawctxt->base.user_ctxt_record) {
  cmds[count++] = 0x31;
  
  u64 gpuaddr = drawctxt->base.user_ctxt_record->memdesc.gpuaddr;
  
L162: return gen8_ringbuffer_addcmds(adreno_dev, rb, NULL, F_NOTPROTECTED,
  }
  
  cmds, count, 0, NULL);
  }
L166: #define RB_SOPTIMESTAMP(device, rb) \
  }
  
  MEMSTORE_RB_GPU_ADDR(device, rb, soptimestamp)
  #define CTXT_SOPTIMESTAMP(device, drawctxt) \
L167: MEMSTORE_RB_GPU_ADDR(device, rb, soptimestamp)
  
  #define RB_SOPTIMESTAMP(device, rb) \
  #define CTXT_SOPTIMESTAMP(device, drawctxt) \
  MEMSTORE_ID_GPU_ADDR(device, (drawctxt)->base.id, soptimestamp)
L168: #define CTXT_SOPTIMESTAMP(device, drawctxt) \
  #define RB_SOPTIMESTAMP(device, rb) \
  MEMSTORE_RB_GPU_ADDR(device, rb, soptimestamp)
  MEMSTORE_ID_GPU_ADDR(device, (drawctxt)->base.id, soptimestamp)
  
L169: MEMSTORE_ID_GPU_ADDR(device, (drawctxt)->base.id, soptimestamp)
  MEMSTORE_RB_GPU_ADDR(device, rb, soptimestamp)
  #define CTXT_SOPTIMESTAMP(device, drawctxt) \
  
  #define RB_EOPTIMESTAMP(device, rb) \
L171: #define RB_EOPTIMESTAMP(device, rb) \
  MEMSTORE_ID_GPU_ADDR(device, (drawctxt)->base.id, soptimestamp)
  
  MEMSTORE_RB_GPU_ADDR(device, rb, eoptimestamp)
  #define CTXT_EOPTIMESTAMP(device, drawctxt) \
L172: MEMSTORE_RB_GPU_ADDR(device, rb, eoptimestamp)
  
  #define RB_EOPTIMESTAMP(device, rb) \
  #define CTXT_EOPTIMESTAMP(device, drawctxt) \
  MEMSTORE_ID_GPU_ADDR(device, (drawctxt)->base.id, eoptimestamp)
L173: #define CTXT_EOPTIMESTAMP(device, drawctxt) \
  #define RB_EOPTIMESTAMP(device, rb) \
  MEMSTORE_RB_GPU_ADDR(device, rb, eoptimestamp)
  MEMSTORE_ID_GPU_ADDR(device, (drawctxt)->base.id, eoptimestamp)
  
L174: MEMSTORE_ID_GPU_ADDR(device, (drawctxt)->base.id, eoptimestamp)
  MEMSTORE_RB_GPU_ADDR(device, rb, eoptimestamp)
  #define CTXT_EOPTIMESTAMP(device, drawctxt) \
  
  int gen8_ringbuffer_submit(struct adreno_ringbuffer *rb,
L176: int gen8_ringbuffer_submit(struct adreno_ringbuffer *rb,
  MEMSTORE_ID_GPU_ADDR(device, (drawctxt)->base.id, eoptimestamp)
  
  struct adreno_submit_time *time)
  {
L208: gmu_core_fault_snapshot(device, GMU_FAULT_PANIC_NONE);
  * recovery.
  */
  adreno_scheduler_fault(adreno_dev,
  ADRENO_GMU_FAULT_SKIP_SNAPSHOT);
L210: ADRENO_GMU_FAULT_SKIP_SNAPSHOT);
  gmu_core_fault_snapshot(device, GMU_FAULT_PANIC_NONE);
  adreno_scheduler_fault(adreno_dev,
  }
  
L216: int gen8_ringbuffer_init(struct adreno_device *adreno_dev)
  }
  
  {
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
L227: adreno_dev->cur_rb = &(adreno_dev->ringbuffers[0]);
  return ret;
  
  
  if (!adreno_preemption_feature_set(adreno_dev)) {

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_rpmh.c =====
L26: * setup_gmu_arc_votes - Build the gmu voting table
  
  /*
  * @gmu: Pointer to gmu device
  * @pri_rail: Pointer to primary power rail vlvl table
L27: * @gmu: Pointer to gmu device
  /*
  * setup_gmu_arc_votes - Build the gmu voting table
  * @pri_rail: Pointer to primary power rail vlvl table
  * @sec_rail: Pointer to second/dependent power rail vlvl table
L31: * This function initializes the cx votes for all gmu frequencies
  * @sec_rail: Pointer to second/dependent power rail vlvl table
  *
  * for gmu dcvs
  */
L32: * for gmu dcvs
  *
  * This function initializes the cx votes for all gmu frequencies
  */
  static int setup_cx_arc_votes(struct gen8_gmu_device *gmu,
L34: static int setup_cx_arc_votes(struct gen8_gmu_device *gmu,
  * for gmu dcvs
  */
  struct rpmh_arc_vals *pri_rail, struct rpmh_arc_vals *sec_rail)
  {
L37: struct kgsl_device *device = KGSL_DEVICE(gen8_gmu_to_adreno(gmu));
  struct rpmh_arc_vals *pri_rail, struct rpmh_arc_vals *sec_rail)
  {
  /* Hardcoded values of GMU CX voltage levels */
  u16 gmu_cx_vlvl[MAX_CX_LEVELS];
L38: /* Hardcoded values of GMU CX voltage levels */
  {
  struct kgsl_device *device = KGSL_DEVICE(gen8_gmu_to_adreno(gmu));
  u16 gmu_cx_vlvl[MAX_CX_LEVELS];
  u32 cx_votes[MAX_CX_LEVELS];
L39: u16 gmu_cx_vlvl[MAX_CX_LEVELS];
  struct kgsl_device *device = KGSL_DEVICE(gen8_gmu_to_adreno(gmu));
  /* Hardcoded values of GMU CX voltage levels */
  u32 cx_votes[MAX_CX_LEVELS];
  struct gen8_dcvs_table *table = &gmu->dcvs_table;
L41: struct gen8_dcvs_table *table = &gmu->dcvs_table;
  u16 gmu_cx_vlvl[MAX_CX_LEVELS];
  u32 cx_votes[MAX_CX_LEVELS];
  u32 *freqs = device->gmu_core.freqs;
  u32 *vlvls = device->gmu_core.vlvls;
L42: u32 *freqs = device->gmu_core.freqs;
  u32 cx_votes[MAX_CX_LEVELS];
  struct gen8_dcvs_table *table = &gmu->dcvs_table;
  u32 *vlvls = device->gmu_core.vlvls;
  int ret, i;
L43: u32 *vlvls = device->gmu_core.vlvls;
  struct gen8_dcvs_table *table = &gmu->dcvs_table;
  u32 *freqs = device->gmu_core.freqs;
  int ret, i;
  
L46: gmu_cx_vlvl[0] = 0;
  int ret, i;
  
  for (i = 0; i < device->gmu_core.num_freqs; i++)
  gmu_cx_vlvl[i + 1] = vlvls[i];
L47: for (i = 0; i < device->gmu_core.num_freqs; i++)
  
  gmu_cx_vlvl[0] = 0;
  gmu_cx_vlvl[i + 1] = vlvls[i];
  
L48: gmu_cx_vlvl[i + 1] = vlvls[i];
  gmu_cx_vlvl[0] = 0;
  for (i = 0; i < device->gmu_core.num_freqs; i++)
  
  table->gmu_level_num = device->gmu_core.num_freqs + 1;
L50: table->gmu_level_num = device->gmu_core.num_freqs + 1;
  gmu_cx_vlvl[i + 1] = vlvls[i];
  
  
  table->cx_votes[0].freq = 0;
L53: for (i = 0; i < device->gmu_core.num_freqs; i++)
  
  table->cx_votes[0].freq = 0;
  table->cx_votes[i + 1].freq = freqs[i] / 1000;
  
L57: sec_rail, gmu_cx_vlvl, table->gmu_level_num);
  
  ret = adreno_rpmh_setup_volt_dependency_tbl(cx_votes, pri_rail,
  if (!ret) {
  for (i = 0; i < table->gmu_level_num; i++)
L59: for (i = 0; i < table->gmu_level_num; i++)
  sec_rail, gmu_cx_vlvl, table->gmu_level_num);
  if (!ret) {
  table->cx_votes[i].vote = cx_votes[i];
  }
L179: * @hfi: Pointer to hfi device
  /*
  * setup_gx_arc_votes - Build the gpu dcvs voting table
  * @pri_rail: Pointer to primary power rail vlvl table
  * @sec_rail: Pointer to second/dependent power rail vlvl table
L194: struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev);
  {
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
  struct kgsl_pwrctrl *pwr = &device->pwrctrl;
  struct gen8_dcvs_table *table = &gmu->dcvs_table;
L196: struct gen8_dcvs_table *table = &gmu->dcvs_table;
  struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev);
  struct kgsl_pwrctrl *pwr = &device->pwrctrl;
  const struct adreno_gen8_core *gen8_core = to_gen8_core(adreno_dev);
  u16 vlvl_tbl[MAX_GX_LEVELS];
L216: /* Fill the vlvl tables. GMU power levels are in ascending order */
  memset(cx_vlvl_tbl, 0, sizeof(cx_vlvl_tbl));
  
  for (i = 1; i < table->gpu_level_num; i++) {
  vlvl_tbl[i] = pwr->pwrlevels[pwr->num_pwrlevels - i].voltage_level;
L261: struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev);
  static int build_dcvs_table(struct adreno_device *adreno_dev)
  {
  struct rpmh_arc_vals gx_arc, cx_arc, mx_arc, gmxc_arc, gbx_arc;
  const struct adreno_gen8_core *gen8_core = to_gen8_core(adreno_dev);
L284: ret = setup_cx_arc_votes(gmu, &cx_arc, &mx_arc);
  }
  
  if (ret)
  return ret;
L306: /* BIT(2) is used to vote for GPU performance mode through GMU */
  }
  
  #define ACV_GPU_PERFMODE_VOTE	BIT(2)
  
L317: struct gen8_gmu_device *gmu = to_gen8_gmu(adreno_dev);
  static int build_bw_table(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);
L331: adreno_dev->gmu_ab);
  ddr = adreno_rpmh_build_bw_votes(gen8_11_0_ddr_bcms, ARRAY_SIZE(gen8_11_0_ddr_bcms),
  pwr->ddr_table, pwr->ddr_table_count, ACV_GPU_PERFMODE_VOTE, perfmode_lvl,
  else
  ddr = adreno_rpmh_build_bw_votes(adreno_ddr_bcms, ARRAY_SIZE(adreno_ddr_bcms),
L335: adreno_dev->gmu_ab);
  ddr = adreno_rpmh_build_bw_votes(adreno_ddr_bcms, ARRAY_SIZE(adreno_ddr_bcms),
  pwr->ddr_table, pwr->ddr_table_count, ACV_GPU_PERFMODE_VOTE, perfmode_lvl,
  
  if (IS_ERR(ddr))
L351: adreno_dev->gmu_ab);
  cnoc = adreno_rpmh_build_bw_votes(adreno_cnoc_bcms,
  ARRAY_SIZE(adreno_cnoc_bcms), cnoc_table, count, 0, 0,
  
  if (cnoc_table != default_cnoc_table)
L361: ret = CMD_MSG_HDR(gmu->hfi.bw_table, H2F_MSG_BW_VOTE_TBL);
  }
  
  if (ret)
  return ret;

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_snapshot.c =====
L38: .gmu_cx_unsliced_regs = gen8_0_0_gmu_registers,
  .external_core_regs = gen8_0_0_external_core_regs,
  .num_external_core_regs = ARRAY_SIZE(gen8_0_0_external_core_regs),
  .gmu_gx_regs = gen8_gmu_gx_registers,
  .num_gmu_gx_regs = ARRAY_SIZE(gen8_gmu_gx_registers),
L39: .gmu_gx_regs = gen8_gmu_gx_registers,
  .num_external_core_regs = ARRAY_SIZE(gen8_0_0_external_core_regs),
  .gmu_cx_unsliced_regs = gen8_0_0_gmu_registers,
  .num_gmu_gx_regs = ARRAY_SIZE(gen8_gmu_gx_registers),
  .rscc_regs = gen8_0_0_rscc_rsc_registers,
L40: .num_gmu_gx_regs = ARRAY_SIZE(gen8_gmu_gx_registers),
  .gmu_cx_unsliced_regs = gen8_0_0_gmu_registers,
  .gmu_gx_regs = gen8_gmu_gx_registers,
  .rscc_regs = gen8_0_0_rscc_rsc_registers,
  .reg_list = gen8_0_0_reg_list,
L70: .gmu_cx_unsliced_regs = gen8_1_0_gmucx_registers,
  .external_core_regs = gen8_1_0_external_core_regs,
  .num_external_core_regs = ARRAY_SIZE(gen8_1_0_external_core_regs),
  .gmu_gx_regs = gen8_1_0_gmu_gx_registers,
  .num_gmu_gx_regs = ARRAY_SIZE(gen8_1_0_gmu_gx_registers),
L71: .gmu_gx_regs = gen8_1_0_gmu_gx_registers,
  .num_external_core_regs = ARRAY_SIZE(gen8_1_0_external_core_regs),
  .gmu_cx_unsliced_regs = gen8_1_0_gmucx_registers,
  .num_gmu_gx_regs = ARRAY_SIZE(gen8_1_0_gmu_gx_registers),
  .rscc_regs = gen8_2_0_rscc_rsc_registers,
L72: .num_gmu_gx_regs = ARRAY_SIZE(gen8_1_0_gmu_gx_registers),
  .gmu_cx_unsliced_regs = gen8_1_0_gmucx_registers,
  .gmu_gx_regs = gen8_1_0_gmu_gx_registers,
  .rscc_regs = gen8_2_0_rscc_rsc_registers,
  .reg_list = gen8_1_0_misc_registers,
L101: .gmu_cx_unsliced_regs = gen8_1_0_gmucx_registers,
  .external_core_regs = gen8_1_0_external_core_regs,
  .num_external_core_regs = ARRAY_SIZE(gen8_1_0_external_core_regs),
  .gmu_gx_regs = gen8_1_0_gmu_gx_registers,
  .num_gmu_gx_regs = ARRAY_SIZE(gen8_1_0_gmu_gx_registers),
L102: .gmu_gx_regs = gen8_1_0_gmu_gx_registers,
  .num_external_core_regs = ARRAY_SIZE(gen8_1_0_external_core_regs),
  .gmu_cx_unsliced_regs = gen8_1_0_gmucx_registers,
  .num_gmu_gx_regs = ARRAY_SIZE(gen8_1_0_gmu_gx_registers),
  .rscc_regs = gen8_2_0_rscc_rsc_registers,
L103: .num_gmu_gx_regs = ARRAY_SIZE(gen8_1_0_gmu_gx_registers),
  .gmu_cx_unsliced_regs = gen8_1_0_gmucx_registers,
  .gmu_gx_regs = gen8_1_0_gmu_gx_registers,
  .rscc_regs = gen8_2_0_rscc_rsc_registers,
  .reg_list = gen8_1_0_misc_registers,
L132: .gmu_cx_unsliced_regs = gen8_2_0_gmucx_registers,
  .external_core_regs = gen8_2_0_external_core_regs,
  .num_external_core_regs = ARRAY_SIZE(gen8_2_0_external_core_regs),
  .gmu_gx_regs = gen8_2_0_gmu_gx_registers,
  .num_gmu_gx_regs = ARRAY_SIZE(gen8_2_0_gmu_gx_registers),
L133: .gmu_gx_regs = gen8_2_0_gmu_gx_registers,
  .num_external_core_regs = ARRAY_SIZE(gen8_2_0_external_core_regs),
  .gmu_cx_unsliced_regs = gen8_2_0_gmucx_registers,
  .num_gmu_gx_regs = ARRAY_SIZE(gen8_2_0_gmu_gx_registers),
  .rscc_regs = gen8_2_0_rscc_rsc_registers,
L134: .num_gmu_gx_regs = ARRAY_SIZE(gen8_2_0_gmu_gx_registers),
  .gmu_cx_unsliced_regs = gen8_2_0_gmucx_registers,
  .gmu_gx_regs = gen8_2_0_gmu_gx_registers,
  .rscc_regs = gen8_2_0_rscc_rsc_registers,
  .reg_list = gen8_2_0_misc_registers,
L163: .gmu_cx_unsliced_regs = gen8_3_0_gmu_registers,
  .external_core_regs = gen8_3_0_external_core_regs,
  .num_external_core_regs = ARRAY_SIZE(gen8_3_0_external_core_regs),
  .gmu_gx_regs = gen8_3_0_gmu_gx_regs,
  .num_gmu_gx_regs = ARRAY_SIZE(gen8_3_0_gmu_gx_regs),
L164: .gmu_gx_regs = gen8_3_0_gmu_gx_regs,
  .num_external_core_regs = ARRAY_SIZE(gen8_3_0_external_core_regs),
  .gmu_cx_unsliced_regs = gen8_3_0_gmu_registers,
  .num_gmu_gx_regs = ARRAY_SIZE(gen8_3_0_gmu_gx_regs),
  .rscc_regs = gen8_3_0_rscc_rsc_registers,
L165: .num_gmu_gx_regs = ARRAY_SIZE(gen8_3_0_gmu_gx_regs),
  .gmu_cx_unsliced_regs = gen8_3_0_gmu_registers,
  .gmu_gx_regs = gen8_3_0_gmu_gx_regs,
  .rscc_regs = gen8_3_0_rscc_rsc_registers,
  .reg_list = gen8_0_0_reg_list,
L194: .gmu_cx_unsliced_regs = gen8_6_0_gmu_registers,
  .external_core_regs = gen8_6_0_external_core_regs,
  .num_external_core_regs = ARRAY_SIZE(gen8_6_0_external_core_regs),
  .gmu_gx_regs = gen8_6_0_gmu_gx_registers,
  .num_gmu_gx_regs = ARRAY_SIZE(gen8_6_0_gmu_gx_registers),
L195: .gmu_gx_regs = gen8_6_0_gmu_gx_registers,
  .num_external_core_regs = ARRAY_SIZE(gen8_6_0_external_core_regs),
  .gmu_cx_unsliced_regs = gen8_6_0_gmu_registers,
  .num_gmu_gx_regs = ARRAY_SIZE(gen8_6_0_gmu_gx_registers),
  .rscc_regs = gen8_0_0_rscc_rsc_registers,
L196: .num_gmu_gx_regs = ARRAY_SIZE(gen8_6_0_gmu_gx_registers),
  .gmu_cx_unsliced_regs = gen8_6_0_gmu_registers,
  .gmu_gx_regs = gen8_6_0_gmu_gx_registers,
  .rscc_regs = gen8_0_0_rscc_rsc_registers,
  .reg_list = gen8_6_0_reg_list,
L225: .gmu_cx_unsliced_regs = gen8_2_0_gmucx_registers,
  .external_core_regs = gen8_9_0_external_core_regs,
  .num_external_core_regs = ARRAY_SIZE(gen8_9_0_external_core_regs),
  .gmu_gx_regs = gen8_2_0_gmu_gx_registers,
  .num_gmu_gx_regs = ARRAY_SIZE(gen8_2_0_gmu_gx_registers),
L226: .gmu_gx_regs = gen8_2_0_gmu_gx_registers,
  .num_external_core_regs = ARRAY_SIZE(gen8_9_0_external_core_regs),
  .gmu_cx_unsliced_regs = gen8_2_0_gmucx_registers,
  .num_gmu_gx_regs = ARRAY_SIZE(gen8_2_0_gmu_gx_registers),
  .rscc_regs = gen8_2_0_rscc_rsc_registers,
L227: .num_gmu_gx_regs = ARRAY_SIZE(gen8_2_0_gmu_gx_registers),
  .gmu_cx_unsliced_regs = gen8_2_0_gmucx_registers,
  .gmu_gx_regs = gen8_2_0_gmu_gx_registers,
  .rscc_regs = gen8_2_0_rscc_rsc_registers,
  .reg_list = gen8_2_0_misc_registers,
L260: .gmu_cx_unsliced_regs = gen8_11_0_gmucx_registers,
  .external_core_regs = gen8_11_0_external_core_regs,
  .num_external_core_regs = ARRAY_SIZE(gen8_11_0_external_core_regs),
  .gmu_gx_regs = gen8_2_0_gmu_gx_registers,
  .num_gmu_gx_regs = ARRAY_SIZE(gen8_2_0_gmu_gx_registers),
L261: .gmu_gx_regs = gen8_2_0_gmu_gx_registers,
  .num_external_core_regs = ARRAY_SIZE(gen8_11_0_external_core_regs),
  .gmu_cx_unsliced_regs = gen8_11_0_gmucx_registers,
  .num_gmu_gx_regs = ARRAY_SIZE(gen8_2_0_gmu_gx_registers),
  .rscc_regs = gen8_2_0_rscc_rsc_registers,
L262: .num_gmu_gx_regs = ARRAY_SIZE(gen8_2_0_gmu_gx_registers),
  .gmu_cx_unsliced_regs = gen8_11_0_gmucx_registers,
  .gmu_gx_regs = gen8_2_0_gmu_gx_registers,
  .rscc_regs = gen8_2_0_rscc_rsc_registers,
  .reg_list = gen8_11_0_misc_registers,
L331: return (adreno_smmu_is_stalled(ADRENO_DEVICE(device)) ||
  static bool CD_SCRIPT_CHECK(struct kgsl_device *device)
  {
  (kgsl_mmu_ctx_terminated_on_fault(&device->mmu)) ||
  (!device->snapshot_crashdumper) ||
L957: *data = gen8_gmu_malu_is_on(ADRENO_DEVICE(device));
  header->type = SNAPSHOT_DEBUG_MALU_STATUS;
  header->size = 1;
  
  return DEBUG_SECTION_SZ(1);
L1989: if (CD_SCRIPT_CHECK(device) || !gen8_gmu_rpmh_pwr_state_is_active(device)
  const u32 *regs_ptr = (const u32 *)gen8_snapshot_block_list->cx_misc_regs;
  
  || !gen8_gmu_gx_is_on(ADRENO_DEVICE(device)))
  goto legacy_snapshot;
L1990: || !gen8_gmu_gx_is_on(ADRENO_DEVICE(device)))
  
  if (CD_SCRIPT_CHECK(device) || !gen8_gmu_rpmh_pwr_state_is_active(device)
  goto legacy_snapshot;
  
L2108: /* External core and CX MISC regs are dumped in the beginning of gmu snapshot */
  gen8_snapshot_block_list = gpucore->gen8_snapshot_block_list;
  
  if (!gmu_core_isenabled(device)) {
  gen8_snapshot_external_core_regs(device, snapshot);
L2109: if (!gmu_core_isenabled(device)) {
  
  /* External core and CX MISC regs are dumped in the beginning of gmu snapshot */
  gen8_snapshot_external_core_regs(device, snapshot);
  

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_gen8_snapshot.h =====
L237: DEBUGBUS_GMU_CX_GC_US_I_0           = 2,
  enum gen8_debugbus_ids {
  DEBUGBUS_GBIF_CX_GC_US_I_0          = 1,
  DEBUGBUS_CX_GC_US_I_0               = 3,
  DEBUGBUS_GBIF_GX_GC_US_I_0          = 8,
L240: DEBUGBUS_GMU_GX_GC_US_I_0           = 9,
  DEBUGBUS_CX_GC_US_I_0               = 3,
  DEBUGBUS_GBIF_GX_GC_US_I_0          = 8,
  DEBUGBUS_DBGC_GC_US_I_0             = 10,
  DEBUGBUS_RBBM_GC_US_I_0             = 11,
L287: DEBUGBUS_GMU_GC_S_0_I_0             = 150,
  DEBUGBUS_CCRE_GC_S_0_I_0            = 148,
  DEBUGBUS_CGC_GC_S_0_I_0             = 149,
  DEBUGBUS_SLICE_GC_S_0_I_0           = 151,
  DEBUGBUS_HLSQ_SPTP_STAR_GC_S_0_I_0  = 152,
L344: DEBUGBUS_GMU_GC_S_1_I_0             = 278,
  DEBUGBUS_CCRE_GC_S_1_I_0            = 276,
  DEBUGBUS_CGC_GC_S_1_I_0             = 277,
  DEBUGBUS_SLICE_GC_S_1_I_0           = 279,
  DEBUGBUS_HLSQ_SPTP_STAR_GC_S_1_I_0  = 280,
L401: DEBUGBUS_GMU_GC_S_2_I_0             = 406,
  DEBUGBUS_CCRE_GC_S_2_I_0            = 404,
  DEBUGBUS_CGC_GC_S_2_I_0             = 405,
  DEBUGBUS_SLICE_GC_S_2_I_0           = 407,
  DEBUGBUS_HLSQ_SPTP_STAR_GC_S_2_I_0  = 408,
L459: DEBUGBUS_GMU_GC_S_3_I_0             = 534,
  DEBUGBUS_CCRE_GC_S_3_I_0            = 532,
  DEBUGBUS_CGC_GC_S_3_I_0             = 533,
  DEBUGBUS_SLICE_GC_S_3_I_0           = 535,
  DEBUGBUS_HLSQ_SPTP_STAR_GC_S_3_I_0  = 536,
L483: DEBUGBUS_GMU_GX_GC_US_I_0,
  
  static const u32 gen8_debugbus_blocks[] = {
  DEBUGBUS_DBGC_GC_US_I_0,
  DEBUGBUS_RBBM_GC_US_I_0,
L528: DEBUGBUS_GMU_GC_S_0_I_0,
  DEBUGBUS_CCRE_GC_S_0_I_0,
  DEBUGBUS_CGC_GC_S_0_I_0,
  DEBUGBUS_SLICE_GC_S_0_I_0,
  DEBUGBUS_HLSQ_SPTP_STAR_GC_S_0_I_0,
L571: DEBUGBUS_GMU_GC_S_1_I_0,
  DEBUGBUS_CCRE_GC_S_1_I_0,
  DEBUGBUS_CGC_GC_S_1_I_0,
  DEBUGBUS_SLICE_GC_S_1_I_0,
  DEBUGBUS_HLSQ_SPTP_STAR_GC_S_1_I_0,
L614: DEBUGBUS_GMU_GC_S_2_I_0,
  DEBUGBUS_CCRE_GC_S_2_I_0,
  DEBUGBUS_CGC_GC_S_2_I_0,
  DEBUGBUS_SLICE_GC_S_2_I_0,
  DEBUGBUS_HLSQ_SPTP_STAR_GC_S_2_I_0,
L643: DEBUGBUS_GMU_CX_GC_US_I_0,
  static const u32 gen8_cx_debugbus_blocks[] = {
  DEBUGBUS_GBIF_CX_GC_US_I_0,
  DEBUGBUS_CX_GC_US_I_0,
  };
L774: /* gmu_cx_unsliced_regs : List of GMU CX unsliced registers */
  /* num_external_core_regs : length of external core registers list */
  size_t num_external_core_regs;
  const u32 *gmu_cx_unsliced_regs;
  /* gmu_gx_registers : List of GMU registers */
L775: const u32 *gmu_cx_unsliced_regs;
  size_t num_external_core_regs;
  /* gmu_cx_unsliced_regs : List of GMU CX unsliced registers */
  /* gmu_gx_registers : List of GMU registers */
  struct gen8_reg_list *gmu_gx_regs;
L776: /* gmu_gx_registers : List of GMU registers */
  /* gmu_cx_unsliced_regs : List of GMU CX unsliced registers */
  const u32 *gmu_cx_unsliced_regs;
  struct gen8_reg_list *gmu_gx_regs;
  /* num_gmu_gx_regs : Length of GMU registers list */
L777: struct gen8_reg_list *gmu_gx_regs;
  const u32 *gmu_cx_unsliced_regs;
  /* gmu_gx_registers : List of GMU registers */
  /* num_gmu_gx_regs : Length of GMU registers list */
  size_t num_gmu_gx_regs;
L778: /* num_gmu_gx_regs : Length of GMU registers list */
  /* gmu_gx_registers : List of GMU registers */
  struct gen8_reg_list *gmu_gx_regs;
  size_t num_gmu_gx_regs;
  /* rscc_regs : List of RSCC registers */
L779: size_t num_gmu_gx_regs;
  struct gen8_reg_list *gmu_gx_regs;
  /* num_gmu_gx_regs : Length of GMU registers list */
  /* rscc_regs : List of RSCC registers */
  const u32 *rscc_regs;

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hfi.h =====
L6: #ifndef __ADRENO_HFI_H
  * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
  */
  #define __ADRENO_HFI_H
  
L7: #define __ADRENO_HFI_H
  */
  #ifndef __ADRENO_HFI_H
  
  #include "kgsl_util.h"
L12: #define HFI_QUEUE_SIZE			SZ_4K /* bytes, must be base 4dw */
  
  #define HW_FENCE_QUEUE_SIZE		SZ_4K
  #define MAX_RCVD_PAYLOAD_SIZE		32 /* dwords */
  #define MAX_RCVD_SIZE			(MAX_RCVD_PAYLOAD_SIZE + 3) /* dwords */
L15: #define HFI_MAX_MSG_SIZE		(SZ_1K)
  #define MAX_RCVD_PAYLOAD_SIZE		32 /* dwords */
  #define MAX_RCVD_SIZE			(MAX_RCVD_PAYLOAD_SIZE + 3) /* dwords */
  
  #define HFI_CMD_ID 0
L17: #define HFI_CMD_ID 0
  #define HFI_MAX_MSG_SIZE		(SZ_1K)
  
  #define HFI_MSG_ID 1
  #define HFI_DBG_ID 2
L18: #define HFI_MSG_ID 1
  
  #define HFI_CMD_ID 0
  #define HFI_DBG_ID 2
  #define HFI_DSP_ID_0 3
L19: #define HFI_DBG_ID 2
  #define HFI_CMD_ID 0
  #define HFI_MSG_ID 1
  #define HFI_DSP_ID_0 3
  
L20: #define HFI_DSP_ID_0 3
  #define HFI_MSG_ID 1
  #define HFI_DBG_ID 2
  
  #define HFI_CMD_IDX 0
L22: #define HFI_CMD_IDX 0
  #define HFI_DSP_ID_0 3
  
  #define HFI_MSG_IDX 1
  #define HFI_DBG_IDX 2
L23: #define HFI_MSG_IDX 1
  
  #define HFI_CMD_IDX 0
  #define HFI_DBG_IDX 2
  #define HFI_DSP_IDX_BASE 3
L24: #define HFI_DBG_IDX 2
  #define HFI_CMD_IDX 0
  #define HFI_MSG_IDX 1
  #define HFI_DSP_IDX_BASE 3
  #define HFI_DSP_IDX_0 3
L25: #define HFI_DSP_IDX_BASE 3
  #define HFI_MSG_IDX 1
  #define HFI_DBG_IDX 2
  #define HFI_DSP_IDX_0 3
  
L26: #define HFI_DSP_IDX_0 3
  #define HFI_DBG_IDX 2
  #define HFI_DSP_IDX_BASE 3
  
  #define HFI_CMD_IDX_LEGACY 0
L28: #define HFI_CMD_IDX_LEGACY 0
  #define HFI_DSP_IDX_0 3
  
  #define HFI_DSP_IDX_0_LEGACY 1
  #define HFI_MSG_IDX_LEGACY 4
L29: #define HFI_DSP_IDX_0_LEGACY 1
  
  #define HFI_CMD_IDX_LEGACY 0
  #define HFI_MSG_IDX_LEGACY 4
  #define HFI_DBG_IDX_LEGACY 5
L30: #define HFI_MSG_IDX_LEGACY 4
  #define HFI_CMD_IDX_LEGACY 0
  #define HFI_DSP_IDX_0_LEGACY 1
  #define HFI_DBG_IDX_LEGACY 5
  
L31: #define HFI_DBG_IDX_LEGACY 5
  #define HFI_DSP_IDX_0_LEGACY 1
  #define HFI_MSG_IDX_LEGACY 4
  
  #define HFI_QUEUE_STATUS_DISABLED 0
L33: #define HFI_QUEUE_STATUS_DISABLED 0
  #define HFI_DBG_IDX_LEGACY 5
  
  #define HFI_QUEUE_STATUS_ENABLED 1
  
L34: #define HFI_QUEUE_STATUS_ENABLED 1
  
  #define HFI_QUEUE_STATUS_DISABLED 0
  
  /* HTOF queue priority, 1 is highest priority */
L37: #define HFI_CMD_PRI 10
  
  /* HTOF queue priority, 1 is highest priority */
  #define HFI_MSG_PRI 10
  #define HFI_DBG_PRI 40
L38: #define HFI_MSG_PRI 10
  /* HTOF queue priority, 1 is highest priority */
  #define HFI_CMD_PRI 10
  #define HFI_DBG_PRI 40
  #define HFI_DSP_PRI_0 20
L39: #define HFI_DBG_PRI 40
  #define HFI_CMD_PRI 10
  #define HFI_MSG_PRI 10
  #define HFI_DSP_PRI_0 20
  
L40: #define HFI_DSP_PRI_0 20
  #define HFI_MSG_PRI 10
  #define HFI_DBG_PRI 40
  
  #define HFI_IRQ_SIDEMSGQ_MASK		BIT(1)
L42: #define HFI_IRQ_SIDEMSGQ_MASK		BIT(1)
  #define HFI_DSP_PRI_0 20
  
  #define HFI_IRQ_DBGQ_MASK		BIT(2)
  #define HFI_IRQ_CM3_FAULT_MASK		BIT(15)
L43: #define HFI_IRQ_DBGQ_MASK		BIT(2)
  
  #define HFI_IRQ_SIDEMSGQ_MASK		BIT(1)
  #define HFI_IRQ_CM3_FAULT_MASK		BIT(15)
  #define HFI_IRQ_OOB_MASK		GENMASK(31, 16)
L44: #define HFI_IRQ_CM3_FAULT_MASK		BIT(15)
  #define HFI_IRQ_SIDEMSGQ_MASK		BIT(1)
  #define HFI_IRQ_DBGQ_MASK		BIT(2)
  #define HFI_IRQ_OOB_MASK		GENMASK(31, 16)
  #define HFI_IRQ_MASK			(HFI_IRQ_SIDEMSGQ_MASK |\
L45: #define HFI_IRQ_OOB_MASK		GENMASK(31, 16)
  #define HFI_IRQ_DBGQ_MASK		BIT(2)
  #define HFI_IRQ_CM3_FAULT_MASK		BIT(15)
  #define HFI_IRQ_MASK			(HFI_IRQ_SIDEMSGQ_MASK |\
  HFI_IRQ_DBGQ_MASK |\
L46: #define HFI_IRQ_MASK			(HFI_IRQ_SIDEMSGQ_MASK |\
  #define HFI_IRQ_CM3_FAULT_MASK		BIT(15)
  #define HFI_IRQ_OOB_MASK		GENMASK(31, 16)
  HFI_IRQ_DBGQ_MASK |\
  HFI_IRQ_CM3_FAULT_MASK)
L47: HFI_IRQ_DBGQ_MASK |\
  #define HFI_IRQ_OOB_MASK		GENMASK(31, 16)
  #define HFI_IRQ_MASK			(HFI_IRQ_SIDEMSGQ_MASK |\
  HFI_IRQ_CM3_FAULT_MASK)
  
L48: HFI_IRQ_CM3_FAULT_MASK)
  #define HFI_IRQ_MASK			(HFI_IRQ_SIDEMSGQ_MASK |\
  HFI_IRQ_DBGQ_MASK |\
  
  #define DCVS_ACK_NONBLOCK 0

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched.c =====
L8: #include "adreno_hfi.h"
  
  #include "adreno.h"
  #include "adreno_snapshot.h"
  #include "adreno_sysfs.h"
L26: * if we are sure that there will always be enough room in the ringbuffer
  *
  * Our code that "puts back" a command from the context is much cleaner
  * so restrict the size of the context queue to ADRENO_CONTEXT_DRAWQUEUE_SIZE - 1
  */
L53: static inline u32 get_gmu_vma_id(u32 flags)
  }
  
  {
  return (flags & HFI_MEMFLAG_GMU_CACHEABLE) ? GMU_CACHE : GMU_NONCACHED_KERNEL;
L55: return (flags & HFI_MEMFLAG_GMU_CACHEABLE) ? GMU_CACHE : GMU_NONCACHED_KERNEL;
  static inline u32 get_gmu_vma_id(u32 flags)
  {
  }
  
L60: if (desc_flags & HFI_MEMFLAG_GFX_PRIV)
  static void setup_gfx_flags_priv(u32 desc_flags, u64 *flags, u32 *priv)
  {
  *priv |= KGSL_MEMDESC_PRIVILEGED;
  
L63: if (!(desc_flags & HFI_MEMFLAG_GFX_WRITEABLE))
  *priv |= KGSL_MEMDESC_PRIVILEGED;
  
  *flags |= KGSL_MEMFLAGS_GPUREADONLY;
  
L66: if (desc_flags & HFI_MEMFLAG_GFX_SECURE)
  *flags |= KGSL_MEMFLAGS_GPUREADONLY;
  
  *flags |= KGSL_MEMFLAGS_SECURE;
  }
L71: struct hfi_mem_alloc_entry *entry, u64 flags, u32 priv)
  
  static int reserve_preempt_record_va(struct adreno_device *adreno_dev,
  {
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
L74: struct hfi_mem_alloc_desc *desc = &entry->desc;
  {
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
  int ret = 0;
  
L84: if (!(entry->desc.flags & HFI_MEMFLAG_GMU_ACC))
  }
  
  return ret;
  
L87: if (!entry->md->gmuaddr)
  return ret;
  
  ret = gmu_core_reserve_gmuaddr(device, entry->md,
  get_gmu_vma_id(desc->flags), desc->align);
L88: ret = gmu_core_reserve_gmuaddr(device, entry->md,
  
  if (!entry->md->gmuaddr)
  get_gmu_vma_id(desc->flags), desc->align);
  
L89: get_gmu_vma_id(desc->flags), desc->align);
  if (!entry->md->gmuaddr)
  ret = gmu_core_reserve_gmuaddr(device, entry->md,
  
  return ret;
L95: struct kgsl_memdesc **md, struct hfi_mem_alloc_entry *entry, u64 offset,
  
  static int alloc_map_preempt_record(struct adreno_device *adreno_dev,
  u64 flags, u32 priv)
  {
L101: struct hfi_mem_alloc_desc *desc = &entry->desc;
  u64 curr_gmem_size =  adreno_gmem_size(adreno_dev);
  u64 md_size = ctxt_record_size - curr_gmem_size;
  
  if (*md)
L111: (entry->desc.mem_kind == HFI_MEMKIND_CSW_PRIV_SECURE) ?
  *md = kgsl_alloc_map_gpu_global(KGSL_DEVICE(adreno_dev),
  entry->md->gpuaddr + offset, md_size, 0, flags, priv,
  "sec_preempt_record_non_gmem" : "preempt_record_non_gmem");
  if (IS_ERR(*md)) {
L120: if (!(desc->flags & HFI_MEMFLAG_GMU_ACC))
  }
  
  return 0;
  
L123: if ((*md)->gmuaddr)
  return 0;
  
  return 0;
  
L126: return gmu_core_map_gmu(KGSL_DEVICE(adreno_dev), *md,
  return 0;
  
  entry->md->gmuaddr + offset,
  get_gmu_vma_id(desc->flags),
L127: entry->md->gmuaddr + offset,
  
  return gmu_core_map_gmu(KGSL_DEVICE(adreno_dev), *md,
  get_gmu_vma_id(desc->flags),
  gmu_core_get_attrs(desc->flags), desc->align);
L128: get_gmu_vma_id(desc->flags),
  return gmu_core_map_gmu(KGSL_DEVICE(adreno_dev), *md,
  entry->md->gmuaddr + offset,
  gmu_core_get_attrs(desc->flags), desc->align);
  }
L129: gmu_core_get_attrs(desc->flags), desc->align);
  entry->md->gmuaddr + offset,
  get_gmu_vma_id(desc->flags),
  }
  
L133: struct hfi_mem_alloc_entry *entry, u64 flags, u32 priv)
  
  static int alloc_map_non_gmem(struct adreno_device *adreno_dev,
  {
  struct adreno_hwsched *hwsched = &adreno_dev->hwsched;
L141: /* Check whether GMU has removed GMEM size from RB0 context record */
  int i;
  
  if (entry->desc.size == ((ctxt_record_sz * KGSL_PRIORITY_MAX_RB_LEVELS) -
  curr_gmem_size))
L147: struct kgsl_memdesc **md = (entry->desc.mem_kind == HFI_MEMKIND_CSW_PRIV_SECURE) ?
  
  for (i = 0; i < KGSL_PRIORITY_MAX_RB_LEVELS; i++) {
  &hwsched->secure_preempt_rec[i] : &hwsched->preempt_rec[i];
  int ret = alloc_map_preempt_record(adreno_dev, md, entry, offset, flags, priv);
L163: struct hfi_mem_alloc_entry *entry)
  
  static int process_preempt_record_mem_alloc(struct adreno_device *adreno_dev,
  {
  u64 flags = 0;
L170: struct gmu_core_device *gmu = &KGSL_DEVICE(adreno_dev)->gmu_core;
  
  if (!entry->md) {
  
  if (gmu->global_entries == ARRAY_SIZE(gmu->gmu_globals))
L172: if (gmu->global_entries == ARRAY_SIZE(gmu->gmu_globals))
  struct gmu_core_device *gmu = &KGSL_DEVICE(adreno_dev)->gmu_core;
  
  return -ENOMEM;
  
L175: entry->md = &gmu->gmu_globals[gmu->global_entries];
  return -ENOMEM;
  
  gmu->global_entries++;
  }
L176: gmu->global_entries++;
  
  entry->md = &gmu->gmu_globals[gmu->global_entries];
  }
  

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched.h =====
L10: #include "adreno_hfi.h"
  #define _ADRENO_HWSCHED_H_
  
  #include "kgsl_sync.h"
  
L25: * @unack_count: Number of hardware fences sent to GMU but haven't yet been ack'd
  spinlock_t lock;
  /**
  * by GMU
  */
L26: * by GMU
  /**
  * @unack_count: Number of hardware fences sent to GMU but haven't yet been ack'd
  */
  u32 unack_count;
L40: * @defer_ts: The timestamp of the hardware fence which got deferred
  struct adreno_context *defer_drawctxt;
  /**
  */
  u32 defer_ts;
L62: struct hfi_hw_fence_info cmd;
  struct adreno_hw_fence_entry {
  /** @cmd: H2F_MSG_HW_FENCE_INFO packet for this hardware fence */
  /** @kfence: Pointer to the kgsl fence */
  struct kgsl_sync_fence *kfence;
L84: * @preempt_count - Target specific function to get preemption count
  struct kgsl_drawobj *drawobj);
  /**
  */
  u32 (*preempt_count)(struct adreno_device *adreno_dev);
L88: * @preempt_info - Target specific function to get preemption information
  u32 (*preempt_count)(struct adreno_device *adreno_dev);
  /**
  */
  ssize_t (*preempt_info)(struct adreno_device *adreno_dev, char *buf);
L104: GMU_GPU_RESET_NONE,
  
  enum gpu_reset_type {
  GMU_GPU_SOFT_RESET,
  GMU_GPU_HARD_RESET,
L105: GMU_GPU_SOFT_RESET,
  enum gpu_reset_type {
  GMU_GPU_RESET_NONE,
  GMU_GPU_HARD_RESET,
  };
L106: GMU_GPU_HARD_RESET,
  GMU_GPU_RESET_NONE,
  GMU_GPU_SOFT_RESET,
  };
  
L112: /** @update: True if this value needs to be sent to GMU at slumber exit **/
  /** @value: Stores the requested value for the tunable **/
  u32 value;
  bool update;
  };
L120: /** @mem_alloc_table: Array of HFI memory allocation entries */
  */
  struct adreno_hwsched {
  struct hfi_mem_alloc_entry mem_alloc_table[32];
  /** @mem_alloc_entries: Number of entries in the memory allocation table */
L121: struct hfi_mem_alloc_entry mem_alloc_table[32];
  struct adreno_hwsched {
  /** @mem_alloc_table: Array of HFI memory allocation entries */
  /** @mem_alloc_entries: Number of entries in the memory allocation table */
  u32 mem_alloc_entries;
L138: /** @ctxt_bad: Container for the context bad hfi packet */
  /** @hwsched_ops: Container for target specific hwscheduler ops */
  const struct adreno_hwsched_ops *hwsched_ops;
  void *ctxt_bad;
  /** @idle_gate: Gate to wait on for hwscheduler to idle */
L144: /** @recurring_cmdobj: Recurring commmand object sent to GMU */
  /** @big_cmdobj = Points to the big IB that is inflight */
  struct kgsl_drawobj_cmd *big_cmdobj;
  struct kgsl_drawobj_cmd *recurring_cmdobj;
  /** @lsr_timer: Timer struct to schedule lsr work */
L153: * @submission_seqnum: Sequence number for sending submissions to GMU context queues or
  struct kmem_cache *hw_fence_cache;
  /**
  * dispatch queues
  */
L159: /** @global_ctxt_gmu_registered: Whether global context is registered with gmu */
  /** @global_ctxtq: Memory descriptor for global context queue */
  struct kgsl_memdesc global_ctxtq;
  bool global_ctxt_gmu_registered;
  /** @hw_fence: Container for hw fence related structures */
L160: bool global_ctxt_gmu_registered;
  struct kgsl_memdesc global_ctxtq;
  /** @global_ctxt_gmu_registered: Whether global context is registered with gmu */
  /** @hw_fence: Container for hw fence related structures */
  struct adreno_hwsched_hw_fence hw_fence;
L165: /** @preempt_rec: Memory descriptors for non-gmem part of preemption records */
  /** @reset_type: GPU fault reset (hard/soft) type */
  enum gpu_reset_type reset_type;
  struct kgsl_memdesc *preempt_rec[KGSL_PRIORITY_MAX_RB_LEVELS];
  /**
L168: * @preempt_rec_gmem: Memory descriptors for gmem part of preemption
  struct kgsl_memdesc *preempt_rec[KGSL_PRIORITY_MAX_RB_LEVELS];
  /**
  * records. No gmem buffer needed for rb0 preemption record.
  */
L169: * records. No gmem buffer needed for rb0 preemption record.
  /**
  * @preempt_rec_gmem: Memory descriptors for gmem part of preemption
  */
  struct kgsl_memdesc *preempt_rec_gmem[KGSL_PRIORITY_MAX_RB_LEVELS - 1];
L174: * preemption records
  /**
  * @secure_preempt_rec: Memory descriptors for non-gmem part of secure
  */
  struct kgsl_memdesc *secure_preempt_rec[KGSL_PRIORITY_MAX_RB_LEVELS];
L179: * preemption records. No gmem buffer needed for rb0 preemption record.
  /**
  * @secure_preempt_rec_gmem: Memory descriptors for gmem part of secure
  */
  struct kgsl_memdesc *secure_preempt_rec_gmem[KGSL_PRIORITY_MAX_RB_LEVELS - 1];
L182: /** @dcvs_param_update: True if dcvs params have to be sent to GMU at slumber exit */
  */
  struct kgsl_memdesc *secure_preempt_rec_gmem[KGSL_PRIORITY_MAX_RB_LEVELS - 1];
  bool dcvs_param_update;
  /** @tunables_kobj: Kobj for dcvs tunables **/
L188: /** @sysfs_dcvs_tunables : Tuning parameters for GMU based DCVS **/
  /** @dcvs_kobj: Kobj for dcvs params **/
  struct kobject dcvs_kobj;
  struct adreno_dcvs_tunable sysfs_dcvs_tunables[GPU_TUNING_KEY_MAX];
  /** @default_dcvs_tunables: Default value of GMU based DCVS tunables **/
L190: /** @default_dcvs_tunables: Default value of GMU based DCVS tunables **/
  /** @sysfs_dcvs_tunables : Tuning parameters for GMU based DCVS **/
  struct adreno_dcvs_tunable sysfs_dcvs_tunables[GPU_TUNING_KEY_MAX];
  u32 default_dcvs_tunables[GPU_TUNING_KEY_MAX];
  };
L196: * in the ringbuffer.
  /*
  * This value is based on maximum number of IBs that can fit
  */
  #define HWSCHED_MAX_IBS 2000
L206: ADRENO_HWSCHED_FORCE_RETIRE_GMU,
  ADRENO_HWSCHED_CONTEXT_QUEUE,
  ADRENO_HWSCHED_HW_FENCE,
  ADRENO_HWSCHED_GPU_SOFT_RESET,
  };
L213: * @mad: Pointer to the HFI memory allocation descriptor
  * adreno_hwsched_process_mem_alloc - Process memory allocation for hwsched
  * @adreno_dev: Pointer to the adreno device
  *
  * This function processes the memory allocation request for the hwsched.
L222: struct hfi_mem_alloc_desc *mad);
  */
  int adreno_hwsched_process_mem_alloc(struct adreno_device *adreno_dev,
  
  /**

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched_snapshot.c =====
L27: header->timestamp_queued = 0;
  header->rbsize = rb->size >> 2;
  header->count = rb->size >> 2;
  header->timestamp_retired = 0;
  header->gpuaddr = rb->gpuaddr;
L28: header->timestamp_retired = 0;
  header->count = rb->size >> 2;
  header->timestamp_queued = 0;
  header->gpuaddr = rb->gpuaddr;
  header->id = 0;
L99: header->timestamp_queued = adreno_hwsched_parse_payload(payload,
  header->rbsize = size >> 2;
  header->count = size >> 2;
  KEY_RB_QUEUED_TS);
  header->timestamp_retired = adreno_hwsched_parse_payload(payload,
L101: header->timestamp_retired = adreno_hwsched_parse_payload(payload,
  header->timestamp_queued = adreno_hwsched_parse_payload(payload,
  KEY_RB_QUEUED_TS);
  KEY_RB_RETIRED_TS);
  header->gpuaddr = gpuaddr;
L123: struct hfi_context_bad_cmd_legacy *cmd = adreno_dev->hwsched.ctxt_bad;
  struct kgsl_snapshot *snapshot)
  {
  u32 i = 0, payload_bytes;
  void *start;
L128: /* Skip if we didn't receive a context bad HFI */
  bool ret = false;
  
  if (!cmd->hdr)
  return false;
L133: offsetof(struct hfi_context_bad_cmd_legacy, payload);
  
  payload_bytes = (MSG_HDR_GET_SIZE(cmd->hdr) << 2) -
  
  start = &cmd->payload[0];
L154: struct hfi_context_bad_cmd *cmd = adreno_dev->hwsched.ctxt_bad;
  struct kgsl_snapshot *snapshot)
  {
  u32 i = 0, payload_bytes;
  void *start;
L159: /* Skip if we didn't receive a context bad HFI */
  bool ret = false;
  
  if (!cmd->hdr)
  return false;
L164: offsetof(struct hfi_context_bad_cmd, payload);
  
  payload_bytes = (MSG_HDR_GET_SIZE(cmd->hdr) << 2) -
  
  start = &cmd->payload[0];
L216: struct gmu_mem_type_desc desc;
  struct kgsl_context *context = ptr;
  struct adreno_context *drawctxt = ADRENO_CONTEXT(context);
  
  if (!context->gmu_registered)
L218: if (!context->gmu_registered)
  struct gmu_mem_type_desc desc;
  
  return 0;
  
L221: desc.memdesc = &drawctxt->gmu_context_queue;
  return 0;
  
  desc.type = SNAPSHOT_GMU_MEM_CONTEXT_QUEUE;
  kgsl_snapshot_add_section(context->device,
L222: desc.type = SNAPSHOT_GMU_MEM_CONTEXT_QUEUE;
  
  desc.memdesc = &drawctxt->gmu_context_queue;
  kgsl_snapshot_add_section(context->device,
  KGSL_SNAPSHOT_SECTION_GMU_MEMORY,
L224: KGSL_SNAPSHOT_SECTION_GMU_MEMORY,
  desc.type = SNAPSHOT_GMU_MEM_CONTEXT_QUEUE;
  kgsl_snapshot_add_section(context->device,
  snapshot, adreno_snapshot_gmu_mem, &desc);
  
L225: snapshot, adreno_snapshot_gmu_mem, &desc);
  kgsl_snapshot_add_section(context->device,
  KGSL_SNAPSHOT_SECTION_GMU_MEMORY,
  
  return 0;
L241: static void snapshot_preemption_record(struct kgsl_device *device,
  }
  
  struct kgsl_snapshot *snapshot, struct kgsl_memdesc *md, u64 offset, u64 size)
  {
L254: "Invalid preemption context record size: md_size: 0x%llx, ctxt_record_size: 0x%llx\n",
  if (WARN_RATELIMIT((ctxt_record_size > md->size) ||
  (offset > (md->size - ctxt_record_size)),
  md->size, ctxt_record_size))
  return;
L260: SNAPSHOT_ERR_NOMEM(device, "PREEMPTION RECORD");
  section_size = sizeof(*section_header) + sizeof(*header) + ctxt_record_size;
  if (snapshot->remain < section_size) {
  return;
  }
L283: void adreno_hwsched_snapshot_preemption_records(struct kgsl_device *device,
  }
  
  struct kgsl_snapshot *snapshot, struct kgsl_memdesc *md)
  {
L296: snapshot_preemption_record(device, snapshot,
  
  for (i = 0; i < KGSL_PRIORITY_MAX_RB_LEVELS; i++)
  hwsched->preempt_rec[i], 0, hwsched->preempt_rec[i]->size);
  return;
L301: /* Check whether GMU has removed GMEM size from RB0 context record */
  }
  
  if (md->size == (rb0_ctxt_record_size * KGSL_PRIORITY_MAX_RB_LEVELS)) {
  do_div(ctxt_record_size, KGSL_PRIORITY_MAX_RB_LEVELS);
L310: snapshot_preemption_record(device, snapshot, md, offset, rb0_ctxt_record_size);
  }
  
  offset += rb0_ctxt_record_size;
  
L313: /* All preemption records exist as a single mem alloc entry */
  offset += rb0_ctxt_record_size;
  
  for (i = 1; i < KGSL_PRIORITY_MAX_RB_LEVELS; i++) {
  snapshot_preemption_record(device, snapshot, md,
L315: snapshot_preemption_record(device, snapshot, md,
  /* All preemption records exist as a single mem alloc entry */
  for (i = 1; i < KGSL_PRIORITY_MAX_RB_LEVELS; i++) {
  offset, ctxt_record_size);
  offset += ctxt_record_size;

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_hwsched_snapshot.h =====
L24: void adreno_hwsched_snapshot_preemption_records(struct kgsl_device *device,
  struct kgsl_snapshot *snapshot);
  
  struct kgsl_snapshot *snapshot, struct kgsl_memdesc *md);
  

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_ioctl.c =====
L149: static long adreno_ioctl_preemption_counters_query(
  }
  
  struct kgsl_device_private *dev_priv,
  unsigned int cmd, void *data)
L154: struct kgsl_preemption_counters_query *read = data;
  {
  struct adreno_device *adreno_dev = ADRENO_DEVICE(dev_priv->device);
  int size_level = A5XX_CP_CTXRECORD_PREEMPTION_COUNTER_SIZE;
  int levels_to_copy;
L155: int size_level = A5XX_CP_CTXRECORD_PREEMPTION_COUNTER_SIZE;
  struct adreno_device *adreno_dev = ADRENO_DEVICE(dev_priv->device);
  struct kgsl_preemption_counters_query *read = data;
  int levels_to_copy;
  
L159: !adreno_is_preemption_enabled(adreno_dev))
  
  if (!adreno_is_a5xx(adreno_dev) ||
  return -EOPNOTSUPP;
  
L165: /* Calculate number of preemption counter levels to copy to userspace */
  return -EINVAL;
  
  levels_to_copy = (read->size_user / size_level);
  
L169: ARRAY_SIZE(adreno_dev->ringbuffers));
  
  levels_to_copy = min_t(int, levels_to_copy,
  
  if (copy_to_user(u64_to_user_ptr(read->counters),
L186: struct kgsl_read_calibrated_timestamps *reads = data;
  {
  struct adreno_device *adreno_dev = ADRENO_DEVICE(dev_priv->device);
  unsigned long flags;
  u32 *sources = NULL;
L195: /* Reading calibrated timestamps requires the CX timer be initialized */
  int ret = 0;
  
  if (!test_bit(ADRENO_DEVICE_CX_TIMER_INITIALIZED, &adreno_dev->priv))
  return -EOPNOTSUPP;
L199: /* Check that the number of timestamps is reasonable */
  return -EOPNOTSUPP;
  
  if (!reads->count ||
  (reads->count > (2 * KGSL_CALIBRATED_TIME_DOMAIN_MAX)))
L240: /* Done collecting timestamps. Re-enable irqs */
  (u64)ktime_to_ns(ktime_get_raw());
  
  local_irq_restore(flags);
  
L303: { IOCTL_KGSL_PREEMPTIONCOUNTER_QUERY,
  { IOCTL_KGSL_PERFCOUNTER_QUERY, adreno_ioctl_perfcounter_query },
  { IOCTL_KGSL_PERFCOUNTER_READ, adreno_ioctl_perfcounter_read },
  adreno_ioctl_preemption_counters_query },
  { IOCTL_KGSL_READ_CALIBRATED_TIMESTAMPS, adreno_ioctl_read_calibrated_ts },
L304: adreno_ioctl_preemption_counters_query },
  { IOCTL_KGSL_PERFCOUNTER_READ, adreno_ioctl_perfcounter_read },
  { IOCTL_KGSL_PREEMPTIONCOUNTER_QUERY,
  { IOCTL_KGSL_READ_CALIBRATED_TIMESTAMPS, adreno_ioctl_read_calibrated_ts },
  };
L305: { IOCTL_KGSL_READ_CALIBRATED_TIMESTAMPS, adreno_ioctl_read_calibrated_ts },
  { IOCTL_KGSL_PREEMPTIONCOUNTER_QUERY,
  adreno_ioctl_preemption_counters_query },
  };
  

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_perfcounter.h =====
L80: * registers of this perfcounter group as part of preemption and IFPC
  /*
  * ADRENO_PERFCOUNTER_GROUP_RESTORE indicates CP needs to restore the select
  */
  #define ADRENO_PERFCOUNTER_GROUP_RESTORE BIT(1)

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_pm4types.h =====
L16: /* Enable preemption flag */
  #define PM4_TYPE4_PKT_SIZE_MAX  128
  
  #define CP_PREEMPT_ENABLE 0x1C
  /* Preemption token command on which preemption occurs */
L18: /* Preemption token command on which preemption occurs */
  /* Enable preemption flag */
  #define CP_PREEMPT_ENABLE 0x1C
  #define CP_PREEMPT_TOKEN 0x1E
  /* Bit to set in CP_PREEMPT_TOKEN ordinal for interrupt on preemption */
L20: /* Bit to set in CP_PREEMPT_TOKEN ordinal for interrupt on preemption */
  /* Preemption token command on which preemption occurs */
  #define CP_PREEMPT_TOKEN 0x1E
  #define CP_PREEMPT_ORDINAL_INTERRUPT 24
  
L44: /* switches SMMU pagetable, used on a5xx only */
  #define CP_WAIT_REG_EQ		0x52
  
  #define CP_SMMU_TABLE_UPDATE 0x53
  
L45: #define CP_SMMU_TABLE_UPDATE 0x53
  
  /* switches SMMU pagetable, used on a5xx only */
  
  /* Designate command streams to be executed before/after CP does state restore during preemption */
L47: /* Designate command streams to be executed before/after CP does state restore during preemption */
  #define CP_SMMU_TABLE_UPDATE 0x53
  
  #define CP_SET_AMBLE		0x55
  
L78: #define CP_EVENT_WRITE		0x46
  
  /* generate an event that creates a write to memory when completed */
  
  /* A5XX Enable yield in RB only */
L85: /* Enable/Disable/Defer A5x global preemption model */
  #define CP_WHERE_AM_I 0x62
  
  #define CP_PREEMPT_ENABLE_GLOBAL    0x69
  
L88: /* Enable/Disable A5x local preemption model */
  #define CP_PREEMPT_ENABLE_GLOBAL    0x69
  
  #define CP_PREEMPT_ENABLE_LOCAL     0x6A
  
L92: #define CP_CONTEXT_SWITCH_YIELD     0x6B
  
  /* Yeild token on a5xx similar to CP_PREEMPT on a4xx */
  
  /* Inform CP about current render mode (needed for a5xx preemption) */
L94: /* Inform CP about current render mode (needed for a5xx preemption) */
  #define CP_CONTEXT_SWITCH_YIELD     0x6B
  
  #define CP_SET_RENDER_MODE          0x6C
  
L100: /* Stall the SQE until the CP processing pipeline is empty */
  #define CP_WAIT_FOR_ME		0x13
  
  #define CP_WAIT_FOR_CP_FLUSH 0x13
  
L132: /* This is a commonly used CP_EVENT_WRITE */
  #define CP_LOADSTATE_EXTSRCADDR_SHIFT 0x00000002
  
  #define CACHE_FLUSH_TS 4
  #define CACHE_CLEAN 0x31
L133: #define CACHE_FLUSH_TS 4
  
  /* This is a commonly used CP_EVENT_WRITE */
  #define CACHE_CLEAN 0x31
  #define LRZ_CACHE_FLUSH 0x26
L140: #define CP_WAIT_TIMESTAMP 0x14
  #define CP_THREAD_CONTROL 0x17
  
  
  #define CP_SET_THREAD_BR FIELD_PREP(GENMASK(1, 0), 1)
L155: /* Used to define amble type in SET_AMBLE packet to execute during preemption */
  #define CP_CLEAR_ON_CHIP_TS BIT(0)
  
  #define CP_KMD_AMBLE_TYPE 3
  

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_profile.c =====
L16: #include "adreno_ringbuffer.h"
  #include "adreno_profile.h"
  #include "adreno_pm4types.h"
  
  #define ASSIGNS_STR_FORMAT "%.8s:%u "
L22: *        : 3 - timestamp, count, context id
  /*
  * Raw Data for processing later:
  * [per counter] - data for each counter
  *        : 1 - Register offset
L34: *        : 4 - timestamp
  * Pre-IB command size (in dwords):
  *        : 2 - NOP start identifier
  *        : 4 - count
  *        : 4 - context id
L99: unsigned int head, unsigned int timestamp,
  static u64 _build_pre_ib_cmds(struct adreno_device *adreno_dev,
  struct adreno_profile *profile,
  struct adreno_context *drawctxt,
  u32 *dwords)
L116: * Write ringbuffer commands to save the following to memory:
  
  /*
  * timestamp, count, context_id, pid, tid, context type
  */
L117: * timestamp, count, context_id, pid, tid, context type
  /*
  * Write ringbuffer commands to save the following to memory:
  */
  ibcmds += _ib_cmd_mem_write(adreno_dev, ibcmds, gpuaddr + data_offset,
L120: timestamp, &data_offset);
  */
  ibcmds += _ib_cmd_mem_write(adreno_dev, ibcmds, gpuaddr + data_offset,
  ibcmds += _ib_cmd_mem_write(adreno_dev, ibcmds, gpuaddr + data_offset,
  profile->assignment_count, &data_offset);
L321: * If shared_buffer empty or Memstore EOP timestamp is less than
  
  /*
  * outstanding counter buffer timestamps then no results available
  */
L322: * outstanding counter buffer timestamps then no results available
  /*
  * If shared_buffer empty or Memstore EOP timestamp is less than
  */
  if (shared_buf_empty(profile))
L328: if (adreno_rb_readtimestamp(adreno_dev,
  
  shared_ptr = (unsigned int *)profile->shared_buffer->hostptr;
  adreno_dev->cur_rb,
  KGSL_TIMESTAMP_RETIRED, &global_eop))
L330: KGSL_TIMESTAMP_RETIRED, &global_eop))
  if (adreno_rb_readtimestamp(adreno_dev,
  adreno_dev->cur_rb,
  return false;
  do {
L338: ts_cmp = timestamp_cmp(ts, global_eop);
  
  ts = *(shared_ptr + off);
  if (ts_cmp >= 0) {
  *shared_buf_tail = off;
L379: * format: timestamp, count, context_id
  buf_off = profile->shared_tail;
  /*
  * count entries: pc_off, pc_start, pc_end
  */
L907: * format <pid>  <tid> <context id> <cnt<<16 | client type> <timestamp>
  */
  /*
  * for each perf counter <cntr_reg_off> <start hi & lo> <end hi & low>
  */
L1094: struct adreno_ringbuffer *rb = ADRENO_CURRENT_RINGBUFFER(adreno_dev);
  unsigned int entry_head = profile->shared_head;
  unsigned int *shared_ptr;
  
  if (adreno_dev->hwsched_enabled)
L1105: * ringbuffer in the case where only the post_ib fails enough space
  * check if space available, include the post_ib in space available
  * check so don't have to handle trying to undo the pre_ib insertion in
  */
  if (SIZE_SHARED_ENTRY(count) >= shared_buf_available(profile))
L1132: rb->timestamp + 1, drawctxt, dwords);
  /* create the shared ibdesc */
  return _build_pre_ib_cmds(adreno_dev, profile, entry_head,
  }
  

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_ringbuffer.c =====
L14: #include "adreno_ringbuffer.h"
  #include "adreno.h"
  #include "adreno_pm4types.h"
  #include "adreno_trace.h"
  #include "kgsl_trace.h"
L28: struct adreno_ringbuffer *rb,
  
  void adreno_get_submit_time(struct adreno_device *adreno_dev,
  struct adreno_submit_time *time)
  {
L55: drawctxt->timestamp, time->ticks);
  /* Trace the GPU time to create a mapping to ftrace time */
  trace_adreno_cmdbatch_sync(context->id, context->priority,
  
  /* Get the kernel clock for time since boot */
L66: unsigned int *adreno_ringbuffer_allocspace(struct adreno_ringbuffer *rb,
  }
  
  unsigned int dwords)
  {
L83: * There isn't enough space toward the end of ringbuffer. So
  
  /*
  * look for space from the beginning of ringbuffer upto the
  * read pointer.
L84: * look for space from the beginning of ringbuffer upto the
  /*
  * There isn't enough space toward the end of ringbuffer. So
  * read pointer.
  */
L105: void adreno_ringbuffer_stop(struct adreno_device *adreno_dev)
  }
  
  {
  struct adreno_ringbuffer *rb;
L107: struct adreno_ringbuffer *rb;
  void adreno_ringbuffer_stop(struct adreno_device *adreno_dev)
  {
  int i;
  
L110: FOR_EACH_RINGBUFFER(adreno_dev, rb, i)
  int i;
  
  kgsl_cancel_events(KGSL_DEVICE(adreno_dev), &(rb->events));
  }
L114: static int _rb_readtimestamp(struct kgsl_device *device,
  }
  
  void *priv, enum kgsl_timestamp_type type,
  unsigned int *timestamp)
L115: void *priv, enum kgsl_timestamp_type type,
  
  static int _rb_readtimestamp(struct kgsl_device *device,
  unsigned int *timestamp)
  {
L116: unsigned int *timestamp)
  static int _rb_readtimestamp(struct kgsl_device *device,
  void *priv, enum kgsl_timestamp_type type,
  {
  return adreno_rb_readtimestamp(ADRENO_DEVICE(device), priv, type,
L118: return adreno_rb_readtimestamp(ADRENO_DEVICE(device), priv, type,
  unsigned int *timestamp)
  {
  timestamp);
  }
L119: timestamp);
  {
  return adreno_rb_readtimestamp(ADRENO_DEVICE(device), priv, type,
  }
  
L122: int adreno_ringbuffer_setup(struct adreno_device *adreno_dev,
  }
  
  struct adreno_ringbuffer *rb, int id)
  {
L123: struct adreno_ringbuffer *rb, int id)
  
  int adreno_ringbuffer_setup(struct adreno_device *adreno_dev,
  {
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
L137: SZ_4K, KGSL_MEMFLAGS_GPUREADONLY, priv, "ringbuffer");
  
  ret = adreno_allocate_global(device, &rb->buffer_desc, KGSL_RB_SIZE,
  if (ret)
  return ret;
L145: kgsl_add_event_group(device, &rb->events, NULL, _rb_readtimestamp, rb,
  
  rb->id = id;
  "rb_events-%d", id);
  
L148: rb->timestamp = 0;
  "rb_events-%d", id);
  
  init_waitqueue_head(&rb->ts_expire_waitq);
  
L156: void adreno_preemption_timer(struct timer_list *t)
  }
  
  {
  struct adreno_preemption *preempt = kgsl_timer_container_of(preempt, t, timer);
L158: struct adreno_preemption *preempt = kgsl_timer_container_of(preempt, t, timer);
  void adreno_preemption_timer(struct timer_list *t)
  {
  struct adreno_device *adreno_dev = container_of(preempt,
  struct adreno_device, preempt);
L186: context->id, drawobj->timestamp);
  (drawobj->flags & KGSL_CONTEXT_PWR_CONSTRAINT)))
  kgsl_pwrctrl_set_constraint(device, &context->pwr_constraint,
  
  if (context->l3_pwr_constraint.type &&
L241: int adreno_ringbuffer_submitcmd(struct adreno_device *adreno_dev,
  }
  
  struct kgsl_drawobj_cmd *cmdobj,
  struct adreno_submit_time *time)
L248: struct adreno_ringbuffer *rb = drawctxt->rb;
  struct kgsl_drawobj *drawobj = DRAWOBJ(cmdobj);
  struct adreno_context *drawctxt = ADRENO_CONTEXT(drawobj->context);
  const struct adreno_gpudev *gpudev = ADRENO_GPU_DEVICE(adreno_dev);
  u32 flags = 0;
L285: * ringbuffer.  If an upstream caller already passed down a
  * we want to use an adreno_submit_time struct to get the
  * precise moment when the command is submitted to the
  * pointer piggyback on that otherwise use a local struct
  */
L340: ret = gpudev->ringbuffer_submitcmd(adreno_dev, cmdobj,
  adreno_profile_process_results(adreno_dev);
  
  flags, time);
  
L345: cmdobj->global_ts = drawctxt->internal_timestamp;
  if (!ret) {
  set_bit(KGSL_CONTEXT_PRIV_SUBMITTED, &drawobj->context->priv);
  }
  
L352: * adreno_ringbuffer_wait_callback() - Callback function for event registered
  
  /**
  * on a ringbuffer timestamp
  * @device: Device for which the callback is valid
L353: * on a ringbuffer timestamp
  /**
  * adreno_ringbuffer_wait_callback() - Callback function for event registered
  * @device: Device for which the callback is valid
  * @context: The context of the event
L359: static void adreno_ringbuffer_wait_callback(struct kgsl_device *device,
  * @result: Result of the event trigger
  */
  struct kgsl_event_group *group,
  void *priv, int result)

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_ringbuffer.h =====
L6: #ifndef __ADRENO_RINGBUFFER_H
  * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
  */
  #define __ADRENO_RINGBUFFER_H
  
L7: #define __ADRENO_RINGBUFFER_H
  */
  #ifndef __ADRENO_RINGBUFFER_H
  
  /* Given a ringbuffer, return the adreno device that owns it */
L9: /* Given a ringbuffer, return the adreno device that owns it */
  #define __ADRENO_RINGBUFFER_H
  
  
  #define _RB_OFFSET(_id) (offsetof(struct adreno_device, ringbuffers) + \
L11: #define _RB_OFFSET(_id) (offsetof(struct adreno_device, ringbuffers) + \
  /* Given a ringbuffer, return the adreno device that owns it */
  
  ((_id) * sizeof(struct adreno_ringbuffer)))
  
L12: ((_id) * sizeof(struct adreno_ringbuffer)))
  
  #define _RB_OFFSET(_id) (offsetof(struct adreno_device, ringbuffers) + \
  
  #define ADRENO_RB_DEVICE(_rb) \
L17: /* Adreno ringbuffer size in bytes */
  ((struct adreno_device *) (((void *) (_rb)) - _RB_OFFSET((_rb)->id)))
  
  #define KGSL_RB_SIZE (32 * 1024)
  
L21: * A handy macro to convert the RB size to dwords since most ringbuffer
  
  /*
  * operations happen in dword increments
  */
L64: * struct adreno_ringbuffer - Definition for an adreno ringbuffer object
  
  /**
  * @flags: Internal control flags for the ringbuffer
  * @buffer_desc: Pointer to the ringbuffer memory descriptor
L65: * @flags: Internal control flags for the ringbuffer
  /**
  * struct adreno_ringbuffer - Definition for an adreno ringbuffer object
  * @buffer_desc: Pointer to the ringbuffer memory descriptor
  * @_wptr: The next value of wptr to be written to the hardware on submit
L66: * @buffer_desc: Pointer to the ringbuffer memory descriptor
  * struct adreno_ringbuffer - Definition for an adreno ringbuffer object
  * @flags: Internal control flags for the ringbuffer
  * @_wptr: The next value of wptr to be written to the hardware on submit
  * @wptr: Local copy of the wptr offset last written to hardware
L70: * @rb_ctx: The context that represents a ringbuffer
  * @wptr: Local copy of the wptr offset last written to hardware
  * @last_wptr: offset of the last wptr that was written to CFF
  * @id: Priority level of the ringbuffer, also used as an ID
  * @fault_detect_ts: The last retired global timestamp read during fault detect
L71: * @id: Priority level of the ringbuffer, also used as an ID
  * @last_wptr: offset of the last wptr that was written to CFF
  * @rb_ctx: The context that represents a ringbuffer
  * @fault_detect_ts: The last retired global timestamp read during fault detect
  * @timestamp: The RB's global timestamp
L72: * @fault_detect_ts: The last retired global timestamp read during fault detect
  * @rb_ctx: The context that represents a ringbuffer
  * @id: Priority level of the ringbuffer, also used as an ID
  * @timestamp: The RB's global timestamp
  * @events: A kgsl_event_group for this context - contains the list of GPU
L73: * @timestamp: The RB's global timestamp
  * @id: Priority level of the ringbuffer, also used as an ID
  * @fault_detect_ts: The last retired global timestamp read during fault detect
  * @events: A kgsl_event_group for this context - contains the list of GPU
  * events
L76: * @drawctxt_active: The last pagetable that this ringbuffer is set to
  * @events: A kgsl_event_group for this context - contains the list of GPU
  * events
  * @preemption_desc: The memory descriptor containing
  * preemption info written/read by CP
L77: * @preemption_desc: The memory descriptor containing
  * events
  * @drawctxt_active: The last pagetable that this ringbuffer is set to
  * preemption info written/read by CP
  * @secure_preemption_desc: The memory descriptor containing
L78: * preemption info written/read by CP
  * @drawctxt_active: The last pagetable that this ringbuffer is set to
  * @preemption_desc: The memory descriptor containing
  * @secure_preemption_desc: The memory descriptor containing
  * preemption info written/read by CP for secure contexts
L79: * @secure_preemption_desc: The memory descriptor containing
  * @preemption_desc: The memory descriptor containing
  * preemption info written/read by CP
  * preemption info written/read by CP for secure contexts
  * @perfcounter_save_restore_desc: Used by CP to save/restore the perfcounter
L80: * preemption info written/read by CP for secure contexts
  * preemption info written/read by CP
  * @secure_preemption_desc: The memory descriptor containing
  * @perfcounter_save_restore_desc: Used by CP to save/restore the perfcounter
  * values across preemption
L82: * values across preemption
  * preemption info written/read by CP for secure contexts
  * @perfcounter_save_restore_desc: Used by CP to save/restore the perfcounter
  * and the commands to switch pagetable on the RB
  * @dispatch_q: The dispatcher side queue for this ringbuffer
L84: * @dispatch_q: The dispatcher side queue for this ringbuffer
  * values across preemption
  * and the commands to switch pagetable on the RB
  * @ts_expire_waitq: Wait queue to wait for rb timestamp to expire
  * @ts_expire_waitq: Wait q to wait for rb timestamp to expire
L85: * @ts_expire_waitq: Wait queue to wait for rb timestamp to expire
  * and the commands to switch pagetable on the RB
  * @dispatch_q: The dispatcher side queue for this ringbuffer
  * @ts_expire_waitq: Wait q to wait for rb timestamp to expire
  * @wptr_preempt_end: Used during preemption to check that preemption occurred
L86: * @ts_expire_waitq: Wait q to wait for rb timestamp to expire
  * @dispatch_q: The dispatcher side queue for this ringbuffer
  * @ts_expire_waitq: Wait queue to wait for rb timestamp to expire
  * @wptr_preempt_end: Used during preemption to check that preemption occurred
  * at the right rptr
L87: * @wptr_preempt_end: Used during preemption to check that preemption occurred
  * @ts_expire_waitq: Wait queue to wait for rb timestamp to expire
  * @ts_expire_waitq: Wait q to wait for rb timestamp to expire
  * at the right rptr
  * @gpr11: The gpr11 value of this RB
L92: * @skip_inline_wptr: Used during preemption to make sure wptr is updated in
  * @preempted_midway: Indicates that the RB was preempted before rptr = wptr
  * @preempt_lock: Lock to protect the wptr pointer while it is being updated
  * hardware
  */
L95: struct adreno_ringbuffer {
  * hardware
  */
  unsigned long flags;
  struct kgsl_memdesc *buffer_desc;
L103: unsigned int timestamp;
  int id;
  unsigned int fault_detect_ts;
  struct kgsl_event_group events;
  struct adreno_context *drawctxt_active;
L106: struct kgsl_memdesc *preemption_desc;
  struct kgsl_event_group events;
  struct adreno_context *drawctxt_active;
  struct kgsl_memdesc *secure_preemption_desc;
  struct kgsl_memdesc *perfcounter_save_restore_desc;
L107: struct kgsl_memdesc *secure_preemption_desc;
  struct adreno_context *drawctxt_active;
  struct kgsl_memdesc *preemption_desc;
  struct kgsl_memdesc *perfcounter_save_restore_desc;
  struct adreno_dispatcher_drawqueue dispatch_q;
L124: * commands per ringbuffer with user profiling enabled
  * @profile_index: Pointer to the next "slot" in profile_desc for a user
  * profiling IB1.  This allows for PAGE_SIZE / 16 = 256 simultaneous
  * enough.
  */

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_rpmh.c =====
L167: bool gmu_ab)
  struct rpmh_bw_votes *adreno_rpmh_build_bw_votes(struct bcm *bcms, int bcm_count,
  u32 *levels, int levels_count, u32 perfmode_vote, u32 perfmode_lvl,
  {
  struct rpmh_bw_votes *votes;
L217: tcs_cmd_data(bcms, bcm_count, gmu_ab ? levels[i] : 0x0,
  }
  
  levels[i], votes->cmds[i],
  (i >= perfmode_lvl) ? perfmode_vote : 0x0);
L231: * Return the same value to disable cx voting at GMU.
  /*
  * This means that the Gx level doesn't have a dependency on Cx level.
  */
  if (vlvl == 0xffffffff) {
L248: void adreno_rpmh_build_bw_table_cmd(struct hfi_bwtable_cmd *cmd, struct rpmh_bw_votes *ddr,
  }
  
  struct rpmh_bw_votes *cnoc)
  {

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_rpmh.h =====
L7: #ifndef _ADRENO_GMU_RPMH_H
  */
  
  #define _ADRENO_GMU_RPMH_H
  
L8: #define _ADRENO_GMU_RPMH_H
  
  #ifndef _ADRENO_GMU_RPMH_H
  
  struct rpmh_arc_vals {
L97: * @gmu_ab: Indicate if GMU supports AB vote
  * @perfmode_vote: Performance mode vote
  * @perfmode_lvl: Initial performance level for performance mode vote
  *
  * Return: Pointer to the rpmh_bw_votes structure on success, or an error pointer failure
L102: u32 *levels, int levels_count, u32 perfmode_vote, u32 perfmode_lvl, bool gmu_ab);
  */
  struct rpmh_bw_votes *adreno_rpmh_build_bw_votes(struct bcm *bcms, int bcm_count,
  
  /**
L116: * @cmd: Pointer to the hfi_bwtable_cmd structure
  /**
  * adreno_rpmh_build_bw_table_cmd - Build bandwidth table command
  * @ddr: Pointer to the DDR RPMh bandwidth votes
  * @cnoc: Pointer to the CNOC RPMh bandwidth votes
L120: void adreno_rpmh_build_bw_table_cmd(struct hfi_bwtable_cmd *cmd, struct rpmh_bw_votes *ddr,
  * @cnoc: Pointer to the CNOC RPMh bandwidth votes
  */
  struct rpmh_bw_votes *cnoc);
  #endif

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_snapshot.c =====
L23: struct adreno_ringbuffer *rb;
  struct snapshot_rb_params {
  struct kgsl_snapshot *snapshot;
  };
  
L211: * During restore after preemption, ib1base in the register
  if (adreno_ib_addr_overlap(snapshot->ib1base, gpuaddr, dwords)) {
  /*
  * can be updated by CP. In such scenarios, to dump complete
  * IB1 in snapshot, we should consider ib1base from ringbuffer.
L213: * IB1 in snapshot, we should consider ib1base from ringbuffer.
  * During restore after preemption, ib1base in the register
  * can be updated by CP. In such scenarios, to dump complete
  */
  snapshot->ib1base = gpuaddr;
L249: * During restore after preemption, ib1base in the register
  if (adreno_ib_addr_overlap(snapshot->ib1base_lpac, gpuaddr, dwords)) {
  /*
  * can be updated by CP. In such scenarios, to dump complete
  * IB1 in snapshot, we should consider ib1base from ringbuffer.
L251: * IB1 in snapshot, we should consider ib1base from ringbuffer.
  * During restore after preemption, ib1base in the register
  * can be updated by CP. In such scenarios, to dump complete
  */
  snapshot->ib1base_lpac = gpuaddr;
L278: struct kgsl_iommu *iommu = KGSL_IOMMU(device);
  int index = 0;
  struct adreno_device *adreno_dev = ADRENO_DEVICE(device);
  
  for (index = 0; index < KGSL_RB_DWORDS;) {
L292: if (kgsl_gpuaddr_in_memdesc(iommu->setstate,
  
  /* Don't parse known global IBs */
  ibaddr, ibsize))
  continue;
L315: struct adreno_ringbuffer *rb,
  */
  static void snapshot_rb_ibs(struct kgsl_device *device,
  struct kgsl_snapshot *snapshot)
  {
L343: * Figure out the window of ringbuffer data to dump.  First we need to
  
  /*
  * find where the last processed IB ws submitted.  Start walking back
  * from the rptr
L373: * During restore after preemption, ib1base in
  ibaddr, ibsize)) {
  /*
  * the register can be updated by CP. In such
  * scenario, to dump complete IB1 in snapshot,
L376: * we should consider ib1base from ringbuffer.
  * the register can be updated by CP. In such
  * scenario, to dump complete IB1 in snapshot,
  */
  snapshot->ib1base = ibaddr;
L387: * incorrectly after preemption, then simply dump the entire
  /*
  * If the ib1 was not found, for example, if ib1base was restored
  * ringbuffer along with all the IBs in the ringbuffer.
  */
L388: * ringbuffer along with all the IBs in the ringbuffer.
  * If the ib1 was not found, for example, if ib1base was restored
  * incorrectly after preemption, then simply dump the entire
  */
  
L452: struct kgsl_iommu *iommu = KGSL_IOMMU(device);
  
  if (parse_ibs && adreno_cmd_is_ib(adreno_dev, rbptr[index])) {
  uint64_t ibaddr;
  uint64_t ibsize;
L463: if (kgsl_gpuaddr_in_memdesc(iommu->setstate,
  
  /* Don't parse known global IBs */
  ibaddr, ibsize))
  continue;
L479: /* Snapshot the ringbuffer memory */
  }
  
  static size_t snapshot_rb(struct kgsl_device *device, u8 *buf,
  size_t remain, void *priv)
L488: struct adreno_ringbuffer *rb = snap_rb_params->rb;
  struct snapshot_rb_params *snap_rb_params = priv;
  struct kgsl_snapshot *snapshot = snap_rb_params->snapshot;
  
  /*
L491: * Dump the entire ringbuffer - the parser can choose how much of it to
  
  /*
  * process
  */
L508: adreno_rb_readtimestamp(adreno_dev, rb, KGSL_TIMESTAMP_QUEUED,
  header->rbsize = KGSL_RB_DWORDS;
  header->count = KGSL_RB_DWORDS;
  &header->timestamp_queued);
  adreno_rb_readtimestamp(adreno_dev, rb, KGSL_TIMESTAMP_RETIRED,
L509: &header->timestamp_queued);
  header->count = KGSL_RB_DWORDS;
  adreno_rb_readtimestamp(adreno_dev, rb, KGSL_TIMESTAMP_QUEUED,
  adreno_rb_readtimestamp(adreno_dev, rb, KGSL_TIMESTAMP_RETIRED,
  &header->timestamp_retired);
L510: adreno_rb_readtimestamp(adreno_dev, rb, KGSL_TIMESTAMP_RETIRED,
  adreno_rb_readtimestamp(adreno_dev, rb, KGSL_TIMESTAMP_QUEUED,
  &header->timestamp_queued);
  &header->timestamp_retired);
  header->gpuaddr = rb->buffer_desc->gpuaddr;
L511: &header->timestamp_retired);
  &header->timestamp_queued);
  adreno_rb_readtimestamp(adreno_dev, rb, KGSL_TIMESTAMP_RETIRED,
  header->gpuaddr = rb->buffer_desc->gpuaddr;
  header->id = rb->id;
L518: /* Just copy the ringbuffer, there are no active IBs */
  snapshot_rb_ibs(device, rb, snapshot);
  
  memcpy(data, rb->buffer_desc->hostptr, KGSL_RB_SIZE);
  
L832: proc_ptbase |= FIELD_PREP(GENMASK_ULL(63, KGSL_IOMMU_ASID_START_BIT), asid);
  proc_ptbase = kgsl_mmu_pagetable_get_ttbr0(process->pagetable);
  if (asid >= 0)
  
  /* agreement! No need to check further */
L903: /* Snapshot IOMMU specific buffers */
  }
  
  static void adreno_snapshot_iommu(struct kgsl_device *device,
  struct kgsl_snapshot *snapshot)
L904: static void adreno_snapshot_iommu(struct kgsl_device *device,
  
  /* Snapshot IOMMU specific buffers */
  struct kgsl_snapshot *snapshot)
  {
L908: struct kgsl_iommu *iommu = KGSL_IOMMU(device);
  {
  struct adreno_device *adreno_dev = ADRENO_DEVICE(device);
  
  kgsl_snapshot_add_section(device, KGSL_SNAPSHOT_SECTION_GPU_OBJECT_V2,
L911: snapshot, adreno_snapshot_global, iommu->setstate);
  
  kgsl_snapshot_add_section(device, KGSL_SNAPSHOT_SECTION_GPU_OBJECT_V2,
  
  if (adreno_is_preemption_enabled(adreno_dev))
L913: if (adreno_is_preemption_enabled(adreno_dev))
  snapshot, adreno_snapshot_global, iommu->setstate);
  
  kgsl_snapshot_add_section(device,
  KGSL_SNAPSHOT_SECTION_GPU_OBJECT_V2,
L916: snapshot, adreno_snapshot_global, iommu->smmu_info);
  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_snapshot.h =====
L12: /* Number of dwords to dump in snapshot for CP SQE */
  #include "kgsl_snapshot.h"
  
  #define SQE_FW_SNAPSHOT_DWORDS 5
  /* Number of dwords to dump in snapshot for CP AQE */
L13: #define SQE_FW_SNAPSHOT_DWORDS 5
  
  /* Number of dwords to dump in snapshot for CP SQE */
  /* Number of dwords to dump in snapshot for CP AQE */
  #define AQE_FW_SNAPSHOT_DWORDS 6
L143: * adreno_snapshot_dump_all_ibs - To dump all ibs from ringbuffer
  
  /**
  * @device: Pointer to the kgsl device
  * @rbptr: Ringbuffer host pointer
L145: * @rbptr: Ringbuffer host pointer
  * adreno_snapshot_dump_all_ibs - To dump all ibs from ringbuffer
  * @device: Pointer to the kgsl device
  * @snapshot: Pointer to the snapshot structure
  *
L148: * Parse all IBs from the ringbuffer and add to IB dump list.
  * @snapshot: Pointer to the snapshot structure
  *
  */
  void adreno_snapshot_dump_all_ibs(struct kgsl_device *device,
L155: * adreno_snapshot_gmu_versions - To dump gmu versions info to snapshot buffer
  
  /**
  * @device: Pointer to the kgsl device
  * @snapshot: Pointer to the snapshot structure
L159: * Dump gmu versions info to the snapshot buffer.
  * @snapshot: Pointer to the snapshot structure
  *
  */
  void adreno_snapshot_gmu_versions(struct kgsl_device *device,
L161: void adreno_snapshot_gmu_versions(struct kgsl_device *device,
  * Dump gmu versions info to the snapshot buffer.
  */
  struct kgsl_snapshot *snapshot);
  
L165: * kgsl_snapshot_gmu_mem - Snapshot a GMU memory descriptor
  
  /**
  * @device: Pointer to the kgsl device
  * @buf: Destination snapshot buffer
L173: size_t adreno_snapshot_gmu_mem(struct kgsl_device *device,
  * Return: Number of bytes written to snapshot buffer
  */
  u8 *buf, size_t remain, void *priv);
  
L177: * adreno_snapshot_preemption_record - To dump preemption related buffers
  
  /**
  * @device: Pointer to the kgsl device
  * @snapshot: Pointer to the snapshot structure
L181: * Snapshot the preemption related buffers .
  * @snapshot: Pointer to the snapshot structure
  *
  */
  void adreno_snapshot_preemption_record(struct kgsl_device *device,
L183: void adreno_snapshot_preemption_record(struct kgsl_device *device,
  * Snapshot the preemption related buffers .
  */
  struct kgsl_snapshot *snapshot);
  

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_sysfs.c =====
L10: #include <linux/firmware/qcom/qcom_scm.h>
  #include <linux/version.h>
  #if (KERNEL_VERSION(6, 3, 0) <= LINUX_VERSION_CODE)
  #else
  #include <linux/qcom_scm.h>
L409: return gmu_core_dev_ifpc_store(KGSL_DEVICE(adreno_dev), val);
  static int _ifpc_store(struct adreno_device *adreno_dev, bool val)
  {
  }
  
L414: return gmu_core_dev_ifpc_isenabled(KGSL_DEVICE(adreno_dev));
  static bool _ifpc_show(struct adreno_device *adreno_dev)
  {
  }
  
L446: return gmu_core_dev_acd_set(KGSL_DEVICE(adreno_dev), val);
  static int _acd_store(struct adreno_device *adreno_dev, bool val)
  {
  }
  
L449: static bool _gmu_ab_show(struct adreno_device *adreno_dev)
  }
  
  {
  return adreno_dev->gmu_ab;
L451: return adreno_dev->gmu_ab;
  static bool _gmu_ab_show(struct adreno_device *adreno_dev)
  {
  }
  
L454: static int _gmu_ab_store(struct adreno_device *adreno_dev, bool val)
  }
  
  {
  if (!test_bit(ADRENO_DEVICE_GMU_AB, &adreno_dev->priv) ||
L456: if (!test_bit(ADRENO_DEVICE_GMU_AB, &adreno_dev->priv) ||
  static int _gmu_ab_store(struct adreno_device *adreno_dev, bool val)
  {
  (adreno_dev->gmu_ab == val))
  return 0;
L457: (adreno_dev->gmu_ab == val))
  {
  if (!test_bit(ADRENO_DEVICE_GMU_AB, &adreno_dev->priv) ||
  return 0;
  
L461: return adreno_power_cycle_bool(adreno_dev, &adreno_dev->gmu_ab, val);
  
  /* Power cycle the GPU for changes to take effect */
  }
  
L678: static ADRENO_SYSFS_BOOL(gmu_ab);
  static ADRENO_SYSFS_BOOL(dms);
  static ADRENO_SYSFS_BOOL(touch_wake);
  static ADRENO_SYSFS_BOOL(dcvs_profile_enabled);
  
L715: &adreno_attr_gmu_ab.attr.attr,
  &adreno_attr_dms.attr.attr,
  &adreno_attr_touch_wake.attr.attr,
  &adreno_attr_clx.attr.attr,
  &dev_attr_gpufaults.attr,
L739: struct device *gmu_dev;
  {
  struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
  int ret;
  
L752: /* Add a soft link for gmu device */
  }
  
  if (gmu_core_isenabled(device)) {
  gmu_dev =  GMU_PDEV_DEV(device);
L753: if (gmu_core_isenabled(device)) {
  
  /* Add a soft link for gmu device */
  gmu_dev =  GMU_PDEV_DEV(device);
  WARN_ON(sysfs_create_link(&device->dev->kobj, &gmu_dev->kobj, "gmu"));
L754: gmu_dev =  GMU_PDEV_DEV(device);
  /* Add a soft link for gmu device */
  if (gmu_core_isenabled(device)) {
  WARN_ON(sysfs_create_link(&device->dev->kobj, &gmu_dev->kobj, "gmu"));
  }
L755: WARN_ON(sysfs_create_link(&device->dev->kobj, &gmu_dev->kobj, "gmu"));
  if (gmu_core_isenabled(device)) {
  gmu_dev =  GMU_PDEV_DEV(device);
  }
  return ret;

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno_trace.h =====
L21: #include "adreno_hfi.h"
  #include "adreno_gen7.h"
  #include "adreno_gen8.h"
  
  #if (KERNEL_VERSION(6, 10, 0) > LINUX_VERSION_CODE)
L44: __field(unsigned int, timestamp)
  TP_STRUCT__entry(
  __field(unsigned int, id)
  __field(unsigned int, queued)
  __field(unsigned int, flags)
L51: __entry->timestamp = drawobj->timestamp;
  TP_fast_assign(
  __entry->id = drawobj->context->id;
  __entry->queued = queued;
  __entry->flags = drawobj->flags;
L59: __entry->timestamp, __entry->queued,
  "ctx=%u ctx_prio=%u ts=%u queued=%u flags=%s",
  __entry->id, __entry->prio,
  __entry->flags ? __print_flags(__entry->flags, "|",
  KGSL_DRAWOBJ_FLAGS) : "none"
L113: GMU_SYNCOBJ_FLAGS) : "none",
  __entry->id,  __entry->context, __entry->seqno,
  __entry->flags ? __print_flags(__entry->flags, "|",
  __get_str(fence_name))
  );
L118: TP_PROTO(u32 id, u32 timestamp, uint64_t ticks),
  
  TRACE_EVENT(adreno_syncobj_query_reply,
  TP_ARGS(id, timestamp, ticks),
  TP_STRUCT__entry(
L119: TP_ARGS(id, timestamp, ticks),
  TRACE_EVENT(adreno_syncobj_query_reply,
  TP_PROTO(u32 id, u32 timestamp, uint64_t ticks),
  TP_STRUCT__entry(
  __field(u32, id)
L122: __field(u32, timestamp)
  TP_STRUCT__entry(
  __field(u32, id)
  __field(uint64_t, ticks)
  ),
L127: __entry->timestamp = timestamp;
  TP_fast_assign(
  __entry->id = id;
  __entry->ticks = ticks;
  ),
L132: __entry->id, __entry->timestamp, __entry->ticks)
  TP_printk(
  "ctx=%u ts=%u ticks=%lld",
  );
  
L136: TP_PROTO(u32 id, u32 timestamp, uint64_t ticks),
  
  TRACE_EVENT(adreno_syncobj_query,
  TP_ARGS(id, timestamp, ticks),
  TP_STRUCT__entry(
L137: TP_ARGS(id, timestamp, ticks),
  TRACE_EVENT(adreno_syncobj_query,
  TP_PROTO(u32 id, u32 timestamp, uint64_t ticks),
  TP_STRUCT__entry(
  __field(u32, id)
L140: __field(u32, timestamp)
  TP_STRUCT__entry(
  __field(u32, id)
  __field(uint64_t, ticks)
  ),
L145: __entry->timestamp = timestamp;
  TP_fast_assign(
  __entry->id = id;
  __entry->ticks = ticks;
  ),
L150: __entry->id, __entry->timestamp, __entry->ticks)
  TP_printk(
  "ctx=%u ts=%u ticks=%lld",
  );
  
L154: TP_PROTO(u32 id, u32 timestamp, u32 num_syncobj,
  
  TRACE_EVENT(adreno_syncobj_submitted,
  uint64_t ticks),
  TP_ARGS(id, timestamp, num_syncobj, ticks),
L156: TP_ARGS(id, timestamp, num_syncobj, ticks),
  TP_PROTO(u32 id, u32 timestamp, u32 num_syncobj,
  uint64_t ticks),
  TP_STRUCT__entry(
  __field(u32, id)
L159: __field(u32, timestamp)
  TP_STRUCT__entry(
  __field(u32, id)
  __field(u32, num_syncobj)
  __field(uint64_t, ticks)
L165: __entry->timestamp = timestamp;
  TP_fast_assign(
  __entry->id = id;
  __entry->num_syncobj = num_syncobj;
  __entry->ticks = ticks;
L171: __entry->id, __entry->timestamp, __entry->num_syncobj, __entry->ticks)
  TP_printk(
  "ctx=%u ts=%u num_sync=%u ticks=%lld",
  );
  
L175: TP_PROTO(u32 id, u32 timestamp, u64 ticks),
  
  TRACE_EVENT(adreno_syncobj_retired,
  TP_ARGS(id, timestamp, ticks),
  TP_STRUCT__entry(
L176: TP_ARGS(id, timestamp, ticks),
  TRACE_EVENT(adreno_syncobj_retired,
  TP_PROTO(u32 id, u32 timestamp, u64 ticks),
  TP_STRUCT__entry(
  __field(u32, id)
L179: __field(u32, timestamp)
  TP_STRUCT__entry(
  __field(u32, id)
  __field(u64, ticks)
  ),
L184: __entry->timestamp = timestamp;
  TP_fast_assign(
  __entry->id = id;
  __entry->ticks = ticks;
  ),
L188: "ctx=%u ts=%u ticks=%llu", __entry->id, __entry->timestamp, __entry->ticks)
  ),
  TP_printk(
  );
  
L198: __field(unsigned int, timestamp)
  TP_STRUCT__entry(
  __field(unsigned int, id)
  __field(int, inflight)
  __field(unsigned int, flags)
L213: __entry->timestamp = drawobj->timestamp;
  TP_fast_assign(
  __entry->id = drawobj->context->id;
  __entry->inflight = info->inflight;
  __entry->flags = drawobj->flags;
L224: __entry->dispatch_queue = info->gmu_dispatch_queue;
  __entry->wptr = info->wptr;
  __entry->q_inflight = q_inflight;
  ),
  TP_printk(
L228: __entry->id, __entry->prio, __entry->timestamp,
  TP_printk(
  "ctx=%u ctx_prio=%d ts=%u inflight=%d flags=%s ticks=%lld time=%lu.%0lu rb_id=%d r/w=%x/%x, q_inflight=%d dq_id=%d",
  __entry->inflight,
  __entry->flags ? __print_flags(__entry->flags, "|",
L245: __field(unsigned int, timestamp)
  TP_STRUCT__entry(
  __field(unsigned int, id)
  __field(int, inflight)
  __field(unsigned int, recovery)

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\adreno-gpulist.h =====
L137: ADRENO_PREEMPTION |
  DEFINE_ADRENO_REV(ADRENO_REV_A530, 5, 3, 0, 1),
  .features = ADRENO_SPTP_PC | ADRENO_LM |
  ADRENO_CONTENT_PROTECTION,
  .gpudev = &adreno_a5xx_gpudev,
L153: .zap_name = "a530_zap.mdt",
  .gpmufw_name = "a530_gpmu.fw2",
  .regfw_name = "a530v2_seq.fw2",
  .hwcg = a530_hwcg_regs,
  .hwcg_count = ARRAY_SIZE(a530_hwcg_regs),
L164: ADRENO_PREEMPTION |
  DEFINE_ADRENO_REV(ADRENO_REV_A530, 5, 3, 0, ANY_ID),
  .features = ADRENO_SPTP_PC | ADRENO_LM |
  ADRENO_CONTENT_PROTECTION,
  .gpudev = &adreno_a5xx_gpudev,
L180: .zap_name = "a530_zap.mdt",
  .gpmufw_name = "a530v3_gpmu.fw2",
  .regfw_name = "a530v3_seq.fw2",
  .hwcg = a530_hwcg_regs,
  .hwcg_count = ARRAY_SIZE(a530_hwcg_regs),
L232: .features = ADRENO_PREEMPTION,
  .base = {
  DEFINE_ADRENO_REV(ADRENO_REV_A505, 5, 0, 5, ANY_ID),
  .gpudev = &adreno_a5xx_gpudev,
  .perfcounters = &adreno_a5xx_perfcounters,
L251: .features = ADRENO_PREEMPTION |
  .base = {
  DEFINE_ADRENO_REV(ADRENO_REV_A506, 5, 0, 6, ANY_ID),
  ADRENO_CONTENT_PROTECTION | ADRENO_CPZ_RETENTION,
  .gpudev = &adreno_a5xx_gpudev,
L263: .zap_name = "a506_zap.mdt",
  .pm4fw_name = "a530_pm4.fw",
  .pfpfw_name = "a530_pfp.fw",
  .hwcg = a50x_hwcg_regs,
  .hwcg_count = ARRAY_SIZE(a50x_hwcg_regs),
L455: .features = ADRENO_PREEMPTION |
  .base = {
  DEFINE_ADRENO_REV(ADRENO_REV_A540, 5, 4, 0, ANY_ID),
  ADRENO_CONTENT_PROTECTION |
  ADRENO_SPTP_PC,
L471: .zap_name = "a540_zap.mdt",
  .pfpfw_name = "a530_pfp.fw",
  .gpmufw_name = "a540_gpmu.fw2",
  .hwcg = a540_hwcg_regs,
  .hwcg_count = ARRAY_SIZE(a540_hwcg_regs),
L540: .features = ADRENO_PREEMPTION |
  .base = {
  DEFINE_ADRENO_REV(ADRENO_REV_A512, 5, 1, 2, ANY_ID),
  ADRENO_CONTENT_PROTECTION | ADRENO_CPZ_RETENTION,
  .gpudev = &adreno_a5xx_gpudev,
L552: .zap_name = "a512_zap.mdt",
  .pm4fw_name = "a530_pm4.fw",
  .pfpfw_name = "a530_pfp.fw",
  .hwcg = a512_hwcg_regs,
  .hwcg_count = ARRAY_SIZE(a512_hwcg_regs),
L560: .features = ADRENO_PREEMPTION |
  .base = {
  DEFINE_ADRENO_REV(ADRENO_REV_A508, 5, 0, 8, ANY_ID),
  ADRENO_CONTENT_PROTECTION | ADRENO_CPZ_RETENTION,
  .gpudev = &adreno_a5xx_gpudev,
L572: .zap_name = "a508_zap.mdt",
  .pm4fw_name = "a530_pm4.fw",
  .pfpfw_name = "a530_pfp.fw",
  .hwcg = a50x_hwcg_regs,
  .hwcg_count = ARRAY_SIZE(a50x_hwcg_regs),
L684: {A6XX_RBBM_CLOCK_CNTL_GMU_GX, 0x00000222},
  {A6XX_RBBM_CLOCK_DELAY_HLSQ_2, 0x00000002},
  {A6XX_RBBM_CLOCK_MODE_HLSQ, 0x00002222},
  {A6XX_RBBM_CLOCK_DELAY_GMU_GX, 0x00000111},
  {A6XX_RBBM_CLOCK_HYST_GMU_GX, 0x00000555},
L685: {A6XX_RBBM_CLOCK_DELAY_GMU_GX, 0x00000111},
  {A6XX_RBBM_CLOCK_MODE_HLSQ, 0x00002222},
  {A6XX_RBBM_CLOCK_CNTL_GMU_GX, 0x00000222},
  {A6XX_RBBM_CLOCK_HYST_GMU_GX, 0x00000555},
  };
L686: {A6XX_RBBM_CLOCK_HYST_GMU_GX, 0x00000555},
  {A6XX_RBBM_CLOCK_CNTL_GMU_GX, 0x00000222},
  {A6XX_RBBM_CLOCK_DELAY_GMU_GX, 0x00000111},
  };
  
L736: ADRENO_IOCOHERENT | ADRENO_PREEMPTION,
  DEFINE_ADRENO_REV(ADRENO_REV_A630, 6, 3, 0, ANY_ID),
  .features = ADRENO_IFPC | ADRENO_CONTENT_PROTECTION |
  .gpudev = &adreno_a630_gpudev.base,
  .perfcounters = &adreno_a630_perfcounters,
L746: .gmu_major = 1,
  },
  .prim_fifo_threshold = 0x0018000,
  .gmu_minor = 3,
  .sqefw_name = "a630_sqe.fw",
L747: .gmu_minor = 3,
  .prim_fifo_threshold = 0x0018000,
  .gmu_major = 1,
  .sqefw_name = "a630_sqe.fw",
  .gmufw_name = "a630_gmu.bin",
L748: .sqefw_name = "a630_sqe.fw",
  .gmu_major = 1,
  .gmu_minor = 3,
  .gmufw_name = "a630_gmu.bin",
  .zap_name = "a630_zap.mdt",
L749: .gmufw_name = "a630_gmu.bin",
  .gmu_minor = 3,
  .sqefw_name = "a630_sqe.fw",
  .zap_name = "a630_zap.mdt",
  .hwcg = a630_hwcg_regs,
L750: .zap_name = "a630_zap.mdt",
  .sqefw_name = "a630_sqe.fw",
  .gmufw_name = "a630_gmu.bin",
  .hwcg = a630_hwcg_regs,
  .hwcg_count = ARRAY_SIZE(a630_hwcg_regs),
L821: {A6XX_RBBM_CLOCK_CNTL_GMU_GX, 0x00000222},
  {A6XX_RBBM_CLOCK_DELAY_HLSQ_2, 0x00000002},
  {A6XX_RBBM_CLOCK_MODE_HLSQ, 0x00002222},
  {A6XX_RBBM_CLOCK_DELAY_GMU_GX, 0x00000111},
  {A6XX_RBBM_CLOCK_HYST_GMU_GX, 0x00000555}
L822: {A6XX_RBBM_CLOCK_DELAY_GMU_GX, 0x00000111},
  {A6XX_RBBM_CLOCK_MODE_HLSQ, 0x00002222},
  {A6XX_RBBM_CLOCK_CNTL_GMU_GX, 0x00000222},
  {A6XX_RBBM_CLOCK_HYST_GMU_GX, 0x00000555}
  };
L823: {A6XX_RBBM_CLOCK_HYST_GMU_GX, 0x00000555}
  {A6XX_RBBM_CLOCK_CNTL_GMU_GX, 0x00000222},
  {A6XX_RBBM_CLOCK_DELAY_GMU_GX, 0x00000111},
  };
  
L834: .features = ADRENO_PREEMPTION |
  .base = {
  DEFINE_ADRENO_REV(ADRENO_REV_A615, 6, 1, 5, ANY_ID),
  ADRENO_CONTENT_PROTECTION | ADRENO_IFPC |
  ADRENO_IOCOHERENT,
L846: .gmu_major = 1,
  },
  .prim_fifo_threshold = 0x0018000,
  .gmu_minor = 3,
  .sqefw_name = "a630_sqe.fw",
L847: .gmu_minor = 3,
  .prim_fifo_threshold = 0x0018000,
  .gmu_major = 1,
  .sqefw_name = "a630_sqe.fw",
  .gmufw_name = "a630_gmu.bin",
L848: .sqefw_name = "a630_sqe.fw",
  .gmu_major = 1,
  .gmu_minor = 3,
  .gmufw_name = "a630_gmu.bin",
  .zap_name = "a615_zap.mdt",
L849: .gmufw_name = "a630_gmu.bin",
  .gmu_minor = 3,
  .sqefw_name = "a630_sqe.fw",
  .zap_name = "a615_zap.mdt",
  .hwcg = a615_hwcg_regs,

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\downstream_dependencies\linux\qcom-iommu-util.h =====
L7: #ifndef __QCOM_IOMMU_UTIL_H
  */
  
  #define __QCOM_IOMMU_UTIL_H
  
L8: #define __QCOM_IOMMU_UTIL_H
  
  #ifndef __QCOM_IOMMU_UTIL_H
  
  #include <linux/iommu.h>
L10: #include <linux/iommu.h>
  #define __QCOM_IOMMU_UTIL_H
  
  
  #include <soc/qcom/secure_buffer.h>
L14: /* IOMMU fault behaviors */
  #include <soc/qcom/secure_buffer.h>
  
  #define QCOM_IOMMU_FAULT_MODEL_NO_STALL	BIT(2)
  #define QCOM_IOMMU_FAULT_MODEL_NON_FATAL	BIT(0)
L15: #define QCOM_IOMMU_FAULT_MODEL_NO_STALL	BIT(2)
  
  /* IOMMU fault behaviors */
  #define QCOM_IOMMU_FAULT_MODEL_NON_FATAL	BIT(0)
  
L16: #define QCOM_IOMMU_FAULT_MODEL_NON_FATAL	BIT(0)
  /* IOMMU fault behaviors */
  #define QCOM_IOMMU_FAULT_MODEL_NO_STALL	BIT(2)
  
  #ifndef IOMMU_SYS_CACHE
L18: #ifndef IOMMU_SYS_CACHE
  #define QCOM_IOMMU_FAULT_MODEL_NON_FATAL	BIT(0)
  
  /* Attributes are not supported, so render them ineffective. */
  #define IOMMU_SYS_CACHE		(0)
L20: #define IOMMU_SYS_CACHE		(0)
  #ifndef IOMMU_SYS_CACHE
  /* Attributes are not supported, so render them ineffective. */
  #define IOMMU_SYS_CACHE_NWA	(0)
  #endif
L21: #define IOMMU_SYS_CACHE_NWA	(0)
  /* Attributes are not supported, so render them ineffective. */
  #define IOMMU_SYS_CACHE		(0)
  #endif
  
L25: #define IOMMU_USE_UPSTREAM_HINT	(IOMMU_SYS_CACHE)
  
  /* Use upstream device's bus attribute */
  
  /* Use upstream device's bus attribute with no write-allocate cache policy */
L28: #define IOMMU_USE_LLC_NWA	(IOMMU_SYS_CACHE_NWA)
  
  /* Use upstream device's bus attribute with no write-allocate cache policy */
  
  /* vendor iommu fault flags */
L30: /* vendor iommu fault flags */
  #define IOMMU_USE_LLC_NWA	(IOMMU_SYS_CACHE_NWA)
  
  #define IOMMU_FAULT_TRANSLATION         (1 << 2)
  #define IOMMU_FAULT_PERMISSION          (1 << 3)
L31: #define IOMMU_FAULT_TRANSLATION         (1 << 2)
  
  /* vendor iommu fault flags */
  #define IOMMU_FAULT_PERMISSION          (1 << 3)
  #define IOMMU_FAULT_EXTERNAL            (1 << 4)
L32: #define IOMMU_FAULT_PERMISSION          (1 << 3)
  /* vendor iommu fault flags */
  #define IOMMU_FAULT_TRANSLATION         (1 << 2)
  #define IOMMU_FAULT_EXTERNAL            (1 << 4)
  #define IOMMU_FAULT_TRANSACTION_STALLED (1 << 5)
L33: #define IOMMU_FAULT_EXTERNAL            (1 << 4)
  #define IOMMU_FAULT_TRANSLATION         (1 << 2)
  #define IOMMU_FAULT_PERMISSION          (1 << 3)
  #define IOMMU_FAULT_TRANSACTION_STALLED (1 << 5)
  
L34: #define IOMMU_FAULT_TRANSACTION_STALLED (1 << 5)
  #define IOMMU_FAULT_PERMISSION          (1 << 3)
  #define IOMMU_FAULT_EXTERNAL            (1 << 4)
  
  static inline int qcom_iommu_set_fault_model(struct iommu_domain *domain, int fault_model)
L36: static inline int qcom_iommu_set_fault_model(struct iommu_domain *domain, int fault_model)
  #define IOMMU_FAULT_TRANSACTION_STALLED (1 << 5)
  
  {
  return -EINVAL;
L41: static inline int qcom_iommu_get_context_bank_nr(struct iommu_domain *domain)
  }
  
  {
  return 0;
L46: static inline int qcom_iommu_get_asid_nr(struct iommu_domain *domain)
  }
  
  {
  return 0;
L51: static inline int qcom_iommu_set_secure_vmid(struct iommu_domain *domain, enum vmid vmid)
  }
  
  {
  return -EINVAL;
L61: #endif /* __QCOM_IOMMU_UTIL_H */
  }
  

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\downstream_dependencies\msm_hw_fence.h =====
L52: * struct msm_hw_fence_hfi_queue_table_header - HFI queue table structure.
  
  /**
  * @version: HFI protocol version.
  * @size: Queue table size in dwords.
L53: * @version: HFI protocol version.
  /**
  * struct msm_hw_fence_hfi_queue_table_header - HFI queue table structure.
  * @size: Queue table size in dwords.
  * @qhdr0_offset: First queue header offset (dwords) in this table.
L60: struct msm_hw_fence_hfi_queue_table_header {
  * @num_active_q: Number of active queues.
  */
  u32 version;
  u32 size;
L70: * struct msm_hw_fence_hfi_queue_header - HFI queue header structure.
  
  /**
  * @status: Active = 1, Inactive = 0.
  * @start_addr: Starting address of the queue.
L90: struct msm_hw_fence_hfi_queue_header {
  * @write_index: write index of the queue.
  */
  u32 status;
  u32 start_addr;

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\downstream_dependencies\soc\qcom\msm_performance.h =====
L23: uint32_t ctx_id, uint32_t timestamp, bool end_of_frame)
  static inline void msm_perf_events_update(enum evt_update_t update_typ,
  enum gfx_evt_t evt_typ, pid_t pid,
  {
  }

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\gen7_reg.h =====
L46: #define GEN7_CP_SQE_CNTL                 0x808
  #define GEN7_CP_RB_RPTR                  0x806
  #define GEN7_CP_RB_WPTR                  0x807
  #define GEN7_CP_CP2GMU_STATUS            0x812
  #define GEN7_CP_HW_FAULT                 0x821
L47: #define GEN7_CP_CP2GMU_STATUS            0x812
  #define GEN7_CP_RB_WPTR                  0x807
  #define GEN7_CP_SQE_CNTL                 0x808
  #define GEN7_CP_HW_FAULT                 0x821
  #define GEN7_CP_INTERRUPT_STATUS         0x823
L52: #define GEN7_CP_SQE_INSTR_BASE_LO        0x830
  #define GEN7_CP_PROTECT_STATUS           0x824
  #define GEN7_CP_STATUS_1                 0x825
  #define GEN7_CP_SQE_INSTR_BASE_HI        0x831
  #define GEN7_CP_MISC_CNTL                0x840
L53: #define GEN7_CP_SQE_INSTR_BASE_HI        0x831
  #define GEN7_CP_STATUS_1                 0x825
  #define GEN7_CP_SQE_INSTR_BASE_LO        0x830
  #define GEN7_CP_MISC_CNTL                0x840
  #define GEN7_CP_CHICKEN_DBG              0x841
L61: #define GEN7_CP_CONTEXT_SWITCH_CNTL      0x8a0
  #define GEN7_CP_PROTECT_CNTL             0x84f
  #define GEN7_CP_PROTECT_REG              0x850
  #define GEN7_CP_CONTEXT_SWITCH_SMMU_INFO_LO 0x8a1
  #define GEN7_CP_CONTEXT_SWITCH_SMMU_INFO_HI 0x8a2
L62: #define GEN7_CP_CONTEXT_SWITCH_SMMU_INFO_LO 0x8a1
  #define GEN7_CP_PROTECT_REG              0x850
  #define GEN7_CP_CONTEXT_SWITCH_CNTL      0x8a0
  #define GEN7_CP_CONTEXT_SWITCH_SMMU_INFO_HI 0x8a2
  #define GEN7_CP_CONTEXT_SWITCH_PRIV_NON_SECURE_RESTORE_ADDR_LO 0x8a3
L63: #define GEN7_CP_CONTEXT_SWITCH_SMMU_INFO_HI 0x8a2
  #define GEN7_CP_CONTEXT_SWITCH_CNTL      0x8a0
  #define GEN7_CP_CONTEXT_SWITCH_SMMU_INFO_LO 0x8a1
  #define GEN7_CP_CONTEXT_SWITCH_PRIV_NON_SECURE_RESTORE_ADDR_LO 0x8a3
  #define GEN7_CP_CONTEXT_SWITCH_PRIV_NON_SECURE_RESTORE_ADDR_HI 0x8a4
L64: #define GEN7_CP_CONTEXT_SWITCH_PRIV_NON_SECURE_RESTORE_ADDR_LO 0x8a3
  #define GEN7_CP_CONTEXT_SWITCH_SMMU_INFO_LO 0x8a1
  #define GEN7_CP_CONTEXT_SWITCH_SMMU_INFO_HI 0x8a2
  #define GEN7_CP_CONTEXT_SWITCH_PRIV_NON_SECURE_RESTORE_ADDR_HI 0x8a4
  #define GEN7_CP_CONTEXT_SWITCH_PRIV_SECURE_RESTORE_ADDR_LO     0x8a5
L65: #define GEN7_CP_CONTEXT_SWITCH_PRIV_NON_SECURE_RESTORE_ADDR_HI 0x8a4
  #define GEN7_CP_CONTEXT_SWITCH_SMMU_INFO_HI 0x8a2
  #define GEN7_CP_CONTEXT_SWITCH_PRIV_NON_SECURE_RESTORE_ADDR_LO 0x8a3
  #define GEN7_CP_CONTEXT_SWITCH_PRIV_SECURE_RESTORE_ADDR_LO     0x8a5
  #define GEN7_CP_CONTEXT_SWITCH_PRIV_SECURE_RESTORE_ADDR_HI     0x8a6
L66: #define GEN7_CP_CONTEXT_SWITCH_PRIV_SECURE_RESTORE_ADDR_LO     0x8a5
  #define GEN7_CP_CONTEXT_SWITCH_PRIV_NON_SECURE_RESTORE_ADDR_LO 0x8a3
  #define GEN7_CP_CONTEXT_SWITCH_PRIV_NON_SECURE_RESTORE_ADDR_HI 0x8a4
  #define GEN7_CP_CONTEXT_SWITCH_PRIV_SECURE_RESTORE_ADDR_HI     0x8a6
  #define GEN7_CP_CONTEXT_SWITCH_NON_PRIV_RESTORE_ADDR_LO        0x8a7
L67: #define GEN7_CP_CONTEXT_SWITCH_PRIV_SECURE_RESTORE_ADDR_HI     0x8a6
  #define GEN7_CP_CONTEXT_SWITCH_PRIV_NON_SECURE_RESTORE_ADDR_HI 0x8a4
  #define GEN7_CP_CONTEXT_SWITCH_PRIV_SECURE_RESTORE_ADDR_LO     0x8a5
  #define GEN7_CP_CONTEXT_SWITCH_NON_PRIV_RESTORE_ADDR_LO        0x8a7
  #define GEN7_CP_CONTEXT_SWITCH_NON_PRIV_RESTORE_ADDR_HI        0x8a8
L68: #define GEN7_CP_CONTEXT_SWITCH_NON_PRIV_RESTORE_ADDR_LO        0x8a7
  #define GEN7_CP_CONTEXT_SWITCH_PRIV_SECURE_RESTORE_ADDR_LO     0x8a5
  #define GEN7_CP_CONTEXT_SWITCH_PRIV_SECURE_RESTORE_ADDR_HI     0x8a6
  #define GEN7_CP_CONTEXT_SWITCH_NON_PRIV_RESTORE_ADDR_HI        0x8a8
  #define GEN7_CP_CONTEXT_SWITCH_LEVEL_STATUS                    0x8ab
L69: #define GEN7_CP_CONTEXT_SWITCH_NON_PRIV_RESTORE_ADDR_HI        0x8a8
  #define GEN7_CP_CONTEXT_SWITCH_PRIV_SECURE_RESTORE_ADDR_HI     0x8a6
  #define GEN7_CP_CONTEXT_SWITCH_NON_PRIV_RESTORE_ADDR_LO        0x8a7
  #define GEN7_CP_CONTEXT_SWITCH_LEVEL_STATUS                    0x8ab
  #define GEN7_CP_PERFCTR_CP_SEL_0         0x8d0
L70: #define GEN7_CP_CONTEXT_SWITCH_LEVEL_STATUS                    0x8ab
  #define GEN7_CP_CONTEXT_SWITCH_NON_PRIV_RESTORE_ADDR_LO        0x8a7
  #define GEN7_CP_CONTEXT_SWITCH_NON_PRIV_RESTORE_ADDR_HI        0x8a8
  #define GEN7_CP_PERFCTR_CP_SEL_0         0x8d0
  #define GEN7_CP_PERFCTR_CP_SEL_1         0x8d1
L96: #define GEN7_CP_SQE_STAT_ADDR            0x908
  #define GEN7_CP_CRASH_DUMP_CNTL          0x902
  #define GEN7_CP_CRASH_DUMP_STATUS        0x903
  #define GEN7_CP_SQE_STAT_DATA            0x909
  #define GEN7_CP_DRAW_STATE_ADDR          0x90a
L97: #define GEN7_CP_SQE_STAT_DATA            0x909
  #define GEN7_CP_CRASH_DUMP_STATUS        0x903
  #define GEN7_CP_SQE_STAT_ADDR            0x908
  #define GEN7_CP_DRAW_STATE_ADDR          0x90a
  #define GEN7_CP_DRAW_STATE_DATA          0x90b
L104: #define GEN7_CP_SQE_UCODE_DBG_ADDR       0x910
  #define GEN7_CP_MEM_POOL_DBG_ADDR        0x90e
  #define GEN7_CP_MEM_POOL_DBG_DATA        0x90f
  #define GEN7_CP_SQE_UCODE_DBG_DATA       0x911
  #define GEN7_CP_IB1_BASE                 0x928
L105: #define GEN7_CP_SQE_UCODE_DBG_DATA       0x911
  #define GEN7_CP_MEM_POOL_DBG_DATA        0x90f
  #define GEN7_CP_SQE_UCODE_DBG_ADDR       0x910
  #define GEN7_CP_IB1_BASE                 0x928
  #define GEN7_CP_IB1_BASE_HI              0x929
L129: #define GEN7_CP_BV_SQE_UCODE_DBG_ADDR    0xa85
  #define GEN7_CP_BV_ROQ_DBG_ADDR          0xa83
  #define GEN7_CP_BV_ROQ_DBG_DATA          0xa84
  #define GEN7_CP_BV_SQE_UCODE_DBG_DATA    0xa86
  #define GEN7_CP_BV_SQE_STAT_ADDR         0xa87
L130: #define GEN7_CP_BV_SQE_UCODE_DBG_DATA    0xa86
  #define GEN7_CP_BV_ROQ_DBG_DATA          0xa84
  #define GEN7_CP_BV_SQE_UCODE_DBG_ADDR    0xa85
  #define GEN7_CP_BV_SQE_STAT_ADDR         0xa87
  #define GEN7_CP_BV_SQE_STAT_DATA         0xa88
L131: #define GEN7_CP_BV_SQE_STAT_ADDR         0xa87
  #define GEN7_CP_BV_SQE_UCODE_DBG_ADDR    0xa85
  #define GEN7_CP_BV_SQE_UCODE_DBG_DATA    0xa86
  #define GEN7_CP_BV_SQE_STAT_DATA         0xa88
  #define GEN7_CP_BV_RB_RPTR_ADDR_LO       0xa98
L132: #define GEN7_CP_BV_SQE_STAT_DATA         0xa88
  #define GEN7_CP_BV_SQE_UCODE_DBG_DATA    0xa86
  #define GEN7_CP_BV_SQE_STAT_ADDR         0xa87
  #define GEN7_CP_BV_RB_RPTR_ADDR_LO       0xa98
  #define GEN7_CP_BV_RB_RPTR_ADDR_HI       0xa99
L157: #define GEN7_CP_SQE_AC_UCODE_DBG_ADDR    0xb27
  #define GEN7_CP_LPAC_IB2_BASE_HI         0xb11
  #define GEN7_CP_LPAC_IB2_REM_SIZE        0xb12
  #define GEN7_CP_SQE_AC_UCODE_DBG_DATA    0xb28
  #define GEN7_CP_SQE_AC_STAT_ADDR         0xb29
L158: #define GEN7_CP_SQE_AC_UCODE_DBG_DATA    0xb28
  #define GEN7_CP_LPAC_IB2_REM_SIZE        0xb12
  #define GEN7_CP_SQE_AC_UCODE_DBG_ADDR    0xb27
  #define GEN7_CP_SQE_AC_STAT_ADDR         0xb29
  #define GEN7_CP_SQE_AC_STAT_DATA         0xb2a
L159: #define GEN7_CP_SQE_AC_STAT_ADDR         0xb29
  #define GEN7_CP_SQE_AC_UCODE_DBG_ADDR    0xb27
  #define GEN7_CP_SQE_AC_UCODE_DBG_DATA    0xb28
  #define GEN7_CP_SQE_AC_STAT_DATA         0xb2a
  #define GEN7_CP_LPAC_CHICKEN_DBG         0xb30
L160: #define GEN7_CP_SQE_AC_STAT_DATA         0xb2a
  #define GEN7_CP_SQE_AC_UCODE_DBG_DATA    0xb28
  #define GEN7_CP_SQE_AC_STAT_ADDR         0xb29
  #define GEN7_CP_LPAC_CHICKEN_DBG         0xb30
  #define GEN7_CP_LPAC_APRIV_CNTL          0xb31
L693: #define GEN7_RBBM_CLOCK_CNTL_GMU_GX      0x00118
  #define GEN7_RBBM_CLOCK_HYST_GPC         0x00116
  #define GEN7_RBBM_CLOCK_DELAY_HLSQ_2     0x00117
  #define GEN7_RBBM_CLOCK_DELAY_GMU_GX     0x00119
  #define GEN7_RBBM_CLOCK_HYST_GMU_GX      0x0011a
L694: #define GEN7_RBBM_CLOCK_DELAY_GMU_GX     0x00119
  #define GEN7_RBBM_CLOCK_DELAY_HLSQ_2     0x00117
  #define GEN7_RBBM_CLOCK_CNTL_GMU_GX      0x00118
  #define GEN7_RBBM_CLOCK_HYST_GMU_GX      0x0011a
  #define GEN7_RBBM_CLOCK_MODE_HLSQ        0x0011b
L695: #define GEN7_RBBM_CLOCK_HYST_GMU_GX      0x0011a
  #define GEN7_RBBM_CLOCK_CNTL_GMU_GX      0x00118
  #define GEN7_RBBM_CLOCK_DELAY_GMU_GX     0x00119
  #define GEN7_RBBM_CLOCK_MODE_HLSQ        0x0011b
  #define GEN7_RBBM_CLOCK_DELAY_HLSQ       0x0011c
L770: #define GEN7_DBGC_SMMU_FAULT_BLOCK_HALT_CFG         0x69e
  #define GEN7_DBGC_DBG_TRACE_BUFFER_RD_ADDR          0x69b
  #define GEN7_DBGC_DBG_TRACE_BUFFER_RD_DATA          0x69c
  
  /* VSC registers */

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\gen8_reg.h =====
L594: #define GEN8_DBGC_QDSS_TIMESTAMP_0               0x639 /* Indexed Register */
  #define GEN8_DBGC_EVT_INTF_SEL_1                 0x637 /* Indexed Register */
  #define GEN8_DBGC_EVT_SLICE_CFG                  0x638
  #define GEN8_DBGC_QDSS_TIMESTAMP_1               0x63a /* Indexed Register */
  #define GEN8_DBGC_ECO_CNTL                       0x63b
L595: #define GEN8_DBGC_QDSS_TIMESTAMP_1               0x63a /* Indexed Register */
  #define GEN8_DBGC_EVT_SLICE_CFG                  0x638
  #define GEN8_DBGC_QDSS_TIMESTAMP_0               0x639 /* Indexed Register */
  #define GEN8_DBGC_ECO_CNTL                       0x63b
  #define GEN8_DBGC_AHB_DBG_CNTL                   0x63c
L615: #define GEN8_DBGC_SMMU_FAULT_BLOCK_HALT_CFG      0x665
  #define GEN8_DBGC_DBG_TRACE_BUFFER_RD_DATA       0x663
  #define GEN8_DBGC_TRACE_BUFFER_ATB_RD_STATUS     0x664
  #define GEN8_DBGC_DBG_LOPC_SB_RD_ADDR            0x666
  #define GEN8_DBGC_DBG_LOPC_SB_RD_DATA            0x667
L653: #define GEN8_DBGC_CFG_PERF_TIMESTAMP_TRIG_SEL_US 0x742
  #define GEN8_DBGC_CFG_BV_PERF_COUNTER_SEL_SP_VS_US 0x732
  #define GEN8_DBGC_CFG_BV_PERF_COUNTER_SEL_NONE_US 0x740
  #define GEN8_DBGC_CFG_BV_PERF_TIMESTAMP_TRIG_SEL_US 0x743
  #define GEN8_DBGC_CFG_GBIF_BR_PERF_CNTR_BASE_LO  0x744
L654: #define GEN8_DBGC_CFG_BV_PERF_TIMESTAMP_TRIG_SEL_US 0x743
  #define GEN8_DBGC_CFG_BV_PERF_COUNTER_SEL_NONE_US 0x740
  #define GEN8_DBGC_CFG_PERF_TIMESTAMP_TRIG_SEL_US 0x742
  #define GEN8_DBGC_CFG_GBIF_BR_PERF_CNTR_BASE_LO  0x744
  #define GEN8_DBGC_CFG_GBIF_BR_PERF_CNTR_BASE_HI  0x745
L682: #define GEN8_DBGC_CFG_PERF_TIMESTAMP_TRIG_SEL_LPAC_US 0x785
  #define GEN8_DBGC_CFG_PERF_COUNTER_SEL_LPAC_US_1 0x783
  #define GEN8_DBGC_CFG_PERF_COUNTER_SEL_LPAC_US_2 0x784
  #define GEN8_DBGC_CFG_GBIF_LPAC_PERF_CNTR_BASE_LO 0x786
  #define GEN8_DBGC_CFG_GBIF_LPAC_PERF_CNTR_BASE_HI 0x787
L728: #define GEN8_DBGC_CFG_PERF_TIMESTAMP_TRIG_SEL_S  0x7c4
  #define GEN8_DBGC_CFG_PERF_COUNTER_SEL_PS_2      0x7c2
  #define GEN8_DBGC_CFG_PERF_COUNTER_SEL_PS_3      0x7c3
  #define GEN8_DBGC_CFG_BV_PERF_COUNTER_SEL_FE_S   0x7c5
  #define GEN8_DBGC_CFG_BV_PERF_COUNTER_SEL_FE_S_1 0x7c6
L744: #define GEN8_DBGC_CFG_BV_PERF_TIMESTAMP_TRIG_SEL_S 0x7d4
  #define GEN8_DBGC_CFG_BV_PERF_COUNTER_SEL_VPC_PS 0x7d2
  #define GEN8_DBGC_CFG_BV_PERF_COUNTER_SEL_VPC_PS_1 0x7d3
  #define GEN8_DBGC_PERF_COUNTER_SCOPING_CMD_S     0x7d5
  #define GEN8_DBGC_LPAC_SCOPE_PERF_COUNTER_CFG_S  0x7e0
L751: #define GEN8_DBGC_CFG_PERF_TIMESTAMP_TRIG_SEL_LPAC_S 0x7e5
  #define GEN8_DBGC_CFG_PERF_COUNTER_SEL_LPAC_S_1  0x7e3
  #define GEN8_DBGC_CFG_PERF_COUNTER_SEL_LPAC_S_2  0x7e4
  #define GEN8_DBGC_LPAC_PERF_COUNTER_SCOPING_CMD_S 0x7e6
  
L780: #define GEN8_CP_SMMU_STREAM_ID_LPAC                            0x814
  #define GEN8_CP_RB_RPTR_LPAC                                   0x811
  #define GEN8_CP_RB_WPTR_LPAC                                   0x812
  #define GEN8_CP_SQE_CNTL                                       0x815
  #define GEN8_CP_SQE_INSTR_BASE_LO                              0x816
L781: #define GEN8_CP_SQE_CNTL                                       0x815
  #define GEN8_CP_RB_WPTR_LPAC                                   0x812
  #define GEN8_CP_SMMU_STREAM_ID_LPAC                            0x814
  #define GEN8_CP_SQE_INSTR_BASE_LO                              0x816
  #define GEN8_CP_SQE_INSTR_BASE_HI                              0x817
L782: #define GEN8_CP_SQE_INSTR_BASE_LO                              0x816
  #define GEN8_CP_SMMU_STREAM_ID_LPAC                            0x814
  #define GEN8_CP_SQE_CNTL                                       0x815
  #define GEN8_CP_SQE_INSTR_BASE_HI                              0x817
  #define GEN8_CP_AQE_INSTR_BASE_LO_0                            0x818
L783: #define GEN8_CP_SQE_INSTR_BASE_HI                              0x817
  #define GEN8_CP_SQE_CNTL                                       0x815
  #define GEN8_CP_SQE_INSTR_BASE_LO                              0x816
  #define GEN8_CP_AQE_INSTR_BASE_LO_0                            0x818
  #define GEN8_CP_AQE_INSTR_BASE_HI_0                            0x819
L789: #define GEN8_CP_APERTURE_CNTL_GMU                              0x81d
  #define GEN8_CP_AQE_INSTR_BASE_HI_1                            0x81b
  #define GEN8_CP_APERTURE_CNTL_HOST                             0x81c
  #define GEN8_CP_APERTURE_CNTL_CD                               0x81e
  #define GEN8_CP_CP2GMU_STATUS                                  0x822
L791: #define GEN8_CP_CP2GMU_STATUS                                  0x822
  #define GEN8_CP_APERTURE_CNTL_GMU                              0x81d
  #define GEN8_CP_APERTURE_CNTL_CD                               0x81e
  #define GEN8_CP_SEMAPHORE_REG_0                                0x825
  #define GEN8_CP_RL_ERROR_DETAILS_0                             0x840
L808: #define GEN8_CP_SQE_ICACHE_CNTL_PIPE                           0x8b0
  #define GEN8_CP_PROTECT_REG_PIPE                               0x8a0
  
  #define GEN8_CP_SQE_DCACHE_CNTL_PIPE                           0x8b1
  #define GEN8_CP_CHICKEN_DBG_PIPE                               0x8b2
L809: #define GEN8_CP_SQE_DCACHE_CNTL_PIPE                           0x8b1
  
  #define GEN8_CP_SQE_ICACHE_CNTL_PIPE                           0x8b0
  #define GEN8_CP_CHICKEN_DBG_PIPE                               0x8b2
  #define GEN8_CP_HW_FAULT_STATUS_PIPE                           0x8b3
L819: #define GEN8_CP_SQE_STATUS_PIPE                                0x8bb
  #define GEN8_CP_PIPE_STATUS_PIPE                               0x8b9
  #define GEN8_CP_GPU_BATCH_ID_PIPE                              0x8ba
  #define GEN8_CP_CONTEXT_SWITCH_CNTL                            0x8c0
  #define GEN8_CP_CONTEXT_SWITCH_SMMU_INFO_LO                    0x8c1
L820: #define GEN8_CP_CONTEXT_SWITCH_CNTL                            0x8c0
  #define GEN8_CP_GPU_BATCH_ID_PIPE                              0x8ba
  #define GEN8_CP_SQE_STATUS_PIPE                                0x8bb
  #define GEN8_CP_CONTEXT_SWITCH_SMMU_INFO_LO                    0x8c1
  #define GEN8_CP_CONTEXT_SWITCH_SMMU_INFO_HI                    0x8c2
L821: #define GEN8_CP_CONTEXT_SWITCH_SMMU_INFO_LO                    0x8c1
  #define GEN8_CP_SQE_STATUS_PIPE                                0x8bb
  #define GEN8_CP_CONTEXT_SWITCH_CNTL                            0x8c0
  #define GEN8_CP_CONTEXT_SWITCH_SMMU_INFO_HI                    0x8c2
  #define GEN8_CP_CONTEXT_SWITCH_PNSR_ADDR_LO                    0x8c3
L822: #define GEN8_CP_CONTEXT_SWITCH_SMMU_INFO_HI                    0x8c2
  #define GEN8_CP_CONTEXT_SWITCH_CNTL                            0x8c0
  #define GEN8_CP_CONTEXT_SWITCH_SMMU_INFO_LO                    0x8c1
  #define GEN8_CP_CONTEXT_SWITCH_PNSR_ADDR_LO                    0x8c3
  #define GEN8_CP_CONTEXT_SWITCH_PNSR_ADDR_HI                    0x8c4
L823: #define GEN8_CP_CONTEXT_SWITCH_PNSR_ADDR_LO                    0x8c3
  #define GEN8_CP_CONTEXT_SWITCH_SMMU_INFO_LO                    0x8c1
  #define GEN8_CP_CONTEXT_SWITCH_SMMU_INFO_HI                    0x8c2
  #define GEN8_CP_CONTEXT_SWITCH_PNSR_ADDR_HI                    0x8c4
  #define GEN8_CP_CONTEXT_SWITCH_PSR_ADDR_LO                     0x8c5
L824: #define GEN8_CP_CONTEXT_SWITCH_PNSR_ADDR_HI                    0x8c4
  #define GEN8_CP_CONTEXT_SWITCH_SMMU_INFO_HI                    0x8c2
  #define GEN8_CP_CONTEXT_SWITCH_PNSR_ADDR_LO                    0x8c3
  #define GEN8_CP_CONTEXT_SWITCH_PSR_ADDR_LO                     0x8c5
  #define GEN8_CP_CONTEXT_SWITCH_PSR_ADDR_HI                     0x8c6
L825: #define GEN8_CP_CONTEXT_SWITCH_PSR_ADDR_LO                     0x8c5
  #define GEN8_CP_CONTEXT_SWITCH_PNSR_ADDR_LO                    0x8c3
  #define GEN8_CP_CONTEXT_SWITCH_PNSR_ADDR_HI                    0x8c4
  #define GEN8_CP_CONTEXT_SWITCH_PSR_ADDR_HI                     0x8c6
  #define GEN8_CP_CONTEXT_SWITCH_NPR_ADDR_LO                     0x8c7
L826: #define GEN8_CP_CONTEXT_SWITCH_PSR_ADDR_HI                     0x8c6
  #define GEN8_CP_CONTEXT_SWITCH_PNSR_ADDR_HI                    0x8c4
  #define GEN8_CP_CONTEXT_SWITCH_PSR_ADDR_LO                     0x8c5
  #define GEN8_CP_CONTEXT_SWITCH_NPR_ADDR_LO                     0x8c7
  #define GEN8_CP_CONTEXT_SWITCH_NPR_ADDR_HI                     0x8c8
L827: #define GEN8_CP_CONTEXT_SWITCH_NPR_ADDR_LO                     0x8c7
  #define GEN8_CP_CONTEXT_SWITCH_PSR_ADDR_LO                     0x8c5
  #define GEN8_CP_CONTEXT_SWITCH_PSR_ADDR_HI                     0x8c6
  #define GEN8_CP_CONTEXT_SWITCH_NPR_ADDR_HI                     0x8c8
  #define GEN8_CP_CONTEXT_SWITCH_LEVEL_STATUS                    0x8cb
L828: #define GEN8_CP_CONTEXT_SWITCH_NPR_ADDR_HI                     0x8c8
  #define GEN8_CP_CONTEXT_SWITCH_PSR_ADDR_HI                     0x8c6
  #define GEN8_CP_CONTEXT_SWITCH_NPR_ADDR_LO                     0x8c7
  #define GEN8_CP_CONTEXT_SWITCH_LEVEL_STATUS                    0x8cb
  #define GEN8_CP_PERFCTR_CP_SEL_0                               0x8d0
L829: #define GEN8_CP_CONTEXT_SWITCH_LEVEL_STATUS                    0x8cb
  #define GEN8_CP_CONTEXT_SWITCH_NPR_ADDR_LO                     0x8c7
  #define GEN8_CP_CONTEXT_SWITCH_NPR_ADDR_HI                     0x8c8
  #define GEN8_CP_PERFCTR_CP_SEL_0                               0x8d0
  #define GEN8_CP_PERFCTR_CP_SEL_1                               0x8d1
L855: #define GEN8_CP_SQE_STAT_ADDR_PIPE                             0x8f0
  #define GEN8_CP_ALWAYS_ON_CONTEXT_LO                           0x8e9
  #define GEN8_CP_ALWAYS_ON_CONTEXT_HI                           0x8ea
  #define GEN8_CP_SQE_STAT_DATA_PIPE                             0x8f1
  #define GEN8_CP_DRAW_STATE_ADDR_PIPE                           0x8f2
L856: #define GEN8_CP_SQE_STAT_DATA_PIPE                             0x8f1
  #define GEN8_CP_ALWAYS_ON_CONTEXT_HI                           0x8ea
  #define GEN8_CP_SQE_STAT_ADDR_PIPE                             0x8f0
  #define GEN8_CP_DRAW_STATE_ADDR_PIPE                           0x8f2
  #define GEN8_CP_DRAW_STATE_DATA_PIPE                           0x8f3

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\governor_msm_adreno_tz.c =====
L19: #include <linux/firmware/qcom/qcom_scm.h>
  #include <linux/version.h>
  #if (KERNEL_VERSION(6, 3, 0) <= LINUX_VERSION_CODE)
  #else
  #include <linux/qcom_scm.h>
L24: #include <linux/firmware/qcom/qcom_scm_addon.h>
  #endif
  #if IS_ENABLED(CONFIG_QCOM_SCM_ADDON)
  #endif
  
L239: #include <linux/firmware/qcom/qcom_tzmem.h>
  
  #if IS_ENABLED(CONFIG_QCOM_TZMEM)
  
  static int tz_init(struct device *dev, struct devfreq_msm_adreno_tz_data *priv,

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\include\linux\msm_kgsl.h =====
L54: * @GPU_GMU_READY - GMU initialized to handle other requests
  /**
  * enum kgsl_srcu_events - kgsl srcu notify events for listeners
  * @GPU_GMU_STOP - GMU is not ready to handle other requests
  * @GPU_SSR_BEGIN - GPU/GMU fault detected to start recovery
L55: * @GPU_GMU_STOP - GMU is not ready to handle other requests
  * enum kgsl_srcu_events - kgsl srcu notify events for listeners
  * @GPU_GMU_READY - GMU initialized to handle other requests
  * @GPU_SSR_BEGIN - GPU/GMU fault detected to start recovery
  * @GPU_SSR_END - GPU/GMU fault recovery end
L56: * @GPU_SSR_BEGIN - GPU/GMU fault detected to start recovery
  * @GPU_GMU_READY - GMU initialized to handle other requests
  * @GPU_GMU_STOP - GMU is not ready to handle other requests
  * @GPU_SSR_END - GPU/GMU fault recovery end
  * @GPU_SSR_FATAL - LSR context invalidated
L57: * @GPU_SSR_END - GPU/GMU fault recovery end
  * @GPU_GMU_STOP - GMU is not ready to handle other requests
  * @GPU_SSR_BEGIN - GPU/GMU fault detected to start recovery
  * @GPU_SSR_FATAL - LSR context invalidated
  */
L61: GPU_GMU_READY,
  */
  enum kgsl_srcu_events {
  GPU_GMU_STOP,
  GPU_SSR_BEGIN,
L62: GPU_GMU_STOP,
  enum kgsl_srcu_events {
  GPU_GMU_READY,
  GPU_SSR_BEGIN,
  GPU_SSR_END,

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\include\uapi\linux\msm_kgsl.h =====
L64: #define KGSL_CONTEXT_PREEMPT_STYLE_RINGBUFFER 0x1
  #define KGSL_CONTEXT_PREEMPT_STYLE_SHIFT      25
  #define KGSL_CONTEXT_PREEMPT_STYLE_DEFAULT    0x0
  #define KGSL_CONTEXT_PREEMPT_STYLE_FINEGRAIN  0x2
  
L130: #define KGSL_CMD_SYNCPOINT_TYPE_TIMESTAMP 0
  
  /* Flags for GPU command sync points */
  #define KGSL_CMD_SYNCPOINT_TYPE_FENCE 1
  #define KGSL_CMD_SYNCPOINT_TYPE_TIMELINE 2
L240: #define KGSL_FLAGS_PER_CONTEXT_TIMESTAMPS 0x00000200
  #define KGSL_FLAGS_RESERVED2   0x00000080
  #define KGSL_FLAGS_SOFT_RESET  0x00000100
  
  /* Server Side Sync Timeout in milliseconds */
L286: * struct kgsl_devmemstore - this structure defines the region of memory
  
  /*
  * that can be mmap()ed from this driver. The timestamp fields are volatile
  * because they are written by the GPU
L287: * that can be mmap()ed from this driver. The timestamp fields are volatile
  /*
  * struct kgsl_devmemstore - this structure defines the region of memory
  * because they are written by the GPU
  * @soptimestamp: Start of pipeline timestamp written by GPU before the
L289: * @soptimestamp: Start of pipeline timestamp written by GPU before the
  * that can be mmap()ed from this driver. The timestamp fields are volatile
  * because they are written by the GPU
  * commands in concern are processed
  * @sbz: Unused, kept for 8 byte alignment
L292: * @eoptimestamp: End of pipeline timestamp written by GPU after the
  * commands in concern are processed
  * @sbz: Unused, kept for 8 byte alignment
  * commands in concern are processed
  * @sbz2: Unused, kept for 8 byte alignment
L297: * @ref_wait_ts: Timestamp on which to generate interrupt, unused now.
  * @preempted: Indicates if the context was preempted
  * @sbz3: Unused, kept for 8 byte alignment
  * @sbz4: Unused, kept for 8 byte alignment
  * @current_context: The current context the GPU is working on
L302: struct kgsl_devmemstore {
  * @sbz5: Unused, kept for 8 byte alignment
  */
  volatile unsigned int soptimestamp;
  unsigned int sbz;
L303: volatile unsigned int soptimestamp;
  */
  struct kgsl_devmemstore {
  unsigned int sbz;
  volatile unsigned int eoptimestamp;
L305: volatile unsigned int eoptimestamp;
  volatile unsigned int soptimestamp;
  unsigned int sbz;
  unsigned int sbz2;
  volatile unsigned int preempted;
L315: #define KGSL_MEMSTORE_OFFSET(ctxt_id, field) \
  };
  
  ((ctxt_id)*sizeof(struct kgsl_devmemstore) + \
  offsetof(struct kgsl_devmemstore, field))
L316: ((ctxt_id)*sizeof(struct kgsl_devmemstore) + \
  
  #define KGSL_MEMSTORE_OFFSET(ctxt_id, field) \
  offsetof(struct kgsl_devmemstore, field))
  
L317: offsetof(struct kgsl_devmemstore, field))
  #define KGSL_MEMSTORE_OFFSET(ctxt_id, field) \
  ((ctxt_id)*sizeof(struct kgsl_devmemstore) + \
  
  /* timestamp id*/
L319: /* timestamp id*/
  offsetof(struct kgsl_devmemstore, field))
  
  enum kgsl_timestamp_type {
  KGSL_TIMESTAMP_CONSUMED = 0x00000001, /* start-of-pipeline timestamp */
L320: enum kgsl_timestamp_type {
  
  /* timestamp id*/
  KGSL_TIMESTAMP_CONSUMED = 0x00000001, /* start-of-pipeline timestamp */
  KGSL_TIMESTAMP_RETIRED  = 0x00000002, /* end-of-pipeline timestamp*/
L321: KGSL_TIMESTAMP_CONSUMED = 0x00000001, /* start-of-pipeline timestamp */
  /* timestamp id*/
  enum kgsl_timestamp_type {
  KGSL_TIMESTAMP_RETIRED  = 0x00000002, /* end-of-pipeline timestamp*/
  KGSL_TIMESTAMP_QUEUED   = 0x00000003,
L322: KGSL_TIMESTAMP_RETIRED  = 0x00000002, /* end-of-pipeline timestamp*/
  enum kgsl_timestamp_type {
  KGSL_TIMESTAMP_CONSUMED = 0x00000001, /* start-of-pipeline timestamp */
  KGSL_TIMESTAMP_QUEUED   = 0x00000003,
  };
L323: KGSL_TIMESTAMP_QUEUED   = 0x00000003,
  KGSL_TIMESTAMP_CONSUMED = 0x00000001, /* start-of-pipeline timestamp */
  KGSL_TIMESTAMP_RETIRED  = 0x00000002, /* end-of-pipeline timestamp*/
  };
  
L449: __u32 timestamp;
  struct kgsl_context_property_fault {
  __s32 faults;
  };
  
L500: #define KGSL_PERFCOUNTER_GROUP_GMU_XOCLK 0x27
  #define KGSL_PERFCOUNTER_GROUP_FCHE 0x25
  #define KGSL_PERFCOUNTER_GROUP_MHUB 0x26
  #define KGSL_PERFCOUNTER_GROUP_GMU_GMUCLK  0x28
  #define KGSL_PERFCOUNTER_GROUP_GMU_PERF  0x29
L501: #define KGSL_PERFCOUNTER_GROUP_GMU_GMUCLK  0x28
  #define KGSL_PERFCOUNTER_GROUP_MHUB 0x26
  #define KGSL_PERFCOUNTER_GROUP_GMU_XOCLK 0x27
  #define KGSL_PERFCOUNTER_GROUP_GMU_PERF  0x29
  #define KGSL_PERFCOUNTER_GROUP_SW 0x2a
L502: #define KGSL_PERFCOUNTER_GROUP_GMU_PERF  0x29
  #define KGSL_PERFCOUNTER_GROUP_GMU_XOCLK 0x27
  #define KGSL_PERFCOUNTER_GROUP_GMU_GMUCLK  0x28
  #define KGSL_PERFCOUNTER_GROUP_SW 0x2a
  #define KGSL_PERFCOUNTER_GROUP_UFC 0x2b
L533: * @wall_clock_s: Ringbuffer submission time (seconds).
  /**
  * struct kgsl_cmdbatch_profiling_buffer
  *                If KGSL_CMDBATCH_PROFILING_KTIME is set, time is provided
  *                in kernel clocks, otherwise wall clock time is used.
L536: * @wall_clock_ns: Ringbuffer submission time (nanoseconds).
  *                If KGSL_CMDBATCH_PROFILING_KTIME is set, time is provided
  *                in kernel clocks, otherwise wall clock time is used.
  *                 If KGSL_CMDBATCH_PROFILING_KTIME is set time is provided
  *                 in kernel clocks, otherwise wall clock time is used.
L539: * @gpu_ticks_queued: GPU ticks at ringbuffer submission
  *                 If KGSL_CMDBATCH_PROFILING_KTIME is set time is provided
  *                 in kernel clocks, otherwise wall clock time is used.
  * @gpu_ticks_submitted: GPU ticks when starting cmdbatch execution
  * @gpu_ticks_retired: GPU ticks when finishing cmdbatch execution
L566: * struct kgsl_memstore into userspace.
  * for KGSL_PROP_DEVICE_SHADOW, use struct kgsl_shadowprop
  * this is used to find mmap() offset and sizes for mapping
  */
  struct kgsl_device_getproperty {
L580: /* block until the GPU has executed past a given timestamp
  */
  
  * timeout is in milliseconds.
  */
L583: struct kgsl_device_waittimestamp {
  * timeout is in milliseconds.
  */
  unsigned int timestamp;
  unsigned int timeout;
L584: unsigned int timestamp;
  */
  struct kgsl_device_waittimestamp {
  unsigned int timeout;
  };

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl.c =====
L36: #include "kgsl_gmu_core.h"
  #include "kgsl_device.h"
  #include "kgsl_eventlog.h"
  #include "kgsl_mmu.h"
  #include "kgsl_pool.h"
L253: int kgsl_readtimestamp(struct kgsl_device *device, void *priv,
  }
  
  enum kgsl_timestamp_type type, unsigned int *timestamp)
  {
L254: enum kgsl_timestamp_type type, unsigned int *timestamp)
  
  int kgsl_readtimestamp(struct kgsl_device *device, void *priv,
  {
  if (device)
L257: return device->ftbl->readtimestamp(device, priv, type,
  {
  if (device)
  timestamp);
  return -EINVAL;
L258: timestamp);
  if (device)
  return device->ftbl->readtimestamp(device, priv, type,
  return -EINVAL;
  
L567: ret = kgsl_mmu_map(memdesc->pagetable, memdesc);
  * SVM process
  */
  
  if (ret) {
L749: "cannot have more than %zu contexts due to memstore limitation\n",
  if (id == -ENOSPC) {
  dev_warn(device->dev,
  KGSL_MEMSTORE_MAX);
  kgsl_context_debug_info(device);
L750: KGSL_MEMSTORE_MAX);
  dev_warn(device->dev,
  "cannot have more than %zu contexts due to memstore limitation\n",
  kgsl_context_debug_info(device);
  }
L784: kgsl_readtimestamp, context, "context-%d", id);
  
  kgsl_add_event_group(device, &context->events, context,
  
  out:
L879: /* Clear the timestamps in the memstore during destroy */
  if (context->id != KGSL_CONTEXT_INVALID) {
  
  kgsl_sharedmem_writel(device->memstore,
  KGSL_MEMSTORE_OFFSET(context->id, soptimestamp), 0);
L880: kgsl_sharedmem_writel(device->memstore,
  
  /* Clear the timestamps in the memstore during destroy */
  KGSL_MEMSTORE_OFFSET(context->id, soptimestamp), 0);
  kgsl_sharedmem_writel(device->memstore,
L881: KGSL_MEMSTORE_OFFSET(context->id, soptimestamp), 0);
  /* Clear the timestamps in the memstore during destroy */
  kgsl_sharedmem_writel(device->memstore,
  kgsl_sharedmem_writel(device->memstore,
  KGSL_MEMSTORE_OFFSET(context->id, eoptimestamp), 0);
L882: kgsl_sharedmem_writel(device->memstore,
  kgsl_sharedmem_writel(device->memstore,
  KGSL_MEMSTORE_OFFSET(context->id, soptimestamp), 0);
  KGSL_MEMSTORE_OFFSET(context->id, eoptimestamp), 0);
  
L883: KGSL_MEMSTORE_OFFSET(context->id, eoptimestamp), 0);
  KGSL_MEMSTORE_OFFSET(context->id, soptimestamp), 0);
  kgsl_sharedmem_writel(device->memstore,
  
  /* clear device power constraint */
L937: * kgsl_check_timestamp() - return true if the specified timestamp is retired
  
  /**
  * @device: Pointer to the KGSL device to check
  * @context: Pointer to the context for the timestamp
L939: * @context: Pointer to the context for the timestamp
  * kgsl_check_timestamp() - return true if the specified timestamp is retired
  * @device: Pointer to the KGSL device to check
  * @timestamp: The timestamp to compare
  */
L940: * @timestamp: The timestamp to compare
  * @device: Pointer to the KGSL device to check
  * @context: Pointer to the context for the timestamp
  */
  bool kgsl_check_timestamp(struct kgsl_device *device,
L942: bool kgsl_check_timestamp(struct kgsl_device *device,
  * @timestamp: The timestamp to compare
  */
  struct kgsl_context *context, unsigned int timestamp)
  {
L943: struct kgsl_context *context, unsigned int timestamp)
  */
  bool kgsl_check_timestamp(struct kgsl_device *device,
  {
  unsigned int ts_processed;
L947: kgsl_readtimestamp(device, context, KGSL_TIMESTAMP_RETIRED,
  unsigned int ts_processed;
  
  &ts_processed);
  
L950: return (timestamp_cmp(ts_processed, timestamp) >= 0);
  &ts_processed);
  
  }
  
L1021: if (private->profile.md.gmuaddr) {
  
  
  /*
  * This calls iommu_unmap(), which may take variable amount of time to
L1023: * This calls iommu_unmap(), which may take variable amount of time to
  if (private->profile.md.gmuaddr) {
  /*
  * complete. So do this at the very end of process private cleanup, so that
  * this doesn't delay the clean up of rest of the process private resources.
L1027: gmu_core_free_block(device, &private->profile.md);
  * this doesn't delay the clean up of rest of the process private resources.
  */
  }
  
L1270: /* Allocate profile memory for gmu based DCVS targets */
  }
  
  device->ftbl->alloc_dcvs_profile_memory(device, private);
  mutex_init(&private->profile.profile_mutex);
L1664: * to prevent race condition between ioctls calling free/freememontimestamp
  *
  * This function will set the pending free flag if it is previously unset. Used
  * on the same entry. Whichever thread set's the flag first will do the free.
  */
L1700: fault_stats.timestamp = context->last_faulted_cmd_ts;
  
  fault_stats.faults = context->total_fault_count;
  
  /*
L1943: u64 va_size = KGSL_IOMMU_VA_END64 - KGSL_IOMMU_VA_BASE64;
  struct kgsl_device_getproperty *param)
  {
  
  if (param->sizebytes != sizeof(va_size))
L1957: u64 size = KGSL_IOMMU_SECURE_SIZE(&dev_priv->device->mmu);
  struct kgsl_device_getproperty *param)
  {
  
  if (param->sizebytes != sizeof(size))
L2063: long kgsl_ioctl_device_waittimestamp_ctxtid(
  }
  
  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.h =====
L18: #include "kgsl_gmu_core.h"
  #include <linux/version.h>
  
  #include "kgsl_pwrscale.h"
  #include "kgsl_sharedmem.h"
L53: /* The number of memstore arrays limits the number of contexts allowed.
  
  
  * If more contexts are needed, update multiple for MEMSTORE_SIZE
  */
L54: * If more contexts are needed, update multiple for MEMSTORE_SIZE
  
  /* The number of memstore arrays limits the number of contexts allowed.
  */
  #define KGSL_MEMSTORE_SIZE	((int)(PAGE_SIZE * 8))
L56: #define KGSL_MEMSTORE_SIZE	((int)(PAGE_SIZE * 8))
  * If more contexts are needed, update multiple for MEMSTORE_SIZE
  */
  #define KGSL_MEMSTORE_GLOBAL	(0)
  #define KGSL_PRIORITY_MAX_RB_LEVELS 4
L57: #define KGSL_MEMSTORE_GLOBAL	(0)
  */
  #define KGSL_MEMSTORE_SIZE	((int)(PAGE_SIZE * 8))
  #define KGSL_PRIORITY_MAX_RB_LEVELS 4
  #define KGSL_LPAC_RB_ID		KGSL_PRIORITY_MAX_RB_LEVELS
L61: #define KGSL_MEMSTORE_MAX	(KGSL_MEMSTORE_SIZE / \
  #define KGSL_LPAC_RB_ID		KGSL_PRIORITY_MAX_RB_LEVELS
  /* Subtract one for LPAC */
  sizeof(struct kgsl_devmemstore) - 2 - KGSL_PRIORITY_MAX_RB_LEVELS)
  #define KGSL_MAX_CONTEXTS_PER_PROC 200
L62: sizeof(struct kgsl_devmemstore) - 2 - KGSL_PRIORITY_MAX_RB_LEVELS)
  /* Subtract one for LPAC */
  #define KGSL_MEMSTORE_MAX	(KGSL_MEMSTORE_SIZE / \
  #define KGSL_MAX_CONTEXTS_PER_PROC 200
  
L65: #define MEMSTORE_RB_OFFSET(rb, field)	\
  #define KGSL_MAX_CONTEXTS_PER_PROC 200
  
  KGSL_MEMSTORE_OFFSET(((rb)->id + KGSL_MEMSTORE_MAX), field)
  
L66: KGSL_MEMSTORE_OFFSET(((rb)->id + KGSL_MEMSTORE_MAX), field)
  
  #define MEMSTORE_RB_OFFSET(rb, field)	\
  
  #define MEMSTORE_ID_GPU_ADDR(dev, iter, field) \
L68: #define MEMSTORE_ID_GPU_ADDR(dev, iter, field) \
  KGSL_MEMSTORE_OFFSET(((rb)->id + KGSL_MEMSTORE_MAX), field)
  
  ((dev)->memstore->gpuaddr + KGSL_MEMSTORE_OFFSET(iter, field))
  
L69: ((dev)->memstore->gpuaddr + KGSL_MEMSTORE_OFFSET(iter, field))
  
  #define MEMSTORE_ID_GPU_ADDR(dev, iter, field) \
  
  #define MEMSTORE_RB_GPU_ADDR(dev, rb, field)	\
L71: #define MEMSTORE_RB_GPU_ADDR(dev, rb, field)	\
  ((dev)->memstore->gpuaddr + KGSL_MEMSTORE_OFFSET(iter, field))
  
  ((dev)->memstore->gpuaddr + \
  KGSL_MEMSTORE_OFFSET(((rb)->id + KGSL_MEMSTORE_MAX), field))
L72: ((dev)->memstore->gpuaddr + \
  
  #define MEMSTORE_RB_GPU_ADDR(dev, rb, field)	\
  KGSL_MEMSTORE_OFFSET(((rb)->id + KGSL_MEMSTORE_MAX), field))
  
L73: KGSL_MEMSTORE_OFFSET(((rb)->id + KGSL_MEMSTORE_MAX), field))
  #define MEMSTORE_RB_GPU_ADDR(dev, rb, field)	\
  ((dev)->memstore->gpuaddr + \
  
  #define KGSL_CONTEXT_PRIORITY_HIGH 0
L77: #define KGSL_GLOBAL_CTXT_ID (KGSL_MEMSTORE_MAX - 1)
  #define KGSL_CONTEXT_PRIORITY_HIGH 0
  /* Last context id is reserved for global context */
  
  /*
L88: /** @rptr: per ringbuffer address where GPU writes the rptr */
  /* Shadow global helpers */
  struct adreno_rb_shadow {
  u32 rptr;
  /** @bv_rptr: per ringbuffer address where GPU writes BV rptr */
L90: /** @bv_rptr: per ringbuffer address where GPU writes BV rptr */
  /** @rptr: per ringbuffer address where GPU writes the rptr */
  u32 rptr;
  u32 bv_rptr;
  /** @bv_ts: per ringbuffer address where BV ringbuffer timestamp is written to */
L92: /** @bv_ts: per ringbuffer address where BV ringbuffer timestamp is written to */
  /** @bv_rptr: per ringbuffer address where GPU writes BV rptr */
  u32 bv_rptr;
  u32 bv_ts;
  /** @current_rb_ptname: The current pagetable active on the given RB */
L134: /* Timestamp window used to detect rollovers (half of integer range) */
  ((dev)->scratch->gpuaddr + SCRATCH_POSTAMBLE_OFFSET)
  
  #define KGSL_TIMESTAMP_WINDOW 0x80000000
  
L135: #define KGSL_TIMESTAMP_WINDOW 0x80000000
  
  /* Timestamp window used to detect rollovers (half of integer range) */
  
  /*
L241: * struct kgsl_event - KGSL GPU timestamp event
  
  /**
  * @device: Pointer to the KGSL device that owns the event
  * @context: Pointer to the context that owns the event
L244: * @timestamp: Timestamp for the event to expire
  * @device: Pointer to the KGSL device that owns the event
  * @context: Pointer to the context that owns the event
  * @func: Callback function for the event when it expires
  * @priv: Private data passed to the callback function
L256: unsigned int timestamp;
  struct kgsl_device *device;
  struct kgsl_context *context;
  kgsl_event_func func;
  void *priv;
L266: typedef int (*readtimestamp_func)(struct kgsl_device *, void *,
  };
  
  enum kgsl_timestamp_type, unsigned int *);
  
L267: enum kgsl_timestamp_type, unsigned int *);
  
  typedef int (*readtimestamp_func)(struct kgsl_device *, void *,
  
  /**
L275: * @processed: Last processed timestamp
  * @events: List of active GPU events
  * @group: Node for the master group list
  * @name: String name for the group (for the debugfs file)
  * @readtimestamp: Function pointer to read a timestamp
L277: * @readtimestamp: Function pointer to read a timestamp
  * @processed: Last processed timestamp
  * @name: String name for the group (for the debugfs file)
  * @priv: Priv member to pass to the readtimestamp function
  */
L278: * @priv: Priv member to pass to the readtimestamp function
  * @name: String name for the group (for the debugfs file)
  * @readtimestamp: Function pointer to read a timestamp
  */
  struct kgsl_event_group {
L287: readtimestamp_func readtimestamp;
  unsigned int processed;
  char name[64];
  void *priv;
  };
L294: * @rb_id: id of the ringbuffer to which this submission is made
  * struct submission_info - Container for submission statistics
  * @inflight: Number of commands that are inflight
  * @rptr: Read pointer of the ringbuffer
  * @wptr: Write pointer of the ringbuffer

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_bus.c =====
L239: if (IS_ERR(pwr->icc_path) && !gmu_core_scales_bandwidth(device)) {
  pwr->icc_path = of_icc_get(&pdev->dev, NULL);
  
  WARN(1, "The CPU has no way to set the GPU bus levels\n");
  

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_compat.c =====
L53: param.timestamp = param32->timestamp;
  param.synclist = compat_ptr(param32->synclist);
  param.numsyncs = param32->numsyncs;
  
  result = kgsl_ioctl_submit_commands(dev_priv, cmd, &param);
L57: param32->timestamp = param.timestamp;
  result = kgsl_ioctl_submit_commands(dev_priv, cmd, &param);
  
  
  return result;
L67: struct kgsl_ringbuffer_issueibcmds_compat *param32 = data;
  {
  int result;
  struct kgsl_ringbuffer_issueibcmds param;
  
L68: struct kgsl_ringbuffer_issueibcmds param;
  int result;
  struct kgsl_ringbuffer_issueibcmds_compat *param32 = data;
  
  param.drawctxt_id = param32->drawctxt_id;
L74: param.timestamp = param32->timestamp;
  param.ibdesc_addr = (unsigned long)param32->ibdesc_addr;
  param.numibs = param32->numibs;
  
  result = kgsl_ioctl_rb_issueibcmds(dev_priv, cmd, &param);
L78: param32->timestamp = param.timestamp;
  result = kgsl_ioctl_rb_issueibcmds(dev_priv, cmd, &param);
  
  
  return result;
L83: static long kgsl_ioctl_cmdstream_freememontimestamp_ctxtid_compat(
  }
  
  struct kgsl_device_private
  *dev_priv, unsigned int cmd,
L88: struct kgsl_cmdstream_freememontimestamp_ctxtid_compat *param32 = data;
  void *data)
  {
  struct kgsl_cmdstream_freememontimestamp_ctxtid param;
  
L89: struct kgsl_cmdstream_freememontimestamp_ctxtid param;
  {
  struct kgsl_cmdstream_freememontimestamp_ctxtid_compat *param32 = data;
  
  param.context_id = param32->context_id;
L94: param.timestamp = param32->timestamp;
  param.gpuaddr = (unsigned long)param32->gpuaddr;
  param.type = param32->type;
  
  return kgsl_ioctl_cmdstream_freememontimestamp_ctxtid(dev_priv, cmd,
L96: return kgsl_ioctl_cmdstream_freememontimestamp_ctxtid(dev_priv, cmd,
  param.timestamp = param32->timestamp;
  
  &param);
  }
L264: static long kgsl_ioctl_timestamp_event_compat(struct kgsl_device_private
  }
  
  *dev_priv, unsigned int cmd, void *data)
  {
L267: struct kgsl_timestamp_event_compat *param32 = data;
  *dev_priv, unsigned int cmd, void *data)
  {
  struct kgsl_timestamp_event param;
  
L268: struct kgsl_timestamp_event param;
  {
  struct kgsl_timestamp_event_compat *param32 = data;
  
  param.type = param32->type;
L271: param.timestamp = param32->timestamp;
  
  param.type = param32->type;
  param.context_id = param32->context_id;
  param.priv = compat_ptr(param32->priv);
L276: return kgsl_ioctl_timestamp_event(dev_priv, cmd, &param);
  param.len = (size_t)param32->len;
  
  }
  
L283: /* IOCTL_KGSL_DEVICE_WAITTIMESTAMP is no longer supported */
  KGSL_IOCTL_FUNC(IOCTL_KGSL_DEVICE_GETPROPERTY_COMPAT,
  kgsl_ioctl_device_getproperty_compat),
  KGSL_IOCTL_FUNC(IOCTL_KGSL_DEVICE_WAITTIMESTAMP_CTXTID,
  kgsl_ioctl_device_waittimestamp_ctxtid),
L284: KGSL_IOCTL_FUNC(IOCTL_KGSL_DEVICE_WAITTIMESTAMP_CTXTID,
  kgsl_ioctl_device_getproperty_compat),
  /* IOCTL_KGSL_DEVICE_WAITTIMESTAMP is no longer supported */
  kgsl_ioctl_device_waittimestamp_ctxtid),
  KGSL_IOCTL_FUNC(IOCTL_KGSL_RINGBUFFER_ISSUEIBCMDS_COMPAT,
L285: kgsl_ioctl_device_waittimestamp_ctxtid),
  /* IOCTL_KGSL_DEVICE_WAITTIMESTAMP is no longer supported */
  KGSL_IOCTL_FUNC(IOCTL_KGSL_DEVICE_WAITTIMESTAMP_CTXTID,
  KGSL_IOCTL_FUNC(IOCTL_KGSL_RINGBUFFER_ISSUEIBCMDS_COMPAT,
  kgsl_ioctl_rb_issueibcmds_compat),
L286: KGSL_IOCTL_FUNC(IOCTL_KGSL_RINGBUFFER_ISSUEIBCMDS_COMPAT,
  KGSL_IOCTL_FUNC(IOCTL_KGSL_DEVICE_WAITTIMESTAMP_CTXTID,
  kgsl_ioctl_device_waittimestamp_ctxtid),
  kgsl_ioctl_rb_issueibcmds_compat),
  KGSL_IOCTL_FUNC(IOCTL_KGSL_SUBMIT_COMMANDS_COMPAT,
L290: /* IOCTL_KGSL_CMDSTREAM_READTIMESTAMP is no longer supported */
  KGSL_IOCTL_FUNC(IOCTL_KGSL_SUBMIT_COMMANDS_COMPAT,
  kgsl_ioctl_submit_commands_compat),
  KGSL_IOCTL_FUNC(IOCTL_KGSL_CMDSTREAM_READTIMESTAMP_CTXTID,
  kgsl_ioctl_cmdstream_readtimestamp_ctxtid),
L291: KGSL_IOCTL_FUNC(IOCTL_KGSL_CMDSTREAM_READTIMESTAMP_CTXTID,
  kgsl_ioctl_submit_commands_compat),
  /* IOCTL_KGSL_CMDSTREAM_READTIMESTAMP is no longer supported */
  kgsl_ioctl_cmdstream_readtimestamp_ctxtid),
  /* IOCTL_KGSL_CMDSTREAM_FREEMEMONTIMESTAMP is no longer supported */
L292: kgsl_ioctl_cmdstream_readtimestamp_ctxtid),
  /* IOCTL_KGSL_CMDSTREAM_READTIMESTAMP is no longer supported */
  KGSL_IOCTL_FUNC(IOCTL_KGSL_CMDSTREAM_READTIMESTAMP_CTXTID,
  /* IOCTL_KGSL_CMDSTREAM_FREEMEMONTIMESTAMP is no longer supported */
  KGSL_IOCTL_FUNC(IOCTL_KGSL_CMDSTREAM_FREEMEMONTIMESTAMP_CTXTID_COMPAT,
L293: /* IOCTL_KGSL_CMDSTREAM_FREEMEMONTIMESTAMP is no longer supported */
  KGSL_IOCTL_FUNC(IOCTL_KGSL_CMDSTREAM_READTIMESTAMP_CTXTID,
  kgsl_ioctl_cmdstream_readtimestamp_ctxtid),
  KGSL_IOCTL_FUNC(IOCTL_KGSL_CMDSTREAM_FREEMEMONTIMESTAMP_CTXTID_COMPAT,
  kgsl_ioctl_cmdstream_freememontimestamp_ctxtid_compat),
L294: KGSL_IOCTL_FUNC(IOCTL_KGSL_CMDSTREAM_FREEMEMONTIMESTAMP_CTXTID_COMPAT,
  kgsl_ioctl_cmdstream_readtimestamp_ctxtid),
  /* IOCTL_KGSL_CMDSTREAM_FREEMEMONTIMESTAMP is no longer supported */
  kgsl_ioctl_cmdstream_freememontimestamp_ctxtid_compat),
  KGSL_IOCTL_FUNC(IOCTL_KGSL_DRAWCTXT_CREATE,
L295: kgsl_ioctl_cmdstream_freememontimestamp_ctxtid_compat),
  /* IOCTL_KGSL_CMDSTREAM_FREEMEMONTIMESTAMP is no longer supported */
  KGSL_IOCTL_FUNC(IOCTL_KGSL_CMDSTREAM_FREEMEMONTIMESTAMP_CTXTID_COMPAT,
  KGSL_IOCTL_FUNC(IOCTL_KGSL_DRAWCTXT_CREATE,
  kgsl_ioctl_drawctxt_create),
L308: KGSL_IOCTL_FUNC(IOCTL_KGSL_TIMESTAMP_EVENT_COMPAT,
  KGSL_IOCTL_FUNC(IOCTL_KGSL_GPUMEM_ALLOC_COMPAT,
  kgsl_ioctl_gpumem_alloc_compat),
  kgsl_ioctl_timestamp_event_compat),
  KGSL_IOCTL_FUNC(IOCTL_KGSL_SETPROPERTY_COMPAT,
L309: kgsl_ioctl_timestamp_event_compat),
  kgsl_ioctl_gpumem_alloc_compat),
  KGSL_IOCTL_FUNC(IOCTL_KGSL_TIMESTAMP_EVENT_COMPAT,
  KGSL_IOCTL_FUNC(IOCTL_KGSL_SETPROPERTY_COMPAT,
  kgsl_ioctl_device_setproperty_compat),

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_compat.h =====
L69: unsigned int timestamp;
  compat_uptr_t synclist;
  unsigned int numsyncs;
  /* private: reserved for future use */
  unsigned int __pad[4];
L77: struct kgsl_ringbuffer_issueibcmds_compat {
  _IOWR(KGSL_IOC_TYPE, 0x3D, struct kgsl_submit_commands_compat)
  
  unsigned int drawctxt_id;
  compat_ulong_t ibdesc_addr;
L81: unsigned int timestamp; /* output param */
  compat_ulong_t ibdesc_addr;
  unsigned int numibs;
  unsigned int flags;
  };
L85: #define IOCTL_KGSL_RINGBUFFER_ISSUEIBCMDS_COMPAT \
  };
  
  _IOWR(KGSL_IOC_TYPE, 0x10, struct kgsl_ringbuffer_issueibcmds_compat)
  
L86: _IOWR(KGSL_IOC_TYPE, 0x10, struct kgsl_ringbuffer_issueibcmds_compat)
  
  #define IOCTL_KGSL_RINGBUFFER_ISSUEIBCMDS_COMPAT \
  
  struct kgsl_cmdstream_freememontimestamp_ctxtid_compat {
L88: struct kgsl_cmdstream_freememontimestamp_ctxtid_compat {
  _IOWR(KGSL_IOC_TYPE, 0x10, struct kgsl_ringbuffer_issueibcmds_compat)
  
  unsigned int context_id;
  compat_ulong_t gpuaddr;
L92: unsigned int timestamp;
  compat_ulong_t gpuaddr;
  unsigned int type;
  };
  
L95: #define IOCTL_KGSL_CMDSTREAM_FREEMEMONTIMESTAMP_CTXTID_COMPAT \
  };
  
  _IOW(KGSL_IOC_TYPE, 0x17, \
  struct kgsl_cmdstream_freememontimestamp_ctxtid_compat)
L97: struct kgsl_cmdstream_freememontimestamp_ctxtid_compat)
  #define IOCTL_KGSL_CMDSTREAM_FREEMEMONTIMESTAMP_CTXTID_COMPAT \
  _IOW(KGSL_IOC_TYPE, 0x17, \
  
  struct kgsl_map_user_mem_compat {
L131: struct kgsl_timestamp_event_compat {
  _IOWR(KGSL_IOC_TYPE, 0x2f, struct kgsl_gpumem_alloc_compat)
  
  int type;                /* Type of event (see list below) */
  unsigned int timestamp;  /* Timestamp to trigger event on */
L133: unsigned int timestamp;  /* Timestamp to trigger event on */
  struct kgsl_timestamp_event_compat {
  int type;                /* Type of event (see list below) */
  unsigned int context_id; /* Context for the timestamp */
  compat_uptr_t priv;      /* Pointer to the event specific blob */
L134: unsigned int context_id; /* Context for the timestamp */
  int type;                /* Type of event (see list below) */
  unsigned int timestamp;  /* Timestamp to trigger event on */
  compat_uptr_t priv;      /* Pointer to the event specific blob */
  compat_size_t len;       /* Size of the event specific blob */
L139: #define IOCTL_KGSL_TIMESTAMP_EVENT_COMPAT \
  };
  
  _IOWR(KGSL_IOC_TYPE, 0x33, struct kgsl_timestamp_event_compat)
  
L140: _IOWR(KGSL_IOC_TYPE, 0x33, struct kgsl_timestamp_event_compat)
  
  #define IOCTL_KGSL_TIMESTAMP_EVENT_COMPAT \
  
  struct kgsl_gpumem_alloc_id_compat {

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_device.h =====
L52: * RESET indicates that GPU or GMU hang happens. KGSL is handling	*
  * past its timer) and all system resources are released.  SUSPEND is	*
  * requested by the kernel and will be enforced upon all open devices.	*
  * snapshot or recover GPU from hang. MINBW implies that DDR BW vote is	*
  * set to non-zero minimum value.
L69: * @KGSL_EVENT_RETIRED: The timestamp associated with the event retired
  * enum kgsl_event_results - result codes passed to an event callback when the
  * event is retired or cancelled
  * successflly
  * @KGSL_EVENT_CANCELLED: The event was cancelled before the event was fired
L99: ((_context != NULL) ? (_context)->id : KGSL_MEMSTORE_GLOBAL)
  
  #define KGSL_CONTEXT_ID(_context) \
  
  enum gpu_pwrlevel_op {
L134: int (*waittimestamp)(struct kgsl_device *device,
  int (*getproperty_compat)(struct kgsl_device *device,
  struct kgsl_device_getproperty *param);
  struct kgsl_context *context, unsigned int timestamp,
  unsigned int msecs);
L135: struct kgsl_context *context, unsigned int timestamp,
  struct kgsl_device_getproperty *param);
  int (*waittimestamp)(struct kgsl_device *device,
  unsigned int msecs);
  int (*readtimestamp)(struct kgsl_device *device, void *priv,
L137: int (*readtimestamp)(struct kgsl_device *device, void *priv,
  struct kgsl_context *context, unsigned int timestamp,
  unsigned int msecs);
  enum kgsl_timestamp_type type, unsigned int *timestamp);
  int (*queue_cmds)(struct kgsl_device_private *dev_priv,
L138: enum kgsl_timestamp_type type, unsigned int *timestamp);
  unsigned int msecs);
  int (*readtimestamp)(struct kgsl_device *device, void *priv,
  int (*queue_cmds)(struct kgsl_device_private *dev_priv,
  struct kgsl_context *context, struct kgsl_drawobj *drawobj[],
L141: uint32_t count, uint32_t *timestamp);
  int (*queue_cmds)(struct kgsl_device_private *dev_priv,
  struct kgsl_context *context, struct kgsl_drawobj *drawobj[],
  void (*power_stats)(struct kgsl_device *device,
  struct kgsl_power_stats *stats);
L195: /** @queue_recurring_cmd: Queue recurring commands to GMU */
  int (*gpu_bus_set)(struct kgsl_device *device, int bus_level, u32 ab);
  void (*deassert_gbif_halt)(struct kgsl_device *device);
  int (*queue_recurring_cmd)(struct kgsl_device_private *dev_priv,
  struct kgsl_context *context, struct kgsl_drawobj *drawobj);
L198: /** @dequeue_recurring_cmd: Dequeue recurring commands from GMU */
  int (*queue_recurring_cmd)(struct kgsl_device_private *dev_priv,
  struct kgsl_context *context, struct kgsl_drawobj *drawobj);
  int (*dequeue_recurring_cmd)(struct kgsl_device *device,
  struct kgsl_context *context);
L205: /** @gmu_based_dcvs_pwr_ops: Function ops for GMU based DCVS power operations */
  /** @create_hw_fence: Create a hardware fence */
  void (*create_hw_fence)(struct kgsl_device *device, struct kgsl_sync_fence *kfence);
  int (*gmu_based_dcvs_pwr_ops)(struct kgsl_device *device, u32 arg,
  enum gpu_pwrlevel_op op);
L206: int (*gmu_based_dcvs_pwr_ops)(struct kgsl_device *device, u32 arg,
  void (*create_hw_fence)(struct kgsl_device *device, struct kgsl_sync_fence *kfence);
  /** @gmu_based_dcvs_pwr_ops: Function ops for GMU based DCVS power operations */
  enum gpu_pwrlevel_op op);
  /** @set_thermal_index: Target specific function to send thermal constraint to GMU */
L208: /** @set_thermal_index: Target specific function to send thermal constraint to GMU */
  int (*gmu_based_dcvs_pwr_ops)(struct kgsl_device *device, u32 arg,
  enum gpu_pwrlevel_op op);
  void (*set_thermal_index)(struct kgsl_device *device);
  /** @alloc_dcvs_profile_memory: Function ops for GMU based DCVS profile operations */
L210: /** @alloc_dcvs_profile_memory: Function ops for GMU based DCVS profile operations */
  /** @set_thermal_index: Target specific function to send thermal constraint to GMU */
  void (*set_thermal_index)(struct kgsl_device *device);
  void (*alloc_dcvs_profile_memory)(struct kgsl_device *device,
  struct kgsl_process_private *proc_priv);
L215: /** @set_smmu_aperture: Target specific function to program the SMMU aperture registers */
  /** @is_first_boot_done: Check if the ADRENO device first boot is done */
  bool (*is_first_boot_done)(struct kgsl_device *device);
  int (*set_smmu_aperture)(struct kgsl_device *device);
  };
L216: int (*set_smmu_aperture)(struct kgsl_device *device);
  bool (*is_first_boot_done)(struct kgsl_device *device);
  /** @set_smmu_aperture: Target specific function to program the SMMU aperture registers */
  };
  
L283: /* Kernel virtual address for CX SMMU aperture register block */
  void __iomem *qdss_gfx_virt;
  
  void __iomem *smmu_aperture_virt;
  
L284: void __iomem *smmu_aperture_virt;
  
  /* Kernel virtual address for CX SMMU aperture register block */
  
  struct kgsl_memdesc *memstore;
L286: struct kgsl_memdesc *memstore;
  void __iomem *smmu_aperture_virt;
  
  struct kgsl_memdesc *scratch;
  
L290: struct gmu_core_device gmu_core;
  
  struct kgsl_mmu mmu;
  struct completion hwaccess_gate;
  struct completion halt_gate;
L341: bool prioritize_unrecoverable;	/* Overwrite with new GMU snapshots */
  bool force_panic;		/* Force panic after snapshot dump */
  bool skip_ib_capture;		/* Skip IB capture after snapshot */
  bool set_isdb_breakpoint;	/* Set isdb registers before snapshot */
  bool snapshot_atomic;		/* To capture snapshot in atomic context*/
L383: /** @gmu_fault: Set when a gmu or rgmu fault is encountered */
  /** @soc_code: Identifier containing product and feature code */
  u32 soc_code;
  bool gmu_fault;
  /** @regmap: GPU register map */
L384: bool gmu_fault;
  u32 soc_code;
  /** @gmu_fault: Set when a gmu or rgmu fault is encountered */
  /** @regmap: GPU register map */
  struct kgsl_regmap regmap;
L494: * sync_pt timestamp expires
  * this context was responsible for causing it
  * @timeline: sync timeline used to create fences that can be signaled when a
  * @events: A kgsl_event_group for this context - contains the list of GPU
  * events
L502: * across preemption
  * @fault_time: time of the first gpu hang in last _context_throttle_time ms
  * @user_ctxt_record: memory descriptor used by CP to save/restore VPC data
  * @total_fault_count: number of times gpu faulted in this context
  * @last_faulted_cmd_ts: last faulted command batch timestamp
L504: * @last_faulted_cmd_ts: last faulted command batch timestamp
  * across preemption
  * @total_fault_count: number of times gpu faulted in this context
  * @gmu_registered: whether context is registered with gmu or not
  */
L505: * @gmu_registered: whether context is registered with gmu or not
  * @total_fault_count: number of times gpu faulted in this context
  * @last_faulted_cmd_ts: last faulted command batch timestamp
  */
  struct kgsl_context {
L527: bool gmu_registered;
  unsigned int total_fault_count;
  unsigned int last_faulted_cmd_ts;
  /**
  * @gmu_dispatch_queue: dispatch queue id to which this context will be
L529: * @gmu_dispatch_queue: dispatch queue id to which this context will be
  bool gmu_registered;
  /**
  * submitted
  */
L532: u32 gmu_dispatch_queue;
  * submitted
  */
  /** @faults: List of @kgsl_fault_node to store fault information */
  struct list_head faults;

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_drawobj.c =====
L111: case KGSL_CMD_SYNCPOINT_TYPE_TIMESTAMP: {
  
  switch (event->type) {
  unsigned int retired;
  
L114: kgsl_readtimestamp(event->device,
  unsigned int retired;
  
  event->context, KGSL_TIMESTAMP_RETIRED,
  &retired);
L115: event->context, KGSL_TIMESTAMP_RETIRED,
  
  kgsl_readtimestamp(event->device,
  &retired);
  
L119: "  [timestamp] context %u timestamp %u (retired %u)\n",
  
  dev_err(device->dev,
  event->context->id, event->timestamp,
  retired);
L120: event->context->id, event->timestamp,
  dev_err(device->dev,
  "  [timestamp] context %u timestamp %u (retired %u)\n",
  retired);
  break;
L170: "kgsl: possible gpu syncpoint deadlock for context %u timestamp %u\n",
  
  dev_err(device->dev,
  drawobj->context->id, drawobj->timestamp);
  
L171: drawobj->context->id, drawobj->timestamp);
  dev_err(device->dev,
  "kgsl: possible gpu syncpoint deadlock for context %u timestamp %u\n",
  
  set_bit(ADRENO_CONTEXT_FENCE_LOG, &drawobj->context->priv);
L186: case KGSL_CMD_SYNCPOINT_TYPE_TIMESTAMP:
  
  switch (event->type) {
  dev_err(device->dev, "       [%u] TIMESTAMP %u:%u\n",
  i, event->context->id, event->timestamp);
L187: dev_err(device->dev, "       [%u] TIMESTAMP %u:%u\n",
  switch (event->type) {
  case KGSL_CMD_SYNCPOINT_TYPE_TIMESTAMP:
  i, event->context->id, event->timestamp);
  break;
L188: i, event->context->id, event->timestamp);
  case KGSL_CMD_SYNCPOINT_TYPE_TIMESTAMP:
  dev_err(device->dev, "       [%u] TIMESTAMP %u:%u\n",
  break;
  case KGSL_CMD_SYNCPOINT_TYPE_FENCE: {
L264: * This function is called by the GPU event when the sync event timestamp
  
  /*
  * expires
  */
L272: trace_syncpoint_timestamp_expire(event->syncobj,
  struct kgsl_drawobj_sync_event *event = priv;
  
  event->context, event->timestamp);
  
L273: event->context, event->timestamp);
  
  trace_syncpoint_timestamp_expire(event->syncobj,
  
  /*
L365: case KGSL_CMD_SYNCPOINT_TYPE_TIMESTAMP:
  
  switch (event->type) {
  kgsl_cancel_event(drawobj->device,
  &event->context->events, event->timestamp,
L367: &event->context->events, event->timestamp,
  case KGSL_CMD_SYNCPOINT_TYPE_TIMESTAMP:
  kgsl_cancel_event(drawobj->device,
  drawobj_sync_func, event);
  /*
L429: * signaled. The timelineobj now only needs all preceding timestamps to
  /*
  * At this point any syncobjs blocking this timelinobj have been
  * retire before signaling the timelines. Notify timelines to keep them
  * in sync with the timestamps as they retire.
L431: * in sync with the timestamps as they retire.
  * signaled. The timelineobj now only needs all preceding timestamps to
  * retire before signaling the timelines. Notify timelines to keep them
  */
  for (i = 0; i < timelineobj->count; i++)
L687: /* drawobj_add_sync_timestamp() - Add a new sync point for a sync obj
  }
  
  * @device: KGSL device
  * @syncobj: KGSL sync obj to add the sync point to
L692: * Add a new sync point timestamp event to the sync obj.
  * @priv: Private structure passed by the user
  *
  */
  static int drawobj_add_sync_timestamp(struct kgsl_device *device,
L694: static int drawobj_add_sync_timestamp(struct kgsl_device *device,
  * Add a new sync point timestamp event to the sync obj.
  */
  struct kgsl_drawobj_sync *syncobj,
  struct kgsl_cmd_syncpoint_timestamp *timestamp)
L696: struct kgsl_cmd_syncpoint_timestamp *timestamp)
  static int drawobj_add_sync_timestamp(struct kgsl_device *device,
  struct kgsl_drawobj_sync *syncobj,
  
  {
L701: timestamp->context_id);
  struct kgsl_drawobj *drawobj = DRAWOBJ(syncobj);
  struct kgsl_context *context = kgsl_context_get(device,
  struct kgsl_drawobj_sync_event *event;
  int ret = -EINVAL;
L713: * create a sync point on a future timestamp.
  * This has the effect of delaying a command from submitting until the
  * dependent command has cleared.  That said we obviously can't let them
  */
  
L719: kgsl_readtimestamp(device, context, KGSL_TIMESTAMP_QUEUED,
  unsigned int queued;
  
  &queued);
  
L722: if (timestamp_cmp(timestamp->timestamp, queued) > 0) {
  &queued);
  
  dev_err(device->dev,
  "Cannot create syncpoint for future timestamp %d (current %d)\n",
L724: "Cannot create syncpoint for future timestamp %d (current %d)\n",
  if (timestamp_cmp(timestamp->timestamp, queued) > 0) {
  dev_err(device->dev,
  timestamp->timestamp, queued);
  goto done;
L725: timestamp->timestamp, queued);
  dev_err(device->dev,
  "Cannot create syncpoint for future timestamp %d (current %d)\n",
  goto done;
  }
L737: event->type = KGSL_CMD_SYNCPOINT_TYPE_TIMESTAMP;
  event->id = id;
  
  event->syncobj = syncobj;
  event->context = context;
L740: event->timestamp = timestamp->timestamp;
  event->syncobj = syncobj;
  event->context = context;
  event->device = device;
  
L745: ret = kgsl_add_event(device, &context->events, timestamp->timestamp,
  set_bit(event->id, &syncobj->pending);
  
  drawobj_sync_func, event);
  

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_drawobj.h =====
L30: * @timestamp: Timestamp assigned to the command
  * @context: KGSL context that created the command
  * @type: Object type
  * @flags: flags
  * @refcount: kref structure to maintain the reference count
L38: uint32_t timestamp;
  struct kgsl_context *context;
  uint32_t type;
  unsigned long flags;
  struct kref refcount;
L53: * @global_ts: The ringbuffer timestamp corresponding to this
  * @base: Base kgsl_drawobj, this needs to be the first entry
  * @priv: Internal flags
  *    command obj
  * @fault_policy: Internal policy describing how to handle this command in case
L62: * @marker_timestamp: For markers, the timestamp of the last "real" command that
  * @cmdlist: List of IBs to issue
  * @memlist: List of all memory used in this command batch
  * was queued
  * @profiling_buf_entry: Mem entry containing the profiling buffer
L81: unsigned int marker_timestamp;
  struct list_head cmdlist;
  struct list_head memlist;
  struct kgsl_mem_entry *profiling_buf_entry;
  uint64_t profiling_buffer_gpuaddr;
L96: /* This hw sync object has been assigned a timestamp */
  /* This sync object can be sent to hardware */
  #define KGSL_SYNCOBJ_HW 1
  #define KGSL_SYNCOBJ_HW_TS 2
  
L111: * @synclist: Array of context/timestamp tuples to wait for before issuing
  * struct kgsl_drawobj_sync - KGSL sync object
  * @base: Base kgsl_drawobj, this needs to be the first entry
  * @numsyncs: Number of sync entries in the array
  * @pending: Bitmask of sync events that are active
L197: * @context: KGSL context for whose timestamp we want to
  * @type: Syncpoint type
  * @syncobj: Pointer to the syncobj that owns the sync event
  *           register this event
  * @timestamp: Pending timestamp for the event
L199: * @timestamp: Pending timestamp for the event
  * @context: KGSL context for whose timestamp we want to
  *           register this event
  * @handle: Pointer to a sync fence handle
  * @device: Pointer to the KGSL device
L208: unsigned int timestamp;
  struct kgsl_drawobj_sync *syncobj;
  struct kgsl_context *context;
  struct kgsl_sync_fence_cb *handle;
  struct kgsl_device *device;
L242: * @CMDOBJ_RECURRING_START: To track recurring command object at GMU
  * @CMDOBJ_FAULT - Mark the command object as faulted
  * the command obj in the profiling buffer
  * @CMDOBJ_RECURRING_STOP: To untrack recurring command object from GMU
  * @CMDOBJ_MARKER_EXPIRED: Whether this MARKER object is retired or not
L243: * @CMDOBJ_RECURRING_STOP: To untrack recurring command object from GMU
  * the command obj in the profiling buffer
  * @CMDOBJ_RECURRING_START: To track recurring command object at GMU
  * @CMDOBJ_MARKER_EXPIRED: Whether this MARKER object is retired or not
  * @CMDOBJ_NOP_SUBMISSION: NOP submission to do force retire via GMU
L245: * @CMDOBJ_NOP_SUBMISSION: NOP submission to do force retire via GMU
  * @CMDOBJ_RECURRING_STOP: To untrack recurring command object from GMU
  * @CMDOBJ_MARKER_EXPIRED: Whether this MARKER object is retired or not
  */
  enum kgsl_drawobj_cmd_priv {
L320: * kgsl_drawobj_create_timestamp_syncobj - Create a syncobj for a timestamp
  
  /**
  * @device: A GPU device handle
  * @context: Draw context for the syncobj
L323: * @timestamp: Timestamp to sync on
  * @device: A GPU device handle
  * @context: Draw context for the syncobj
  *
  * Create a sync object for @timestamp on @context.
L325: * Create a sync object for @timestamp on @context.
  * @timestamp: Timestamp to sync on
  *
  * Return: A pointer to the sync object
  */
L329: kgsl_drawobj_create_timestamp_syncobj(struct kgsl_device *device,
  */
  struct kgsl_drawobj_sync *
  struct kgsl_context *context, unsigned int timestamp);
  
L330: struct kgsl_context *context, unsigned int timestamp);
  struct kgsl_drawobj_sync *
  kgsl_drawobj_create_timestamp_syncobj(struct kgsl_device *device,
  
  struct kgsl_drawobj_bind *kgsl_drawobj_bind_create(struct kgsl_device *device,

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_eventlog.c =====
L26: * ringbuffer
  /*
  * This an internal event used to skip empty space at the bottom of the
  */
  

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_events.c =====
L41: trace_kgsl_fire_event(id, event->timestamp, event->result,
  int id = KGSL_CONTEXT_ID(event->context);
  
  jiffies - event->created, event->func);
  
L44: log_kgsl_fire_event(id, event->timestamp, event->result,
  jiffies - event->created, event->func);
  
  jiffies - event->created);
  
L60: * This ensures that the timestamp didn't slip back accidently, maybe
  
  /*
  * due to a memory barrier issue. This is highly unlikely but we've
  * been burned here in the past.
L64: if ((cur < processed) && ((processed - cur) < KGSL_TIMESTAMP_WINDOW))
  * been burned here in the past.
  */
  return false;
  
L74: unsigned int timestamp;
  {
  struct kgsl_event *event, *tmp;
  struct kgsl_context *context;
  
L91: group->readtimestamp(device, group->priv, KGSL_TIMESTAMP_RETIRED,
  spin_lock(&group->lock);
  
  &timestamp);
  
L92: &timestamp);
  
  group->readtimestamp(device, group->priv, KGSL_TIMESTAMP_RETIRED,
  
  if (!flush && !_do_process_group(group->processed, timestamp))
L94: if (!flush && !_do_process_group(group->processed, timestamp))
  &timestamp);
  
  goto out;
  
L98: if (timestamp_cmp(event->timestamp, timestamp) <= 0)
  
  list_for_each_entry_safe(event, tmp, &group->events, node) {
  signal_event(device, event, KGSL_EVENT_RETIRED);
  else if (flush)
L105: group->processed = timestamp;
  }
  
  
  out:
L137: * 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
L140: * @timestamp: Registered expiry timestamp for the event
  * @device: Pointer to a KGSL device
  * @group: Ponter to the GPU event group that owns the event
  */
  void kgsl_cancel_events_timestamp(struct kgsl_device *device,
L142: void kgsl_cancel_events_timestamp(struct kgsl_device *device,
  * @timestamp: Registered expiry timestamp for the event
  */
  struct kgsl_event_group *group, unsigned int timestamp)
  {
L143: struct kgsl_event_group *group, unsigned int timestamp)
  */
  void kgsl_cancel_events_timestamp(struct kgsl_device *device,
  {
  struct kgsl_event *event, *tmp;
L150: if (timestamp_cmp(timestamp, event->timestamp) == 0)
  
  list_for_each_entry_safe(event, tmp, &group->events, node) {
  signal_event(device, event, KGSL_EVENT_CANCELLED);
  }
L179: * @timestamp: Registered expiry timestamp for the event
  * @device: Pointer to a KGSL device
  * @group: Pointer to the group that contains the events
  * @func: Registered callback for the function
  * @priv: Registered priv data for the function
L184: struct kgsl_event_group *group, unsigned int timestamp,
  */
  void kgsl_cancel_event(struct kgsl_device *device,
  kgsl_event_func func, void *priv)
  {
L192: if (timestamp == event->timestamp && func == event->func &&
  
  list_for_each_entry_safe(event, tmp, &group->events, node) {
  event->priv == priv) {
  signal_event(device, event, KGSL_EVENT_CANCELLED);
L206: * @timestamp: Registered expiry timestamp for the event
  * @device: Pointer to a KGSL device
  * @group: Pointer to the group that contains the events
  * @func: Registered callback for the function
  * @priv: Registered priv data for the function
L212: unsigned int timestamp, kgsl_event_func func, void *priv)
  bool kgsl_event_pending(struct kgsl_device *device,
  struct kgsl_event_group *group,
  {
  struct kgsl_event *event;
L219: if (timestamp == event->timestamp && func == event->func &&
  spin_lock(&group->lock);
  list_for_each_entry(event, &group->events, node) {
  event->priv == priv) {
  result = true;
L232: * @timestamp: Timestamp that the event will expire on
  * @device: Pointer to a KGSL device
  * @group: Pointer to the group to add the event to
  * @func: Callback function for the event
  * @priv: Private data to send to the callback function
L237: unsigned int timestamp, kgsl_event_func func, void *priv)
  */
  int kgsl_add_event(struct kgsl_device *device, struct kgsl_event_group *group,
  {
  unsigned int queued;
L248: * If the caller is creating their own timestamps, let them schedule
  
  /*
  * events in the future. Otherwise only allow timestamps that have been
  * queued.
L249: * events in the future. Otherwise only allow timestamps that have been
  /*
  * If the caller is creating their own timestamps, let them schedule
  * queued.
  */
L253: group->readtimestamp(device, group->priv, KGSL_TIMESTAMP_QUEUED,
  */
  if (!context || !(context->flags & KGSL_CONTEXT_USER_GENERATED_TS)) {
  &queued);
  
L256: if (timestamp_cmp(timestamp, queued) > 0)
  &queued);
  
  return -EINVAL;
  }
L272: event->timestamp = timestamp;
  event->device = device;
  event->context = context;
  event->priv = priv;
  event->func = func;
L280: trace_kgsl_register_event(KGSL_CONTEXT_ID(context), timestamp, func);
  kthread_init_work(&event->work, _kgsl_event_worker);
  
  
  spin_lock(&group->lock);
L285: * Check to see if the requested timestamp has already retired.  If so,
  
  /*
  * schedule the callback right away
  */

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_gmu_core.c =====
L16: #include "kgsl_gmu_core.h"
  #include "adreno_trace.h"
  #include "kgsl_device.h"
  #include "kgsl_power_trace.h"
  #include "kgsl_sync.h"
L21: static const struct of_device_id gmu_match_table[] = {
  #include "kgsl_trace.h"
  
  { .compatible = "qcom,gpu-gmu", .data = &a6xx_gmu_driver },
  { .compatible = "qcom,gpu-rgmu", .data = &a6xx_rgmu_driver },
L22: { .compatible = "qcom,gpu-gmu", .data = &a6xx_gmu_driver },
  
  static const struct of_device_id gmu_match_table[] = {
  { .compatible = "qcom,gpu-rgmu", .data = &a6xx_rgmu_driver },
  { .compatible = "qcom,gen7-gmu", .data = &gen7_gmu_driver },
L23: { .compatible = "qcom,gpu-rgmu", .data = &a6xx_rgmu_driver },
  static const struct of_device_id gmu_match_table[] = {
  { .compatible = "qcom,gpu-gmu", .data = &a6xx_gmu_driver },
  { .compatible = "qcom,gen7-gmu", .data = &gen7_gmu_driver },
  { .compatible = "qcom,gen8-gmu", .data = &gen8_gmu_driver },
L24: { .compatible = "qcom,gen7-gmu", .data = &gen7_gmu_driver },
  { .compatible = "qcom,gpu-gmu", .data = &a6xx_gmu_driver },
  { .compatible = "qcom,gpu-rgmu", .data = &a6xx_rgmu_driver },
  { .compatible = "qcom,gen8-gmu", .data = &gen8_gmu_driver },
  { .compatible = "qcom,adreno-gmu-623.0", .data = &a6xx_gmu_driver },
L25: { .compatible = "qcom,gen8-gmu", .data = &gen8_gmu_driver },
  { .compatible = "qcom,gpu-rgmu", .data = &a6xx_rgmu_driver },
  { .compatible = "qcom,gen7-gmu", .data = &gen7_gmu_driver },
  { .compatible = "qcom,adreno-gmu-623.0", .data = &a6xx_gmu_driver },
  { .compatible = "qcom,adreno-gmu-663.0", .data = &a6xx_gmu_driver },
L26: { .compatible = "qcom,adreno-gmu-623.0", .data = &a6xx_gmu_driver },
  { .compatible = "qcom,gen7-gmu", .data = &gen7_gmu_driver },
  { .compatible = "qcom,gen8-gmu", .data = &gen8_gmu_driver },
  { .compatible = "qcom,adreno-gmu-663.0", .data = &a6xx_gmu_driver },
  { .compatible = "qcom,adreno-gmu-635.0", .data = &a6xx_gmu_driver },
L27: { .compatible = "qcom,adreno-gmu-663.0", .data = &a6xx_gmu_driver },
  { .compatible = "qcom,gen8-gmu", .data = &gen8_gmu_driver },
  { .compatible = "qcom,adreno-gmu-623.0", .data = &a6xx_gmu_driver },
  { .compatible = "qcom,adreno-gmu-635.0", .data = &a6xx_gmu_driver },
  { .compatible = "qcom,adreno-rgmu", .data = &a6xx_rgmu_driver },
L28: { .compatible = "qcom,adreno-gmu-635.0", .data = &a6xx_gmu_driver },
  { .compatible = "qcom,adreno-gmu-623.0", .data = &a6xx_gmu_driver },
  { .compatible = "qcom,adreno-gmu-663.0", .data = &a6xx_gmu_driver },
  { .compatible = "qcom,adreno-rgmu", .data = &a6xx_rgmu_driver },
  { .compatible = "qcom,adreno-gmu-x185.1", .data = &gen7_gmu_driver },
L29: { .compatible = "qcom,adreno-rgmu", .data = &a6xx_rgmu_driver },
  { .compatible = "qcom,adreno-gmu-663.0", .data = &a6xx_gmu_driver },
  { .compatible = "qcom,adreno-gmu-635.0", .data = &a6xx_gmu_driver },
  { .compatible = "qcom,adreno-gmu-x185.1", .data = &gen7_gmu_driver },
  { .compatible = "qcom,adreno-gmu-x145.0", .data = &gen7_gmu_driver },
L30: { .compatible = "qcom,adreno-gmu-x185.1", .data = &gen7_gmu_driver },
  { .compatible = "qcom,adreno-gmu-635.0", .data = &a6xx_gmu_driver },
  { .compatible = "qcom,adreno-rgmu", .data = &a6xx_rgmu_driver },
  { .compatible = "qcom,adreno-gmu-x145.0", .data = &gen7_gmu_driver },
  { .compatible = "qcom,adreno-gmu-x285.1", .data = &gen8_gmu_driver },
L31: { .compatible = "qcom,adreno-gmu-x145.0", .data = &gen7_gmu_driver },
  { .compatible = "qcom,adreno-rgmu", .data = &a6xx_rgmu_driver },
  { .compatible = "qcom,adreno-gmu-x185.1", .data = &gen7_gmu_driver },
  { .compatible = "qcom,adreno-gmu-x285.1", .data = &gen8_gmu_driver },
  { .compatible = "qcom,adreno-gmu-x285.0", .data = &gen8_gmu_driver },
L32: { .compatible = "qcom,adreno-gmu-x285.1", .data = &gen8_gmu_driver },
  { .compatible = "qcom,adreno-gmu-x185.1", .data = &gen7_gmu_driver },
  { .compatible = "qcom,adreno-gmu-x145.0", .data = &gen7_gmu_driver },
  { .compatible = "qcom,adreno-gmu-x285.0", .data = &gen8_gmu_driver },
  { .compatible = "qcom,adreno-gmu-x290.1", .data = &gen8_gmu_driver },
L33: { .compatible = "qcom,adreno-gmu-x285.0", .data = &gen8_gmu_driver },
  { .compatible = "qcom,adreno-gmu-x145.0", .data = &gen7_gmu_driver },
  { .compatible = "qcom,adreno-gmu-x285.1", .data = &gen8_gmu_driver },
  { .compatible = "qcom,adreno-gmu-x290.1", .data = &gen8_gmu_driver },
  { .compatible = "qcom,adreno-gmu-722.0", .data = &gen7_gmu_driver },
L34: { .compatible = "qcom,adreno-gmu-x290.1", .data = &gen8_gmu_driver },
  { .compatible = "qcom,adreno-gmu-x285.1", .data = &gen8_gmu_driver },
  { .compatible = "qcom,adreno-gmu-x285.0", .data = &gen8_gmu_driver },
  { .compatible = "qcom,adreno-gmu-722.0", .data = &gen7_gmu_driver },
  { .compatible = "qcom,adreno-gmu-753.1", .data = &gen7_gmu_driver },
L35: { .compatible = "qcom,adreno-gmu-722.0", .data = &gen7_gmu_driver },
  { .compatible = "qcom,adreno-gmu-x285.0", .data = &gen8_gmu_driver },
  { .compatible = "qcom,adreno-gmu-x290.1", .data = &gen8_gmu_driver },
  { .compatible = "qcom,adreno-gmu-753.1", .data = &gen7_gmu_driver },
  { .compatible = "qcom,adreno-gmu-830.1", .data = &gen8_gmu_driver },
L36: { .compatible = "qcom,adreno-gmu-753.1", .data = &gen7_gmu_driver },
  { .compatible = "qcom,adreno-gmu-x290.1", .data = &gen8_gmu_driver },
  { .compatible = "qcom,adreno-gmu-722.0", .data = &gen7_gmu_driver },
  { .compatible = "qcom,adreno-gmu-830.1", .data = &gen8_gmu_driver },
  { .compatible = "qcom,adreno-gmu-840.1", .data = &gen8_gmu_driver },
L37: { .compatible = "qcom,adreno-gmu-830.1", .data = &gen8_gmu_driver },
  { .compatible = "qcom,adreno-gmu-722.0", .data = &gen7_gmu_driver },
  { .compatible = "qcom,adreno-gmu-753.1", .data = &gen7_gmu_driver },
  { .compatible = "qcom,adreno-gmu-840.1", .data = &gen8_gmu_driver },
  { .compatible = "qcom,adreno-gmu-845.0", .data = &gen8_gmu_driver },
L38: { .compatible = "qcom,adreno-gmu-840.1", .data = &gen8_gmu_driver },
  { .compatible = "qcom,adreno-gmu-753.1", .data = &gen7_gmu_driver },
  { .compatible = "qcom,adreno-gmu-830.1", .data = &gen8_gmu_driver },
  { .compatible = "qcom,adreno-gmu-845.0", .data = &gen8_gmu_driver },
  { .compatible = "qcom,adreno-gmu-850.1", .data = &gen8_gmu_driver },
L39: { .compatible = "qcom,adreno-gmu-845.0", .data = &gen8_gmu_driver },
  { .compatible = "qcom,adreno-gmu-830.1", .data = &gen8_gmu_driver },
  { .compatible = "qcom,adreno-gmu-840.1", .data = &gen8_gmu_driver },
  { .compatible = "qcom,adreno-gmu-850.1", .data = &gen8_gmu_driver },
  {},
L40: { .compatible = "qcom,adreno-gmu-850.1", .data = &gen8_gmu_driver },
  { .compatible = "qcom,adreno-gmu-840.1", .data = &gen8_gmu_driver },
  { .compatible = "qcom,adreno-gmu-845.0", .data = &gen8_gmu_driver },
  {},
  };
L44: void __init gmu_core_register(void)
  };
  
  {
  const struct of_device_id *match;
L49: node = of_find_matching_node_and_match(NULL, gmu_match_table,
  struct device_node *node;
  
  &match);
  if (!node)
L58: void gmu_core_unregister(void)
  }
  
  {
  const struct of_device_id *match;
L63: node = of_find_matching_node_and_match(NULL, gmu_match_table,
  struct device_node *node;
  
  &match);
  if (!node)
L72: bool gmu_core_isenabled(struct kgsl_device *device)
  }
  
  {
  return test_bit(GMU_ENABLED, &device->gmu_core.flags);
L74: return test_bit(GMU_ENABLED, &device->gmu_core.flags);
  bool gmu_core_isenabled(struct kgsl_device *device)
  {
  }
  
L77: bool gmu_core_gpmu_isenabled(struct kgsl_device *device)
  }
  
  {
  return (device->gmu_core.dev_ops != NULL);
L79: return (device->gmu_core.dev_ops != NULL);
  bool gmu_core_gpmu_isenabled(struct kgsl_device *device)
  {
  }
  
L82: bool gmu_core_scales_bandwidth(struct kgsl_device *device)
  }
  
  {
  const struct gmu_dev_ops *ops = GMU_DEVICE_OPS(device);

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_gmu_core.h =====
L6: #ifndef __KGSL_GMU_CORE_H
  * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
  */
  #define __KGSL_GMU_CORE_H
  
L7: #define __KGSL_GMU_CORE_H
  */
  #ifndef __KGSL_GMU_CORE_H
  
  #include <linux/mailbox_client.h>
L14: /* GMU_DEVICE - Given an KGSL device return the GMU specific struct */
  #include "kgsl_sharedmem.h"
  
  #define GMU_DEVICE_OPS(_a) ((_a)->gmu_core.dev_ops)
  
L15: #define GMU_DEVICE_OPS(_a) ((_a)->gmu_core.dev_ops)
  
  /* GMU_DEVICE - Given an KGSL device return the GMU specific struct */
  
  /* GMU_PDEV - Given a KGSL device return the GMU platform device struct */
L17: /* GMU_PDEV - Given a KGSL device return the GMU platform device struct */
  #define GMU_DEVICE_OPS(_a) ((_a)->gmu_core.dev_ops)
  
  #define GMU_PDEV(device) ((device)->gmu_core.pdev)
  
L18: #define GMU_PDEV(device) ((device)->gmu_core.pdev)
  
  /* GMU_PDEV - Given a KGSL device return the GMU platform device struct */
  
  /* GMU_PDEV_DEV - Given a KGSL device return pointer to struct dev for GMU platform device */
L20: /* GMU_PDEV_DEV - Given a KGSL device return pointer to struct dev for GMU platform device */
  #define GMU_PDEV(device) ((device)->gmu_core.pdev)
  
  #define GMU_PDEV_DEV(device) (&((GMU_PDEV(device))->dev))
  
L21: #define GMU_PDEV_DEV(device) (&((GMU_PDEV(device))->dev))
  
  /* GMU_PDEV_DEV - Given a KGSL device return pointer to struct dev for GMU platform device */
  
  #define MAX_GX_LEVELS		32
L40: enum gmu_common_capabilities {
  #endif
  
  FCC_VERSION_INFO = 0,
  };
L44: enum gmu_platform_capabilities {
  };
  
  FAC_TRACE_BUFFER = 0,
  FAC_VRB_HW_FENCE_SHADOW_NUM_ENTRIES = 1,
L57: * 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.
L58: * from slumber. GMU_COLD_BOOT is booting for the first time. GMU_RESET
  /*
  * These are the different ways the GMU can boot. GMU_WARM_BOOT is waking up
  * is a soft reset of the GMU.
  */
L59: * is a soft reset of the GMU.
  * 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
  */
  enum gmu_core_boot {
L61: enum gmu_core_boot {
  * is a soft reset of the GMU.
  */
  GMU_WARM_BOOT = 0,
  GMU_COLD_BOOT = 1,
L62: GMU_WARM_BOOT = 0,
  */
  enum gmu_core_boot {
  GMU_COLD_BOOT = 1,
  GMU_RESET = 2
L63: GMU_COLD_BOOT = 1,
  enum gmu_core_boot {
  GMU_WARM_BOOT = 0,
  GMU_RESET = 2
  };
L64: GMU_RESET = 2
  GMU_WARM_BOOT = 0,
  GMU_COLD_BOOT = 1,
  };
  
L67: /* Bits for the flags field in the gmu structure */
  };
  
  enum gmu_core_flags {
  GMU_BOOT_INIT_DONE = 0,
L68: enum gmu_core_flags {
  
  /* Bits for the flags field in the gmu structure */
  GMU_BOOT_INIT_DONE = 0,
  GMU_HFI_ON,
L69: GMU_BOOT_INIT_DONE = 0,
  /* Bits for the flags field in the gmu structure */
  enum gmu_core_flags {
  GMU_HFI_ON,
  GMU_FAULT,
L70: GMU_HFI_ON,
  enum gmu_core_flags {
  GMU_BOOT_INIT_DONE = 0,
  GMU_FAULT,
  GMU_DCVS_REPLAY,
L71: GMU_FAULT,
  GMU_BOOT_INIT_DONE = 0,
  GMU_HFI_ON,
  GMU_DCVS_REPLAY,
  GMU_ENABLED,
L72: GMU_DCVS_REPLAY,
  GMU_HFI_ON,
  GMU_FAULT,
  GMU_ENABLED,
  GMU_RSCC_SLEEP_SEQ_DONE,
L73: GMU_ENABLED,
  GMU_FAULT,
  GMU_DCVS_REPLAY,
  GMU_RSCC_SLEEP_SEQ_DONE,
  GMU_DISABLE_SLUMBER,
L74: GMU_RSCC_SLEEP_SEQ_DONE,
  GMU_DCVS_REPLAY,
  GMU_ENABLED,
  GMU_DISABLE_SLUMBER,
  GMU_THERMAL_MITIGATION,
L75: GMU_DISABLE_SLUMBER,
  GMU_ENABLED,
  GMU_RSCC_SLEEP_SEQ_DONE,
  GMU_THERMAL_MITIGATION,
  GMU_FORCE_COLDBOOT,
L76: GMU_THERMAL_MITIGATION,
  GMU_RSCC_SLEEP_SEQ_DONE,
  GMU_DISABLE_SLUMBER,
  GMU_FORCE_COLDBOOT,
  GMU_SOCCP_VOTE_ON,
L77: GMU_FORCE_COLDBOOT,
  GMU_DISABLE_SLUMBER,
  GMU_THERMAL_MITIGATION,
  GMU_SOCCP_VOTE_ON,
  };
L78: GMU_SOCCP_VOTE_ON,
  GMU_THERMAL_MITIGATION,
  GMU_FORCE_COLDBOOT,
  };
  
L103: * Hopefully the GMU has finished waking up during this delay.
  /*
  * Wait time before trying to write the register again.
  * This delay must be less than the IFPC main hysteresis or
  * the GMU will start shutting down before we try again.

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_ioctl.c =====
L13: /* IOCTL_KGSL_DEVICE_WAITTIMESTAMP is no longer supported */
  KGSL_IOCTL_FUNC(IOCTL_KGSL_DEVICE_GETPROPERTY,
  kgsl_ioctl_device_getproperty),
  KGSL_IOCTL_FUNC(IOCTL_KGSL_DEVICE_WAITTIMESTAMP_CTXTID,
  kgsl_ioctl_device_waittimestamp_ctxtid),
L14: KGSL_IOCTL_FUNC(IOCTL_KGSL_DEVICE_WAITTIMESTAMP_CTXTID,
  kgsl_ioctl_device_getproperty),
  /* IOCTL_KGSL_DEVICE_WAITTIMESTAMP is no longer supported */
  kgsl_ioctl_device_waittimestamp_ctxtid),
  KGSL_IOCTL_FUNC(IOCTL_KGSL_RINGBUFFER_ISSUEIBCMDS,
L15: kgsl_ioctl_device_waittimestamp_ctxtid),
  /* IOCTL_KGSL_DEVICE_WAITTIMESTAMP is no longer supported */
  KGSL_IOCTL_FUNC(IOCTL_KGSL_DEVICE_WAITTIMESTAMP_CTXTID,
  KGSL_IOCTL_FUNC(IOCTL_KGSL_RINGBUFFER_ISSUEIBCMDS,
  kgsl_ioctl_rb_issueibcmds),
L16: KGSL_IOCTL_FUNC(IOCTL_KGSL_RINGBUFFER_ISSUEIBCMDS,
  KGSL_IOCTL_FUNC(IOCTL_KGSL_DEVICE_WAITTIMESTAMP_CTXTID,
  kgsl_ioctl_device_waittimestamp_ctxtid),
  kgsl_ioctl_rb_issueibcmds),
  KGSL_IOCTL_FUNC(IOCTL_KGSL_SUBMIT_COMMANDS,
L20: /* IOCTL_KGSL_CMDSTREAM_READTIMESTAMP is no longer supported */
  KGSL_IOCTL_FUNC(IOCTL_KGSL_SUBMIT_COMMANDS,
  kgsl_ioctl_submit_commands),
  KGSL_IOCTL_FUNC(IOCTL_KGSL_CMDSTREAM_READTIMESTAMP_CTXTID,
  kgsl_ioctl_cmdstream_readtimestamp_ctxtid),
L21: KGSL_IOCTL_FUNC(IOCTL_KGSL_CMDSTREAM_READTIMESTAMP_CTXTID,
  kgsl_ioctl_submit_commands),
  /* IOCTL_KGSL_CMDSTREAM_READTIMESTAMP is no longer supported */
  kgsl_ioctl_cmdstream_readtimestamp_ctxtid),
  /* IOCTL_KGSL_CMDSTREAM_FREEMEMONTIMESTAMP is no longer supported */
L22: kgsl_ioctl_cmdstream_readtimestamp_ctxtid),
  /* IOCTL_KGSL_CMDSTREAM_READTIMESTAMP is no longer supported */
  KGSL_IOCTL_FUNC(IOCTL_KGSL_CMDSTREAM_READTIMESTAMP_CTXTID,
  /* IOCTL_KGSL_CMDSTREAM_FREEMEMONTIMESTAMP is no longer supported */
  KGSL_IOCTL_FUNC(IOCTL_KGSL_CMDSTREAM_FREEMEMONTIMESTAMP_CTXTID,
L23: /* IOCTL_KGSL_CMDSTREAM_FREEMEMONTIMESTAMP is no longer supported */
  KGSL_IOCTL_FUNC(IOCTL_KGSL_CMDSTREAM_READTIMESTAMP_CTXTID,
  kgsl_ioctl_cmdstream_readtimestamp_ctxtid),
  KGSL_IOCTL_FUNC(IOCTL_KGSL_CMDSTREAM_FREEMEMONTIMESTAMP_CTXTID,
  kgsl_ioctl_cmdstream_freememontimestamp_ctxtid),
L24: KGSL_IOCTL_FUNC(IOCTL_KGSL_CMDSTREAM_FREEMEMONTIMESTAMP_CTXTID,
  kgsl_ioctl_cmdstream_readtimestamp_ctxtid),
  /* IOCTL_KGSL_CMDSTREAM_FREEMEMONTIMESTAMP is no longer supported */
  kgsl_ioctl_cmdstream_freememontimestamp_ctxtid),
  KGSL_IOCTL_FUNC(IOCTL_KGSL_DRAWCTXT_CREATE,
L25: kgsl_ioctl_cmdstream_freememontimestamp_ctxtid),
  /* IOCTL_KGSL_CMDSTREAM_FREEMEMONTIMESTAMP is no longer supported */
  KGSL_IOCTL_FUNC(IOCTL_KGSL_CMDSTREAM_FREEMEMONTIMESTAMP_CTXTID,
  KGSL_IOCTL_FUNC(IOCTL_KGSL_DRAWCTXT_CREATE,
  kgsl_ioctl_drawctxt_create),
L40: KGSL_IOCTL_FUNC(IOCTL_KGSL_TIMESTAMP_EVENT,
  KGSL_IOCTL_FUNC(IOCTL_KGSL_GPUMEM_ALLOC,
  kgsl_ioctl_gpumem_alloc),
  kgsl_ioctl_timestamp_event),
  KGSL_IOCTL_FUNC(IOCTL_KGSL_SETPROPERTY,
L41: kgsl_ioctl_timestamp_event),
  kgsl_ioctl_gpumem_alloc),
  KGSL_IOCTL_FUNC(IOCTL_KGSL_TIMESTAMP_EVENT,
  KGSL_IOCTL_FUNC(IOCTL_KGSL_SETPROPERTY,
  kgsl_ioctl_device_setproperty),

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_iommu.c =====
L13: #include <linux/qcom-iommu-util.h>
  #include <linux/of_platform.h>
  #include <linux/scatterlist.h>
  #include <linux/qcom-io-pgtable.h>
  #include <linux/seq_file.h>
L21: #include <linux/firmware/qcom/qcom_scm.h>
  #include <linux/version.h>
  #if (KERNEL_VERSION(6, 3, 0) <= LINUX_VERSION_CODE)
  #else
  #include <linux/qcom_scm.h>
L26: #include <linux/firmware/qcom/qcom_scm_addon.h>
  #endif
  #if IS_ENABLED(CONFIG_QCOM_SCM_ADDON)
  #endif
  #include <linux/random.h>
L34: #include "kgsl_iommu.h"
  #include "adreno.h"
  #include "kgsl_device.h"
  #include "kgsl_mmu.h"
  #include "kgsl_pwrctrl.h"
L40: #define KGSL_IOMMU_SPLIT_TABLE_BASE 0x0001ff8000000000ULL
  #include "kgsl_trace.h"
  
  
  #define KGSL_IOMMU_IDR1_OFFSET 0x24
L42: #define KGSL_IOMMU_IDR1_OFFSET 0x24
  #define KGSL_IOMMU_SPLIT_TABLE_BASE 0x0001ff8000000000ULL
  
  #define IDR1_NUMPAGENDXB GENMASK(30, 28)
  #define IDR1_PAGESIZE BIT(31)
L54: * struct kgsl_iommu_addr_entry - entry in the kgsl_pagetable rbtree.
  
  /*
  * @base: starting virtual address of the entry
  * @size: size of the entry
L59: struct kgsl_iommu_addr_entry {
  * @node: the rbtree node
  */
  uint64_t base;
  uint64_t size;
L67: static struct adreno_smmu_priv *kgsl_get_prvdata(struct device *dev)
  static struct kmem_cache *addr_entry_cache;
  
  {
  struct kgsl_device *kgsl = dev_get_drvdata(dev);
L70: struct kgsl_iommu *iommu = KGSL_IOMMU(kgsl);
  {
  struct kgsl_device *kgsl = dev_get_drvdata(dev);
  
  return &((iommu->user_context).adreno_smmu);
L72: return &((iommu->user_context).adreno_smmu);
  struct kgsl_iommu *iommu = KGSL_IOMMU(kgsl);
  
  }
  
L86: static void _tlb_add_page(struct iommu_iotlb_gather *gather,
  }
  
  unsigned long iova, size_t granule, void *cookie)
  {
L91: static const struct iommu_flush_ops kgsl_iopgtbl_tlb_ops = {
  }
  
  .tlb_flush_all = _tlb_flush_all,
  .tlb_flush_walk = _tlb_flush_walk,
L97: static struct kgsl_iommu_pt *to_iommu_pt(struct kgsl_pagetable *pagetable)
  };
  
  {
  return container_of(pagetable, struct kgsl_iommu_pt, base);
L99: return container_of(pagetable, struct kgsl_iommu_pt, base);
  static struct kgsl_iommu_pt *to_iommu_pt(struct kgsl_pagetable *pagetable)
  {
  }
  
L109: return IOMMU_SYS_CACHE_NWA;
  /* Return no-write-allocate if mmu feature for no-write-allocate is set */
  if (test_bit(KGSL_MMU_FORCE_LLCC_NWA, &mmu->features))
  
  /* Return 0 as default llcc allocation policy */
L115: static int _iommu_get_protection_flags(struct kgsl_mmu *mmu,
  }
  
  struct kgsl_memdesc *memdesc)
  {
L118: int flags = IOMMU_READ | IOMMU_WRITE | IOMMU_NOEXEC;
  struct kgsl_memdesc *memdesc)
  {
  
  flags |= get_llcc_flags(mmu);
L123: flags &= ~IOMMU_WRITE;
  
  if (memdesc->flags & KGSL_MEMFLAGS_GPUREADONLY)
  
  if (TEST_FLAG(KGSL_MEMDESC_PRIVILEGED, &memdesc->priv))
L126: flags |= IOMMU_PRIV;
  
  if (TEST_FLAG(KGSL_MEMDESC_PRIVILEGED, &memdesc->priv))
  
  if (memdesc->flags & KGSL_MEMFLAGS_IOCOHERENT)
L129: flags |= IOMMU_CACHE;
  
  if (memdesc->flags & KGSL_MEMFLAGS_IOCOHERENT)
  
  if (TEST_FLAG(KGSL_MEMDESC_UCODE, &memdesc->priv))
L132: flags &= ~IOMMU_NOEXEC;
  
  if (TEST_FLAG(KGSL_MEMDESC_UCODE, &memdesc->priv))
  
  return flags;
L169: static struct iommu_domain *to_iommu_domain(struct kgsl_iommu_context *context)
  }
  
  {
  return context->domain;
L174: static struct kgsl_iommu *to_kgsl_iommu(struct kgsl_pagetable *pt)
  }
  
  {
  return &pt->mmu->iommu;
L176: return &pt->mmu->iommu;
  static struct kgsl_iommu *to_kgsl_iommu(struct kgsl_pagetable *pt)
  {
  }
  
L186: static struct page *iommu_get_guard_page(struct kgsl_memdesc *memdesc)
  static struct page *kgsl_secure_guard_page;
  
  {
  if (kgsl_memdesc_is_secured(memdesc)) {
L202: static size_t iommu_pgsize(unsigned long pgsize_bitmap, unsigned long iova,
  }
  
  phys_addr_t paddr, size_t size, size_t *count)
  {
L257: static void kgsl_iommu_flush_tlb(struct kgsl_mmu *mmu)
  }
  
  {
  struct kgsl_device *device = KGSL_MMU_DEVICE(mmu);
L260: struct kgsl_iommu *iommu = &mmu->iommu;
  {
  struct kgsl_device *device = KGSL_MMU_DEVICE(mmu);
  
  iommu_flush_iotlb_all(to_iommu_domain(&iommu->user_context));
L262: iommu_flush_iotlb_all(to_iommu_domain(&iommu->user_context));
  struct kgsl_iommu *iommu = &mmu->iommu;
  
  
  /* As LPAC is optional, check LPAC domain is present before flush */

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_iommu.h =====
L6: #ifndef __KGSL_IOMMU_H
  * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
  */
  #define __KGSL_IOMMU_H
  
L7: #define __KGSL_IOMMU_H
  */
  #ifndef __KGSL_IOMMU_H
  
  #include <linux/adreno-smmu-priv.h>
L9: #include <linux/adreno-smmu-priv.h>
  #define __KGSL_IOMMU_H
  
  #include <linux/io-pgtable.h>
  #include <linux/qcom-iommu-util.h>
L11: #include <linux/qcom-iommu-util.h>
  #include <linux/adreno-smmu-priv.h>
  #include <linux/io-pgtable.h>
  /*
  * These defines control the address range for allocations that
L16: #define KGSL_IOMMU_GLOBAL_MEM_SIZE	(90 * SZ_1M)
  * are mapped into all pagetables.
  */
  #define KGSL_IOMMU_GLOBAL_MEM_BASE32	0xf8000000
  #define KGSL_IOMMU_GLOBAL_MEM_BASE64	\
L17: #define KGSL_IOMMU_GLOBAL_MEM_BASE32	0xf8000000
  */
  #define KGSL_IOMMU_GLOBAL_MEM_SIZE	(90 * SZ_1M)
  #define KGSL_IOMMU_GLOBAL_MEM_BASE64	\
  (KGSL_MEMSTORE_TOKEN_ADDRESS - KGSL_IOMMU_GLOBAL_MEM_SIZE)
L18: #define KGSL_IOMMU_GLOBAL_MEM_BASE64	\
  #define KGSL_IOMMU_GLOBAL_MEM_SIZE	(90 * SZ_1M)
  #define KGSL_IOMMU_GLOBAL_MEM_BASE32	0xf8000000
  (KGSL_MEMSTORE_TOKEN_ADDRESS - KGSL_IOMMU_GLOBAL_MEM_SIZE)
  
L19: (KGSL_MEMSTORE_TOKEN_ADDRESS - KGSL_IOMMU_GLOBAL_MEM_SIZE)
  #define KGSL_IOMMU_GLOBAL_MEM_BASE32	0xf8000000
  #define KGSL_IOMMU_GLOBAL_MEM_BASE64	\
  
  /*
L22: * This is a dummy token address that we use to identify memstore when the user
  
  /*
  * wants to map it. mmap() uses a unsigned long for the offset so we need a 32
  * bit value that works with all sized apps. We chose a value that was purposely
L29: #define KGSL_MEMSTORE_TOKEN_ADDRESS	(KGSL_IOMMU_SECURE_BASE32 - SZ_4K)
  */
  
  
  #define KGSL_IOMMU_GLOBAL_MEM_BASE(__mmu)	\
L31: #define KGSL_IOMMU_GLOBAL_MEM_BASE(__mmu)	\
  #define KGSL_MEMSTORE_TOKEN_ADDRESS	(KGSL_IOMMU_SECURE_BASE32 - SZ_4K)
  
  (test_bit(KGSL_MMU_64BIT, &(__mmu)->features) ? \
  KGSL_IOMMU_GLOBAL_MEM_BASE64 : KGSL_IOMMU_GLOBAL_MEM_BASE32)
L33: KGSL_IOMMU_GLOBAL_MEM_BASE64 : KGSL_IOMMU_GLOBAL_MEM_BASE32)
  #define KGSL_IOMMU_GLOBAL_MEM_BASE(__mmu)	\
  (test_bit(KGSL_MMU_64BIT, &(__mmu)->features) ? \
  
  #define KGSL_IOMMU_SVM_BASE32(__mmu)	\
L35: #define KGSL_IOMMU_SVM_BASE32(__mmu)	\
  KGSL_IOMMU_GLOBAL_MEM_BASE64 : KGSL_IOMMU_GLOBAL_MEM_BASE32)
  
  (ADRENO_DEVICE(KGSL_MMU_DEVICE(__mmu))->uche_gmem_base + \
  ADRENO_DEVICE(KGSL_MMU_DEVICE(__mmu))->gpucore->gmem_size)
L39: #define KGSL_IOMMU_SVM_END32(__mmu) \
  ADRENO_DEVICE(KGSL_MMU_DEVICE(__mmu))->gpucore->gmem_size)
  
  (test_bit(KGSL_MMU_64BIT, &(__mmu)->features) ? \
  (test_bit(KGSL_MMU_IOPGTABLE, &(__mmu)->features) ? \
L42: KGSL_MEMSTORE_TOKEN_ADDRESS : \
  (test_bit(KGSL_MMU_64BIT, &(__mmu)->features) ? \
  (test_bit(KGSL_MMU_IOPGTABLE, &(__mmu)->features) ? \
  KGSL_IOMMU_GLOBAL_MEM_BASE64) : \
  (0xC0000000 - SZ_16M))
L43: KGSL_IOMMU_GLOBAL_MEM_BASE64) : \
  (test_bit(KGSL_MMU_IOPGTABLE, &(__mmu)->features) ? \
  KGSL_MEMSTORE_TOKEN_ADDRESS : \
  (0xC0000000 - SZ_16M))
  
L49: #define KGSL_IOMMU_SECURE_SIZE32 SZ_256M
  * Limit secure size to 256MB for 32bit kernels.
  */
  #define KGSL_IOMMU_SECURE_BASE32	\
  (KGSL_IOMMU_SECURE_BASE64 - KGSL_IOMMU_SECURE_SIZE32)
L50: #define KGSL_IOMMU_SECURE_BASE32	\
  */
  #define KGSL_IOMMU_SECURE_SIZE32 SZ_256M
  (KGSL_IOMMU_SECURE_BASE64 - KGSL_IOMMU_SECURE_SIZE32)
  #define KGSL_IOMMU_SECURE_END32 KGSL_IOMMU_SECURE_BASE64
L51: (KGSL_IOMMU_SECURE_BASE64 - KGSL_IOMMU_SECURE_SIZE32)
  #define KGSL_IOMMU_SECURE_SIZE32 SZ_256M
  #define KGSL_IOMMU_SECURE_BASE32	\
  #define KGSL_IOMMU_SECURE_END32 KGSL_IOMMU_SECURE_BASE64
  
L52: #define KGSL_IOMMU_SECURE_END32 KGSL_IOMMU_SECURE_BASE64
  #define KGSL_IOMMU_SECURE_BASE32	\
  (KGSL_IOMMU_SECURE_BASE64 - KGSL_IOMMU_SECURE_SIZE32)
  
  #define KGSL_IOMMU_SECURE_BASE64	0x100000000ULL
L54: #define KGSL_IOMMU_SECURE_BASE64	0x100000000ULL
  #define KGSL_IOMMU_SECURE_END32 KGSL_IOMMU_SECURE_BASE64
  
  #define KGSL_IOMMU_SECURE_END64	\
  (KGSL_IOMMU_SECURE_BASE64 + KGSL_IOMMU_SECURE_SIZE64)
L55: #define KGSL_IOMMU_SECURE_END64	\
  
  #define KGSL_IOMMU_SECURE_BASE64	0x100000000ULL
  (KGSL_IOMMU_SECURE_BASE64 + KGSL_IOMMU_SECURE_SIZE64)
  
L56: (KGSL_IOMMU_SECURE_BASE64 + KGSL_IOMMU_SECURE_SIZE64)
  #define KGSL_IOMMU_SECURE_BASE64	0x100000000ULL
  #define KGSL_IOMMU_SECURE_END64	\
  
  #define KGSL_IOMMU_MAX_SECURE_SIZE 0xFFFFF000
L58: #define KGSL_IOMMU_MAX_SECURE_SIZE 0xFFFFF000
  (KGSL_IOMMU_SECURE_BASE64 + KGSL_IOMMU_SECURE_SIZE64)
  
  
  #define KGSL_IOMMU_SECURE_SIZE64	\
L60: #define KGSL_IOMMU_SECURE_SIZE64	\
  #define KGSL_IOMMU_MAX_SECURE_SIZE 0xFFFFF000
  
  (KGSL_IOMMU_MAX_SECURE_SIZE - KGSL_IOMMU_SECURE_SIZE32)
  
L61: (KGSL_IOMMU_MAX_SECURE_SIZE - KGSL_IOMMU_SECURE_SIZE32)
  
  #define KGSL_IOMMU_SECURE_SIZE64	\
  
  #define KGSL_IOMMU_SECURE_BASE(_mmu) (test_bit(KGSL_MMU_64BIT, \
L63: #define KGSL_IOMMU_SECURE_BASE(_mmu) (test_bit(KGSL_MMU_64BIT, \
  (KGSL_IOMMU_MAX_SECURE_SIZE - KGSL_IOMMU_SECURE_SIZE32)
  
  &(_mmu)->features) ? KGSL_IOMMU_SECURE_BASE64 : \
  KGSL_IOMMU_SECURE_BASE32)
L64: &(_mmu)->features) ? KGSL_IOMMU_SECURE_BASE64 : \
  
  #define KGSL_IOMMU_SECURE_BASE(_mmu) (test_bit(KGSL_MMU_64BIT, \
  KGSL_IOMMU_SECURE_BASE32)
  #define KGSL_IOMMU_SECURE_END(_mmu) (test_bit(KGSL_MMU_64BIT, \
L65: KGSL_IOMMU_SECURE_BASE32)
  #define KGSL_IOMMU_SECURE_BASE(_mmu) (test_bit(KGSL_MMU_64BIT, \
  &(_mmu)->features) ? KGSL_IOMMU_SECURE_BASE64 : \
  #define KGSL_IOMMU_SECURE_END(_mmu) (test_bit(KGSL_MMU_64BIT, \
  &(_mmu)->features) ? KGSL_IOMMU_SECURE_END64 : \
L66: #define KGSL_IOMMU_SECURE_END(_mmu) (test_bit(KGSL_MMU_64BIT, \
  &(_mmu)->features) ? KGSL_IOMMU_SECURE_BASE64 : \
  KGSL_IOMMU_SECURE_BASE32)
  &(_mmu)->features) ? KGSL_IOMMU_SECURE_END64 : \
  KGSL_IOMMU_SECURE_END32)

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_mmu.c =====
L328: kgsl_mmu_map(struct kgsl_pagetable *pagetable,
  
  int
  struct kgsl_memdesc *memdesc)
  {
L369: int kgsl_mmu_map_child(struct kgsl_pagetable *pt,
  }
  
  struct kgsl_memdesc *memdesc, u64 offset,
  struct kgsl_memdesc *child, u64 child_offset,
L396: int kgsl_mmu_map_zero_page_to_range(struct kgsl_pagetable *pt,
  }
  
  struct kgsl_memdesc *memdesc, u64 start, u64 length)
  {
L510: void kgsl_mmu_map_global(struct kgsl_device *device,
  }
  
  struct kgsl_memdesc *memdesc, u32 padding)
  {
L622: ssize_t kgsl_mmu_map_sg(struct iommu_domain *domain,
  };
  
  unsigned long iova, struct scatterlist *sg,
  unsigned int nents, int prot)
L627: return iommu_map_sg(domain, iova, sg, nents, prot, GFP_KERNEL);
  {
  #if (KERNEL_VERSION(6, 2, 0) <= LINUX_VERSION_CODE)
  #else
  return iommu_map_sg(domain, iova, sg, nents, prot);
L629: return iommu_map_sg(domain, iova, sg, nents, prot);
  return iommu_map_sg(domain, iova, sg, nents, prot, GFP_KERNEL);
  #else
  #endif
  }
L650: * Try to bind the IOMMU and if it doesn't exist for some reason
  
  /*
  * go for the NOMMU option instead
  */
L653: ret = kgsl_iommu_bind(device, to_platform_device(dev));
  * go for the NOMMU option instead
  */
  
  if (!ret || ret == -EPROBE_DEFER)
L686: * Add kgsl-smmu and context bank as a component device to establish
  {
  /*
  * correct probe order with smmu driver.
  *
L687: * correct probe order with smmu driver.
  /*
  * Add kgsl-smmu and context bank as a component device to establish
  *
  * As context bank node in DT contains "iommus" property. fw_devlink
L689: * As context bank node in DT contains "iommus" property. fw_devlink
  * correct probe order with smmu driver.
  *
  * ensures that context bank is probed only after corresponding
  * supplier (smmu driver) probe is done.
L691: * supplier (smmu driver) probe is done.
  * As context bank node in DT contains "iommus" property. fw_devlink
  * ensures that context bank is probed only after corresponding
  *
  * Adding context bank as a component device ensures master bind
L694: * (adreno_bind) is called only once component (kgsl-smmu and context
  *
  * Adding context bank as a component device ensures master bind
  * banks) probe is done thus ensuring correct probe order with smmu
  * driver.
L695: * banks) probe is done thus ensuring correct probe order with smmu
  * Adding context bank as a component device ensures master bind
  * (adreno_bind) is called only once component (kgsl-smmu and context
  * driver.
  *
L698: * kgsl-smmu also need to be a component because we need kgsl-smmu
  * driver.
  *
  * device info in order to initialize the context banks.
  */
L702: "qcom,smmu-kgsl-cb")) {
  */
  if (of_device_is_compatible(pdev->dev.of_node,
  return component_add(&pdev->dev, &kgsl_mmu_cb_component_ops);
  }
L715: "qcom,smmu-kgsl-cb")) {
  {
  if (of_device_is_compatible(pdev->dev.of_node,
  component_del(&pdev->dev, &kgsl_mmu_cb_component_ops);
  return;
L739: { .compatible = "qcom,kgsl-smmu-v2" },
  
  static const struct of_device_id mmu_match_table[] = {
  { .compatible = "qcom,smmu-kgsl-cb" },
  {},
L740: { .compatible = "qcom,smmu-kgsl-cb" },
  static const struct of_device_id mmu_match_table[] = {
  { .compatible = "qcom,kgsl-smmu-v2" },
  {},
  };
L745: * Legacy pdev for kgsl-smmu component. This is required
  
  /*
  * with non-standard GPU DT bindings which maintains dummy
  * IOMMU device.
L747: * IOMMU device.
  * Legacy pdev for kgsl-smmu component. This is required
  * with non-standard GPU DT bindings which maintains dummy
  */
  static struct platform_driver kgsl_mmu_driver = {
L753: .name = "kgsl-iommu",
  .remove = kgsl_mmu_dev_remove,
  .driver = {
  .of_match_table = mmu_match_table,
  }

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_mmu.h =====
L24: (_ttbr0 & (BIT_ULL(KGSL_IOMMU_ASID_START_BIT) - 1))
  /* Mask ASID fields to match 48bit ptbase address*/
  #define MMU_SW_PT_BASE(_ttbr0) \
  
  #define KGSL_MMU_DEVICE(_mmu) \
L52: KGSL_MMU_TYPE_IOMMU = 0,
  
  enum kgsl_mmutype {
  KGSL_MMU_TYPE_NONE
  };
L56: #define KGSL_IOMMU_SMMU_V500 1
  };
  
  
  struct kgsl_pagetable {
L169: /** @KGSL_MMU_SMMU_APERTURE: Set the SMMU aperture */
  /** @KGSL_MMU_LLC_ENABLE: Set if LLC is activated for the target */
  KGSL_MMU_LLCC_ENABLE,
  KGSL_MMU_SMMU_APERTURE,
  /**
L170: KGSL_MMU_SMMU_APERTURE,
  KGSL_MMU_LLCC_ENABLE,
  /** @KGSL_MMU_SMMU_APERTURE: Set the SMMU aperture */
  /**
  * @KGSL_MMU_IOPGTABLE: Set if the qcom,adreno-smmu implementation is
L172: * @KGSL_MMU_IOPGTABLE: Set if the qcom,adreno-smmu implementation is
  KGSL_MMU_SMMU_APERTURE,
  /**
  * available. Implies split address space and per-process pagetables
  */
L184: #include "kgsl_iommu.h"
  };
  
  
  /**
L208: /** mmu: Pointer to the IOMMU sub-device */
  /** @pfpolicy: The current pagefault policy for the device */
  unsigned long pfpolicy;
  struct kgsl_iommu iommu;
  };
L209: struct kgsl_iommu iommu;
  unsigned long pfpolicy;
  /** mmu: Pointer to the IOMMU sub-device */
  };
  
L212: #define KGSL_IOMMU(d) (&((d)->mmu.iommu))
  };
  
  
  int __init kgsl_mmu_init(void);
L221: int kgsl_mmu_map(struct kgsl_pagetable *pagetable,
  void kgsl_mmu_putpagetable(struct kgsl_pagetable *pagetable);
  
  struct kgsl_memdesc *memdesc);
  int kgsl_mmu_map_child(struct kgsl_pagetable *pt,
L223: int kgsl_mmu_map_child(struct kgsl_pagetable *pt,
  int kgsl_mmu_map(struct kgsl_pagetable *pagetable,
  struct kgsl_memdesc *memdesc);
  struct kgsl_memdesc *memdesc, u64 offset,
  struct kgsl_memdesc *child, u64 child_offset,
L227: int kgsl_mmu_map_zero_page_to_range(struct kgsl_pagetable *pt,
  struct kgsl_memdesc *child, u64 child_offset,
  u64 length);
  struct kgsl_memdesc *memdesc, u64 start, u64 length);
  int kgsl_mmu_unmap(struct kgsl_pagetable *pagetable,
L253: * Static inline functions of MMU that simply call the SMMU specific
  
  /*
  * function using a function pointer. These functions can be thought
  * of as wrappers around the actual function
L395: * kgsl_mmu_map_global - Map a memdesc as a global buffer
  
  /**
  * @device: A KGSL GPU device handle
  * @memdesc: Pointer to a GPU memory descriptor
L402: void kgsl_mmu_map_global(struct kgsl_device *device,
  * Map a buffer as globally accessible in all pagetable contexts
  */
  struct kgsl_memdesc *memdesc, u32 padding);
  
L437: #if IS_ENABLED(CONFIG_ARM_SMMU)
  void kgsl_mmu_pagetable_add(struct kgsl_mmu *mmu, struct kgsl_pagetable *pagetable);
  
  int kgsl_iommu_bind(struct kgsl_device *device, struct platform_device *pdev);
  #else
L438: int kgsl_iommu_bind(struct kgsl_device *device, struct platform_device *pdev);
  
  #if IS_ENABLED(CONFIG_ARM_SMMU)
  #else
  static inline int kgsl_iommu_bind(struct kgsl_device *device, struct platform_device *pdev)
L440: static inline int kgsl_iommu_bind(struct kgsl_device *device, struct platform_device *pdev)
  int kgsl_iommu_bind(struct kgsl_device *device, struct platform_device *pdev);
  #else
  {
  return -ENODEV;
L447: * kgsl_mmu_map_sg - Map the given buffer to the IOMMU domain
  
  /**
  * @domain: The IOMMU domain to perform the mapping
  * @iova: The start address to map the buffer
L448: * @domain: The IOMMU domain to perform the mapping
  /**
  * kgsl_mmu_map_sg - Map the given buffer to the IOMMU domain
  * @iova: The start address to map the buffer
  * @sgt: The sg_table object describing the buffer
L451: * @prot: IOMMU protection bits
  * @iova: The start address to map the buffer
  * @sgt: The sg_table object describing the buffer
  *
  * Creates a mapping at @iova for the buffer described by a scatterlist
L454: * stored in the given sg_table object in the provided IOMMU domain.
  *
  * Creates a mapping at @iova for the buffer described by a scatterlist
  */
  ssize_t kgsl_mmu_map_sg(struct iommu_domain *domain,
L456: ssize_t kgsl_mmu_map_sg(struct iommu_domain *domain,
  * stored in the given sg_table object in the provided IOMMU domain.
  */
  unsigned long iova, struct scatterlist *sg,
  unsigned int nents, int prot);

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.c =====
L26: #include "kgsl_gmu_core.h"
  #include "kgsl_eventlog.h"
  #include "kgsl_device.h"
  #include "kgsl_power_trace.h"
  #include "kgsl_pwrscale.h"
L55: "gmu_clk",
  "rbcpr_clk",
  "iref_clk",
  "ahb_clk",
  "smmu_vote",
L57: "smmu_vote",
  "gmu_clk",
  "ahb_clk",
  "apb_pclk",
  "hub_cx_int_clk",
L162: * If the last timestamp that set the constraint has retired,
  
  /*
  * clear the constraint
  */
L165: if (kgsl_check_timestamp(device, context,
  * clear the constraint
  */
  pwr->constraint.owner_timestamp)) {
  reset = true;
L166: pwr->constraint.owner_timestamp)) {
  */
  if (kgsl_check_timestamp(device, context,
  reset = true;
  kgsl_context_put(context);
L174: * the timestamp retires
  /*
  * Increase the timeout to keep the constraint at least till
  */
  pwr->constraint.expires = jiffies +
L300: * as the current one, update ownership and timestamp.
  * If a constraint is already set, set a new constraint only
  * if it is faster. If the requested constraint is the same
  */
  if ((pwrc_old->type == KGSL_CONSTRAINT_NONE) ||
L310: pwrc_old->owner_timestamp = ts;
  pwrc_old->expires = jiffies +
  msecs_to_jiffies(atomic64_read(&device->pwrctrl.interval_timeout));
  kgsl_pwrctrl_pwrlevel_change(device, constraint);
  /* Trace the constraint being set by the driver */
L316: pwrc_old->owner_timestamp = ts;
  } else if ((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));
L398: if (device->ftbl->gmu_based_dcvs_pwr_ops(device, level, GPU_PWRLEVEL_OP_MAX_PWRLEVEL)) {
  pwr->max_pwrlevel = level;
  
  /* Update the current level using the new limit */
  kgsl_pwrctrl_pwrlevel_change(device, pwr->active_pwrlevel);
L434: if (device->ftbl->gmu_based_dcvs_pwr_ops(device, level, GPU_PWRLEVEL_OP_MIN_PWRLEVEL)) {
  pwr->min_pwrlevel = level;
  
  /* Update the current level using the new limit */
  kgsl_pwrctrl_pwrlevel_change(device, pwr->active_pwrlevel);
L551: if (device->ftbl->gmu_based_dcvs_pwr_ops(device, level, GPU_PWRLEVEL_OP_GPUCLK))
  kgsl_mutex_lock(&device->mutex);
  
  kgsl_pwrctrl_pwrlevel_change(device, (unsigned int) level);
  
L727: if (gmu_core_gpmu_isenabled(device))
  int ret;
  
  return -EOPNOTSUPP;
  
L858: * 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
L860: * send to GMU
  * 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
  */
  if (!device->host_based_dcvs) {
L865: gmu_core_mark_for_coldboot(device);
  pwr->update_dcvs_table = true;
  pwr->default_pwrlevel = level;
  } else {
  pwr->default_pwrlevel = level;
L1109: if (device->ftbl->gmu_based_dcvs_pwr_ops(device, enable, GPU_PWRLEVEL_OP_DCVS_ENABLE)) {
  kgsl_mutex_lock(&device->mutex);
  
  if (enable)
  kgsl_pwrscale_governor_enable(device);
L1126: struct gmu_core_device *gmu_core = &device->gmu_core;
  struct kgsl_device *device = dev_get_drvdata(dev);
  struct kgsl_pwrscale *psc = &device->pwrscale;
  
  if (device->host_based_dcvs)
L1131: return scnprintf(buf, PAGE_SIZE, "%u\n", (u32)gmu_core->gpu_pwrscale_enable);
  return scnprintf(buf, PAGE_SIZE, "%u\n", psc->enabled);
  else
  }
  
L1258: if (gmu_core_gpmu_isenabled(device))
  int i = 0;
  
  return;
  if (test_bit(KGSL_PWRFLAGS_CLK_ON, &pwr->ctrl_flags))
L1287: /* Turn off the IOMMU clocks */
  }
  
  kgsl_mmu_disable_clk(&device->mmu);
  } else if (requested_state == KGSL_STATE_SLUMBER) {
L1332: /* Turn on the IOMMU clocks */
  }
  
  kgsl_mmu_enable_clk(&device->mmu);
  }
L1407: if (pwr->gmu_mx_pd)
  struct kgsl_pwrctrl *pwr = &device->pwrctrl;
  
  pm_runtime_put_sync(pwr->gmu_mx_pd);
  }
L1408: pm_runtime_put_sync(pwr->gmu_mx_pd);
  
  if (pwr->gmu_mx_pd)
  }
  
L1416: if (!pwr->gmu_mx_pd)
  int ret;
  
  return 0;
  
L1419: ret = pm_runtime_resume_and_get(pwr->gmu_mx_pd);
  return 0;
  
  if (ret)
  dev_err(device->dev, "Failed to enable MX gdsc, error %d\n", ret);
L1431: if (!pwr->cx_regulator && !pwr->gmu_cx_pd)
  int ret;
  
  return 0;
  
L1443: KGSL_GMU_CORE_FORCE_PANIC(device->gmu_core.gf_panic,
  dev_err(device->dev, "GPU CX wait timeout\n");
  }
  GMU_PDEV(device), 0ULL, GMU_FAULT_CX_WAIT_TIMEOUT);
  }
L1444: GMU_PDEV(device), 0ULL, GMU_FAULT_CX_WAIT_TIMEOUT);
  }
  KGSL_GMU_CORE_FORCE_PANIC(device->gmu_core.gf_panic,
  }
  

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrctrl.h =====
L55: u32 owner_timestamp;
  unsigned long expires;
  uint32_t owner_id;
  };
  
L74: /** @voltage_level: Voltage level used by the GMU to vote RPMh */
  /** @cx_level: CX vote */
  u32 cx_level;
  u32 voltage_level;
  /** @opp:  OPP node corresponding to GPU OPP table */
L122: * Only GMU device votes for GMU_CX_PD. Other client votes are consolidated
  * @cx_pd: Power domain for registering CX GDSC notifier
  *
  * in the CX GenPD instance, so use this for registering the notifier.
  */
L126: /** @gmu_cx_pd: Power domain for controlling GMU CX GDSC instance */
  */
  struct device *cx_pd;
  struct device *gmu_cx_pd;
  /** @gmu_mx_pd: Power domain for controlling GMU MX GDSC instance */
L127: struct device *gmu_cx_pd;
  struct device *cx_pd;
  /** @gmu_cx_pd: Power domain for controlling GMU CX GDSC instance */
  /** @gmu_mx_pd: Power domain for controlling GMU MX GDSC instance */
  struct device *gmu_mx_pd;
L128: /** @gmu_mx_pd: Power domain for controlling GMU MX GDSC instance */
  /** @gmu_cx_pd: Power domain for controlling GMU CX GDSC instance */
  struct device *gmu_cx_pd;
  struct device *gmu_mx_pd;
  /** @gx_pd: Power domain for controlling GX GDSC */
L129: struct device *gmu_mx_pd;
  struct device *gmu_cx_pd;
  /** @gmu_mx_pd: Power domain for controlling GMU MX GDSC instance */
  /** @gx_pd: Power domain for controlling GX GDSC */
  struct device *gx_pd;
L212: /** @update_dcvs_table: Set when the dcvs table needs an update for GMU */
  /** @cooling_work: ws to update pwrlevel as per the thermal mitigation request */
  struct kthread_work cooling_work;
  bool update_dcvs_table;
  /** @stats_lock: Spinlock for updating pwr stats */
L262: * @ts: The timestamp for which this constraint is enforced
  * @pwrc: Pointer to requested constraint
  * @id: Context id which owns the constraint
  *
  * Accept the new constraint if no previous constraint existed or if the
L266: * constraints are equal, update the timestamp and ownership to make sure
  * Accept the new constraint if no previous constraint existed or if the
  * new constraint is faster than the previous one.  If the new and previous
  * the constraint expires at the correct time.
  */

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrscale.c =====
L674: * kgsl_pwrscale_passive_init - Initialize the passive governor for gmu based DCVS targets
  
  /**
  * @device: Pointer to KGSL device
  * @pdev: Pointer to the GPU platform device
L686: device->gmu_core.gpu_pwrscale_enable = true;
  int ret, i;
  
  profile->target = kgsl_passive_devfreq_target;
  profile->get_dev_status = kgsl_passive_devfreq_get_dev_status;

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_pwrscale.h =====
L31: * @time - Last submitted sample timestamp
  * @accum_stats - Accumulated statistics for various frequency calculations
  * @enabled - Whether or not power scaling is enabled
  * @devfreq_wq - Main devfreq workqueue
  * @devfreq_suspend_ws - Pass device suspension to devfreq
L35: * @next_governor_call - Timestamp after which the governor may be notified of
  * @devfreq_suspend_ws - Pass device suspension to devfreq
  * @devfreq_resume_ws - Pass device resume to devfreq
  * a new sample
  * @ctxt_aware_enable - Whether or not ctxt aware DCVS feature is enabled

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_reclaim.c =====
L162: ret = kgsl_mmu_map(memdesc->pagetable, memdesc);
  spin_unlock(&memdesc->lock);
  
  if (ret)
  return ret;
L340: ret = kgsl_mmu_map(memdesc->pagetable, memdesc);
  
  /* Map the new pages to the mmu */
  if (ret) {
  pr_err_ratelimited("kgsl: Failed to map process %d entry %d\n",

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_regmap.h =====
L42: * from a commmon base. This is used to access GPU and GMU registers in
  /**
  * struct kgsl_regmap - Define a set of individual regions that are all indexed
  * separate io-remmaped regions from a single set of function calls.
  */

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sharedmem.c =====
L1514: * the IOMMU driver will BUG later if we reallocated the address and
  /*
  * Don't release the GPU address if the memory fails to unmap because
  * tried to map it
  */
L2011: kgsl_mmu_map_global(device, &gmd->memdesc, 0);
  */
  list_add_tail(&gmd->node, &device->globals);
  
  return &gmd->memdesc;
L2056: kgsl_mmu_map_global(device, &md->memdesc, padding);
  list_add_tail(&md->node, &device->globals);
  
  kgsl_trace_gpu_mem_total(device, md->memdesc.size);
  

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sharedmem.h =====
L108: /** @gmuaddr: GMU VA if this is mapped in GMU */
  /** @ranges_lock: Mutex to protect the range database */
  struct mutex ranges_lock;
  u32 gmuaddr;
  /*@shmem_page_list: shmem pages list */
L109: u32 gmuaddr;
  struct mutex ranges_lock;
  /** @gmuaddr: GMU VA if this is mapped in GMU */
  /*@shmem_page_list: shmem pages list */
  struct list_head shmem_page_list;

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_snapshot.c =====
L598: * Trigger both GPU and GMU snapshot. GPU specific code
  
  /*
  * will take care of whether to dumps full state or only
  * GMU state based on current GPU power state.
L600: * GMU state based on current GPU power state.
  * Trigger both GPU and GMU snapshot. GPU specific code
  * will take care of whether to dumps full state or only
  */
  if (device->ftbl->snapshot)
L609: * The timestamp is the seconds since boot so it is easier to match to
  
  /*
  * the kernel log
  */
L613: snapshot->timestamp = ktime_get_real_seconds() - boot.tv_sec;
  */
  getboottime64(&boot);
  
  kgsl_add_to_minidump("ATOMIC_GPU_SNAPSHOT", (u64) device->snapshot_memory_atomic.ptr,
L628: * @gmu_fault: whether this snapshot is triggered by a GMU fault.
  * @context: the context that is hung, might be NULL if unknown.
  * @context_lpac: the lpac context that is hung, might be NULL if unknown.
  *
  * Given a device, construct a binary snapshot dump of the current device state
L635: bool gmu_fault)
  void kgsl_device_snapshot(struct kgsl_device *device,
  struct kgsl_context *context, struct kgsl_context *context_lpac,
  {
  struct kgsl_snapshot *snapshot;
L655: device->gmu_fault = gmu_fault;
  /* increment the hang count for good book keeping */
  device->snapshot_faultcount++;
  
  if (device->snapshot != NULL) {
L662: *    be it a gmu or gpu fault.
  * Snapshot over-write policy:
  * 1. By default, don't over-write the very first snapshot,
  * 2. Never over-write existing snapshot on a gpu fault.
  * 3. Never over-write a snapshot that we didn't recover from.
L665: * 4. In order to over-write a new gmu fault snapshot with a
  * 2. Never over-write existing snapshot on a gpu fault.
  * 3. Never over-write a snapshot that we didn't recover from.
  *    previously recovered fault, then set the sysfs knob
  *    prioritize_recoverable to true.
L670: !device->snapshot->recovered || !gmu_fault)
  */
  if (!device->prioritize_unrecoverable ||
  return;
  
L705: * The timestamp is the seconds since boot so it is easier to match to
  
  /*
  * the kernel log
  */
L710: snapshot->timestamp = ktime_get_real_seconds() - boot.tv_sec;
  
  getboottime64(&boot);
  
  /* Store the instance in the device until it gets dumped */
L718: gmu_fault ? "GMU" : "GPU", snapshot_phy_addr(device),
  /* log buffer info to aid in ramdump fault tolerance */
  dev_err(device->dev, "%s snapshot created at pa %llx++0x%zx\n",
  snapshot->size);
  
L727: sysfs_notify(&device->snapshot_kobj, NULL, "timestamp");
  BUG_ON(device->force_panic);
  
  
  /*
L1000: /* Show the timestamp of the last collected snapshot */
  }
  
  static ssize_t timestamp_show(struct kgsl_device *device, char *buf)
  {
L1001: static ssize_t timestamp_show(struct kgsl_device *device, char *buf)
  
  /* Show the timestamp of the last collected snapshot */
  {
  unsigned long timestamp;
L1003: unsigned long timestamp;
  static ssize_t timestamp_show(struct kgsl_device *device, char *buf)
  {
  
  kgsl_mutex_lock(&device->mutex);
L1006: timestamp = device->snapshot ? device->snapshot->timestamp : 0;
  
  kgsl_mutex_lock(&device->mutex);
  kgsl_mutex_unlock(&device->mutex);
  return scnprintf(buf, PAGE_SIZE, "%lu\n", timestamp);
L1008: return scnprintf(buf, PAGE_SIZE, "%lu\n", timestamp);
  timestamp = device->snapshot ? device->snapshot->timestamp : 0;
  kgsl_mutex_unlock(&device->mutex);
  }
  
L1039: static SNAPSHOT_ATTR(timestamp, 0444, timestamp_show, NULL);
  }
  
  static SNAPSHOT_ATTR(faultcount, 0644, faultcount_show, faultcount_store);
  static SNAPSHOT_ATTR(force_panic, 0644, force_panic_show, force_panic_store);
L1089: &attr_timestamp.attr,
  
  static const struct attribute *snapshot_attrs[] = {
  &attr_faultcount.attr,
  &attr_force_panic.attr,
L1105: /* To send NMI to GMU */
  panic_nb);
  
  device->gmu_fault = gmu_core_isenabled(device);
  
L1106: device->gmu_fault = gmu_core_isenabled(device);
  
  /* To send NMI to GMU */
  
  kgsl_device_snapshot_atomic(device);
L1189: * If we want to over-write with a gmu snapshot, then set it to true
  /*
  * Set this to false so that we only ever keep the first snapshot around
  * via sysfs
  */
L1326: if (snapshot->device->gmu_fault)
  void *ptr;
  
  goto gmu_only;
  
L1327: goto gmu_only;
  
  if (snapshot->device->gmu_fault)
  
  kgsl_snapshot_process_ib_obj_list(snapshot);
L1377: gmu_only:
  snapshot->ib2base);
  
  BUG_ON(!snapshot->device->skip_ib_capture &&
  snapshot->device->force_panic);

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_snapshot.h =====
L60: #define KGSL_SNAPSHOT_SECTION_GMU_MEMORY   0x1701
  #define KGSL_SNAPSHOT_SECTION_MVC_V2       0x1502
  #define KGSL_SNAPSHOT_SECTION_MVC_V3       0x1503
  #define KGSL_SNAPSHOT_SECTION_SIDE_DEBUGBUS 0x1801
  #define KGSL_SNAPSHOT_SECTION_TRACE_BUFFER 0x1901
L73: __u32 seconds;		/* Unix timestamp for the snapshot */
  struct kgsl_snapshot_linux_v4 {
  int osid;		/* subsection OS identifier */
  __u32 power_flags;	/* Current power flags */
  __u32 power_level;	/* Current power level */
L99: __u32 timestamp_queued;		/* The last queued timestamp */
  struct kgsl_snapshot_linux_context_v2 {
  __u32 id;			/* The context ID */
  __u32 timestamp_consumed;	/* The last timestamp consumed by HW */
  __u32 timestamp_retired;	/* The last timestamp retired by HW */
L100: __u32 timestamp_consumed;	/* The last timestamp consumed by HW */
  __u32 id;			/* The context ID */
  __u32 timestamp_queued;		/* The last queued timestamp */
  __u32 timestamp_retired;	/* The last timestamp retired by HW */
  };
L101: __u32 timestamp_retired;	/* The last timestamp retired by HW */
  __u32 timestamp_queued;		/* The last queued timestamp */
  __u32 timestamp_consumed;	/* The last timestamp consumed by HW */
  };
  
L104: /* Ringbuffer sub-section header */
  };
  
  struct kgsl_snapshot_rb_v2 {
  int start;  /* dword at the start of the dump */
L108: int rbsize; /* Size (in dwords) of the ringbuffer */
  int start;  /* dword at the start of the dump */
  int end;    /* dword at the end of the dump */
  int wptr;   /* Current index of the CPU write pointer */
  int rptr;   /* Current index of the GPU read pointer */
L112: __u32 timestamp_queued; /* The last queued timestamp */
  int rptr;   /* Current index of the GPU read pointer */
  int count;  /* Number of dwords in the dump */
  __u32 timestamp_retired; /* The last timestamp retired by HW */
  __u64 gpuaddr; /* The GPU address of the ringbuffer */
L113: __u32 timestamp_retired; /* The last timestamp retired by HW */
  int count;  /* Number of dwords in the dump */
  __u32 timestamp_queued; /* The last queued timestamp */
  __u64 gpuaddr; /* The GPU address of the ringbuffer */
  __u32 id; /* Ringbuffer identifier */
L114: __u64 gpuaddr; /* The GPU address of the ringbuffer */
  __u32 timestamp_queued; /* The last queued timestamp */
  __u32 timestamp_retired; /* The last timestamp retired by HW */
  __u32 id; /* Ringbuffer identifier */
  } __packed;
L115: __u32 id; /* Ringbuffer identifier */
  __u32 timestamp_retired; /* The last timestamp retired by HW */
  __u64 gpuaddr; /* The GPU address of the ringbuffer */
  } __packed;
  
L136: /* GMU memory ID's */
  } __packed;
  
  #define SNAPSHOT_GMU_MEM_UNKNOWN	0x00
  #define SNAPSHOT_GMU_MEM_HFI		0x01
L137: #define SNAPSHOT_GMU_MEM_UNKNOWN	0x00
  
  /* GMU memory ID's */
  #define SNAPSHOT_GMU_MEM_HFI		0x01
  #define SNAPSHOT_GMU_MEM_LOG		0x02
L138: #define SNAPSHOT_GMU_MEM_HFI		0x01
  /* GMU memory ID's */
  #define SNAPSHOT_GMU_MEM_UNKNOWN	0x00
  #define SNAPSHOT_GMU_MEM_LOG		0x02
  #define SNAPSHOT_GMU_MEM_BWTABLE	0x03
L139: #define SNAPSHOT_GMU_MEM_LOG		0x02
  #define SNAPSHOT_GMU_MEM_UNKNOWN	0x00
  #define SNAPSHOT_GMU_MEM_HFI		0x01
  #define SNAPSHOT_GMU_MEM_BWTABLE	0x03
  #define SNAPSHOT_GMU_MEM_DEBUG		0x04
L140: #define SNAPSHOT_GMU_MEM_BWTABLE	0x03
  #define SNAPSHOT_GMU_MEM_HFI		0x01
  #define SNAPSHOT_GMU_MEM_LOG		0x02
  #define SNAPSHOT_GMU_MEM_DEBUG		0x04
  #define SNAPSHOT_GMU_MEM_BIN_BLOCK	0x05
L141: #define SNAPSHOT_GMU_MEM_DEBUG		0x04
  #define SNAPSHOT_GMU_MEM_LOG		0x02
  #define SNAPSHOT_GMU_MEM_BWTABLE	0x03
  #define SNAPSHOT_GMU_MEM_BIN_BLOCK	0x05
  #define SNAPSHOT_GMU_MEM_CONTEXT_QUEUE	0x06
L142: #define SNAPSHOT_GMU_MEM_BIN_BLOCK	0x05
  #define SNAPSHOT_GMU_MEM_BWTABLE	0x03
  #define SNAPSHOT_GMU_MEM_DEBUG		0x04
  #define SNAPSHOT_GMU_MEM_CONTEXT_QUEUE	0x06
  #define SNAPSHOT_GMU_MEM_HW_FENCE	0x07
L143: #define SNAPSHOT_GMU_MEM_CONTEXT_QUEUE	0x06
  #define SNAPSHOT_GMU_MEM_DEBUG		0x04
  #define SNAPSHOT_GMU_MEM_BIN_BLOCK	0x05
  #define SNAPSHOT_GMU_MEM_HW_FENCE	0x07
  #define SNAPSHOT_GMU_MEM_WARMBOOT	0x08
L144: #define SNAPSHOT_GMU_MEM_HW_FENCE	0x07
  #define SNAPSHOT_GMU_MEM_BIN_BLOCK	0x05
  #define SNAPSHOT_GMU_MEM_CONTEXT_QUEUE	0x06
  #define SNAPSHOT_GMU_MEM_WARMBOOT	0x08
  #define SNAPSHOT_GMU_MEM_VRB		0x09
L145: #define SNAPSHOT_GMU_MEM_WARMBOOT	0x08
  #define SNAPSHOT_GMU_MEM_CONTEXT_QUEUE	0x06
  #define SNAPSHOT_GMU_MEM_HW_FENCE	0x07
  #define SNAPSHOT_GMU_MEM_VRB		0x09
  #define SNAPSHOT_GMU_MEM_TRACE		0x0a
L146: #define SNAPSHOT_GMU_MEM_VRB		0x09
  #define SNAPSHOT_GMU_MEM_HW_FENCE	0x07
  #define SNAPSHOT_GMU_MEM_WARMBOOT	0x08
  #define SNAPSHOT_GMU_MEM_TRACE		0x0a
  
L147: #define SNAPSHOT_GMU_MEM_TRACE		0x0a
  #define SNAPSHOT_GMU_MEM_WARMBOOT	0x08
  #define SNAPSHOT_GMU_MEM_VRB		0x09
  
  /* GMU memory section data */
L149: /* GMU memory section data */
  #define SNAPSHOT_GMU_MEM_TRACE		0x0a
  
  struct kgsl_snapshot_gmu_mem {
  int type;
L150: struct kgsl_snapshot_gmu_mem {
  
  /* GMU memory section data */
  int type;
  uint64_t hostaddr;
L153: uint64_t gmuaddr;
  int type;
  uint64_t hostaddr;
  uint64_t gpuaddr;
  } __packed;
L211: #define SNAPSHOT_DEBUG_SQE_VERSION 14
  #define SNAPSHOT_DEBUG_SHADER_MEMORY 11
  #define SNAPSHOT_DEBUG_CP_MERCIU 12
  
  /* GMU Version information */
L213: /* GMU Version information */
  #define SNAPSHOT_DEBUG_SQE_VERSION 14
  
  #define SNAPSHOT_DEBUG_GMU_CORE_VERSION 15
  #define SNAPSHOT_DEBUG_GMU_CORE_DEV_VERSION 16
L214: #define SNAPSHOT_DEBUG_GMU_CORE_VERSION 15
  
  /* GMU Version information */
  #define SNAPSHOT_DEBUG_GMU_CORE_DEV_VERSION 16
  #define SNAPSHOT_DEBUG_GMU_PWR_VERSION 17
L215: #define SNAPSHOT_DEBUG_GMU_CORE_DEV_VERSION 16
  /* GMU Version information */
  #define SNAPSHOT_DEBUG_GMU_CORE_VERSION 15
  #define SNAPSHOT_DEBUG_GMU_PWR_VERSION 17
  #define SNAPSHOT_DEBUG_GMU_PWR_DEV_VERSION 18

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sync.c =====
L13: #include "kgsl_gmu_core.h"
  
  #include "kgsl_device.h"
  #include "kgsl_sync.h"
  
L106: kfence->context_id, kfence->timestamp, ret);
  if (__ratelimit(&_rs))
  dev_err(device->dev, "Failed to create ctx:%d ts:%d hardware fence:%d\n",
  
  return -EINVAL;
L125: "Failed to add GMU as waiter ret:%d fence ctx:%llu ts:%llu\n",
  if (ret) {
  dev_err_ratelimited(device->dev,
  ret, fence->context, fence->seqno);
  return ret;
L147: struct synx_hw_fence_hfi_queue_header *hdr = (struct synx_hw_fence_hfi_queue_header *)
  {
  void *ptr = kgsl_synx.mem_descriptor.vaddr;
  (ptr + sizeof(struct synx_hw_fence_hfi_queue_table_header));
  u32 queue_size_dwords = hdr->queue_size / sizeof(u32);
L148: (ptr + sizeof(struct synx_hw_fence_hfi_queue_table_header));
  void *ptr = kgsl_synx.mem_descriptor.vaddr;
  struct synx_hw_fence_hfi_queue_header *hdr = (struct synx_hw_fence_hfi_queue_header *)
  u32 queue_size_dwords = hdr->queue_size / sizeof(u32);
  u32 payload_size_dwords = hdr->pkt_size / sizeof(u32);
L185: WARN_RATELIMIT(!test_bit(GMU_SOCCP_VOTE_ON, &device->gmu_core.flags),
  {
  /* soccp should be powered on */
  "signaling hw fence via cpu without soccp powered up\n");
  
L271: kfence->context_id, kfence->timestamp, ret);
  if (__ratelimit(&_rs))
  dev_err(device->dev, "Failed to create ctx:%d ts:%d hardware fence:%d\n",
  return -EINVAL;
  }
L288: "Failed to add GMU as waiter ret:%d fence ctx:%llu ts:%llu\n",
  if (ret)
  dev_err_ratelimited(device->dev,
  ret, fence->context, fence->seqno);
  else {
L301: struct msm_hw_fence_hfi_queue_header *hdr = (struct msm_hw_fence_hfi_queue_header *)
  {
  void *ptr = kgsl_msm_hw_fence.mem_descriptor.virtual_addr;
  (ptr + sizeof(struct msm_hw_fence_hfi_queue_table_header));
  u32 queue_size_dwords = hdr->queue_size / sizeof(u32);
L302: (ptr + sizeof(struct msm_hw_fence_hfi_queue_table_header));
  void *ptr = kgsl_msm_hw_fence.mem_descriptor.virtual_addr;
  struct msm_hw_fence_hfi_queue_header *hdr = (struct msm_hw_fence_hfi_queue_header *)
  u32 queue_size_dwords = hdr->queue_size / sizeof(u32);
  u32 payload_size_dwords = hdr->pkt_size / sizeof(u32);
L338: kfence->context_id, kfence->timestamp, ret);
  dev_err_ratelimited(device->dev,
  "Failed to trigger hw fence via cpu: ctx:%d ts:%d ret:%d\n",
  return;
  }
L365: unsigned int timestamp)
  static struct kgsl_sync_fence *kgsl_sync_fence_create(
  struct kgsl_context *context,
  {
  struct kgsl_sync_fence *kfence;
L383: kfence->timestamp = timestamp;
  kfence->parent = ktimeline;
  kfence->context_id = context->id;
  
  dma_fence_init(&kfence->fence, &kgsl_sync_fence_ops, &ktimeline->lock,
L386: ktimeline->fence_context, timestamp);
  
  dma_fence_init(&kfence->fence, &kgsl_sync_fence_ops, &ktimeline->lock,
  
  /*
L424: unsigned int ts = kfence->timestamp;
  struct kgsl_sync_fence *kfence = (struct kgsl_sync_fence *)fence;
  struct kgsl_sync_timeline *ktimeline = kfence->parent;
  
  return (timestamp_cmp(ktimeline->last_timestamp, ts) >= 0);
L426: return (timestamp_cmp(ktimeline->last_timestamp, ts) >= 0);
  unsigned int ts = kfence->timestamp;
  
  }
  
L436: unsigned int timestamp;
  struct kgsl_sync_fence_event_priv {
  struct kgsl_context *context;
  };
  
L440: * kgsl_sync_fence_event_cb - Event callback for a fence timestamp event
  
  /**
  * @device - The KGSL device that expired the timestamp
  * @context- Pointer to the context that owns the event
L441: * @device - The KGSL device that expired the timestamp
  /**
  * kgsl_sync_fence_event_cb - Event callback for a fence timestamp event
  * @context- Pointer to the context that owns the event
  * @priv: Private data for the callback
L446: * Signal a fence following the expiration of a timestamp
  * @result - Result of the event (retired or canceled)
  *
  */
  
L454: kgsl_sync_timeline_signal(ev->context->ktimeline, ev->timestamp);
  struct kgsl_sync_fence_event_priv *ev = priv;
  
  kgsl_context_put(ev->context);
  kfree(ev);
L460: struct kgsl_context *context, unsigned int timestamp)
  
  static int _add_fence_event(struct kgsl_device *device,
  {
  struct kgsl_sync_fence_event_priv *event;
L479: event->timestamp = timestamp;
  
  event->context = context;
  
  ret = kgsl_add_event(device, &context->events, timestamp,
L481: ret = kgsl_add_event(device, &context->events, timestamp,
  event->timestamp = timestamp;
  
  kgsl_sync_fence_event_cb, event);
  
L506: * @timestamp - Timestamp to trigger the event
  * kgsl_add_fence_event - Create a new fence event
  * @device - KGSL device to create the event on
  * @data - Return fence fd stored in struct kgsl_timestamp_event_fence
  * @len - length of the fence event
L507: * @data - Return fence fd stored in struct kgsl_timestamp_event_fence
  * @device - KGSL device to create the event on
  * @timestamp - Timestamp to trigger the event
  * @len - length of the fence event
  * @owner - driver instance that owns this event
L513: * the timestamp expires
  *
  * Create a fence and register an event to signal the fence when
  */
  
L517: u32 context_id, u32 timestamp, void __user *data, int len,
  
  int kgsl_add_fence_event(struct kgsl_device *device,
  struct kgsl_device_private *owner)
  {
L520: struct kgsl_timestamp_event_fence priv;
  struct kgsl_device_private *owner)
  {
  struct kgsl_context *context;
  struct kgsl_sync_fence *kfence = NULL;
L540: kfence = kgsl_sync_fence_create(context, timestamp);
  goto out;
  
  if (kfence == NULL) {
  ret = -ENOMEM;

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_sync.h =====
L20: * @last_timestamp: Last timestamp when signaling fences
  * @child_list_head: List head for all fences on this timeline
  * @lock: Spinlock to protect this timeline
  * @device: kgsl device
  * @context: kgsl context
L33: unsigned int last_timestamp;
  
  spinlock_t lock;
  struct kgsl_device *device;
  struct kgsl_context *context;
L46: * @timestamp: Context timestamp that this fence is associated with
  * @child_list: List of fences on the same timeline
  * @context_id: kgsl context id
  */
  struct kgsl_sync_fence {
L54: unsigned int timestamp;
  struct list_head child_list;
  u32 context_id;
  /** @hw_fence_index: Index of hw fence in hw fence table */
  u64 hw_fence_index;
L84: u32 context_id, u32 timestamp, void __user *data, int len,
  #if defined(CONFIG_SYNC_FILE)
  int kgsl_add_fence_event(struct kgsl_device *device,
  struct kgsl_device_private *owner);
  
L118: u32 timestamp);
  
  void kgsl_sync_timeline_signal(struct kgsl_sync_timeline *ktimeline,
  
  int kgsl_hw_fence_init(struct kgsl_device *device);
L144: u32 context_id, u32 timestamp, void __user *data, int len,
  #else
  static inline int kgsl_add_fence_event(struct kgsl_device *device,
  struct kgsl_device_private *owner)
  {
L225: u32 timestamp)
  
  void kgsl_sync_timeline_signal(struct kgsl_sync_timeline *ktimeline,
  {
  

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.c =====
L578: if (kgsl_check_timestamp(event->context->device,
  seqno = timeline->value;
  list_for_each_entry_reverse(event, &timeline->events, node) {
  event->context, event->timestamp)) {
  seqno = event->seqno;
L579: event->context, event->timestamp)) {
  list_for_each_entry_reverse(event, &timeline->events, node) {
  if (kgsl_check_timestamp(event->context->device,
  seqno = event->seqno;
  break;

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_timeline.h =====
L46: /** @timestamp: context timestamp this event is waiting for */
  /** @context: context this event is waiting for */
  struct kgsl_context *context;
  unsigned int timestamp;
  /** @node: list node */
L47: unsigned int timestamp;
  struct kgsl_context *context;
  /** @timestamp: context timestamp this event is waiting for */
  /** @node: list node */
  struct list_head node;

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_trace.h =====
L48: struct kgsl_ringbuffer_issueibcmds;
  { KGSL_CONSTRAINT_L3_PWRLEVEL, "L3_pwrlevel" })
  
  struct kgsl_device_waittimestamp;
  
L49: struct kgsl_device_waittimestamp;
  
  struct kgsl_ringbuffer_issueibcmds;
  
  /*
L59: int timestamp,
  int drawctxt_id,
  unsigned int numibs,
  int flags,
  int result,
L64: TP_ARGS(device, drawctxt_id, numibs, timestamp,
  unsigned int type),
  
  flags, result, type),
  
L71: __field(unsigned int, timestamp)
  __field(unsigned int, drawctxt_id)
  __field(unsigned int, numibs)
  __field(unsigned int, flags)
  __field(int, result)
L81: __entry->timestamp = timestamp;
  __entry->drawctxt_id = drawctxt_id;
  __entry->numibs = numibs;
  __entry->flags = flags;
  __entry->result = result;
L92: __entry->timestamp,
  __entry->drawctxt_id,
  __entry->numibs,
  __entry->flags ? __print_flags(__entry->flags, "|",
  KGSL_DRAWOBJ_FLAGS) : "None",
L101: * Tracepoint for kgsl readtimestamp
  
  /*
  */
  TRACE_EVENT(kgsl_readtimestamp,
L103: TRACE_EVENT(kgsl_readtimestamp,
  * Tracepoint for kgsl readtimestamp
  */
  
  TP_PROTO(struct kgsl_device *device,
L108: unsigned int timestamp),
  unsigned int context_id,
  unsigned int type,
  
  TP_ARGS(device, context_id, type, timestamp),
L110: TP_ARGS(device, context_id, type, timestamp),
  unsigned int timestamp),
  
  
  TP_STRUCT__entry(
L116: __field(unsigned int, timestamp)
  __field(unsigned int, context_id)
  __field(unsigned int, type)
  ),
  
L123: __entry->timestamp = timestamp;
  __entry->context_id = context_id;
  __entry->type = type;
  ),
  
L131: __entry->timestamp
  __entry->context_id,
  __entry->type,
  )
  );
L136: * Tracepoint for kgsl waittimestamp entry
  
  /*
  */
  TRACE_EVENT(kgsl_waittimestamp_entry,
L138: TRACE_EVENT(kgsl_waittimestamp_entry,
  * Tracepoint for kgsl waittimestamp entry
  */
  
  TP_PROTO(struct kgsl_device *device,
L175: * Tracepoint for kgsl waittimestamp exit
  
  /*
  */
  TRACE_EVENT(kgsl_waittimestamp_exit,
L177: TRACE_EVENT(kgsl_waittimestamp_exit,
  * Tracepoint for kgsl waittimestamp exit
  */
  
  TP_PROTO(struct kgsl_device *device, unsigned int curr_ts,
L268: TRACE_EVENT(kgsl_gmu_pwrlevel,
  );
  
  
  TP_PROTO(unsigned long freq,
L286: "gmu_freq=%ld gmu_prev_freq=%ld",
  
  TP_printk(
  __entry->freq,
  __entry->prev_freq
L761: DECLARE_EVENT_CLASS(kgsl_mem_timestamp_template,
  );
  
  
  TP_PROTO(struct kgsl_device *device, struct kgsl_mem_entry *mem_entry,
L807: DEFINE_EVENT(kgsl_mem_timestamp_template, kgsl_mem_timestamp_queue,
  );
  
  TP_PROTO(struct kgsl_device *device, struct kgsl_mem_entry *mem_entry,
  unsigned int id, unsigned int curr_ts, unsigned int free_ts),
L813: DEFINE_EVENT(kgsl_mem_timestamp_template, kgsl_mem_timestamp_free,
  );
  
  TP_PROTO(struct kgsl_device *device, struct kgsl_mem_entry *mem_entry,
  unsigned int id, unsigned int curr_ts, unsigned int free_ts),
L1020: TP_PROTO(unsigned int id, unsigned int timestamp, void *func),
  
  TRACE_EVENT(kgsl_register_event,
  TP_ARGS(id, timestamp, func),
  TP_STRUCT__entry(
L1021: TP_ARGS(id, timestamp, func),
  TRACE_EVENT(kgsl_register_event,
  TP_PROTO(unsigned int id, unsigned int timestamp, void *func),
  TP_STRUCT__entry(
  __field(unsigned int, id)
L1024: __field(unsigned int, timestamp)
  TP_STRUCT__entry(
  __field(unsigned int, id)
  __field(void *, func)
  ),
L1029: __entry->timestamp = timestamp;
  TP_fast_assign(
  __entry->id = id;
  __entry->func = func;
  ),
L1034: __entry->id, __entry->timestamp, __entry->func)
  TP_printk(
  "ctx=%u ts=%u cb=%pS",
  );
  
L1102: DECLARE_EVENT_CLASS(syncpoint_timestamp_template,
  );
  
  TP_PROTO(struct kgsl_drawobj_sync *syncobj,
  struct kgsl_context *context,
L1105: unsigned int timestamp),
  TP_PROTO(struct kgsl_drawobj_sync *syncobj,
  struct kgsl_context *context,
  TP_ARGS(syncobj, context, timestamp),
  TP_STRUCT__entry(

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_util.c =====
L12: #include <linux/firmware.h>
  #include <linux/delay.h>
  #include <linux/device.h>
  #include <linux/ktime.h>
  #include <linux/pm_domain.h>
L17: #include <linux/firmware/qcom/qcom_scm.h>
  #include <linux/version.h>
  #if (KERNEL_VERSION(6, 3, 0) <= LINUX_VERSION_CODE)
  #else
  #include <linux/qcom_scm.h>
L22: #include <linux/firmware/qcom/qcom_scm_addon.h>
  #endif
  #if IS_ENABLED(CONFIG_QCOM_SCM_ADDON)
  #endif
  #include <linux/regulator/consumer.h>
L107: static int _kgsl_scm_gpu_init_regs(u32 gpu_req)
  
  #if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE)
  {
  return -EOPNOTSUPP;
L112: static int _kgsl_scm_gpu_init_regs(u32 gpu_req)
  }
  #elif (KERNEL_VERSION(6, 11, 0) <= LINUX_VERSION_CODE)
  {
  return qcom_scm_gpu_init_regs(gpu_req);
L114: return qcom_scm_gpu_init_regs(gpu_req);
  static int _kgsl_scm_gpu_init_regs(u32 gpu_req)
  {
  }
  #elif (IS_ENABLED(CONFIG_QCOM_KGSL_UPSTREAM) && !IS_ENABLED(CONFIG_QCOM_SCM_ADDON))
L117: static int _kgsl_scm_gpu_init_regs(u32 gpu_req)
  }
  #elif (IS_ENABLED(CONFIG_QCOM_KGSL_UPSTREAM) && !IS_ENABLED(CONFIG_QCOM_SCM_ADDON))
  {
  return -EINVAL;
L122: static int _kgsl_scm_gpu_init_regs(u32 gpu_req)
  }
  #else
  {
  return qcom_scm_kgsl_init_regs(gpu_req);
L128: int kgsl_scm_gpu_init_regs(struct device *dev, u32 gpu_req, bool zap_enabled)
  #endif
  
  {
  int ret;
L135: ret = _kgsl_scm_gpu_init_regs(gpu_req);
  return -EOPNOTSUPP;
  
  if (ret && (ret != -EOPNOTSUPP)) {
  if (zap_enabled)
L207: int kgsl_attach_iommu_group(struct device *dev, struct iommu_domain *domain,
  }
  
  struct iommu_group **group)
  {
L208: struct iommu_group **group)
  
  int kgsl_attach_iommu_group(struct device *dev, struct iommu_domain *domain,
  {
  struct iommu_group *grp = iommu_group_get(dev);
L210: struct iommu_group *grp = iommu_group_get(dev);
  struct iommu_group **group)
  {
  int ret;
  
L216: ret = iommu_attach_group(domain, grp);
  return -ENODEV;
  
  if (ret) {
  iommu_group_put(grp);
L218: iommu_group_put(grp);
  ret = iommu_attach_group(domain, grp);
  if (ret) {
  return ret;
  }
L227: void kgsl_detach_iommu_group(struct iommu_domain *domain, struct iommu_group *group)
  }
  
  {
  iommu_detach_group(domain, group);
L229: iommu_detach_group(domain, group);
  void kgsl_detach_iommu_group(struct iommu_domain *domain, struct iommu_group *group)
  {
  iommu_group_put(group);
  }
L230: iommu_group_put(group);
  {
  iommu_detach_group(domain, group);
  }
  
L321: static const char * const globals[] = {"ringbuffer", "memstore", "scratch",
  static bool include_global_in_minidump(struct kgsl_global_memdesc *md)
  {
  "profile", "profile_desc", "alwayson"};
  int i;
L405: if (!ADRENO_FEATURE(adreno_dev, ADRENO_GMU_BASED_DCVS) &&
  return ret;
  
  device->pwrscale.enabled) {
  struct msm_busmon_extended_profile bus_profile = device->pwrscale.bus_profile;

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_util.h =====
L20: #define KGSL_MEMSTORE_ENTRY "memstore"
  
  #define KGSL_SCRATCH_ENTRY "scratch"
  #define KGSL_GMU_LOG_ENTRY "kgsl_gmu_log"
  #define KGSL_GMU_TRACE_ENTRY "kgsl_gmu_trace"
L21: #define KGSL_GMU_LOG_ENTRY "kgsl_gmu_log"
  #define KGSL_SCRATCH_ENTRY "scratch"
  #define KGSL_MEMSTORE_ENTRY "memstore"
  #define KGSL_GMU_TRACE_ENTRY "kgsl_gmu_trace"
  #define KGSL_HFIMEM_ENTRY "kgsl_hfi_mem"
L22: #define KGSL_GMU_TRACE_ENTRY "kgsl_gmu_trace"
  #define KGSL_MEMSTORE_ENTRY "memstore"
  #define KGSL_GMU_LOG_ENTRY "kgsl_gmu_log"
  #define KGSL_HFIMEM_ENTRY "kgsl_hfi_mem"
  #define KGSL_GMU_DUMPMEM_ENTRY "kgsl_gmu_dump_mem"
L23: #define KGSL_HFIMEM_ENTRY "kgsl_hfi_mem"
  #define KGSL_GMU_LOG_ENTRY "kgsl_gmu_log"
  #define KGSL_GMU_TRACE_ENTRY "kgsl_gmu_trace"
  #define KGSL_GMU_DUMPMEM_ENTRY "kgsl_gmu_dump_mem"
  #define KGSL_GMU_RB_ENTRY "gmu_rb"
L24: #define KGSL_GMU_DUMPMEM_ENTRY "kgsl_gmu_dump_mem"
  #define KGSL_GMU_TRACE_ENTRY "kgsl_gmu_trace"
  #define KGSL_HFIMEM_ENTRY "kgsl_hfi_mem"
  #define KGSL_GMU_RB_ENTRY "gmu_rb"
  #define KGSL_GMU_KERNEL_PROF_ENTRY "gmu_kernel_profiling"
L25: #define KGSL_GMU_RB_ENTRY "gmu_rb"
  #define KGSL_HFIMEM_ENTRY "kgsl_hfi_mem"
  #define KGSL_GMU_DUMPMEM_ENTRY "kgsl_gmu_dump_mem"
  #define KGSL_GMU_KERNEL_PROF_ENTRY "gmu_kernel_profiling"
  #define KGSL_GMU_USER_PROF_ENTRY "gmu_user_profiling"
L26: #define KGSL_GMU_KERNEL_PROF_ENTRY "gmu_kernel_profiling"
  #define KGSL_GMU_DUMPMEM_ENTRY "kgsl_gmu_dump_mem"
  #define KGSL_GMU_RB_ENTRY "gmu_rb"
  #define KGSL_GMU_USER_PROF_ENTRY "gmu_user_profiling"
  #define KGSL_GMU_CMD_BUFFER_ENTRY "gmu_cmd_buffer"
L27: #define KGSL_GMU_USER_PROF_ENTRY "gmu_user_profiling"
  #define KGSL_GMU_RB_ENTRY "gmu_rb"
  #define KGSL_GMU_KERNEL_PROF_ENTRY "gmu_kernel_profiling"
  #define KGSL_GMU_CMD_BUFFER_ENTRY "gmu_cmd_buffer"
  #define KGSL_HFI_BIG_IB_ENTRY "kgsl_hfi_big_ib"
L28: #define KGSL_GMU_CMD_BUFFER_ENTRY "gmu_cmd_buffer"
  #define KGSL_GMU_KERNEL_PROF_ENTRY "gmu_kernel_profiling"
  #define KGSL_GMU_USER_PROF_ENTRY "gmu_user_profiling"
  #define KGSL_HFI_BIG_IB_ENTRY "kgsl_hfi_big_ib"
  #define KGSL_HFI_BIG_IB_REC_ENTRY "kgsl_hfi_big_ib_rec"
L29: #define KGSL_HFI_BIG_IB_ENTRY "kgsl_hfi_big_ib"
  #define KGSL_GMU_USER_PROF_ENTRY "gmu_user_profiling"
  #define KGSL_GMU_CMD_BUFFER_ENTRY "gmu_cmd_buffer"
  #define KGSL_HFI_BIG_IB_REC_ENTRY "kgsl_hfi_big_ib_rec"
  #define KGSL_ADRENO_CTX_ENTRY "kgsl_adreno_ctx"
L30: #define KGSL_HFI_BIG_IB_REC_ENTRY "kgsl_hfi_big_ib_rec"
  #define KGSL_GMU_CMD_BUFFER_ENTRY "gmu_cmd_buffer"
  #define KGSL_HFI_BIG_IB_ENTRY "kgsl_hfi_big_ib"
  #define KGSL_ADRENO_CTX_ENTRY "kgsl_adreno_ctx"
  #define KGSL_PROC_PRIV_ENTRY "kgsl_proc_priv"
L34: #define KGSL_GMU_VRB_ENTRY "kgsl_gmu_vrb"
  #define KGSL_PROC_PRIV_ENTRY "kgsl_proc_priv"
  #define KGSL_PGTABLE_ENTRY "kgsl_pgtable"
  #define KGSL_SYNC_FENCE_ENTRY "kgsl_sync_fence"
  #define KGSL_SYNC_TIMELINE_ENTRY "kgsl_sync_timeline"
L79: * @list_offset: this tells CP the start of preemption only list:
  * @list_length: this tells CP the last dword in the list:
  * 16 + (4 * (List_Length - 1))
  * 16 + (4 * List_Offset)
  * @ifpc_list_len: number of static ifpc duplets in the list
L82: * @preemption_list_len: number of static preemption duplets in the list
  * 16 + (4 * List_Offset)
  * @ifpc_list_len: number of static ifpc duplets in the list
  * @dynamic_list_len: number of dynamically added triplets in the list
  */
L96: u8 preemption_list_len;
  struct {
  u8 ifpc_list_len;
  u16 dynamic_list_len;
  };
L174: * kgsl_attach_iommu_group() - Get iommu group and attach domain
  
  /**
  *
  * @dev: iommu group of this device is used
L176: * @dev: iommu group of this device is used
  * kgsl_attach_iommu_group() - Get iommu group and attach domain
  *
  * @domain: iommu domain to attach
  * @group: This is updated with iommu group on successful attach
L177: * @domain: iommu domain to attach
  *
  * @dev: iommu group of this device is used
  * @group: This is updated with iommu group on successful attach
  *
L178: * @group: This is updated with iommu group on successful attach
  * @dev: iommu group of this device is used
  * @domain: iommu domain to attach
  *
  * Get the iommu group of a device and attach iommu domain to the group.
L180: * Get the iommu group of a device and attach iommu domain to the group.
  * @group: This is updated with iommu group on successful attach
  *
  *
  * Return: 0 on success, negative error on failure
L184: int kgsl_attach_iommu_group(struct device *dev, struct iommu_domain *domain,
  * Return: 0 on success, negative error on failure
  */
  struct iommu_group **group);
  
L185: struct iommu_group **group);
  */
  int kgsl_attach_iommu_group(struct device *dev, struct iommu_domain *domain,
  
  /**
L188: * kgsl_detach_iommu_group() - Detach iommu domain from group
  
  /**
  *
  * @domain: iommu domain to detach
L190: * @domain: iommu domain to detach
  * kgsl_detach_iommu_group() - Detach iommu domain from group
  *
  * @group: iommu group to be used for detach
  *
L191: * @group: iommu group to be used for detach
  *
  * @domain: iommu domain to detach
  *
  * Detach iommu domain from iommu group
L193: * Detach iommu domain from iommu group
  * @group: iommu group to be used for detach
  *
  */
  void kgsl_detach_iommu_group(struct iommu_domain *domain, struct iommu_group *group);
L195: void kgsl_detach_iommu_group(struct iommu_domain *domain, struct iommu_group *group);
  * Detach iommu domain from iommu group
  */
  
  /**
L198: * kgsl_scm_gpu_init_regs - Load secure registers through tz
  
  /**
  * @dev: Pointer to the GPU platform device
  * @gpu_req: Bit mask of requests to enable
L206: int kgsl_scm_gpu_init_regs(struct device *dev, u32 gpu_req, bool zap_enabled);
  * not supported
  */
  
  #if IS_ENABLED(CONFIG_QCOM_VA_MINIDUMP)
L278: static inline int qcom_scm_kgsl_set_smmu_lpac_aperture(
  }
  
  unsigned int num_context_bank)
  {

===== C:\Users\qwertyhorik\Desktop\Ios\GPU_TRANSFER_2026-11-26\external\qualcomm-kgsl\kgsl_vbo.c =====
L125: kgsl_mmu_map_zero_page_to_range(memdesc->pagetable,
  
  if (!(memdesc->flags & KGSL_MEMFLAGS_VBO_NO_MAP_ZERO))
  memdesc, range->range.start, bind_range_len(range));
  
L250: ret = kgsl_mmu_map_child(memdesc->pagetable, memdesc, start,
  }
  
  &entry->memdesc, offset, last - start + 1);
  if (ret)

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\IOS_APOLLO_GPU_REFERENCE-1f75f381e31d\shim\shim.c =====
L120: static void irq_handler(void)
  /* ---- exceptions ---- */
  
  {
  uint64_t iar = rsr("icc_iar1_el1");
L143: irq_handler();
  {
  if (slot == 5) {	/* IRQ from current EL, SPx */
  return;
  }

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\IOS_APOLLO_GPU_REFERENCE-1f75f381e31d\userland\audio\audio_plugin.c =====
L90: AudioTimeStamp mCurrentTime, mInputTime, mOutputTime;
  UInt64 mIOCycleCounter;
  UInt32 mNominalIOBufferFrameSize;
  Float64 mMasterHostTicksPerFrame, mDeviceHostTicksPerFrame;
  } AudioServerPlugInIOCycleInfo;
L128: OSStatus (*GetZeroTimeStamp)(AudioServerPlugInDriverRef, AudioObjectID, UInt32, Float64 *, UInt64 *, UInt64 *);
  OSStatus (*StartIO)(AudioServerPlugInDriverRef, AudioObjectID, UInt32);
  OSStatus (*StopIO)(AudioServerPlugInDriverRef, AudioObjectID, UInt32);
  OSStatus (*WillDoIOOperation)(AudioServerPlugInDriverRef, AudioObjectID, UInt32, UInt32, Boolean *, Boolean *);
  OSStatus (*BeginIOOperation)(AudioServerPlugInDriverRef, AudioObjectID, UInt32, UInt32, UInt32,
L166: kAudioDevicePropertyPreferredChannelsForStereo = 'dch2', kAudioDevicePropertyZeroTimeStampPeriod = 'ring',
  kAudioDevicePropertySafetyOffset = 'saft', kAudioDevicePropertyNominalSampleRate = 'nsrt',
  kAudioDevicePropertyAvailableNominalSampleRates = 'nsr#', kAudioDevicePropertyIsHidden = 'hidn',
  kAudioSelectorControlClassID = 'slct', kAudioDataSourceControlClassID = 'dsrc',
  kAudioSelectorControlPropertyCurrentItem = 'scci', kAudioSelectorControlPropertyAvailableItems = 'scai',
L214: UInt64 periods;                 /* whole timestamp periods since */
  unsigned running;               /* how many clients have started I/O */
  UInt64 anchor;                  /* mach_absolute_time() when the first of them did */
  };
  
L237: #define TIMESTAMP_PERIOD        16384
  #define MANUFACTURER            CFSTR("redwood")
  /* how often a device says where its clock is, in frames: also the largest I/O buffer the HAL will use */
  
  static AudioServerPlugInHostRef host;
L612: case kAudioDevicePropertyZeroTimeStampPeriod:
  v.size = 2 * sizeof(UInt32);
  break;
  WORD(TIMESTAMP_PERIOD);
  break;
L613: WORD(TIMESTAMP_PERIOD);
  break;
  case kAudioDevicePropertyZeroTimeStampPeriod:
  break;
  }
L942: /* Where the device's clock was last at a multiple of TIMESTAMP_PERIOD frames, and when. */
  }
  
  static OSStatus
  get_zero_time_stamp(__unused AudioServerPlugInDriverRef driver, AudioObjectID object, __unused UInt32 client,
L947: Float64 ticks_per_period = ticks_per_frame * TIMESTAMP_PERIOD;
  Float64 *sample_time, UInt64 *host_time, UInt64 *seed)
  {
  UInt64 now = mach_absolute_time();
  struct device *d = device_of(object);
L958: *sample_time = (Float64)d->periods * TIMESTAMP_PERIOD;
  d->periods++;
  }
  *host_time = d->anchor + (UInt64)((Float64)d->periods * ticks_per_period);
  *seed = 1;

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\IOS_APOLLO_GPU_REFERENCE-1f75f381e31d\userland\bt-inject\sweet_bt_inject.c =====
L3: * QCA6390 the kernel brought up (sweet_bt.c, boot-arg sweetbt=6: the firmware runs, the H4 kernel control
  /*
  * libsweet-bt.dylib: what the kernel inserts into bluetoothd and BlueTool so iOS's Bluetooth stack talks to the
  * "com.sweet.bluetooth" and the registry entry "bluetooth" are up). Inserted with boot-arg
  *   sweetinject=/usr/local/lib/libsweet-bt.dylib:bluetoothd,BlueTool
L22: *   bluetoothd reports a firmware error (FWError) and tries again, and the controller never comes up (boots 66-73).
  *   com.apple.BlueTool) to RunBuiltinScript "boot"/"init" and waits for the reply's "result" to be 0. Apple's
  *   BlueTool can only open Apple's own transports, never our UART ("Device not open yet"), so it fails and exits,
  *   Both ports that got iOS Bluetooth working on Qualcomm chips replace BlueTool: the Mi 10 port
  *   (github.com/JopangJovan/hackios-xnu-kernel-umi, umi_bluetool.c) and the Xiaomi 15 port
L28: *   and com.sweet.bluetooth resolves -- as the Mi 10 port's helper does (the kernel loaded the firmware and NVM
  *   our own XPC responder instead (take_over_main), so Apple's code never runs and nothing on the root changes. It
  *   answers boot/init with 0 once the controller is ready -- the registry entry "bluetooth" says SweetBluetoothReady
  *   before launchd started), with an errno otherwise. "deepsleep", which bluetoothd runs when Bluetooth is turned
  *   off, is answered 0 and the chip stays powered: bluetoothd resets it (HCI Reset) when it is turned on again, and
L411: * com.sweet.bluetooth resolves (sweet_bt.c sets both once the firmware runs). 0, or an errno.
  /*
  * The controller is ready when the registry entry "bluetooth" says SweetBluetoothReady and the kernel control
  */
  static int

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\IOS_APOLLO_GPU_REFERENCE-1f75f381e31d\userland\metal\include\hakios-metal\a6xx.hpp =====
L63: // What both Mesa emitters give CP_WAIT_REG_MEM_5_DELAY_LOOP_CYCLES when waiting for a timestamp (a choice, not a fact)
  inline constexpr uint32_t kSpCsTexConstAlign = 64;           // not-in-headers: a6xx.xml SP_CS_TEX_CONST align="64"
  inline constexpr uint32_t kSpCsTexSampAlign = 16;            // not-in-headers: a6xx.xml SP_CS_TEX_SAMP align="16"
  inline constexpr uint32_t kDelayLoopCycles = 16;             // not-in-headers: a6xx.cc cache_flush and fd6_emit.h fd6_cache_flush both pass 16
  
L288: // CP_EVENT_WRITE's event. Several names share a value because the XML gives each generation its own name for the
  };
  
  // same number; only the A6XX ones a compute dispatch, a draw and their barriers use are here. turnip gives the
  // 4-word form (an address and a value, no TIMESTAMP bit) to the events that complete asynchronously: RB_DONE_TS,
L290: // 4-word form (an address and a value, no TIMESTAMP bit) to the events that complete asynchronously: RB_DONE_TS,
  // CP_EVENT_WRITE's event. Several names share a value because the XML gives each generation its own name for the
  // same number; only the A6XX ones a compute dispatch, a draw and their barriers use are here. turnip gives the
  // CACHE_FLUSH_TS, PC_CCU_RESOLVE_TS, PC_CCU_FLUSH_DEPTH_TS, PC_CCU_FLUSH_COLOR_TS (freedreno_gpu_event.h:60-85
  // needs_seqno); the invalidates, LRZ_FLUSH, LRZ_CLEAR, BLIT, LABEL and ZPASS_DONE are 1-word events.
L291: // CACHE_FLUSH_TS, PC_CCU_RESOLVE_TS, PC_CCU_FLUSH_DEPTH_TS, PC_CCU_FLUSH_COLOR_TS (freedreno_gpu_event.h:60-85
  // same number; only the A6XX ones a compute dispatch, a draw and their barriers use are here. turnip gives the
  // 4-word form (an address and a value, no TIMESTAMP bit) to the events that complete asynchronously: RB_DONE_TS,
  // needs_seqno); the invalidates, LRZ_FLUSH, LRZ_CLEAR, BLIT, LABEL and ZPASS_DONE are 1-word events.
  enum vgt_event_type : uint32_t {
L294: CACHE_FLUSH_TS = 4,            // adreno_pm4.xml.h:60   flush the caches, then write the timestamp (Gallium's FD_CACHE_CLEAN)
  // needs_seqno); the invalidates, LRZ_FLUSH, LRZ_CLEAR, BLIT, LABEL and ZPASS_DONE are 1-word events.
  enum vgt_event_type : uint32_t {
  CACHE_FLUSH = 6,               // adreno_pm4.xml.h:62
  START_COMPUTE_CTRS = 15,       // adreno_pm4.xml.h:85
L300: RB_DONE_TS = 22,               // adreno_pm4.xml.h:77   the GPU is done with everything before it; timestamp (FD_RB_DONE)
  ZPASS_DONE = 21,               // adreno_pm4.xml.h:75
  CACHE_FLUSH_AND_INV_EVENT = 22, // adreno_pm4.xml.h:76  the A2xx name of the same value
  PC_CCU_INVALIDATE_DEPTH = 24,  // adreno_pm4.xml.h:91
  PC_CCU_INVALIDATE_COLOR = 25,  // adreno_pm4.xml.h:92
L368: CP_EVENT_WRITE = 0x46,         // adreno_pm4.xml.h:234
  CP_MEM_TO_REG = 0x42,          // adreno_pm4.xml.h:285
  CP_SET_DRAW_STATE = 0x43,      // adreno_pm4.xml.h:271
  CP_SET_AMBLE = 0x55,           // adreno_pm4.xml.h:332  the IBs the CP runs around a context switch
  CP_CONTEXT_REG_BUNCH = 0x5c,   // adreno_pm4.xml.h:292  (register, value) pairs: turnip's stream-out disable and VFD_FETCH strides use it; not needed with type4
L918: // CP_EVENT_WRITE, 1 word (the event) or 4 (the event, then an address and the value written there when it completes)
  inline constexpr uint32_t CP_EXEC_CS_3_NGROUPS_Z__MASK = 0xffffffff;                    // adreno_pm4.xml.h:2529
  
  inline constexpr uint32_t CP_EVENT_WRITE_0_EVENT__MASK = 0x000000ff;                    // adreno_pm4.xml.h:2329
  inline constexpr uint32_t CP_EVENT_WRITE_0_EVENT__SHIFT = 0;                            // adreno_pm4.xml.h:2330
L919: inline constexpr uint32_t CP_EVENT_WRITE_0_EVENT__MASK = 0x000000ff;                    // adreno_pm4.xml.h:2329
  
  // CP_EVENT_WRITE, 1 word (the event) or 4 (the event, then an address and the value written there when it completes)
  inline constexpr uint32_t CP_EVENT_WRITE_0_EVENT__SHIFT = 0;                            // adreno_pm4.xml.h:2330
  // With TIMESTAMP set the GPU writes back its timestamp instead of the packet's value. Measured on the phone on
L920: inline constexpr uint32_t CP_EVENT_WRITE_0_EVENT__SHIFT = 0;                            // adreno_pm4.xml.h:2330
  // CP_EVENT_WRITE, 1 word (the event) or 4 (the event, then an address and the value written there when it completes)
  inline constexpr uint32_t CP_EVENT_WRITE_0_EVENT__MASK = 0x000000ff;                    // adreno_pm4.xml.h:2329
  // With TIMESTAMP set the GPU writes back its timestamp instead of the packet's value. Measured on the phone on
  // 28 October (hakios-metal-probe --bisect): with the bit set on the two end-of-dispatch events (RB_DONE_TS,
L921: // With TIMESTAMP set the GPU writes back its timestamp instead of the packet's value. Measured on the phone on
  inline constexpr uint32_t CP_EVENT_WRITE_0_EVENT__MASK = 0x000000ff;                    // adreno_pm4.xml.h:2329
  inline constexpr uint32_t CP_EVENT_WRITE_0_EVENT__SHIFT = 0;                            // adreno_pm4.xml.h:2330
  // 28 October (hakios-metal-probe --bisect): with the bit set on the two end-of-dispatch events (RB_DONE_TS,
  // CACHE_FLUSH_TS) the CP_WAIT_REG_MEM and CP_WAIT_MEM_GTE that poll for the seqno never saw it and the CP spun for
L923: // CACHE_FLUSH_TS) the CP_WAIT_REG_MEM and CP_WAIT_MEM_GTE that poll for the seqno never saw it and the CP spun for
  // With TIMESTAMP set the GPU writes back its timestamp instead of the packet's value. Measured on the phone on
  // 28 October (hakios-metal-probe --bisect): with the bit set on the two end-of-dispatch events (RB_DONE_TS,
  // ever, every dispatch; with it clear the whole tail completes in 41 us. Gallium sets the bit on every 4-word event,
  // computerator never does: computerator's form is the one that works here. eventWrite0 leaves it clear.
L926: inline constexpr uint32_t CP_EVENT_WRITE_0_TIMESTAMP = 0x40000000;                      // adreno_pm4.xml.h:2335
  // ever, every dispatch; with it clear the whole tail completes in 41 us. Gallium sets the bit on every 4-word event,
  // computerator never does: computerator's form is the one that works here. eventWrite0 leaves it clear.
  inline constexpr uint32_t CP_EVENT_WRITE_0_IRQ = 0x80000000;                            // adreno_pm4.xml.h:2336
  inline constexpr uint32_t CP_EVENT_WRITE_1_ADDR_0_LO__MASK = 0xffffffff;                // adreno_pm4.xml.h:2340
L927: inline constexpr uint32_t CP_EVENT_WRITE_0_IRQ = 0x80000000;                            // adreno_pm4.xml.h:2336
  // computerator never does: computerator's form is the one that works here. eventWrite0 leaves it clear.
  inline constexpr uint32_t CP_EVENT_WRITE_0_TIMESTAMP = 0x40000000;                      // adreno_pm4.xml.h:2335
  inline constexpr uint32_t CP_EVENT_WRITE_1_ADDR_0_LO__MASK = 0xffffffff;                // adreno_pm4.xml.h:2340
  inline constexpr uint32_t CP_EVENT_WRITE_2_ADDR_0_HI__MASK = 0xffffffff;                // adreno_pm4.xml.h:2349
L928: inline constexpr uint32_t CP_EVENT_WRITE_1_ADDR_0_LO__MASK = 0xffffffff;                // adreno_pm4.xml.h:2340
  inline constexpr uint32_t CP_EVENT_WRITE_0_TIMESTAMP = 0x40000000;                      // adreno_pm4.xml.h:2335
  inline constexpr uint32_t CP_EVENT_WRITE_0_IRQ = 0x80000000;                            // adreno_pm4.xml.h:2336
  inline constexpr uint32_t CP_EVENT_WRITE_2_ADDR_0_HI__MASK = 0xffffffff;                // adreno_pm4.xml.h:2349
  constexpr uint32_t CP_EVENT_WRITE_0_EVENT(vgt_event_type v) { return field(v, CP_EVENT_WRITE_0_EVENT__SHIFT, CP_EVENT_WRITE_0_EVENT__MASK); }
L929: inline constexpr uint32_t CP_EVENT_WRITE_2_ADDR_0_HI__MASK = 0xffffffff;                // adreno_pm4.xml.h:2349
  inline constexpr uint32_t CP_EVENT_WRITE_0_IRQ = 0x80000000;                            // adreno_pm4.xml.h:2336
  inline constexpr uint32_t CP_EVENT_WRITE_1_ADDR_0_LO__MASK = 0xffffffff;                // adreno_pm4.xml.h:2340
  constexpr uint32_t CP_EVENT_WRITE_0_EVENT(vgt_event_type v) { return field(v, CP_EVENT_WRITE_0_EVENT__SHIFT, CP_EVENT_WRITE_0_EVENT__MASK); }
  
L930: constexpr uint32_t CP_EVENT_WRITE_0_EVENT(vgt_event_type v) { return field(v, CP_EVENT_WRITE_0_EVENT__SHIFT, CP_EVENT_WRITE_0_EVENT__MASK); }
  inline constexpr uint32_t CP_EVENT_WRITE_1_ADDR_0_LO__MASK = 0xffffffff;                // adreno_pm4.xml.h:2340
  inline constexpr uint32_t CP_EVENT_WRITE_2_ADDR_0_HI__MASK = 0xffffffff;                // adreno_pm4.xml.h:2349
  
  // CP_SET_MARKER, 1 word: tells the command processor the mode, for its save and restore (RM6_COMPUTE before a dispatch)
L1362: // `timestamp` is the TIMESTAMP bit: it must stay clear (see it above); the 4-word form of the packet writes the
  }
  
  // packet's value with the bit clear, which is what the waits of the dispatch tail poll for
  constexpr uint32_t eventWrite0(vgt_event_type event, bool timestamp = false) {
L1364: constexpr uint32_t eventWrite0(vgt_event_type event, bool timestamp = false) {
  // `timestamp` is the TIMESTAMP bit: it must stay clear (see it above); the 4-word form of the packet writes the
  // packet's value with the bit clear, which is what the waits of the dispatch tail poll for
  return CP_EVENT_WRITE_0_EVENT(event) | (timestamp ? CP_EVENT_WRITE_0_TIMESTAMP : 0u);
  }
L1365: return CP_EVENT_WRITE_0_EVENT(event) | (timestamp ? CP_EVENT_WRITE_0_TIMESTAMP : 0u);
  // packet's value with the bit clear, which is what the waits of the dispatch tail poll for
  constexpr uint32_t eventWrite0(vgt_event_type event, bool timestamp = false) {
  }
  
L1382: //   CP_SET_MODE 0 (1 word); the three cache invalidates (CP_EVENT_WRITE, 1 word each: PC_CCU_INVALIDATE_COLOR,
  //
  // The order, as compute.cpp should write it (a type4 of one register each, unless said):
  //   PC_CCU_INVALIDATE_DEPTH, CACHE_INVALIDATE; no wait between them); HLSQ_INVALIDATE_CMD = hlsqInvalidateCmdAll();
  //   CP_WAIT_FOR_IDLE; then the static registers: every entry of kStaticState in order; CP_SET_DRAW_STATE (3 words:
L1391: //   this"). Gallium ends with three CP_SET_AMBLE (3 words each) telling the CP what to run around a preemption; they
  //   turnip's table writes and a draw depends on: the render contract's batch start); then CP_WAIT_FOR_IDLE and
  //   REG_A6XX_RB_CCU_CNTL = rbCcuCntlSysmem() (fd6_emit_ccu_cntl's A6XX path: the wait first, "early a6xx needed
  //   are optional for a batch that is not preempted (see below). Where the two witnesses' tables differ the table
  //   keeps fd6's value (SP_FLOAT_CNTL F16_NO_INF where turnip writes 0; GRAS_UNKNOWN_8110 2 where turnip writes 0);
L1600: // the preemption preamble (fd6_gmem.cc fd6_build_preemption_preamble) adds these two, both = kMagicPcPowerCntl
  inline constexpr uint32_t REG_A6XX_SP_FS_CTRL_REG0 = 0xa980;                           // a6xx.xml.h:8749  reset to 0 only on chips with early preamble
  inline constexpr uint32_t A6XX_SP_FS_CTRL_REG0_EARLYPREAMBLE = 0x10000000;             // a6xx.xml.h:8788
  inline constexpr uint32_t REG_A6XX_PC_POWER_CNTL = 0x9805;                             // a6xx.xml.h:7467
  inline constexpr uint32_t REG_A6XX_VFD_POWER_CNTL = 0xa0f8;                            // a6xx.xml.h:8034
L1814: // Gallium sets the BIN_PREAMBLE to its preemption preamble (the static registers again, RB_CCU_CNTL, PC_POWER_CNTL
  
  // CP_SET_AMBLE, 3 words: an IB (address, then its length and kind) the CP runs by itself around a context switch.
  // and VFD_POWER_CNTL = kMagicPcPowerCntl, and a CP_MEM_TO_REG restoring the VSC state) and clears PREAMBLE and
  // POSTAMBLE (address 0, 0 dwords). A batch that is never preempted does not need any of the three.
L1834: // CP_MEM_TO_REG, 3 words (the preemption preamble's VSC restore): CNT registers from REG are loaded from the address
  constexpr uint32_t CP_SET_AMBLE_2_TYPE(amble_type v) { return field(v, CP_SET_AMBLE_2_TYPE__SHIFT, CP_SET_AMBLE_2_TYPE__MASK); }
  
  inline constexpr uint32_t CP_MEM_TO_REG_0_REG__MASK = 0x0003ffff;                      // adreno_pm4.xml.h:1741
  inline constexpr uint32_t CP_MEM_TO_REG_0_REG__SHIFT = 0;                              // adreno_pm4.xml.h:1742
L2304: // the event blit: CP_EVENT_WRITE BLIT moves the current bin between GMEM and memory (LOAD, STORE) or clears it in GMEM,
  }
  
  // as RB_BLIT_INFO says, over the bin's part of the blit scissor (tu_clear_blit.cc:1909-2009 event_blit_setup/_run)
  enum a6xx_blit_event_type : uint32_t {

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\IOS_APOLLO_GPU_REFERENCE-1f75f381e31d\userland\metal\include\hakios-metal\compute.hpp =====
L79: // end-of-dispatch timestamp words.
  // 16 bytes each, 16-aligned), a border colour entry of zeros (128 bytes, 128-aligned: SP_TP_BORDER_COLOR_BASE_ADDR's
  // entry 0, what a CLAMP_TO_BORDER sampler reads for Metal's clamp_to_zero), a hole descriptor (see below), and the two
  constexpr uint32_t kTableBytes = 8192;
  constexpr uint32_t kTableIbosAt = 0;
L87: constexpr uint32_t kTableTimestampsAt = 5632;   // the two timestamp words the cache flush writes and waits for
  constexpr uint32_t kTableBorderColorAt = 6144;  // Metal's three border colours (texture.hpp: writeBorderColors)
  constexpr uint32_t kTableHoleAt = 5504;         // 64 bytes nobody addresses: what the hole descriptors point at
  // an indirect dispatch's group counts, copied in by the CP from the caller's buffer (which Metal aligns to 4 bytes,
  // and CP_LOAD_STATE6 reads from 16): two vec4s, one under the kernel's own count slot, one under the driver params,
L96: kTableHoleAt + 64 <= kTableTimestampsAt && kTableTimestampsAt + 16 <= kTableIndirectAt && kTableIndirectAt % 16 == 0 &&
  kTableTexSampAt + kMaxTextureSlots * 16 <= kTableHoleAt && kTableIndirectAt + 32 <= kTableBorderColorAt &&
  kTableBorderColorAt + 3 * 128 <= kTableBytes &&
  kTableIndirectAt + 32 <= kTableBytes, "the table's parts fit");
  // An IBO slot ir3 counts but the kernel never addresses (a device buffer at [[buffer(5)]] alone leaves slots 0-4; a
L114: bool invalidate = true;     // CP_EVENT_WRITE CACHE_INVALIDATE before the dispatch (Gallium's barrier)
  bool hlsqCopies = a6xx::kHasLpac;
  bool pvtmemZero = true;     // the private-memory registers written as zero (Gallium does; computerator leaves them)
  bool marker = true;         // CP_SET_MARKER RM6_COMPUTE
  bool tail = true;           // the end: RB_DONE_TS, a wait for it, CACHE_FLUSH_TS, a wait for it
L116: bool tail = true;           // the end: RB_DONE_TS, a wait for it, CACHE_FLUSH_TS, a wait for it
  bool invalidate = true;     // CP_EVENT_WRITE CACHE_INVALIDATE before the dispatch (Gallium's barrier)
  bool marker = true;         // CP_SET_MARKER RM6_COMPUTE
  bool tailRbDone = true;     // ... the RB_DONE_TS half of it
  bool tailCacheFlush = true; // ... the CACHE_FLUSH_TS half of it
L118: bool tailCacheFlush = true; // ... the CACHE_FLUSH_TS half of it
  bool tail = true;           // the end: RB_DONE_TS, a wait for it, CACHE_FLUSH_TS, a wait for it
  bool tailRbDone = true;     // ... the RB_DONE_TS half of it
  // CP_EVENT_WRITE_0_TIMESTAMP on the two events. Off: with it the GPU writes a timestamp where the wait expects the
  // value (the XML says "write back timestamp instead of value from packet", and the phone said so on 28 October: every
L119: // CP_EVENT_WRITE_0_TIMESTAMP on the two events. Off: with it the GPU writes a timestamp where the wait expects the
  bool tailRbDone = true;     // ... the RB_DONE_TS half of it
  bool tailCacheFlush = true; // ... the CACHE_FLUSH_TS half of it
  // value (the XML says "write back timestamp instead of value from packet", and the phone said so on 28 October: every
  // dispatch hung on its own tail, each half of it, until the bit was cleared; computerator leaves it clear, and so does
L120: // value (the XML says "write back timestamp instead of value from packet", and the phone said so on 28 October: every
  bool tailCacheFlush = true; // ... the CACHE_FLUSH_TS half of it
  // CP_EVENT_WRITE_0_TIMESTAMP on the two events. Off: with it the GPU writes a timestamp where the wait expects the
  // dispatch hung on its own tail, each half of it, until the bit was cleared; computerator leaves it clear, and so does
  // the kernel's own fence write). True is here for the fake GPU's test of that, nothing else.
L123: bool tailTimestampBit = false;
  // dispatch hung on its own tail, each half of it, until the bit was cleared; computerator leaves it clear, and so does
  // the kernel's own fence write). True is here for the fake GPU's test of that, nothing else.
  // The texture state: the TEX_SAMP and TEX_CONST loads into SB6_CS_TEX, SP_CS_TEX_SAMP/CONST/COUNT (Gallium's
  // fd6_texture.cc:593-687), emitted only for a kernel with numTextureSlots > 0, as Gallium builds the CS_TEX group

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\IOS_APOLLO_GPU_REFERENCE-1f75f381e31d\userland\metal\include\hakios-metal\fake_gpu.hpp =====
L42: // CACHE_FLUSH_TS after the last draw ("the colour stays in the CCU" otherwise). It rasterizes nothing: coverage, the
  // RB_RENDER_CONTROL0; MSAA off in the three DEST registers; RB_CCU_CNTL written in this submission right after a
  // CP_WAIT_FOR_IDLE with the sysmem shape; and, at the submission's end, a 4-word PC_CCU_FLUSH_COLOR_TS and a 4-word
  // edge rule, interpolation, the y orientation and the bytes are the phone's.
  //
L139: bool ccuFlushed = false, cacheFlushed = false;   // a 4-word PC_CCU_FLUSH_COLOR_TS / CACHE_FLUSH_TS followed it (set at the submission's end)
  uint32_t numNonPosVar = 0;                  // VPC_CNTL_0.NUMNONPOSVAR
  uint32_t spFsOutputReg0 = 0;                // SP_FS_OUTPUT_REG[0]
  };
  struct Stats {

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\IOS_APOLLO_GPU_REFERENCE-1f75f381e31d\userland\metal\include\hakios-metal\gpu.hpp =====
L42: struct MsmSubmitCmd { uint32_t type, submit_idx, submit_offset, size, pad, nr_relocs; uint64_t relocs; };
  struct MsmGemCpuPrep { uint32_t handle, op; MsmTimespec timeout; };
  struct MsmGemCpuFini { uint32_t handle; };
  struct MsmSubmitBo { uint32_t flags, handle; uint64_t presumed; };
  struct MsmGemSubmit {
L63: static_assert(sizeof(MsmSubmitCmd) == 32 && sizeof(MsmSubmitBo) == 16 && sizeof(MsmGemSubmit) == 72, "msm_drm.h layout");
  
  static_assert(sizeof(MsmParam) == 24 && sizeof(MsmGemNew) == 16 && sizeof(MsmGemInfo) == 24, "msm_drm.h layout");
  static_assert(sizeof(MsmWaitFence) == 32, "msm_drm.h layout");
  static_assert(sizeof(HakiosSurface) == 40, "hakios.gpu.cpp layout");
L83: kParamTimestamp = 5,
  kParamChipId = 3,
  kParamMaxFreq = 4,
  kParamGmemBase = 6,
  kParamPriorities = 7,
L99: kSubmitCmdBuf = 1,
  kSubmitBoRead = 0x1,
  kSubmitBoWrite = 0x2,
  };
  
L117: // no firmware, QEMU, or not the phone.
  
  // HakiosGPU's user client (Darwin only: src/iokit_transport.cpp). nullptr when there is no such service: no gpu=1,
  std::unique_ptr<Transport> openKernelGpu(std::string* why);
  

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\IOS_APOLLO_GPU_REFERENCE-1f75f381e31d\userland\metal\include\hakios-metal\hakios_metal.h =====
L6: *   device          the GPU, or NULL when the kernel has none to give (no gpu=1, no firmware, QEMU)
  * failure leaves its reason for hakios_metal_error().
  *
  *   buffer          GPU memory with its CPU mapping (write-combined) and its GPU address
  *   library         a .metallib taken apart: its functions by name, each one's AIR

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\IOS_APOLLO_GPU_REFERENCE-1f75f381e31d\userland\metal\include\hakios-metal\render.hpp =====
L32: //   the tail      CP_WAIT_FOR_IDLE; PC_CCU_FLUSH_COLOR_TS writing a value (no TIMESTAMP bit: the 28 October lesson)
  //                 and stencil off
  //   the draw      CP_DRAW_INDX_OFFSET: a triangle list of N vertices, auto index, one instance
  //                 and a wait for it, which is what puts the colour in memory; LRZ_FLUSH; CACHE_FLUSH_TS and its wait.
  #pragma once
L33: //                 and a wait for it, which is what puts the colour in memory; LRZ_FLUSH; CACHE_FLUSH_TS and its wait.
  //   the draw      CP_DRAW_INDX_OFFSET: a triangle list of N vertices, auto index, one instance
  //   the tail      CP_WAIT_FOR_IDLE; PC_CCU_FLUSH_COLOR_TS writing a value (no TIMESTAMP bit: the 28 October lesson)
  #pragma once
  
L372: // What a pass owns in GPU memory (one 16 KiB page on the phone): the tail's timestamp words, a zero border colour
  uint32_t halfBitsOf(float f);
  
  // entry (the TP's base registers point here, as in compute), a hole, room for step two's per-stage descriptor tables.
  constexpr uint32_t kTableBytes = 8192;
L375: constexpr uint32_t kTableTimestampsAt = 0;        // the CCU flush's and the cache flush's values: 4 words
  // entry (the TP's base registers point here, as in compute), a hole, room for step two's per-stage descriptor tables.
  constexpr uint32_t kTableBytes = 8192;
  constexpr uint32_t kTableClearFlushAt = 12;       // ...the fourth: the CCU flush after a Clear's fill, which writes kClearFlushValue
  constexpr uint32_t kClearFlushValue = 4;
L406: constexpr uint32_t kTableZeroedBytes = 96;        // what tableStart zeroes from kTableTimestampsAt: every word above
  constexpr uint32_t kTableBinFlushAt = 76;
  constexpr uint32_t kBinFlushValue = 12;
  static_assert(kTableMoreClearFlushAt + 4 * (kMaxColorOutputs - 1) <= kTableZeroedBytes, "the Clears' words are zeroed");
  // an occlusion query's two snapshots of the running sample count (RB_SAMPLE_COUNT_ADDR), begin and end, 64 bits each
L420: // Each group switchable, as compute::Options are: the instrument that found the TIMESTAMP bit. The defaults are the
  kTableFsAt + 4096 <= kTableBytes, "the table's parts fit");
  
  // whole stream as turnip's sysmem pass and r3d path have it; the *Alt fields pick the other witness's value where the
  // two disagree, so one boot of --bisect can tell which the hardware wants.
L461: bool tailCacheFlush = true;  // CACHE_FLUSH_TS + CP_WAIT_MEM_GTE, as compute's tail
  bool tailDepthFlush = true;  // with a depth attachment: PC_CCU_FLUSH_DEPTH_TS writing a value + the wait for it
  bool tailLrzFlush = true;    // LRZ_FLUSH, 1 word
  bool tailRbDone = false;     // RB_DONE_TS + wait: in neither witness's render end; here for the bisect
  bool tailTimestampBit = false;   // must stay clear (28 October); here for the fake's test only
L463: bool tailTimestampBit = false;   // must stay clear (28 October); here for the fake's test only
  bool tailCacheFlush = true;  // CACHE_FLUSH_TS + CP_WAIT_MEM_GTE, as compute's tail
  bool tailRbDone = false;     // RB_DONE_TS + wait: in neither witness's render end; here for the bisect
  bool dedupRegs = true;       // in an open pass, a register write that would put the value the register already holds is
  // left out (CommandBuffer::draw); off: every draw writes all of its state, as before
L568: // TABLE then the draw's own (its descriptors), the border colours and the timestamps being the pass's; encodeEnd the
  // The same draw in three parts, for a pass of several (CommandBuffer::draw joins a draw to the open pass into the same
  // attachments): encodeBegin the batch start, the pass begin and the clears; encodeInPass one draw's state and the draw,
  // tail into the pass's TABLE. encode is the three over one table.
  // (SKIP_CLEARS: colour attachments whose Clear a GMEM pass does in its tiles instead)

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\IOS_APOLLO_GPU_REFERENCE-1f75f381e31d\userland\metal\plugin\HakiosMetal.m =====
L310: *   libraries   -newLibraryWithData:error:, -newLibraryWithURL:error:, -newLibraryWithFile:error:, -newDefaultLibrary...:
  *               for the CPU and, later, the GPU; until the GPU is used (hakios.gpu.cpp's buffers, mapped into its address
  *               space) it is ordinary memory of this process, zeroed, and -gpuAddress is 0.
  *               the .metallib read (hakios_metallib.c, every offset checked), its functions listed by name and type, and
  *               -newFunctionWithName: giving a function that knows its name, its type and its module (the AIR bitcode the
L1091: class_addMethod(device, sel_registerName("newLibraryWithFile:error:"), (IMP)deviceNewLibraryFile, "@@:@^@");
  objc_registerClassPair(gLibraryClass);
  class_addMethod(device, sel_registerName("newLibraryWithURL:error:"), (IMP)deviceNewLibraryURL, "@@:@^@");
  class_addMethod(device, sel_registerName("newLibraryWithData:error:"), (IMP)deviceNewLibraryData, "@@:@^@");
  class_addMethod(device, sel_registerName("newDefaultLibrary"), (IMP)deviceNewDefaultLibrary, "@@:");

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\IOS_APOLLO_GPU_REFERENCE-1f75f381e31d\userland\metal\src\compute.cpp =====
L55: st.packet(CP_EVENT_WRITE, &w, 1);
  void event(pm4::Stream& st, vgt_event_type e) {
  uint32_t w = eventWrite0(e, false);
  }
  
L59: void eventTimestamp(pm4::Stream& st, vgt_event_type e, uint64_t address, uint32_t value, bool timestampBit) {
  
  // an event that writes VALUE to ADDRESS when it has completed: how the GPU says the caches are flushed
  uint32_t w[4] = {eventWrite0(e, timestampBit), uint32_t(address), uint32_t(address >> 32), value};
  st.packet(CP_EVENT_WRITE, w, 4);
L60: uint32_t w[4] = {eventWrite0(e, timestampBit), uint32_t(address), uint32_t(address >> 32), value};
  // an event that writes VALUE to ADDRESS when it has completed: how the GPU says the caches are flushed
  void eventTimestamp(pm4::Stream& st, vgt_event_type e, uint64_t address, uint32_t value, bool timestampBit) {
  st.packet(CP_EVENT_WRITE, w, 4);
  }
L61: st.packet(CP_EVENT_WRITE, w, 4);
  void eventTimestamp(pm4::Stream& st, vgt_event_type e, uint64_t address, uint32_t value, bool timestampBit) {
  uint32_t w[4] = {eventWrite0(e, timestampBit), uint32_t(address), uint32_t(address >> 32), value};
  }
  
L283: memset(tableCpu + kTableTimestampsAt, 0, 64);
  memset(tableCpu + kTableHoleAt, 0, 64);
  writeBorderColors(tableCpu + kTableBorderColorAt);   // the entries a sampler's BCOLOR names
  
  // --- the textures and samplers: the two tables, only for a kernel with sampled textures (Gallium builds the CS_TEX
L562: uint64_t ts = table + kTableTimestampsAt;
  if (o.tail) {
  // the end, as computerator's cache_flush: the GPU says it is done, the caches are flushed, and the flush is waited for
  if (o.tailRbDone) {
  eventTimestamp(stream, RB_DONE_TS, ts, 1, o.tailTimestampBit);
L564: eventTimestamp(stream, RB_DONE_TS, ts, 1, o.tailTimestampBit);
  uint64_t ts = table + kTableTimestampsAt;
  if (o.tailRbDone) {
  waitForWord(stream, ts, 1);
  }
L568: eventTimestamp(stream, CACHE_FLUSH_TS, ts + 4, 2, o.tailTimestampBit);
  }
  if (o.tailCacheFlush) {
  waitForWordAtLeast(stream, ts + 4, 2);
  }

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\IOS_APOLLO_GPU_REFERENCE-1f75f381e31d\userland\metal\src\fake_gpu.cpp =====
L1137: // CP_EVENT_WRITE BLIT in a tile: RB_BLIT_INFO's LOAD or STORE carried out over the tile's part of RB_BLIT_SCISSOR,
  }
  
  // between the destination's rows and GMEM at RB_BLIT_BASE_GMEM, the bin's width a GMEM row (what the draws see there,
  // RB_MRT's BASE_GMEM 0 with the window offset at the bin's corner)
L2151: case CP_EVENT_WRITE: {
  }
  break;
  // 1 word: the event; 4: and the address and value written when it completes (at once here: the model
  // is in order, so what a later wait reads is what an earlier event wrote)
L2155: fault(text("CP_EVENT_WRITE of %llu words, not 1 or 4", h.count));
  // is in order, so what a later wait reads is what an earlier event wrote)
  if (h.count != 1 && h.count != 4) {
  return false;
  }
L2160: if (h.count == 1 && fieldOf(p[0], CP_EVENT_WRITE_0_EVENT__MASK, CP_EVENT_WRITE_0_EVENT__SHIFT) == BLIT && !eventBlit()) {
  // ZPASS_DONE: the running sample count, 64 bits, where RB_SAMPLE_COUNT_ADDR points, when
  // RB_SAMPLE_COUNT_CONTROL.COPY asks for it (turnip's occlusion query, A6XX path)
  return false;
  }
L2163: if (h.count == 1 && fieldOf(p[0], CP_EVENT_WRITE_0_EVENT__MASK, CP_EVENT_WRITE_0_EVENT__SHIFT) == ZPASS_DONE) {
  return false;
  }
  if ((reg(REG_A6XX_RB_SAMPLE_COUNT_CONTROL) & A6XX_RB_SAMPLE_COUNT_CONTROL_COPY) == 0) {
  fault("ZPASS_DONE without RB_SAMPLE_COUNT_CONTROL.COPY: no count is written");
L2178: // With the TIMESTAMP bit the GPU writes a timestamp of its own, not the packet's value (the XML says so,
  if (h.count == 4) {
  uint64_t to = p[1] | uint64_t(p[2]) << 32;
  // and on the phone a wait for the value then never ended: 28 October, every dispatch); here a 64-bit
  // count no wait for a small value can match, 8 bytes as the GPU's timestamp is.
L2180: // count no wait for a small value can match, 8 bytes as the GPU's timestamp is.
  // With the TIMESTAMP bit the GPU writes a timestamp of its own, not the packet's value (the XML says so,
  // and on the phone a wait for the value then never ended: 28 October, every dispatch); here a 64-bit
  bool timestamp = (p[0] & CP_EVENT_WRITE_0_TIMESTAMP) != 0;
  uint8_t* d = at(to, timestamp ? 8 : 4);
L2181: bool timestamp = (p[0] & CP_EVENT_WRITE_0_TIMESTAMP) != 0;
  // and on the phone a wait for the value then never ended: 28 October, every dispatch); here a 64-bit
  // count no wait for a small value can match, 8 bytes as the GPU's timestamp is.
  uint8_t* d = at(to, timestamp ? 8 : 4);
  if (d == nullptr || to % 4 != 0) {
L2182: uint8_t* d = at(to, timestamp ? 8 : 4);
  // count no wait for a small value can match, 8 bytes as the GPU's timestamp is.
  bool timestamp = (p[0] & CP_EVENT_WRITE_0_TIMESTAMP) != 0;
  if (d == nullptr || to % 4 != 0) {
  fault(text("CP_EVENT_WRITE's timestamp at %#llx: outside every buffer", to));
L2184: fault(text("CP_EVENT_WRITE's timestamp at %#llx: outside every buffer", to));
  uint8_t* d = at(to, timestamp ? 8 : 4);
  if (d == nullptr || to % 4 != 0) {
  return false;
  }
L2187: if (timestamp) {
  return false;
  }
  uint64_t ticks = 0x0001000000000000ull + stats_.packets;
  memcpy(d, &ticks, 8);
L2195: uint32_t ev = fieldOf(p[0], CP_EVENT_WRITE_0_EVENT__MASK, CP_EVENT_WRITE_0_EVENT__SHIFT);
  // what a draw needs after it: the colour CCU flushed to memory (tu6_emit_flushes / fd6_emit_flushes: the
  // 4-word form with an address, freedreno_gpu_event.h:60-85 needs_seqno) and then the cache flush
  if (ev == PC_CCU_FLUSH_COLOR_TS) drawsWithoutCcuFlush_ = 0;
  if (ev == PC_CCU_FLUSH_DEPTH_TS) drawsWithoutDepthFlush_ = 0;
L2198: if (ev == CACHE_FLUSH_TS) drawsWithoutCacheFlush_ = 0;
  if (ev == PC_CCU_FLUSH_COLOR_TS) drawsWithoutCcuFlush_ = 0;
  if (ev == PC_CCU_FLUSH_DEPTH_TS) drawsWithoutDepthFlush_ = 0;
  }
  break;
L2392: // CACHE_FLUSH_TS: a stream that draws and ends without both would complete with the target unchanged
  // the colour a draw wrote sits in the CCU until PC_CCU_FLUSH_COLOR_TS (the kernel's own end-of-submit fence
  // flushes the UCHE, not the CCU: hakios.adreno.c:3496-3516), and what the CCU flushed sits in the UCHE until
  if (drawsWithoutCcuFlush_ != 0) {
  fault("the colour stays in the CCU: no PC_CCU_FLUSH_COLOR_TS (4-word) after the draw");
L2400: fault("the colour may stay in the cache: no CACHE_FLUSH_TS (4-word) after the draw");
  ok = false;
  } else if (drawsWithoutCacheFlush_ != 0) {
  ok = false;
  }
L2448: case kParamTimestamp: p->value = uint64_t(nowNs()); return 0;
  case kParamChipId: p->value = kChipId | kSpeedBin << 32; return 0;
  case kParamMaxFreq: p->value = kMaxFrequencyHz; return 0;
  case kParamGmemBase: p->value = 0; return 0;
  case kParamPriorities: p->value = 1; return 0;
L2538: auto* cmd = reinterpret_cast<const MsmSubmitCmd*>(uintptr_t(s->cmds));
  if (s->nr_cmds != 1 || s->nr_bos == 0 || (s->queueid != 0 && queues_.count(s->queueid) == 0)) return EINVAL;
  auto* bos = reinterpret_cast<const MsmSubmitBo*>(uintptr_t(s->bos));
  if (cmd->submit_idx >= s->nr_bos || cmd->type != kSubmitCmdBuf || cmd->size % 4 != 0) return EINVAL;
  for (uint32_t i = 0; i < s->nr_bos; i++) {
L2539: if (cmd->submit_idx >= s->nr_bos || cmd->type != kSubmitCmdBuf || cmd->size % 4 != 0) return EINVAL;
  auto* bos = reinterpret_cast<const MsmSubmitBo*>(uintptr_t(s->bos));
  auto* cmd = reinterpret_cast<const MsmSubmitCmd*>(uintptr_t(s->cmds));
  for (uint32_t i = 0; i < s->nr_bos; i++) {
  if (buffers_.count(bos[i].handle) == 0) return ENOENT;   // a buffer the GPU would not know: refused

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\IOS_APOLLO_GPU_REFERENCE-1f75f381e31d\userland\metal\src\gpu.cpp =====
L163: MsmSubmitCmd cmd{};
  }
  }
  cmd.type = kSubmitCmdBuf;
  cmd.submit_idx = 0;
L164: cmd.type = kSubmitCmdBuf;
  }
  MsmSubmitCmd cmd{};
  cmd.submit_idx = 0;
  cmd.submit_offset = offsetBytes;

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\IOS_APOLLO_GPU_REFERENCE-1f75f381e31d\userland\metal\src\iokit_transport.cpp =====
L111: "firmware in the ADT: mkadt.py --gmu-fw/--sqe-fw/--zap-mdt)";
  if (s == 0) {
  *why = "no SweetGPU service: the kernel has not kept the GPU on (boot-args sweetgpu=22 sweetgpukeep=1, the "
  return nullptr;
  }

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\IOS_APOLLO_GPU_REFERENCE-1f75f381e31d\userland\metal\src\render.cpp =====
L61: st.packet(CP_EVENT_WRITE, &w, 1);
  void event(pm4::Stream& st, vgt_event_type e) {
  uint32_t w = eventWrite0(e, false);
  }
  
L65: // tu_cmd_buffer.cc:48-70) has no TIMESTAMP bit; with it the GPU writes a timestamp instead and the wait below never
  
  // the 4-word event: VALUE written to ADDRESS when it has completed. turnip's form (tu_emit_raw_event_write,
  // ends (28 October, every compute dispatch). The bit is here for the fake GPU's test of that alone.
  void eventTimestamp(pm4::Stream& st, vgt_event_type e, uint64_t address, uint32_t value, bool timestampBit) {
L67: void eventTimestamp(pm4::Stream& st, vgt_event_type e, uint64_t address, uint32_t value, bool timestampBit) {
  // tu_cmd_buffer.cc:48-70) has no TIMESTAMP bit; with it the GPU writes a timestamp instead and the wait below never
  // ends (28 October, every compute dispatch). The bit is here for the fake GPU's test of that alone.
  uint32_t w[4] = {eventWrite0(e, timestampBit), uint32_t(address), uint32_t(address >> 32), value};
  st.packet(CP_EVENT_WRITE, w, 4);
L68: uint32_t w[4] = {eventWrite0(e, timestampBit), uint32_t(address), uint32_t(address >> 32), value};
  // ends (28 October, every compute dispatch). The bit is here for the fake GPU's test of that alone.
  void eventTimestamp(pm4::Stream& st, vgt_event_type e, uint64_t address, uint32_t value, bool timestampBit) {
  st.packet(CP_EVENT_WRITE, w, 4);
  }
L69: st.packet(CP_EVENT_WRITE, w, 4);
  void eventTimestamp(pm4::Stream& st, vgt_event_type e, uint64_t address, uint32_t value, bool timestampBit) {
  uint32_t w[4] = {eventWrite0(e, timestampBit), uint32_t(address), uint32_t(address >> 32), value};
  }
  
L924: eventTimestamp(stream, PC_CCU_FLUSH_COLOR_TS, ts, kClearFlushValue, false);
  void clearStream(pm4::Stream& stream, const Texture& target, const ClearWords& c, uint64_t ts, uint32_t level = 0, uint32_t slice = 0) {
  fillStream(stream, target, c, TILE6_LINEAR, level, slice);
  waitForWord(stream, ts, kClearFlushValue);
  event(stream, PC_CCU_INVALIDATE_COLOR);
L939: eventTimestamp(stream, PC_CCU_FLUSH_COLOR_TS, table + kTableDepthClearFlushAt, kDepthClearFlushValue, false);
  c.value[0] = fui(float(clearDepth));
  fillStream(stream, depth, c, TILE6_3, level, slice);
  waitForWord(stream, table + kTableDepthClearFlushAt, kDepthClearFlushValue);
  eventTimestamp(stream, PC_CCU_FLUSH_DEPTH_TS, table + kTableDepthClearDepthFlushAt, kDepthClearDepthFlushValue, false);
L941: eventTimestamp(stream, PC_CCU_FLUSH_DEPTH_TS, table + kTableDepthClearDepthFlushAt, kDepthClearDepthFlushValue, false);
  eventTimestamp(stream, PC_CCU_FLUSH_COLOR_TS, table + kTableDepthClearFlushAt, kDepthClearFlushValue, false);
  waitForWord(stream, table + kTableDepthClearFlushAt, kDepthClearFlushValue);
  waitForWord(stream, table + kTableDepthClearDepthFlushAt, kDepthClearDepthFlushValue);
  event(stream, PC_CCU_INVALIDATE_DEPTH);
L963: eventTimestamp(stream, PC_CCU_FLUSH_COLOR_TS, table + kTableStencilClearFlushAt, kStencilClearFlushValue, false);
  regs(stream, REG_A6XX_RB_2D_DST_FLAGS, {0, 0, 0});
  command1(stream, CP_BLIT, cpBlit0(BLIT_OP_SCALE));
  waitForWord(stream, table + kTableStencilClearFlushAt, kStencilClearFlushValue);
  eventTimestamp(stream, PC_CCU_FLUSH_DEPTH_TS, table + kTableStencilClearDepthFlushAt, kStencilClearDepthFlushValue, false);
L965: eventTimestamp(stream, PC_CCU_FLUSH_DEPTH_TS, table + kTableStencilClearDepthFlushAt, kStencilClearDepthFlushValue, false);
  eventTimestamp(stream, PC_CCU_FLUSH_COLOR_TS, table + kTableStencilClearFlushAt, kStencilClearFlushValue, false);
  waitForWord(stream, table + kTableStencilClearFlushAt, kStencilClearFlushValue);
  waitForWord(stream, table + kTableStencilClearDepthFlushAt, kStencilClearDepthFlushValue);
  event(stream, PC_CCU_INVALIDATE_DEPTH);
L1134: memset(tableCpu + kTableTimestampsAt, 0, kTableZeroedBytes);   // the tail's and the clears' values: 0 until the events write them
  // the table's words the stream addresses, zeroed before the GPU sees them
  void tableStart(uint8_t* tableCpu) {
  writeBorderColors(tableCpu + kTableBorderColorAt);     // the entries a sampler's BCOLOR names (the batch start points the TP here)
  memset(tableCpu + kTableHoleAt, 0, 64);
L1218: // fd6_gmem.cc:2114); RB_DONE_TS only under tailRbDone (in neither witness's render end); CACHE_FLUSH_TS writing 2 and
  // (neither witness waits: both let the kernel's fence follow; the kernel's own fence here has no CCU flush,
  // hakios.adreno.c:3496-3516, so the wait is cheap insurance); LRZ_FLUSH as both witnesses end a pass (tu_lrz.cc:465,
  // CP_WAIT_MEM_GTE for it, compute's measured tail
  stream.waitForIdle();
L1222: const uint64_t ts = table + kTableTimestampsAt;
  stream.waitForIdle();
  {
  if (o.tailCcuFlush) {
  eventTimestamp(stream, PC_CCU_FLUSH_COLOR_TS, ts, 1, o.tailTimestampBit);
L1224: eventTimestamp(stream, PC_CCU_FLUSH_COLOR_TS, ts, 1, o.tailTimestampBit);
  const uint64_t ts = table + kTableTimestampsAt;
  if (o.tailCcuFlush) {
  waitForWord(stream, ts, 1);
  }
L1230: eventTimestamp(stream, PC_CCU_FLUSH_DEPTH_TS, table + kTableDepthFlushAt, kDepthFlushValue, false);
  // A6XX): every draw is a pass of its own here, so the next draw's depth test must find this one's depth in memory
  if (depth && o.tailDepthFlush) {
  waitForWord(stream, table + kTableDepthFlushAt, kDepthFlushValue);
  }
L1237: eventTimestamp(stream, RB_DONE_TS, ts + 8, 3, o.tailTimestampBit);
  }
  if (o.tailRbDone) {
  waitForWord(stream, ts + 8, 3);
  }
L1241: eventTimestamp(stream, CACHE_FLUSH_TS, ts + 4, 2, o.tailTimestampBit);
  }
  if (o.tailCacheFlush) {
  waitForWordAtLeast(stream, ts + 4, 2);
  }
L1613: eventTimestamp(stream, PC_CCU_FLUSH_COLOR_TS, table + kTableFbReadFlushAt, kFbReadFlushValue, false);
  if (barrier && gmem == nullptr) {
  stream.waitForIdle();
  waitForWord(stream, table + kTableFbReadFlushAt, kFbReadFlushValue);
  event(stream, CACHE_INVALIDATE);
L1687: // track RB_RENDER_CNTL for preemption: a type-4 write of the register is the same write).
  // 7. RB_RENDER_CNTL: CCUSINGLECACHELINESIZE 2 in both pipelines (tu_cmd_buffer.cc:633-693; fd6_gmem.cc:531-552), 0 in
  // r3d_dst (tu_clear_blit.cc:1408) -- renderCntlZero for the bisect. A plain type-4: has_cp_reg_write is false on the A635 (the A650 has CP_REG_WRITE, which Gallium uses only to
  if (o.renderCntl) {
  uint32_t flagMrts = 0;
L2422: eventTimestamp(stream, CACHE_FLUSH_TS, table + kTableBinFlushAt, kBinFlushValue, false);
  // the VSC wrote through the UCHE and the command processor reads the streams uncached: flushed and waited for
  stream.waitForIdle();
  waitForWord(stream, table + kTableBinFlushAt, kBinFlushValue);
  stream.waitForMe();
L2535: eventTimestamp(stream, PC_CCU_RESOLVE_TS, table + kTableBlitFlushAt, kBlitFlushValue, false);
  // the stores out of the blit cache (tu6_tile_render_end's FD_CCU_CLEAN_BLIT_CACHE: PC_CCU_RESOLVE_TS on A6XX), waited
  // for as the tail waits for its flushes; then the CCU back where every other pass here expects it
  waitForWord(stream, table + kTableBlitFlushAt, kBlitFlushValue);
  stream.waitForIdle();
L2678: eventTimestamp(stream, PC_CCU_FLUSH_COLOR_TS, table + kTableClearFlushAt, kClearFlushValue, false);
  command1(stream, CP_BLIT, cpBlit0(BLIT_OP_SCALE));
  // what a Clear's fill does after it, and then the pass's tail: the copy is in memory when the next thing reads it
  waitForWord(stream, table + kTableClearFlushAt, kClearFlushValue);
  event(stream, PC_CCU_INVALIDATE_COLOR);
L2713: eventTimestamp(stream, PC_CCU_FLUSH_COLOR_TS, table + kTableClearFlushAt, kClearFlushValue, false);
  length -= w;
  }
  waitForWord(stream, table + kTableClearFlushAt, kClearFlushValue);
  event(stream, PC_CCU_INVALIDATE_COLOR);
L2769: case CP_EVENT_WRITE: case CP_SET_MODE: case CP_SET_VISIBILITY_OVERRIDE: case CP_SET_MARKER: case CP_REG_TO_MEM:
  case pm4::kNop: case CP_WAIT_MEM_GTE: case CP_SKIP_IB2_ENABLE_GLOBAL: case CP_WAIT_FOR_IDLE: case CP_LOAD_STATE6_GEOM:
  case CP_LOAD_STATE6_FRAG: case CP_LOAD_STATE6: case CP_DRAW_INDX_OFFSET: case CP_DRAW_INDIRECT_MULTI: case CP_WAIT_REG_MEM:
  case pm4::kMemcpy: case pm4::kWaitMemWrites: case pm4::kWaitForMe:
  break;

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\IOS_APOLLO_GPU_REFERENCE-1f75f381e31d\userland\metal\tests\a6xx_test.cpp =====
L22: // CP_EVENT_WRITE 0x46 = 100 0110, three ones: 0. count 1: one bit: 0. count 4: 0.
  // CP_EXEC_CS 0x33 = 011 0011, four ones: bit 23 is 1 (0x00800000). count 4 = 100, one bit: bit 15 is 0.
  CHECK_EQ(pm4::type7(CP_EXEC_CS, 4), 0x70b30004u);
  CHECK_EQ(pm4::type7(CP_EVENT_WRITE, 1), 0x70460001u);
  CHECK_EQ(pm4::type7(CP_EVENT_WRITE, 4), 0x70460004u);
L23: CHECK_EQ(pm4::type7(CP_EVENT_WRITE, 1), 0x70460001u);
  CHECK_EQ(pm4::type7(CP_EXEC_CS, 4), 0x70b30004u);
  // CP_EVENT_WRITE 0x46 = 100 0110, three ones: 0. count 1: one bit: 0. count 4: 0.
  CHECK_EQ(pm4::type7(CP_EVENT_WRITE, 4), 0x70460004u);
  // CP_SET_MARKER 0x65 = 110 0101, four ones: bit 23 is 1. count 1: 0.
L24: CHECK_EQ(pm4::type7(CP_EVENT_WRITE, 4), 0x70460004u);
  // CP_EVENT_WRITE 0x46 = 100 0110, three ones: 0. count 1: one bit: 0. count 4: 0.
  CHECK_EQ(pm4::type7(CP_EVENT_WRITE, 1), 0x70460001u);
  // CP_SET_MARKER 0x65 = 110 0101, four ones: bit 23 is 1. count 1: 0.
  CHECK_EQ(pm4::type7(CP_SET_MARKER, 1), 0x70e50001u);
L314: CHECK_EQ(eventWrite0(CACHE_FLUSH_TS, true), 0x40000004u);
  // the events and waits of the flush at the end
  CHECK_EQ(eventWrite0(RB_DONE_TS, true), 0x40000016u);
  CHECK_EQ(eventWrite0(CACHE_INVALIDATE, false), 0x31u);
  CHECK_EQ(waitRegMem0(WRITE_EQ, POLL_MEMORY), 0x13u);
L428: CHECK_EQ(eventWrite0(PC_CCU_FLUSH_COLOR_TS), 0x1du);   // no TIMESTAMP bit: the 28 October lesson holds for the render tail too
  CHECK_EQ(uint32_t(LRZ_FLUSH), 38u);
  CHECK_EQ(uint32_t(LRZ_CLEAR), 37u);
  CHECK_EQ(eventWrite0(LRZ_FLUSH), 0x26u);
  // the marker and the state blocks of the two stages' loads

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\IOS_APOLLO_GPU_REFERENCE-1f75f381e31d\userland\metal\tests\compiler_test.cpp =====
L116: std::unique_ptr<CompiledKernel> compareWithFixture(const char* name, const Kernel& b, const char* entry, const char* needle) {
  // NAME.ll compiled here against its fixture B: every field of the Kernel, the words, and what the compiler reported
  // about the resources; NEEDLE is an instruction the listing must carry. Returns the compiled kernel for more checks.
  std::vector<uint8_t> bc = bitcodeOf(name);
  // a build with the compiler and no bitcode is a broken build, not a pass
L167: compareWithFixture("fill_id", kernels::fill_id_air, "fill_id", "stib");
  return;
  }
  // and a module that is not a kernel is refused by name, not compiled into something else
  uint8_t garbage[16] = {'B', 'C', 0xc0, 0xde, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
L182: auto k = compareWithFixture("tex_size_h", kernels::tex_size_h_air, "tex_size_h", "getsize");
  return;
  }
  if (k) {
  CHECK_EQ(k->kernel.textures[0].element, uint8_t(kElemFloat));
L196: auto k = compareWithFixture("tg_arg", kernels::tg_arg_air, "tg_arg", "l[r1.z+256]");
  return;
  }
  if (k) {
  CHECK(k->hasThreadgroupArg);
L203: auto fill = compareWithFixture("tex_fill", kernels::tex_fill_air, "tex_fill", "stib");
  }
  // the twin: a kernel with no threadgroup argument says so, and keeps its base at 0
  if (fill) CHECK(!fill->hasThreadgroupArg);
  }
L215: auto k = compareWithFixture("ptr_phi", kernels::ptr_phi_air, "ptr_phi", "ldib");
  return;
  }
  if (k) CHECK_EQ(k->kernel.numSsbos, 2u);
  }
L227: auto fill = compareWithFixture("tex_fill", kernels::tex_fill_air, "tex_fill", "stib.b.typed.2d.u32.4");
  return;
  }
  if (fill) {
  // the image is the one resource with a texture kind; c is a constant buffer
L240: auto copy = compareWithFixture("tex_copy", kernels::tex_copy_air, "tex_copy", "isaml");
  CHECK_EQ(samplers, 0u);
  }
  if (copy) {
  bool inAt1 = false, outAt0 = false;
L251: auto sample = compareWithFixture("tex_sample_gid", kernels::tex_sample_gid_air, "tex_sample_gid", "saml");
  CHECK(copy->listing.find("t#1") != std::string::npos);
  }
  if (sample) {
  bool samplerAt0 = false;
L259: auto half = compareWithFixture("tex_fill_h", kernels::tex_fill_h_air, "tex_fill_h", "stib.b.typed.2d.f16.4");
  }
  // the half image: the store typed by its VALUE (f16), the slot's class float as declared, 16-bit values
  if (half) {
  CHECK_EQ(half->kernel.textures[0].element, uint8_t(kElemFloat));
L427: std::shared_ptr<CompiledStage> compareStageWithFixture(const char* name, const Stage& b, const char* entry, const char* needle) {
  // NAME.ll compiled here as a Stage against its fixture B (tools/mesa/ir3-dump.patch's emit_stage_fields): the Kernel part
  // field for field as above, then every field of render.hpp's Stage. Returns the compiled stage, shared, for the link tests.
  std::vector<uint8_t> bc = bitcodeOf(name);
  CHECK(!bc.empty());
L572: auto flatVs = compareStageWithFixture("tri_flat_vs", kernels::tri_flat_vs_air, "tri_flat_vs", "sel.b32");
  return;
  }
  auto flatFs = compareStageWithFixture("tri_flat_fs", kernels::tri_flat_fs_air, "tri_flat_fs", "mov.u32u32 r0.x, 0x3e008081");
  auto colorVs = compareStageWithFixture("tri_color_vs", kernels::tri_color_vs_air, "tri_color_vs", "sel.b32");
L573: auto flatFs = compareStageWithFixture("tri_flat_fs", kernels::tri_flat_fs_air, "tri_flat_fs", "mov.u32u32 r0.x, 0x3e008081");
  }
  auto flatVs = compareStageWithFixture("tri_flat_vs", kernels::tri_flat_vs_air, "tri_flat_vs", "sel.b32");
  auto colorVs = compareStageWithFixture("tri_color_vs", kernels::tri_color_vs_air, "tri_color_vs", "sel.b32");
  auto colorFs = compareStageWithFixture("tri_color_fs", kernels::tri_color_fs_air, "tri_color_fs", "bary.f");
L574: auto colorVs = compareStageWithFixture("tri_color_vs", kernels::tri_color_vs_air, "tri_color_vs", "sel.b32");
  auto flatVs = compareStageWithFixture("tri_flat_vs", kernels::tri_flat_vs_air, "tri_flat_vs", "sel.b32");
  auto flatFs = compareStageWithFixture("tri_flat_fs", kernels::tri_flat_fs_air, "tri_flat_fs", "mov.u32u32 r0.x, 0x3e008081");
  auto colorFs = compareStageWithFixture("tri_color_fs", kernels::tri_color_fs_air, "tri_color_fs", "bary.f");
  // the constant-buffer fragment stage: its pushed range compiled here as the fixture writer wrote it (block 0, 16 dwords at c0)
L575: auto colorFs = compareStageWithFixture("tri_color_fs", kernels::tri_color_fs_air, "tri_color_fs", "bary.f");
  auto flatFs = compareStageWithFixture("tri_flat_fs", kernels::tri_flat_fs_air, "tri_flat_fs", "mov.u32u32 r0.x, 0x3e008081");
  auto colorVs = compareStageWithFixture("tri_color_vs", kernels::tri_color_vs_air, "tri_color_vs", "sel.b32");
  // the constant-buffer fragment stage: its pushed range compiled here as the fixture writer wrote it (block 0, 16 dwords at c0)
  auto cflatFs = compareStageWithFixture("tri_cflat_fs", kernels::tri_cflat_fs_air, "tri_cflat_fs", "mov.u32u32 r0.x, c0.x");
L577: auto cflatFs = compareStageWithFixture("tri_cflat_fs", kernels::tri_cflat_fs_air, "tri_cflat_fs", "mov.u32u32 r0.x, c0.x");
  auto colorFs = compareStageWithFixture("tri_color_fs", kernels::tri_color_fs_air, "tri_color_fs", "bary.f");
  // the constant-buffer fragment stage: its pushed range compiled here as the fixture writer wrote it (block 0, 16 dwords at c0)
  if (cflatFs) {
  CHECK_EQ(cflatFs->stage.k.numUboRanges, 1u);
L612: auto dposVs = compareStageWithFixture("tri_dpos_vs", kernels::tri_dpos_vs_air, "tri_dpos_vs", "ldib");
  }
  // vertex pulling from a device buffer: an ldib through IBO 0 of the 3D table
  if (dposVs) {
  CHECK_EQ(dposVs->stage.k.numSsbos, 1u);
L618: auto uposVs = compareStageWithFixture("tri_upos_vs", kernels::tri_upos_vs_air, "tri_upos_vs", "ldc");
  }
  // vertex pulling from a constant buffer: an ldc through UBO 0, nothing pushed
  if (uposVs) {
  CHECK_EQ(uposVs->stage.k.numUbos, 1u);
L623: auto texFs = compareStageWithFixture("tri_tex_fs", kernels::tri_tex_fs_air, "tri_tex_fs", "bary.f");
  CHECK_EQ(uposVs->stage.k.numUboRanges, 0u);
  }
  if (texFs) {
  CHECK_EQ(texFs->stage.k.numTextureSlots, 1u);
L634: auto nullFs = compareStageWithFixture("tri_null_fs", kernels::tri_null_fs_air, "tri_null_fs", "sam.3d");
  }
  // the null texture's slot: the 2D sample a prefetch, the 3D one a sam.3d, both through slot 0, which is marked
  if (nullFs) {
  CHECK_EQ(nullFs->stage.k.numTextureSlots, 1u);
L641: auto mrtFs = compareStageWithFixture("tri_mrt_fs", kernels::tri_mrt_fs_air, "tri_mrt_fs", "mov.u32u32 r1.w, 0x3f400000");
  }
  // two colour targets: [[color(0)]] in r0, [[color(1)]] in r1, and the pipeline links (MRT is the draw's to serve now)
  if (mrtFs) {
  CHECK_EQ(mrtFs->stage.numColorOutputs, 2u);
L655: auto fbFs = compareStageWithFixture("tri_fb_fs", kernels::tri_fb_fs_air, "tri_fb_fs", "isaml (f32)(xyz)");
  // a framebuffer fetch: lowerFbRead's texel fetch (isaml) of slot 0, marked as colour attachment 0's, the layer and
  // the sample folded to 0, so no VARYING_SLOT_LAYER input and no sample id are left for the draw to refuse
  if (fbFs) {
  CHECK_EQ(uint32_t(fbFs->stage.fbRead), 1u);
L1266: auto k = compareWithFixture("argbuf_res", kernels::argbuf_res_air, "argbuf_res", "isam");
  return;
  }
  if (!k) return;
  Gpu gpu(std::make_unique<FakeGpu>());

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\IOS_APOLLO_GPU_REFERENCE-1f75f381e31d\userland\metal\tests\compute_test.cpp =====
L493: s2.packet(CP_EVENT_WRITE, ev, 4);
  pm4::Stream s2;
  uint32_t ev[4] = {eventWrite0(RB_DONE_TS, true), uint32_t(word2), uint32_t(word2 >> 32), 1};
  uint32_t w2[6] = {waitRegMem0(WRITE_EQ, POLL_MEMORY), uint32_t(word2), uint32_t(word2 >> 32), 1, ~0u, kDelayLoopCycles};
  s2.packet(CP_WAIT_REG_MEM, w2, 6);
L500: TEST(an_event_with_the_timestamp_bit_writes_a_timestamp_not_the_value) {
  }
  
  // the hang of 28 October: the dispatch's end waited for a value the event never wrote, because the TIMESTAMP bit
  // makes the GPU write a timestamp there instead. The fake does the same now, so that tail fails here.
L501: // the hang of 28 October: the dispatch's end waited for a value the event never wrote, because the TIMESTAMP bit
  
  TEST(an_event_with_the_timestamp_bit_writes_a_timestamp_not_the_value) {
  // makes the GPU write a timestamp there instead. The fake does the same now, so that tail fails here.
  Rig r;
L502: // makes the GPU write a timestamp there instead. The fake does the same now, so that tail fails here.
  TEST(an_event_with_the_timestamp_bit_writes_a_timestamp_not_the_value) {
  // the hang of 28 October: the dispatch's end waited for a value the event never wrote, because the TIMESTAMP bit
  Rig r;
  auto out = buffer(r, 4096, 0);
L506: bit.tailTimestampBit = true;
  auto out = buffer(r, 4096, 0);
  compute::Options bit;
  auto cb = r.queue->commandBuffer();
  CHECK(cb->dispatch(kernels::end_only, kGroups16, nullptr, std::vector<Binding>{}, nullptr, bit));
L1177: if (h.kind == pm4::Header::kCommand && h.opcode == a6xx::CP_EVENT_WRITE && h.count >= 1 && (w[i + 1] & 0x7f) == a6xx::LABEL) {
  for (size_t i = 0; i < w.size();) {
  pm4::Header h = pm4::decode(w[i]);
  (i < exec ? *before : *after) += 1;
  }

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\IOS_APOLLO_GPU_REFERENCE-1f75f381e31d\userland\metal\tests\render_test.cpp =====
L225: // the first CP_EVENT_WRITE of EVENT: its header index, or -1
  return count;
  }
  size_t findEvent(uint32_t event) const {
  const auto& w = stream.words();
L230: if (h.kind == pm4::Header::kCommand && h.opcode == a6xx::CP_EVENT_WRITE && h.count >= 1 &&
  for (size_t i = 0; i < w.size();) {
  pm4::Header h = pm4::decode(w[i]);
  (w[i + 1] & a6xx::CP_EVENT_WRITE_0_EVENT__MASK) == event) {
  return i;
L231: (w[i + 1] & a6xx::CP_EVENT_WRITE_0_EVENT__MASK) == event) {
  pm4::Header h = pm4::decode(w[i]);
  if (h.kind == pm4::Header::kCommand && h.opcode == a6xx::CP_EVENT_WRITE && h.count >= 1 &&
  return i;
  }
L629: // the table: the timestamps zeroed, the border colour entry zeroed, the hole zeroed; the rest untouched
  if (!e.ok) std::printf("       %s\n", e.error.c_str());
  using namespace a6xx;
  const uint32_t* tw = e.tableWords();
  for (uint32_t i = 0; i < render::kTableZeroedBytes / 4; i++) CHECK_EQ(tw[render::kTableTimestampsAt / 4 + i], 0u);   // the tail's, the depth ones, the Clears'
L631: for (uint32_t i = 0; i < render::kTableZeroedBytes / 4; i++) CHECK_EQ(tw[render::kTableTimestampsAt / 4 + i], 0u);   // the tail's, the depth ones, the Clears'
  // the table: the timestamps zeroed, the border colour entry zeroed, the hole zeroed; the rest untouched
  const uint32_t* tw = e.tableWords();
  for (uint32_t i = 0; i < 32; i++) CHECK_EQ(tw[render::kTableBorderColorAt / 4 + i], 0u);
  CHECK_EQ(tw[render::kTableZeroedBytes / 4], 0xeeeeeeeeu);
L868: // the tail after it: a WFI, the CCU colour flush writing 1 to the table (no TIMESTAMP bit) and its wait, LRZ_FLUSH,
  CHECK_EQ(w[dr + 2], 1u);
  CHECK_EQ(w[dr + 3], 3u);
  // the cache flush writing 2 and its wait; no RB_DONE_TS
  CHECK(pm4::decode(w[dr + 4]).opcode == pm4::kWaitForIdle);
L875: CHECK_EQ(w[ccu + 2], uint32_t(e.table->gpuAddress() + render::kTableTimestampsAt));
  CHECK_EQ(pm4::decode(w[ccu]).count, 4u);
  CHECK_EQ(w[ccu + 1], uint32_t(PC_CCU_FLUSH_COLOR_TS));
  CHECK_EQ(w[ccu + 4], 1u);
  size_t wait = e.find(CP_WAIT_REG_MEM, ccu);
L885: if (h.kind == pm4::Header::kCommand && h.opcode == CP_EVENT_WRITE && (w[i + 1] & CP_EVENT_WRITE_0_EVENT__MASK) == LRZ_FLUSH) next = i;
  for (size_t i = lrz + 1 + pm4::decode(w[lrz]).count; i < w.size() && next == size_t(-1);) {
  pm4::Header h = pm4::decode(w[i]);
  i += 1 + h.count;
  }
L891: size_t cache = e.findEvent(CACHE_FLUSH_TS);
  }
  CHECK(lrz != size_t(-1) && lrz > wait);   // the tail's LRZ_FLUSH, beside the begin's
  CHECK(cache > lrz);
  CHECK_EQ(w[cache + 2], uint32_t(e.table->gpuAddress() + render::kTableTimestampsAt + 4));
L893: CHECK_EQ(w[cache + 2], uint32_t(e.table->gpuAddress() + render::kTableTimestampsAt + 4));
  size_t cache = e.findEvent(CACHE_FLUSH_TS);
  CHECK(cache > lrz);
  CHECK_EQ(w[cache + 4], 2u);
  CHECK_EQ(e.find(CP_WAIT_MEM_GTE, cache), cache + 5);
L1094: CHECK(e.findEvent(CACHE_FLUSH_TS) != size_t(-1));
  CHECK_EQ(e.findEvent(PC_CCU_FLUSH_COLOR_TS), size_t(-1));
  CHECK_EQ(e.find(CP_WAIT_REG_MEM), size_t(-1));
  }
  {
L1103: after = after || (h.kind == pm4::Header::kCommand && h.opcode == CP_EVENT_WRITE && (e.stream.words()[i + 1] & CP_EVENT_WRITE_0_EVENT__MASK) == LRZ_FLUSH);
  for (size_t i = dr; i < e.stream.size();) {
  pm4::Header h = pm4::decode(e.stream.words()[i]);
  i += 1 + h.count;
  }
L1110: CHECK_EQ(e.findEvent(CACHE_FLUSH_TS), size_t(-1));
  {
  Encoded e = with([](render::Options& o) { o.tailCacheFlush = false; });
  CHECK_EQ(e.find(CP_WAIT_MEM_GTE), size_t(-1));
  }
L1117: CHECK_EQ(e.stream.words()[rb + 2], uint32_t(e.table->gpuAddress() + render::kTableTimestampsAt + 8));
  size_t rb = e.findEvent(RB_DONE_TS);
  CHECK(rb != size_t(-1));
  CHECK_EQ(e.stream.words()[rb + 4], 3u);
  CHECK(e.findEvent(PC_CCU_FLUSH_COLOR_TS) < rb && rb < e.findEvent(CACHE_FLUSH_TS));
L1119: CHECK(e.findEvent(PC_CCU_FLUSH_COLOR_TS) < rb && rb < e.findEvent(CACHE_FLUSH_TS));
  CHECK_EQ(e.stream.words()[rb + 2], uint32_t(e.table->gpuAddress() + render::kTableTimestampsAt + 8));
  CHECK_EQ(e.stream.words()[rb + 4], 3u);
  }
  {
L1122: Encoded e = with([](render::Options& o) { o.tailTimestampBit = true; });
  }
  {
  size_t ccu = e.findEvent(PC_CCU_FLUSH_COLOR_TS);
  CHECK((e.stream.words()[ccu + 1] & CP_EVENT_WRITE_0_TIMESTAMP) != 0);
L1124: CHECK((e.stream.words()[ccu + 1] & CP_EVENT_WRITE_0_TIMESTAMP) != 0);
  Encoded e = with([](render::Options& o) { o.tailTimestampBit = true; });
  size_t ccu = e.findEvent(PC_CCU_FLUSH_COLOR_TS);
  CHECK((whole.stream.words()[whole.findEvent(PC_CCU_FLUSH_COLOR_TS) + 1] & CP_EVENT_WRITE_0_TIMESTAMP) == 0);
  }
L1125: CHECK((whole.stream.words()[whole.findEvent(PC_CCU_FLUSH_COLOR_TS) + 1] & CP_EVENT_WRITE_0_TIMESTAMP) == 0);
  size_t ccu = e.findEvent(PC_CCU_FLUSH_COLOR_TS);
  CHECK((e.stream.words()[ccu + 1] & CP_EVENT_WRITE_0_TIMESTAMP) != 0);
  }
  // the draw's own knobs: a half viewport, a scissor, a vertex start, a strip, a 48x20 target
L1874: CHECK(has(w.fault(), "the colour may stay in the cache: no CACHE_FLUSH_TS (4-word) after the draw"));
  o.tailCacheFlush = false;
  Twin w(o);
  CHECK(w.r.fake->stats().lastDraw.ccuFlushed && !w.r.fake->stats().lastDraw.cacheFlushed);
  }
L1881: w.words[ccu] = pm4::type7(CP_EVENT_WRITE, 1);
  Twin w;
  size_t ccu = w.e.findEvent(PC_CCU_FLUSH_COLOR_TS);
  w.words.erase(w.words.begin() + ccu + 2, w.words.begin() + ccu + 5);
  CHECK(has(w.fault(), "would wait forever"));   // the wait that followed reads a word nothing wrote
L1887: o.tailTimestampBit = true;   // the 28 October form: a timestamp where the wait expects 1
  {
  render::Options o;
  Twin w(o);
  CHECK(has(w.fault(), "CP_WAIT_REG_MEM would wait forever"));
L4323: n += h.kind == pm4::Header::kCommand && h.opcode == CP_EVENT_WRITE && (st.words()[i + 1] & CP_EVENT_WRITE_0_EVENT__MASK) == CACHE_INVALIDATE;
  for (size_t i = 0; i + 1 < st.words().size();) {
  const pm4::Header h = pm4::decode(st.words()[i]);
  i += 1 + h.count;
  }
L4359: for (size_t i = e.find(CP_EVENT_WRITE); i != size_t(-1); i = e.find(CP_EVENT_WRITE, i + 1)) {
  // the flush on the draw's word, waited for, and the invalidate, all before the draw packet
  size_t flush = size_t(-1);
  if ((e.stream.words()[i + 1] & CP_EVENT_WRITE_0_EVENT__MASK) == PC_CCU_FLUSH_COLOR_TS &&
  e.stream.words()[i + 2] == uint32_t(e.table->gpuAddress() + render::kTableFbReadFlushAt)) {
L4360: if ((e.stream.words()[i + 1] & CP_EVENT_WRITE_0_EVENT__MASK) == PC_CCU_FLUSH_COLOR_TS &&
  size_t flush = size_t(-1);
  for (size_t i = e.find(CP_EVENT_WRITE); i != size_t(-1); i = e.find(CP_EVENT_WRITE, i + 1)) {
  e.stream.words()[i + 2] == uint32_t(e.table->gpuAddress() + render::kTableFbReadFlushAt)) {
  flush = i;
L4369: for (size_t i = e.find(CP_EVENT_WRITE, flush == size_t(-1) ? 0 : flush); i != size_t(-1); i = e.find(CP_EVENT_WRITE, i + 1)) {
  CHECK(flush != size_t(-1) && flush < draw);
  size_t inval = size_t(-1);
  if ((e.stream.words()[i + 1] & CP_EVENT_WRITE_0_EVENT__MASK) == CACHE_INVALIDATE) {
  inval = i;
L4370: if ((e.stream.words()[i + 1] & CP_EVENT_WRITE_0_EVENT__MASK) == CACHE_INVALIDATE) {
  size_t inval = size_t(-1);
  for (size_t i = e.find(CP_EVENT_WRITE, flush == size_t(-1) ? 0 : flush); i != size_t(-1); i = e.find(CP_EVENT_WRITE, i + 1)) {
  inval = i;
  break;
L4379: for (size_t i = plain.find(CP_EVENT_WRITE); i != size_t(-1); i = plain.find(CP_EVENT_WRITE, i + 1)) {
  Encoded plain(r, flatProgram(), pass, wholeDraw(6));
  bool plainFlush = false;
  plainFlush |= plain.stream.words()[i + 2] == uint32_t(plain.table->gpuAddress() + render::kTableFbReadFlushAt);
  }

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\IOS_APOLLO_GPU_REFERENCE-1f75f381e31d\userland\metal\tools\probe.cpp =====
L386: // --notail: no end-of-dispatch events and waits of our own; the kernel's own CACHE_FLUSH_TS fence closes the
  bisect = bisect || strcmp(argv[i], "--bisect") == 0;
  binTrace = binTrace || strcmp(argv[i], "--bin-trace") == 0;
  // submission (28 October: with them every dispatch hung, without them end_only completed in 48 us)
  if (strcmp(argv[i], "--notail") == 0) chosen.tail = false;
L5264: const double sysUs = timed(false), gmUs = timed(true);
  return best;
  };
  char text[240];
  snprintf(text, sizeof text, "GMEM cost: 8 full-screen blended draws %.0f us in sysmem, %.0f us in GMEM (%.2fx)", sysUs, gmUs,
L5266: snprintf(text, sizeof text, "GMEM cost: 8 full-screen blended draws %.0f us in sysmem, %.0f us in GMEM (%.2fx)", sysUs, gmUs,
  const double sysUs = timed(false), gmUs = timed(true);
  char text[240];
  gmUs > 0 ? sysUs / gmUs : 0.0);
  report(sysUs > 0 && gmUs > 0, text);
L5267: gmUs > 0 ? sysUs / gmUs : 0.0);
  char text[240];
  snprintf(text, sizeof text, "GMEM cost: 8 full-screen blended draws %.0f us in sysmem, %.0f us in GMEM (%.2fx)", sysUs, gmUs,
  report(sysUs > 0 && gmUs > 0, text);
  }
L5268: report(sysUs > 0 && gmUs > 0, text);
  snprintf(text, sizeof text, "GMEM cost: 8 full-screen blended draws %.0f us in sysmem, %.0f us in GMEM (%.2fx)", sysUs, gmUs,
  gmUs > 0 ? sysUs / gmUs : 0.0);
  }
  }
L6158: // group it lacks is what writes the colour. tailTimestampBit is not among them: that hang is measured (28 October).
  // draw hangs or writes nothing, this says which group it needs, one boot for all of it, each hang costing a reset. A
  // variant that completes AND paints the 2016 pixels is the finding; one that completes and paints nothing says the
  if (bisect && t) {
  struct Variant {
L6195: without("without CACHE_FLUSH_TS and its wait", [](render::Options& o) { o.tailCacheFlush = false; });
  without("without the CCU colour flush and its wait", [](render::Options& o) { o.tailCcuFlush = false; });
  without("without the tail's LRZ_FLUSH", [](render::Options& o) { o.tailLrzFlush = false; });
  without("with RB_DONE_TS and its wait (compute's tail)", [](render::Options& o) { o.tailRbDone = true; });
  for (const Variant& v : variants) {
L6478: without("without the end (RB_DONE_TS, CACHE_FLUSH_TS and their waits)", [](compute::Options& o) { o.tail = false; });
  };
  // 28 October, first round: every variant with the end hung, both without it completed. So the end it is; now its parts.
  without("with the end, the TIMESTAMP bit off (computerator's form)", [](compute::Options& o) { o.tailTimestampBit = false; });
  without("with only RB_DONE_TS and its wait", [](compute::Options& o) { o.tailCacheFlush = false; });
L6479: without("with the end, the TIMESTAMP bit off (computerator's form)", [](compute::Options& o) { o.tailTimestampBit = false; });
  // 28 October, first round: every variant with the end hung, both without it completed. So the end it is; now its parts.
  without("without the end (RB_DONE_TS, CACHE_FLUSH_TS and their waits)", [](compute::Options& o) { o.tail = false; });
  without("with only RB_DONE_TS and its wait", [](compute::Options& o) { o.tailCacheFlush = false; });
  without("with only CACHE_FLUSH_TS and its wait", [](compute::Options& o) { o.tailRbDone = false; });
L6481: without("with only CACHE_FLUSH_TS and its wait", [](compute::Options& o) { o.tailRbDone = false; });
  without("with the end, the TIMESTAMP bit off (computerator's form)", [](compute::Options& o) { o.tailTimestampBit = false; });
  without("with only RB_DONE_TS and its wait", [](compute::Options& o) { o.tailCacheFlush = false; });
  without("with only CACHE_FLUSH_TS and its wait, TIMESTAMP bit off", [](compute::Options& o) {
  o.tailRbDone = false;
L6482: without("with only CACHE_FLUSH_TS and its wait, TIMESTAMP bit off", [](compute::Options& o) {
  without("with only RB_DONE_TS and its wait", [](compute::Options& o) { o.tailCacheFlush = false; });
  without("with only CACHE_FLUSH_TS and its wait", [](compute::Options& o) { o.tailRbDone = false; });
  o.tailRbDone = false;
  o.tailTimestampBit = false;
L6484: o.tailTimestampBit = false;
  without("with only CACHE_FLUSH_TS and its wait, TIMESTAMP bit off", [](compute::Options& o) {
  o.tailRbDone = false;
  });
  without("with only RB_DONE_TS and its wait, TIMESTAMP bit off", [](compute::Options& o) {
L6486: without("with only RB_DONE_TS and its wait, TIMESTAMP bit off", [](compute::Options& o) {
  o.tailTimestampBit = false;
  });
  o.tailCacheFlush = false;
  o.tailTimestampBit = false;
L6488: o.tailTimestampBit = false;
  without("with only RB_DONE_TS and its wait, TIMESTAMP bit off", [](compute::Options& o) {
  o.tailCacheFlush = false;
  });
  variants.push_back(Variant{"with none of those: the registers, the loads, NDRANGE, CP_EXEC_CS, CP_WAIT_FOR_IDLE", minimal});

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\IOS_APOLLO_GPU_REFERENCE-1f75f381e31d\userland\metal2\metal2\HotMetal2.mm =====
L114: - (id)newPipelineLibraryWithFilePath:(NSString *)path error:(NSError **)error
  @end
  @implementation NBDeviceMethods (HotMetal2)
  {
  (void)path;

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\IOS_APOLLO_GPU_REFERENCE-1f75f381e31d\userland\metal2\metal2\NativeBridgeMetalFrontend.mm =====
L2283: - (id<MTLLibrary>)newLibraryWithFile:(NSString *)path error:(NSError **)error {
  NBLibrary *library=[NBLibrary new];library.handle=handle;[library computeLibraryHash:bytes length:size];if(error)*error=nil;return (id<MTLLibrary>)library;
  }
  NSData *bytes=path?[NSData dataWithContentsOfFile:path options:NSDataReadingMappedIfSafe error:error]:nil;if(!bytes)return nil;
  const uint64_t libraryBegan=nowUs();
L2292: return [(id<MTLDevice>)self newLibraryWithFile:url.path error:error];
  - (id<MTLLibrary>)newLibraryWithURL:(NSURL *)url error:(NSError **)error {
  if(!url.isFileURL){if(error)*error=nbError(@"a file URL is required");return nil;}
  }
  - (id<MTLLibrary>)newDefaultLibraryWithBundle:(NSBundle *)bundle error:(NSError **)error {

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\IOS_APOLLO_GPU_REFERENCE-1f75f381e31d\userland\metal2\turnip\NativeAdrenoABI.h =====
L23: NativeAdrenoMethodGetTimestamp = 7,
  NativeAdrenoMethodSubmit = 5,
  NativeAdrenoMethodWaitFence = 6,
  NativeAdrenoMethodGetStatus = 8,
  NativeAdrenoMethodSetMetadata = 9,
L95: uint64_t fence;               /* nonzero CP timestamp value */
  };
  struct NativeAdrenoAbiSubmitReply {
  };
  struct NativeAdrenoAbiWaitFence {
L101: struct NativeAdrenoAbiTimestamp {
  uint64_t timeout_ns;          /* 0 polls once */
  };
  uint64_t ticks;               /* GPU always-on counter value */
  };
L162: static_assert(sizeof(NativeAdrenoAbiTimestamp) == 8, "ABI timestamp layout");
  static_assert(sizeof(NativeAdrenoAbiMetadata) == 80, "ABI metadata layout");
  static_assert(sizeof(NativeAdrenoAbiWaitFence) == 16, "ABI wait layout");
  static_assert(sizeof(NativeAdrenoAbiStatus) == 16, "ABI status layout");
  #endif

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\IOS_APOLLO_GPU_REFERENCE-1f75f381e31d\userland\metal2\turnip\v2test.cpp =====
L158: NativeAdrenoAbiTimestamp ts;
  NativeAdrenoAbiStatus st;
  call(NativeAdrenoMethodGetStatus, NULL, 0, &st, sizeof(st));
  call(NativeAdrenoMethodGetTimestamp, NULL, 0, &ts, sizeof(ts));
  printf("faults %llu, timestamp %llu\n", (unsigned long long)st.faults, (unsigned long long)ts.ticks);
L159: call(NativeAdrenoMethodGetTimestamp, NULL, 0, &ts, sizeof(ts));
  call(NativeAdrenoMethodGetStatus, NULL, 0, &st, sizeof(st));
  NativeAdrenoAbiTimestamp ts;
  printf("faults %llu, timestamp %llu\n", (unsigned long long)st.faults, (unsigned long long)ts.ticks);
  printf("%s: %d failed\n", fails ? "FAIL" : "ALL PASS", fails);
L160: printf("faults %llu, timestamp %llu\n", (unsigned long long)st.faults, (unsigned long long)ts.ticks);
  NativeAdrenoAbiTimestamp ts;
  call(NativeAdrenoMethodGetTimestamp, NULL, 0, &ts, sizeof(ts));
  printf("%s: %d failed\n", fails ? "FAIL" : "ALL PASS", fails);
  return fails != 0;

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\IOS_APOLLO_GPU_REFERENCE-1f75f381e31d\wifi\lx\include\linux\remoteproc.h =====
L2: * Remote processors: here the one that runs the radio's firmware. Starting and stopping it is
  /*
  * the kernel's business (lx_os_rproc_boot()); the driver only asks.
  */

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\IOS_APOLLO_GPU_REFERENCE-1f75f381e31d\wifi\lx\include\linux\soc\qcom\qmi.h =====
L2: * QMI, the protocol in which the driver talks to the radio's firmware before the radio's own
  /*
  * registers exist. The helpers are the kernel's (bsd/sys/hakios.qmi.h, bsd/dev/hakios.qmi.c),
  * under Linux's names; a kernel tree that does not have them yet gets LinuxKPI's header, in
L16: * request: the mode the firmware is asked for. The radio's registers answer in mission mode only.
  /*
  * What the driver sends goes past the radio's bus first (src/lx_bus.c), which has to know of one
  */
  int lx_qmi_send_request(struct qmi_handle *qmi, struct sockaddr_qrtr *sq, struct qmi_txn *txn, int msg_id, size_t largest,

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\IOS_APOLLO_GPU_REFERENCE-1f75f381e31d\wifi\lx\src\lx_80211.c =====
L14: * (the firmware puts them into 802.11 and ciphers them: the driver's "frame mode" Ethernet).
  * (open system), associated with, the keys agreed in the four-way handshake (lx_wpa.c) and
  * given to the driver --, after which Ethernet frames pass between the kernel and the driver
  *
  * What is not: more than one network, roaming, power saving, 40 MHz and wider channels, HE,
L246: * disabled. The driver reads the result off the channels when it tells the firmware which it
  * What cfg80211 does with a domain (Linux: net/wireless/reg.c, handle_channel()): a channel
  * may be used if a rule covers its 20 MHz, and takes the rule's limits; otherwise it is
  * may use (reg.c: ath11k_reg_update_chan_list()), and so does the scan below.
  */
L300: * The driver's domain for its radio (which it has from the firmware). It keeps its own copy and
  
  /*
  * may free it. The driver calls this from work of its own, one call at a time, and may be
  * waiting for that work to end while it holds the radio's lock: so that lock is not taken here.
L303: * A domain that comes when the radio is no longer registered is not applied (the firmware sends
  * may free it. The driver calls this from work of its own, one call at a time, and may be
  * waiting for that work to end while it holds the radio's lock: so that lock is not taken here.
  * one whenever the country changes, also while the driver is on its way down).
  */
L444: * with, to see whether that announces RSN: it then tells the firmware to let nothing but the
  /*
  * What a scan has learnt of an access point. The driver asks this of the one it is associating
  * handshake through until the keys are set (mac.c: ath11k_peer_assoc_h_crypto()).
  */
L516: /* (the driver's recovery after its firmware has died, which nothing here goes through) */
  }
  
  void
  linuxkpi_ieee80211_restart_hw(struct ieee80211_hw *hw)
L727: /* An Ethernet frame, through the driver's data path: the firmware makes 802.11 of it, and ciphers it once there is a key. */
  }
  
  static bool
  ethernet_send(struct lx_radio *radio, const uint8_t *frame, unsigned length)
L748: * kinds over in 802.11 although the firmware had them as Ethernet -- the handshake's, and what
  /*
  * An 802.11 data frame made into the Ethernet frame it carries, in place: the driver hands two
  * was sent to everybody and deciphered (dp_rx.c: ath11k_dp_rx_h_undecap()). The header is 24
  * bytes, more with a fourth address, the QoS field, the HT field and, if the driver left it
L936: lx_tell("lx: THE RADIO HAS NO ADDRESS (the kernel was given none, and the firmware has none): no interface is made\n");
  }
  if (is_zero_ether_addr(hw->wiphy->perm_addr)) {
  return (EADDRNOTAVAIL);
  }
L950: /* the firmware is to take Ethernet frames and to give them, if the driver offers that (its frame mode) */
  vif->bss_conf.bssid = no_network;	/* (the driver compares every beacon's sender with it) */
  vif->link_conf[0] = &vif->bss_conf;
  if (ieee80211_hw_check(hw, SUPPORTS_TX_ENCAP_OFFLOAD)) {
  vif->offload_flags |= IEEE80211_OFFLOAD_ENCAP_ENABLED;
L964: printf("lx: an interface in station mode is added to it: %d (Ethernet frames %s the firmware, %s it)\n", ret,
  radio->started = true;
  ret = radio->ops->add_interface(hw, vif);
  vif->offload_flags & IEEE80211_OFFLOAD_ENCAP_ENABLED ? "to" : "NOT to", vif->offload_flags &
  IEEE80211_OFFLOAD_DECAP_ENABLED ? "from" : "NOT from");
L1096: * ampdu_action, which sets up the firmware's reorder queue for the class), then the answer, ADDBA
  * The access point's requests to send us frames in aggregates (A-MPDU) for a traffic class, and to
  * stop doing so, as mac80211 handles them (net/mac80211/agg-rx.c): the driver told (its
  * response, with the window size the driver can take. Without this every frame goes on its own
  * and the link carries about a third of what it could. On the driver's work queue: the driver's
L1203: * firmware about the peer (mac.c: ath11k_peer_assoc_prepare()): rates, the HT and VHT
  /*
  * What the access point says it can do, into the form the driver reads it in when it tells the
  * capabilities, WMM. `elements` are the association response's, or the beacon's before that.
  */
L1399: /* A key for the driver to give the firmware: CCMP, for frames between us and the access point or for the group's. */
  }
  
  static struct ieee80211_key_conf *
  key_set(struct lx_radio *radio, const uint8_t *key, unsigned index, bool pairwise, int *error)
L1750: /* the access point as a station of the driver's: the firmware learns of it, and the radio goes to its channel */
  }
  
  radio->sta = (struct ieee80211_sta *)roundup2((uintptr_t)radio->sta_memory, 64);
  memcpy(radio->sta->addr, target->address, ETH_ALEN);

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\IOS_APOLLO_GPU_REFERENCE-1f75f381e31d\wifi\lx\src\lx_base.c =====
L4: * writes, socket buffers, firmware files. The headers that declare all this are FreeBSD's
  * What the driver's files ask of a Linux kernel around them, as far as the files built so far
  * ask it: locks, sleeping and waking, work queues, timers, memory, memory the radio reads and
  * LinuxKPI; FreeBSD's own implementations stand on FreeBSD's kernel and are not used. These
  * stand on the few calls of lx_os.h, which the XNU side gives (bsd/dev/hakios.lx.c), and are
L30: #include <linux/firmware.h>
  #include <linux/dma-mapping.h>
  #include <linux/dmi.h>
  #include <linux/idr.h>
  #include <linux/io.h>
L758: * reaches memory through the SoC's SMMU, which lets it see what it has been shown and nothing
  /*
  * Memory the radio itself reads and writes: its rings, and the buffers it fills. The radio
  * else; so all such memory comes out of one piece, taken once, which the kernel's side shows
  * the radio and says the radio's address of (lx_os_radio_memory()). That piece is not behind
L766: #define POOL_RINGS	(24u << 20) /* UMI also allocates WLAN firmware DDR, CAL, and M3 here. */
  */
  #define POOL_SIZE	(64u << 20)
  #define POOL_SLOT	4096u
  #define POOL_SLOTS	((POOL_SIZE - POOL_RINGS) / POOL_SLOT)
L933: /* ---- firmware files ---------------------------------------------------------------------------- */
  }
  
  
  int
L936: linuxkpi_firmware_request_nowarn(const struct linuxkpi_firmware **out, const char *name, struct device *dev)
  
  int
  {
  struct linuxkpi_firmware *fw;
L938: struct linuxkpi_firmware *fw;
  linuxkpi_firmware_request_nowarn(const struct linuxkpi_firmware **out, const char *name, struct device *dev)
  {
  const void *data = NULL;
  unsigned long size = 0;
L941: int error = lx_os_firmware(name, &data, &size);
  const void *data = NULL;
  unsigned long size = 0;
  
  printf("lx: the driver asks for the file \"%s\": %s\n", name, error == 0 ? "there" : "not there");
L958: linuxkpi_release_firmware(const struct linuxkpi_firmware *fw)
  
  void
  {
  lkpi_kfree(fw);
L966: * Numbered things (Linux's "idr": the driver numbers the frames it has handed to the firmware
  
  /*
  * and finds them again by number). Here a table that grows, hung where FreeBSD's keeps its tree.
  */

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\IOS_APOLLO_GPU_REFERENCE-1f75f381e31d\wifi\lx\src\lx_bus.c =====
L11: * Its kernel transport supplies fixed firmware memory and retains CAL across reset.
  * UMI selects QCA6390 on PCIe, uses the serialized dynamic BAR window and
  * its stock CE/DP MSI offsets, and restarts MHI after cold-boot calibration.
  *
  * Where this stage ends: qmi.c has its exchange with the firmware, core.c starts the firmware
L13: * Where this stage ends: qmi.c has its exchange with the firmware, core.c starts the firmware
  * Its kernel transport supplies fixed firmware memory and retains CAL across reset.
  *
  * in mission mode and has ce.c and hal.c set up the copy engines' rings, htc.c connects its
  * services over them and wmi.c has the firmware say what the radio is ("service ready") and,
L15: * services over them and wmi.c has the firmware say what the radio is ("service ready") and,
  * Where this stage ends: qmi.c has its exchange with the firmware, core.c starts the firmware
  * in mission mode and has ce.c and hal.c set up the copy engines' rings, htc.c connects its
  * given the driver's configuration, that it is ready for commands ("unified ready"); mac.c
  * registers the radio with what stands in for mac80211 (lx_80211.c) and sets the data path's
L18: * rings up. What the firmware said is then put in the log. With the boot-arg wifi_scan=1 the
  * given the driver's configuration, that it is ready for commands ("unified ready"); mac.c
  * registers the radio with what stands in for mac80211 (lx_80211.c) and sets the data path's
  * station of lx_80211.c has the radio scan, and the driver is taken down again the way its own
  * removal does it (ath11k_core_deinit()); with wifi_join=1 the station joins the network the
L55: bool mission;				/* the firmware has been asked for mission mode, and for no other since */
  bool umi;
  struct mutex window_lock;
  bool closed;				/* the driver has stopped the bus: the registers are not touched again */
  unsigned reads, writes, said, refused;
L164: * the firmware names are the chip's first 512K; the second 512K show its data path's
  /*
  * As ahb.c reaches them (ath11k_ahb_get_window_start_wcn6750()): the first 512K of the block
  * registers, the third its copy engines'.
  */
L189: * The registers answer while the firmware is in mission mode and at no other time: an access
  
  /*
  * outside it ends the kernel (bsd/dev/hakios.wifi.c, step 16). The driver asks for that mode
  * before it first touches them; once it has stopped the bus, on its way to asking for the mode
L206: "after the bus was stopped" : "while the firmware is not in mission mode");
  if (bus.refused++ < 8) {
  lx_tell("lx: the chip's %#x is reached for %s: NOT DONE\n", offset, !known ? "which no window shows" : bus.closed ?
  }
  return (true);
L359: * says that after its last word to the firmware over a copy engine and before it asks for the
  * The copy engines are looked at no more, and no register is touched from here on. This is what
  * the driver's "interrupts off" comes to here, and it comes in time: on its way down the driver
  * mode "off".
  */
L380: * A request of the driver's to the firmware, on its way out (linux/soc/qcom/qmi.h, ours). One
  
  /*
  * matters here: the mode. With any mode but mission the radio's registers stop answering, and
  * the driver does not always let go of the copy engines first -- where its start fails late,
L398: if (lx_os_radio_firmware_memory(response.mem_seg[i].type, response.mem_seg[i].size,
  void *memory;
  unsigned long long address;
  &memory, &address)) return -EINVAL;
  response.mem_seg[i].addr = address;
L412: if (!wlfw->m3_mem.vaddr || lx_os_radio_firmware_memory(3, m3.size, &memory, &address)) return -EINVAL;
  void *memory;
  unsigned long long address;
  if (memory != wlfw->m3_mem.vaddr) memcpy(memory, wlfw->m3_mem.vaddr, m3.size);
  __asm __volatile("dsb osh" ::: "memory");
L437: if (mode != ATH11K_FIRMWARE_MODE_NORMAL && bus.looking) {
  u32 mode = ((const struct qmi_wlanfw_wlan_mode_req_msg_v01 *)structure)->mode;
  
  printf("lx: the driver asks for mode %u while the copy engines are still looked at: they are let go of first\n",
  mode);
L441: if (mode != ATH11K_FIRMWARE_MODE_NORMAL) {
  mode);
  }
  bus_quiet();
  }
L444: bus.mission = mode == ATH11K_FIRMWARE_MODE_NORMAL;
  bus_quiet();
  }
  lx_tell("lx: the firmware is asked for mode %u (0: mission, 4: off, 7: calibration)\n", mode);
  }
L445: lx_tell("lx: the firmware is asked for mode %u (0: mission, 4: off, 7: calibration)\n", mode);
  }
  bus.mission = mode == ATH11K_FIRMWARE_MODE_NORMAL;
  }
  return (qmi_send_request(qmi, sq, txn, msg_id, largest, ei, structure));
L579: "registers so far; the configuration the firmware was sent named %u shadow registers)\n", bus.reads, bus.writes,
  set_bit(ATH11K_FLAG_DEVICE_INIT_DONE, &ab->dev_flags);
  printf("lx: the driver starts the bus: buffers for the copy engines that receive (%u reads and %u writes of the chip's "
  ab->qmi.ce_cfg.shadow_reg_v2_len);
  ath11k_ce_rx_post_buf(ab);
L585: * (here and not when the driver is set up: the firmware is asked for calibration in between, and
  lx_tell("lx: the rings are set up and the copy engines have their buffers: the bus is started\n");
  /*
  * the copy engines are let go of for that, interrupts and all; see lx_qmi_send_request())
  */
L729: * firmware says (mac.c: ath11k_mac_register()); this radio's firmware says none. The kernel has
  /*
  * The radio's own address, which the driver asks its device for before it falls back on what the
  * it, if it was given one. Nothing here says the address.
  */
L738: /* ---- what the firmware has said of the radio ------------------------------------------------------- */
  }
  
  
  /* After "unified ready": what wmi.c has kept of the firmware's two announcements. */
L740: /* After "unified ready": what wmi.c has kept of the firmware's two announcements. */
  /* ---- what the firmware has said of the radio ------------------------------------------------------- */
  
  static void
  say_radio(struct ath11k_base *ab)
L746: printf("lx: THE FIRMWARE SAYS OF THE RADIO: %u radio(s); %u chains (mask %#x); up to %u channels in a scan, %u MACs; "
  const struct ath11k_targ_cap *t = &ab->target_caps;
  
  "transmit power %d..%d; phy %#x, HT %#x, VHT %#x (MCS %#x), system %#x\n", ab->num_radios, t->num_rf_chains,
  t->txrx_chainmask, t->max_num_scan_channels, t->max_supported_macs, (int)t->hw_min_tx_power, (int)t->hw_max_tx_power,
L751: printf("lx: its address, by the firmware: %02x:%02x:%02x:%02x:%02x:%02x (and its check sum of the packet log's "
  t->phy_capability, t->ht_cap_info, t->vht_cap_info, t->vht_supp_mcs, t->sys_cap_info);
  /* (the second number is from the same structure of "ready" as the address: it shows that was read) */
  "definitions: %#x)\n", ab->mac_addr[0], ab->mac_addr[1], ab->mac_addr[2], ab->mac_addr[3], ab->mac_addr[4],
  ab->mac_addr[5], ab->pktlog_defs_checksum);
L806: * The driver's parameter "frame_mode": Ethernet. The firmware then puts frames into 802.11
  }
  /*
  * and takes them out of it, and ciphers them: what passes between the driver and the layer
  * above is what goes over a cable.
L854: ab->fw_mode = ATH11K_FIRMWARE_MODE_NORMAL;
  }
  ab->hw_rev = bus.umi ? ATH11K_HW_QCA6390_HW20 : ATH11K_HW_WCN6750_HW10;
  ret = ath11k_core_pre_init(ab);
  if (!ret && bus.umi) {
L862: lx_tell("lx: the driver does not get as far as its exchange with the firmware: %d\n", ret);
  }
  if (ret || (ret = ath11k_hal_srng_init(ab)) != 0 || (ret = ath11k_ce_alloc_pipes(ab)) != 0) {
  return (-ret);
  }
L870: printf("lx: the driver (\"%s\") is set up; its exchange with the firmware begins (registers: %s)\n", ab->hw_params.name,
  ab->qmi.ce_cfg.svc_to_ce_map = ab->hw_params.svc_to_ce_map;
  ab->qmi.service_ins_id = ab->hw_params.qmi_service_ins_id;
  bus.how >= 2 ? "for real" : "NOT TOUCHED, wifi_lx=1");
  if ((ret = ath11k_core_init(ab)) != 0) {
L893: up ? "IS UP as far as it is built: the firmware has said \"unified ready\"" : test_bit(ATH11K_FLAG_REGISTERED,
  up = test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags) && bus.looks;
  lx_tell("lx: %llu ms after its start the driver %s; its flags: %#lx\n", (lx_os_nanoseconds() - began) / 1000000ull,
  &ab->dev_flags) ? "HAS GIVEN UP on the way and wound itself down" : "HAS NOT GOT THROUGH its exchange with the firmware",
  ab->dev_flags);
L894: &ab->dev_flags) ? "HAS GIVEN UP on the way and wound itself down" : "HAS NOT GOT THROUGH its exchange with the firmware",
  lx_tell("lx: %llu ms after its start the driver %s; its flags: %#lx\n", (lx_os_nanoseconds() - began) / 1000000ull,
  up ? "IS UP as far as it is built: the firmware has said \"unified ready\"" : test_bit(ATH11K_FLAG_REGISTERED,
  ab->dev_flags);
  if (!up) {
L901: lx_pause_ms(1000);			/* (for what the firmware says unasked once it is ready) */
  return (test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags) ? ETIMEDOUT : EIO);
  }
  say_radio(ab);
  

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\IOS_SAILFISH_GPU_REFERENCE-6f27e41ff249\shim\shim.c =====
L119: static void irq_handler(void)
  /* ---- exceptions ---- */
  
  {
  uint64_t iar = rsr("icc_iar1_el1");
L142: irq_handler();
  {
  if (slot == 5) {	/* IRQ from current EL, SPx */
  return;
  }

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\IOS_SAILFISH_GPU_REFERENCE-6f27e41ff249\tools\sweetgl\sweet_drm.c =====
L195: case MSM_PARAM_TIMESTAMP:
  p->value = max_freq;
  return 0;
  /* the generic timer and RBBM_ALWAYSON both count XO (19.2 MHz) */
  p->value = mach_absolute_time();

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\IOS_SWEET_BASE-45263bee51df\shim\shim.c =====
L119: static void irq_handler(void)
  /* ---- exceptions ---- */
  
  {
  uint64_t iar = rsr("icc_iar1_el1");
L142: irq_handler();
  {
  if (slot == 5) {	/* IRQ from current EL, SPx */
  return;
  }

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\drivers\DarwinBoot\DarwinBootPkg\Driver\DarwinBoot.c =====
L508: Print (L"DARWINBOOT: unsupported inputs or exception level; firmware retained\n");
  if ((Request->KextCount != 0) || (Request->DeviceTree != NULL) || (Request->DeviceTreeSize != 0) ||
  (DarwinCurrentEl () != 4)) {
  return EFI_UNSUPPORTED;
  }
L629: // The same facts in large type over the whole screen. The firmware's log
  
  //
  // draws far larger than the text console, and the form feed clears the
  // screen first. This is what stays visible if the kernel never draws.
L672: Print (L"DARWINBOOT: boot refused: %r; firmware retained\n", Status);
  if (Map != NULL) { FreePool (Map); }
  if (Address != 0) { gBS->FreePages (Address, EFI_SIZE_TO_PAGES (WindowSize)); }
  return Status;
  }

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoFirmware.c =====
L2: #include "AdrenoFirmware.h"
  /* SPDX-License-Identifier: BSD-2-Clause-Patent */
  
  static uint32_t le32(const uint8_t *p)
L10: AdrenoFirmwareResult AdrenoFirmwarePlanGmu(
  }
  
  const uint8_t *firmware, size_t bytes,
  const AdrenoFirmwareRegion *regions, size_t region_count,
L11: const uint8_t *firmware, size_t bytes,
  
  AdrenoFirmwareResult AdrenoFirmwarePlanGmu(
  const AdrenoFirmwareRegion *regions, size_t region_count,
  AdrenoFirmwareBlock *blocks, size_t capacity, size_t *count)
L12: const AdrenoFirmwareRegion *regions, size_t region_count,
  AdrenoFirmwareResult AdrenoFirmwarePlanGmu(
  const uint8_t *firmware, size_t bytes,
  AdrenoFirmwareBlock *blocks, size_t capacity, size_t *count)
  {
L13: AdrenoFirmwareBlock *blocks, size_t capacity, size_t *count)
  const uint8_t *firmware, size_t bytes,
  const AdrenoFirmwareRegion *regions, size_t region_count,
  {
  if (!count) return AdrenoFirmwareInvalid;
L15: if (!count) return AdrenoFirmwareInvalid;
  AdrenoFirmwareBlock *blocks, size_t capacity, size_t *count)
  {
  *count = 0;
  if (!firmware || !regions || !blocks || !region_count || region_count > 64)
L17: if (!firmware || !regions || !blocks || !region_count || region_count > 64)
  if (!count) return AdrenoFirmwareInvalid;
  *count = 0;
  return AdrenoFirmwareInvalid;
  if (bytes < 16) return AdrenoFirmwareTruncated;
L18: return AdrenoFirmwareInvalid;
  *count = 0;
  if (!firmware || !regions || !blocks || !region_count || region_count > 64)
  if (bytes < 16) return AdrenoFirmwareTruncated;
  for (size_t i = 0; i < region_count; ++i) {
L19: if (bytes < 16) return AdrenoFirmwareTruncated;
  if (!firmware || !regions || !blocks || !region_count || region_count > 64)
  return AdrenoFirmwareInvalid;
  for (size_t i = 0; i < region_count; ++i) {
  const AdrenoFirmwareRegion *a = regions + i;
L21: const AdrenoFirmwareRegion *a = regions + i;
  if (bytes < 16) return AdrenoFirmwareTruncated;
  for (size_t i = 0; i < region_count; ++i) {
  if (!a->bytes || (a->address & 3) || (a->bytes & 3) ||
  a->bytes > UINT64_C(0x100000000) - a->address || a->identifier == UINT32_MAX)
L24: return AdrenoFirmwareInvalid;
  if (!a->bytes || (a->address & 3) || (a->bytes & 3) ||
  a->bytes > UINT64_C(0x100000000) - a->address || a->identifier == UINT32_MAX)
  for (size_t j = 0; j < i; ++j) {
  const AdrenoFirmwareRegion *b = regions + j;
L26: const AdrenoFirmwareRegion *b = regions + j;
  return AdrenoFirmwareInvalid;
  for (size_t j = 0; j < i; ++j) {
  if (a->identifier == b->identifier ||
  ((uint64_t)a->address < (uint64_t)b->address + b->bytes &&
L30: return AdrenoFirmwareInvalid;
  ((uint64_t)a->address < (uint64_t)b->address + b->bytes &&
  (uint64_t)b->address < (uint64_t)a->address + a->bytes))
  }
  }
L36: if (bytes - offset < 16) return AdrenoFirmwareTruncated;
  size_t offset = 0, n = 0;
  while (offset < bytes) {
  uint32_t address = le32(firmware + offset);
  uint32_t length = le32(firmware + offset + 4);
L37: uint32_t address = le32(firmware + offset);
  while (offset < bytes) {
  if (bytes - offset < 16) return AdrenoFirmwareTruncated;
  uint32_t length = le32(firmware + offset + 4);
  uint32_t identifier = UINT32_MAX;
L38: uint32_t length = le32(firmware + offset + 4);
  if (bytes - offset < 16) return AdrenoFirmwareTruncated;
  uint32_t address = le32(firmware + offset);
  uint32_t identifier = UINT32_MAX;
  if (length > bytes - offset - 16) return AdrenoFirmwareTruncated;
L40: if (length > bytes - offset - 16) return AdrenoFirmwareTruncated;
  uint32_t length = le32(firmware + offset + 4);
  uint32_t identifier = UINT32_MAX;
  if (length) {
  if ((address & 3) || (length & 3) ||
L44: return AdrenoFirmwareInvalid;
  if ((address & 3) || (length & 3) ||
  length > UINT64_C(0x100000000) - address)
  for (size_t i = 0; i < region_count; ++i) {
  if (address >= regions[i].address && length <= regions[i].bytes &&
L52: if (identifier == UINT32_MAX) return AdrenoFirmwareUnmapped;
  }
  }
  }
  if (n == capacity) return AdrenoFirmwareNoSpace;
L54: if (n == capacity) return AdrenoFirmwareNoSpace;
  if (identifier == UINT32_MAX) return AdrenoFirmwareUnmapped;
  }
  if (pass) {
  blocks[n].address = address;
L58: blocks[n].type = le32(firmware + offset + 8);
  blocks[n].address = address;
  blocks[n].bytes = length;
  blocks[n].value = le32(firmware + offset + 12);
  blocks[n].payload_offset = offset + 16;
L59: blocks[n].value = le32(firmware + offset + 12);
  blocks[n].bytes = length;
  blocks[n].type = le32(firmware + offset + 8);
  blocks[n].payload_offset = offset + 16;
  blocks[n].region_identifier = identifier;
L68: return AdrenoFirmwareSuccess;
  if (pass) *count = n;
  }
  }

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoFirmware.h =====
L2: #ifndef ADRENO_FIRMWARE_H
  /* SPDX-License-Identifier: BSD-2-Clause-Patent */
  #define ADRENO_FIRMWARE_H
  #include <stddef.h>
L3: #define ADRENO_FIRMWARE_H
  /* SPDX-License-Identifier: BSD-2-Clause-Patent */
  #ifndef ADRENO_FIRMWARE_H
  #include <stddef.h>
  #include <stdint.h>
L11: } AdrenoFirmwareRegion;
  uint64_t bytes;
  uint32_t identifier;
  
  typedef struct {
L17: } AdrenoFirmwareBlock;
  size_t payload_offset;
  uint32_t region_identifier;
  
  typedef enum {
L20: AdrenoFirmwareSuccess,
  
  typedef enum {
  AdrenoFirmwareInvalid,
  AdrenoFirmwareTruncated,
L21: AdrenoFirmwareInvalid,
  typedef enum {
  AdrenoFirmwareSuccess,
  AdrenoFirmwareTruncated,
  AdrenoFirmwareUnmapped,
L22: AdrenoFirmwareTruncated,
  AdrenoFirmwareSuccess,
  AdrenoFirmwareInvalid,
  AdrenoFirmwareUnmapped,
  AdrenoFirmwareNoSpace
L23: AdrenoFirmwareUnmapped,
  AdrenoFirmwareInvalid,
  AdrenoFirmwareTruncated,
  AdrenoFirmwareNoSpace
  } AdrenoFirmwareResult;
L24: AdrenoFirmwareNoSpace
  AdrenoFirmwareTruncated,
  AdrenoFirmwareUnmapped,
  } AdrenoFirmwareResult;
  
L25: } AdrenoFirmwareResult;
  AdrenoFirmwareUnmapped,
  AdrenoFirmwareNoSpace
  
  /* No output entries are changed on failure; *count is then zero.
L29: * Success validates structure/ranges, not firmware authenticity or execution.
  /* No output entries are changed on failure; *count is then zero.
  * Zero-size metadata stays opaque, with region_identifier UINT32_MAX.
  */
  #ifdef __cplusplus
L34: AdrenoFirmwareResult AdrenoFirmwarePlanGmu(
  extern "C" {
  #endif
  const uint8_t *firmware, size_t bytes,
  const AdrenoFirmwareRegion *regions, size_t region_count,
L35: const uint8_t *firmware, size_t bytes,
  #endif
  AdrenoFirmwareResult AdrenoFirmwarePlanGmu(
  const AdrenoFirmwareRegion *regions, size_t region_count,
  AdrenoFirmwareBlock *blocks, size_t capacity, size_t *count);
L36: const AdrenoFirmwareRegion *regions, size_t region_count,
  AdrenoFirmwareResult AdrenoFirmwarePlanGmu(
  const uint8_t *firmware, size_t bytes,
  AdrenoFirmwareBlock *blocks, size_t capacity, size_t *count);
  #ifdef __cplusplus
L37: AdrenoFirmwareBlock *blocks, size_t capacity, size_t *count);
  const uint8_t *firmware, size_t bytes,
  const AdrenoFirmwareRegion *regions, size_t region_count,
  #ifdef __cplusplus
  }

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfi.c =====
L2: /* HFI wire facts from the source pinned by the umbrella. No Linux runtime. */
  /* SPDX-License-Identifier: BSD-2-Clause-Patent */
  #include "AdrenoHfi.h"
  #if !defined(__aarch64__) || __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__
L3: #include "AdrenoHfi.h"
  /* SPDX-License-Identifier: BSD-2-Clause-Patent */
  /* HFI wire facts from the source pinned by the umbrella. No Linux runtime. */
  #if !defined(__aarch64__) || __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__
  #error GMU HFI transport requires little-endian AArch64
L5: #error GMU HFI transport requires little-endian AArch64
  #include "AdrenoHfi.h"
  #if !defined(__aarch64__) || __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__
  #endif
  #define WORDS 1024u
L11: static AdrenoHfiStatus poison(AdrenoHfi *h,AdrenoHfiStatus status)
  static void publish(void){__asm__ volatile("dsb oshst":::"memory");}
  static void complete(void){__asm__ volatile("dmb osh":::"memory");}
  {h->poisoned=1;return status;}
  static AdrenoHfiStatus valid(AdrenoHfi *h,unsigned q,volatile uint32_t **header,
L13: static AdrenoHfiStatus valid(AdrenoHfi *h,unsigned q,volatile uint32_t **header,
  static AdrenoHfiStatus poison(AdrenoHfi *h,AdrenoHfiStatus status)
  {h->poisoned=1;return status;}
  volatile uint32_t **data,uint32_t *read,uint32_t *write)
  {
L17: ((uintptr_t)h->shared&4095))return AdrenoHfiInvalid;
  {
  if(!h || !h->shared || !h->notify || !h->iova || (h->iova&4095) ||
  if(h->poisoned)return AdrenoHfiPoisoned;
  volatile uint32_t *m=h->shared;acquire();
L18: if(h->poisoned)return AdrenoHfiPoisoned;
  if(!h || !h->shared || !h->notify || !h->iova || (h->iova&4095) ||
  ((uintptr_t)h->shared&4095))return AdrenoHfiInvalid;
  volatile uint32_t *m=h->shared;acquire();
  if(h->legacy>1 || q>1)return poison(h,AdrenoHfiCorrupt);
L20: if(h->legacy>1 || q>1)return poison(h,AdrenoHfiCorrupt);
  if(h->poisoned)return AdrenoHfiPoisoned;
  volatile uint32_t *m=h->shared;acquire();
  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)
L23: 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)
  volatile uint32_t *v=m+6+12*q;
  const unsigned queue_id=(h->legacy && q==1)?4:q;
L27: v[3]!=WORDS || v[4]!=0)return poison(h,AdrenoHfiCorrupt);
  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) ||
  *read=v[10];*write=v[11];acquire();
  if(*read>=WORDS || *write>=WORDS || (!h->legacy && ((*read&3) || (*write&3))))return poison(h,AdrenoHfiCorrupt);
L29: if(*read>=WORDS || *write>=WORDS || (!h->legacy && ((*read&3) || (*write&3))))return poison(h,AdrenoHfiCorrupt);
  v[3]!=WORDS || v[4]!=0)return poison(h,AdrenoHfiCorrupt);
  *read=v[10];*write=v[11];acquire();
  *header=v;*data=m+(q+1)*WORDS;return AdrenoHfiSuccess;
  }
L30: *header=v;*data=m+(q+1)*WORDS;return AdrenoHfiSuccess;
  *read=v[10];*write=v[11];acquire();
  if(*read>=WORDS || *write>=WORDS || (!h->legacy && ((*read&3) || (*write&3))))return poison(h,AdrenoHfiCorrupt);
  }
  static AdrenoHfiStatus initialize(AdrenoHfi *h,volatile uint32_t *shared,
L32: static AdrenoHfiStatus initialize(AdrenoHfi *h,volatile uint32_t *shared,
  *header=v;*data=m+(q+1)*WORDS;return AdrenoHfiSuccess;
  }
  size_t bytes,uint64_t iova,void *cookie,int (*notify)(void *),unsigned legacy)
  {
L37: return AdrenoHfiInvalid;
  if(!h || !shared || !notify || bytes!=16384 || ((uintptr_t)shared&4095) ||
  (uintptr_t)shared>UINTPTR_MAX-16383 || !iova || (iova&4095) || iova>UINT32_MAX-16383)
  for(unsigned i=0;i<4096;++i)shared[i]=0;
  const unsigned queues=legacy?2:3;
L48: *h=(AdrenoHfi){shared,(uint32_t)iova,0,0,0,cookie,notify,0,0,0,0,legacy};
  }
  publish();
  return AdrenoHfiSuccess;
  }
L49: return AdrenoHfiSuccess;
  publish();
  *h=(AdrenoHfi){shared,(uint32_t)iova,0,0,0,cookie,notify,0,0,0,0,legacy};
  }
  AdrenoHfiStatus AdrenoHfiInitializeStopped(AdrenoHfi *h,volatile uint32_t *shared,
L51: AdrenoHfiStatus AdrenoHfiInitializeStopped(AdrenoHfi *h,volatile uint32_t *shared,
  return AdrenoHfiSuccess;
  }
  size_t bytes,uint64_t iova,void *cookie,int (*notify)(void *))
  {return initialize(h,shared,bytes,iova,cookie,notify,0);}
L54: 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,0);}
  size_t bytes,uint64_t iova,void *cookie,int (*notify)(void *))
  {return initialize(h,shared,bytes,iova,cookie,notify,1);}
L57: AdrenoHfiStatus AdrenoHfiSend(AdrenoHfi *h,unsigned id,const uint32_t *payload,
  size_t bytes,uint64_t iova,void *cookie,int (*notify)(void *))
  {return initialize(h,shared,bytes,iova,cookie,notify,1);}
  size_t words,uint32_t *wire_header)
  {
L60: if(!wire_header || id>255 || words>254 || (words && !payload))return AdrenoHfiInvalid;
  size_t words,uint32_t *wire_header)
  {
  volatile uint32_t *v,*data;uint32_t read,write;
  AdrenoHfiStatus status=valid(h,0,&v,&data,&read,&write);
L62: AdrenoHfiStatus status=valid(h,0,&v,&data,&read,&write);
  if(!wire_header || id>255 || words>254 || (words && !payload))return AdrenoHfiInvalid;
  volatile uint32_t *v,*data;uint32_t read,write;
  if(status!=AdrenoHfiSuccess)return status;
  if(h->pending_header)return AdrenoHfiBusy;
L63: if(status!=AdrenoHfiSuccess)return status;
  volatile uint32_t *v,*data;uint32_t read,write;
  AdrenoHfiStatus status=valid(h,0,&v,&data,&read,&write);
  if(h->pending_header)return AdrenoHfiBusy;
  unsigned count=(unsigned)words+1,padded=h->legacy?count:(count+3)&~3u;
L64: if(h->pending_header)return AdrenoHfiBusy;
  AdrenoHfiStatus status=valid(h,0,&v,&data,&read,&write);
  if(status!=AdrenoHfiSuccess)return status;
  unsigned count=(unsigned)words+1,padded=h->legacy?count:(count+3)&~3u;
  if(((read-write-1)&(WORDS-1))<padded)return AdrenoHfiNoSpace;
L66: if(((read-write-1)&(WORDS-1))<padded)return AdrenoHfiNoSpace;
  if(h->pending_header)return AdrenoHfiBusy;
  unsigned count=(unsigned)words+1,padded=h->legacy?count:(count+3)&~3u;
  uint32_t sequence=(h->sequence+1)%4095;
  uint32_t header=(sequence<<20)|(count<<8)|id;
L74: if(h->notify(h->cookie))return poison(h,AdrenoHfiNotifyError);
  publish();v[11]=(write+padded)&(WORDS-1);publish();
  h->pending_header=header;h->sequence=sequence;*wire_header=header;
  return AdrenoHfiSuccess;
  }
L75: return AdrenoHfiSuccess;
  h->pending_header=header;h->sequence=sequence;*wire_header=header;
  if(h->notify(h->cookie))return poison(h,AdrenoHfiNotifyError);
  }
  AdrenoHfiStatus AdrenoHfiPoll(AdrenoHfi *h,uint32_t *payload,size_t capacity,
L77: AdrenoHfiStatus AdrenoHfiPoll(AdrenoHfi *h,uint32_t *payload,size_t capacity,
  return AdrenoHfiSuccess;
  }
  size_t *payload_words,uint32_t *error)
  {
L80: if(!payload || capacity<16 || !payload_words || !error)return AdrenoHfiInvalid;
  size_t *payload_words,uint32_t *error)
  {
  *payload_words=0;*error=0;
  volatile uint32_t *v,*data;uint32_t read,write;
L83: AdrenoHfiStatus status=valid(h,1,&v,&data,&read,&write);
  *payload_words=0;*error=0;
  volatile uint32_t *v,*data;uint32_t read,write;
  if(status!=AdrenoHfiSuccess)return status;
  if(!h->pending_header)return AdrenoHfiInvalid;
L84: if(status!=AdrenoHfiSuccess)return status;
  volatile uint32_t *v,*data;uint32_t read,write;
  AdrenoHfiStatus status=valid(h,1,&v,&data,&read,&write);
  if(!h->pending_header)return AdrenoHfiInvalid;
  /* Legacy skipped packets have at least two words; modern packets occupy

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfi.h =====
L2: #ifndef ADRENO_HFI_H
  /* SPDX-License-Identifier: BSD-2-Clause-Patent */
  #define ADRENO_HFI_H
  #include <stddef.h>
L3: #define ADRENO_HFI_H
  /* SPDX-License-Identifier: BSD-2-Clause-Patent */
  #ifndef ADRENO_HFI_H
  #include <stddef.h>
  #include <stdint.h>
L10: AdrenoHfiSuccess,AdrenoHfiInvalid,AdrenoHfiBusy,AdrenoHfiNoSpace,
  #endif
  typedef enum {
  AdrenoHfiEmpty,AdrenoHfiCorrupt,AdrenoHfiUnexpected,AdrenoHfiFirmwareError,
  AdrenoHfiNotifyError,AdrenoHfiWaitError,AdrenoHfiTimeout,AdrenoHfiPoisoned
L11: AdrenoHfiEmpty,AdrenoHfiCorrupt,AdrenoHfiUnexpected,AdrenoHfiFirmwareError,
  typedef enum {
  AdrenoHfiSuccess,AdrenoHfiInvalid,AdrenoHfiBusy,AdrenoHfiNoSpace,
  AdrenoHfiNotifyError,AdrenoHfiWaitError,AdrenoHfiTimeout,AdrenoHfiPoisoned
  } AdrenoHfiStatus;
L12: AdrenoHfiNotifyError,AdrenoHfiWaitError,AdrenoHfiTimeout,AdrenoHfiPoisoned
  AdrenoHfiSuccess,AdrenoHfiInvalid,AdrenoHfiBusy,AdrenoHfiNoSpace,
  AdrenoHfiEmpty,AdrenoHfiCorrupt,AdrenoHfiUnexpected,AdrenoHfiFirmwareError,
  } AdrenoHfiStatus;
  typedef struct {
L13: } AdrenoHfiStatus;
  AdrenoHfiEmpty,AdrenoHfiCorrupt,AdrenoHfiUnexpected,AdrenoHfiFirmwareError,
  AdrenoHfiNotifyError,AdrenoHfiWaitError,AdrenoHfiTimeout,AdrenoHfiPoisoned
  typedef struct {
  volatile uint32_t *shared;
L18: int (*notify)(void *); /* real HOST2GMU interrupt write, 0=success */
  uint32_t iova,sequence,pending_header,poisoned;
  void *cookie;
  /* 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. */
L19: /* Diagnostics of skipped response packets (a6xx_hfi_wait_for_ack skips firmware error messages and replies to
  void *cookie;
  int (*notify)(void *); /* real HOST2GMU interrupt write, 0=success */
  * another sequence number): their count and the first one's header, return header and code. */
  uint32_t skipped,skipped_header,skipped_ret,skipped_code;
L23: } AdrenoHfi;
  uint32_t skipped,skipped_header,skipped_ret,skipped_code;
  uint32_t legacy; /* set only by the stopped initializer; immutable thereafter */
  /* Caller owns an exclusive, 16KiB extent
  * mapped with four native4K pages, coherent for CPU and GMU, and a valid 32bit
L25: * mapped with four native4K pages, coherent for CPU and GMU, and a valid 32bit
  } AdrenoHfi;
  /* Caller owns an exclusive, 16KiB extent
  * GMU IOVA. Coherence, ownership and active mappings are platform obligations,
  * not established by this API. The GMU MUST be stopped and unable to access
L26: * GMU IOVA. Coherence, ownership and active mappings are platform obligations,
  /* Caller owns an exclusive, 16KiB extent
  * mapped with four native4K pages, coherent for CPU and GMU, and a valid 32bit
  * 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.
L27: * not established by this API. The GMU MUST be stopped and unable to access
  * mapped with four native4K pages, coherent for CPU and GMU, and a valid 32bit
  * GMU IOVA. Coherence, ownership and active mappings are platform obligations,
  * this extent during initialization. No reset of a running queue is allowed.
  * AArch64 little-endian; real outer-shareable barriers, no fake ACKs.
L34: AdrenoHfiStatus AdrenoHfiInitializeStopped(AdrenoHfi *,volatile uint32_t *,
  * Never free/reuse shared storage until an external real stop+TLB drain is
  * proved. Poison/timeout/notify failure do not establish safe release. */
  size_t shared_bytes,uint64_t iova,void *cookie,int (*notify)(void *));
  /* A618/a630_gmu.bin legacy profile: two queues, response type 0xa04,
L36: /* A618/a630_gmu.bin legacy profile: two queues, response type 0xa04,
  AdrenoHfiStatus AdrenoHfiInitializeStopped(AdrenoHfi *,volatile uint32_t *,
  size_t shared_bytes,uint64_t iova,void *cookie,int (*notify)(void *));
  * byte-size 120 table, word-granular ring indexes, no four-word padding.
  * The same stopped/coherent/exclusive storage requirements apply. This
L39: * initializes wire data only: it never powers, releases or resets a GMU. */
  * byte-size 120 table, word-granular ring indexes, no four-word padding.
  * The same stopped/coherent/exclusive storage requirements apply. This
  AdrenoHfiStatus AdrenoHfiInitializeLegacyStopped(AdrenoHfi *,volatile uint32_t *,
  size_t shared_bytes,uint64_t iova,void *cookie,int (*notify)(void *));
L40: AdrenoHfiStatus AdrenoHfiInitializeLegacyStopped(AdrenoHfi *,volatile uint32_t *,
  * The same stopped/coherent/exclusive storage requirements apply. This
  * initializes wire data only: it never powers, releases or resets a GMU. */
  size_t shared_bytes,uint64_t iova,void *cookie,int (*notify)(void *));
  /* payload excludes the wire header. One command may be outstanding. A failed
L44: * NoSpace/Busy refuse before publishing. No firmware readiness is inferred. */
  /* payload excludes the wire header. One command may be outstanding. A failed
  * notify after publishing is indeterminate: poisons the session, no retry.
  AdrenoHfiStatus AdrenoHfiSend(AdrenoHfi *,unsigned id,const uint32_t *payload,
  size_t payload_words,uint32_t *wire_header);
L45: AdrenoHfiStatus AdrenoHfiSend(AdrenoHfi *,unsigned id,const uint32_t *payload,
  * notify after publishing is indeterminate: poisons the session, no retry.
  * NoSpace/Busy refuse before publishing. No firmware readiness is inferred. */
  size_t payload_words,uint32_t *wire_header);
  /* Poll the response queue. As a6xx_hfi_wait_for_ack: the reply whose return
L47: /* Poll the response queue. As a6xx_hfi_wait_for_ack: the reply whose return
  AdrenoHfiStatus AdrenoHfiSend(AdrenoHfi *,unsigned id,const uint32_t *payload,
  size_t payload_words,uint32_t *wire_header);
  * header carries the pending command's sequence number completes it (error=0
  * succeeds, otherwise FirmwareError); F2H error messages and replies to other
L49: * succeeds, otherwise FirmwareError); F2H error messages and replies to other
  /* 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
  * sequence numbers are consumed, counted and skipped. payload_words reports
  * actual returned words; output remains untouched on failure. Capacity must be
L55: AdrenoHfiStatus AdrenoHfiPoll(AdrenoHfi *,uint32_t *payload,size_t capacity,
  * Malformed queues or packets poison the session; no success or queue reset is
  * synthesized. Debug queue not drained. */
  size_t *payload_words,uint32_t *firmware_error);
  /* Serialized command + bounded response polling. Poll budget limits software
L56: size_t *payload_words,uint32_t *firmware_error);
  * synthesized. Debug queue not drained. */
  AdrenoHfiStatus AdrenoHfiPoll(AdrenoHfi *,uint32_t *payload,size_t capacity,
  /* Serialized command + bounded response polling. Poll budget limits software
  * iterations, not hardware elapsed microseconds. Optional wait callback must
L60: * This transport alone performs no power/firmware/performance-table startup. */
  * iterations, not hardware elapsed microseconds. Optional wait callback must
  * return promptly; an error poisons the session. Timeout also poisons it.
  AdrenoHfiStatus AdrenoHfiExchange(AdrenoHfi *,unsigned id,const uint32_t *,size_t,
  unsigned poll_budget,int (*wait_once)(void *),uint32_t *,size_t,
L61: AdrenoHfiStatus AdrenoHfiExchange(AdrenoHfi *,unsigned id,const uint32_t *,size_t,
  * return promptly; an error poisons the session. Timeout also poisons it.
  * This transport alone performs no power/firmware/performance-table startup. */
  unsigned poll_budget,int (*wait_once)(void *),uint32_t *,size_t,
  size_t *,uint32_t *firmware_error);
L63: size_t *,uint32_t *firmware_error);
  AdrenoHfiStatus AdrenoHfiExchange(AdrenoHfi *,unsigned id,const uint32_t *,size_t,
  unsigned poll_budget,int (*wait_once)(void *),uint32_t *,size_t,
  #ifdef __cplusplus
  }

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.c =====
L2: /* Independent serialization from the pinned modern HFI wire contract. */
  /* SPDX-License-Identifier: BSD-2-Clause-Patent */
  #include "AdrenoHfiStartup.h"
  static int zero(const uint32_t *v,size_t n)
L3: #include "AdrenoHfiStartup.h"
  /* SPDX-License-Identifier: BSD-2-Clause-Patent */
  /* Independent serialization from the pinned modern HFI wire contract. */
  static int zero(const uint32_t *v,size_t n)
  {for(size_t i=0;i<n;++i)if(v[i])return 0;return 1;}
L6: static int levels(const AdrenoHfiPerformanceLevel *v,unsigned n,unsigned max)
  static int zero(const uint32_t *v,size_t n)
  {for(size_t i=0;i<n;++i)if(v[i])return 0;return 1;}
  {
  if(n<2 || n>max || v[0].hz)return 0;
L23: AdrenoHfiStartupStatus AdrenoHfiStartupValidate(const AdrenoHfiStartupConfig *c)
  return zero(v+n,max-n);
  }
  {
  if(!c || !levels(c->gpu,c->gpu_count,16) || !levels(c->gmu,c->gmu_count,4) ||
L25: if(!c || !levels(c->gpu,c->gpu_count,16) || !levels(c->gmu,c->gmu_count,4) ||
  AdrenoHfiStartupStatus AdrenoHfiStartupValidate(const AdrenoHfiStartupConfig *c)
  {
  !c->bandwidth_count || c->bandwidth_count>16 || c->enable_ifpc>1 ||
  !addresses(c->cnoc_addresses,c->cnoc_count,6) ||
L28: !addresses(c->ddr_addresses,c->ddr_count,8))return AdrenoHfiStartupInvalid;
  !c->bandwidth_count || c->bandwidth_count>16 || c->enable_ifpc>1 ||
  !addresses(c->cnoc_addresses,c->cnoc_count,6) ||
  if(c->cnoc_wait_mask>>c->cnoc_count || c->ddr_wait_mask>>c->ddr_count)return AdrenoHfiStartupInvalid;
  for(unsigned i=0;i<c->cnoc_count;++i)
L29: if(c->cnoc_wait_mask>>c->cnoc_count || c->ddr_wait_mask>>c->ddr_count)return AdrenoHfiStartupInvalid;
  !addresses(c->cnoc_addresses,c->cnoc_count,6) ||
  !addresses(c->ddr_addresses,c->ddr_count,8))return AdrenoHfiStartupInvalid;
  for(unsigned i=0;i<c->cnoc_count;++i)
  for(unsigned j=0;j<c->ddr_count;++j)if(c->cnoc_addresses[i]==c->ddr_addresses[j])return AdrenoHfiStartupInvalid;
L31: for(unsigned j=0;j<c->ddr_count;++j)if(c->cnoc_addresses[i]==c->ddr_addresses[j])return AdrenoHfiStartupInvalid;
  if(c->cnoc_wait_mask>>c->cnoc_count || c->ddr_wait_mask>>c->ddr_count)return AdrenoHfiStartupInvalid;
  for(unsigned i=0;i<c->cnoc_count;++i)
  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)
L32: 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<c->cnoc_count;++i)
  for(unsigned j=0;j<c->ddr_count;++j)if(c->cnoc_addresses[i]==c->ddr_addresses[j])return AdrenoHfiStartupInvalid;
  for(unsigned i=0;i<16;++i)
  if(!zero(c->ddr_data[i]+(i<c->bandwidth_count?c->ddr_count:0),
L35: 8-(i<c->bandwidth_count?c->ddr_count:0)))return AdrenoHfiStartupInvalid;
  for(unsigned i=0;i<16;++i)
  if(!zero(c->ddr_data[i]+(i<c->bandwidth_count?c->ddr_count:0),
  if(!c->acd_enable_mask) {
  if(c->acd_version || c->acd_stride || c->acd_count || !zero(c->acd_data,32))return AdrenoHfiStartupInvalid;
L37: if(c->acd_version || c->acd_stride || c->acd_count || !zero(c->acd_data,32))return AdrenoHfiStartupInvalid;
  8-(i<c->bandwidth_count?c->ddr_count:0)))return AdrenoHfiStartupInvalid;
  if(!c->acd_enable_mask) {
  } else {
  if(c->acd_version!=1 || c->acd_stride!=1 || (c->acd_enable_mask&1) ||
L40: c->acd_enable_mask>>c->gpu_count)return AdrenoHfiStartupInvalid;
  } else {
  if(c->acd_version!=1 || c->acd_stride!=1 || (c->acd_enable_mask&1) ||
  unsigned count=0;
  for(uint32_t bits=c->acd_enable_mask;bits;bits>>=1)count+=bits&1;
L43: if(c->acd_count!=count || !zero(c->acd_data+count,32-count))return AdrenoHfiStartupInvalid;
  unsigned count=0;
  for(uint32_t bits=c->acd_enable_mask;bits;bits>>=1)count+=bits&1;
  }
  return AdrenoHfiStartupSuccess;
L45: return AdrenoHfiStartupSuccess;
  if(c->acd_count!=count || !zero(c->acd_data+count,32-count))return AdrenoHfiStartupInvalid;
  }
  }
  AdrenoHfiStartupStatus AdrenoHfiStartupEncode(const AdrenoHfiStartupConfig *c,
L47: AdrenoHfiStartupStatus AdrenoHfiStartupEncode(const AdrenoHfiStartupConfig *c,
  return AdrenoHfiStartupSuccess;
  }
  AdrenoHfiStartupStage stage,uint32_t *id,uint32_t *p,size_t capacity,size_t *count)
  {
L48: AdrenoHfiStartupStage stage,uint32_t *id,uint32_t *p,size_t capacity,size_t *count)
  }
  AdrenoHfiStartupStatus AdrenoHfiStartupEncode(const AdrenoHfiStartupConfig *c,
  {
  if(!count)return AdrenoHfiStartupInvalid;
L50: if(!count)return AdrenoHfiStartupInvalid;
  AdrenoHfiStartupStage stage,uint32_t *id,uint32_t *p,size_t capacity,size_t *count)
  {
  *count=0;
  if(!id || !p || capacity<159 || AdrenoHfiStartupValidate(c)!=AdrenoHfiStartupSuccess ||
L52: if(!id || !p || capacity<159 || AdrenoHfiStartupValidate(c)!=AdrenoHfiStartupSuccess ||
  if(!count)return AdrenoHfiStartupInvalid;
  *count=0;
  stage<AdrenoHfiStagePerformance || stage>AdrenoHfiStageStart ||
  ((stage==AdrenoHfiStageAcdEnable || stage==AdrenoHfiStageAcdTable) && !c->acd_enable_mask) ||
L53: stage<AdrenoHfiStagePerformance || stage>AdrenoHfiStageStart ||
  *count=0;
  if(!id || !p || capacity<159 || AdrenoHfiStartupValidate(c)!=AdrenoHfiStartupSuccess ||
  ((stage==AdrenoHfiStageAcdEnable || stage==AdrenoHfiStageAcdTable) && !c->acd_enable_mask) ||
  (stage==AdrenoHfiStageIfpc && !c->enable_ifpc))return AdrenoHfiStartupInvalid;
L54: ((stage==AdrenoHfiStageAcdEnable || stage==AdrenoHfiStageAcdTable) && !c->acd_enable_mask) ||
  if(!id || !p || capacity<159 || AdrenoHfiStartupValidate(c)!=AdrenoHfiStartupSuccess ||
  stage<AdrenoHfiStagePerformance || stage>AdrenoHfiStageStart ||
  (stage==AdrenoHfiStageIfpc && !c->enable_ifpc))return AdrenoHfiStartupInvalid;
  size_t n=0;unsigned message=0;
L55: (stage==AdrenoHfiStageIfpc && !c->enable_ifpc))return AdrenoHfiStartupInvalid;
  stage<AdrenoHfiStagePerformance || stage>AdrenoHfiStageStart ||
  ((stage==AdrenoHfiStageAcdEnable || stage==AdrenoHfiStageAcdTable) && !c->acd_enable_mask) ||
  size_t n=0;unsigned message=0;
  switch(stage) {
L58: case AdrenoHfiStagePerformance:
  size_t n=0;unsigned message=0;
  switch(stage) {
  message=4;n=58;
  for(size_t i=0;i<n;++i)p[i]=0;
L61: p[0]=c->gpu_count;p[1]=c->gmu_count;
  message=4;n=58;
  for(size_t i=0;i<n;++i)p[i]=0;
  for(unsigned i=0;i<c->gpu_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);
L65: for(unsigned i=0;i<c->gmu_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);
  }
  p[50+2*i]=c->gmu[i].vote;p[51+2*i]=(uint32_t)(c->gmu[i].hz/1000);
  }
L66: p[50+2*i]=c->gmu[i].vote;p[51+2*i]=(uint32_t)(c->gmu[i].hz/1000);
  }
  for(unsigned i=0;i<c->gmu_count;++i) {
  }
  break;
L69: case AdrenoHfiStageBandwidth:
  }
  break;
  message=3;n=159;
  p[0]=c->bandwidth_count;p[1]=c->cnoc_count;p[2]=c->ddr_count;
L78: case AdrenoHfiStageAcdEnable:message=11;n=3;p[0]=12;p[1]=1;p[2]=0;break;
  for(unsigned i=0;i<128;++i)p[31+i]=c->ddr_data[i/8][i%8];
  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;
L79: case AdrenoHfiStageAcdTable:
  break;
  case AdrenoHfiStageAcdEnable:message=11;n=3;p[0]=12;p[1]=1;p[2]=0;break;
  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];
L83: case AdrenoHfiStageIfpc:message=11;n=3;p[0]=9;p[1]=1;p[2]=0x1680;break;
  for(unsigned i=0;i<32;++i)p[4+i]=c->acd_data[i];
  break;
  case AdrenoHfiStageCoreStart:message=14;n=1;p[0]=0;break;
  case AdrenoHfiStageStart:message=10;n=0;break;
L84: case AdrenoHfiStageCoreStart:message=14;n=1;p[0]=0;break;
  break;
  case AdrenoHfiStageIfpc:message=11;n=3;p[0]=9;p[1]=1;p[2]=0x1680;break;
  case AdrenoHfiStageStart:message=10;n=0;break;
  default:return AdrenoHfiStartupInvalid;

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiStartup.h =====
L2: #ifndef ADRENO_HFI_STARTUP_H
  /* SPDX-License-Identifier: BSD-2-Clause-Patent */
  #define ADRENO_HFI_STARTUP_H
  #include "AdrenoHfi.h"
L3: #define ADRENO_HFI_STARTUP_H
  /* SPDX-License-Identifier: BSD-2-Clause-Patent */
  #ifndef ADRENO_HFI_STARTUP_H
  #include "AdrenoHfi.h"
  #ifdef __cplusplus
L4: #include "AdrenoHfi.h"
  #ifndef ADRENO_HFI_STARTUP_H
  #define ADRENO_HFI_STARTUP_H
  #ifdef __cplusplus
  extern "C" {
L9: typedef struct {uint64_t hz;uint32_t vote;} AdrenoHfiPerformanceLevel;
  #endif
  /* Modern A6xx/A7xx wire profile. Legacy and A8xx table formats are excluded. */
  typedef struct {
  unsigned gpu_count,gmu_count;
L11: unsigned gpu_count,gmu_count;
  typedef struct {uint64_t hz;uint32_t vote;} AdrenoHfiPerformanceLevel;
  typedef struct {
  AdrenoHfiPerformanceLevel gpu[16],gmu[4];
  unsigned bandwidth_count,cnoc_count,ddr_count;
L12: AdrenoHfiPerformanceLevel gpu[16],gmu[4];
  typedef struct {
  unsigned gpu_count,gmu_count;
  unsigned bandwidth_count,cnoc_count,ddr_count;
  uint32_t cnoc_wait_mask,ddr_wait_mask;
L19: } AdrenoHfiStartupConfig;
  uint32_t acd_version,acd_enable_mask,acd_stride,acd_count,acd_data[32];
  unsigned enable_ifpc;
  typedef enum {
  AdrenoHfiStageNone,AdrenoHfiStagePerformance,AdrenoHfiStageBandwidth,
L21: AdrenoHfiStageNone,AdrenoHfiStagePerformance,AdrenoHfiStageBandwidth,
  } AdrenoHfiStartupConfig;
  typedef enum {
  AdrenoHfiStageAcdEnable,AdrenoHfiStageAcdTable,AdrenoHfiStageIfpc,
  AdrenoHfiStageCoreStart,AdrenoHfiStageStart,AdrenoHfiStageComplete
L22: AdrenoHfiStageAcdEnable,AdrenoHfiStageAcdTable,AdrenoHfiStageIfpc,
  typedef enum {
  AdrenoHfiStageNone,AdrenoHfiStagePerformance,AdrenoHfiStageBandwidth,
  AdrenoHfiStageCoreStart,AdrenoHfiStageStart,AdrenoHfiStageComplete
  } AdrenoHfiStartupStage;
L23: AdrenoHfiStageCoreStart,AdrenoHfiStageStart,AdrenoHfiStageComplete
  AdrenoHfiStageNone,AdrenoHfiStagePerformance,AdrenoHfiStageBandwidth,
  AdrenoHfiStageAcdEnable,AdrenoHfiStageAcdTable,AdrenoHfiStageIfpc,
  } AdrenoHfiStartupStage;
  typedef enum {
L24: } AdrenoHfiStartupStage;
  AdrenoHfiStageAcdEnable,AdrenoHfiStageAcdTable,AdrenoHfiStageIfpc,
  AdrenoHfiStageCoreStart,AdrenoHfiStageStart,AdrenoHfiStageComplete
  typedef enum {
  AdrenoHfiStartupSuccess,AdrenoHfiStartupInvalid,AdrenoHfiStartupBusy,
L26: AdrenoHfiStartupSuccess,AdrenoHfiStartupInvalid,AdrenoHfiStartupBusy,
  } AdrenoHfiStartupStage;
  typedef enum {
  AdrenoHfiStartupPoisoned,AdrenoHfiStartupClockError,AdrenoHfiStartupWaitError,
  AdrenoHfiStartupTimeout,AdrenoHfiStartupPlatformFault,AdrenoHfiStartupTransportError
L27: AdrenoHfiStartupPoisoned,AdrenoHfiStartupClockError,AdrenoHfiStartupWaitError,
  typedef enum {
  AdrenoHfiStartupSuccess,AdrenoHfiStartupInvalid,AdrenoHfiStartupBusy,
  AdrenoHfiStartupTimeout,AdrenoHfiStartupPlatformFault,AdrenoHfiStartupTransportError
  } AdrenoHfiStartupStatus;
L28: AdrenoHfiStartupTimeout,AdrenoHfiStartupPlatformFault,AdrenoHfiStartupTransportError
  AdrenoHfiStartupSuccess,AdrenoHfiStartupInvalid,AdrenoHfiStartupBusy,
  AdrenoHfiStartupPoisoned,AdrenoHfiStartupClockError,AdrenoHfiStartupWaitError,
  } AdrenoHfiStartupStatus;
  typedef struct {
L29: } AdrenoHfiStartupStatus;
  AdrenoHfiStartupPoisoned,AdrenoHfiStartupClockError,AdrenoHfiStartupWaitError,
  AdrenoHfiStartupTimeout,AdrenoHfiStartupPlatformFault,AdrenoHfiStartupTransportError
  typedef struct {
  void *cookie;
L37: } AdrenoHfiStartupServices;
  unsigned polls_per_command,wait_interval_us;
  uint64_t command_timeout_us,total_timeout_us;
  typedef struct {unsigned attempted,poisoned,completed;} AdrenoHfiStartup;
  typedef struct {
L38: typedef struct {unsigned attempted,poisoned,completed;} AdrenoHfiStartup;
  uint64_t command_timeout_us,total_timeout_us;
  } AdrenoHfiStartupServices;
  typedef struct {
  AdrenoHfiStartupStage stage;
L40: AdrenoHfiStartupStage stage;
  typedef struct {unsigned attempted,poisoned,completed;} AdrenoHfiStartup;
  typedef struct {
  AdrenoHfiStatus transport_status;
  uint32_t firmware_error,wire_header,acknowledged_stages;
L41: AdrenoHfiStatus transport_status;
  typedef struct {
  AdrenoHfiStartupStage stage;
  uint32_t firmware_error,wire_header,acknowledged_stages;
  unsigned published_commands,poll_reads,resources_must_retain;
L42: uint32_t firmware_error,wire_header,acknowledged_stages;
  AdrenoHfiStartupStage stage;
  AdrenoHfiStatus transport_status;
  unsigned published_commands,poll_reads,resources_must_retain;
  uint64_t elapsed_us;
L45: } AdrenoHfiStartupResult;
  unsigned published_commands,poll_reads,resources_must_retain;
  uint64_t elapsed_us;
  /* Validate every input before any queue publication. Frequencies include the
  * zero/off entry, are strictly ascending, exactly representable in wire kHz.
L53: AdrenoHfiStartupStatus AdrenoHfiStartupValidate(const AdrenoHfiStartupConfig *);
  * Unused fixed-capacity slots must be zero. This prevents silently ignoring
  * unsupported or malformed configuration. No input is authenticated here. */
  AdrenoHfiStartupStatus AdrenoHfiStartupValidateServices(const AdrenoHfiStartupServices *);
  /* Payload excludes header. All output storage must be disjoint from inputs.
L54: AdrenoHfiStartupStatus AdrenoHfiStartupValidateServices(const AdrenoHfiStartupServices *);
  * unsupported or malformed configuration. No input is authenticated here. */
  AdrenoHfiStartupStatus AdrenoHfiStartupValidate(const AdrenoHfiStartupConfig *);
  /* Payload excludes header. All output storage must be disjoint from inputs.
  * Encodes one selected stage; unused optional stages refuse. Failure leaves
L58: AdrenoHfiStartupStatus AdrenoHfiStartupEncode(const AdrenoHfiStartupConfig *,
  * Encodes one selected stage; unused optional stages refuse. Failure leaves
  * payload/header outputs untouched except word_count=0. Capacity >=159. */
  AdrenoHfiStartupStage,uint32_t *id,uint32_t *payload,size_t capacity,size_t *word_count);
  /* Single attempt, serialized, caller-owned zero-initialized state. Requires
L59: AdrenoHfiStartupStage,uint32_t *id,uint32_t *payload,size_t capacity,size_t *word_count);
  * payload/header outputs untouched except word_count=0. Capacity >=159. */
  AdrenoHfiStartupStatus AdrenoHfiStartupEncode(const AdrenoHfiStartupConfig *,
  /* Single attempt, serialized, caller-owned zero-initialized state. Requires
  * a real ready GMU, exclusive coherent HFI allocation and active native4K GMU
L61: * a real ready GMU, exclusive coherent HFI allocation and active native4K GMU
  AdrenoHfiStartupStage,uint32_t *id,uint32_t *payload,size_t capacity,size_t *word_count);
  /* Single attempt, serialized, caller-owned zero-initialized state. Requires
  * mappings. Only matching actual ACKs advance the startup sequence. All
  * commands and the whole sequence have monotonic-time AND iteration bounds.
L67: * execution, power/coherence/SMMU readiness, shader submission or a desktop.
  * failure the transport is poisoned; no replay, synthetic ACK or implicit
  * stop occurs. Even success does not authorize resource release or prove GPU
  * Input, state, services, transport, result and shared queues must remain
  * disjoint and pinned; config remains immutable throughout the sequence. */
L70: AdrenoHfiStartupStatus AdrenoHfiStartupRun(AdrenoHfiStartup *,AdrenoHfi *,
  * Input, state, services, transport, result and shared queues must remain
  * disjoint and pinned; config remains immutable throughout the sequence. */
  const AdrenoHfiStartupConfig *,const AdrenoHfiStartupServices *,AdrenoHfiStartupResult *);
  #ifdef __cplusplus
L71: const AdrenoHfiStartupConfig *,const AdrenoHfiStartupServices *,AdrenoHfiStartupResult *);
  * disjoint and pinned; config remains immutable throughout the sequence. */
  AdrenoHfiStartupStatus AdrenoHfiStartupRun(AdrenoHfiStartup *,AdrenoHfi *,
  #ifdef __cplusplus
  }

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiVotes.c =====
L2: #include "AdrenoHfiVotes.h"
  /* SPDX-License-Identifier: BSD-2-Clause-Patent */
  static uint16_t le16(const uint8_t *p){return (uint16_t)(p[0]|(uint16_t)p[1]<<8);}
  static uint32_t le32(const uint8_t *p){return le16(p)|(uint32_t)le16(p+2)<<16;}
L17: AdrenoHfiStartupStatus AdrenoHfiArcVotes(const uint32_t *levels,size_t count,
  return 1;
  }
  const uint8_t *primary,size_t primary_bytes,const uint8_t *secondary,size_t secondary_bytes,
  uint32_t *votes,size_t capacity)
L22: !rail(primary,primary_bytes) || !rail(secondary,secondary_bytes))return AdrenoHfiStartupInvalid;
  {
  if(!levels || !votes || !count || count>16 || capacity<count || levels[0] ||
  uint32_t result[16];
  for(size_t i=0;i<count;++i) {
L25: if(levels[i]>UINT16_MAX || (i && levels[i]<levels[i-1]))return AdrenoHfiStartupInvalid;
  uint32_t result[16];
  for(size_t i=0;i<count;++i) {
  size_t p=0,s=0;
  while(p<primary_bytes/2 && le16(primary+2*p)<levels[i])++p;
L28: if(p==primary_bytes/2)return AdrenoHfiStartupInvalid;
  size_t p=0,s=0;
  while(p<primary_bytes/2 && le16(primary+2*p)<levels[i])++p;
  for(size_t j=0;j<secondary_bytes/2;++j) {
  uint16_t value=le16(secondary+2*j);
L37: return AdrenoHfiStartupSuccess;
  }
  for(size_t i=0;i<count;++i)votes[i]=result[i];
  }
  AdrenoHfiStartupStatus AdrenoHfiBcmAux(AdrenoHfiBcm *b,const uint8_t *p,size_t bytes)
L39: AdrenoHfiStartupStatus AdrenoHfiBcmAux(AdrenoHfiBcm *b,const uint8_t *p,size_t bytes)
  return AdrenoHfiStartupSuccess;
  }
  {
  if(!b || !p || bytes!=8 || p[7])return AdrenoHfiStartupInvalid;
L41: if(!b || !p || bytes!=8 || p[7])return AdrenoHfiStartupInvalid;
  AdrenoHfiStartupStatus AdrenoHfiBcmAux(AdrenoHfiBcm *b,const uint8_t *p,size_t bytes)
  {
  b->unit=le32(p);b->width=le16(p+4);b->vcd=p[6];return AdrenoHfiStartupSuccess;
  }
L42: b->unit=le32(p);b->width=le16(p+4);b->vcd=p[6];return AdrenoHfiStartupSuccess;
  {
  if(!b || !p || bytes!=8 || p[7])return AdrenoHfiStartupInvalid;
  }
  static int address(uint32_t a){return a && !(a&3);}
L45: AdrenoHfiStartupStatus AdrenoHfiBuildBandwidth(const uint32_t *kbps,size_t count,
  }
  static int address(uint32_t a){return a && !(a&3);}
  const AdrenoHfiBcm *bcms,size_t n,uint32_t cn0,AdrenoHfiStartupConfig *c)
  {
L46: const AdrenoHfiBcm *bcms,size_t n,uint32_t cn0,AdrenoHfiStartupConfig *c)
  static int address(uint32_t a){return a && !(a&3);}
  AdrenoHfiStartupStatus AdrenoHfiBuildBandwidth(const uint32_t *kbps,size_t count,
  {
  if(!c || !kbps || !bcms || !count || count>16 || kbps[0] || !n || n>3 || !address(cn0))
L49: return AdrenoHfiStartupInvalid;
  {
  if(!c || !kbps || !bcms || !count || count>16 || kbps[0] || !n || n>3 || !address(cn0))
  for(size_t i=1;i<count;++i)if(kbps[i]<=kbps[i-1])return AdrenoHfiStartupInvalid;
  for(size_t j=0;j<n;++j) {
L50: for(size_t i=1;i<count;++i)if(kbps[i]<=kbps[i-1])return AdrenoHfiStartupInvalid;
  if(!c || !kbps || !bcms || !count || count>16 || kbps[0] || !n || n>3 || !address(cn0))
  return AdrenoHfiStartupInvalid;
  for(size_t j=0;j<n;++j) {
  const AdrenoHfiBcm *b=bcms+j;
L52: const AdrenoHfiBcm *b=bcms+j;
  for(size_t i=1;i<count;++i)if(kbps[i]<=kbps[i-1])return AdrenoHfiStartupInvalid;
  for(size_t j=0;j<n;++j) {
  if(!address(b->address) || b->address==cn0 || b->fixed>1 || b->perfmode>0x3fff ||
  (!b->fixed && (!b->unit || !b->width || !b->buswidth || b->perfmode || b->perfmode_kbps)))
L55: return AdrenoHfiStartupInvalid;
  if(!address(b->address) || b->address==cn0 || b->fixed>1 || b->perfmode>0x3fff ||
  (!b->fixed && (!b->unit || !b->width || !b->buswidth || b->perfmode || b->perfmode_kbps)))
  for(size_t k=0;k<j;++k)if(b->address==bcms[k].address)return AdrenoHfiStartupInvalid;
  }
L56: for(size_t k=0;k<j;++k)if(b->address==bcms[k].address)return AdrenoHfiStartupInvalid;
  (!b->fixed && (!b->unit || !b->width || !b->buswidth || b->perfmode || b->perfmode_kbps)))
  return AdrenoHfiStartupInvalid;
  }
  /* All input validation is finished before changing caller storage. */
L72: const AdrenoHfiBcm *b=bcms+j;data=commit?0x40000000:0;
  uint32_t data=0;
  if(i<count && j<n) {
  if(kbps[i]) {
  data|=0x20000000;
L88: return AdrenoHfiStartupSuccess;
  }
  }
  }

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\AdrenoHfiVotes.h =====
L2: #ifndef ADRENO_HFI_VOTES_H
  /* SPDX-License-Identifier: BSD-2-Clause-Patent */
  #define ADRENO_HFI_VOTES_H
  #include "AdrenoHfiStartup.h"
L3: #define ADRENO_HFI_VOTES_H
  /* SPDX-License-Identifier: BSD-2-Clause-Patent */
  #ifndef ADRENO_HFI_VOTES_H
  #include "AdrenoHfiStartup.h"
  #ifdef __cplusplus
L4: #include "AdrenoHfiStartup.h"
  #ifndef ADRENO_HFI_VOTES_H
  #define ADRENO_HFI_VOTES_H
  #ifdef __cplusplus
  extern "C" {
L17: AdrenoHfiStartupStatus AdrenoHfiArcVotes(const uint32_t *levels,size_t level_count,
  * Output remains unchanged on failure. Inputs/outputs must be disjoint and
  * immutable during calls. Successful arithmetic does not authenticate inputs. */
  const uint8_t *primary,size_t primary_bytes,const uint8_t *secondary,size_t secondary_bytes,
  uint32_t *votes,size_t capacity);
L26: } AdrenoHfiBcm;
  uint16_t perfmode;
  uint32_t perfmode_kbps;
  /* Decode exactly eight bytes of BCM aux data; address/buswidth/fixed/perfmode
  * are separately supplied source/platform policy and are preserved. */
L29: AdrenoHfiStartupStatus AdrenoHfiBcmAux(AdrenoHfiBcm *,const uint8_t *,size_t);
  /* Decode exactly eight bytes of BCM aux data; address/buswidth/fixed/perfmode
  * are separately supplied source/platform policy and are preserved. */
  /* A7xx BCM arithmetic and modern HFI bandwidth layout. Off=0, then strictly
  * ascending KB/s OPP bandwidths, <=16. Up to three platform-ordered BCMs;
L30: /* A7xx BCM arithmetic and modern HFI bandwidth layout. Off=0, then strictly
  * are separately supplied source/platform policy and are preserved. */
  AdrenoHfiStartupStatus AdrenoHfiBcmAux(AdrenoHfiBcm *,const uint8_t *,size_t);
  * ascending KB/s OPP bandwidths, <=16. Up to three platform-ordered BCMs;
  * CN0 address must come from command-db. No source fallback address exists.
L35: * Failure leaves the entire config unchanged. Success requires no HFI/device.
  * Unit/width come from BCM aux; buswidth/fixed/perfmode from target catalog.
  * Fills only bandwidth-related config fields, preserving performance/features.
  * Does not validate actual rail/BCM ownership, limits, speed bin or power. */
  AdrenoHfiStartupStatus AdrenoHfiBuildBandwidth(const uint32_t *kbps,size_t level_count,
L37: AdrenoHfiStartupStatus AdrenoHfiBuildBandwidth(const uint32_t *kbps,size_t level_count,
  * Failure leaves the entire config unchanged. Success requires no HFI/device.
  * Does not validate actual rail/BCM ownership, limits, speed bin or power. */
  const AdrenoHfiBcm *bcms,size_t bcm_count,uint32_t cn0_address,AdrenoHfiStartupConfig *);
  #ifdef __cplusplus
L38: const AdrenoHfiBcm *bcms,size_t bcm_count,uint32_t cn0_address,AdrenoHfiStartupConfig *);
  * Does not validate actual rail/BCM ownership, limits, speed bin or power. */
  AdrenoHfiStartupStatus AdrenoHfiBuildBandwidth(const uint32_t *kbps,size_t level_count,
  #ifdef __cplusplus
  }

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\test_gmu.c =====
L2: #include "AdrenoFirmware.h"
  /* SPDX-License-Identifier: BSD-2-Clause-Patent */
  #include <assert.h>
  #include <stdio.h>
L8: static const AdrenoFirmwareRegion regions[] = {
  #include <string.h>
  
  {0, 0x4000, 1}, {0x4000, 0xffc000, 2}, {0x10004000, 0x4000, 3}
  };
L13: const AdrenoFirmwareRegion *ranges, size_t range_count,
  
  static void refusal(const uint8_t *data, size_t bytes,
  size_t capacity, AdrenoFirmwareResult expected)
  {
L14: size_t capacity, AdrenoFirmwareResult expected)
  static void refusal(const uint8_t *data, size_t bytes,
  const AdrenoFirmwareRegion *ranges, size_t range_count,
  {
  AdrenoFirmwareBlock blocks[32], before[32];
L16: AdrenoFirmwareBlock blocks[32], before[32];
  size_t capacity, AdrenoFirmwareResult expected)
  {
  memset(blocks, 0xa5, sizeof(blocks));
  memcpy(before, blocks, sizeof(blocks));
L20: AdrenoFirmwareResult result = AdrenoFirmwarePlanGmu(data, bytes, ranges, range_count, blocks, capacity, &count);
  memcpy(before, blocks, sizeof(blocks));
  size_t count = 123;
  assert(result != AdrenoFirmwareSuccess);
  if (expected != AdrenoFirmwareSuccess) assert(result == expected);
L21: assert(result != AdrenoFirmwareSuccess);
  size_t count = 123;
  AdrenoFirmwareResult result = AdrenoFirmwarePlanGmu(data, bytes, ranges, range_count, blocks, capacity, &count);
  if (expected != AdrenoFirmwareSuccess) assert(result == expected);
  assert(count == 0 && !memcmp(blocks, before, sizeof(blocks)));
L22: if (expected != AdrenoFirmwareSuccess) assert(result == expected);
  AdrenoFirmwareResult result = AdrenoFirmwarePlanGmu(data, bytes, ranges, range_count, blocks, capacity, &count);
  assert(result != AdrenoFirmwareSuccess);
  assert(count == 0 && !memcmp(blocks, before, sizeof(blocks)));
  }
L36: AdrenoFirmwareBlock blocks[32];
  assert(data && fread(data, 1, (size_t)length, file) == (size_t)length);
  fclose(file);
  size_t count = 0;
  assert(AdrenoFirmwarePlanGmu(data, length, regions, 3, blocks, 32, &count) == AdrenoFirmwareSuccess && count == 15);
L38: assert(AdrenoFirmwarePlanGmu(data, length, regions, 3, blocks, 32, &count) == AdrenoFirmwareSuccess && count == 15);
  AdrenoFirmwareBlock blocks[32];
  size_t count = 0;
  unsigned payloads = 0;
  size_t payload_bytes = 0;
L54: AdrenoFirmwareResult result = AdrenoFirmwarePlanGmu(data, bytes, regions, 3, blocks, 32, &count);
  for (size_t bytes = 0; bytes < (size_t)length; ++bytes) {
  count = 0;
  if (result == AdrenoFirmwareSuccess) valid_prefixes++;
  else refusal(data, bytes, regions, 3, 32, AdrenoFirmwareSuccess);
L55: if (result == AdrenoFirmwareSuccess) valid_prefixes++;
  count = 0;
  AdrenoFirmwareResult result = AdrenoFirmwarePlanGmu(data, bytes, regions, 3, blocks, 32, &count);
  else refusal(data, bytes, regions, 3, 32, AdrenoFirmwareSuccess);
  }
L56: else refusal(data, bytes, regions, 3, 32, AdrenoFirmwareSuccess);
  AdrenoFirmwareResult result = AdrenoFirmwarePlanGmu(data, bytes, regions, 3, blocks, 32, &count);
  if (result == AdrenoFirmwareSuccess) valid_prefixes++;
  }
  /* Ending on a complete record is structurally valid, not authentic firmware. */
L58: /* Ending on a complete record is structurally valid, not authentic firmware. */
  else refusal(data, bytes, regions, 3, 32, AdrenoFirmwareSuccess);
  }
  assert(valid_prefixes == 14);
  refusal(data, length, regions, 3, 14, AdrenoFirmwareNoSpace);
L60: refusal(data, length, regions, 3, 14, AdrenoFirmwareNoSpace);
  /* Ending on a complete record is structurally valid, not authentic firmware. */
  assert(valid_prefixes == 14);
  refusal(data, length, regions, 2, 32, AdrenoFirmwareUnmapped);
  AdrenoFirmwareRegion bad[3];
L61: refusal(data, length, regions, 2, 32, AdrenoFirmwareUnmapped);
  assert(valid_prefixes == 14);
  refusal(data, length, regions, 3, 14, AdrenoFirmwareNoSpace);
  AdrenoFirmwareRegion bad[3];
  memcpy(bad, regions, sizeof(bad)); bad[1].address = 0x3ffc;
L62: AdrenoFirmwareRegion bad[3];
  refusal(data, length, regions, 3, 14, AdrenoFirmwareNoSpace);
  refusal(data, length, regions, 2, 32, AdrenoFirmwareUnmapped);
  memcpy(bad, regions, sizeof(bad)); bad[1].address = 0x3ffc;
  refusal(data, length, bad, 3, 32, AdrenoFirmwareInvalid);
L64: refusal(data, length, bad, 3, 32, AdrenoFirmwareInvalid);
  AdrenoFirmwareRegion bad[3];
  memcpy(bad, regions, sizeof(bad)); bad[1].address = 0x3ffc;
  memcpy(bad, regions, sizeof(bad)); bad[1].identifier = 1;
  refusal(data, length, bad, 3, 32, AdrenoFirmwareInvalid);
L66: refusal(data, length, bad, 3, 32, AdrenoFirmwareInvalid);
  refusal(data, length, bad, 3, 32, AdrenoFirmwareInvalid);
  memcpy(bad, regions, sizeof(bad)); bad[1].identifier = 1;
  memcpy(bad, regions, sizeof(bad)); bad[2].bytes -= 0x10;
  refusal(data, length, bad, 3, 32, AdrenoFirmwareUnmapped);
L68: refusal(data, length, bad, 3, 32, AdrenoFirmwareUnmapped);
  refusal(data, length, bad, 3, 32, AdrenoFirmwareInvalid);
  memcpy(bad, regions, sizeof(bad)); bad[2].bytes -= 0x10;
  data[0xb4] = 0xff; data[0xb5] = 0xff; data[0xb6] = 0xff; data[0xb7] = 0xff;
  refusal(data, length, regions, 3, 32, AdrenoFirmwareTruncated);
L70: refusal(data, length, regions, 3, 32, AdrenoFirmwareTruncated);
  refusal(data, length, bad, 3, 32, AdrenoFirmwareUnmapped);
  data[0xb4] = 0xff; data[0xb5] = 0xff; data[0xb6] = 0xff; data[0xb7] = 0xff;
  free(data);
  puts("PASS: actual 15-record GMU plan, all 66844 prefixes and six explicit refusal controls; no partial output");
L72: puts("PASS: actual 15-record GMU plan, all 66844 prefixes and six explicit refusal controls; no partial output");
  refusal(data, length, regions, 3, 32, AdrenoFirmwareTruncated);
  free(data);
  }

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\test_hfi.c =====
L2: /* All peers below are software fixtures; no firmware/device is executed. */
  /* SPDX-License-Identifier: BSD-2-Clause-Patent */
  #include "AdrenoHfi.h"
  #include <stdio.h>
L3: #include "AdrenoHfi.h"
  /* SPDX-License-Identifier: BSD-2-Clause-Patent */
  /* All peers below are software fixtures; no firmware/device is executed. */
  #include <stdio.h>
  #include <stdlib.h>
L9: static AdrenoHfi h;static unsigned notified,notify_fail,auto_reply,waits,reply_at;
  #define CHECK(x) do {if(!(x)){fprintf(stderr,"line %d: %s\n",__LINE__,#x);exit(1);}}while(0)
  static _Alignas(4096) uint32_t shared[4096],before[4096];
  static uint32_t input[254],output[16];
  #ifdef SOURCE_ORACLE
L40: CHECK(AdrenoHfiInitializeStopped(&h,shared,sizeof(shared),0x60000000,&h,notify)==AdrenoHfiSuccess);
  notified=notify_fail=auto_reply=waits=reply_at=0;
  memset(&h,0,sizeof(h));memset(shared,0xa5,sizeof(shared));
  CHECK(shared[1]==168 && shared[2]==6 && shared[3]==12 && shared[4]==3 && shared[5]==3);
  for(unsigned q=0;q<3;++q) {
L60: CHECK(AdrenoHfiSend(&h,14,input,words,&header)==AdrenoHfiSuccess && notified==1);
  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(header==((1u<<20)|((words+1)<<8)|14) && h.pending_header==header);
  CHECK(shared[1024+at]==header);
L73: CHECK(AdrenoHfiSend(&h,10,NULL,0,&header)==AdrenoHfiBusy && notified==1);
  CHECK(!memcmp(shared,reference,sizeof(shared)));
  #endif
  shared[28]=shared[29]=at;unsigned returned=words%17;
  response(3+returned,126,h.pending_header,0);memset(output,0x5a,sizeof(output));
L76: CHECK(AdrenoHfiPoll(&h,output,16,&count,&error)==AdrenoHfiSuccess);
  shared[28]=shared[29]=at;unsigned returned=words%17;
  response(3+returned,126,h.pending_header,0);memset(output,0x5a,sizeof(output));
  CHECK(count==returned && !error && !h.pending_header && !h.poisoned);
  for(unsigned i=0;i<returned;++i)CHECK(output[i]==0xfeed0003+i);
L84: CHECK(AdrenoHfiSend(&h,10,NULL,0,&header)==AdrenoHfiNoSpace);
  reset();shared[16]=4;memcpy(before,shared,sizeof(shared));
  /* Reserve the complete four-word packet including padding and sentinel. */
  CHECK(!memcmp(before,shared,sizeof(shared)) && !notified && !h.pending_header);
  reset();notify_fail=1;
L87: CHECK(AdrenoHfiSend(&h,14,NULL,0,&header)==AdrenoHfiNotifyError);
  CHECK(!memcmp(before,shared,sizeof(shared)) && !notified && !h.pending_header);
  reset();notify_fail=1;
  CHECK(h.poisoned && h.pending_header && shared[17]==4);
  CHECK(AdrenoHfiSend(&h,14,NULL,0,&header)==AdrenoHfiPoisoned && notified==1);
L89: CHECK(AdrenoHfiSend(&h,14,NULL,0,&header)==AdrenoHfiPoisoned && notified==1);
  CHECK(AdrenoHfiSend(&h,14,NULL,0,&header)==AdrenoHfiNotifyError);
  CHECK(h.poisoned && h.pending_header && shared[17]==4);
  for(unsigned fault=0;fault<11;++fault) {
  reset();CHECK(AdrenoHfiSend(&h,14,NULL,0,&header)==AdrenoHfiSuccess);
L91: reset();CHECK(AdrenoHfiSend(&h,14,NULL,0,&header)==AdrenoHfiSuccess);
  CHECK(AdrenoHfiSend(&h,14,NULL,0,&header)==AdrenoHfiPoisoned && notified==1);
  for(unsigned fault=0;fault<11;++fault) {
  response(4,126,header,0);memset(output,0x5a,sizeof(output));
  AdrenoHfiStatus expected=AdrenoHfiCorrupt;
L93: AdrenoHfiStatus expected=AdrenoHfiCorrupt;
  reset();CHECK(AdrenoHfiSend(&h,14,NULL,0,&header)==AdrenoHfiSuccess);
  response(4,126,header,0);memset(output,0x5a,sizeof(output));
  switch(fault) {
  case 0:shared[2048]&=~0xff00u;break; /* zero length */
L101: case 6:shared[2048]=(2u<<8)|126;expected=AdrenoHfiEmpty;break; /* too short to match: skipped */
  case 4:shared[21]=2048;break; /* untrusted ring size */
  case 5:shared[2048]=(1u<<8)|100;break; /* error message without a code */
  case 7:shared[2050]=7;expected=AdrenoHfiFirmwareError;break;
  case 8:shared[2048]=(20u<<8)|100;break;
L102: case 7:shared[2050]=7;expected=AdrenoHfiFirmwareError;break;
  case 5:shared[2048]=(1u<<8)|100;break; /* error message without a code */
  case 6:shared[2048]=(2u<<8)|126;expected=AdrenoHfiEmpty;break; /* too short to match: skipped */
  case 8:shared[2048]=(20u<<8)|100;break;
  case 9:shared[2048]=(5u<<8)|126;break; /* incomplete packet */
L108: CHECK(AdrenoHfiPoll(&h,output,16,&count,&error)==expected);
  }
  uint32_t read=shared[28];
  if(fault==6) {CHECK(!count && !h.poisoned && h.pending_header && h.skipped==1);untouched_output();continue;}
  CHECK(!count && h.poisoned && h.pending_header && shared[28]==read);untouched_output();
L112: /* a6xx_hfi_wait_for_ack: a firmware error message and a reply to another sequence number are consumed and
  CHECK(!count && h.poisoned && h.pending_header && shared[28]==read);untouched_output();
  }
  * skipped, the first one recorded; the matching reply then completes. The GMU may change the echoed header's
  * other fields: only the sequence number is compared. */
L113: * skipped, the first one recorded; the matching reply then completes. The GMU may change the echoed header's
  }
  /* a6xx_hfi_wait_for_ack: a firmware error message and a reply to another sequence number are consumed and
  * other fields: only the sequence number is compared. */
  reset();CHECK(AdrenoHfiSend(&h,4,input,58,&header)==AdrenoHfiSuccess && header==0x103b04);
L115: reset();CHECK(AdrenoHfiSend(&h,4,input,58,&header)==AdrenoHfiSuccess && header==0x103b04);
  * skipped, the first one recorded; the matching reply then completes. The GMU may change the echoed header's
  * other fields: only the sequence number is compared. */
  response(2,100,77,0);
  response(4,126,(header&~0xfffff000u)|(9u<<20),0);
L119: CHECK(AdrenoHfiPoll(&h,output,16,&count,&error)==AdrenoHfiEmpty && !h.poisoned && h.pending_header==header);
  response(4,126,(header&~0xfffff000u)|(9u<<20),0);
  memset(output,0x5a,sizeof(output));
  CHECK(h.skipped==2 && h.skipped_header==((1u<<16)|(2u<<8)|100) && h.skipped_ret==77 && shared[28]==shared[29]);
  untouched_output();
L123: CHECK(AdrenoHfiPoll(&h,output,16,&count,&error)==AdrenoHfiSuccess && count==1 && output[0]==0xfeed0003);
  untouched_output();
  response(4,126,(header&0xfff00000u)|(1u<<16)|0x3b05,0);
  CHECK(!h.pending_header && !h.poisoned && h.skipped==2);
  /* a reply that matches by sequence number but reports an error fails as before */
L126: reset();CHECK(AdrenoHfiSend(&h,4,NULL,0,&header)==AdrenoHfiSuccess);
  CHECK(!h.pending_header && !h.poisoned && h.skipped==2);
  /* a reply that matches by sequence number but reports an error fails as before */
  response(4,126,header,5);
  CHECK(AdrenoHfiPoll(&h,output,16,&count,&error)==AdrenoHfiFirmwareError && error==5 && h.poisoned);
L128: CHECK(AdrenoHfiPoll(&h,output,16,&count,&error)==AdrenoHfiFirmwareError && error==5 && h.poisoned);
  reset();CHECK(AdrenoHfiSend(&h,4,NULL,0,&header)==AdrenoHfiSuccess);
  response(4,126,header,5);
  reset();memset(output,0x5a,sizeof(output));
  CHECK(AdrenoHfiExchange(&h,14,NULL,0,3,wait_once,output,16,&count,&error)==AdrenoHfiTimeout);
L130: CHECK(AdrenoHfiExchange(&h,14,NULL,0,3,wait_once,output,16,&count,&error)==AdrenoHfiTimeout);
  CHECK(AdrenoHfiPoll(&h,output,16,&count,&error)==AdrenoHfiFirmwareError && error==5 && h.poisoned);
  reset();memset(output,0x5a,sizeof(output));
  CHECK(waits==2 && h.poisoned && h.pending_header && !count);untouched_output();
  reset();
L133: CHECK(AdrenoHfiExchange(&h,14,NULL,0,3,failed_wait,output,16,&count,&error)==AdrenoHfiWaitError);
  CHECK(waits==2 && h.poisoned && h.pending_header && !count);untouched_output();
  reset();
  CHECK(waits==1 && notified==1 && h.poisoned && h.pending_header && !count);untouched_output();
  reset();reply_at=2;
L136: CHECK(AdrenoHfiExchange(&h,14,NULL,0,3,wait_once,output,16,&count,&error)==AdrenoHfiSuccess);
  CHECK(waits==1 && notified==1 && h.poisoned && h.pending_header && !count);untouched_output();
  reset();reply_at=2;
  CHECK(waits==2 && count==1 && output[0]==0xfeed0003 && !h.pending_header);
  reset();auto_reply=1;
L142: CHECK(AdrenoHfiExchange(&h,10,NULL,0,1,NULL,output,16,&count,&error)==AdrenoHfiSuccess);
  /* Software peer consumes the outgoing packet, then produces its ACK. */
  shared[16]=shared[17];
  CHECK(h.sequence==(i+1)%4095);
  }
L146: CHECK(AdrenoHfiInitializeStopped(&h,shared,16383,0x60000000,&h,notify)==AdrenoHfiInvalid);
  }
  reset();memcpy(before,shared,sizeof(shared));
  CHECK(AdrenoHfiInitializeStopped(&h,shared,16384,0xffffd000,&h,notify)==AdrenoHfiInvalid);
  CHECK(AdrenoHfiInitializeStopped(&h,shared+1,16384,0x60000000,&h,notify)==AdrenoHfiInvalid);
L147: CHECK(AdrenoHfiInitializeStopped(&h,shared,16384,0xffffd000,&h,notify)==AdrenoHfiInvalid);
  reset();memcpy(before,shared,sizeof(shared));
  CHECK(AdrenoHfiInitializeStopped(&h,shared,16383,0x60000000,&h,notify)==AdrenoHfiInvalid);
  CHECK(AdrenoHfiInitializeStopped(&h,shared+1,16384,0x60000000,&h,notify)==AdrenoHfiInvalid);
  CHECK(!memcmp(before,shared,sizeof(shared)));
L148: CHECK(AdrenoHfiInitializeStopped(&h,shared+1,16384,0x60000000,&h,notify)==AdrenoHfiInvalid);
  CHECK(AdrenoHfiInitializeStopped(&h,shared,16383,0x60000000,&h,notify)==AdrenoHfiInvalid);
  CHECK(AdrenoHfiInitializeStopped(&h,shared,16384,0xffffd000,&h,notify)==AdrenoHfiInvalid);
  CHECK(!memcmp(before,shared,sizeof(shared)));
  CHECK(AdrenoHfiSend(&h,256,NULL,0,&header)==AdrenoHfiInvalid);
L150: CHECK(AdrenoHfiSend(&h,256,NULL,0,&header)==AdrenoHfiInvalid);
  CHECK(AdrenoHfiInitializeStopped(&h,shared+1,16384,0x60000000,&h,notify)==AdrenoHfiInvalid);
  CHECK(!memcmp(before,shared,sizeof(shared)));
  CHECK(AdrenoHfiSend(&h,14,input,255,&header)==AdrenoHfiInvalid && !notified);
  CHECK(AdrenoHfiExchange(&h,14,NULL,0,0,NULL,output,16,&count,&error)==AdrenoHfiInvalid && !notified);

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\test_startup.c =====
L2: /* Software GMU peer only. Original source oracle is compiled outside Git. */
  /* SPDX-License-Identifier: BSD-2-Clause-Patent */
  #include "AdrenoHfiStartup.h"
  #include <stdio.h>
L3: #include "AdrenoHfiStartup.h"
  /* SPDX-License-Identifier: BSD-2-Clause-Patent */
  /* Software GMU peer only. Original source oracle is compiled outside Git. */
  #include <stdio.h>
  #include <stdlib.h>
L9: static AdrenoHfi hfi;
  #define CHECK(x) do {if(!(x)){fprintf(stderr,"line %d: %s\n",__LINE__,#x);exit(1);}}while(0)
  static uint32_t *shared;
  static AdrenoHfiStartup state;
  static AdrenoHfiStartupConfig config;
L10: static AdrenoHfiStartup state;
  static uint32_t *shared;
  static AdrenoHfi hfi;
  static AdrenoHfiStartupConfig config;
  static AdrenoHfiStartupServices services;
L11: static AdrenoHfiStartupConfig config;
  static AdrenoHfi hfi;
  static AdrenoHfiStartup state;
  static AdrenoHfiStartupServices services;
  static AdrenoHfiStartupResult result;
L12: static AdrenoHfiStartupServices services;
  static AdrenoHfiStartup state;
  static AdrenoHfiStartupConfig config;
  static AdrenoHfiStartupResult result;
  static struct {
L13: static AdrenoHfiStartupResult result;
  static AdrenoHfiStartupConfig config;
  static AdrenoHfiStartupServices services;
  static struct {
  uint64_t time,jump;
L21: extern int source_startup(const AdrenoHfiStartupConfig *,unsigned,unsigned *,unsigned *,unsigned *,uint32_t [8][159]);
  } peer;
  #ifdef SOURCE_ORACLE
  #endif
  static void response(uint32_t command)
L63: CHECK(AdrenoHfiInitializeStopped(&hfi,shared,16384,0x61004000,&peer,notify)==AdrenoHfiSuccess);
  {
  memset(&peer,0,sizeof(peer));peer.time=1000;
  state=(AdrenoHfiStartup){0};config=(AdrenoHfiStartupConfig){0};
  config.gpu_count=4;config.gmu_count=3;
L64: state=(AdrenoHfiStartup){0};config=(AdrenoHfiStartupConfig){0};
  memset(&peer,0,sizeof(peer));peer.time=1000;
  CHECK(AdrenoHfiInitializeStopped(&hfi,shared,16384,0x61004000,&peer,notify)==AdrenoHfiSuccess);
  config.gpu_count=4;config.gmu_count=3;
  for(unsigned i=0;i<4;++i)config.gpu[i]=(AdrenoHfiPerformanceLevel){i*100000000ULL,i*3};
L65: config.gpu_count=4;config.gmu_count=3;
  CHECK(AdrenoHfiInitializeStopped(&hfi,shared,16384,0x61004000,&peer,notify)==AdrenoHfiSuccess);
  state=(AdrenoHfiStartup){0};config=(AdrenoHfiStartupConfig){0};
  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};
L66: for(unsigned i=0;i<4;++i)config.gpu[i]=(AdrenoHfiPerformanceLevel){i*100000000ULL,i*3};
  state=(AdrenoHfiStartup){0};config=(AdrenoHfiStartupConfig){0};
  config.gpu_count=4;config.gmu_count=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;
L67: for(unsigned i=0;i<3;++i)config.gmu[i]=(AdrenoHfiPerformanceLevel){i*200000000ULL,i*4};
  config.gpu_count=4;config.gmu_count=3;
  for(unsigned i=0;i<4;++i)config.gpu[i]=(AdrenoHfiPerformanceLevel){i*100000000ULL,i*3};
  config.bandwidth_count=3;config.cnoc_count=2;config.ddr_count=3;
  config.cnoc_wait_mask=3;config.ddr_wait_mask=7;
L80: services=(AdrenoHfiStartupServices){&peer,now,wait_us,health,5,10,100,500};
  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;
  }
  static AdrenoHfiStartupStatus run(void)
L82: static AdrenoHfiStartupStatus run(void)
  services=(AdrenoHfiStartupServices){&peer,now,wait_us,health,5,10,100,500};
  }
  {return AdrenoHfiStartupRun(&state,&hfi,&config,&services,&result);}
  static void refused(void)
L83: {return AdrenoHfiStartupRun(&state,&hfi,&config,&services,&result);}
  }
  static AdrenoHfiStartupStatus run(void)
  static void refused(void)
  {
L87: CHECK(run()==AdrenoHfiStartupInvalid && !state.attempted && !peer.count);
  {
  uint32_t before[4096];memcpy(before,shared,sizeof(before));
  CHECK(!memcmp(before,shared,sizeof(before)) && result.resources_must_retain);
  }
L95: setup(acd,ifpc);CHECK(run()==AdrenoHfiStartupSuccess);
  unsigned cases=0;
  for(unsigned acd=0;acd<2;++acd)for(unsigned ifpc=0;ifpc<2;++ifpc) {
  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);
L97: CHECK(result.stage==AdrenoHfiStageComplete && result.published_commands==count && result.resources_must_retain);
  setup(acd,ifpc);CHECK(run()==AdrenoHfiStartupSuccess);
  unsigned count=4+2*acd+ifpc;CHECK(peer.count==count && state.completed && !state.poisoned);
  #ifdef SOURCE_ORACLE
  unsigned expected_count=0,ids[8]={0},words[8]={0};uint32_t messages[8][159]={{0}};
L104: CHECK(run()==AdrenoHfiStartupBusy && peer.count==count);
  for(unsigned i=0;i<count;++i)CHECK(ids[i]==peer.ids[i] && words[i]==peer.words[i] && !memcmp(messages[i],peer.messages[i],words[i]*4));
  #endif
  for(unsigned fail=1;fail<=count;++fail)for(unsigned mode=1;mode<=3;++mode) {
  setup(acd,ifpc);peer.fail_at=fail;peer.mode=mode;
L107: CHECK(run()==(mode==3?AdrenoHfiStartupTimeout:AdrenoHfiStartupTransportError));
  for(unsigned fail=1;fail<=count;++fail)for(unsigned mode=1;mode<=3;++mode) {
  setup(acd,ifpc);peer.fail_at=fail;peer.mode=mode;
  CHECK(peer.count==fail && state.poisoned && hfi.poisoned && !state.completed && result.resources_must_retain);
  CHECK(result.published_commands==fail && run()==AdrenoHfiStartupPoisoned && peer.count==fail);
L108: CHECK(peer.count==fail && state.poisoned && hfi.poisoned && !state.completed && result.resources_must_retain);
  setup(acd,ifpc);peer.fail_at=fail;peer.mode=mode;
  CHECK(run()==(mode==3?AdrenoHfiStartupTimeout:AdrenoHfiStartupTransportError));
  CHECK(result.published_commands==fail && run()==AdrenoHfiStartupPoisoned && peer.count==fail);
  #ifdef SOURCE_ORACLE
L109: CHECK(result.published_commands==fail && run()==AdrenoHfiStartupPoisoned && peer.count==fail);
  CHECK(run()==(mode==3?AdrenoHfiStartupTimeout:AdrenoHfiStartupTransportError));
  CHECK(peer.count==fail && state.poisoned && hfi.poisoned && !state.completed && result.resources_must_retain);
  #ifdef SOURCE_ORACLE
  expected_count=0;
L119: CHECK(run()==AdrenoHfiStartupTimeout && result.poll_reads==5 && peer.waits==4);
  }
  setup(1,1);peer.fail_at=1;peer.mode=3;peer.clock_stall=1;
  setup(1,1);peer.fail_at=1;peer.mode=3;services.command_timeout_us=20;
  CHECK(run()==AdrenoHfiStartupTimeout && result.elapsed_us==20 && peer.count==1);
L121: CHECK(run()==AdrenoHfiStartupTimeout && result.elapsed_us==20 && peer.count==1);
  CHECK(run()==AdrenoHfiStartupTimeout && result.poll_reads==5 && peer.waits==4);
  setup(1,1);peer.fail_at=1;peer.mode=3;services.command_timeout_us=20;
  setup(1,1);peer.jump=100;
  CHECK(run()==AdrenoHfiStartupTimeout && peer.count==1 && !result.acknowledged_stages);
L123: CHECK(run()==AdrenoHfiStartupTimeout && peer.count==1 && !result.acknowledged_stages);
  CHECK(run()==AdrenoHfiStartupTimeout && result.elapsed_us==20 && peer.count==1);
  setup(1,1);peer.jump=100;
  setup(1,1);peer.jump=30;services.command_timeout_us=40;services.total_timeout_us=80;
  CHECK(run()==AdrenoHfiStartupTimeout && peer.count==3 && result.elapsed_us==90);
L125: CHECK(run()==AdrenoHfiStartupTimeout && peer.count==3 && result.elapsed_us==90);
  CHECK(run()==AdrenoHfiStartupTimeout && peer.count==1 && !result.acknowledged_stages);
  setup(1,1);peer.jump=30;services.command_timeout_us=40;services.total_timeout_us=80;
  setup(1,1);peer.clock_reverse=3;CHECK(run()==AdrenoHfiStartupClockError && state.poisoned);
  setup(1,1);peer.clock_fail=1;CHECK(run()==AdrenoHfiStartupClockError && !state.attempted && !peer.count);
L126: setup(1,1);peer.clock_reverse=3;CHECK(run()==AdrenoHfiStartupClockError && state.poisoned);
  setup(1,1);peer.jump=30;services.command_timeout_us=40;services.total_timeout_us=80;
  CHECK(run()==AdrenoHfiStartupTimeout && peer.count==3 && result.elapsed_us==90);
  setup(1,1);peer.clock_fail=1;CHECK(run()==AdrenoHfiStartupClockError && !state.attempted && !peer.count);
  setup(1,1);peer.clock_fail=3;CHECK(run()==AdrenoHfiStartupClockError && state.poisoned);
L127: setup(1,1);peer.clock_fail=1;CHECK(run()==AdrenoHfiStartupClockError && !state.attempted && !peer.count);
  CHECK(run()==AdrenoHfiStartupTimeout && peer.count==3 && result.elapsed_us==90);
  setup(1,1);peer.clock_reverse=3;CHECK(run()==AdrenoHfiStartupClockError && state.poisoned);
  setup(1,1);peer.clock_fail=3;CHECK(run()==AdrenoHfiStartupClockError && state.poisoned);
  setup(1,1);peer.fail_at=1;peer.mode=3;peer.wait_fail=1;CHECK(run()==AdrenoHfiStartupWaitError && state.poisoned);
L128: setup(1,1);peer.clock_fail=3;CHECK(run()==AdrenoHfiStartupClockError && state.poisoned);
  setup(1,1);peer.clock_reverse=3;CHECK(run()==AdrenoHfiStartupClockError && state.poisoned);
  setup(1,1);peer.clock_fail=1;CHECK(run()==AdrenoHfiStartupClockError && !state.attempted && !peer.count);
  setup(1,1);peer.fail_at=1;peer.mode=3;peer.wait_fail=1;CHECK(run()==AdrenoHfiStartupWaitError && state.poisoned);
  setup(1,1);peer.health_fail=1;CHECK(run()==AdrenoHfiStartupPlatformFault && !state.attempted && !peer.count);

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\kits\AdrenoFirmware\test_votes.c =====
L3: #include "AdrenoHfiVotes.h"
  /* SPDX-License-Identifier: BSD-2-Clause-Patent */
  /* Arithmetic tests against pinned original-source oracle, no platform access. */
  #include <stdio.h>
  #include <stdlib.h>
L9: extern int source_bandwidth(const uint32_t *,unsigned,const AdrenoHfiBcm *,unsigned,uint32_t,uint32_t [159]);
  #define CHECK(x) do {if(!(x)){fprintf(stderr,"line %d: %s\n",__LINE__,#x);exit(1);}}while(0)
  extern int source_arc(const uint32_t *,unsigned,const uint8_t *,size_t,const uint8_t *,size_t,uint32_t *);
  static uint32_t seed=0x740;
  static uint32_t random32(void){seed^=seed<<13;seed^=seed>>17;seed^=seed<<5;return seed;}
L24: CHECK(AdrenoHfiArcVotes(levels,count,primary+1,512,secondary+1,512,votes,16)==AdrenoHfiStartupSuccess);
  for(unsigned i=1;i<count;++i)levels[i]=levels[i-1]+random32()%4000;
  memset(votes,0xa5,sizeof(votes));memset(expected,0xa5,sizeof(expected));
  CHECK(!source_arc(levels,count,primary+1,512,secondary+1,512,expected));
  CHECK(!memcmp(votes,expected,sizeof(votes)));
L29: CHECK(AdrenoHfiArcVotes(levels,2,primary+1,512,secondary+1,512,votes,16)==AdrenoHfiStartupSuccess && votes[1]==0xffff02ff);
  }
  levels[1]=65535;
  for(unsigned mode=0;mode<8;++mode) {
  uint8_t p[8]={0,0,100,0,200,0,0,0},s[8]={0,0,100,0,0,0,0,0};
L39: CHECK(AdrenoHfiArcVotes(l,count,p,bytes,s,8,votes,capacity)==AdrenoHfiStartupInvalid && !memcmp(before,votes,sizeof(votes)));
  }
  memset(votes,0x5a,sizeof(votes));memcpy(before,votes,sizeof(votes));
  }
  }
L45: AdrenoHfiBcm b[3];AdrenoHfiStartupConfig c;
  {
  uint32_t bw[16]={0},expected[159],actual[159],id;size_t words;
  for(unsigned run=0;run<1000;++run) {
  unsigned count=2+random32()%15,n=1+random32()%3;
L51: b[j]=(AdrenoHfiBcm){.address=0x1000+4*j,.unit=1+random32(),.width=1+random32()%65535,
  if(run%5==0){count=2;bw[1]=UINT32_MAX;}
  for(unsigned j=0;j<n;++j) {
  .buswidth=1+random32()%65535,.vcd=random32()%3,.fixed=j==2,.perfmode=j==2?8:0,.perfmode_kbps=j==2?16500000:0};
  if(run%7==0){b[j].unit=1;b[j].width=65535;b[j].buswidth=1;}
L56: c=(AdrenoHfiStartupConfig){.gpu_count=2,.gmu_count=2,.gpu={{0,0},{1000,1}},.gmu={{0,0},{2000,1}},.enable_ifpc=1};
  if(run%11==0){b[j].unit=UINT32_MAX;b[j].width=1;b[j].buswidth=65535;}
  }
  CHECK(AdrenoHfiBuildBandwidth(bw,count,b,n,0x2000,&c)==AdrenoHfiStartupSuccess);
  CHECK(c.enable_ifpc==1 && c.gpu[1].hz==1000 && c.gmu[1].vote==1);
L57: CHECK(AdrenoHfiBuildBandwidth(bw,count,b,n,0x2000,&c)==AdrenoHfiStartupSuccess);
  }
  c=(AdrenoHfiStartupConfig){.gpu_count=2,.gmu_count=2,.gpu={{0,0},{1000,1}},.gmu={{0,0},{2000,1}},.enable_ifpc=1};
  CHECK(c.enable_ifpc==1 && c.gpu[1].hz==1000 && c.gmu[1].vote==1);
  CHECK(AdrenoHfiStartupEncode(&c,AdrenoHfiStageBandwidth,&id,actual,159,&words)==AdrenoHfiStartupSuccess && id==3 && words==159);
L58: CHECK(c.enable_ifpc==1 && c.gpu[1].hz==1000 && c.gmu[1].vote==1);
  c=(AdrenoHfiStartupConfig){.gpu_count=2,.gmu_count=2,.gpu={{0,0},{1000,1}},.gmu={{0,0},{2000,1}},.enable_ifpc=1};
  CHECK(AdrenoHfiBuildBandwidth(bw,count,b,n,0x2000,&c)==AdrenoHfiStartupSuccess);
  CHECK(AdrenoHfiStartupEncode(&c,AdrenoHfiStageBandwidth,&id,actual,159,&words)==AdrenoHfiStartupSuccess && id==3 && words==159);
  CHECK(!source_bandwidth(bw,count,b,n,0x2000,expected) && !memcmp(actual,expected,sizeof(actual)));
L59: CHECK(AdrenoHfiStartupEncode(&c,AdrenoHfiStageBandwidth,&id,actual,159,&words)==AdrenoHfiStartupSuccess && id==3 && words==159);
  CHECK(AdrenoHfiBuildBandwidth(bw,count,b,n,0x2000,&c)==AdrenoHfiStartupSuccess);
  CHECK(c.enable_ifpc==1 && c.gpu[1].hz==1000 && c.gmu[1].vote==1);
  CHECK(!source_bandwidth(bw,count,b,n,0x2000,expected) && !memcmp(actual,expected,sizeof(actual)));
  }
L63: AdrenoHfiStartupConfig before;c=(AdrenoHfiStartupConfig){.gpu_count=7};before=c;
  }
  for(unsigned mode=0;mode<12;++mode) {
  b[0]=(AdrenoHfiBcm){.address=0x1000,.unit=1000,.width=4,.buswidth=4};b[1]=b[0];b[1].address+=4;
  bw[0]=0;bw[1]=16500000;unsigned n=2,count=2,cn0=0x2000;
L64: b[0]=(AdrenoHfiBcm){.address=0x1000,.unit=1000,.width=4,.buswidth=4};b[1]=b[0];b[1].address+=4;
  for(unsigned mode=0;mode<12;++mode) {
  AdrenoHfiStartupConfig before;c=(AdrenoHfiStartupConfig){.gpu_count=7};before=c;
  bw[0]=0;bw[1]=16500000;unsigned n=2,count=2,cn0=0x2000;
  switch(mode) {
L72: CHECK(AdrenoHfiBuildBandwidth(bw,count,b,n,cn0,&c)==AdrenoHfiStartupInvalid && !memcmp(&before,&c,sizeof(c)));
  case 8:bw[1]=0;break;case 9:count=17;break;case 10:n=4;break;case 11:b[0].perfmode=0xffff;break;
  }
  }
  uint8_t aux[9]={0,0xe8,3,0,0,16,0,2,0};b[0]=(AdrenoHfiBcm){.address=0x1000,.buswidth=4};
L74: uint8_t aux[9]={0,0xe8,3,0,0,16,0,2,0};b[0]=(AdrenoHfiBcm){.address=0x1000,.buswidth=4};
  CHECK(AdrenoHfiBuildBandwidth(bw,count,b,n,cn0,&c)==AdrenoHfiStartupInvalid && !memcmp(&before,&c,sizeof(c)));
  }
  CHECK(AdrenoHfiBcmAux(b,aux+1,8)==AdrenoHfiStartupSuccess && b[0].unit==1000 && b[0].width==16 && b[0].vcd==2 && b[0].buswidth==4 && b[0].address==0x1000);
  AdrenoHfiBcm before=b[0];aux[8]=1;
L75: CHECK(AdrenoHfiBcmAux(b,aux+1,8)==AdrenoHfiStartupSuccess && b[0].unit==1000 && b[0].width==16 && b[0].vcd==2 && b[0].buswidth==4 && b[0].address==0x1000);
  }
  uint8_t aux[9]={0,0xe8,3,0,0,16,0,2,0};b[0]=(AdrenoHfiBcm){.address=0x1000,.buswidth=4};
  AdrenoHfiBcm before=b[0];aux[8]=1;
  CHECK(AdrenoHfiBcmAux(b,aux+1,8)==AdrenoHfiStartupInvalid && !memcmp(b,&before,sizeof(before)));
L76: AdrenoHfiBcm before=b[0];aux[8]=1;
  uint8_t aux[9]={0,0xe8,3,0,0,16,0,2,0};b[0]=(AdrenoHfiBcm){.address=0x1000,.buswidth=4};
  CHECK(AdrenoHfiBcmAux(b,aux+1,8)==AdrenoHfiStartupSuccess && b[0].unit==1000 && b[0].width==16 && b[0].vcd==2 && b[0].buswidth==4 && b[0].address==0x1000);
  CHECK(AdrenoHfiBcmAux(b,aux+1,8)==AdrenoHfiStartupInvalid && !memcmp(b,&before,sizeof(before)));
  CHECK(AdrenoHfiBcmAux(b,aux+1,7)==AdrenoHfiStartupInvalid && !memcmp(b,&before,sizeof(before)));
L77: CHECK(AdrenoHfiBcmAux(b,aux+1,8)==AdrenoHfiStartupInvalid && !memcmp(b,&before,sizeof(before)));
  CHECK(AdrenoHfiBcmAux(b,aux+1,8)==AdrenoHfiStartupSuccess && b[0].unit==1000 && b[0].width==16 && b[0].vcd==2 && b[0].buswidth==4 && b[0].address==0x1000);
  AdrenoHfiBcm before=b[0];aux[8]=1;
  CHECK(AdrenoHfiBcmAux(b,aux+1,7)==AdrenoHfiStartupInvalid && !memcmp(b,&before,sizeof(before)));
  /* Explicit threshold and saturation/minimum cases with known wire values. */
L78: CHECK(AdrenoHfiBcmAux(b,aux+1,7)==AdrenoHfiStartupInvalid && !memcmp(b,&before,sizeof(before)));
  AdrenoHfiBcm before=b[0];aux[8]=1;
  CHECK(AdrenoHfiBcmAux(b,aux+1,8)==AdrenoHfiStartupInvalid && !memcmp(b,&before,sizeof(before)));
  /* Explicit threshold and saturation/minimum cases with known wire values. */
  b[0]=(AdrenoHfiBcm){.address=0x1000,.fixed=1,.perfmode=8,.perfmode_kbps=16500000};
L80: b[0]=(AdrenoHfiBcm){.address=0x1000,.fixed=1,.perfmode=8,.perfmode_kbps=16500000};
  CHECK(AdrenoHfiBcmAux(b,aux+1,7)==AdrenoHfiStartupInvalid && !memcmp(b,&before,sizeof(before)));
  /* Explicit threshold and saturation/minimum cases with known wire values. */
  uint32_t edge[]={0,16499999,16500000,16500001};
  CHECK(AdrenoHfiBuildBandwidth(edge,4,b,1,0x2000,&c)==AdrenoHfiStartupSuccess);
L82: CHECK(AdrenoHfiBuildBandwidth(edge,4,b,1,0x2000,&c)==AdrenoHfiStartupSuccess);
  b[0]=(AdrenoHfiBcm){.address=0x1000,.fixed=1,.perfmode=8,.perfmode_kbps=16500000};
  uint32_t edge[]={0,16499999,16500000,16500001};
  CHECK(c.ddr_data[0][0]==0x40000000 && c.ddr_data[1][0]==0x60000000 && c.ddr_data[2][0]==0x60000008 && c.ddr_data[3][0]==0x60000008);
  }
L89: puts("Arithmetic and software inputs only; no actual command-db, rail ownership, power or GMU execution claim");
  arc_tests();bandwidth_tests();
  puts("PASS: 1000 ARC + 1000 BCM original-source differential cases, full bandwidth wire layout, 22 refusal controls, unaligned aux, index/threshold/clamp boundaries");
  }

===== C:\Users\qwertyhorik\Desktop\Ios\SWEETGPU_RESEARCH\UPSTREAM_READONLY\UNIXNU_SWEET_DARWIN23-d3dd6fdf9e88\tests\test_hfi_legacy.c =====
L2: /* A software peer. No actual GMU, device, DMA or firmware is executed. */
  /* SPDX-License-Identifier: BSD-2-Clause-Patent */
  #include "AdrenoHfi.h"
  #include "AdrenoHfiStartup.h"
L3: #include "AdrenoHfi.h"
  /* SPDX-License-Identifier: BSD-2-Clause-Patent */
  /* A software peer. No actual GMU, device, DMA or firmware is executed. */
  #include "AdrenoHfiStartup.h"
  #include <assert.h>
L4: #include "AdrenoHfiStartup.h"
  /* A software peer. No actual GMU, device, DMA or firmware is executed. */
  #include "AdrenoHfi.h"
  #include <assert.h>
  #include <stdio.h>
L10: static AdrenoHfi h;
  
  static _Alignas(4096) uint32_t shared[4096], before[4096];
  static unsigned notifications, fail_notify, reply_immediately;
  
L38: assert(AdrenoHfiInitializeLegacyStopped(&h, shared, sizeof(shared),
  memset(&h, 0, sizeof(h));
  memset(shared, 0xa5, sizeof(shared));
  0x60009000, &h, notify) == AdrenoHfiSuccess);
  assert(h.legacy == 1);
L39: 0x60009000, &h, notify) == AdrenoHfiSuccess);
  memset(shared, 0xa5, sizeof(shared));
  assert(AdrenoHfiInitializeLegacyStopped(&h, shared, sizeof(shared),
  assert(h.legacy == 1);
  }
L65: assert(AdrenoHfiSend(&h, 1, input, words, &header) == AdrenoHfiSuccess);
  unsigned at = positions[position];
  shared[16] = shared[17] = at;
  assert(notifications == 1 && header == (0x100000 | ((words + 1) << 8) | 1));
  assert(shared[1024 + at] == header);
L77: assert(AdrenoHfiPoll(&h, output, 16, &returned, &error) == AdrenoHfiSuccess);
  reply(response_words, header, 0);
  memset(output, 0x5a, sizeof(output));
  assert(returned == response_words && !error && !h.pending_header && !h.poisoned);
  assert(shared[28] == ((at + 3 + response_words) & 1023));
L87: assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiNoSpace);
  reset(); shared[16] = 1;
  memcpy(before, shared, sizeof(shared));
  assert(!memcmp(shared, before, sizeof(shared)) && !notifications);
  reset(); shared[16] = 2;
L90: assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiSuccess && shared[17] == 1);
  assert(!memcmp(shared, before, sizeof(shared)) && !notifications);
  reset(); shared[16] = 2;
  
  reset(); fail_notify = 1;
L93: assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiNotifyError);
  
  reset(); fail_notify = 1;
  assert(h.poisoned && h.pending_header && shared[17] == 1);
  assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiPoisoned && notifications == 1);
L95: assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiPoisoned && notifications == 1);
  assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiNotifyError);
  assert(h.poisoned && h.pending_header && shared[17] == 1);
  
  for (unsigned fault = 0; fault < 7; ++fault) {
L99: assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiSuccess);
  for (unsigned fault = 0; fault < 7; ++fault) {
  reset();
  reply(0, header, 0);
  switch (fault) {
L111: assert(AdrenoHfiPoll(&h, output, 16, &returned, &error) == AdrenoHfiCorrupt);
  }
  memset(output, 0x5a, sizeof(output));
  assert(h.poisoned && h.pending_header && returned == 0);
  for (unsigned index = 0; index < 16; ++index) assert(output[index] == 0x5a5a5a5a);
L116: assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiSuccess);
  }
  reset();
  reply(0, header + (1u << 20), 0);
  reply(0, header, 0);
L119: assert(AdrenoHfiPoll(&h, output, 16, &returned, &error) == AdrenoHfiSuccess && h.skipped == 1);
  reply(0, header + (1u << 20), 0);
  reply(0, header, 0);
  reset();
  assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiSuccess);
L121: assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiSuccess);
  assert(AdrenoHfiPoll(&h, output, 16, &returned, &error) == AdrenoHfiSuccess && h.skipped == 1);
  reset();
  reply(0, header, 7);
  assert(AdrenoHfiPoll(&h, output, 16, &returned, &error) == AdrenoHfiFirmwareError && error == 7);
L123: assert(AdrenoHfiPoll(&h, output, 16, &returned, &error) == AdrenoHfiFirmwareError && error == 7);
  assert(AdrenoHfiSend(&h, 1, NULL, 0, &header) == AdrenoHfiSuccess);
  reply(0, header, 7);
  reset();
  assert(AdrenoHfiExchange(&h, 1, NULL, 0, 2, NULL, output, 16, &returned, &error) == AdrenoHfiTimeout);
L125: assert(AdrenoHfiExchange(&h, 1, NULL, 0, 2, NULL, output, 16, &returned, &error) == AdrenoHfiTimeout);
  assert(AdrenoHfiPoll(&h, output, 16, &returned, &error) == AdrenoHfiFirmwareError && error == 7);
  reset();
  assert(h.poisoned && notifications == 1);
  reset(); reply_immediately = 1;
L130: assert(AdrenoHfiExchange(&h, 1, NULL, 0, 1, NULL, output, 16, &returned, &error) == AdrenoHfiSuccess);
  for (unsigned index = 0; index < 4100; ++index) {
  shared[16] = shared[17];
  assert(h.sequence == (index + 1) % 4095);
  }
L134: AdrenoHfiStartup state = {0};
  }
  reset();
  AdrenoHfiStartupResult result;
  assert(AdrenoHfiStartupRun(&state, &h, NULL, NULL, &result) == AdrenoHfiStartupInvalid);
L135: AdrenoHfiStartupResult result;
  reset();
  AdrenoHfiStartup state = {0};
  assert(AdrenoHfiStartupRun(&state, &h, NULL, NULL, &result) == AdrenoHfiStartupInvalid);
  assert(!notifications && !state.attempted && !h.pending_header);
L136: assert(AdrenoHfiStartupRun(&state, &h, NULL, NULL, &result) == AdrenoHfiStartupInvalid);
  AdrenoHfiStartup state = {0};
  AdrenoHfiStartupResult result;
  assert(!notifications && !state.attempted && !h.pending_header);
  assert(cases == 2295);
L139: printf("PASS: %u legacy HFI ring/response cases, 4100 sequence exchanges, failure quarantine\n", cases);
  assert(!notifications && !state.attempted && !h.pending_header);
  assert(cases == 2295);
  puts("Software peer only; no real firmware ACK or GPU execution");
  return 0;
L140: puts("Software peer only; no real firmware ACK or GPU execution");
  assert(cases == 2295);
  printf("PASS: %u legacy HFI ring/response cases, 4100 sequence exchanges, failure quarantine\n", cases);
  return 0;
  }