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_INIT_CREATE_STATIC _IOWR('R', 9, struct fastrpc_init_create_static)
17 #define FASTRPC_IOCTL_MEM_MAP _IOWR('R', 10, struct fastrpc_mem_map)
18 #define FASTRPC_IOCTL_MEM_UNMAP _IOWR('R', 11, struct fastrpc_mem_unmap)
19 #define FASTRPC_IOCTL_GET_DSP_INFO _IOWR('R', 13, struct fastrpc_ioctl_capability)
22 * enum fastrpc_map_flags - control flags for mapping memory on DSP user process
23 * @FASTRPC_MAP_STATIC: Map memory pages with RW- permission and CACHE WRITEBACK.
24 * The driver is responsible for cache maintenance when passed
25 * the buffer to FastRPC calls. Same virtual address will be
26 * assigned for subsequent FastRPC calls.
27 * @FASTRPC_MAP_RESERVED: Reserved
28 * @FASTRPC_MAP_FD: Map memory pages with RW- permission and CACHE WRITEBACK.
29 * Mapping tagged with a file descriptor. User is responsible for
30 * CPU and DSP cache maintenance for the buffer. Get virtual address
31 * of buffer on DSP using HAP_mmap_get() and HAP_mmap_put() APIs.
32 * @FASTRPC_MAP_FD_DELAYED: Mapping delayed until user call HAP_mmap() and HAP_munmap()
33 * functions on DSP. It is useful to map a buffer with cache modes
34 * other than default modes. User is responsible for CPU and DSP
35 * cache maintenance for the buffer.
36 * @FASTRPC_MAP_FD_NOMAP: This flag is used to skip CPU mapping,
37 * otherwise behaves similar to FASTRPC_MAP_FD_DELAYED flag.
38 * @FASTRPC_MAP_MAX: max count for flags
41 enum fastrpc_map_flags
{
42 FASTRPC_MAP_STATIC
= 0,
45 FASTRPC_MAP_FD_DELAYED
,
46 FASTRPC_MAP_FD_NOMAP
= 16,
50 enum fastrpc_proc_attr
{
51 /* Macro for Debug attr */
52 FASTRPC_MODE_DEBUG
= (1 << 0),
53 /* Macro for Ptrace */
54 FASTRPC_MODE_PTRACE
= (1 << 1),
55 /* Macro for CRC Check */
56 FASTRPC_MODE_CRC
= (1 << 2),
57 /* Macro for Unsigned PD */
58 FASTRPC_MODE_UNSIGNED_MODULE
= (1 << 3),
59 /* Macro for Adaptive QoS */
60 FASTRPC_MODE_ADAPTIVE_QOS
= (1 << 4),
61 /* Macro for System Process */
62 FASTRPC_MODE_SYSTEM_PROCESS
= (1 << 5),
63 /* Macro for Prvileged Process */
64 FASTRPC_MODE_PRIVILEGED
= (1 << 6),
67 /* Fastrpc attribute for memory protection of buffers */
68 #define FASTRPC_ATTR_SECUREMAP (1)
70 struct fastrpc_invoke_args
{
77 struct fastrpc_invoke
{
83 struct fastrpc_init_create
{
84 __u32 filelen
; /* elf file length */
85 __s32 filefd
; /* fd for the file */
88 __u64 file
; /* pointer to elf file */
91 struct fastrpc_init_create_static
{
92 __u32 namelen
; /* length of pd process name */
94 __u64 name
; /* pd process name */
97 struct fastrpc_alloc_dma_buf
{
99 __u32 flags
; /* flags to map with */
100 __u64 size
; /* size */
103 struct fastrpc_req_mmap
{
105 __u32 flags
; /* flags for dsp to map with */
106 __u64 vaddrin
; /* optional virtual address */
107 __u64 size
; /* size */
108 __u64 vaddrout
; /* dsp virtual address */
111 struct fastrpc_mem_map
{
114 __s32 offset
; /* buffer offset */
115 __u32 flags
; /* flags defined in enum fastrpc_map_flags */
116 __u64 vaddrin
; /* buffer virtual address */
117 __u64 length
; /* buffer length */
118 __u64 vaddrout
; /* [out] remote virtual address */
119 __s32 attrs
; /* buffer attributes used for SMMU mapping */
123 struct fastrpc_req_munmap
{
124 __u64 vaddrout
; /* address to unmap */
125 __u64 size
; /* size */
128 struct fastrpc_mem_unmap
{
131 __u64 vaddr
; /* remote process (dsp) virtual address */
132 __u64 length
; /* buffer size */
136 struct fastrpc_ioctl_capability
{
139 __u32 capability
; /* dsp capability */
143 #endif /* __QCOM_FASTRPC_H__ */