Add 'qcom/opensource/dsp-kernel/' from commit 'ca5dc8ec8dfe988ba23cf4d4497f932154a6021a'
git-subtree-dir: qcom/opensource/dsp-kernel git-subtree-mainline:1841c0f616
git-subtree-split:ca5dc8ec8d
Change-Id: repo: https://git.codelinaro.org/clo/la/platform/vendor/qcom/opensource/dsp-kernel tag: LA.VENDOR.14.3.0.r1-17300-lanai.QSSI15.0
This commit is contained in:
158
qcom/opensource/dsp-kernel/include/linux/fastrpc.h
Normal file
158
qcom/opensource/dsp-kernel/include/linux/fastrpc.h
Normal file
@@ -0,0 +1,158 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2021, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_fastrpc_H
|
||||
#define __LINUX_fastrpc_H
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/kernel.h>
|
||||
|
||||
#define FASTRPC_DRV_NAME_SIZE 32
|
||||
|
||||
enum fastrpc_driver_status {
|
||||
FASTRPC_PROC_DOWN = 0,
|
||||
};
|
||||
enum fastrpc_driver_invoke_nums {
|
||||
FASTRPC_DEV_MAP_DMA = 1,
|
||||
FASTRPC_DEV_UNMAP_DMA,
|
||||
FASTRPC_DEV_GET_HLOS_PID,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct fastrpc_dev_map_dma - fastrpc dma buffer map structure
|
||||
* @buf : Shared DMA buf object
|
||||
* @attrs : Attributes to map buffer on IOMMU
|
||||
* @size : Size of DMA buffer
|
||||
* @v_dsp_addr : Virtual addr of DSP after mapping the buffer on DSP
|
||||
*/
|
||||
struct fastrpc_dev_map_dma {
|
||||
struct dma_buf *buf;
|
||||
uint32_t attrs;
|
||||
size_t size;
|
||||
uint64_t v_dsp_addr;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct fastrpc_dev_unmap_dma - fastrpc dma buffer unmap structure
|
||||
* @buf : Shared DMA buf object
|
||||
* @size : Size of DMA buffer
|
||||
*/
|
||||
struct fastrpc_dev_unmap_dma {
|
||||
struct dma_buf *buf;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct fastrpc_dev_get_hlos_pid - fastrpc dma buffer unmap structure
|
||||
* @hlos_pid : HLOS PID of attached device
|
||||
*/
|
||||
struct fastrpc_dev_get_hlos_pid {
|
||||
int hlos_pid;
|
||||
};
|
||||
|
||||
/**
|
||||
* fastrpc_device - device that belong to the fastrpc bus
|
||||
* @hn: Head node to add to fastrpc device list
|
||||
* @dev: the device struct
|
||||
* @handle: handle of the process
|
||||
* @fl: process file of fastrpc device
|
||||
* @dev_close: flag to determine if device is closed
|
||||
* @refs: reference count of drivers using the device
|
||||
*/
|
||||
struct fastrpc_device {
|
||||
struct hlist_node hn;
|
||||
struct device dev;
|
||||
int handle;
|
||||
struct fastrpc_file *fl;
|
||||
bool dev_close;
|
||||
unsigned int refs;
|
||||
};
|
||||
|
||||
#define to_fastrpc_device(d) container_of(d, struct fastrpc_device, dev)
|
||||
|
||||
/**
|
||||
* struct fastrpc_driver - fastrpc driver struct
|
||||
* @hn: Node to add to fastrpc driver list
|
||||
* @driver: underlying device driver
|
||||
* @device: device that is matching to driver
|
||||
* @handle: handle of the process
|
||||
* @create: 0 to attach, 1 to create process
|
||||
* @probe: invoked when a matching fastrpc device (i.e. device) is found
|
||||
* @callback: invoked when there is a status change in the process
|
||||
*/
|
||||
struct fastrpc_driver {
|
||||
struct hlist_node hn;
|
||||
struct device_driver driver;
|
||||
struct device *device;
|
||||
int handle;
|
||||
int create;
|
||||
int (*probe)(struct fastrpc_device *dev);
|
||||
int (*callback)(struct fastrpc_device *dev,
|
||||
enum fastrpc_driver_status status);
|
||||
};
|
||||
|
||||
#define to_fastrpc_driver(x) container_of((x), struct fastrpc_driver, driver)
|
||||
|
||||
//#if IS_ENABLED(CONFIG_MSM_ADSPRPC) || IS_ENABLED(CONFIG_MSM_ADSPRPC_TRUSTED)
|
||||
/**
|
||||
* function fastrpc_driver_register - Register fastrpc driver
|
||||
* @drv: Initialized fastrpc driver structure pointer
|
||||
*/
|
||||
int fastrpc_driver_register(struct fastrpc_driver *drv);
|
||||
|
||||
/**
|
||||
* function fastrpc_driver_unregister - Un-register fastrpc driver
|
||||
* @drv: fastrpc driver structure pointer
|
||||
*/
|
||||
void fastrpc_driver_unregister(struct fastrpc_driver *drv);
|
||||
|
||||
/**
|
||||
* function fastrpc_driver_invoke - fastrpc driver invocation function
|
||||
* Invoke fastrpc driver using fastrpc_device received in probe of registration
|
||||
* @dev : Device received in probe of registration.
|
||||
* @invoke_num : Invocation number of operation,
|
||||
* one of "fastrpc_driver_invoke_nums"
|
||||
* @invoke_param: Address of invocation structure corresponding to invoke_num
|
||||
* (struct fastrpc_dev_map_dma *) for FASTRPC_DEV_MAP_DMA
|
||||
* (struct fastrpc_dev_unmap_dma *) for FASTRPC_DEV_UNMAP_DMA.
|
||||
*/
|
||||
long fastrpc_driver_invoke(struct fastrpc_device *dev,
|
||||
enum fastrpc_driver_invoke_nums invoke_num, unsigned long invoke_param);
|
||||
|
||||
/*
|
||||
#else
|
||||
static inline int fastrpc_driver_register(struct fastrpc_driver *drv)
|
||||
{ return 0; }
|
||||
|
||||
static inline void fastrpc_driver_unregister(struct fastrpc_driver *drv)
|
||||
{ return; }
|
||||
|
||||
static inline long fastrpc_driver_invoke(struct fastrpc_device *dev,
|
||||
enum fastrpc_driver_invoke_nums invoke_num, unsigned long invoke_param)
|
||||
{ return 0; }
|
||||
#endif
|
||||
*/
|
||||
/**
|
||||
* module_fastrpc_driver() - Helper macro for registering a fastrpc driver
|
||||
* @__fastrpc_driver: fastrpc_driver struct
|
||||
*
|
||||
* Helper macro for fastrpc drivers which do not do anything special in module
|
||||
* init/exit. This eliminates a lot of boilerplate code. Each module may only
|
||||
* use this macro once, and calling it replaces module_init and module_exit.
|
||||
*/
|
||||
#define module_fastrpc_driver(__fastrpc_driver) \
|
||||
static int __init __fastrpc_driver##_init(void) \
|
||||
{ \
|
||||
return fastrpc_driver_register(&(__fastrpc_driver)); \
|
||||
} \
|
||||
module_init(__fastrpc_driver##_init); \
|
||||
static void __exit __fastrpc_driver##_exit(void) \
|
||||
{ \
|
||||
fastrpc_driver_unregister(&(__fastrpc_driver)); \
|
||||
} \
|
||||
module_exit(__fastrpc_driver##_exit)
|
||||
|
||||
#endif /* __LINUX_fastrpc_H */
|
284
qcom/opensource/dsp-kernel/include/uapi/fastrpc_shared.h
Normal file
284
qcom/opensource/dsp-kernel/include/uapi/fastrpc_shared.h
Normal file
@@ -0,0 +1,284 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
|
||||
/*
|
||||
* Copyright (c) 2023, Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef FASTRPC_IOCTL_H
|
||||
#define FASTRPC_IOCTL_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
#define remote_arg_t union remote_arg
|
||||
/* Map and unmap IOCTL methods reserved memory size for future extensions */
|
||||
#define MAP_RESERVED_NUM (14)
|
||||
#define UNMAP_RESERVED_NUM (10)
|
||||
|
||||
#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)
|
||||
|
||||
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 */
|
||||
};
|
||||
|
||||
struct fastrpc_mem_unmap {
|
||||
int fd; /* ion fd */
|
||||
uint64_t vaddr; /* remote process (dsp) virtual address */
|
||||
size_t length; /* buffer size */
|
||||
};
|
||||
|
||||
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_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_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 */
|
||||
};
|
||||
|
||||
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 */
|
||||
};
|
||||
|
||||
/* 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];
|
||||
};
|
||||
};
|
||||
|
||||
/* 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];
|
||||
};
|
||||
};
|
||||
|
||||
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;
|
||||
};
|
||||
};
|
||||
|
||||
struct fastrpc_ioctl_capability {
|
||||
uint32_t domain;
|
||||
uint32_t attribute_ID;
|
||||
uint32_t capability;
|
||||
};
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user