adreno_gen8.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2021, The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2023-2024, Qualcomm Innovation Center, Inc. All rights reserved.
  5. */
  6. #ifndef _ADRENO_GEN8_H_
  7. #define _ADRENO_GEN8_H_
  8. #include <linux/delay.h>
  9. #include "adreno_gen8_gmu.h"
  10. #include "gen8_reg.h"
  11. /* Forward struct declaration */
  12. struct gen8_snapshot_block_list;
  13. extern const struct adreno_power_ops gen8_gmu_power_ops;
  14. extern const struct adreno_power_ops gen8_hwsched_power_ops;
  15. extern const struct adreno_perfcounters adreno_gen8_perfcounters;
  16. struct gen8_gpudev {
  17. struct adreno_gpudev base;
  18. int (*hfi_probe)(struct adreno_device *adreno_dev);
  19. void (*hfi_remove)(struct adreno_device *adreno_dev);
  20. void (*handle_watchdog)(struct adreno_device *adreno_dev);
  21. };
  22. extern const struct gen8_gpudev adreno_gen8_gmu_gpudev;
  23. extern const struct gen8_gpudev adreno_gen8_hwsched_gpudev;
  24. struct gen8_nonctxt_overrides {
  25. /** offset: Dword offset of the register to write */
  26. u32 offset;
  27. /** pipelines: Pipelines to write */
  28. u32 pipelines;
  29. /** val: Value to be written to the register */
  30. u32 val;
  31. /** set: True for user override request */
  32. bool set;
  33. /**
  34. * list_type: 0 If the register already present in any of exisiting static pwrup list
  35. 1 if the register fits into IFPC static pwrup only list
  36. 2 if the register fits into IFPC + preemption static list
  37. 3 if the register fits into external powerup list
  38. */
  39. u32 list_type;
  40. };
  41. /**
  42. * struct gen8_device - Container for the gen8_device
  43. */
  44. struct gen8_device {
  45. /** @gmu: Container for the gen8 GMU device */
  46. struct gen8_gmu_device gmu;
  47. /** @adreno_dev: Container for the generic adreno device */
  48. struct adreno_device adreno_dev;
  49. /** @aperture: The last value that the host aperture register was programmed to */
  50. u32 aperture;
  51. /** @ext_pwrup_list_len: External pwrup reglist length */
  52. u16 ext_pwrup_list_len;
  53. /**
  54. * @nc_overrides: Noncontext registers overrides whitelist if defined,
  55. * must be null terminated
  56. */
  57. struct gen8_nonctxt_overrides *nc_overrides;
  58. /** @nc_mutex: Mutex to protect nc_overrides updates */
  59. struct mutex nc_mutex;
  60. /** @nc_overrides_enabled: Set through debugfs path when any override is enabled */
  61. bool nc_overrides_enabled;
  62. };
  63. /**
  64. * struct gen8_pwrup_extlist - container for a powerup external reglist
  65. */
  66. struct gen8_pwrup_extlist {
  67. /** offset: Dword offset of the register to write */
  68. u32 offset;
  69. /** pipelines: pipelines to write */
  70. u32 pipelines;
  71. };
  72. /**
  73. * struct gen8_protected_regs - container for a protect register span
  74. */
  75. struct gen8_protected_regs {
  76. /** @reg: Physical protected mode register to write to */
  77. u32 reg;
  78. /** @start: Dword offset of the starting register in the range */
  79. u32 start;
  80. /** @end: Dword offset of the ending register in the range (inclusive) */
  81. u32 end;
  82. /**
  83. * @noaccess: 1 if the register should not be accessible from
  84. * userspace, 0 if it can be read (but not written)
  85. */
  86. u32 noaccess;
  87. };
  88. /**
  89. * struct gen8_nonctxt_regs - Container for non context registers span
  90. */
  91. struct gen8_nonctxt_regs {
  92. /** @offset: Dword offset of the register to write */
  93. u32 offset;
  94. /** @val: Value to write */
  95. u32 val;
  96. /** @pipelines: pipelines to write */
  97. u32 pipelines;
  98. };
  99. /**
  100. * struct adreno_gen8_core - gen8 specific GPU core definitions
  101. */
  102. struct adreno_gen8_core {
  103. /** @base: Container for the generic GPU definitions */
  104. struct adreno_gpu_core base;
  105. /** @gmu_fw_version: Minimum firmware version required to support this core */
  106. u32 gmu_fw_version;
  107. /** @sqefw_name: Name of the SQE microcode file */
  108. const char *sqefw_name;
  109. /** @aqefw_name: Name of the AQE microcode file */
  110. const char *aqefw_name;
  111. /** @gmufw_name: Name of the GMU firmware file */
  112. const char *gmufw_name;
  113. /** @zap_name: Name of the CPZ zap file */
  114. const char *zap_name;
  115. /** @ao_hwcg: List of registers and values to write for HWCG in AO block */
  116. const struct kgsl_regmap_list *ao_hwcg;
  117. /** @ao_hwcg_count: Number of registers in @ao_hwcg */
  118. u32 ao_hwcg_count;
  119. /** @gbif: List of registers and values to write for GBIF */
  120. const struct kgsl_regmap_list *gbif;
  121. /** @gbif_count: Number of registers in @gbif */
  122. u32 gbif_count;
  123. /** @hang_detect_cycles: Hang detect counter timeout value */
  124. u32 hang_detect_cycles;
  125. /** @protected_regs: Array of protected registers for the target */
  126. const struct gen8_protected_regs *protected_regs;
  127. /** @nonctxt_regs: Array of non context register list */
  128. const struct gen8_nonctxt_regs *nonctxt_regs;
  129. /** @ctxt_record_size: Size of the preemption record in bytes */
  130. u64 ctxt_record_size;
  131. /** @highest_bank_bit: Highest bank bit value */
  132. u32 highest_bank_bit;
  133. /** @gen8_snapshot_block_list: Device-specific blocks dumped in the snapshot */
  134. const struct gen8_snapshot_block_list *gen8_snapshot_block_list;
  135. /** @gmu_hub_clk_freq: Gmu hub interface clock frequency */
  136. u64 gmu_hub_clk_freq;
  137. /**
  138. * @bcl_data: bit 0 contains response type for bcl alarms and bits 1:21 controls sid vals
  139. * to configure throttle levels for bcl alarm levels 0-2. If sid vals are not set,
  140. * gmu fw sets default throttle levels.
  141. */
  142. u32 bcl_data;
  143. /** @preempt_level: Preemption level valid ranges [0 to 2] */
  144. u32 preempt_level;
  145. /** @qos_value: GPU qos value to set for each RB. */
  146. const u32 *qos_value;
  147. /**
  148. * @acv_perfmode_ddr_freq: Vote perfmode when DDR frequency >= acv_perfmode_ddr_freq.
  149. * If not specified, vote perfmode for highest DDR level only.
  150. */
  151. u32 acv_perfmode_ddr_freq;
  152. /** @rt_bus_hint: IB level hint for real time clients i.e. RB-0 */
  153. const u32 rt_bus_hint;
  154. /** @fast_bus_hint: Whether or not to increase IB vote on high ddr stall */
  155. bool fast_bus_hint;
  156. /** @noc_timeout_us: GPU config NOC port timeout in usec */
  157. u32 noc_timeout_us;
  158. };
  159. /**
  160. * struct gen8_cp_preemption_record - CP context record for
  161. * preemption.
  162. * @magic: (00) Value at this offset must be equal to
  163. * GEN8_CP_CTXRECORD_MAGIC_REF.
  164. * @info: (04) Type of record. Written non-zero (usually) by CP.
  165. * we must set to zero for all ringbuffers.
  166. * @errno: (08) Error code. Initialize this to GEN8_CP_CTXRECORD_ERROR_NONE.
  167. * CP will update to another value if a preemption error occurs.
  168. * @data: (12) DATA field in YIELD and SET_MARKER packets.
  169. * Written by CP when switching out. Not used on switch-in. Initialized to 0.
  170. * @cntl: (16) RB_CNTL, saved and restored by CP. We must initialize this.
  171. * @rptr: (20) RB_RPTR, saved and restored by CP. We must initialize this.
  172. * @wptr: (24) RB_WPTR, saved and restored by CP. We must initialize this.
  173. * @_pad28: (28) Reserved/padding.
  174. * @rptr_addr: (32) RB_RPTR_ADDR_LO|HI saved and restored. We must initialize.
  175. * rbase: (40) RB_BASE_LO|HI saved and restored.
  176. * counter: (48) Pointer to preemption counter.
  177. * @bv_rptr_addr: (56) BV_RB_RPTR_ADDR_LO|HI save and restored. We must initialize.
  178. */
  179. struct gen8_cp_preemption_record {
  180. u32 magic;
  181. u32 info;
  182. u32 errno;
  183. u32 data;
  184. u32 cntl;
  185. u32 rptr;
  186. u32 wptr;
  187. u32 _pad28;
  188. u64 rptr_addr;
  189. u64 rbase;
  190. u64 counter;
  191. u64 bv_rptr_addr;
  192. };
  193. /**
  194. * struct gen8_cp_smmu_info - CP preemption SMMU info.
  195. * @magic: (00) The value at this offset must be equal to
  196. * GEN8_CP_SMMU_INFO_MAGIC_REF
  197. * @_pad4: (04) Reserved/padding
  198. * @ttbr0: (08) Base address of the page table for the * incoming context
  199. * @asid: (16) Address Space IDentifier (ASID) of the incoming context
  200. * @context_idr: (20) Context Identification Register value
  201. * @context_bank: (24) Which Context Bank in SMMU to update
  202. */
  203. struct gen8_cp_smmu_info {
  204. u32 magic;
  205. u32 _pad4;
  206. u64 ttbr0;
  207. u32 asid;
  208. u32 context_idr;
  209. u32 context_bank;
  210. };
  211. #define GEN8_CP_SMMU_INFO_MAGIC_REF 0x241350d5UL
  212. #define GEN8_CP_CTXRECORD_MAGIC_REF 0xae399d6eUL
  213. /* Size of each CP preemption record */
  214. #define GEN8_CP_CTXRECORD_SIZE_IN_BYTES (13536 * SZ_1K)
  215. /* Size of preemption record to be dumped in snapshot */
  216. #define GEN8_SNAPSHOT_CTXRECORD_SIZE_IN_BYTES (128 * 1024)
  217. /* Size of the user context record block (in bytes) */
  218. #define GEN8_CP_CTXRECORD_USER_RESTORE_SIZE (192 * 1024)
  219. /* Size of the performance counter save/restore block (in bytes) */
  220. #define GEN8_CP_PERFCOUNTER_SAVE_RESTORE_SIZE (4 * 1024)
  221. #define GEN8_CP_RB_CNTL_DEFAULT \
  222. (FIELD_PREP(GENMASK(7, 0), ilog2(KGSL_RB_DWORDS >> 1)) | \
  223. FIELD_PREP(GENMASK(12, 8), ilog2(4)))
  224. /* Size of the CP_INIT pm4 stream in dwords */
  225. #define GEN8_CP_INIT_DWORDS 10
  226. #define GEN8_INT_MASK \
  227. ((1 << GEN8_INT_AHBERROR) | \
  228. (1 << GEN8_INT_ATBASYNCFIFOOVERFLOW) | \
  229. (1 << GEN8_INT_GPCERROR) | \
  230. (1 << GEN8_INT_SWINTERRUPT) | \
  231. (1 << GEN8_INT_HWERROR) | \
  232. (1 << GEN8_INT_PM4CPINTERRUPT) | \
  233. (1 << GEN8_INT_RB_DONE_TS) | \
  234. (1 << GEN8_INT_CACHE_CLEAN_TS) | \
  235. (1 << GEN8_INT_ATBBUSOVERFLOW) | \
  236. (1 << GEN8_INT_HANGDETECTINTERRUPT) | \
  237. (1 << GEN8_INT_OUTOFBOUNDACCESS) | \
  238. (1 << GEN8_INT_UCHETRAPINTERRUPT) | \
  239. (1 << GEN8_INT_TSBWRITEERROR) | \
  240. (1 << GEN8_INT_SWFUSEVIOLATION))
  241. #define GEN8_HWSCHED_INT_MASK \
  242. ((1 << GEN8_INT_AHBERROR) | \
  243. (1 << GEN8_INT_ATBASYNCFIFOOVERFLOW) | \
  244. (1 << GEN8_INT_ATBBUSOVERFLOW) | \
  245. (1 << GEN8_INT_OUTOFBOUNDACCESS) | \
  246. (1 << GEN8_INT_UCHETRAPINTERRUPT) | \
  247. (1 << GEN8_INT_TSBWRITEERROR))
  248. /* GEN8 CX MISC interrupt bits */
  249. #define GEN8_CX_MISC_GPU_CC_IRQ 31
  250. #define GEN8_CX_MISC_INT_MASK BIT(GEN8_CX_MISC_GPU_CC_IRQ)
  251. /**
  252. * to_gen8_core - return the gen8 specific GPU core struct
  253. * @adreno_dev: An Adreno GPU device handle
  254. *
  255. * Returns:
  256. * A pointer to the gen8 specific GPU core struct
  257. */
  258. static inline const struct adreno_gen8_core *
  259. to_gen8_core(struct adreno_device *adreno_dev)
  260. {
  261. const struct adreno_gpu_core *core = adreno_dev->gpucore;
  262. return container_of(core, struct adreno_gen8_core, base);
  263. }
  264. /* Preemption functions */
  265. void gen8_preemption_trigger(struct adreno_device *adreno_dev, bool atomic);
  266. void gen8_preemption_schedule(struct adreno_device *adreno_dev);
  267. void gen8_preemption_start(struct adreno_device *adreno_dev);
  268. int gen8_preemption_init(struct adreno_device *adreno_dev);
  269. u32 gen8_preemption_post_ibsubmit(struct adreno_device *adreno_dev,
  270. u32 *cmds);
  271. u32 gen8_preemption_pre_ibsubmit(struct adreno_device *adreno_dev,
  272. struct adreno_ringbuffer *rb, struct adreno_context *drawctxt,
  273. u32 *cmds);
  274. u32 gen8_set_marker(u32 *cmds, enum adreno_cp_marker_type type);
  275. void gen8_preemption_callback(struct adreno_device *adreno_dev, int bit);
  276. int gen8_preemption_context_init(struct kgsl_context *context);
  277. void gen8_preemption_context_destroy(struct kgsl_context *context);
  278. void gen8_preemption_prepare_postamble(struct adreno_device *adreno_dev);
  279. void gen8_snapshot(struct adreno_device *adreno_dev,
  280. struct kgsl_snapshot *snapshot);
  281. void gen8_crashdump_init(struct adreno_device *adreno_dev);
  282. /**
  283. * gen8_snapshot_external_core_regs - Dump external registers into snapshot
  284. * @device: Pointer to KGSL device
  285. * @snapshot: Pointer to the snapshot
  286. *
  287. * Dump external core registers like GPUCC, CPR into GPU snapshot.
  288. */
  289. void gen8_snapshot_external_core_regs(struct kgsl_device *device,
  290. struct kgsl_snapshot *snapshot);
  291. /**
  292. * gen8_enable_ahb_timeout_detection - Program AHB control registers
  293. * @adreno_dev: An Adreno GPU handle
  294. *
  295. * Program AHB control registers to enable AHB timeout detection.
  296. *
  297. */
  298. void gen8_enable_ahb_timeout_detection(struct adreno_device *adreno_dev);
  299. /**
  300. * gen8_start - Program gen8 registers
  301. * @adreno_dev: An Adreno GPU handle
  302. *
  303. * This function does all gen8 register programming every
  304. * time we boot the gpu
  305. *
  306. * Return: 0 on success or negative on failure
  307. */
  308. int gen8_start(struct adreno_device *adreno_dev);
  309. /**
  310. * gen8_init - Initialize gen8 resources
  311. * @adreno_dev: An Adreno GPU handle
  312. *
  313. * This function does gen8 specific one time initialization
  314. * and is invoked when the very first client opens a
  315. * kgsl instance
  316. *
  317. * Return: Zero on success and negative error on failure
  318. */
  319. int gen8_init(struct adreno_device *adreno_dev);
  320. /**
  321. * gen8_cx_timer_init - Initialize the CX timer on Gen8 devices
  322. * @adreno_dev: Pointer to the adreno device
  323. *
  324. * Synchronize the GPU CX timer (if we have one) with the CPU timer
  325. */
  326. void gen8_cx_timer_init(struct adreno_device *adreno_dev);
  327. /**
  328. * gen8_get_gpu_feature_info - Get hardware supported feature info
  329. * @adreno_dev: Pointer to the adreno device
  330. *
  331. * Get HW supported feature info and update sofware feature configuration
  332. */
  333. void gen8_get_gpu_feature_info(struct adreno_device *adreno_dev);
  334. /**
  335. * gen8_rb_start - Gen8 specific ringbuffer setup
  336. * @adreno_dev: An Adreno GPU handle
  337. *
  338. * This function does gen8 specific ringbuffer setup and
  339. * attempts to submit CP INIT and bring GPU out of secure mode
  340. *
  341. * Return: Zero on success and negative error on failure
  342. */
  343. int gen8_rb_start(struct adreno_device *adreno_dev);
  344. /**
  345. * gen8_microcode_read - Get the cp microcode from the filesystem
  346. * @adreno_dev: An Adreno GPU handle
  347. *
  348. * This function gets the firmware from filesystem and sets up
  349. * the micorocode global buffer
  350. *
  351. * Return: Zero on success and negative error on failure
  352. */
  353. int gen8_microcode_read(struct adreno_device *adreno_dev);
  354. /**
  355. * gen8_probe_common - Probe common gen8 resources
  356. * @pdev: Pointer to the platform device
  357. * @adreno_dev: Pointer to the adreno device
  358. * @chipid: Chipid of the target
  359. * @gpucore: Pointer to the gpucore strucure
  360. *
  361. * This function sets up the gen8 resources common across all
  362. * gen8 targets
  363. */
  364. int gen8_probe_common(struct platform_device *pdev,
  365. struct adreno_device *adreno_dev, u32 chipid,
  366. const struct adreno_gpu_core *gpucore);
  367. /**
  368. * gen8_hw_isidle - Check whether gen8 gpu is idle or not
  369. * @adreno_dev: An Adreno GPU handle
  370. *
  371. * Return: True if gpu is idle, otherwise false
  372. */
  373. bool gen8_hw_isidle(struct adreno_device *adreno_dev);
  374. /**
  375. * gen8_spin_idle_debug - Debug logging used when gpu fails to idle
  376. * @adreno_dev: An Adreno GPU handle
  377. *
  378. * This function logs interesting registers and triggers a snapshot
  379. */
  380. void gen8_spin_idle_debug(struct adreno_device *adreno_dev,
  381. const char *str);
  382. /**
  383. * gen8_perfcounter_update - Update the IFPC perfcounter list
  384. * @adreno_dev: An Adreno GPU handle
  385. * @reg: Perfcounter reg struct to add/remove to the list
  386. * @update_reg: true if the perfcounter needs to be programmed by the CPU
  387. * @pipe: pipe id for CP aperture control
  388. * @flags: Flags set for requested perfcounter group
  389. *
  390. * Return: 0 on success or -EBUSY if the lock couldn't be taken
  391. */
  392. int gen8_perfcounter_update(struct adreno_device *adreno_dev,
  393. struct adreno_perfcount_register *reg, bool update_reg, u32 pipe,
  394. unsigned long flags);
  395. /*
  396. * gen8_ringbuffer_init - Initialize the ringbuffers
  397. * @adreno_dev: An Adreno GPU handle
  398. *
  399. * Initialize the ringbuffer(s) for a5xx.
  400. * Return: 0 on success or negative on failure
  401. */
  402. int gen8_ringbuffer_init(struct adreno_device *adreno_dev);
  403. /**
  404. * gen8_ringbuffer_submitcmd - Submit a user command to the ringbuffer
  405. * @adreno_dev: An Adreno GPU handle
  406. * @cmdobj: Pointer to a user command object
  407. * @flags: Internal submit flags
  408. * @time: Optional pointer to a adreno_submit_time container
  409. *
  410. * Return: 0 on success or negative on failure
  411. */
  412. int gen8_ringbuffer_submitcmd(struct adreno_device *adreno_dev,
  413. struct kgsl_drawobj_cmd *cmdobj, u32 flags,
  414. struct adreno_submit_time *time);
  415. /**
  416. * gen8_ringbuffer_submit - Submit a command to the ringbuffer
  417. * @rb: Ringbuffer pointer
  418. * @time: Optional pointer to a adreno_submit_time container
  419. *
  420. * Return: 0 on success or negative on failure
  421. */
  422. int gen8_ringbuffer_submit(struct adreno_ringbuffer *rb,
  423. struct adreno_submit_time *time);
  424. /**
  425. * gen8_fenced_write - Write to a fenced register
  426. * @adreno_dev: An Adreno GPU handle
  427. * @offset: Register offset
  428. * @value: Value to write
  429. * @mask: Expected FENCE_STATUS for successful write
  430. *
  431. * Return: 0 on success or negative on failure
  432. */
  433. int gen8_fenced_write(struct adreno_device *adreno_dev, u32 offset,
  434. u32 value, u32 mask);
  435. /**
  436. * gen87ringbuffer_addcmds - Wrap and submit commands to the ringbuffer
  437. * @adreno_dev: An Adreno GPU handle
  438. * @rb: Ringbuffer pointer
  439. * @drawctxt: Draw context submitting the commands
  440. * @flags: Submission flags
  441. * @in: Input buffer to write to ringbuffer
  442. * @dwords: Dword length of @in
  443. * @timestamp: Draw context timestamp for the submission
  444. * @time: Optional pointer to a adreno_submit_time container
  445. *
  446. * Return: 0 on success or negative on failure
  447. */
  448. int gen8_ringbuffer_addcmds(struct adreno_device *adreno_dev,
  449. struct adreno_ringbuffer *rb, struct adreno_context *drawctxt,
  450. u32 flags, u32 *in, u32 dwords, u32 timestamp,
  451. struct adreno_submit_time *time);
  452. /**
  453. * gen8_cp_init_cmds - Create the CP_INIT commands
  454. * @adreno_dev: An Adreno GPU handle
  455. * @cmd: Buffer to write the CP_INIT commands into
  456. */
  457. void gen8_cp_init_cmds(struct adreno_device *adreno_dev, u32 *cmds);
  458. /**
  459. * gen8_gmu_hfi_probe - Probe Gen8 HFI specific data
  460. * @adreno_dev: An Adreno GPU handle
  461. *
  462. * Return: 0 on success or negative on failure
  463. */
  464. int gen8_gmu_hfi_probe(struct adreno_device *adreno_dev);
  465. static inline const struct gen8_gpudev *
  466. to_gen8_gpudev(const struct adreno_gpudev *gpudev)
  467. {
  468. return container_of(gpudev, struct gen8_gpudev, base);
  469. }
  470. /**
  471. * gen8_reset_preempt_records - Reset the preemption buffers
  472. * @adreno_dev: Handle to the adreno device
  473. *
  474. * Reset the preemption records at the time of hard reset
  475. */
  476. void gen8_reset_preempt_records(struct adreno_device *adreno_dev);
  477. /**
  478. * gen8_rdpm_mx_freq_update - Update the mx frequency
  479. * @gmu: An Adreno GMU handle
  480. * @freq: Frequency in KHz
  481. *
  482. * This function communicates GPU mx frequency(in Mhz) changes to rdpm.
  483. */
  484. void gen8_rdpm_mx_freq_update(struct gen8_gmu_device *gmu, u32 freq);
  485. /**
  486. * gen8_rdpm_cx_freq_update - Update the cx frequency
  487. * @gmu: An Adreno GMU handle
  488. * @freq: Frequency in KHz
  489. *
  490. * This function communicates GPU cx frequency(in Mhz) changes to rdpm.
  491. */
  492. void gen8_rdpm_cx_freq_update(struct gen8_gmu_device *gmu, u32 freq);
  493. /**
  494. * gen8_scm_gpu_init_cx_regs - Program gpu regs for feature support
  495. * @adreno_dev: Handle to the adreno device
  496. *
  497. * Program gpu regs for feature support. Scm call for the same
  498. * is added from kernel version 6.0 onwards.
  499. *
  500. * Return: 0 on success or negative on failure
  501. */
  502. int gen8_scm_gpu_init_cx_regs(struct adreno_device *adreno_dev);
  503. /**
  504. * gen8_legacy_snapshot_registers - Dump registers for GPU/GMU
  505. * @device: Handle to the KGSL device
  506. * @buf: Target buffer to copy the data
  507. * @remain: Buffer size remaining for dump
  508. * @priv: Private data to dump the registers
  509. *
  510. * Return: Size of the section
  511. */
  512. size_t gen8_legacy_snapshot_registers(struct kgsl_device *device,
  513. u8 *buf, size_t remain, void *priv);
  514. /**
  515. * gen8_regread64_aperture - Read 64 bit register values
  516. * @device: Handle to the KGSL device
  517. * @offsetwords_lo: Lower 32 bit address to read
  518. * @offsetwords_hi: Higher 32 bit address to read
  519. * @value: The value of register at offsetwords
  520. * @pipe: Pipe for which the register is to be read
  521. * @slice_id: Slice for which the register is to be read
  522. * @use_slice_id: Set if the value to be read is from a sliced register
  523. *
  524. * This function reads the 64 bit value for registers
  525. */
  526. void gen8_regread64_aperture(struct kgsl_device *device,
  527. u32 offsetwords_lo, u32 offsetwords_hi, u64 *value, u32 pipe,
  528. u32 slice_id, u32 use_slice_id);
  529. /**
  530. * gen8_regread_aperture - Read 32 bit register values
  531. * @device: Handle to the KGSL device
  532. * @offsetwords: 32 bit address to read
  533. * @value: The value of register at offsetwords
  534. * @pipe: Pipe for which the register is to be read
  535. * @slice_id: Slice for which the register is to be read
  536. * @use_slice_id: Set if the value to be read is from a sliced register
  537. *
  538. * This function reads the 32 bit value for registers
  539. */
  540. void gen8_regread_aperture(struct kgsl_device *device,
  541. u32 offsetwords, u32 *value, u32 pipe, u32 slice_id, u32 use_slice_id);
  542. /**
  543. * gen8_host_aperture_set - Program CP aperture register
  544. * @adreno_dev: Handle to the adreno device
  545. * @pipe_id: Pipe for which the register is to be set
  546. * @slice_id: Slice for which the register is to be set
  547. * @use_slice_id: Set if the value to be read is from a sliced register
  548. *
  549. * This function programs CP aperture register
  550. */
  551. void gen8_host_aperture_set(struct adreno_device *adreno_dev, u32 pipe_id,
  552. u32 slice_id, u32 use_slice_id);
  553. #endif