adsprpc_shared.h 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2022, 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. };
  410. struct fastrpc_ctrl_latency {
  411. uint32_t enable; /* latency control enable */
  412. uint32_t latency; /* latency request in us */
  413. };
  414. struct fastrpc_ctrl_kalloc {
  415. uint32_t kalloc_support; /* Remote memory allocation from kernel */
  416. };
  417. struct fastrpc_ctrl_wakelock {
  418. uint32_t enable; /* wakelock control enable */
  419. };
  420. struct fastrpc_ctrl_pm {
  421. uint32_t timeout; /* timeout(in ms) for PM to keep system awake */
  422. };
  423. struct fastrpc_ctrl_smmu {
  424. uint32_t sharedcb; /* Set to SMMU share context bank */
  425. };
  426. struct fastrpc_ioctl_control {
  427. uint32_t req;
  428. union {
  429. struct fastrpc_ctrl_latency lp;
  430. struct fastrpc_ctrl_kalloc kalloc;
  431. struct fastrpc_ctrl_wakelock wp;
  432. struct fastrpc_ctrl_pm pm;
  433. struct fastrpc_ctrl_smmu smmu;
  434. };
  435. };
  436. #define FASTRPC_MAX_DSP_ATTRIBUTES (256)
  437. #define FASTRPC_MAX_ATTRIBUTES (260)
  438. enum fastrpc_dsp_capability {
  439. ASYNC_FASTRPC_CAP = 9,
  440. DMA_HANDLE_REVERSE_RPC_CAP = 129,
  441. };
  442. struct fastrpc_ioctl_capability {
  443. uint32_t domain;
  444. uint32_t attribute_ID;
  445. uint32_t capability;
  446. };
  447. struct smq_null_invoke {
  448. uint64_t ctx; /* invoke caller context */
  449. uint32_t handle; /* handle to invoke */
  450. uint32_t sc; /* scalars structure describing the data */
  451. };
  452. struct smq_phy_page {
  453. uint64_t addr; /* physical address */
  454. uint64_t size; /* size of contiguous region */
  455. };
  456. struct smq_invoke_buf {
  457. int num; /* number of contiguous regions */
  458. int pgidx; /* index to start of contiguous region */
  459. };
  460. struct smq_invoke {
  461. struct smq_null_invoke header;
  462. struct smq_phy_page page; /* remote arg and list of pages address */
  463. };
  464. struct smq_msg {
  465. uint32_t pid; /* process group id */
  466. uint32_t tid; /* thread id */
  467. struct smq_invoke invoke;
  468. };
  469. struct smq_invoke_rsp {
  470. uint64_t ctx; /* invoke caller context */
  471. int retval; /* invoke return value */
  472. };
  473. enum fastrpc_response_flags {
  474. NORMAL_RESPONSE = 0,
  475. EARLY_RESPONSE = 1,
  476. USER_EARLY_SIGNAL = 2,
  477. COMPLETE_SIGNAL = 3,
  478. STATUS_RESPONSE = 4,
  479. POLL_MODE = 5,
  480. };
  481. enum fastrpc_process_create_state {
  482. PROCESS_CREATE_DEFAULT = 0, /* Process is not created */
  483. PROCESS_CREATE_IS_INPROGRESS = 1, /* Process creation is in progress */
  484. PROCESS_CREATE_SUCCESS = 2, /* Process creation is successful */
  485. };
  486. struct smq_invoke_rspv2 {
  487. uint64_t ctx; /* invoke caller context */
  488. int retval; /* invoke return value */
  489. uint32_t flags; /* early response flags */
  490. uint32_t early_wake_time; /* user predicted early wakeup time in us */
  491. uint32_t version; /* Version number for validation */
  492. };
  493. enum fastrpc_status_flags {
  494. FASTRPC_USERPD_UP = 0,
  495. FASTRPC_USERPD_EXIT = 1,
  496. FASTRPC_USERPD_FORCE_KILL = 2,
  497. FASTRPC_USERPD_EXCEPTION = 3,
  498. FASTRPC_DSP_SSR = 4,
  499. };
  500. struct smq_notif_rspv3 {
  501. uint64_t ctx; /* response context */
  502. uint32_t type; /* Notification type */
  503. int pid; /* user process pid */
  504. uint32_t status; /* userpd status notification */
  505. };
  506. enum fastrpc_process_exit_states {
  507. /* Process Default State */
  508. FASTRPC_PROCESS_DEFAULT_STATE = 0,
  509. /* Process exit initiated */
  510. FASTRPC_PROCESS_EXIT_START = 1,
  511. /* Process exit issued to DSP */
  512. FASTRPC_PROCESS_DSP_EXIT_INIT = 2,
  513. /* Process exit in DSP complete */
  514. FASTRPC_PROCESS_DSP_EXIT_COMPLETE = 3,
  515. /* Process exit in DSP error */
  516. FASTRPC_PROCESS_DSP_EXIT_ERROR = 4,
  517. };
  518. inline int fastrpc_transport_send(int cid, void *rpc_msg, uint32_t rpc_msg_size, bool trusted_vm);
  519. inline int fastrpc_handle_rpc_response(void *data, int len, int cid);
  520. inline int verify_transport_device(int cid, bool trusted_vm);
  521. int fastrpc_transport_init(void);
  522. void fastrpc_transport_deinit(void);
  523. void fastrpc_transport_session_init(int cid, char *subsys);
  524. void fastrpc_transport_session_deinit(int cid);
  525. int fastrpc_wait_for_transport_interrupt(int cid, unsigned int flags);
  526. static inline struct smq_invoke_buf *smq_invoke_buf_start(remote_arg64_t *pra,
  527. uint32_t sc)
  528. {
  529. unsigned int len = REMOTE_SCALARS_LENGTH(sc);
  530. return (struct smq_invoke_buf *)(&pra[len]);
  531. }
  532. static inline struct smq_phy_page *smq_phy_page_start(uint32_t sc,
  533. struct smq_invoke_buf *buf)
  534. {
  535. unsigned int nTotal = REMOTE_SCALARS_LENGTH(sc);
  536. return (struct smq_phy_page *)(&buf[nTotal]);
  537. }
  538. /*
  539. * Fastrpc context ID bit-map:
  540. *
  541. * bits 0-3 : type of remote PD
  542. * bit 4 : type of job (sync/async)
  543. * bit 5 : reserved
  544. * bits 6-15 : index in context table
  545. * bits 16-63 : incrementing context ID
  546. */
  547. #define FASTRPC_CTX_MAX (1024)
  548. /* Length of glink transaction history to store */
  549. #define GLINK_MSG_HISTORY_LEN (128)
  550. /* Type of fastrpc DMA bufs sent to DSP */
  551. enum fastrpc_buf_type {
  552. METADATA_BUF,
  553. COPYDATA_BUF,
  554. INITMEM_BUF,
  555. USERHEAP_BUF,
  556. };
  557. /* Types of RPC calls to DSP */
  558. enum fastrpc_msg_type {
  559. USER_MSG = 0,
  560. KERNEL_MSG_WITH_ZERO_PID,
  561. KERNEL_MSG_WITH_NONZERO_PID,
  562. };
  563. #define DSPSIGNAL_TIMEOUT_NONE 0xffffffff
  564. #define DSPSIGNAL_NUM_SIGNALS 1024
  565. // Signal state and completions are stored in groups of DSPSIGNAL_GROUP_SIZE.
  566. // Must be a power of two.
  567. #define DSPSIGNAL_GROUP_SIZE 256
  568. struct secure_vm {
  569. int *vmid;
  570. int *vmperm;
  571. int vmcount;
  572. };
  573. struct gid_list {
  574. unsigned int *gids;
  575. unsigned int gidcount;
  576. };
  577. struct qos_cores {
  578. int *coreno;
  579. int corecount;
  580. };
  581. struct fastrpc_file;
  582. struct fastrpc_buf {
  583. struct hlist_node hn;
  584. struct hlist_node hn_rem;
  585. struct hlist_node hn_init;
  586. struct fastrpc_file *fl;
  587. void *virt;
  588. uint64_t phys;
  589. size_t size;
  590. unsigned long dma_attr;
  591. uintptr_t raddr;
  592. uint32_t flags;
  593. int type; /* One of "fastrpc_buf_type" */
  594. bool in_use; /* Used only for persistent header buffers */
  595. struct timespec64 buf_start_time;
  596. struct timespec64 buf_end_time;
  597. };
  598. struct fastrpc_ctx_lst;
  599. struct fastrpc_tx_msg {
  600. struct smq_msg msg; /* Msg sent to remote subsystem */
  601. int transport_send_err; /* transport error */
  602. int64_t ns; /* Timestamp (in ns) of msg */
  603. uint64_t xo_time_in_us; /* XO Timestamp (in us) of sent message */
  604. };
  605. struct fastrpc_rx_msg {
  606. struct smq_invoke_rspv2 rsp; /* Response from remote subsystem */
  607. int64_t ns; /* Timestamp (in ns) of response */
  608. uint64_t xo_time_in_us; /* XO Timestamp (in us) of response */
  609. };
  610. struct fastrpc_transport_log {
  611. unsigned int tx_index; /* Current index of 'tx_msgs' array */
  612. unsigned int rx_index; /* Current index of 'rx_msgs' array */
  613. /* Rolling history of messages sent to remote subsystem */
  614. struct fastrpc_tx_msg tx_msgs[GLINK_MSG_HISTORY_LEN];
  615. /* Rolling history of responses from remote subsystem */
  616. struct fastrpc_rx_msg rx_msgs[GLINK_MSG_HISTORY_LEN];
  617. spinlock_t lock;
  618. };
  619. struct overlap {
  620. uintptr_t start;
  621. uintptr_t end;
  622. int raix;
  623. uintptr_t mstart;
  624. uintptr_t mend;
  625. uintptr_t offset;
  626. int do_cmo; /*used for cache maintenance of inrout buffers*/
  627. };
  628. struct fastrpc_perf {
  629. uint64_t count;
  630. uint64_t flush;
  631. uint64_t map;
  632. uint64_t copy;
  633. uint64_t link;
  634. uint64_t getargs;
  635. uint64_t putargs;
  636. uint64_t invargs;
  637. uint64_t invoke;
  638. uint64_t tid;
  639. };
  640. struct smq_notif_rsp {
  641. struct list_head notifn;
  642. int domain;
  643. int session;
  644. enum fastrpc_status_flags status;
  645. };
  646. struct smq_invoke_ctx {
  647. struct hlist_node hn;
  648. /* Async node to add to async job ctx list */
  649. struct list_head asyncn;
  650. struct completion work;
  651. int retval;
  652. int pid;
  653. int tgid;
  654. remote_arg_t *lpra;
  655. remote_arg64_t *rpra;
  656. remote_arg64_t *lrpra; /* Local copy of rpra for put_args */
  657. int *fds;
  658. unsigned int *attrs;
  659. struct fastrpc_mmap **maps;
  660. struct fastrpc_buf *buf;
  661. struct fastrpc_buf *copybuf; /*used to copy non-ion buffers */
  662. size_t used;
  663. struct fastrpc_file *fl;
  664. uint32_t handle;
  665. uint32_t sc;
  666. struct overlap *overs;
  667. struct overlap **overps;
  668. struct smq_msg msg;
  669. uint32_t *crc;
  670. uint64_t *perf_kernel;
  671. uint64_t *perf_dsp;
  672. unsigned int magic;
  673. uint64_t ctxid;
  674. struct fastrpc_perf *perf;
  675. /* response flags from remote processor */
  676. enum fastrpc_response_flags rsp_flags;
  677. /* user hint of completion time in us */
  678. uint32_t early_wake_time;
  679. /* work done status flag */
  680. bool is_work_done;
  681. /* Store Async job in the context*/
  682. struct fastrpc_async_job asyncjob;
  683. /* Async early flag to check the state of context */
  684. bool is_early_wakeup;
  685. uint32_t sc_interrupted;
  686. struct fastrpc_file *fl_interrupted;
  687. uint32_t handle_interrupted;
  688. };
  689. struct fastrpc_ctx_lst {
  690. struct hlist_head pending;
  691. struct hlist_head interrupted;
  692. /* Number of active contexts queued to DSP */
  693. uint32_t num_active_ctxs;
  694. /* Queue which holds all async job contexts of process */
  695. struct list_head async_queue;
  696. /* Queue which holds all status notifications of process */
  697. struct list_head notif_queue;
  698. };
  699. struct fastrpc_smmu {
  700. struct device *dev;
  701. const char *dev_name;
  702. int cb;
  703. int enabled;
  704. int faults;
  705. int secure;
  706. int coherent;
  707. int sharedcb;
  708. /* gen pool for QRTR */
  709. struct gen_pool *frpc_genpool;
  710. /* fastrpc gen pool buffer */
  711. struct fastrpc_buf *frpc_genpool_buf;
  712. /* fastrpc gen pool buffer fixed IOVA */
  713. unsigned long genpool_iova;
  714. /* fastrpc gen pool buffer size */
  715. size_t genpool_size;
  716. };
  717. struct fastrpc_session_ctx {
  718. struct device *dev;
  719. struct fastrpc_smmu smmu;
  720. int used;
  721. };
  722. struct fastrpc_static_pd {
  723. char *servloc_name;
  724. char *spdname;
  725. void *pdrhandle;
  726. uint64_t pdrcount;
  727. uint64_t prevpdrcount;
  728. atomic_t ispdup;
  729. int cid;
  730. wait_queue_head_t wait_for_pdup;
  731. };
  732. struct fastrpc_dsp_capabilities {
  733. uint32_t is_cached; //! Flag if dsp attributes are cached
  734. uint32_t dsp_attributes[FASTRPC_MAX_DSP_ATTRIBUTES];
  735. };
  736. struct fastrpc_channel_ctx {
  737. char *name;
  738. char *subsys;
  739. struct device *dev;
  740. struct fastrpc_session_ctx session[NUM_SESSIONS];
  741. struct fastrpc_static_pd spd[NUM_SESSIONS];
  742. struct completion work;
  743. struct completion workport;
  744. struct notifier_block nb;
  745. struct mutex smd_mutex;
  746. uint64_t sesscount;
  747. uint64_t ssrcount;
  748. int in_hib;
  749. void *handle;
  750. uint64_t prevssrcount;
  751. int issubsystemup;
  752. int vmid;
  753. struct secure_vm rhvm;
  754. void *rh_dump_dev;
  755. /* Indicates, if channel is restricted to secure node only */
  756. int secure;
  757. /* Indicates whether the channel supports unsigned PD */
  758. bool unsigned_support;
  759. struct fastrpc_dsp_capabilities dsp_cap_kernel;
  760. /* cpu capabilities shared to DSP */
  761. uint64_t cpuinfo_todsp;
  762. bool cpuinfo_status;
  763. struct smq_invoke_ctx *ctxtable[FASTRPC_CTX_MAX];
  764. spinlock_t ctxlock;
  765. struct fastrpc_transport_log gmsg_log;
  766. struct hlist_head initmems;
  767. /* Store gfa structure debug details */
  768. struct fastrpc_buf *buf;
  769. };
  770. struct fastrpc_apps {
  771. struct fastrpc_channel_ctx *channel;
  772. struct cdev cdev;
  773. struct class *class;
  774. struct smq_phy_page range;
  775. struct hlist_head maps;
  776. uint32_t staticpd_flags;
  777. dev_t dev_no;
  778. int compat;
  779. struct hlist_head drivers;
  780. spinlock_t hlock;
  781. struct device *dev;
  782. /* Indicates fastrpc device node info */
  783. struct device *dev_fastrpc;
  784. unsigned int latency;
  785. int transport_initialized;
  786. /* Flag to determine fastrpc bus registration */
  787. int fastrpc_bus_register;
  788. bool legacy_remote_heap;
  789. /* Unique job id for each message */
  790. uint64_t jobid[NUM_CHANNELS];
  791. struct gid_list gidlist;
  792. struct device *secure_dev;
  793. struct device *non_secure_dev;
  794. /* Secure subsystems like ADSP/SLPI will use secure client */
  795. struct wakeup_source *wake_source_secure;
  796. /* Non-secure subsystem like CDSP will use regular client */
  797. struct wakeup_source *wake_source;
  798. uint32_t duplicate_rsp_err_cnt;
  799. struct qos_cores silvercores;
  800. uint32_t max_size_limit;
  801. struct hlist_head frpc_devices;
  802. struct hlist_head frpc_drivers;
  803. struct mutex mut_uid;
  804. /* Indicates cdsp device status */
  805. int remote_cdsp_status;
  806. /* Indicates secure context bank to be shared */
  807. int share_securecb;
  808. };
  809. struct fastrpc_mmap {
  810. struct hlist_node hn;
  811. struct fastrpc_file *fl;
  812. struct fastrpc_apps *apps;
  813. int fd;
  814. uint32_t flags;
  815. struct dma_buf *buf;
  816. struct sg_table *table;
  817. struct dma_buf_attachment *attach;
  818. struct ion_handle *handle;
  819. uint64_t phys;
  820. size_t size;
  821. uintptr_t va;
  822. size_t len;
  823. int refs;
  824. uintptr_t raddr;
  825. int secure;
  826. bool is_persistent; /* the map is persistenet across sessions */
  827. int frpc_md_index; /* Minidump unique index */
  828. uintptr_t attr;
  829. bool in_use; /* Indicates if persistent map is in use*/
  830. struct timespec64 map_start_time;
  831. struct timespec64 map_end_time;
  832. /* Mapping for fastrpc shell */
  833. bool is_filemap;
  834. char *servloc_name; /* Indicate which daemon mapped this */
  835. };
  836. enum fastrpc_perfkeys {
  837. PERF_COUNT = 0,
  838. PERF_FLUSH = 1,
  839. PERF_MAP = 2,
  840. PERF_COPY = 3,
  841. PERF_LINK = 4,
  842. PERF_GETARGS = 5,
  843. PERF_PUTARGS = 6,
  844. PERF_INVARGS = 7,
  845. PERF_INVOKE = 8,
  846. PERF_TID = 9,
  847. PERF_KEY_MAX = 10,
  848. };
  849. struct fastrpc_notif_queue {
  850. /* Number of pending status notifications in queue */
  851. atomic_t notif_queue_count;
  852. /* Wait queue to synchronize notifier thread and response */
  853. wait_queue_head_t notif_wait_queue;
  854. /* IRQ safe spin lock for protecting notif queue */
  855. spinlock_t nqlock;
  856. };
  857. enum fastrpc_dspsignal_state {
  858. DSPSIGNAL_STATE_UNUSED = 0,
  859. DSPSIGNAL_STATE_PENDING,
  860. DSPSIGNAL_STATE_SIGNALED,
  861. DSPSIGNAL_STATE_CANCELED
  862. };
  863. struct fastrpc_dspsignal {
  864. struct completion comp;
  865. int state;
  866. };
  867. struct fastrpc_file {
  868. struct hlist_node hn;
  869. spinlock_t hlock;
  870. struct hlist_head maps;
  871. struct hlist_head cached_bufs;
  872. uint32_t num_cached_buf;
  873. struct hlist_head remote_bufs;
  874. struct fastrpc_ctx_lst clst;
  875. struct fastrpc_session_ctx *sctx;
  876. struct fastrpc_buf *init_mem;
  877. /* No. of persistent headers */
  878. unsigned int num_pers_hdrs;
  879. /* Pre-allocated header buffer */
  880. struct fastrpc_buf *pers_hdr_buf;
  881. /* Pre-allocated buffer divided into N chunks */
  882. struct fastrpc_buf *hdr_bufs;
  883. struct fastrpc_session_ctx *secsctx;
  884. uint32_t mode;
  885. uint32_t profile;
  886. int sessionid;
  887. int tgid_open; /* Process ID during device open */
  888. int tgid; /* Process ID that uses device for RPC calls */
  889. int cid;
  890. bool trusted_vm;
  891. uint64_t ssrcount;
  892. int pd;
  893. char *servloc_name;
  894. int file_close;
  895. int dsp_proc_init;
  896. int sharedcb;
  897. struct fastrpc_apps *apps;
  898. struct dentry *debugfs_file;
  899. struct dev_pm_qos_request *dev_pm_qos_req;
  900. int qos_request;
  901. struct mutex map_mutex;
  902. struct mutex internal_map_mutex;
  903. /* Identifies the device (MINOR_NUM_DEV / MINOR_NUM_SECURE_DEV) */
  904. int dev_minor;
  905. char *debug_buf;
  906. /* Flag to indicate attempt has been made to allocate memory for debug_buf*/
  907. int debug_buf_alloced_attempted;
  908. /* Flag to enable PM wake/relax voting for every remote invoke */
  909. int wake_enable;
  910. struct gid_list gidlist;
  911. /* Number of jobs pending in Async Queue */
  912. atomic_t async_queue_job_count;
  913. /* Async wait queue to synchronize glink response and async thread */
  914. wait_queue_head_t async_wait_queue;
  915. /* IRQ safe spin lock for protecting async queue */
  916. spinlock_t aqlock;
  917. /* Process status notification queue */
  918. struct fastrpc_notif_queue proc_state_notif;
  919. uint32_t ws_timeout;
  920. bool untrusted_process;
  921. struct fastrpc_device *device;
  922. /* Process kill will wait on work when ram dump collection in progress */
  923. struct completion work;
  924. /* Flag to indicate ram dump collection status*/
  925. bool is_ramdump_pend;
  926. /* Flag to indicate type of process (static, dynamic) */
  927. uint32_t proc_flags;
  928. /* If set, threads will poll for DSP response instead of glink wait */
  929. bool poll_mode;
  930. /* Threads poll for specified timeout and fall back to glink wait */
  931. uint32_t poll_timeout;
  932. /* Flag to indicate dynamic process creation status*/
  933. enum fastrpc_process_create_state dsp_process_state;
  934. bool is_unsigned_pd;
  935. /* Flag to indicate 32 bit driver*/
  936. bool is_compat;
  937. /* Completion objects and state for dspsignals */
  938. struct fastrpc_dspsignal *signal_groups[DSPSIGNAL_NUM_SIGNALS / DSPSIGNAL_GROUP_SIZE];
  939. spinlock_t dspsignals_lock;
  940. struct mutex signal_create_mutex;
  941. struct completion shutdown;
  942. };
  943. union fastrpc_ioctl_param {
  944. struct fastrpc_ioctl_invoke_async inv;
  945. struct fastrpc_ioctl_mem_map mem_map;
  946. struct fastrpc_ioctl_mem_unmap mem_unmap;
  947. struct fastrpc_ioctl_mmap mmap;
  948. struct fastrpc_ioctl_mmap_64 mmap64;
  949. struct fastrpc_ioctl_munmap munmap;
  950. struct fastrpc_ioctl_munmap_64 munmap64;
  951. struct fastrpc_ioctl_munmap_fd munmap_fd;
  952. struct fastrpc_ioctl_init_attrs init;
  953. struct fastrpc_ioctl_control cp;
  954. struct fastrpc_ioctl_capability cap;
  955. struct fastrpc_ioctl_invoke2 inv2;
  956. struct fastrpc_ioctl_dspsignal_signal sig;
  957. struct fastrpc_ioctl_dspsignal_wait wait;
  958. struct fastrpc_ioctl_dspsignal_create cre;
  959. struct fastrpc_ioctl_dspsignal_destroy des;
  960. struct fastrpc_ioctl_dspsignal_cancel_wait canc;
  961. };
  962. int fastrpc_internal_invoke(struct fastrpc_file *fl, uint32_t mode,
  963. uint32_t kernel,
  964. struct fastrpc_ioctl_invoke_async *inv);
  965. int fastrpc_internal_invoke2(struct fastrpc_file *fl,
  966. struct fastrpc_ioctl_invoke2 *inv2);
  967. int fastrpc_internal_munmap(struct fastrpc_file *fl,
  968. struct fastrpc_ioctl_munmap *ud);
  969. int fastrpc_internal_mem_map(struct fastrpc_file *fl,
  970. struct fastrpc_ioctl_mem_map *ud);
  971. int fastrpc_internal_mem_unmap(struct fastrpc_file *fl,
  972. struct fastrpc_ioctl_mem_unmap *ud);
  973. int fastrpc_internal_mmap(struct fastrpc_file *fl,
  974. struct fastrpc_ioctl_mmap *ud);
  975. int fastrpc_init_process(struct fastrpc_file *fl,
  976. struct fastrpc_ioctl_init_attrs *uproc);
  977. int fastrpc_get_info(struct fastrpc_file *fl, uint32_t *info);
  978. int fastrpc_internal_control(struct fastrpc_file *fl,
  979. struct fastrpc_ioctl_control *cp);
  980. int fastrpc_setmode(unsigned long ioctl_param,
  981. struct fastrpc_file *fl);
  982. int fastrpc_get_info_from_kernel(
  983. struct fastrpc_ioctl_capability *cap,
  984. struct fastrpc_file *fl);
  985. int fastrpc_dspsignal_signal(struct fastrpc_file *fl,
  986. struct fastrpc_ioctl_dspsignal_signal *sig);
  987. int fastrpc_dspsignal_wait(struct fastrpc_file *fl,
  988. struct fastrpc_ioctl_dspsignal_wait *wait);
  989. int fastrpc_dspsignal_create(struct fastrpc_file *fl,
  990. struct fastrpc_ioctl_dspsignal_create *create);
  991. int fastrpc_dspsignal_destroy(struct fastrpc_file *fl,
  992. struct fastrpc_ioctl_dspsignal_destroy *destroy);
  993. int fastrpc_dspsignal_cancel_wait(struct fastrpc_file *fl,
  994. struct fastrpc_ioctl_dspsignal_cancel_wait *cancel);
  995. void fastrpc_rproc_trace_events(const char *name, const char *event,
  996. const char *subevent);
  997. #endif