Loading drivers/char/adsprpc.c +37 −11 Original line number Diff line number Diff line Loading @@ -58,7 +58,8 @@ #define BALIGN 128 #define NUM_CHANNELS 4 /* adsp, mdsp, slpi, cdsp*/ #define NUM_SESSIONS 9 /*8 compute, 1 cpz*/ #define M_FDLIST 16 #define M_FDLIST (16) #define M_CRCLIST (64) #define IS_CACHE_ALIGNED(x) (((x) & ((L1_CACHE_BYTES)-1)) == 0) Loading Loading @@ -172,6 +173,7 @@ struct smq_invoke_ctx { struct overlap *overs; struct overlap **overps; struct smq_msg msg; uint32_t *crc; }; struct fastrpc_ctx_lst { Loading Loading @@ -681,7 +683,7 @@ static int fastrpc_buf_alloc(struct fastrpc_file *fl, ssize_t size, static int context_restore_interrupted(struct fastrpc_file *fl, struct fastrpc_ioctl_invoke_attrs *inv, struct fastrpc_ioctl_invoke_crc *inv, struct smq_invoke_ctx **po) { int err = 0; Loading Loading @@ -788,7 +790,7 @@ static int context_build_overlap(struct smq_invoke_ctx *ctx) static void context_free(struct smq_invoke_ctx *ctx); static int context_alloc(struct fastrpc_file *fl, uint32_t kernel, struct fastrpc_ioctl_invoke_attrs *invokefd, struct fastrpc_ioctl_invoke_crc *invokefd, struct smq_invoke_ctx **po) { int err = 0, bufs, size = 0; Loading Loading @@ -834,7 +836,7 @@ static int context_alloc(struct fastrpc_file *fl, uint32_t kernel, if (err) goto bail; } ctx->crc = (uint32_t *)invokefd->crc; ctx->sc = invoke->sc; if (bufs) { VERIFY(err, 0 == context_build_overlap(ctx)); Loading Loading @@ -993,6 +995,7 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx) int err = 0; int mflags = 0; uint64_t *fdlist; uint32_t *crclist; /* calculate size of the metadata */ rpra = 0; Loading @@ -1018,7 +1021,9 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx) goto bail; ipage += 1; } metalen = copylen = (ssize_t)&ipage[0] + (sizeof(uint64_t) * M_FDLIST); metalen = copylen = (ssize_t)&ipage[0] + (sizeof(uint64_t) * M_FDLIST) + (sizeof(uint32_t) * M_CRCLIST); /* calculate len requreed for copying */ for (oix = 0; oix < inbufs + outbufs; ++oix) { int i = ctx->overps[oix]->raix; Loading Loading @@ -1115,6 +1120,8 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx) fdlist = (uint64_t *)&pages[bufs + handles]; for (i = 0; i < M_FDLIST; i++) fdlist[i] = 0; crclist = (uint32_t *)&fdlist[M_FDLIST]; memset(crclist, 0, sizeof(uint32_t)*M_FDLIST); /* copy non ion buffers */ PERF(ctx->fl->profile, ctx->fl->perf.copy, Loading Loading @@ -1194,6 +1201,8 @@ static int put_args(uint32_t kernel, struct smq_invoke_ctx *ctx, struct smq_phy_page *pages; struct fastrpc_mmap *mmap; uint64_t *fdlist; uint32_t *crclist = NULL; remote_arg64_t *rpra = ctx->rpra; int i, inbufs, outbufs, handles; int err = 0; Loading @@ -1204,6 +1213,8 @@ static int put_args(uint32_t kernel, struct smq_invoke_ctx *ctx, list = smq_invoke_buf_start(ctx->rpra, sc); pages = smq_phy_page_start(sc, list); fdlist = (uint64_t *)(pages + inbufs + outbufs + handles); crclist = (uint32_t *)(fdlist + M_FDLIST); for (i = inbufs; i < inbufs + outbufs; ++i) { if (!ctx->maps[i]) { K_COPY_TO_USER(err, kernel, Loading @@ -1226,6 +1237,10 @@ static int put_args(uint32_t kernel, struct smq_invoke_ctx *ctx, fastrpc_mmap_free(mmap); } } if (ctx->crc && crclist && rpra) K_COPY_TO_USER(err, kernel, (void __user *)ctx->crc, crclist, M_CRCLIST*sizeof(uint32_t)); bail: return err; } Loading Loading @@ -1348,7 +1363,7 @@ static int fastrpc_release_current_dsp_process(struct fastrpc_file *fl); static int fastrpc_internal_invoke(struct fastrpc_file *fl, uint32_t mode, uint32_t kernel, struct fastrpc_ioctl_invoke_attrs *inv) struct fastrpc_ioctl_invoke_crc *inv) { struct smq_invoke_ctx *ctx = 0; struct fastrpc_ioctl_invoke *invoke = &inv->inv; Loading Loading @@ -1439,7 +1454,7 @@ static int fastrpc_init_process(struct fastrpc_file *fl, struct fastrpc_ioctl_init_attrs *uproc) { int err = 0; struct fastrpc_ioctl_invoke_attrs ioctl; struct fastrpc_ioctl_invoke_crc ioctl; struct fastrpc_ioctl_init *init = &uproc->init; struct smq_phy_page pages[1]; struct fastrpc_mmap *file = 0, *mem = 0; Loading @@ -1458,6 +1473,7 @@ static int fastrpc_init_process(struct fastrpc_file *fl, ioctl.inv.pra = ra; ioctl.fds = 0; ioctl.attrs = 0; ioctl.crc = NULL; fl->pd = 0; VERIFY(err, !(err = fastrpc_internal_invoke(fl, FASTRPC_MODE_PARALLEL, 1, &ioctl))); Loading Loading @@ -1527,6 +1543,7 @@ static int fastrpc_init_process(struct fastrpc_file *fl, ioctl.inv.pra = ra; ioctl.fds = fds; ioctl.attrs = 0; ioctl.crc = NULL; VERIFY(err, !(err = fastrpc_internal_invoke(fl, FASTRPC_MODE_PARALLEL, 1, &ioctl))); if (err) Loading @@ -1545,7 +1562,7 @@ static int fastrpc_init_process(struct fastrpc_file *fl, static int fastrpc_release_current_dsp_process(struct fastrpc_file *fl) { int err = 0; struct fastrpc_ioctl_invoke_attrs ioctl; struct fastrpc_ioctl_invoke_crc ioctl; remote_arg_t ra[1]; int tgid = 0; Loading @@ -1563,6 +1580,7 @@ static int fastrpc_release_current_dsp_process(struct fastrpc_file *fl) ioctl.inv.pra = ra; ioctl.fds = 0; ioctl.attrs = 0; ioctl.crc = NULL; VERIFY(err, 0 == (err = fastrpc_internal_invoke(fl, FASTRPC_MODE_PARALLEL, 1, &ioctl))); bail: Loading @@ -1572,7 +1590,7 @@ static int fastrpc_release_current_dsp_process(struct fastrpc_file *fl) static int fastrpc_mmap_on_dsp(struct fastrpc_file *fl, uint32_t flags, struct fastrpc_mmap *map) { struct fastrpc_ioctl_invoke_attrs ioctl; struct fastrpc_ioctl_invoke_crc ioctl; struct smq_phy_page page; int num = 1; remote_arg_t ra[3]; Loading Loading @@ -1609,6 +1627,7 @@ static int fastrpc_mmap_on_dsp(struct fastrpc_file *fl, uint32_t flags, ioctl.inv.pra = ra; ioctl.fds = 0; ioctl.attrs = 0; ioctl.crc = NULL; VERIFY(err, 0 == (err = fastrpc_internal_invoke(fl, FASTRPC_MODE_PARALLEL, 1, &ioctl))); map->raddr = (uintptr_t)routargs.vaddrout; Loading @@ -1619,7 +1638,7 @@ static int fastrpc_mmap_on_dsp(struct fastrpc_file *fl, uint32_t flags, static int fastrpc_munmap_on_dsp(struct fastrpc_file *fl, struct fastrpc_mmap *map) { struct fastrpc_ioctl_invoke_attrs ioctl; struct fastrpc_ioctl_invoke_crc ioctl; remote_arg_t ra[1]; int err = 0; struct { Loading @@ -1642,6 +1661,7 @@ static int fastrpc_munmap_on_dsp(struct fastrpc_file *fl, ioctl.inv.pra = ra; ioctl.fds = 0; ioctl.attrs = 0; ioctl.crc = NULL; VERIFY(err, 0 == (err = fastrpc_internal_invoke(fl, FASTRPC_MODE_PARALLEL, 1, &ioctl))); return err; Loading Loading @@ -2197,7 +2217,7 @@ static long fastrpc_device_ioctl(struct file *file, unsigned int ioctl_num, unsigned long ioctl_param) { union { struct fastrpc_ioctl_invoke_attrs inv; struct fastrpc_ioctl_invoke_crc inv; struct fastrpc_ioctl_mmap mmap; struct fastrpc_ioctl_munmap munmap; struct fastrpc_ioctl_init_attrs init; Loading @@ -2210,10 +2230,12 @@ static long fastrpc_device_ioctl(struct file *file, unsigned int ioctl_num, p.inv.fds = 0; p.inv.attrs = 0; p.inv.crc = NULL; switch (ioctl_num) { case FASTRPC_IOCTL_INVOKE: size = sizeof(struct fastrpc_ioctl_invoke); /* fall through */ case FASTRPC_IOCTL_INVOKE_FD: if (!size) size = sizeof(struct fastrpc_ioctl_invoke_fd); Loading @@ -2221,6 +2243,10 @@ static long fastrpc_device_ioctl(struct file *file, unsigned int ioctl_num, case FASTRPC_IOCTL_INVOKE_ATTRS: if (!size) size = sizeof(struct fastrpc_ioctl_invoke_attrs); /* fall through */ case FASTRPC_IOCTL_INVOKE_CRC: if (!size) size = sizeof(struct fastrpc_ioctl_invoke_crc); VERIFY(err, 0 == copy_from_user(&p.inv, param, size)); if (err) goto bail; Loading drivers/char/adsprpc_compat.c +23 −7 Original line number Diff line number Diff line Loading @@ -36,6 +36,8 @@ _IOWR('R', 9, struct compat_fastrpc_ioctl_perf) #define COMPAT_FASTRPC_IOCTL_INIT_ATTRS \ _IOWR('R', 10, struct compat_fastrpc_ioctl_init_attrs) #define COMPAT_FASTRPC_IOCTL_INVOKE_CRC \ _IOWR('R', 11, struct compat_fastrpc_ioctl_invoke_crc) struct compat_remote_buf { compat_uptr_t pv; /* buffer pointer */ Loading Loading @@ -64,6 +66,13 @@ struct compat_fastrpc_ioctl_invoke_attrs { compat_uptr_t attrs; /* attribute list */ }; struct compat_fastrpc_ioctl_invoke_crc { struct compat_fastrpc_ioctl_invoke inv; compat_uptr_t fds; /* fd list */ compat_uptr_t attrs; /* attribute list */ compat_uptr_t crc; /* crc list */ }; struct compat_fastrpc_ioctl_mmap { compat_int_t fd; /* ion fd */ compat_uint_t flags; /* flags for dsp to map with */ Loading Loading @@ -100,14 +109,14 @@ struct compat_fastrpc_ioctl_perf { /* kernel performance data */ }; static int compat_get_fastrpc_ioctl_invoke( struct compat_fastrpc_ioctl_invoke_attrs __user *inv32, struct fastrpc_ioctl_invoke_attrs __user **inva, struct compat_fastrpc_ioctl_invoke_crc __user *inv32, struct fastrpc_ioctl_invoke_crc __user **inva, unsigned int cmd) { compat_uint_t u, sc; compat_ssize_t s; compat_uptr_t p; struct fastrpc_ioctl_invoke_attrs *inv; struct fastrpc_ioctl_invoke_crc *inv; union compat_remote_arg *pra32; union remote_arg *pra; int err, len, j; Loading Loading @@ -146,10 +155,16 @@ static int compat_get_fastrpc_ioctl_invoke( err |= put_user(p, (compat_uptr_t *)&inv->fds); } err |= put_user(NULL, &inv->attrs); if (cmd == COMPAT_FASTRPC_IOCTL_INVOKE_ATTRS) { if ((cmd == COMPAT_FASTRPC_IOCTL_INVOKE_ATTRS) || (cmd == COMPAT_FASTRPC_IOCTL_INVOKE_CRC)) { err |= get_user(p, &inv32->attrs); err |= put_user(p, (compat_uptr_t *)&inv->attrs); } err |= put_user(NULL, (compat_uptr_t __user **)&inv->crc); if (cmd == COMPAT_FASTRPC_IOCTL_INVOKE_CRC) { err |= get_user(p, &inv32->crc); err |= put_user(p, (compat_uptr_t __user *)&inv->crc); } *inva = inv; return err; Loading Loading @@ -273,9 +288,10 @@ long compat_fastrpc_device_ioctl(struct file *filp, unsigned int cmd, case COMPAT_FASTRPC_IOCTL_INVOKE: case COMPAT_FASTRPC_IOCTL_INVOKE_FD: case COMPAT_FASTRPC_IOCTL_INVOKE_ATTRS: case COMPAT_FASTRPC_IOCTL_INVOKE_CRC: { struct compat_fastrpc_ioctl_invoke_attrs __user *inv32; struct fastrpc_ioctl_invoke_attrs __user *inv; struct compat_fastrpc_ioctl_invoke_crc __user *inv32; struct fastrpc_ioctl_invoke_crc __user *inv; inv32 = compat_ptr(arg); VERIFY(err, 0 == compat_get_fastrpc_ioctl_invoke(inv32, Loading @@ -283,7 +299,7 @@ long compat_fastrpc_device_ioctl(struct file *filp, unsigned int cmd, if (err) return err; return filp->f_op->unlocked_ioctl(filp, FASTRPC_IOCTL_INVOKE_ATTRS, (unsigned long)inv); FASTRPC_IOCTL_INVOKE_CRC, (unsigned long)inv); } case COMPAT_FASTRPC_IOCTL_MMAP: { Loading drivers/char/adsprpc_shared.h +8 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ #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_GLINK_GUID "fastrpcglink-apps-dsp" #define FASTRPC_SMD_GUID "fastrpcsmd-apps-dsp" Loading Loading @@ -156,6 +157,13 @@ struct fastrpc_ioctl_invoke_attrs { 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_init { uint32_t flags; /* one of FASTRPC_INIT_* macros */ uintptr_t __user file; /* pointer to elf file */ Loading Loading
drivers/char/adsprpc.c +37 −11 Original line number Diff line number Diff line Loading @@ -58,7 +58,8 @@ #define BALIGN 128 #define NUM_CHANNELS 4 /* adsp, mdsp, slpi, cdsp*/ #define NUM_SESSIONS 9 /*8 compute, 1 cpz*/ #define M_FDLIST 16 #define M_FDLIST (16) #define M_CRCLIST (64) #define IS_CACHE_ALIGNED(x) (((x) & ((L1_CACHE_BYTES)-1)) == 0) Loading Loading @@ -172,6 +173,7 @@ struct smq_invoke_ctx { struct overlap *overs; struct overlap **overps; struct smq_msg msg; uint32_t *crc; }; struct fastrpc_ctx_lst { Loading Loading @@ -681,7 +683,7 @@ static int fastrpc_buf_alloc(struct fastrpc_file *fl, ssize_t size, static int context_restore_interrupted(struct fastrpc_file *fl, struct fastrpc_ioctl_invoke_attrs *inv, struct fastrpc_ioctl_invoke_crc *inv, struct smq_invoke_ctx **po) { int err = 0; Loading Loading @@ -788,7 +790,7 @@ static int context_build_overlap(struct smq_invoke_ctx *ctx) static void context_free(struct smq_invoke_ctx *ctx); static int context_alloc(struct fastrpc_file *fl, uint32_t kernel, struct fastrpc_ioctl_invoke_attrs *invokefd, struct fastrpc_ioctl_invoke_crc *invokefd, struct smq_invoke_ctx **po) { int err = 0, bufs, size = 0; Loading Loading @@ -834,7 +836,7 @@ static int context_alloc(struct fastrpc_file *fl, uint32_t kernel, if (err) goto bail; } ctx->crc = (uint32_t *)invokefd->crc; ctx->sc = invoke->sc; if (bufs) { VERIFY(err, 0 == context_build_overlap(ctx)); Loading Loading @@ -993,6 +995,7 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx) int err = 0; int mflags = 0; uint64_t *fdlist; uint32_t *crclist; /* calculate size of the metadata */ rpra = 0; Loading @@ -1018,7 +1021,9 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx) goto bail; ipage += 1; } metalen = copylen = (ssize_t)&ipage[0] + (sizeof(uint64_t) * M_FDLIST); metalen = copylen = (ssize_t)&ipage[0] + (sizeof(uint64_t) * M_FDLIST) + (sizeof(uint32_t) * M_CRCLIST); /* calculate len requreed for copying */ for (oix = 0; oix < inbufs + outbufs; ++oix) { int i = ctx->overps[oix]->raix; Loading Loading @@ -1115,6 +1120,8 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx) fdlist = (uint64_t *)&pages[bufs + handles]; for (i = 0; i < M_FDLIST; i++) fdlist[i] = 0; crclist = (uint32_t *)&fdlist[M_FDLIST]; memset(crclist, 0, sizeof(uint32_t)*M_FDLIST); /* copy non ion buffers */ PERF(ctx->fl->profile, ctx->fl->perf.copy, Loading Loading @@ -1194,6 +1201,8 @@ static int put_args(uint32_t kernel, struct smq_invoke_ctx *ctx, struct smq_phy_page *pages; struct fastrpc_mmap *mmap; uint64_t *fdlist; uint32_t *crclist = NULL; remote_arg64_t *rpra = ctx->rpra; int i, inbufs, outbufs, handles; int err = 0; Loading @@ -1204,6 +1213,8 @@ static int put_args(uint32_t kernel, struct smq_invoke_ctx *ctx, list = smq_invoke_buf_start(ctx->rpra, sc); pages = smq_phy_page_start(sc, list); fdlist = (uint64_t *)(pages + inbufs + outbufs + handles); crclist = (uint32_t *)(fdlist + M_FDLIST); for (i = inbufs; i < inbufs + outbufs; ++i) { if (!ctx->maps[i]) { K_COPY_TO_USER(err, kernel, Loading @@ -1226,6 +1237,10 @@ static int put_args(uint32_t kernel, struct smq_invoke_ctx *ctx, fastrpc_mmap_free(mmap); } } if (ctx->crc && crclist && rpra) K_COPY_TO_USER(err, kernel, (void __user *)ctx->crc, crclist, M_CRCLIST*sizeof(uint32_t)); bail: return err; } Loading Loading @@ -1348,7 +1363,7 @@ static int fastrpc_release_current_dsp_process(struct fastrpc_file *fl); static int fastrpc_internal_invoke(struct fastrpc_file *fl, uint32_t mode, uint32_t kernel, struct fastrpc_ioctl_invoke_attrs *inv) struct fastrpc_ioctl_invoke_crc *inv) { struct smq_invoke_ctx *ctx = 0; struct fastrpc_ioctl_invoke *invoke = &inv->inv; Loading Loading @@ -1439,7 +1454,7 @@ static int fastrpc_init_process(struct fastrpc_file *fl, struct fastrpc_ioctl_init_attrs *uproc) { int err = 0; struct fastrpc_ioctl_invoke_attrs ioctl; struct fastrpc_ioctl_invoke_crc ioctl; struct fastrpc_ioctl_init *init = &uproc->init; struct smq_phy_page pages[1]; struct fastrpc_mmap *file = 0, *mem = 0; Loading @@ -1458,6 +1473,7 @@ static int fastrpc_init_process(struct fastrpc_file *fl, ioctl.inv.pra = ra; ioctl.fds = 0; ioctl.attrs = 0; ioctl.crc = NULL; fl->pd = 0; VERIFY(err, !(err = fastrpc_internal_invoke(fl, FASTRPC_MODE_PARALLEL, 1, &ioctl))); Loading Loading @@ -1527,6 +1543,7 @@ static int fastrpc_init_process(struct fastrpc_file *fl, ioctl.inv.pra = ra; ioctl.fds = fds; ioctl.attrs = 0; ioctl.crc = NULL; VERIFY(err, !(err = fastrpc_internal_invoke(fl, FASTRPC_MODE_PARALLEL, 1, &ioctl))); if (err) Loading @@ -1545,7 +1562,7 @@ static int fastrpc_init_process(struct fastrpc_file *fl, static int fastrpc_release_current_dsp_process(struct fastrpc_file *fl) { int err = 0; struct fastrpc_ioctl_invoke_attrs ioctl; struct fastrpc_ioctl_invoke_crc ioctl; remote_arg_t ra[1]; int tgid = 0; Loading @@ -1563,6 +1580,7 @@ static int fastrpc_release_current_dsp_process(struct fastrpc_file *fl) ioctl.inv.pra = ra; ioctl.fds = 0; ioctl.attrs = 0; ioctl.crc = NULL; VERIFY(err, 0 == (err = fastrpc_internal_invoke(fl, FASTRPC_MODE_PARALLEL, 1, &ioctl))); bail: Loading @@ -1572,7 +1590,7 @@ static int fastrpc_release_current_dsp_process(struct fastrpc_file *fl) static int fastrpc_mmap_on_dsp(struct fastrpc_file *fl, uint32_t flags, struct fastrpc_mmap *map) { struct fastrpc_ioctl_invoke_attrs ioctl; struct fastrpc_ioctl_invoke_crc ioctl; struct smq_phy_page page; int num = 1; remote_arg_t ra[3]; Loading Loading @@ -1609,6 +1627,7 @@ static int fastrpc_mmap_on_dsp(struct fastrpc_file *fl, uint32_t flags, ioctl.inv.pra = ra; ioctl.fds = 0; ioctl.attrs = 0; ioctl.crc = NULL; VERIFY(err, 0 == (err = fastrpc_internal_invoke(fl, FASTRPC_MODE_PARALLEL, 1, &ioctl))); map->raddr = (uintptr_t)routargs.vaddrout; Loading @@ -1619,7 +1638,7 @@ static int fastrpc_mmap_on_dsp(struct fastrpc_file *fl, uint32_t flags, static int fastrpc_munmap_on_dsp(struct fastrpc_file *fl, struct fastrpc_mmap *map) { struct fastrpc_ioctl_invoke_attrs ioctl; struct fastrpc_ioctl_invoke_crc ioctl; remote_arg_t ra[1]; int err = 0; struct { Loading @@ -1642,6 +1661,7 @@ static int fastrpc_munmap_on_dsp(struct fastrpc_file *fl, ioctl.inv.pra = ra; ioctl.fds = 0; ioctl.attrs = 0; ioctl.crc = NULL; VERIFY(err, 0 == (err = fastrpc_internal_invoke(fl, FASTRPC_MODE_PARALLEL, 1, &ioctl))); return err; Loading Loading @@ -2197,7 +2217,7 @@ static long fastrpc_device_ioctl(struct file *file, unsigned int ioctl_num, unsigned long ioctl_param) { union { struct fastrpc_ioctl_invoke_attrs inv; struct fastrpc_ioctl_invoke_crc inv; struct fastrpc_ioctl_mmap mmap; struct fastrpc_ioctl_munmap munmap; struct fastrpc_ioctl_init_attrs init; Loading @@ -2210,10 +2230,12 @@ static long fastrpc_device_ioctl(struct file *file, unsigned int ioctl_num, p.inv.fds = 0; p.inv.attrs = 0; p.inv.crc = NULL; switch (ioctl_num) { case FASTRPC_IOCTL_INVOKE: size = sizeof(struct fastrpc_ioctl_invoke); /* fall through */ case FASTRPC_IOCTL_INVOKE_FD: if (!size) size = sizeof(struct fastrpc_ioctl_invoke_fd); Loading @@ -2221,6 +2243,10 @@ static long fastrpc_device_ioctl(struct file *file, unsigned int ioctl_num, case FASTRPC_IOCTL_INVOKE_ATTRS: if (!size) size = sizeof(struct fastrpc_ioctl_invoke_attrs); /* fall through */ case FASTRPC_IOCTL_INVOKE_CRC: if (!size) size = sizeof(struct fastrpc_ioctl_invoke_crc); VERIFY(err, 0 == copy_from_user(&p.inv, param, size)); if (err) goto bail; Loading
drivers/char/adsprpc_compat.c +23 −7 Original line number Diff line number Diff line Loading @@ -36,6 +36,8 @@ _IOWR('R', 9, struct compat_fastrpc_ioctl_perf) #define COMPAT_FASTRPC_IOCTL_INIT_ATTRS \ _IOWR('R', 10, struct compat_fastrpc_ioctl_init_attrs) #define COMPAT_FASTRPC_IOCTL_INVOKE_CRC \ _IOWR('R', 11, struct compat_fastrpc_ioctl_invoke_crc) struct compat_remote_buf { compat_uptr_t pv; /* buffer pointer */ Loading Loading @@ -64,6 +66,13 @@ struct compat_fastrpc_ioctl_invoke_attrs { compat_uptr_t attrs; /* attribute list */ }; struct compat_fastrpc_ioctl_invoke_crc { struct compat_fastrpc_ioctl_invoke inv; compat_uptr_t fds; /* fd list */ compat_uptr_t attrs; /* attribute list */ compat_uptr_t crc; /* crc list */ }; struct compat_fastrpc_ioctl_mmap { compat_int_t fd; /* ion fd */ compat_uint_t flags; /* flags for dsp to map with */ Loading Loading @@ -100,14 +109,14 @@ struct compat_fastrpc_ioctl_perf { /* kernel performance data */ }; static int compat_get_fastrpc_ioctl_invoke( struct compat_fastrpc_ioctl_invoke_attrs __user *inv32, struct fastrpc_ioctl_invoke_attrs __user **inva, struct compat_fastrpc_ioctl_invoke_crc __user *inv32, struct fastrpc_ioctl_invoke_crc __user **inva, unsigned int cmd) { compat_uint_t u, sc; compat_ssize_t s; compat_uptr_t p; struct fastrpc_ioctl_invoke_attrs *inv; struct fastrpc_ioctl_invoke_crc *inv; union compat_remote_arg *pra32; union remote_arg *pra; int err, len, j; Loading Loading @@ -146,10 +155,16 @@ static int compat_get_fastrpc_ioctl_invoke( err |= put_user(p, (compat_uptr_t *)&inv->fds); } err |= put_user(NULL, &inv->attrs); if (cmd == COMPAT_FASTRPC_IOCTL_INVOKE_ATTRS) { if ((cmd == COMPAT_FASTRPC_IOCTL_INVOKE_ATTRS) || (cmd == COMPAT_FASTRPC_IOCTL_INVOKE_CRC)) { err |= get_user(p, &inv32->attrs); err |= put_user(p, (compat_uptr_t *)&inv->attrs); } err |= put_user(NULL, (compat_uptr_t __user **)&inv->crc); if (cmd == COMPAT_FASTRPC_IOCTL_INVOKE_CRC) { err |= get_user(p, &inv32->crc); err |= put_user(p, (compat_uptr_t __user *)&inv->crc); } *inva = inv; return err; Loading Loading @@ -273,9 +288,10 @@ long compat_fastrpc_device_ioctl(struct file *filp, unsigned int cmd, case COMPAT_FASTRPC_IOCTL_INVOKE: case COMPAT_FASTRPC_IOCTL_INVOKE_FD: case COMPAT_FASTRPC_IOCTL_INVOKE_ATTRS: case COMPAT_FASTRPC_IOCTL_INVOKE_CRC: { struct compat_fastrpc_ioctl_invoke_attrs __user *inv32; struct fastrpc_ioctl_invoke_attrs __user *inv; struct compat_fastrpc_ioctl_invoke_crc __user *inv32; struct fastrpc_ioctl_invoke_crc __user *inv; inv32 = compat_ptr(arg); VERIFY(err, 0 == compat_get_fastrpc_ioctl_invoke(inv32, Loading @@ -283,7 +299,7 @@ long compat_fastrpc_device_ioctl(struct file *filp, unsigned int cmd, if (err) return err; return filp->f_op->unlocked_ioctl(filp, FASTRPC_IOCTL_INVOKE_ATTRS, (unsigned long)inv); FASTRPC_IOCTL_INVOKE_CRC, (unsigned long)inv); } case COMPAT_FASTRPC_IOCTL_MMAP: { Loading
drivers/char/adsprpc_shared.h +8 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ #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_GLINK_GUID "fastrpcglink-apps-dsp" #define FASTRPC_SMD_GUID "fastrpcsmd-apps-dsp" Loading Loading @@ -156,6 +157,13 @@ struct fastrpc_ioctl_invoke_attrs { 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_init { uint32_t flags; /* one of FASTRPC_INIT_* macros */ uintptr_t __user file; /* pointer to elf file */ Loading