mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-08 12:58:12 -04:00
Merge "msm: adsprpc: Driver capability"
This commit is contained in:
commit
c8694fd073
3 changed files with 46 additions and 33 deletions
|
|
@ -596,6 +596,12 @@ static struct fastrpc_channel_ctx gcinfo[NUM_CHANNELS] = {
|
|||
static int hlosvm[1] = {VMID_HLOS};
|
||||
static int hlosvmperm[1] = {PERM_READ | PERM_WRITE | PERM_EXEC};
|
||||
|
||||
static uint32_t kernel_capabilities[FASTRPC_MAX_ATTRIBUTES -
|
||||
FASTRPC_MAX_DSP_ATTRIBUTES] = {
|
||||
1
|
||||
/* PERF_LOGGING_V2_SUPPORT feature is supported, unsupported = 0 */
|
||||
};
|
||||
|
||||
static inline void fastrpc_pm_awake(struct fastrpc_file *fl, int channel_type);
|
||||
|
||||
static inline int64_t getnstimediff(struct timespec64 *start)
|
||||
|
|
@ -3222,31 +3228,37 @@ bail:
|
|||
}
|
||||
|
||||
static int fastrpc_get_info_from_kernel(
|
||||
struct fastrpc_ioctl_remote_dsp_capability *dsp_cap,
|
||||
struct fastrpc_ioctl_capability *cap,
|
||||
struct fastrpc_file *fl)
|
||||
{
|
||||
int err = 0;
|
||||
uint32_t domain_support;
|
||||
uint32_t domain = dsp_cap->domain;
|
||||
uint32_t domain = cap->domain;
|
||||
uint32_t async_capability = IS_ASYNC_FASTRPC_AVAILABLE;
|
||||
struct fastrpc_dsp_capabilities *dsp_cap_ptr;
|
||||
|
||||
VERIFY(err, dsp_cap->domain < NUM_CHANNELS);
|
||||
VERIFY(err, cap->domain < NUM_CHANNELS);
|
||||
|
||||
/*
|
||||
* Check if number of attribute IDs obtained from userspace
|
||||
* is less than the number of attribute IDs supported by
|
||||
* kernel
|
||||
*/
|
||||
if (dsp_cap->attribute_ID >= FASTRPC_MAX_DSP_ATTRIBUTES) {
|
||||
if (cap->attribute_ID >= FASTRPC_MAX_ATTRIBUTES) {
|
||||
err = EOVERFLOW;
|
||||
dsp_cap->capability = 0;
|
||||
cap->capability = 0;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
dsp_cap_ptr = &gcinfo[domain].dsp_cap_kernel;
|
||||
|
||||
if (!dsp_cap_ptr->is_cached) {
|
||||
if (cap->attribute_ID >= FASTRPC_MAX_DSP_ATTRIBUTES) {
|
||||
// Driver capability, pass it to user
|
||||
memcpy(&cap->capability,
|
||||
&kernel_capabilities[cap->attribute_ID -
|
||||
FASTRPC_MAX_DSP_ATTRIBUTES],
|
||||
sizeof(cap->capability));
|
||||
} else if (!dsp_cap_ptr->is_cached) {
|
||||
/*
|
||||
* Information not on kernel, query device for information
|
||||
* and cache on kernel
|
||||
|
|
@ -3266,8 +3278,8 @@ static int fastrpc_get_info_from_kernel(
|
|||
memset(&dsp_cap_ptr->dsp_attributes,
|
||||
0,
|
||||
sizeof(dsp_cap_ptr->dsp_attributes));
|
||||
memset(&dsp_cap->capability,
|
||||
0, sizeof(dsp_cap->capability));
|
||||
memset(&cap->capability,
|
||||
0, sizeof(cap->capability));
|
||||
break;
|
||||
case 1:
|
||||
async_capability =
|
||||
|
|
@ -3275,9 +3287,9 @@ static int fastrpc_get_info_from_kernel(
|
|||
dsp_cap_ptr->dsp_attributes[ASYNC_FASTRPC_CAP];
|
||||
dsp_cap_ptr->dsp_attributes[ASYNC_FASTRPC_CAP] =
|
||||
async_capability;
|
||||
memcpy(&dsp_cap->capability,
|
||||
&dsp_cap_ptr->dsp_attributes[dsp_cap->attribute_ID],
|
||||
sizeof(dsp_cap->capability));
|
||||
memcpy(&cap->capability,
|
||||
&dsp_cap_ptr->dsp_attributes[cap->attribute_ID],
|
||||
sizeof(cap->capability));
|
||||
break;
|
||||
default:
|
||||
err = -1;
|
||||
|
|
@ -3295,9 +3307,9 @@ static int fastrpc_get_info_from_kernel(
|
|||
dsp_cap_ptr->is_cached = 1;
|
||||
} else {
|
||||
// Information on Kernel, pass it to user
|
||||
memcpy(&dsp_cap->capability,
|
||||
&dsp_cap_ptr->dsp_attributes[dsp_cap->attribute_ID],
|
||||
sizeof(dsp_cap->capability));
|
||||
memcpy(&cap->capability,
|
||||
&dsp_cap_ptr->dsp_attributes[cap->attribute_ID],
|
||||
sizeof(cap->capability));
|
||||
}
|
||||
bail:
|
||||
return err;
|
||||
|
|
@ -4698,27 +4710,27 @@ bail:
|
|||
}
|
||||
|
||||
static int fastrpc_get_dsp_info(
|
||||
struct fastrpc_ioctl_remote_dsp_capability *dsp_cap,
|
||||
struct fastrpc_ioctl_capability *cap,
|
||||
void *param, struct fastrpc_file *fl)
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
K_COPY_FROM_USER(err, 0, dsp_cap, param,
|
||||
sizeof(struct fastrpc_ioctl_remote_dsp_capability));
|
||||
VERIFY(err, dsp_cap->domain < NUM_CHANNELS);
|
||||
K_COPY_FROM_USER(err, 0, cap, param,
|
||||
sizeof(struct fastrpc_ioctl_capability));
|
||||
VERIFY(err, cap->domain < NUM_CHANNELS);
|
||||
if (err)
|
||||
goto bail;
|
||||
|
||||
err = fastrpc_get_info_from_kernel(dsp_cap, fl);
|
||||
err = fastrpc_get_info_from_kernel(cap, fl);
|
||||
if (err)
|
||||
goto bail;
|
||||
K_COPY_TO_USER(
|
||||
err,
|
||||
0,
|
||||
&((struct fastrpc_ioctl_remote_dsp_capability *)
|
||||
&((struct fastrpc_ioctl_capability *)
|
||||
param)->capability,
|
||||
&dsp_cap->capability,
|
||||
sizeof(dsp_cap->capability));
|
||||
&cap->capability,
|
||||
sizeof(cap->capability));
|
||||
bail:
|
||||
return err;
|
||||
}
|
||||
|
|
@ -4736,7 +4748,7 @@ static long fastrpc_device_ioctl(struct file *file, unsigned int ioctl_num,
|
|||
struct fastrpc_ioctl_init_attrs init;
|
||||
struct fastrpc_ioctl_perf perf;
|
||||
struct fastrpc_ioctl_control cp;
|
||||
struct fastrpc_ioctl_remote_dsp_capability dsp_cap;
|
||||
struct fastrpc_ioctl_capability cap;
|
||||
struct fastrpc_ioctl_invoke2 inv2;
|
||||
} p;
|
||||
union {
|
||||
|
|
@ -4892,7 +4904,7 @@ static long fastrpc_device_ioctl(struct file *file, unsigned int ioctl_num,
|
|||
goto bail;
|
||||
break;
|
||||
case FASTRPC_IOCTL_GET_DSP_INFO:
|
||||
err = fastrpc_get_dsp_info(&p.dsp_cap, param, fl);
|
||||
err = fastrpc_get_dsp_info(&p.cap, param, fl);
|
||||
break;
|
||||
default:
|
||||
err = -ENOTTY;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
_IOWR('R', 15, struct compat_fastrpc_ioctl_munmap_64)
|
||||
#define COMPAT_FASTRPC_IOCTL_GET_DSP_INFO \
|
||||
_IOWR('R', 17, \
|
||||
struct compat_fastrpc_ioctl_remote_dsp_capability)
|
||||
struct compat_fastrpc_ioctl_capability)
|
||||
#define COMPAT_FASTRPC_IOCTL_INVOKE2 \
|
||||
_IOWR('R', 18, struct compat_fastrpc_ioctl_invoke2)
|
||||
|
||||
|
|
@ -166,7 +166,7 @@ struct compat_fastrpc_ioctl_control {
|
|||
};
|
||||
};
|
||||
|
||||
struct compat_fastrpc_ioctl_remote_dsp_capability {
|
||||
struct compat_fastrpc_ioctl_capability {
|
||||
/*
|
||||
* @param[in]: DSP domain ADSP_DOMAIN_ID,
|
||||
* SDSP_DOMAIN_ID, or CDSP_DOMAIN_ID
|
||||
|
|
@ -555,8 +555,8 @@ static int compat_get_fastrpc_ioctl_init(
|
|||
}
|
||||
|
||||
static int compat_put_fastrpc_ioctl_get_dsp_info(
|
||||
struct compat_fastrpc_ioctl_remote_dsp_capability __user *info32,
|
||||
struct fastrpc_ioctl_remote_dsp_capability __user *info)
|
||||
struct compat_fastrpc_ioctl_capability __user *info32,
|
||||
struct fastrpc_ioctl_capability __user *info)
|
||||
{
|
||||
compat_uint_t u;
|
||||
int err = 0;
|
||||
|
|
@ -634,8 +634,8 @@ static int compat_fastrpc_getperf(struct file *filp,
|
|||
static int compat_fastrpc_get_dsp_info(struct file *filp,
|
||||
unsigned long arg)
|
||||
{
|
||||
struct compat_fastrpc_ioctl_remote_dsp_capability __user *info32;
|
||||
struct fastrpc_ioctl_remote_dsp_capability *info;
|
||||
struct compat_fastrpc_ioctl_capability __user *info32;
|
||||
struct fastrpc_ioctl_capability *info;
|
||||
compat_uint_t u;
|
||||
long ret;
|
||||
int err = 0;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#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_remote_dsp_capability)
|
||||
_IOWR('R', 17, struct fastrpc_ioctl_capability)
|
||||
#define FASTRPC_IOCTL_INVOKE2 _IOWR('R', 18, struct fastrpc_ioctl_invoke2)
|
||||
|
||||
|
||||
|
|
@ -312,10 +312,11 @@ struct fastrpc_ioctl_control {
|
|||
};
|
||||
};
|
||||
|
||||
#define FASTRPC_MAX_DSP_ATTRIBUTES (10)
|
||||
#define FASTRPC_MAX_DSP_ATTRIBUTES (256)
|
||||
#define FASTRPC_MAX_ATTRIBUTES (257)
|
||||
#define ASYNC_FASTRPC_CAP (9)
|
||||
|
||||
struct fastrpc_ioctl_remote_dsp_capability {
|
||||
struct fastrpc_ioctl_capability {
|
||||
uint32_t domain;
|
||||
uint32_t attribute_ID;
|
||||
uint32_t capability;
|
||||
|
|
|
|||
Loading…
Reference in a new issue