adsprpc_shared.h 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2022-2023, Qualcomm Innovation Center, Inc. All rights reserved.
  5. */
  6. #ifndef ADSPRPC_SHARED_H
  7. #define ADSPRPC_SHARED_H
  8. #include <linux/types.h>
  9. #include <linux/cdev.h>
  10. #define FASTRPC_IOCTL_INVOKE _IOWR('R', 1, struct fastrpc_ioctl_invoke)
  11. #define FASTRPC_IOCTL_MMAP _IOWR('R', 2, struct fastrpc_ioctl_mmap)
  12. #define FASTRPC_IOCTL_MUNMAP _IOWR('R', 3, struct fastrpc_ioctl_munmap)
  13. #define FASTRPC_IOCTL_MMAP_64 _IOWR('R', 14, struct fastrpc_ioctl_mmap_64)
  14. #define FASTRPC_IOCTL_MUNMAP_64 _IOWR('R', 15, struct fastrpc_ioctl_munmap_64)
  15. #define FASTRPC_IOCTL_INVOKE_FD _IOWR('R', 4, struct fastrpc_ioctl_invoke_fd)
  16. #define FASTRPC_IOCTL_SETMODE _IOWR('R', 5, uint32_t)
  17. #define FASTRPC_IOCTL_INIT _IOWR('R', 6, struct fastrpc_ioctl_init)
  18. #define FASTRPC_IOCTL_INVOKE_ATTRS \
  19. _IOWR('R', 7, struct fastrpc_ioctl_invoke_attrs)
  20. #define FASTRPC_IOCTL_GETINFO _IOWR('R', 8, uint32_t)
  21. //#define FASTRPC_IOCTL_GETPERF _IOWR('R', 9, struct fastrpc_ioctl_perf)
  22. #define FASTRPC_IOCTL_INIT_ATTRS _IOWR('R', 10, struct fastrpc_ioctl_init_attrs)
  23. #define FASTRPC_IOCTL_INVOKE_CRC _IOWR('R', 11, struct fastrpc_ioctl_invoke_crc)
  24. #define FASTRPC_IOCTL_CONTROL _IOWR('R', 12, struct fastrpc_ioctl_control)
  25. #define FASTRPC_IOCTL_MUNMAP_FD _IOWR('R', 13, struct fastrpc_ioctl_munmap_fd)
  26. #define FASTRPC_IOCTL_GET_DSP_INFO \
  27. _IOWR('R', 17, struct fastrpc_ioctl_capability)
  28. #define FASTRPC_IOCTL_INVOKE2 _IOWR('R', 18, struct fastrpc_ioctl_invoke2)
  29. #define FASTRPC_IOCTL_MEM_MAP _IOWR('R', 19, struct fastrpc_ioctl_mem_map)
  30. #define FASTRPC_IOCTL_MEM_UNMAP _IOWR('R', 20, struct fastrpc_ioctl_mem_unmap)
  31. #define FASTRPC_IOCTL_INVOKE_PERF \
  32. _IOWR('R', 21, struct fastrpc_ioctl_invoke_perf)
  33. #define FASTRPC_IOCTL_NOTIF_RSP \
  34. _IOWR('R', 22, struct fastrpc_ioctl_notif_rsp)
  35. #define FASTRPC_IOCTL_DSPSIGNAL_CREATE _IOWR('R', 23, struct fastrpc_ioctl_dspsignal_create)
  36. #define FASTRPC_IOCTL_DSPSIGNAL_DESTROY _IOWR('R', 24, struct fastrpc_ioctl_dspsignal_destroy)
  37. #define FASTRPC_IOCTL_DSPSIGNAL_SIGNAL _IOWR('R', 25, struct fastrpc_ioctl_dspsignal_signal)
  38. #define FASTRPC_IOCTL_DSPSIGNAL_WAIT _IOWR('R', 26, struct fastrpc_ioctl_dspsignal_wait)
  39. #define FASTRPC_IOCTL_DSPSIGNAL_CANCEL_WAIT \
  40. _IOWR('R', 27, struct fastrpc_ioctl_dspsignal_cancel_wait)
  41. #define FASTRPC_GLINK_GUID "fastrpcglink-apps-dsp"
  42. #define FASTRPC_SMD_GUID "fastrpcsmd-apps-dsp"
  43. #define DEVICE_NAME "adsprpc-smd"
  44. #define DEVICE_NAME_SECURE "adsprpc-smd-secure"
  45. /* Pre-defined parameter for print gfa structure*/
  46. #define smq_invoke_ctx_params "pid: %d, tgid: %d, handle: %d, sc: 0x%x, fl: %p, fd: %p, magic: %d\n"
  47. #define fastrpc_file_params "fl->tgid: %d, fl->cid: %d, fl->ssrcount: %p, fl->pd: %d, fl->profile: %p, fl->mode: %p, fl->tgid_open: %d, fl->num_cached_buf: %d, num_pers_hdrs: %d, fl->sessionid: %d, fl->servloc_name: %s, fl->file_close: %d, fl->dsp_proc_init: %d,fl->apps: %p, fl->qos_request: %d, fl->dev_minor: %d, fl->debug_buf: %s fl->debug_buf_alloced_attempted: %d, fl->wake_enable: %d, fl->ws_timeout: %d, fl->untrusted_process: %d\n"
  48. #define fastrpc_mmap_params "fd: %d, flags: %p, buf: %p, phys: %p, size : %d, va : %p, map->raddr: %p, len : %d, refs : %d, secure: %d\n"
  49. #define fastrpc_buf_params "buf->fl: %p, buf->phys: %p, buf->virt: %p, buf->size: %d, buf->dma_attr: %ld, buf->raddr: %p, buf->flags: %d, buf->type: %d, buf->in_use: %d\n"
  50. /* Set for buffers that have no virtual mapping in userspace */
  51. #define FASTRPC_ATTR_NOVA 0x1
  52. /* Set for buffers that are NOT dma coherent */
  53. #define FASTRPC_ATTR_NON_COHERENT 0x2
  54. /* Set for buffers that are dma coherent */
  55. #define FASTRPC_ATTR_COHERENT 0x4
  56. /* Fastrpc attribute for keeping the map persistent */
  57. #define FASTRPC_ATTR_KEEP_MAP 0x8
  58. /* Fastrpc attribute for no mapping of fd */
  59. #define FASTRPC_ATTR_NOMAP (16)
  60. /*
  61. * Fastrpc attribute to skip flush by fastrpc
  62. */
  63. #define FASTRPC_ATTR_FORCE_NOFLUSH (32)
  64. /*
  65. * Fastrpc attribute to skip invalidate by fastrpc
  66. */
  67. #define FASTRPC_ATTR_FORCE_NOINVALIDATE (64)
  68. /* Driver should operate in parallel with the co-processor */
  69. #define FASTRPC_MODE_PARALLEL 0
  70. /* Driver should operate in serial mode with the co-processor */
  71. #define FASTRPC_MODE_SERIAL 1
  72. /* Driver should operate in profile mode with the co-processor */
  73. #define FASTRPC_MODE_PROFILE 2
  74. /* Set FastRPC session ID to 1 */
  75. #define FASTRPC_MODE_SESSION 4
  76. /* Retrives number of input buffers from the scalars parameter */
  77. #define REMOTE_SCALARS_INBUFS(sc) (((sc) >> 16) & 0x0ff)
  78. /* Retrives number of output buffers from the scalars parameter */
  79. #define REMOTE_SCALARS_OUTBUFS(sc) (((sc) >> 8) & 0x0ff)
  80. /* Retrives number of input handles from the scalars parameter */
  81. #define REMOTE_SCALARS_INHANDLES(sc) (((sc) >> 4) & 0x0f)
  82. /* Retrives number of output handles from the scalars parameter */
  83. #define REMOTE_SCALARS_OUTHANDLES(sc) ((sc) & 0x0f)
  84. /* Remote domains ID */
  85. #define ADSP_DOMAIN_ID (0)
  86. #define MDSP_DOMAIN_ID (1)
  87. #define SDSP_DOMAIN_ID (2)
  88. #define CDSP_DOMAIN_ID (3)
  89. #define MAX_DOMAIN_ID CDSP_DOMAIN_ID
  90. #define NUM_CHANNELS 4 /* adsp, mdsp, slpi, cdsp*/
  91. #define NUM_SESSIONS 13 /* max 12 compute, 1 cpz */
  92. #define VALID_FASTRPC_CID(cid) \
  93. (cid >= ADSP_DOMAIN_ID && cid < NUM_CHANNELS)
  94. #define REMOTE_SCALARS_LENGTH(sc) (REMOTE_SCALARS_INBUFS(sc) +\
  95. REMOTE_SCALARS_OUTBUFS(sc) +\
  96. REMOTE_SCALARS_INHANDLES(sc) +\
  97. REMOTE_SCALARS_OUTHANDLES(sc))
  98. #define REMOTE_SCALARS_MAKEX(attr, method, in, out, oin, oout) \
  99. ((((uint32_t) (attr) & 0x7) << 29) | \
  100. (((uint32_t) (method) & 0x1f) << 24) | \
  101. (((uint32_t) (in) & 0xff) << 16) | \
  102. (((uint32_t) (out) & 0xff) << 8) | \
  103. (((uint32_t) (oin) & 0x0f) << 4) | \
  104. ((uint32_t) (oout) & 0x0f))
  105. #define REMOTE_SCALARS_MAKE(method, in, out) \
  106. REMOTE_SCALARS_MAKEX(0, method, in, out, 0, 0)
  107. #ifdef VERIFY_PRINT_ERROR
  108. #define VERIFY_EPRINTF(format, ...) pr_err(format, ##__VA_ARGS__)
  109. #else
  110. #define VERIFY_EPRINTF(format, args) ((void)0)
  111. #endif
  112. #ifndef VERIFY_PRINT_INFO
  113. #define VERIFY_IPRINTF(args) ((void)0)
  114. #endif
  115. #ifndef VERIFY
  116. #define __STR__(x) #x ":"
  117. #define __TOSTR__(x) __STR__(x)
  118. #define __FILE_LINE__ __FILE__ ":" __TOSTR__(__LINE__)
  119. #define __ADSPRPC_LINE__ "adsprpc:" __TOSTR__(__LINE__)
  120. #define VERIFY(err, val) \
  121. do {\
  122. VERIFY_IPRINTF(__FILE_LINE__"info: calling: " #val "\n");\
  123. if ((val) == 0) {\
  124. (err) = (err) == 0 ? -1 : (err);\
  125. VERIFY_EPRINTF(__ADSPRPC_LINE__" error: %d: "#val "\n", (err));\
  126. } else {\
  127. VERIFY_IPRINTF(__FILE_LINE__"info: passed: " #val "\n");\
  128. } \
  129. } while (0)
  130. #endif
  131. #define ADSPRPC_ERR(fmt, args...)\
  132. pr_err("Error: adsprpc (%d): %s: %s: " fmt, __LINE__,\
  133. current->comm, __func__, ##args)
  134. #define ADSPRPC_INFO(fmt, args...)\
  135. pr_info("Info: adsprpc (%d): %s: %s: " fmt, __LINE__,\
  136. current->comm, __func__, ##args)
  137. #define ADSPRPC_WARN(fmt, args...)\
  138. pr_warn("Warning: adsprpc (%d): %s: %s: " fmt, __LINE__,\
  139. current->comm, __func__, ##args)
  140. #define ADSPRPC_DEBUG(fmt, args...)\
  141. pr_debug("Debug: adsprpc (%d): %s: %s: " fmt, __LINE__,\
  142. current->comm, __func__, ##args)
  143. #define DEBUG_PRINT_SIZE_LIMIT (512*1024)
  144. #define remote_arg64_t union remote_arg64
  145. struct remote_buf64 {
  146. uint64_t pv;
  147. uint64_t len;
  148. };
  149. struct remote_dma_handle64 {
  150. int fd;
  151. uint32_t offset;
  152. uint32_t len;
  153. };
  154. union remote_arg64 {
  155. struct remote_buf64 buf;
  156. struct remote_dma_handle64 dma;
  157. uint32_t h;
  158. };
  159. #define remote_arg_t union remote_arg
  160. struct remote_buf {
  161. void *pv; /* buffer pointer */
  162. size_t len; /* length of buffer */
  163. };
  164. struct remote_dma_handle {
  165. int fd;
  166. uint32_t offset;
  167. };
  168. union remote_arg {
  169. struct remote_buf buf; /* buffer info */
  170. struct remote_dma_handle dma;
  171. uint32_t h; /* remote handle */
  172. };
  173. struct fastrpc_ioctl_invoke {
  174. uint32_t handle; /* remote handle */
  175. uint32_t sc; /* scalars describing the data */
  176. remote_arg_t *pra; /* remote arguments list */
  177. };
  178. struct fastrpc_ioctl_invoke_fd {
  179. struct fastrpc_ioctl_invoke inv;
  180. int *fds; /* fd list */
  181. };
  182. struct fastrpc_ioctl_invoke_attrs {
  183. struct fastrpc_ioctl_invoke inv;
  184. int *fds; /* fd list */
  185. unsigned int *attrs; /* attribute list */
  186. };
  187. struct fastrpc_ioctl_invoke_crc {
  188. struct fastrpc_ioctl_invoke inv;
  189. int *fds; /* fd list */
  190. unsigned int *attrs; /* attribute list */
  191. unsigned int *crc;
  192. };
  193. struct fastrpc_ioctl_invoke_perf {
  194. struct fastrpc_ioctl_invoke inv;
  195. int *fds;
  196. unsigned int *attrs;
  197. unsigned int *crc;
  198. uint64_t *perf_kernel;
  199. uint64_t *perf_dsp;
  200. };
  201. struct fastrpc_async_job {
  202. uint32_t isasyncjob; /* flag to distinguish async job */
  203. uint64_t jobid; /* job id generated by user */
  204. uint32_t reserved; /* reserved */
  205. };
  206. struct fastrpc_ioctl_invoke_async {
  207. struct fastrpc_ioctl_invoke inv;
  208. int *fds; /* fd list */
  209. unsigned int *attrs; /* attribute list */
  210. unsigned int *crc;
  211. uint64_t *perf_kernel;
  212. uint64_t *perf_dsp;
  213. struct fastrpc_async_job *job; /* async job*/
  214. };
  215. struct fastrpc_ioctl_invoke_async_no_perf {
  216. struct fastrpc_ioctl_invoke inv;
  217. int *fds; /* fd list */
  218. unsigned int *attrs; /* attribute list */
  219. unsigned int *crc;
  220. struct fastrpc_async_job *job; /* async job*/
  221. };
  222. struct fastrpc_ioctl_async_response {
  223. uint64_t jobid;/* job id generated by user */
  224. int result; /* result from DSP */
  225. uint64_t *perf_kernel;
  226. uint64_t *perf_dsp;
  227. uint32_t handle;
  228. uint32_t sc;
  229. };
  230. struct fastrpc_ioctl_notif_rsp {
  231. int domain; /* Domain of User PD */
  232. int session; /* Session ID of User PD */
  233. uint32_t status; /* Status of the process */
  234. };
  235. /* INIT a new process or attach to guestos */
  236. enum fastrpc_init_flags {
  237. FASTRPC_INIT_NO_CREATE = -1,
  238. FASTRPC_INIT_ATTACH = 0,
  239. FASTRPC_INIT_CREATE = 1,
  240. FASTRPC_INIT_CREATE_STATIC = 2,
  241. FASTRPC_INIT_ATTACH_SENSORS = 3,
  242. };
  243. enum fastrpc_invoke2_type {
  244. FASTRPC_INVOKE2_ASYNC = 1,
  245. FASTRPC_INVOKE2_ASYNC_RESPONSE = 2,
  246. FASTRPC_INVOKE2_KERNEL_OPTIMIZATIONS,
  247. FASTRPC_INVOKE2_STATUS_NOTIF,
  248. };
  249. struct fastrpc_ioctl_invoke2 {
  250. uint32_t req; /* type of invocation request */
  251. uintptr_t invparam; /* invocation request param */
  252. uint32_t size; /* size of invocation param */
  253. int err; /* reserved */
  254. };
  255. struct fastrpc_ioctl_init {
  256. uint32_t flags; /* one of FASTRPC_INIT_* macros */
  257. uintptr_t file; /* pointer to elf file */
  258. uint32_t filelen; /* elf file length */
  259. int32_t filefd; /* ION fd for the file */
  260. uintptr_t mem; /* mem for the PD */
  261. uint32_t memlen; /* mem length */
  262. int32_t memfd; /* ION fd for the mem */
  263. };
  264. struct fastrpc_ioctl_init_attrs {
  265. struct fastrpc_ioctl_init init;
  266. int attrs;
  267. unsigned int siglen;
  268. };
  269. struct fastrpc_ioctl_munmap {
  270. uintptr_t vaddrout; /* address to unmap */
  271. size_t size; /* size */
  272. };
  273. struct fastrpc_ioctl_munmap_64 {
  274. uint64_t vaddrout; /* address to unmap */
  275. size_t size; /* size */
  276. };
  277. struct fastrpc_ioctl_mmap {
  278. int fd; /* ion fd */
  279. uint32_t flags; /* flags for dsp to map with */
  280. uintptr_t vaddrin; /* optional virtual address */
  281. size_t size; /* size */
  282. uintptr_t vaddrout; /* dsps virtual address */
  283. };
  284. struct fastrpc_ioctl_mmap_64 {
  285. int fd; /* ion fd */
  286. uint32_t flags; /* flags for dsp to map with */
  287. uint64_t vaddrin; /* optional virtual address */
  288. size_t size; /* size */
  289. uint64_t vaddrout; /* dsps virtual address */
  290. };
  291. struct fastrpc_ioctl_munmap_fd {
  292. int fd; /* fd */
  293. uint32_t flags; /* control flags */
  294. uintptr_t va; /* va */
  295. ssize_t len; /* length */
  296. };
  297. struct fastrpc_ioctl_dspsignal_create {
  298. uint32_t signal_id; /* Signal ID */
  299. uint32_t flags; /* Flags, currently unused */
  300. };
  301. struct fastrpc_ioctl_dspsignal_destroy {
  302. uint32_t signal_id; /* Signal ID */
  303. };
  304. struct fastrpc_ioctl_dspsignal_signal {
  305. uint32_t signal_id; /* Signal ID */
  306. };
  307. struct fastrpc_ioctl_dspsignal_wait {
  308. uint32_t signal_id; /* Signal ID */
  309. uint32_t timeout_usec; /* Timeout in microseconds. UINT32_MAX for an infinite wait */
  310. };
  311. struct fastrpc_ioctl_dspsignal_cancel_wait {
  312. uint32_t signal_id; /* Signal ID */
  313. };
  314. /**
  315. * Control flags for mapping memory on DSP user process
  316. */
  317. enum fastrpc_map_flags {
  318. /**
  319. * Map memory pages with RW- permission and CACHE WRITEBACK.
  320. * The driver is responsible for cache maintenance when passed
  321. * the buffer to FastRPC calls. Same virtual address will be
  322. * assigned for subsequent FastRPC calls.
  323. */
  324. FASTRPC_MAP_STATIC = 0,
  325. /* Reserved */
  326. FASTRPC_MAP_RESERVED,
  327. /**
  328. * Map memory pages with RW- permission and CACHE WRITEBACK.
  329. * Mapping tagged with a file descriptor. User is responsible for
  330. * CPU and DSP cache maintenance for the buffer. Get virtual address
  331. * of buffer on DSP using HAP_mmap_get() and HAP_mmap_put() APIs.
  332. */
  333. FASTRPC_MAP_FD = 2,
  334. /**
  335. * Mapping delayed until user call HAP_mmap() and HAP_munmap()
  336. * functions on DSP. It is useful to map a buffer with cache modes
  337. * other than default modes. User is responsible for CPU and DSP
  338. * cache maintenance for the buffer.
  339. */
  340. FASTRPC_MAP_FD_DELAYED,
  341. /**
  342. * This flag is used to skip CPU mapping,
  343. * otherwise behaves similar to FASTRPC_MAP_FD_DELAYED flag.
  344. */
  345. FASTRPC_MAP_FD_NOMAP = 16,
  346. FASTRPC_MAP_MAX,
  347. };
  348. struct fastrpc_mem_map {
  349. int fd; /* ion fd */
  350. int offset; /* buffer offset */
  351. uint32_t flags; /* flags defined in enum fastrpc_map_flags */
  352. int attrs; /* buffer attributes used for SMMU mapping */
  353. uintptr_t vaddrin; /* buffer virtual address */
  354. size_t length; /* buffer length */
  355. uint64_t vaddrout; /* [out] remote virtual address */
  356. };
  357. /* Map and unmap IOCTL methods reserved memory size for future extensions */
  358. #define MAP_RESERVED_NUM (14)
  359. #define UNMAP_RESERVED_NUM (10)
  360. /* map memory to DSP device */
  361. struct fastrpc_ioctl_mem_map {
  362. int version; /* Initial version 0 */
  363. union {
  364. struct fastrpc_mem_map m;
  365. int reserved[MAP_RESERVED_NUM];
  366. };
  367. };
  368. struct fastrpc_mem_unmap {
  369. int fd; /* ion fd */
  370. uint64_t vaddr; /* remote process (dsp) virtual address */
  371. size_t length; /* buffer size */
  372. };
  373. /* unmap memory to DSP device */
  374. struct fastrpc_ioctl_mem_unmap {
  375. int version; /* Initial version 0 */
  376. union {
  377. struct fastrpc_mem_unmap um;
  378. int reserved[UNMAP_RESERVED_NUM];
  379. };
  380. };
  381. /*
  382. * This enum is shared with DSP. So, existing values should NOT
  383. * be modified. Only new members can be added.
  384. */
  385. enum dsp_map_flags {
  386. /* Add memory to static PD pool, protection thru XPU */
  387. ADSP_MMAP_HEAP_ADDR = 4,
  388. /* MAP static DMA buffer on DSP User PD */
  389. ADSP_MMAP_DMA_BUFFER = 6,
  390. /* Add memory to static PD pool, protection thru hypervisor */
  391. ADSP_MMAP_REMOTE_HEAP_ADDR = 8,
  392. /* Add memory to userPD pool, for user heap */
  393. ADSP_MMAP_ADD_PAGES = 0x1000,
  394. /* Add memory to userPD pool, for LLC heap */
  395. ADSP_MMAP_ADD_PAGES_LLC = 0x3000,
  396. /* Map persistent header buffer on DSP */
  397. ADSP_MMAP_PERSIST_HDR = 0x4000,
  398. };
  399. enum fastrpc_control_type {
  400. FASTRPC_CONTROL_LATENCY = 1,
  401. /* Share SMMU context bank */
  402. FASTRPC_CONTROL_SMMU = 2,
  403. FASTRPC_CONTROL_KALLOC = 3,
  404. FASTRPC_CONTROL_WAKELOCK = 4,
  405. FASTRPC_CONTROL_PM = 5,
  406. /* Clean process on DSP */
  407. FASTRPC_CONTROL_DSPPROCESS_CLEAN = 6,
  408. FASTRPC_CONTROL_RPC_POLL = 7,
  409. FASTRPC_CONTROL_ASYNC_WAKE = 8,
  410. FASTRPC_CONTROL_NOTIF_WAKE = 9,
  411. };
  412. struct fastrpc_ctrl_latency {
  413. uint32_t enable; /* latency control enable */
  414. uint32_t latency; /* latency request in us */
  415. };
  416. struct fastrpc_ctrl_kalloc {
  417. uint32_t kalloc_support; /* Remote memory allocation from kernel */
  418. };
  419. struct fastrpc_ctrl_wakelock {
  420. uint32_t enable; /* wakelock control enable */
  421. };
  422. struct fastrpc_ctrl_pm {
  423. uint32_t timeout; /* timeout(in ms) for PM to keep system awake */
  424. };
  425. struct fastrpc_ctrl_smmu {
  426. uint32_t sharedcb; /* Set to SMMU share context bank */
  427. };
  428. struct fastrpc_ioctl_control {
  429. uint32_t req;
  430. union {
  431. struct fastrpc_ctrl_latency lp;
  432. struct fastrpc_ctrl_kalloc kalloc;
  433. struct fastrpc_ctrl_wakelock wp;
  434. struct fastrpc_ctrl_pm pm;
  435. struct fastrpc_ctrl_smmu smmu;
  436. };
  437. };
  438. #define FASTRPC_MAX_DSP_ATTRIBUTES (256)
  439. #define FASTRPC_MAX_ATTRIBUTES (260)
  440. enum fastrpc_dsp_capability {
  441. ASYNC_FASTRPC_CAP = 9,
  442. DMA_HANDLE_REVERSE_RPC_CAP = 129,
  443. };
  444. struct fastrpc_ioctl_capability {
  445. uint32_t domain;
  446. uint32_t attribute_ID;
  447. uint32_t capability;
  448. };
  449. struct smq_null_invoke {
  450. uint64_t ctx; /* invoke caller context */
  451. uint32_t handle; /* handle to invoke */
  452. uint32_t sc; /* scalars structure describing the data */
  453. };
  454. struct smq_phy_page {
  455. uint64_t addr; /* physical address */
  456. uint64_t size; /* size of contiguous region */
  457. };
  458. struct smq_invoke_buf {
  459. int num; /* number of contiguous regions */
  460. int pgidx; /* index to start of contiguous region */
  461. };
  462. struct smq_invoke {
  463. struct smq_null_invoke header;
  464. struct smq_phy_page page; /* remote arg and list of pages address */
  465. };
  466. struct smq_msg {
  467. uint32_t pid; /* process group id */
  468. uint32_t tid; /* thread id */
  469. struct smq_invoke invoke;
  470. };
  471. struct smq_invoke_rsp {
  472. uint64_t ctx; /* invoke caller context */
  473. int retval; /* invoke return value */
  474. };
  475. enum fastrpc_response_flags {
  476. NORMAL_RESPONSE = 0,
  477. EARLY_RESPONSE = 1,
  478. USER_EARLY_SIGNAL = 2,
  479. COMPLETE_SIGNAL = 3,
  480. STATUS_RESPONSE = 4,
  481. POLL_MODE = 5,
  482. };
  483. enum fastrpc_process_create_state {
  484. PROCESS_CREATE_DEFAULT = 0, /* Process is not created */
  485. PROCESS_CREATE_IS_INPROGRESS = 1, /* Process creation is in progress */
  486. PROCESS_CREATE_SUCCESS = 2, /* Process creation is successful */
  487. };
  488. struct smq_invoke_rspv2 {
  489. uint64_t ctx; /* invoke caller context */
  490. int retval; /* invoke return value */
  491. uint32_t flags; /* early response flags */
  492. uint32_t early_wake_time; /* user predicted early wakeup time in us */
  493. uint32_t version; /* Version number for validation */
  494. };
  495. enum fastrpc_status_flags {
  496. FASTRPC_USERPD_UP = 0,
  497. FASTRPC_USERPD_EXIT = 1,
  498. FASTRPC_USERPD_FORCE_KILL = 2,
  499. FASTRPC_USERPD_EXCEPTION = 3,
  500. FASTRPC_DSP_SSR = 4,
  501. };
  502. struct smq_notif_rspv3 {
  503. uint64_t ctx; /* response context */
  504. uint32_t type; /* Notification type */
  505. int pid; /* user process pid */
  506. uint32_t status; /* userpd status notification */
  507. };
  508. enum fastrpc_process_exit_states {
  509. /* Process Default State */
  510. FASTRPC_PROCESS_DEFAULT_STATE = 0,
  511. /* Process exit initiated */
  512. FASTRPC_PROCESS_EXIT_START = 1,
  513. /* Process exit issued to DSP */
  514. FASTRPC_PROCESS_DSP_EXIT_INIT = 2,
  515. /* Process exit in DSP complete */
  516. FASTRPC_PROCESS_DSP_EXIT_COMPLETE = 3,
  517. /* Process exit in DSP error */
  518. FASTRPC_PROCESS_DSP_EXIT_ERROR = 4,
  519. };
  520. inline int fastrpc_transport_send(int cid, void *rpc_msg, uint32_t rpc_msg_size, bool trusted_vm);
  521. inline int fastrpc_handle_rpc_response(void *data, int len, int cid);
  522. inline int verify_transport_device(int cid, bool trusted_vm);
  523. int fastrpc_transport_init(void);
  524. void fastrpc_transport_deinit(void);
  525. void fastrpc_transport_session_init(int cid, char *subsys);
  526. void fastrpc_transport_session_deinit(int cid);
  527. int fastrpc_wait_for_transport_interrupt(int cid, unsigned int flags);
  528. static inline struct smq_invoke_buf *smq_invoke_buf_start(remote_arg64_t *pra,
  529. uint32_t sc)
  530. {
  531. unsigned int len = REMOTE_SCALARS_LENGTH(sc);
  532. return (struct smq_invoke_buf *)(&pra[len]);
  533. }
  534. static inline struct smq_phy_page *smq_phy_page_start(uint32_t sc,
  535. struct smq_invoke_buf *buf)
  536. {
  537. unsigned int nTotal = REMOTE_SCALARS_LENGTH(sc);
  538. return (struct smq_phy_page *)(&buf[nTotal]);
  539. }
  540. /*
  541. * Fastrpc context ID bit-map:
  542. *
  543. * bits 0-3 : type of remote PD
  544. * bit 4 : type of job (sync/async)
  545. * bit 5 : reserved
  546. * bits 6-15 : index in context table
  547. * bits 16-63 : incrementing context ID
  548. */
  549. #define FASTRPC_CTX_MAX (1024)
  550. /* Length of glink transaction history to store */
  551. #define GLINK_MSG_HISTORY_LEN (128)
  552. /* Type of fastrpc DMA bufs sent to DSP */
  553. enum fastrpc_buf_type {
  554. METADATA_BUF,
  555. COPYDATA_BUF,
  556. INITMEM_BUF,
  557. USERHEAP_BUF,
  558. };
  559. /* Types of RPC calls to DSP */
  560. enum fastrpc_msg_type {
  561. USER_MSG = 0,
  562. KERNEL_MSG_WITH_ZERO_PID,
  563. KERNEL_MSG_WITH_NONZERO_PID,
  564. };
  565. /* Fastrpc remote pd type */
  566. enum fastrpc_remote_pd_type {
  567. FASTRPC_ROOT_PD = 0,
  568. FASTRPC_USER_PD,
  569. FASTRPC_SENSORS_PD,
  570. };
  571. #define DSPSIGNAL_TIMEOUT_NONE 0xffffffff
  572. #define DSPSIGNAL_NUM_SIGNALS 1024
  573. // Signal state and completions are stored in groups of DSPSIGNAL_GROUP_SIZE.
  574. // Must be a power of two.
  575. #define DSPSIGNAL_GROUP_SIZE 256
  576. struct secure_vm {
  577. int *vmid;
  578. int *vmperm;
  579. int vmcount;
  580. };
  581. struct gid_list {
  582. unsigned int *gids;
  583. unsigned int gidcount;
  584. };
  585. struct qos_cores {
  586. int *coreno;
  587. int corecount;
  588. };
  589. struct fastrpc_file;
  590. struct fastrpc_buf {
  591. struct hlist_node hn;
  592. struct hlist_node hn_rem;
  593. struct hlist_node hn_init;
  594. struct fastrpc_file *fl;
  595. void *virt;
  596. uint64_t phys;
  597. size_t size;
  598. unsigned long dma_attr;
  599. uintptr_t raddr;
  600. uint32_t flags;
  601. int type; /* One of "fastrpc_buf_type" */
  602. bool in_use; /* Used only for persistent header buffers */
  603. struct timespec64 buf_start_time;
  604. struct timespec64 buf_end_time;
  605. };
  606. struct fastrpc_ctx_lst;
  607. struct fastrpc_tx_msg {
  608. struct smq_msg msg; /* Msg sent to remote subsystem */
  609. int transport_send_err; /* transport error */
  610. int64_t ns; /* Timestamp (in ns) of msg */
  611. uint64_t xo_time_in_us; /* XO Timestamp (in us) of sent message */
  612. };
  613. struct fastrpc_rx_msg {
  614. struct smq_invoke_rspv2 rsp; /* Response from remote subsystem */
  615. int64_t ns; /* Timestamp (in ns) of response */
  616. uint64_t xo_time_in_us; /* XO Timestamp (in us) of response */
  617. };
  618. struct fastrpc_transport_log {
  619. unsigned int tx_index; /* Current index of 'tx_msgs' array */
  620. unsigned int rx_index; /* Current index of 'rx_msgs' array */
  621. /* Rolling history of messages sent to remote subsystem */
  622. struct fastrpc_tx_msg tx_msgs[GLINK_MSG_HISTORY_LEN];
  623. /* Rolling history of responses from remote subsystem */
  624. struct fastrpc_rx_msg rx_msgs[GLINK_MSG_HISTORY_LEN];
  625. spinlock_t lock;
  626. };
  627. struct overlap {
  628. uintptr_t start;
  629. uintptr_t end;
  630. int raix;
  631. uintptr_t mstart;
  632. uintptr_t mend;
  633. uintptr_t offset;
  634. int do_cmo; /*used for cache maintenance of inrout buffers*/
  635. };
  636. struct fastrpc_perf {
  637. uint64_t count;
  638. uint64_t flush;
  639. uint64_t map;
  640. uint64_t copy;
  641. uint64_t link;
  642. uint64_t getargs;
  643. uint64_t putargs;
  644. uint64_t invargs;
  645. uint64_t invoke;
  646. uint64_t tid;
  647. };
  648. struct smq_notif_rsp {
  649. struct list_head notifn;
  650. int domain;
  651. int session;
  652. enum fastrpc_status_flags status;
  653. };
  654. struct smq_invoke_ctx {
  655. struct hlist_node hn;
  656. /* Async node to add to async job ctx list */
  657. struct list_head asyncn;
  658. struct completion work;
  659. int retval;
  660. int pid;
  661. int tgid;
  662. remote_arg_t *lpra;
  663. remote_arg64_t *rpra;
  664. remote_arg64_t *lrpra; /* Local copy of rpra for put_args */
  665. int *fds;
  666. unsigned int *attrs;
  667. struct fastrpc_mmap **maps;
  668. struct fastrpc_buf *buf;
  669. struct fastrpc_buf *copybuf; /*used to copy non-ion buffers */
  670. size_t used;
  671. struct fastrpc_file *fl;
  672. uint32_t handle;
  673. uint32_t sc;
  674. struct overlap *overs;
  675. struct overlap **overps;
  676. struct smq_msg msg;
  677. uint32_t *crc;
  678. uint64_t *perf_kernel;
  679. uint64_t *perf_dsp;
  680. unsigned int magic;
  681. uint64_t ctxid;
  682. struct fastrpc_perf *perf;
  683. /* response flags from remote processor */
  684. enum fastrpc_response_flags rsp_flags;
  685. /* user hint of completion time in us */
  686. uint32_t early_wake_time;
  687. /* work done status flag */
  688. bool is_work_done;
  689. /* Store Async job in the context*/
  690. struct fastrpc_async_job asyncjob;
  691. /* Async early flag to check the state of context */
  692. bool is_early_wakeup;
  693. uint32_t sc_interrupted;
  694. struct fastrpc_file *fl_interrupted;
  695. uint32_t handle_interrupted;
  696. };
  697. struct fastrpc_ctx_lst {
  698. struct hlist_head pending;
  699. struct hlist_head interrupted;
  700. /* Number of active contexts queued to DSP */
  701. uint32_t num_active_ctxs;
  702. /* Queue which holds all async job contexts of process */
  703. struct list_head async_queue;
  704. /* Queue which holds all status notifications of process */
  705. struct list_head notif_queue;
  706. };
  707. struct fastrpc_smmu {
  708. struct device *dev;
  709. const char *dev_name;
  710. int cb;
  711. int enabled;
  712. int faults;
  713. int secure;
  714. int coherent;
  715. int sharedcb;
  716. /* gen pool for QRTR */
  717. struct gen_pool *frpc_genpool;
  718. /* fastrpc gen pool buffer */
  719. struct fastrpc_buf *frpc_genpool_buf;
  720. /* fastrpc gen pool buffer fixed IOVA */
  721. unsigned long genpool_iova;
  722. /* fastrpc gen pool buffer size */
  723. size_t genpool_size;
  724. };
  725. struct fastrpc_session_ctx {
  726. struct device *dev;
  727. struct fastrpc_smmu smmu;
  728. int used;
  729. };
  730. struct fastrpc_static_pd {
  731. char *servloc_name;
  732. char *spdname;
  733. void *pdrhandle;
  734. uint64_t pdrcount;
  735. uint64_t prevpdrcount;
  736. atomic_t ispdup;
  737. int cid;
  738. wait_queue_head_t wait_for_pdup;
  739. };
  740. struct fastrpc_dsp_capabilities {
  741. uint32_t is_cached; //! Flag if dsp attributes are cached
  742. uint32_t dsp_attributes[FASTRPC_MAX_DSP_ATTRIBUTES];
  743. };
  744. struct fastrpc_channel_ctx {
  745. char *name;
  746. char *subsys;
  747. struct device *dev;
  748. struct fastrpc_session_ctx session[NUM_SESSIONS];
  749. struct fastrpc_static_pd spd[NUM_SESSIONS];
  750. struct completion work;
  751. struct completion workport;
  752. struct notifier_block nb;
  753. struct mutex smd_mutex;
  754. uint64_t sesscount;
  755. uint64_t ssrcount;
  756. int in_hib;
  757. void *handle;
  758. uint64_t prevssrcount;
  759. int issubsystemup;
  760. int vmid;
  761. struct secure_vm rhvm;
  762. void *rh_dump_dev;
  763. /* Indicates, if channel is restricted to secure node only */
  764. int secure;
  765. /* Indicates whether the channel supports unsigned PD */
  766. bool unsigned_support;
  767. struct fastrpc_dsp_capabilities dsp_cap_kernel;
  768. /* cpu capabilities shared to DSP */
  769. uint64_t cpuinfo_todsp;
  770. bool cpuinfo_status;
  771. struct smq_invoke_ctx *ctxtable[FASTRPC_CTX_MAX];
  772. spinlock_t ctxlock;
  773. struct fastrpc_transport_log gmsg_log;
  774. struct hlist_head initmems;
  775. /* Store gfa structure debug details */
  776. struct fastrpc_buf *buf;
  777. };
  778. struct fastrpc_apps {
  779. struct fastrpc_channel_ctx *channel;
  780. struct cdev cdev;
  781. struct class *class;
  782. struct smq_phy_page range;
  783. struct hlist_head maps;
  784. uint32_t staticpd_flags;
  785. dev_t dev_no;
  786. int compat;
  787. struct hlist_head drivers;
  788. spinlock_t hlock;
  789. struct device *dev;
  790. /* Indicates fastrpc device node info */
  791. struct device *dev_fastrpc;
  792. unsigned int latency;
  793. int transport_initialized;
  794. /* Flag to determine fastrpc bus registration */
  795. int fastrpc_bus_register;
  796. bool legacy_remote_heap;
  797. /* Unique job id for each message */
  798. uint64_t jobid[NUM_CHANNELS];
  799. struct gid_list gidlist;
  800. struct device *secure_dev;
  801. struct device *non_secure_dev;
  802. /* Secure subsystems like ADSP/SLPI will use secure client */
  803. struct wakeup_source *wake_source_secure;
  804. /* Non-secure subsystem like CDSP will use regular client */
  805. struct wakeup_source *wake_source;
  806. uint32_t duplicate_rsp_err_cnt;
  807. struct qos_cores silvercores;
  808. uint32_t max_size_limit;
  809. struct hlist_head frpc_devices;
  810. struct hlist_head frpc_drivers;
  811. struct mutex mut_uid;
  812. /* Indicates cdsp device status */
  813. int remote_cdsp_status;
  814. /* Indicates secure context bank to be shared */
  815. int share_securecb;
  816. };
  817. struct fastrpc_mmap {
  818. struct hlist_node hn;
  819. struct fastrpc_file *fl;
  820. struct fastrpc_apps *apps;
  821. int fd;
  822. uint32_t flags;
  823. struct dma_buf *buf;
  824. struct sg_table *table;
  825. struct dma_buf_attachment *attach;
  826. struct ion_handle *handle;
  827. uint64_t phys;
  828. size_t size;
  829. uintptr_t va;
  830. size_t len;
  831. int refs;
  832. uintptr_t raddr;
  833. int secure;
  834. bool is_persistent; /* the map is persistenet across sessions */
  835. int frpc_md_index; /* Minidump unique index */
  836. uintptr_t attr;
  837. bool in_use; /* Indicates if persistent map is in use*/
  838. struct timespec64 map_start_time;
  839. struct timespec64 map_end_time;
  840. /* Mapping for fastrpc shell */
  841. bool is_filemap;
  842. char *servloc_name; /* Indicate which daemon mapped this */
  843. };
  844. enum fastrpc_perfkeys {
  845. PERF_COUNT = 0,
  846. PERF_FLUSH = 1,
  847. PERF_MAP = 2,
  848. PERF_COPY = 3,
  849. PERF_LINK = 4,
  850. PERF_GETARGS = 5,
  851. PERF_PUTARGS = 6,
  852. PERF_INVARGS = 7,
  853. PERF_INVOKE = 8,
  854. PERF_TID = 9,
  855. PERF_KEY_MAX = 10,
  856. };
  857. struct fastrpc_notif_queue {
  858. /* Number of pending status notifications in queue */
  859. atomic_t notif_queue_count;
  860. /* Wait queue to synchronize notifier thread and response */
  861. wait_queue_head_t notif_wait_queue;
  862. /* IRQ safe spin lock for protecting notif queue */
  863. spinlock_t nqlock;
  864. };
  865. enum fastrpc_dspsignal_state {
  866. DSPSIGNAL_STATE_UNUSED = 0,
  867. DSPSIGNAL_STATE_PENDING,
  868. DSPSIGNAL_STATE_SIGNALED,
  869. DSPSIGNAL_STATE_CANCELED
  870. };
  871. struct fastrpc_dspsignal {
  872. struct completion comp;
  873. int state;
  874. };
  875. struct fastrpc_file {
  876. struct hlist_node hn;
  877. spinlock_t hlock;
  878. struct hlist_head maps;
  879. struct hlist_head cached_bufs;
  880. uint32_t num_cached_buf;
  881. struct hlist_head remote_bufs;
  882. struct fastrpc_ctx_lst clst;
  883. struct fastrpc_session_ctx *sctx;
  884. struct fastrpc_buf *init_mem;
  885. /* No. of persistent headers */
  886. unsigned int num_pers_hdrs;
  887. /* Pre-allocated header buffer */
  888. struct fastrpc_buf *pers_hdr_buf;
  889. /* Pre-allocated buffer divided into N chunks */
  890. struct fastrpc_buf *hdr_bufs;
  891. struct fastrpc_session_ctx *secsctx;
  892. uint32_t mode;
  893. uint32_t profile;
  894. int sessionid;
  895. int tgid_open; /* Process ID during device open */
  896. int tgid; /* Process ID that uses device for RPC calls */
  897. int cid;
  898. bool trusted_vm;
  899. uint64_t ssrcount;
  900. int pd;
  901. char *servloc_name;
  902. int file_close;
  903. int dsp_proc_init;
  904. int sharedcb;
  905. struct fastrpc_apps *apps;
  906. struct dentry *debugfs_file;
  907. struct dev_pm_qos_request *dev_pm_qos_req;
  908. int qos_request;
  909. struct mutex map_mutex;
  910. struct mutex internal_map_mutex;
  911. /* Identifies the device (MINOR_NUM_DEV / MINOR_NUM_SECURE_DEV) */
  912. int dev_minor;
  913. char *debug_buf;
  914. /* Flag to indicate attempt has been made to allocate memory for debug_buf*/
  915. int debug_buf_alloced_attempted;
  916. /* Flag to enable PM wake/relax voting for every remote invoke */
  917. int wake_enable;
  918. struct gid_list gidlist;
  919. /* Number of jobs pending in Async Queue */
  920. atomic_t async_queue_job_count;
  921. /* Async wait queue to synchronize glink response and async thread */
  922. wait_queue_head_t async_wait_queue;
  923. /* IRQ safe spin lock for protecting async queue */
  924. spinlock_t aqlock;
  925. /* Process status notification queue */
  926. struct fastrpc_notif_queue proc_state_notif;
  927. uint32_t ws_timeout;
  928. bool untrusted_process;
  929. struct fastrpc_device *device;
  930. /* Process kill will wait on work when ram dump collection in progress */
  931. struct completion work;
  932. /* Flag to indicate ram dump collection status*/
  933. bool is_ramdump_pend;
  934. /* Flag to indicate type of process (static, dynamic) */
  935. uint32_t proc_flags;
  936. /* If set, threads will poll for DSP response instead of glink wait */
  937. bool poll_mode;
  938. /* Threads poll for specified timeout and fall back to glink wait */
  939. uint32_t poll_timeout;
  940. /* Flag to indicate dynamic process creation status*/
  941. enum fastrpc_process_create_state dsp_process_state;
  942. bool is_unsigned_pd;
  943. /* Flag to indicate 32 bit driver*/
  944. bool is_compat;
  945. /* Completion objects and state for dspsignals */
  946. struct fastrpc_dspsignal *signal_groups[DSPSIGNAL_NUM_SIGNALS / DSPSIGNAL_GROUP_SIZE];
  947. spinlock_t dspsignals_lock;
  948. struct mutex signal_create_mutex;
  949. struct completion shutdown;
  950. /* Flag to indicate notif thread exit requested*/
  951. bool exit_notif;
  952. /* Flag to indicate async thread exit requested*/
  953. bool exit_async;
  954. };
  955. union fastrpc_ioctl_param {
  956. struct fastrpc_ioctl_invoke_async inv;
  957. struct fastrpc_ioctl_mem_map mem_map;
  958. struct fastrpc_ioctl_mem_unmap mem_unmap;
  959. struct fastrpc_ioctl_mmap mmap;
  960. struct fastrpc_ioctl_mmap_64 mmap64;
  961. struct fastrpc_ioctl_munmap munmap;
  962. struct fastrpc_ioctl_munmap_64 munmap64;
  963. struct fastrpc_ioctl_munmap_fd munmap_fd;
  964. struct fastrpc_ioctl_init_attrs init;
  965. struct fastrpc_ioctl_control cp;
  966. struct fastrpc_ioctl_capability cap;
  967. struct fastrpc_ioctl_invoke2 inv2;
  968. struct fastrpc_ioctl_dspsignal_signal sig;
  969. struct fastrpc_ioctl_dspsignal_wait wait;
  970. struct fastrpc_ioctl_dspsignal_create cre;
  971. struct fastrpc_ioctl_dspsignal_destroy des;
  972. struct fastrpc_ioctl_dspsignal_cancel_wait canc;
  973. };
  974. int fastrpc_internal_invoke(struct fastrpc_file *fl, uint32_t mode,
  975. uint32_t kernel,
  976. struct fastrpc_ioctl_invoke_async *inv);
  977. int fastrpc_internal_invoke2(struct fastrpc_file *fl,
  978. struct fastrpc_ioctl_invoke2 *inv2);
  979. int fastrpc_internal_munmap(struct fastrpc_file *fl,
  980. struct fastrpc_ioctl_munmap *ud);
  981. int fastrpc_internal_mem_map(struct fastrpc_file *fl,
  982. struct fastrpc_ioctl_mem_map *ud);
  983. int fastrpc_internal_mem_unmap(struct fastrpc_file *fl,
  984. struct fastrpc_ioctl_mem_unmap *ud);
  985. int fastrpc_internal_mmap(struct fastrpc_file *fl,
  986. struct fastrpc_ioctl_mmap *ud);
  987. int fastrpc_init_process(struct fastrpc_file *fl,
  988. struct fastrpc_ioctl_init_attrs *uproc);
  989. int fastrpc_get_info(struct fastrpc_file *fl, uint32_t *info);
  990. int fastrpc_internal_control(struct fastrpc_file *fl,
  991. struct fastrpc_ioctl_control *cp);
  992. int fastrpc_setmode(unsigned long ioctl_param,
  993. struct fastrpc_file *fl);
  994. int fastrpc_get_info_from_kernel(
  995. struct fastrpc_ioctl_capability *cap,
  996. struct fastrpc_file *fl);
  997. int fastrpc_dspsignal_signal(struct fastrpc_file *fl,
  998. struct fastrpc_ioctl_dspsignal_signal *sig);
  999. int fastrpc_dspsignal_wait(struct fastrpc_file *fl,
  1000. struct fastrpc_ioctl_dspsignal_wait *wait);
  1001. int fastrpc_dspsignal_create(struct fastrpc_file *fl,
  1002. struct fastrpc_ioctl_dspsignal_create *create);
  1003. int fastrpc_dspsignal_destroy(struct fastrpc_file *fl,
  1004. struct fastrpc_ioctl_dspsignal_destroy *destroy);
  1005. int fastrpc_dspsignal_cancel_wait(struct fastrpc_file *fl,
  1006. struct fastrpc_ioctl_dspsignal_cancel_wait *cancel);
  1007. void fastrpc_rproc_trace_events(const char *name, const char *event,
  1008. const char *subevent);
  1009. #endif