mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
video: tegra: host: restores sof/eof, TS feature
This commit restores the following, [1] 890be46 video: tegra: host: dla: refactor and cleanup code [2] 109f8e8 video: tegra: host: add prefence signal support [3] 6f683c8 video: tegra: host: add sof/eof taskstatus support [4] a9cb0c9 video: tegra: host: add sof/eof timestamp support [5] dcdb0d6 video: tegra: host: increase fw minor version Jira DLA-1992 Jira DLA-1993 Change-Id: I9844b141b72fc553ba7d886e706e340160586129 Signed-off-by: Arvind M <am@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2135092 Tested-by: Mitch Harwell <mharwell@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Prashant Gaikwad <pgaikwad@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
Laxman Dewangan
parent
fccb639c36
commit
c6ec7bcb20
@@ -20,7 +20,7 @@
|
|||||||
#define _DLA_FW_VERSION_H_
|
#define _DLA_FW_VERSION_H_
|
||||||
|
|
||||||
#define FIRMWARE_VERSION_MAJOR 0x1
|
#define FIRMWARE_VERSION_MAJOR 0x1
|
||||||
#define FIRMWARE_VERSION_MINOR 0x0
|
#define FIRMWARE_VERSION_MINOR 0x1
|
||||||
#define FIRMWARE_VERSION_SUBMINOR 0x0
|
#define FIRMWARE_VERSION_SUBMINOR 0x0
|
||||||
|
|
||||||
static inline uint32_t dla_version(void)
|
static inline uint32_t dla_version(void)
|
||||||
|
|||||||
@@ -74,18 +74,22 @@
|
|||||||
#define DLA_INT_ON_COMPLETE_SHIFT 8
|
#define DLA_INT_ON_COMPLETE_SHIFT 8
|
||||||
#define DLA_INT_ON_ERROR_SHIFT 9
|
#define DLA_INT_ON_ERROR_SHIFT 9
|
||||||
|
|
||||||
#define PREACTION_TERMINATE 0x0
|
/* control actions */
|
||||||
#define PREACTION_SEM_EQ 0x90
|
#define ACTION_TERMINATE 0x0
|
||||||
#define PREACTION_SEM_GE 0x92
|
|
||||||
#define PREACTION_GOS_EQ 0xB0
|
|
||||||
#define PREACTION_GOS_GE 0xB2
|
|
||||||
#define PREACTION_TASK_STATUS 0xC0
|
|
||||||
|
|
||||||
#define POSTACTION_TERMINATE 0x0
|
/* conditional actions */
|
||||||
#define POSTACTION_SEM 0x80
|
#define ACTION_SEM_EQ 0x90
|
||||||
#define POSTACTION_TS_SEM 0x83
|
#define ACTION_SEM_GE 0x92
|
||||||
#define POSTACTION_GOS 0xA0
|
#define ACTION_GOS_EQ 0xB0
|
||||||
#define POSTACTION_TASK_STATUS 0xC1
|
#define ACTION_GOS_GE 0xB2
|
||||||
|
#define ACTION_TASK_STATUS_EQ 0xC0
|
||||||
|
|
||||||
|
/* write actions */
|
||||||
|
#define ACTION_WRITE_SEM 0x80
|
||||||
|
#define ACTION_WRITE_TS_SEM 0x83
|
||||||
|
#define ACTION_WRITE_TIMESTAMP 0x87
|
||||||
|
#define ACTION_WRITE_GOS 0xA0
|
||||||
|
#define ACTION_WRITE_TASK_STATUS 0xC1
|
||||||
|
|
||||||
#define PING_DATA_SIZE 4
|
#define PING_DATA_SIZE 4
|
||||||
#define BUFFER_MULTIPLIER 4
|
#define BUFFER_MULTIPLIER 4
|
||||||
@@ -228,6 +232,17 @@ struct dla_action_task_status {
|
|||||||
uint16_t status;
|
uint16_t status;
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Timestamp update action structure
|
||||||
|
*
|
||||||
|
* OPCODE = 0x87
|
||||||
|
*
|
||||||
|
* @address: Address to write timestamp
|
||||||
|
*/
|
||||||
|
struct dla_action_timestamp {
|
||||||
|
uint64_t address;
|
||||||
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Status notifier structure
|
* Status notifier structure
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -99,8 +99,11 @@
|
|||||||
*/
|
*/
|
||||||
#define MAX_NUM_NVDLA_PREFENCES 32
|
#define MAX_NUM_NVDLA_PREFENCES 32
|
||||||
#define MAX_NUM_NVDLA_POSTFENCES 32
|
#define MAX_NUM_NVDLA_POSTFENCES 32
|
||||||
|
#define MAX_NUM_NVDLA_EMU_PREFENCES 16
|
||||||
|
#define MAX_NUM_NVDLA_EMU_POSTFENCES 16
|
||||||
#define MAX_NUM_NVDLA_IN_TASK_STATUS MAX_NUM_NVDLA_PREFENCES
|
#define MAX_NUM_NVDLA_IN_TASK_STATUS MAX_NUM_NVDLA_PREFENCES
|
||||||
#define MAX_NUM_NVDLA_OUT_TASK_STATUS MAX_NUM_NVDLA_POSTFENCES
|
#define MAX_NUM_NVDLA_OUT_TASK_STATUS MAX_NUM_NVDLA_POSTFENCES
|
||||||
|
#define MAX_NUM_NVDLA_OUT_TIMESTAMP 32
|
||||||
#define NUM_PROFILING_POSTACTION 1
|
#define NUM_PROFILING_POSTACTION 1
|
||||||
|
|
||||||
#define MAX_COMMANDS_PER_DEVICE 1
|
#define MAX_COMMANDS_PER_DEVICE 1
|
||||||
@@ -219,7 +222,9 @@ struct nvdla_device {
|
|||||||
*
|
*
|
||||||
* @queue Queue in which task submitted
|
* @queue Queue in which task submitted
|
||||||
* @sp pointer to syncpt
|
* @sp pointer to syncpt
|
||||||
|
* @prefences pointer to pre fences
|
||||||
* @postfences pointer to post fences
|
* @postfences pointer to post fences
|
||||||
|
* @num_prefences Number of prefences in task
|
||||||
* @num_postfences Number of postfences in task
|
* @num_postfences Number of postfences in task
|
||||||
* @fence Fence tracking for current task
|
* @fence Fence tracking for current task
|
||||||
* @fence_counter Counter used to track fence value
|
* @fence_counter Counter used to track fence value
|
||||||
@@ -228,7 +233,9 @@ struct nvdla_device {
|
|||||||
struct nvdla_emu_task {
|
struct nvdla_emu_task {
|
||||||
struct nvdla_queue *queue;
|
struct nvdla_queue *queue;
|
||||||
struct nvhost_syncpt *sp;
|
struct nvhost_syncpt *sp;
|
||||||
struct nvdev_fence postfences[MAX_NUM_NVDLA_POSTFENCES];
|
struct nvdev_fence prefences[MAX_NUM_NVDLA_EMU_PREFENCES];
|
||||||
|
struct nvdev_fence postfences[MAX_NUM_NVDLA_EMU_POSTFENCES];
|
||||||
|
u32 num_prefences;
|
||||||
u32 num_postfences;
|
u32 num_postfences;
|
||||||
u32 fence;
|
u32 fence;
|
||||||
u32 fence_counter;
|
u32 fence_counter;
|
||||||
@@ -259,12 +266,18 @@ struct nvdla_task {
|
|||||||
struct nvdev_fence prefences[MAX_NUM_NVDLA_PREFENCES];
|
struct nvdev_fence prefences[MAX_NUM_NVDLA_PREFENCES];
|
||||||
struct nvdev_fence postfences[MAX_NUM_NVDLA_POSTFENCES];
|
struct nvdev_fence postfences[MAX_NUM_NVDLA_POSTFENCES];
|
||||||
struct nvdla_status_notify in_task_status[MAX_NUM_NVDLA_IN_TASK_STATUS];
|
struct nvdla_status_notify in_task_status[MAX_NUM_NVDLA_IN_TASK_STATUS];
|
||||||
struct nvdla_status_notify out_task_status[MAX_NUM_NVDLA_OUT_TASK_STATUS];
|
struct nvdla_status_notify sof_task_status[MAX_NUM_NVDLA_OUT_TASK_STATUS];
|
||||||
|
struct nvdla_status_notify eof_task_status[MAX_NUM_NVDLA_OUT_TASK_STATUS];
|
||||||
|
struct nvdla_mem_handle sof_timestamps[MAX_NUM_NVDLA_OUT_TIMESTAMP];
|
||||||
|
struct nvdla_mem_handle eof_timestamps[MAX_NUM_NVDLA_OUT_TIMESTAMP];
|
||||||
struct nvdla_mem_handle memory_handles[NVDLA_MAX_BUFFERS_PER_TASK];
|
struct nvdla_mem_handle memory_handles[NVDLA_MAX_BUFFERS_PER_TASK];
|
||||||
u8 num_prefences;
|
u8 num_prefences;
|
||||||
u8 num_postfences;
|
u8 num_postfences;
|
||||||
u8 num_in_task_status;
|
u8 num_in_task_status;
|
||||||
u8 num_out_task_status;
|
u8 num_sof_task_status;
|
||||||
|
u8 num_eof_task_status;
|
||||||
|
u8 num_sof_timestamps;
|
||||||
|
u8 num_eof_timestamps;
|
||||||
u32 num_addresses;
|
u32 num_addresses;
|
||||||
u32 fence;
|
u32 fence;
|
||||||
u32 fence_counter;
|
u32 fence_counter;
|
||||||
@@ -280,7 +293,10 @@ struct nvdla_task {
|
|||||||
struct dma_buf *prefences_sem_dmabuf[MAX_NUM_NVDLA_PREFENCES];
|
struct dma_buf *prefences_sem_dmabuf[MAX_NUM_NVDLA_PREFENCES];
|
||||||
struct dma_buf *in_task_status_dmabuf[MAX_NUM_NVDLA_IN_TASK_STATUS];
|
struct dma_buf *in_task_status_dmabuf[MAX_NUM_NVDLA_IN_TASK_STATUS];
|
||||||
struct dma_buf *postfences_sem_dmabuf[MAX_NUM_NVDLA_POSTFENCES];
|
struct dma_buf *postfences_sem_dmabuf[MAX_NUM_NVDLA_POSTFENCES];
|
||||||
struct dma_buf *out_task_status_dmabuf[MAX_NUM_NVDLA_OUT_TASK_STATUS];
|
struct dma_buf *sof_task_status_dmabuf[MAX_NUM_NVDLA_OUT_TASK_STATUS];
|
||||||
|
struct dma_buf *eof_task_status_dmabuf[MAX_NUM_NVDLA_OUT_TASK_STATUS];
|
||||||
|
struct dma_buf *sof_timestamps_dmabuf[MAX_NUM_NVDLA_OUT_TIMESTAMP];
|
||||||
|
struct dma_buf *eof_timestamps_dmabuf[MAX_NUM_NVDLA_OUT_TIMESTAMP];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct dla_mem_addr {
|
struct dla_mem_addr {
|
||||||
@@ -402,7 +418,7 @@ int nvdla_free_gcov_region(struct platform_device *pdev, bool update_region);
|
|||||||
int nvdla_emulator_submit(struct nvdla_queue *queue,
|
int nvdla_emulator_submit(struct nvdla_queue *queue,
|
||||||
struct nvdla_emu_task *task);
|
struct nvdla_emu_task *task);
|
||||||
void task_free(struct kref *ref);
|
void task_free(struct kref *ref);
|
||||||
int nvdla_get_postfences(struct nvdla_queue *queue, void *in_task);
|
int nvdla_get_signal_fences(struct nvdla_queue *queue, void *in_task);
|
||||||
int nvdla_send_gos_region(struct platform_device *pdev);
|
int nvdla_send_gos_region(struct platform_device *pdev);
|
||||||
|
|
||||||
#endif /* End of __NVHOST_NVDLA_H__ */
|
#endif /* End of __NVHOST_NVDLA_H__ */
|
||||||
|
|||||||
@@ -376,13 +376,41 @@ static int nvdla_get_actions(struct nvdla_ioctl_submit_task *user_task,
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get output task status */
|
/* get sof task status */
|
||||||
if (copy_from_user(task->out_task_status,
|
if (copy_from_user(task->sof_task_status,
|
||||||
(void __user *)user_task->output_task_status,
|
(void __user *)user_task->sof_task_status,
|
||||||
(task->num_out_task_status *
|
(task->num_sof_task_status *
|
||||||
sizeof(struct nvdla_status_notify)))) {
|
sizeof(struct nvdla_status_notify)))) {
|
||||||
err = -EFAULT;
|
err = -EFAULT;
|
||||||
nvdla_dbg_err(pdev, "failed to copy output task status");
|
nvdla_dbg_err(pdev, "failed to copy sof task status");
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* get eof task status */
|
||||||
|
if (copy_from_user(task->eof_task_status,
|
||||||
|
(void __user *)user_task->eof_task_status,
|
||||||
|
(task->num_eof_task_status *
|
||||||
|
sizeof(struct nvdla_status_notify)))) {
|
||||||
|
err = -EFAULT;
|
||||||
|
nvdla_dbg_err(pdev, "failed to copy eof task status");
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* get sof timestamps */
|
||||||
|
if (copy_from_user(task->sof_timestamps,
|
||||||
|
(void __user*)user_task->sof_timestamps,
|
||||||
|
(task->num_sof_timestamps * sizeof(struct nvdla_mem_handle)))) {
|
||||||
|
err = -EFAULT;
|
||||||
|
nvdla_dbg_err(pdev, "failed to copy sof timestamps");
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* get eof timestamps */
|
||||||
|
if (copy_from_user(task->eof_timestamps,
|
||||||
|
(void __user*)user_task->eof_timestamps,
|
||||||
|
(task->num_eof_timestamps * sizeof(struct nvdla_mem_handle)))) {
|
||||||
|
err = -EFAULT;
|
||||||
|
nvdla_dbg_err(pdev, "failed to copy eof timestamps");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -392,20 +420,66 @@ fail:
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nvdla_send_emu_postfences(struct nvdla_emu_task *task,
|
static int nvdla_send_emu_signal_fences(struct nvdla_emu_task *task,
|
||||||
struct nvdla_ioctl_emu_submit_task *user_task)
|
struct nvdla_ioctl_emu_submit_task *user_task)
|
||||||
{
|
{
|
||||||
int err = 0, i;
|
int err = 0, i;
|
||||||
struct platform_device *dla_pdev = task->queue->pool->pdev;
|
struct platform_device *dla_pdev = task->queue->pool->pdev;
|
||||||
struct platform_device *host_pdev =
|
struct platform_device *host_pdev =
|
||||||
to_platform_device(dla_pdev->dev.parent);
|
to_platform_device(dla_pdev->dev.parent);
|
||||||
|
struct nvdev_fence __user *prefences =
|
||||||
|
(struct nvdev_fence __user *)(uintptr_t)user_task->prefences;
|
||||||
struct nvdev_fence __user *postfences =
|
struct nvdev_fence __user *postfences =
|
||||||
(struct nvdev_fence __user *)(uintptr_t)user_task->postfences;
|
(struct nvdev_fence __user *)(uintptr_t)user_task->postfences;
|
||||||
char fence_name[32];
|
char fence_name[32];
|
||||||
|
|
||||||
nvdla_dbg_fn(dla_pdev, "sending post fences");
|
nvdla_dbg_fn(dla_pdev, "sending signal fences");
|
||||||
|
|
||||||
|
for (i = 0; i < task->num_prefences; i++) {
|
||||||
|
if (task->prefences[i].action != NVDEV_FENCE_SIGNAL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (task->prefences[i].type == NVDEV_FENCE_TYPE_SYNC_FD) {
|
||||||
|
struct nvhost_ctrl_sync_fence_info info;
|
||||||
|
|
||||||
|
info.id = task->prefences[i].syncpoint_index;
|
||||||
|
info.thresh = task->prefences[i].syncpoint_value;
|
||||||
|
|
||||||
|
nvdla_dbg_info(dla_pdev,
|
||||||
|
"creating pre sync fd [%d]:[%d]\n",
|
||||||
|
info.id, info.thresh);
|
||||||
|
|
||||||
|
/* create fence name format example: nvdla0_1_fence */
|
||||||
|
snprintf(fence_name, sizeof(fence_name),
|
||||||
|
"%s_%d_%d_prefence", dev_name(&dla_pdev->dev),
|
||||||
|
task->prefences[i].syncpoint_index, i);
|
||||||
|
|
||||||
|
err = nvhost_sync_create_fence_fd(host_pdev,
|
||||||
|
&info, 1, fence_name,
|
||||||
|
&task->prefences[i].sync_fd);
|
||||||
|
|
||||||
|
if (err) {
|
||||||
|
nvdla_dbg_err(dla_pdev,
|
||||||
|
"fail to create prefence syncfd\n");
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nvdla_dbg_fn(dla_pdev, "copy prefences to user");
|
||||||
|
/* send pre fences */
|
||||||
|
if (copy_to_user(prefences, task->prefences,
|
||||||
|
(task->num_prefences * sizeof(struct nvdev_fence)))) {
|
||||||
|
err = -EFAULT;
|
||||||
|
nvdla_dbg_err(dla_pdev, "failed to send prefences");
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
nvdla_dbg_info(dla_pdev, "prefences sent");
|
||||||
|
|
||||||
for (i = 0; i < task->num_postfences; i++) {
|
for (i = 0; i < task->num_postfences; i++) {
|
||||||
|
if (task->postfences[i].action != NVDEV_FENCE_SIGNAL)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (task->postfences[i].type == NVDEV_FENCE_TYPE_SYNC_FD) {
|
if (task->postfences[i].type == NVDEV_FENCE_TYPE_SYNC_FD) {
|
||||||
struct nvhost_ctrl_sync_fence_info info;
|
struct nvhost_ctrl_sync_fence_info info;
|
||||||
|
|
||||||
@@ -418,8 +492,8 @@ static int nvdla_send_emu_postfences(struct nvdla_emu_task *task,
|
|||||||
|
|
||||||
/* create fence name format example: nvdla0_1_fence */
|
/* create fence name format example: nvdla0_1_fence */
|
||||||
snprintf(fence_name, sizeof(fence_name),
|
snprintf(fence_name, sizeof(fence_name),
|
||||||
"%s_%d_fence", dev_name(&dla_pdev->dev),
|
"%s_%d_%d_postfence", dev_name(&dla_pdev->dev),
|
||||||
task->postfences[i].syncpoint_index);
|
task->postfences[i].syncpoint_index, i);
|
||||||
|
|
||||||
err = nvhost_sync_create_fence_fd(host_pdev,
|
err = nvhost_sync_create_fence_fd(host_pdev,
|
||||||
&info, 1, fence_name,
|
&info, 1, fence_name,
|
||||||
@@ -447,20 +521,67 @@ fail:
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nvdla_update_postfences(struct nvdla_task *task,
|
static int nvdla_update_signal_fences(struct nvdla_task *task,
|
||||||
struct nvdla_ioctl_submit_task *user_task)
|
struct nvdla_ioctl_submit_task *user_task)
|
||||||
{
|
{
|
||||||
int err = 0, i;
|
int err = 0, i;
|
||||||
struct platform_device *dla_pdev = task->queue->pool->pdev;
|
struct platform_device *dla_pdev = task->queue->pool->pdev;
|
||||||
struct platform_device *host_pdev =
|
struct platform_device *host_pdev =
|
||||||
to_platform_device(dla_pdev->dev.parent);
|
to_platform_device(dla_pdev->dev.parent);
|
||||||
|
struct nvdev_fence __user *prefences =
|
||||||
|
(struct nvdev_fence __user *)(uintptr_t)user_task->prefences;
|
||||||
struct nvdev_fence __user *postfences =
|
struct nvdev_fence __user *postfences =
|
||||||
(struct nvdev_fence __user *)(uintptr_t)user_task->postfences;
|
(struct nvdev_fence __user *)(uintptr_t)user_task->postfences;
|
||||||
char fence_name[32];
|
char fence_name[32];
|
||||||
|
|
||||||
nvdla_dbg_fn(dla_pdev, "copy post fences for user");
|
nvdla_dbg_fn(dla_pdev, "copy fences for user");
|
||||||
|
|
||||||
|
/* update pre fence signals to users */
|
||||||
|
for (i = 0; i < task->num_prefences; i++) {
|
||||||
|
if (task->prefences[i].action != NVDEV_FENCE_SIGNAL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (task->prefences[i].type == NVDEV_FENCE_TYPE_SYNC_FD) {
|
||||||
|
struct nvhost_ctrl_sync_fence_info info;
|
||||||
|
|
||||||
|
info.id = task->prefences[i].syncpoint_index;
|
||||||
|
info.thresh = task->prefences[i].syncpoint_value;
|
||||||
|
|
||||||
|
nvdla_dbg_info(dla_pdev,
|
||||||
|
"creating pre sync fd [%d]:[%d]\n",
|
||||||
|
info.id, info.thresh);
|
||||||
|
|
||||||
|
/* create fence name format example: nvdla0_1_fence */
|
||||||
|
snprintf(fence_name, sizeof(fence_name),
|
||||||
|
"%s_%d_%d_prefence", dev_name(&dla_pdev->dev),
|
||||||
|
task->prefences[i].syncpoint_index, i);
|
||||||
|
|
||||||
|
err = nvhost_sync_create_fence_fd(host_pdev,
|
||||||
|
&info, 1, fence_name,
|
||||||
|
&task->prefences[i].sync_fd);
|
||||||
|
|
||||||
|
if (err) {
|
||||||
|
nvdla_dbg_err(dla_pdev,
|
||||||
|
"fail to create prefence syncfd\n");
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nvdla_dbg_fn(dla_pdev, "copy prefences to user");
|
||||||
|
/* copy pre fences */
|
||||||
|
if (copy_to_user(prefences, task->prefences,
|
||||||
|
(task->num_prefences * sizeof(struct nvdev_fence)))) {
|
||||||
|
err = -EFAULT;
|
||||||
|
nvdla_dbg_err(dla_pdev, "failed to copy prefences");
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* update post fence signals to user */
|
||||||
for (i = 0; i < task->num_postfences; i++) {
|
for (i = 0; i < task->num_postfences; i++) {
|
||||||
|
if (task->postfences[i].action != NVDEV_FENCE_SIGNAL)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (task->postfences[i].type == NVDEV_FENCE_TYPE_SYNC_FD) {
|
if (task->postfences[i].type == NVDEV_FENCE_TYPE_SYNC_FD) {
|
||||||
struct nvhost_ctrl_sync_fence_info info;
|
struct nvhost_ctrl_sync_fence_info info;
|
||||||
|
|
||||||
@@ -473,8 +594,8 @@ static int nvdla_update_postfences(struct nvdla_task *task,
|
|||||||
|
|
||||||
/* create fence name format example: nvdla0_1_fence */
|
/* create fence name format example: nvdla0_1_fence */
|
||||||
snprintf(fence_name, sizeof(fence_name),
|
snprintf(fence_name, sizeof(fence_name),
|
||||||
"%s_%d_fence", dev_name(&dla_pdev->dev),
|
"%s_%d_%d_postfence", dev_name(&dla_pdev->dev),
|
||||||
task->postfences[i].syncpoint_index);
|
task->postfences[i].syncpoint_index, i);
|
||||||
|
|
||||||
err = nvhost_sync_create_fence_fd(host_pdev,
|
err = nvhost_sync_create_fence_fd(host_pdev,
|
||||||
&info, 1, fence_name,
|
&info, 1, fence_name,
|
||||||
@@ -525,15 +646,33 @@ static int nvdla_val_task_submit_input(struct nvdla_ioctl_submit_task *in_task)
|
|||||||
MAX_NUM_NVDLA_IN_TASK_STATUS);
|
MAX_NUM_NVDLA_IN_TASK_STATUS);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
if (in_task->num_output_task_status > MAX_NUM_NVDLA_OUT_TASK_STATUS) {
|
if (in_task->num_sof_task_status > MAX_NUM_NVDLA_OUT_TASK_STATUS) {
|
||||||
pr_err("out task status[%u] crossing expected[%d]\n",
|
pr_err("sof task status[%u] crossing expected[%d]\n",
|
||||||
in_task->num_output_task_status,
|
in_task->num_sof_task_status,
|
||||||
MAX_NUM_NVDLA_OUT_TASK_STATUS);
|
MAX_NUM_NVDLA_OUT_TASK_STATUS);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
if (in_task->num_addresses < 1) {
|
if (in_task->num_eof_task_status > MAX_NUM_NVDLA_OUT_TASK_STATUS) {
|
||||||
|
pr_err("eof task status[%u] crossing expected[%d]\n",
|
||||||
|
in_task->num_eof_task_status,
|
||||||
|
MAX_NUM_NVDLA_OUT_TASK_STATUS);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
if (in_task->num_sof_timestamps > MAX_NUM_NVDLA_OUT_TIMESTAMP) {
|
||||||
|
pr_err("sof timestamps[%u] crossing expected[%d]\n",
|
||||||
|
in_task->num_sof_timestamps,
|
||||||
|
MAX_NUM_NVDLA_OUT_TIMESTAMP);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
if (in_task->num_eof_timestamps > MAX_NUM_NVDLA_OUT_TIMESTAMP) {
|
||||||
|
pr_err("eof timestamps[%u] crossing expected[%d]\n",
|
||||||
|
in_task->num_eof_timestamps,
|
||||||
|
MAX_NUM_NVDLA_OUT_TIMESTAMP);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
if (in_task->num_addresses < 1) {
|
||||||
pr_err("num addresses[%u] should be min one\n",
|
pr_err("num addresses[%u] should be min one\n",
|
||||||
in_task->num_addresses);
|
in_task->num_addresses);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
if (in_task->num_addresses > NVDLA_MAX_BUFFERS_PER_TASK) {
|
if (in_task->num_addresses > NVDLA_MAX_BUFFERS_PER_TASK) {
|
||||||
@@ -572,7 +711,10 @@ static int nvdla_fill_task(struct nvdla_queue *queue,
|
|||||||
task->num_prefences = local_task->num_prefences;
|
task->num_prefences = local_task->num_prefences;
|
||||||
task->num_postfences = local_task->num_postfences;
|
task->num_postfences = local_task->num_postfences;
|
||||||
task->num_in_task_status = local_task->num_input_task_status;
|
task->num_in_task_status = local_task->num_input_task_status;
|
||||||
task->num_out_task_status = local_task->num_output_task_status;
|
task->num_sof_task_status = local_task->num_sof_task_status;
|
||||||
|
task->num_eof_task_status = local_task->num_eof_task_status;
|
||||||
|
task->num_sof_timestamps = local_task->num_sof_timestamps;
|
||||||
|
task->num_eof_timestamps = local_task->num_eof_timestamps;
|
||||||
task->num_addresses = local_task->num_addresses;
|
task->num_addresses = local_task->num_addresses;
|
||||||
task->timeout = local_task->timeout;
|
task->timeout = local_task->timeout;
|
||||||
|
|
||||||
@@ -616,8 +758,14 @@ static void nvdla_dump_task(struct nvdla_task *task)
|
|||||||
nvdla_dbg_info(pdev, "dumping input task [%p] parameters:", task);
|
nvdla_dbg_info(pdev, "dumping input task [%p] parameters:", task);
|
||||||
nvdla_dbg_info(pdev, "num_prefences[%u] num_postfences[%u]",
|
nvdla_dbg_info(pdev, "num_prefences[%u] num_postfences[%u]",
|
||||||
task->num_prefences, task->num_postfences);
|
task->num_prefences, task->num_postfences);
|
||||||
nvdla_dbg_info(pdev, "num_in_status[%u] num_out_task_status[%u]",
|
nvdla_dbg_info(pdev, "num_in_status[%u] num_sof_task_status[%u] "
|
||||||
task->num_in_task_status, task->num_out_task_status);
|
"num_eof_task_status[%u]",
|
||||||
|
task->num_in_task_status,
|
||||||
|
task->num_sof_task_status,
|
||||||
|
task->num_eof_task_status);
|
||||||
|
nvdla_dbg_info(pdev, "num_sof_timestamps[%u] num_eof_timestamps[%u]",
|
||||||
|
task->num_sof_timestamps,
|
||||||
|
task->num_eof_timestamps);
|
||||||
nvdla_dbg_info(pdev, "num_addresses[%u]", task->num_addresses);
|
nvdla_dbg_info(pdev, "num_addresses[%u]", task->num_addresses);
|
||||||
|
|
||||||
for (i = 0; i < task->num_prefences; i++) {
|
for (i = 0; i < task->num_prefences; i++) {
|
||||||
@@ -654,12 +802,34 @@ static void nvdla_dump_task(struct nvdla_task *task)
|
|||||||
task->in_task_status[i].status);
|
task->in_task_status[i].status);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < task->num_out_task_status; i++) {
|
for (i = 0; i < task->num_sof_task_status; i++) {
|
||||||
nvdla_dbg_info(pdev, "Output task status[%d]:"
|
nvdla_dbg_info(pdev, "SOF task status[%d]:"
|
||||||
"handle[%u] offset[%u] status[%u]",
|
"handle[%u] offset[%u] status[%u]",
|
||||||
i, task->out_task_status[i].handle,
|
i, task->sof_task_status[i].handle,
|
||||||
task->out_task_status[i].offset,
|
task->sof_task_status[i].offset,
|
||||||
task->out_task_status[i].status);
|
task->sof_task_status[i].status);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < task->num_eof_task_status; i++) {
|
||||||
|
nvdla_dbg_info(pdev, "EOF task status[%d]:"
|
||||||
|
"handle[%u] offset[%u] status[%u]",
|
||||||
|
i, task->eof_task_status[i].handle,
|
||||||
|
task->eof_task_status[i].offset,
|
||||||
|
task->eof_task_status[i].status);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < task->num_sof_timestamps; i++) {
|
||||||
|
nvdla_dbg_info(pdev, "SOF timestamp[%d]:"
|
||||||
|
"handle[%u] offset[%u]",
|
||||||
|
i, task->sof_timestamps[i].handle,
|
||||||
|
task->sof_timestamps[i].offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < task->num_eof_timestamps; i++) {
|
||||||
|
nvdla_dbg_info(pdev, "EOF timestamp[%d]:"
|
||||||
|
"handle[%u] offset[%u]",
|
||||||
|
i, task->eof_timestamps[i].handle,
|
||||||
|
task->eof_timestamps[i].offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < task->num_addresses; i++) {
|
for (i = 0; i < task->num_addresses; i++) {
|
||||||
@@ -718,8 +888,18 @@ static int nvdla_emu_task_submit(struct nvdla_private *priv, void *arg)
|
|||||||
|
|
||||||
nvdla_dbg_info(pdev, "submit [%d]th task", i + 1);
|
nvdla_dbg_info(pdev, "submit [%d]th task", i + 1);
|
||||||
|
|
||||||
|
task.num_prefences = local_tasks[i].num_prefences;
|
||||||
task.num_postfences = local_tasks[i].num_postfences;
|
task.num_postfences = local_tasks[i].num_postfences;
|
||||||
|
|
||||||
|
/* get pre fences */
|
||||||
|
if (copy_from_user(task.prefences,
|
||||||
|
(void __user *)local_tasks[i].prefences,
|
||||||
|
(task.num_prefences * sizeof(struct nvdev_fence)))) {
|
||||||
|
err = -EFAULT;
|
||||||
|
nvdla_dbg_err(pdev, "failed to copy prefences");
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
/* get post fences */
|
/* get post fences */
|
||||||
if (copy_from_user(task.postfences,
|
if (copy_from_user(task.postfences,
|
||||||
(void __user *)local_tasks[i].postfences,
|
(void __user *)local_tasks[i].postfences,
|
||||||
@@ -736,13 +916,13 @@ static int nvdla_emu_task_submit(struct nvdla_private *priv, void *arg)
|
|||||||
}
|
}
|
||||||
nvdla_dbg_info(pdev, "task[%d] submitted", i + 1);
|
nvdla_dbg_info(pdev, "task[%d] submitted", i + 1);
|
||||||
|
|
||||||
/* send fences to user */
|
/* send signal fences to user */
|
||||||
err = nvdla_send_emu_postfences(&task, local_tasks + i);
|
err = nvdla_send_emu_signal_fences(&task, local_tasks + i);
|
||||||
if (err) {
|
if (err) {
|
||||||
nvdla_dbg_err(pdev, "fail to send postfence%d", i + 1);
|
nvdla_dbg_err(pdev, "fail to send sig fence%d", i + 1);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
nvdla_dbg_info(pdev, "postfences of task[%d] sent", i + 1);
|
nvdla_dbg_info(pdev, "signal fences of task[%d] sent", i + 1);
|
||||||
}
|
}
|
||||||
nvdla_dbg_fn(pdev, "Emulator task submitted, done!");
|
nvdla_dbg_fn(pdev, "Emulator task submitted, done!");
|
||||||
|
|
||||||
@@ -825,8 +1005,8 @@ static int nvdla_submit(struct nvdla_private *priv, void *arg)
|
|||||||
}
|
}
|
||||||
nvdla_dbg_info(pdev, "task[%d] desc filled", i + 1);
|
nvdla_dbg_info(pdev, "task[%d] desc filled", i + 1);
|
||||||
|
|
||||||
/* get expected postfences prior to submit */
|
/* get expected signal fences prior to submit */
|
||||||
err = nvdla_get_postfences(queue, task);
|
err = nvdla_get_signal_fences(queue, task);
|
||||||
if (err) {
|
if (err) {
|
||||||
nvdla_dbg_err(pdev, "fail to get fences%d", i + 1);
|
nvdla_dbg_err(pdev, "fail to get fences%d", i + 1);
|
||||||
goto fail_to_get_fences;
|
goto fail_to_get_fences;
|
||||||
@@ -834,7 +1014,7 @@ static int nvdla_submit(struct nvdla_private *priv, void *arg)
|
|||||||
nvdla_dbg_info(pdev, "task[%d] got fences", i + 1);
|
nvdla_dbg_info(pdev, "task[%d] got fences", i + 1);
|
||||||
|
|
||||||
/* update fences to user */
|
/* update fences to user */
|
||||||
err = nvdla_update_postfences(task, local_tasks + i);
|
err = nvdla_update_signal_fences(task, local_tasks + i);
|
||||||
if (err) {
|
if (err) {
|
||||||
nvdla_dbg_err(pdev, "fail update postfence%d", i + 1);
|
nvdla_dbg_err(pdev, "fail update postfence%d", i + 1);
|
||||||
goto fail_to_update_postfences;
|
goto fail_to_update_postfences;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Tegra NvDLA Driver
|
* Tegra NvDLA Driver
|
||||||
*
|
*
|
||||||
* Copyright (c) 2016-2018, NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
@@ -79,7 +79,7 @@ struct nvdla_pin_unpin_args {
|
|||||||
struct nvdla_submit_args {
|
struct nvdla_submit_args {
|
||||||
__u64 tasks;
|
__u64 tasks;
|
||||||
__u16 num_tasks;
|
__u16 num_tasks;
|
||||||
#define MAX_TASKS_PER_SUBMIT 24
|
#define MAX_TASKS_PER_SUBMIT 16
|
||||||
#define NVDLA_SUBMIT_FLAGS_ATOMIC (1 << 0)
|
#define NVDLA_SUBMIT_FLAGS_ATOMIC (1 << 0)
|
||||||
__u16 flags;
|
__u16 flags;
|
||||||
__u32 version;
|
__u32 version;
|
||||||
@@ -125,13 +125,19 @@ struct nvdla_mem_handle {
|
|||||||
* @num_prefences number of pre-fences in task
|
* @num_prefences number of pre-fences in task
|
||||||
* @num_postfences number of post-fences in task
|
* @num_postfences number of post-fences in task
|
||||||
* @num_input_task_status number of input task status
|
* @num_input_task_status number of input task status
|
||||||
* @num_output_task_status number of output task status
|
* @num_sof_task_status number of sof task status
|
||||||
|
* @num_eof_task_status number of eof task status
|
||||||
|
* @num_sof_timestamps number of sof timestamp
|
||||||
|
* @num_eof_timestamps number of eof timestamp
|
||||||
* @flags flags for bitwise task info embeddeing
|
* @flags flags for bitwise task info embeddeing
|
||||||
* @reserved reserved for future use
|
* @reserved reserved for future use
|
||||||
* @prefences pointer to pre-fence struct table
|
* @prefences pointer to pre-fence struct table
|
||||||
* @postfences pointer to post-fence struct table
|
* @postfences pointer to post-fence struct table
|
||||||
* @input_task_status pointer to input task status struct table
|
* @input_task_status pointer to input task status struct table
|
||||||
* @output_task_status pointer to output task status struct table
|
* @sof_task_status pointer to sof task status struct table
|
||||||
|
* @eof_task_status pointer to eof task status struct table
|
||||||
|
* @sof_timestamps pointer to sof timestamp handle list
|
||||||
|
* @eof_timestamps pointer to eof timestamp handle list
|
||||||
* @num_addresses total number of addressed passed in structure
|
* @num_addresses total number of addressed passed in structure
|
||||||
* @address_list pointer to address list
|
* @address_list pointer to address list
|
||||||
* @timeout task timeout
|
* @timeout task timeout
|
||||||
@@ -141,17 +147,24 @@ struct nvdla_ioctl_submit_task {
|
|||||||
__u8 num_prefences;
|
__u8 num_prefences;
|
||||||
__u8 num_postfences;
|
__u8 num_postfences;
|
||||||
__u8 num_input_task_status;
|
__u8 num_input_task_status;
|
||||||
__u8 num_output_task_status;
|
__u8 num_sof_task_status;
|
||||||
|
__u8 num_eof_task_status;
|
||||||
|
__u8 num_sof_timestamps;
|
||||||
|
__u8 num_eof_timestamps;
|
||||||
|
__u8 reserved0[1];
|
||||||
#define NVDLA_MAX_BUFFERS_PER_TASK (6144)
|
#define NVDLA_MAX_BUFFERS_PER_TASK (6144)
|
||||||
__u32 num_addresses;
|
__u32 num_addresses;
|
||||||
__u16 flags;
|
__u16 flags;
|
||||||
__u16 reserved;
|
__u16 reserved1;
|
||||||
|
|
||||||
__u64 prefences;
|
__u64 prefences;
|
||||||
__u64 postfences;
|
__u64 postfences;
|
||||||
|
|
||||||
__u64 input_task_status;
|
__u64 input_task_status;
|
||||||
__u64 output_task_status;
|
__u64 sof_task_status;
|
||||||
|
__u64 eof_task_status;
|
||||||
|
__u64 sof_timestamps;
|
||||||
|
__u64 eof_timestamps;
|
||||||
__u64 address_list;
|
__u64 address_list;
|
||||||
__u64 timeout;
|
__u64 timeout;
|
||||||
};
|
};
|
||||||
@@ -160,15 +173,17 @@ struct nvdla_ioctl_submit_task {
|
|||||||
* struct nvdla_ioctl_emu_submit_task structure for single emulator task
|
* struct nvdla_ioctl_emu_submit_task structure for single emulator task
|
||||||
* information
|
* information
|
||||||
*
|
*
|
||||||
|
* @num_prefences number of pre-fences in task
|
||||||
* @num_postfences number of post-fences in task
|
* @num_postfences number of post-fences in task
|
||||||
* @reserved reserved for padding and future use
|
* @prefences pointer to pre-fence struct table
|
||||||
* @postfences pointer to post-fence struct table
|
* @postfences pointer to post-fence struct table
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
struct nvdla_ioctl_emu_submit_task {
|
struct nvdla_ioctl_emu_submit_task {
|
||||||
|
__u32 num_prefences;
|
||||||
__u32 num_postfences;
|
__u32 num_postfences;
|
||||||
__u32 reserved;
|
|
||||||
|
|
||||||
|
__u64 prefences;
|
||||||
__u64 postfences;
|
__u64 postfences;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user