1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
3 #ifndef __QCOM_FASTRPC_H__
4 #define __QCOM_FASTRPC_H__
6 #include <linux/types.h>
8 #define FASTRPC_IOCTL_ALLOC_DMA_BUFF _IOWR('R', 1, struct fastrpc_alloc_dma_buf)
9 #define FASTRPC_IOCTL_FREE_DMA_BUFF _IOWR('R', 2, __u32)
10 #define FASTRPC_IOCTL_INVOKE _IOWR('R', 3, struct fastrpc_invoke)
11 #define FASTRPC_IOCTL_INIT_ATTACH _IO('R', 4)
12 #define FASTRPC_IOCTL_INIT_CREATE _IOWR('R', 5, struct fastrpc_init_create)
13 #define FASTRPC_IOCTL_MMAP _IOWR('R', 6, struct fastrpc_req_mmap)
14 #define FASTRPC_IOCTL_MUNMAP _IOWR('R', 7, struct fastrpc_req_munmap)
15 #define FASTRPC_IOCTL_INIT_ATTACH_SNS _IO('R', 8)
16 #define FASTRPC_IOCTL_MEM_MAP _IOWR('R', 10, struct fastrpc_mem_map)
17 #define FASTRPC_IOCTL_MEM_UNMAP _IOWR('R', 11, struct fastrpc_mem_unmap)
18 #define FASTRPC_IOCTL_GET_DSP_INFO _IOWR('R', 13, struct fastrpc_ioctl_capability)
21 * enum fastrpc_map_flags - control flags for mapping memory on DSP user process
22 * @FASTRPC_MAP_STATIC: Map memory pages with RW- permission and CACHE WRITEBACK.
23 * The driver is responsible for cache maintenance when passed
24 * the buffer to FastRPC calls. Same virtual address will be
25 * assigned for subsequent FastRPC calls.
26 * @FASTRPC_MAP_RESERVED: Reserved
27 * @FASTRPC_MAP_FD: Map memory pages with RW- permission and CACHE WRITEBACK.
28 * Mapping tagged with a file descriptor. User is responsible for
29 * CPU and DSP cache maintenance for the buffer. Get virtual address
30 * of buffer on DSP using HAP_mmap_get() and HAP_mmap_put() APIs.
31 * @FASTRPC_MAP_FD_DELAYED: Mapping delayed until user call HAP_mmap() and HAP_munmap()
32 * functions on DSP. It is useful to map a buffer with cache modes
33 * other than default modes. User is responsible for CPU and DSP
34 * cache maintenance for the buffer.
35 * @FASTRPC_MAP_FD_NOMAP: This flag is used to skip CPU mapping,
36 * otherwise behaves similar to FASTRPC_MAP_FD_DELAYED flag.
37 * @FASTRPC_MAP_MAX: max count for flags
40 enum fastrpc_map_flags {
41 FASTRPC_MAP_STATIC = 0,
44 FASTRPC_MAP_FD_DELAYED,
45 FASTRPC_MAP_FD_NOMAP = 16,
49 enum fastrpc_proc_attr {
50 /* Macro for Debug attr */
51 FASTRPC_MODE_DEBUG = (1 << 0),
52 /* Macro for Ptrace */
53 FASTRPC_MODE_PTRACE = (1 << 1),
54 /* Macro for CRC Check */
55 FASTRPC_MODE_CRC = (1 << 2),
56 /* Macro for Unsigned PD */
57 FASTRPC_MODE_UNSIGNED_MODULE = (1 << 3),
58 /* Macro for Adaptive QoS */
59 FASTRPC_MODE_ADAPTIVE_QOS = (1 << 4),
60 /* Macro for System Process */
61 FASTRPC_MODE_SYSTEM_PROCESS = (1 << 5),
62 /* Macro for Prvileged Process */
63 FASTRPC_MODE_PRIVILEGED = (1 << 6),
66 /* Fastrpc attribute for memory protection of buffers */
67 #define FASTRPC_ATTR_SECUREMAP (1)
69 struct fastrpc_invoke_args {
76 struct fastrpc_invoke {
82 struct fastrpc_init_create {
83 __u32 filelen; /* elf file length */
84 __s32 filefd; /* fd for the file */
87 __u64 file; /* pointer to elf file */
90 struct fastrpc_alloc_dma_buf {
92 __u32 flags; /* flags to map with */
93 __u64 size; /* size */
96 struct fastrpc_req_mmap {
98 __u32 flags; /* flags for dsp to map with */
99 __u64 vaddrin; /* optional virtual address */
100 __u64 size; /* size */
101 __u64 vaddrout; /* dsp virtual address */
104 struct fastrpc_mem_map {
107 __s32 offset; /* buffer offset */
108 __u32 flags; /* flags defined in enum fastrpc_map_flags */
109 __u64 vaddrin; /* buffer virtual address */
110 __u64 length; /* buffer length */
111 __u64 vaddrout; /* [out] remote virtual address */
112 __s32 attrs; /* buffer attributes used for SMMU mapping */
116 struct fastrpc_req_munmap {
117 __u64 vaddrout; /* address to unmap */
118 __u64 size; /* size */
121 struct fastrpc_mem_unmap {
124 __u64 vaddr; /* remote process (dsp) virtual address */
125 __u64 length; /* buffer size */
129 struct fastrpc_ioctl_capability {
132 __u32 capability; /* dsp capability */
136 #endif /* __QCOM_FASTRPC_H__ */