video: tegra: host: dla: add queue operations cmd

- define and add ioctl to set queue operations like, suspend and resume.
- on validating user argument, pass command to engine to suspend and
  resume.
- on receiving this command, firmware just update queue status as sent
  and doesn't interrupt ongoing task or queue work.

Jira DLA-218

Change-Id: I13f5d8822d920961277884c64534daaf64d812be
Signed-off-by: Shridhar Rasal <srasal@nvidia.com>
Reviewed-on: http://git-master/r/1278192
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Prashant Gaikwad <pgaikwad@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Shridhar Rasal
2016-12-29 16:43:56 +05:30
committed by Laxman Dewangan
parent e1255dbab1
commit e8d89fcbf9
3 changed files with 77 additions and 3 deletions

View File

@@ -3,7 +3,7 @@
*
* Tegra Graphics Host NVDLA
*
* Copyright (c) 2016 NVIDIA Corporation. All rights reserved.
* Copyright (c) 2016-2017 NVIDIA Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -279,5 +279,6 @@ int nvdla_send_postfences(struct nvdla_task *task,
int nvdla_get_cmd_memory(struct platform_device *pdev,
struct nvdla_cmd_mem_info *cmd_mem_info);
int nvdla_put_cmd_memory(struct platform_device *pdev, int index);
int nvdla_set_queue_state(struct nvhost_queue *queue, int cmd);
#endif /* End of __NVHOST_NVDLA_H__ */

View File

@@ -1,7 +1,7 @@
/*
* NVDLA IOCTL for T194
*
* Copyright (c) 2016, NVIDIA Corporation. All rights reserved.
* Copyright (c) 2016-2017, NVIDIA Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -54,6 +54,44 @@ struct nvdla_private {
struct nvhost_buffers *buffers;
};
static int nvdla_set_queue(struct nvdla_private *priv, void *args)
{
struct nvdla_queue_status_args *queue_arg =
(struct nvdla_queue_status_args *)args;
struct platform_device *pdev = priv->pdev;
struct nvhost_queue *queue = priv->queue;
int status = queue_arg->status;
int err = 0;
if (!queue) {
nvdla_dbg_err(pdev, "invalid queue\n");
err = -EINVAL;
goto inval_queue;
}
/* allow to send only one command at a time */
if (status != (status & -status)) {
nvdla_dbg_err(pdev, "incorrect queue cmd set[%d]\n", status);
err = -EINVAL;
goto inval_input;
}
if (status & NVDLA_QUEUE_FLAGS_SUSPEND) {
err = nvdla_set_queue_state(queue, DLA_CMD_QUEUE_SUSPEND);
} else if (status & NVDLA_QUEUE_FLAGS_RESUME) {
err = nvdla_set_queue_state(queue, DLA_CMD_QUEUE_RESUME);
} else {
nvdla_dbg_err(pdev, "invalid queue cmd %d\n", status);
err = -EINVAL;
goto inval_cmd;
}
inval_queue:
inval_input:
inval_cmd:
return err;
}
static int nvdla_pin(struct nvdla_private *priv, void *arg)
{
u32 *handles;
@@ -476,6 +514,9 @@ static long nvdla_ioctl(struct file *file, unsigned int cmd,
case NVDLA_IOCTL_SUBMIT:
err = nvdla_submit(priv, (void *)buf);
break;
case NVDLA_IOCTL_SET_QUEUE_STATUS:
err = nvdla_set_queue(priv, (void *)buf);
break;
default:
err = -ENOIOCTLCMD;
break;

View File

@@ -1,7 +1,7 @@
/*
* NVDLA queue and task management for T194
*
* Copyright (c) 2016, NVIDIA Corporation. All rights reserved.
* Copyright (c) 2016-2017, NVIDIA Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -787,6 +787,38 @@ fail_to_register:
return err;
}
int nvdla_set_queue_state(struct nvhost_queue *queue, int cmd)
{
struct platform_device *pdev = queue->pool->pdev;
int err;
nvdla_dbg_fn(pdev, "");
if ((cmd != DLA_CMD_QUEUE_SUSPEND) &&
(cmd != DLA_CMD_QUEUE_RESUME)) {
nvdla_dbg_err(pdev, "invalid cmd %d", cmd);
return -EINVAL;
}
/* get pm refcount */
err = nvhost_module_busy(pdev);
if (err) {
nvdla_dbg_err(pdev, "failed to poweron, err: %d", err);
goto fail_to_poweron;
}
err = nvdla_send_cmd(pdev, cmd, queue->id, true);
if (err) {
nvdla_dbg_err(pdev, "failed to suspend queue %d", err);
goto fail_to_suspend;
}
fail_to_suspend:
nvhost_module_idle(pdev);
fail_to_poweron:
return err;
}
static int nvdla_queue_abort(struct nvhost_queue *queue)
{
int err;