From c9d85a691fc2421c9bbf5b70091bfd591d4d11ef Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Tue, 14 Aug 2018 14:17:05 +0300 Subject: eventlib: unify NVDLA/PVA fence types and add fence recording Bug 2170736 Change-Id: If4fdeda140bf2474a08beb2a0d7c3fc1737a1a66 Signed-off-by: Dmitry Antipov Reviewed-on: https://git-master.nvidia.com/r/1750906 Reviewed-by: Saleh Dindar GVS: Gerrit_Virtual_Submit Reviewed-by: Colin Tracey Reviewed-by: Prashant Gaikwad Reviewed-by: mobile promotions Tested-by: mobile promotions --- include/uapi/linux/nvdev_fence.h | 58 +++++++++++++++++++++++++++++++++++ include/uapi/linux/nvhost_events.h | 30 +++++++++++++++++- include/uapi/linux/nvhost_pva_ioctl.h | 9 ++---- 3 files changed, 89 insertions(+), 8 deletions(-) create mode 100644 include/uapi/linux/nvdev_fence.h (limited to 'include/uapi/linux') diff --git a/include/uapi/linux/nvdev_fence.h b/include/uapi/linux/nvdev_fence.h new file mode 100644 index 000000000..37d81be43 --- /dev/null +++ b/include/uapi/linux/nvdev_fence.h @@ -0,0 +1,58 @@ +/* + * include/uapi/linux/nvdev_fence.h + * + * Tegra PVA/DLA fence support + * + * Copyright (c) 2018, NVIDIA Corporation. 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 as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef LINUX_NVDEV_FENCE_H +#define LINUX_NVDEV_FENCE_H + +#include + +/* used for the recording with keventlib */ +enum nvdev_fence_kind { + NVDEV_FENCE_KIND_PRE = 0, + NVDEV_FENCE_KIND_POST +}; + +/** + * struct nvdev_fence structure for passing fence information + * + * @type: Type of the fence (syncpoint, sync fd or semaphore) + * @syncpoint_index: Syncpoint id + * @syncpoint_value: Value of syncpoint id + * @sync_fd: Linux sync FD handle + * @semaphore_handle: File handle to the semaphore memory buffer + * @semaphore_offset: Offset to the semaphore within the buffer + * @semaphore_value: Value of the semaphore + */ +struct nvdev_fence { + __u32 type; +#define NVDEV_FENCE_TYPE_SYNCPT 0 +#define NVDEV_FENCE_TYPE_SYNC_FD 1 +#define NVDEV_FENCE_TYPE_SEMAPHORE 2 +#define NVDEV_FENCE_TYPE_SEMAPHORE_TS 3 + __u32 syncpoint_index; + __u32 syncpoint_value; + __u32 sync_fd; + __u32 semaphore_handle; + __u32 semaphore_offset; + __u32 semaphore_value; +}; + +#endif /* LINUX_NVDEV_FENCE_H */ diff --git a/include/uapi/linux/nvhost_events.h b/include/uapi/linux/nvhost_events.h index 1282ee38a..1c9bc4cef 100644 --- a/include/uapi/linux/nvhost_events.h +++ b/include/uapi/linux/nvhost_events.h @@ -77,6 +77,31 @@ struct nvhost_vpu_perf_counter { u32 maximum; } __packed; +/* Marks the pre/postfence associated with the task */ +struct nvhost_task_fence { + /* Engine class ID */ + u32 class_id; + + /* Kind (prefence or postfence) */ + u32 kind; + + /* Type (see nvdev_fence.h) */ + u32 type; + + /* Valid for NVDEV_FENCE_TYPE_SYNCPT only */ + u32 syncpoint_index; + u32 syncpoint_value; + + /* Valid for NVDEV_FENCE_TYPE_SYNC_FD only */ + u32 sync_fd; + + /* Valid for NVDEV_FENCE_TYPE_SEMAPHORE + and NVDEV_FENCE_TYPE_SEMAPHORE_TS */ + u32 semaphore_handle; + u32 semaphore_offset; + u32 semaphore_value; +} __packed; + enum { /* struct nvhost_task_submit */ NVHOST_TASK_SUBMIT = 0, @@ -90,7 +115,10 @@ enum { /* struct nvhost_vpu_perf_counter */ NVHOST_VPU_PERF_COUNTER = 3, - NVHOST_NUM_EVENT_TYPES = 4 + /* struct nvhost_task_fence */ + NVHOST_TASK_FENCE = 4, + + NVHOST_NUM_EVENT_TYPES = 5 }; enum { diff --git a/include/uapi/linux/nvhost_pva_ioctl.h b/include/uapi/linux/nvhost_pva_ioctl.h index c09e1ba71..fc0940e95 100644 --- a/include/uapi/linux/nvhost_pva_ioctl.h +++ b/include/uapi/linux/nvhost_pva_ioctl.h @@ -164,13 +164,8 @@ struct pva_task_parameter { /** * struct pva_ioctl_fence structure for passing fence information * - * @type: Type of the fence (syncpoint, sync fd or semaphore) - * @syncpoint_index: Syncpoint id - * @syncpoint_value: Value of syncpoint id - * @sync_fd: Linux sync FD handle - * @semaphore_handle: File handle to the semaphore memory buffer - * @semaphore_offset: Offset to the semaphore within the buffer - * @semaphore_value: Value of the semaphore + * NOTE: this will be removed soon, please use generic fence type + * from nvdev_fence.h */ struct pva_fence { __u32 type; -- cgit v1.2.2