Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 95edaf00 authored by Sathish Ambley's avatar Sathish Ambley
Browse files

msm: ADSPRPC: Provide SMMU information



Expose new IOCTL to provide SMMU information that allows for
userspace to determine the appropriate ION heap to be used.

Change-Id: Iead0966d76acb2d2bbc41fa9cd5d09a252a3429e
Signed-off-by: default avatarSathish Ambley <sathishambley@codeaurora.org>
parent fcbbe260
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -2015,6 +2015,17 @@ bail:
	return err;
}

static int fastrpc_get_info(struct fastrpc_file *fl, uint32_t *info)
{
	int err = 0;

	VERIFY(err, fl && fl->sctx);
	if (err)
		goto bail;
	*info = (fl->sctx->smmu.enabled ? 1 : 0);
bail:
	return err;
}

static long fastrpc_device_ioctl(struct file *file, unsigned int ioctl_num,
				 unsigned long ioctl_param)
@@ -2028,6 +2039,7 @@ static long fastrpc_device_ioctl(struct file *file, unsigned int ioctl_num,
	void *param = (char *)ioctl_param;
	struct fastrpc_file *fl = (struct fastrpc_file *)file->private_data;
	int size = 0, err = 0;
	uint32_t info;

	switch (ioctl_num) {
	case FASTRPC_IOCTL_INVOKE_FD:
@@ -2076,6 +2088,14 @@ static long fastrpc_device_ioctl(struct file *file, unsigned int ioctl_num,
			break;
		}
		break;
	case FASTRPC_IOCTL_GETINFO:
		VERIFY(err, 0 == (err = fastrpc_get_info(fl, &info)));
		if (err)
			goto bail;
		VERIFY(err, 0 == copy_to_user(param, &info, sizeof(info)));
		if (err)
			goto bail;
		break;
	case FASTRPC_IOCTL_INIT:
		VERIFY(err, 0 == copy_from_user(&p.init, param,
						sizeof(p.init)));
+21 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
 * Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
 *
 * 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
@@ -319,6 +319,26 @@ long compat_fastrpc_device_ioctl(struct file *filp, unsigned int cmd,
		return filp->f_op->unlocked_ioctl(filp, FASTRPC_IOCTL_INIT,
							(unsigned long)init);
	}
	case FASTRPC_IOCTL_GETINFO:
	{
		compat_uptr_t __user *info32;
		uint32_t __user *info;
		compat_uint_t u;
		long ret;

		info32 = compat_ptr(arg);
		VERIFY(err, NULL != (info = compat_alloc_user_space(
							sizeof(*info))));
		if (err)
			return -EFAULT;
		ret = filp->f_op->unlocked_ioctl(filp, FASTRPC_IOCTL_GETINFO,
							(unsigned long)info);
		if (ret)
			return ret;
		err = get_user(u, info);
		err |= put_user(u, info32);
		return err;
	}
	case FASTRPC_IOCTL_SETMODE:
		return filp->f_op->unlocked_ioctl(filp, cmd,
						(unsigned long)compat_ptr(arg));
+1 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
#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_GETINFO	_IOWR('R', 8, uint32_t)
#define FASTRPC_GLINK_GUID "fastrpcglink-apps-dsp"
#define FASTRPC_SMD_GUID "fastrpcsmd-apps-dsp"
#define DEVICE_NAME      "adsprpc-smd"