msm: adsprpc: store process specific info in GETINFO ioctl call

Currently, process specific info like name and PID is being stored
in the internal data structures at the time of device open. But
since the DSP HAL service will now be opening the device node on
behalf of third-party applications, store process specific info in
GETINFO ioctl call which will be the first IOCTL call directly
from the client application.

Change-Id: If05d48123e4ec52c0271a7cb7f3ca790662d9abe
Acked-by: Thyagarajan Venkatanarayanan <venkatan@qti.qualcomm.com>
Signed-off-by: Edgar Flores <edgarf@codeaurora.org>
Signed-off-by: Himateja Reddy <hmreddy@codeaurora.org>
This commit is contained in:
Edgar Flores 2020-02-07 14:59:29 -08:00 • committed by Himateja Reddy
commit 603f3f7977

View file

@ -4214,11 +4214,8 @@ static inline void fastrpc_register_wakeup_source(struct device *dev,
static int fastrpc_device_open(struct inode *inode, struct file *filp)
{
int err = 0;
struct dentry *debugfs_file;
struct fastrpc_file *fl = NULL;
struct fastrpc_apps *me = &gfa;
char strpid[PID_SIZE];
int buf_size = 0;
/*
* Indicates the device node opened
@ -4237,18 +4234,6 @@ static int fastrpc_device_open(struct inode *inode, struct file *filp)
if (err)
return err;
snprintf(strpid, PID_SIZE, "%d", current->pid);
buf_size = strlen(current->comm) + strlen("_") + strlen(strpid) + 1;
VERIFY(err, NULL != (fl->debug_buf = kzalloc(buf_size, GFP_KERNEL)));
if (err) {
kfree(fl);
return err;
}
snprintf(fl->debug_buf, UL_SIZE, "%.10s%s%d",
current->comm, "_", current->pid);
debugfs_file = debugfs_create_file(fl->debug_buf, 0644, debugfs_root,
fl, &debugfs_fops);
fastrpc_register_wakeup_source(me->non_secure_dev, "adsprpc-non_secure",
&fl->wake_source);
fastrpc_register_wakeup_source(me->secure_dev, "adsprpc-secure",
@ -4263,14 +4248,11 @@ static int fastrpc_device_open(struct inode *inode, struct file *filp)
init_waitqueue_head(&fl->async_wait_queue);
INIT_HLIST_NODE(&fl->hn);
fl->sessionid = 0;
fl->tgid = current->tgid;
fl->apps = me;
fl->mode = FASTRPC_MODE_SERIAL;
fl->cid = -1;
fl->dev_minor = dev_minor;
fl->init_mem = NULL;
if (debugfs_file != NULL)
fl->debugfs_file = debugfs_file;
memset(&fl->perf, 0, sizeof(fl->perf));
fl->qos_request = 0;
fl->dsp_proc_init = 0;
@ -4312,6 +4294,29 @@ bail:
return err;
}
static int fastrpc_set_process_info(struct fastrpc_file *fl)
{
int err = 0, buf_size = 0;
char strpid[PID_SIZE];
fl->tgid = current->tgid;
snprintf(strpid, PID_SIZE, "%d", current->pid);
buf_size = strlen(current->comm) + strlen("_") + strlen(strpid) + 1;
fl->debug_buf = kzalloc(buf_size, GFP_KERNEL);
if (!fl->debug_buf) {
err = -ENOMEM;
return err;
}
snprintf(fl->debug_buf, UL_SIZE, "%.10s%s%d",
current->comm, "_", current->pid);
fl->debugfs_file = debugfs_create_file(fl->debug_buf, 0644,
debugfs_root, fl, &debugfs_fops);
if (!fl->debugfs_file)
pr_warn("Error: %s: %s: failed to create debugfs file %s\n",
current->comm, __func__, fl->debug_buf);
return err;
}
static int fastrpc_get_info(struct fastrpc_file *fl, uint32_t *info)
{
int err = 0;
@ -4321,6 +4326,9 @@ static int fastrpc_get_info(struct fastrpc_file *fl, uint32_t *info)
if (err)
goto bail;
fastrpc_get_process_gids(&fl->gidlist);
err = fastrpc_set_process_info(fl);
if (err)
goto bail;
if (fl->cid == -1) {
cid = *info;
VERIFY(err, cid < NUM_CHANNELS);