Merge "msm: ADSPRPC: handle 32 bit support"
This commit is contained in:
commit
e931ea69a1
3 changed files with 147 additions and 2 deletions
|
@ -2774,6 +2774,28 @@ static long fastrpc_device_ioctl(struct file *file, unsigned int ioctl_num,
|
||||||
if (err)
|
if (err)
|
||||||
goto bail;
|
goto bail;
|
||||||
break;
|
break;
|
||||||
|
case FASTRPC_IOCTL_MMAP_64:
|
||||||
|
K_COPY_FROM_USER(err, 0, &p.mmap, param,
|
||||||
|
sizeof(p.mmap));
|
||||||
|
if (err)
|
||||||
|
goto bail;
|
||||||
|
VERIFY(err, 0 == (err = fastrpc_internal_mmap(fl, &p.mmap)));
|
||||||
|
if (err)
|
||||||
|
goto bail;
|
||||||
|
K_COPY_TO_USER(err, 0, param, &p.mmap, sizeof(p.mmap));
|
||||||
|
if (err)
|
||||||
|
goto bail;
|
||||||
|
break;
|
||||||
|
case FASTRPC_IOCTL_MUNMAP_64:
|
||||||
|
K_COPY_FROM_USER(err, 0, &p.munmap, param,
|
||||||
|
sizeof(p.munmap));
|
||||||
|
if (err)
|
||||||
|
goto bail;
|
||||||
|
VERIFY(err, 0 == (err = fastrpc_internal_munmap(fl,
|
||||||
|
&p.munmap)));
|
||||||
|
if (err)
|
||||||
|
goto bail;
|
||||||
|
break;
|
||||||
case FASTRPC_IOCTL_SETMODE:
|
case FASTRPC_IOCTL_SETMODE:
|
||||||
switch ((uint32_t)ioctl_param) {
|
switch ((uint32_t)ioctl_param) {
|
||||||
case FASTRPC_MODE_PARALLEL:
|
case FASTRPC_MODE_PARALLEL:
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2014-2018, The Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License version 2 and
|
* it under the terms of the GNU General Public License version 2 and
|
||||||
|
@ -36,6 +36,11 @@
|
||||||
_IOWR('R', 9, struct compat_fastrpc_ioctl_perf)
|
_IOWR('R', 9, struct compat_fastrpc_ioctl_perf)
|
||||||
#define COMPAT_FASTRPC_IOCTL_INIT_ATTRS \
|
#define COMPAT_FASTRPC_IOCTL_INIT_ATTRS \
|
||||||
_IOWR('R', 10, struct compat_fastrpc_ioctl_init_attrs)
|
_IOWR('R', 10, struct compat_fastrpc_ioctl_init_attrs)
|
||||||
|
#define COMPAT_FASTRPC_IOCTL_MMAP_64 \
|
||||||
|
_IOWR('R', 14, struct compat_fastrpc_ioctl_mmap_64)
|
||||||
|
#define COMPAT_FASTRPC_IOCTL_MUNMAP_64 \
|
||||||
|
_IOWR('R', 15, struct compat_fastrpc_ioctl_munmap_64)
|
||||||
|
|
||||||
|
|
||||||
struct compat_remote_buf {
|
struct compat_remote_buf {
|
||||||
compat_uptr_t pv; /* buffer pointer */
|
compat_uptr_t pv; /* buffer pointer */
|
||||||
|
@ -72,11 +77,24 @@ struct compat_fastrpc_ioctl_mmap {
|
||||||
compat_uptr_t vaddrout; /* dsps virtual address */
|
compat_uptr_t vaddrout; /* dsps virtual address */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct compat_fastrpc_ioctl_mmap_64 {
|
||||||
|
compat_int_t fd; /* ion fd */
|
||||||
|
compat_uint_t flags; /* flags for dsp to map with */
|
||||||
|
compat_u64 vaddrin; /* optional virtual address */
|
||||||
|
compat_size_t size; /* size */
|
||||||
|
compat_u64 vaddrout; /* dsps virtual address */
|
||||||
|
};
|
||||||
|
|
||||||
struct compat_fastrpc_ioctl_munmap {
|
struct compat_fastrpc_ioctl_munmap {
|
||||||
compat_uptr_t vaddrout; /* address to unmap */
|
compat_uptr_t vaddrout; /* address to unmap */
|
||||||
compat_size_t size; /* size */
|
compat_size_t size; /* size */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct compat_fastrpc_ioctl_munmap_64 {
|
||||||
|
compat_u64 vaddrout; /* address to unmap */
|
||||||
|
compat_size_t size; /* size */
|
||||||
|
};
|
||||||
|
|
||||||
struct compat_fastrpc_ioctl_init {
|
struct compat_fastrpc_ioctl_init {
|
||||||
compat_uint_t flags; /* one of FASTRPC_INIT_* macros */
|
compat_uint_t flags; /* one of FASTRPC_INIT_* macros */
|
||||||
compat_uptr_t file; /* pointer to elf file */
|
compat_uptr_t file; /* pointer to elf file */
|
||||||
|
@ -209,6 +227,28 @@ static int compat_get_fastrpc_ioctl_mmap(
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int compat_get_fastrpc_ioctl_mmap_64(
|
||||||
|
struct compat_fastrpc_ioctl_mmap_64 __user *map32,
|
||||||
|
struct fastrpc_ioctl_mmap __user *map)
|
||||||
|
{
|
||||||
|
compat_uint_t u;
|
||||||
|
compat_int_t i;
|
||||||
|
compat_size_t s;
|
||||||
|
compat_u64 p;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
err = get_user(i, &map32->fd);
|
||||||
|
err |= put_user(i, &map->fd);
|
||||||
|
err |= get_user(u, &map32->flags);
|
||||||
|
err |= put_user(u, &map->flags);
|
||||||
|
err |= get_user(p, &map32->vaddrin);
|
||||||
|
err |= put_user(p, &map->vaddrin);
|
||||||
|
err |= get_user(s, &map32->size);
|
||||||
|
err |= put_user(s, &map->size);
|
||||||
|
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
static int compat_put_fastrpc_ioctl_mmap(
|
static int compat_put_fastrpc_ioctl_mmap(
|
||||||
struct compat_fastrpc_ioctl_mmap __user *map32,
|
struct compat_fastrpc_ioctl_mmap __user *map32,
|
||||||
struct fastrpc_ioctl_mmap __user *map)
|
struct fastrpc_ioctl_mmap __user *map)
|
||||||
|
@ -222,6 +262,19 @@ static int compat_put_fastrpc_ioctl_mmap(
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int compat_put_fastrpc_ioctl_mmap_64(
|
||||||
|
struct compat_fastrpc_ioctl_mmap_64 __user *map32,
|
||||||
|
struct fastrpc_ioctl_mmap __user *map)
|
||||||
|
{
|
||||||
|
compat_u64 p;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
err = get_user(p, &map->vaddrout);
|
||||||
|
err |= put_user(p, &map32->vaddrout);
|
||||||
|
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
static int compat_get_fastrpc_ioctl_munmap(
|
static int compat_get_fastrpc_ioctl_munmap(
|
||||||
struct compat_fastrpc_ioctl_munmap __user *unmap32,
|
struct compat_fastrpc_ioctl_munmap __user *unmap32,
|
||||||
struct fastrpc_ioctl_munmap __user *unmap)
|
struct fastrpc_ioctl_munmap __user *unmap)
|
||||||
|
@ -238,6 +291,22 @@ static int compat_get_fastrpc_ioctl_munmap(
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int compat_get_fastrpc_ioctl_munmap_64(
|
||||||
|
struct compat_fastrpc_ioctl_munmap_64 __user *unmap32,
|
||||||
|
struct fastrpc_ioctl_munmap __user *unmap)
|
||||||
|
{
|
||||||
|
compat_u64 p;
|
||||||
|
compat_size_t s;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
err = get_user(p, &unmap32->vaddrout);
|
||||||
|
err |= put_user(p, &unmap->vaddrout);
|
||||||
|
err |= get_user(s, &unmap32->size);
|
||||||
|
err |= put_user(s, &unmap->size);
|
||||||
|
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
static int compat_get_fastrpc_ioctl_perf(
|
static int compat_get_fastrpc_ioctl_perf(
|
||||||
struct compat_fastrpc_ioctl_perf __user *perf32,
|
struct compat_fastrpc_ioctl_perf __user *perf32,
|
||||||
struct fastrpc_ioctl_perf __user *perf)
|
struct fastrpc_ioctl_perf __user *perf)
|
||||||
|
@ -343,6 +412,27 @@ long compat_fastrpc_device_ioctl(struct file *filp, unsigned int cmd,
|
||||||
VERIFY(err, 0 == compat_put_fastrpc_ioctl_mmap(map32, map));
|
VERIFY(err, 0 == compat_put_fastrpc_ioctl_mmap(map32, map));
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
case COMPAT_FASTRPC_IOCTL_MMAP_64:
|
||||||
|
{
|
||||||
|
struct compat_fastrpc_ioctl_mmap_64 __user *map32;
|
||||||
|
struct fastrpc_ioctl_mmap __user *map;
|
||||||
|
long ret;
|
||||||
|
|
||||||
|
map32 = compat_ptr(arg);
|
||||||
|
VERIFY(err, NULL != (map = compat_alloc_user_space(
|
||||||
|
sizeof(*map))));
|
||||||
|
if (err)
|
||||||
|
return -EFAULT;
|
||||||
|
VERIFY(err, 0 == compat_get_fastrpc_ioctl_mmap_64(map32, map));
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
ret = filp->f_op->unlocked_ioctl(filp, FASTRPC_IOCTL_MMAP_64,
|
||||||
|
(unsigned long)map);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
VERIFY(err, 0 == compat_put_fastrpc_ioctl_mmap_64(map32, map));
|
||||||
|
return err;
|
||||||
|
}
|
||||||
case COMPAT_FASTRPC_IOCTL_MUNMAP:
|
case COMPAT_FASTRPC_IOCTL_MUNMAP:
|
||||||
{
|
{
|
||||||
struct compat_fastrpc_ioctl_munmap __user *unmap32;
|
struct compat_fastrpc_ioctl_munmap __user *unmap32;
|
||||||
|
@ -360,6 +450,23 @@ long compat_fastrpc_device_ioctl(struct file *filp, unsigned int cmd,
|
||||||
return filp->f_op->unlocked_ioctl(filp, FASTRPC_IOCTL_MUNMAP,
|
return filp->f_op->unlocked_ioctl(filp, FASTRPC_IOCTL_MUNMAP,
|
||||||
(unsigned long)unmap);
|
(unsigned long)unmap);
|
||||||
}
|
}
|
||||||
|
case COMPAT_FASTRPC_IOCTL_MUNMAP_64:
|
||||||
|
{
|
||||||
|
struct compat_fastrpc_ioctl_munmap_64 __user *unmap32;
|
||||||
|
struct fastrpc_ioctl_munmap __user *unmap;
|
||||||
|
|
||||||
|
unmap32 = compat_ptr(arg);
|
||||||
|
VERIFY(err, NULL != (unmap = compat_alloc_user_space(
|
||||||
|
sizeof(*unmap))));
|
||||||
|
if (err)
|
||||||
|
return -EFAULT;
|
||||||
|
VERIFY(err, 0 == compat_get_fastrpc_ioctl_munmap_64(unmap32,
|
||||||
|
unmap));
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
return filp->f_op->unlocked_ioctl(filp, FASTRPC_IOCTL_MUNMAP_64,
|
||||||
|
(unsigned long)unmap);
|
||||||
|
}
|
||||||
case COMPAT_FASTRPC_IOCTL_INIT:
|
case COMPAT_FASTRPC_IOCTL_INIT:
|
||||||
/* fall through */
|
/* fall through */
|
||||||
case COMPAT_FASTRPC_IOCTL_INIT_ATTRS:
|
case COMPAT_FASTRPC_IOCTL_INIT_ATTRS:
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License version 2 and
|
* it under the terms of the GNU General Public License version 2 and
|
||||||
|
@ -19,6 +19,8 @@
|
||||||
#define FASTRPC_IOCTL_INVOKE _IOWR('R', 1, struct fastrpc_ioctl_invoke)
|
#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_MMAP _IOWR('R', 2, struct fastrpc_ioctl_mmap)
|
||||||
#define FASTRPC_IOCTL_MUNMAP _IOWR('R', 3, struct fastrpc_ioctl_munmap)
|
#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_INVOKE_FD _IOWR('R', 4, struct fastrpc_ioctl_invoke_fd)
|
||||||
#define FASTRPC_IOCTL_SETMODE _IOWR('R', 5, uint32_t)
|
#define FASTRPC_IOCTL_SETMODE _IOWR('R', 5, uint32_t)
|
||||||
#define FASTRPC_IOCTL_INIT _IOWR('R', 6, struct fastrpc_ioctl_init)
|
#define FASTRPC_IOCTL_INIT _IOWR('R', 6, struct fastrpc_ioctl_init)
|
||||||
|
@ -171,6 +173,11 @@ struct fastrpc_ioctl_munmap {
|
||||||
size_t size; /* size */
|
size_t size; /* size */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct fastrpc_ioctl_munmap_64 {
|
||||||
|
uint64_t vaddrout; /* address to unmap */
|
||||||
|
size_t size; /* size */
|
||||||
|
};
|
||||||
|
|
||||||
struct fastrpc_ioctl_mmap {
|
struct fastrpc_ioctl_mmap {
|
||||||
int fd; /* ion fd */
|
int fd; /* ion fd */
|
||||||
uint32_t flags; /* flags for dsp to map with */
|
uint32_t flags; /* flags for dsp to map with */
|
||||||
|
@ -179,6 +186,15 @@ struct fastrpc_ioctl_mmap {
|
||||||
uintptr_t vaddrout; /* dsps virtual address */
|
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_perf { /* kernel performance data */
|
struct fastrpc_ioctl_perf { /* kernel performance data */
|
||||||
uintptr_t data;
|
uintptr_t data;
|
||||||
uint32_t numkeys;
|
uint32_t numkeys;
|
||||||
|
|
Loading…
Add table
Reference in a new issue