diff --git a/Kbuild b/Kbuild index 62fa146890..dd2bdac0da 100644 --- a/Kbuild +++ b/Kbuild @@ -20,6 +20,7 @@ ccflags-y += -DCONFIG_DSP_PINEAPPLE=1 endif LINUXINCLUDE += -I$(DSP_ROOT)/include/linux +LINUXINCLUDE += -I$(DSP_ROOT)/include/uapi frpc-adsprpc-y := dsp/adsprpc.o \ dsp/adsprpc_rpmsg.o \ diff --git a/define_modules.bzl b/define_modules.bzl index 9650e7b173..e6b2eb7be7 100644 --- a/define_modules.bzl +++ b/define_modules.bzl @@ -30,8 +30,14 @@ def define_modules(target, variant): ], local_defines = ["DSP_TRACE_INCLUDE_PATH={}".format(trace_include_path)], out = "frpc-adsprpc.ko", - hdrs = ["include/linux/fastrpc.h"], - includes = ["include/linux"], + hdrs = [ + "include/linux/fastrpc.h", + "include/uapi/fastrpc_shared.h", + ], + includes = [ + "include/linux", + "include/uapi", + ], ) ddk_module( diff --git a/dsp/adsprpc_shared.h b/dsp/adsprpc_shared.h index 7493fc521a..ae5d4f670b 100644 --- a/dsp/adsprpc_shared.h +++ b/dsp/adsprpc_shared.h @@ -8,38 +8,7 @@ #include #include - -#define FASTRPC_IOCTL_INVOKE _IOWR('R', 1, struct fastrpc_ioctl_invoke) -#define FASTRPC_IOCTL_MMAP _IOWR('R', 2, struct fastrpc_ioctl_mmap) -#define FASTRPC_IOCTL_MUNMAP _IOWR('R', 3, struct fastrpc_ioctl_munmap) -#define FASTRPC_IOCTL_MMAP_64 _IOWR('R', 14, struct fastrpc_ioctl_mmap_64) -#define FASTRPC_IOCTL_MUNMAP_64 _IOWR('R', 15, struct fastrpc_ioctl_munmap_64) -#define FASTRPC_IOCTL_INVOKE_FD _IOWR('R', 4, struct fastrpc_ioctl_invoke_fd) -#define FASTRPC_IOCTL_SETMODE _IOWR('R', 5, uint32_t) -#define FASTRPC_IOCTL_INIT _IOWR('R', 6, struct fastrpc_ioctl_init) -#define FASTRPC_IOCTL_INVOKE_ATTRS \ - _IOWR('R', 7, struct fastrpc_ioctl_invoke_attrs) -#define FASTRPC_IOCTL_GETINFO _IOWR('R', 8, uint32_t) -//#define FASTRPC_IOCTL_GETPERF _IOWR('R', 9, struct fastrpc_ioctl_perf) -#define FASTRPC_IOCTL_INIT_ATTRS _IOWR('R', 10, struct fastrpc_ioctl_init_attrs) -#define FASTRPC_IOCTL_INVOKE_CRC _IOWR('R', 11, struct fastrpc_ioctl_invoke_crc) -#define FASTRPC_IOCTL_CONTROL _IOWR('R', 12, struct fastrpc_ioctl_control) -#define FASTRPC_IOCTL_MUNMAP_FD _IOWR('R', 13, struct fastrpc_ioctl_munmap_fd) -#define FASTRPC_IOCTL_GET_DSP_INFO \ - _IOWR('R', 17, struct fastrpc_ioctl_capability) -#define FASTRPC_IOCTL_INVOKE2 _IOWR('R', 18, struct fastrpc_ioctl_invoke2) -#define FASTRPC_IOCTL_MEM_MAP _IOWR('R', 19, struct fastrpc_ioctl_mem_map) -#define FASTRPC_IOCTL_MEM_UNMAP _IOWR('R', 20, struct fastrpc_ioctl_mem_unmap) -#define FASTRPC_IOCTL_INVOKE_PERF \ - _IOWR('R', 21, struct fastrpc_ioctl_invoke_perf) -#define FASTRPC_IOCTL_NOTIF_RSP \ - _IOWR('R', 22, struct fastrpc_ioctl_notif_rsp) -#define FASTRPC_IOCTL_DSPSIGNAL_CREATE _IOWR('R', 23, struct fastrpc_ioctl_dspsignal_create) -#define FASTRPC_IOCTL_DSPSIGNAL_DESTROY _IOWR('R', 24, struct fastrpc_ioctl_dspsignal_destroy) -#define FASTRPC_IOCTL_DSPSIGNAL_SIGNAL _IOWR('R', 25, struct fastrpc_ioctl_dspsignal_signal) -#define FASTRPC_IOCTL_DSPSIGNAL_WAIT _IOWR('R', 26, struct fastrpc_ioctl_dspsignal_wait) -#define FASTRPC_IOCTL_DSPSIGNAL_CANCEL_WAIT \ - _IOWR('R', 27, struct fastrpc_ioctl_dspsignal_cancel_wait) +#include "fastrpc_shared.h" #define FASTRPC_GLINK_GUID "fastrpcglink-apps-dsp" #define FASTRPC_SMD_GUID "fastrpcsmd-apps-dsp" @@ -195,8 +164,6 @@ union remote_arg64 { uint32_t h; }; -#define remote_arg_t union remote_arg - struct remote_buf { void *pv; /* buffer pointer */ size_t len; /* length of buffer */ @@ -222,78 +189,12 @@ union remote_arg { uint32_t h; /* remote handle */ }; -struct fastrpc_ioctl_invoke { - uint32_t handle; /* remote handle */ - uint32_t sc; /* scalars describing the data */ - remote_arg_t *pra; /* remote arguments list */ -}; - -struct fastrpc_ioctl_invoke_fd { - struct fastrpc_ioctl_invoke inv; - int *fds; /* fd list */ -}; - -struct fastrpc_ioctl_invoke_attrs { - struct fastrpc_ioctl_invoke inv; - int *fds; /* fd list */ - unsigned int *attrs; /* attribute list */ -}; - -struct fastrpc_ioctl_invoke_crc { - struct fastrpc_ioctl_invoke inv; - int *fds; /* fd list */ - unsigned int *attrs; /* attribute list */ - unsigned int *crc; -}; - -struct fastrpc_ioctl_invoke_perf { - struct fastrpc_ioctl_invoke inv; - int *fds; - unsigned int *attrs; - unsigned int *crc; - uint64_t *perf_kernel; - uint64_t *perf_dsp; -}; - struct fastrpc_async_job { uint32_t isasyncjob; /* flag to distinguish async job */ uint64_t jobid; /* job id generated by user */ uint32_t reserved; /* reserved */ }; -struct fastrpc_ioctl_invoke_async { - struct fastrpc_ioctl_invoke inv; - int *fds; /* fd list */ - unsigned int *attrs; /* attribute list */ - unsigned int *crc; - uint64_t *perf_kernel; - uint64_t *perf_dsp; - struct fastrpc_async_job *job; /* async job*/ -}; - -struct fastrpc_ioctl_invoke_async_no_perf { - struct fastrpc_ioctl_invoke inv; - int *fds; /* fd list */ - unsigned int *attrs; /* attribute list */ - unsigned int *crc; - struct fastrpc_async_job *job; /* async job*/ -}; - -struct fastrpc_ioctl_async_response { - uint64_t jobid;/* job id generated by user */ - int result; /* result from DSP */ - uint64_t *perf_kernel; - uint64_t *perf_dsp; - uint32_t handle; - uint32_t sc; -}; - -struct fastrpc_ioctl_notif_rsp { - int domain; /* Domain of User PD */ - int session; /* Session ID of User PD */ - uint32_t status; /* Status of the process */ -}; - /* FastRPC ioctl structure to set session related info */ struct fastrpc_proc_sess_info { uint32_t domain_id; /* Set the remote subsystem, Domain ID of the session */ @@ -321,84 +222,6 @@ enum fastrpc_invoke2_type { FASTRPC_INVOKE2_SESS_INFO, }; -struct fastrpc_ioctl_invoke2 { - uint32_t req; /* type of invocation request */ - uintptr_t invparam; /* invocation request param */ - uint32_t size; /* size of invocation param */ - int err; /* reserved */ -}; - -struct fastrpc_ioctl_init { - uint32_t flags; /* one of FASTRPC_INIT_* macros */ - uintptr_t file; /* pointer to elf file */ - uint32_t filelen; /* elf file length */ - int32_t filefd; /* ION fd for the file */ - uintptr_t mem; /* mem for the PD */ - uint32_t memlen; /* mem length */ - int32_t memfd; /* ION fd for the mem */ -}; - -struct fastrpc_ioctl_init_attrs { - struct fastrpc_ioctl_init init; - int attrs; - unsigned int siglen; -}; - -struct fastrpc_ioctl_munmap { - uintptr_t vaddrout; /* address to unmap */ - size_t size; /* size */ -}; - -struct fastrpc_ioctl_munmap_64 { - uint64_t vaddrout; /* address to unmap */ - size_t size; /* size */ -}; - -struct fastrpc_ioctl_mmap { - int fd; /* ion fd */ - uint32_t flags; /* flags for dsp to map with */ - uintptr_t vaddrin; /* optional virtual address */ - size_t size; /* size */ - uintptr_t vaddrout; /* dsps virtual address */ -}; - -struct fastrpc_ioctl_mmap_64 { - int fd; /* ion fd */ - uint32_t flags; /* flags for dsp to map with */ - uint64_t vaddrin; /* optional virtual address */ - size_t size; /* size */ - uint64_t vaddrout; /* dsps virtual address */ -}; - -struct fastrpc_ioctl_munmap_fd { - int fd; /* fd */ - uint32_t flags; /* control flags */ - uintptr_t va; /* va */ - ssize_t len; /* length */ -}; - -struct fastrpc_ioctl_dspsignal_create { - uint32_t signal_id; /* Signal ID */ - uint32_t flags; /* Flags, currently unused */ -}; - -struct fastrpc_ioctl_dspsignal_destroy { - uint32_t signal_id; /* Signal ID */ -}; - -struct fastrpc_ioctl_dspsignal_signal { - uint32_t signal_id; /* Signal ID */ -}; - -struct fastrpc_ioctl_dspsignal_wait { - uint32_t signal_id; /* Signal ID */ - uint32_t timeout_usec; /* Timeout in microseconds. UINT32_MAX for an infinite wait */ -}; - -struct fastrpc_ioctl_dspsignal_cancel_wait { - uint32_t signal_id; /* Signal ID */ -}; - /** * Control flags for mapping memory on DSP user process */ @@ -439,44 +262,6 @@ enum fastrpc_map_flags { FASTRPC_MAP_MAX, }; -struct fastrpc_mem_map { - int fd; /* ion fd */ - int offset; /* buffer offset */ - uint32_t flags; /* flags defined in enum fastrpc_map_flags */ - int attrs; /* buffer attributes used for SMMU mapping */ - uintptr_t vaddrin; /* buffer virtual address */ - size_t length; /* buffer length */ - uint64_t vaddrout; /* [out] remote virtual address */ -}; - -/* Map and unmap IOCTL methods reserved memory size for future extensions */ -#define MAP_RESERVED_NUM (14) -#define UNMAP_RESERVED_NUM (10) - -/* map memory to DSP device */ -struct fastrpc_ioctl_mem_map { - int version; /* Initial version 0 */ - union { - struct fastrpc_mem_map m; - int reserved[MAP_RESERVED_NUM]; - }; -}; - -struct fastrpc_mem_unmap { - int fd; /* ion fd */ - uint64_t vaddr; /* remote process (dsp) virtual address */ - size_t length; /* buffer size */ -}; - -/* unmap memory to DSP device */ -struct fastrpc_ioctl_mem_unmap { - int version; /* Initial version 0 */ - union { - struct fastrpc_mem_unmap um; - int reserved[UNMAP_RESERVED_NUM]; - }; -}; - /* * This enum is shared with DSP. So, existing values should NOT * be modified. Only new members can be added. @@ -515,38 +300,6 @@ enum fastrpc_control_type { FASTRPC_CONTROL_NOTIF_WAKE = 9, }; -struct fastrpc_ctrl_latency { - uint32_t enable; /* latency control enable */ - uint32_t latency; /* latency request in us */ -}; - -struct fastrpc_ctrl_kalloc { - uint32_t kalloc_support; /* Remote memory allocation from kernel */ -}; - -struct fastrpc_ctrl_wakelock { - uint32_t enable; /* wakelock control enable */ -}; - -struct fastrpc_ctrl_pm { - uint32_t timeout; /* timeout(in ms) for PM to keep system awake */ -}; - -struct fastrpc_ctrl_smmu { - uint32_t sharedcb; /* Set to SMMU share context bank */ -}; - -struct fastrpc_ioctl_control { - uint32_t req; - union { - struct fastrpc_ctrl_latency lp; - struct fastrpc_ctrl_kalloc kalloc; - struct fastrpc_ctrl_wakelock wp; - struct fastrpc_ctrl_pm pm; - struct fastrpc_ctrl_smmu smmu; - }; -}; - #define FASTRPC_MAX_DSP_ATTRIBUTES (256) #define FASTRPC_MAX_ATTRIBUTES (260) @@ -555,12 +308,6 @@ enum fastrpc_dsp_capability { DMA_HANDLE_REVERSE_RPC_CAP = 129, }; -struct fastrpc_ioctl_capability { - uint32_t domain; - uint32_t attribute_ID; - uint32_t capability; -}; - struct smq_null_invoke { uint64_t ctx; /* invoke caller context */ uint32_t handle; /* handle to invoke */ @@ -1164,26 +911,6 @@ struct fastrpc_file { struct fastrpc_proc_sharedbuf_info sharedbuf_info; }; -union fastrpc_ioctl_param { - struct fastrpc_ioctl_invoke_async inv; - struct fastrpc_ioctl_mem_map mem_map; - struct fastrpc_ioctl_mem_unmap mem_unmap; - struct fastrpc_ioctl_mmap mmap; - struct fastrpc_ioctl_mmap_64 mmap64; - struct fastrpc_ioctl_munmap munmap; - struct fastrpc_ioctl_munmap_64 munmap64; - struct fastrpc_ioctl_munmap_fd munmap_fd; - struct fastrpc_ioctl_init_attrs init; - struct fastrpc_ioctl_control cp; - struct fastrpc_ioctl_capability cap; - struct fastrpc_ioctl_invoke2 inv2; - struct fastrpc_ioctl_dspsignal_signal sig; - struct fastrpc_ioctl_dspsignal_wait wait; - struct fastrpc_ioctl_dspsignal_create cre; - struct fastrpc_ioctl_dspsignal_destroy des; - struct fastrpc_ioctl_dspsignal_cancel_wait canc; -}; - int fastrpc_internal_invoke(struct fastrpc_file *fl, uint32_t mode, uint32_t kernel, struct fastrpc_ioctl_invoke_async *inv); diff --git a/include/uapi/fastrpc_shared.h b/include/uapi/fastrpc_shared.h index 4c0fd38bec..e8f9a0da80 100644 --- a/include/uapi/fastrpc_shared.h +++ b/include/uapi/fastrpc_shared.h @@ -7,7 +7,6 @@ #define FASTRPC_IOCTL_H #include -#include #define remote_arg_t union remote_arg /* Map and unmap IOCTL methods reserved memory size for future extensions */