#endif
}
+static int nvhost_ioctl_ctrl_sync_fence_set_name(
+ struct nvhost_ctrl_userctx *ctx,
+ struct nvhost_ctrl_sync_fence_name_args *args)
+{
+#ifdef CONFIG_TEGRA_GRHOST_SYNC
+ int err;
+ char name[32];
+ const char __user *args_name =
+ (const char __user *)(uintptr_t)args->name;
+
+ if (args_name) {
+ if (strncpy_from_user(name, args_name, sizeof(name)) < 0)
+ return -EFAULT;
+ name[sizeof(name) - 1] = '\0';
+ } else {
+ name[0] = '\0';
+ }
+
+ err = nvhost_sync_fence_set_name(args->fence_fd, name);
+ return err;
+#else
+ return -EINVAL;
+#endif
+}
+
static int nvhost_ioctl_ctrl_module_mutex(struct nvhost_ctrl_userctx *ctx,
struct nvhost_ctrl_module_mutex_args *args)
{
case NVHOST_IOCTL_CTRL_SYNC_FENCE_CREATE:
err = nvhost_ioctl_ctrl_sync_fence_create(priv, (void *)buf);
break;
+ case NVHOST_IOCTL_CTRL_SYNC_FENCE_SET_NAME:
+ err = nvhost_ioctl_ctrl_sync_fence_set_name(priv, (void *)buf);
+ break;
case NVHOST_IOCTL_CTRL_MODULE_MUTEX:
err = nvhost_ioctl_ctrl_module_mutex(priv, (void *)buf);
break;
sync_timeline_signal(&obj->obj);
}
+int nvhost_sync_fence_set_name(int fence_fd, const char *name)
+{
+ struct sync_fence *fence = nvhost_sync_fdget(fence_fd);
+ if (!fence)
+ return -EINVAL;
+ strlcpy(fence->name, name, sizeof(fence->name));
+ sync_fence_put(fence);
+ return 0;
+}
+EXPORT_SYMBOL(nvhost_sync_fence_set_name);
+
int nvhost_sync_create_fence_fd(struct platform_device *pdev,
struct nvhost_ctrl_sync_fence_info *pts,
u32 num_pts, const char *name, int *fence_fd)
int nvhost_sync_num_pts(struct sync_fence *fence);
u32 nvhost_sync_pt_id(struct sync_pt *pt);
u32 nvhost_sync_pt_thresh(struct sync_pt *pt);
+int nvhost_sync_fence_set_name(int fence_fd, const char *name);
#else
static inline struct sync_fence *nvhost_sync_create_fence(
return 0;
}
+static inline int nvhost_sync_fence_set_name(int fence_fd, const char *name)
+{
+ return -EINVAL;
+}
+
#endif
/* Hacky way to get access to struct nvhost_device_data for VI device. */
__u64 name; /* const char* */
};
+struct nvhost_ctrl_sync_fence_name_args {
+ __u64 name; /* const char* for name */
+ __s32 fence_fd; /* fd of fence */
+};
+
struct nvhost_ctrl_module_mutex_args {
__u32 id;
__u32 lock;
_IOWR(NVHOST_IOCTL_MAGIC, 11, struct nvhost_ctrl_sync_fence_create_args)
#define NVHOST_IOCTL_CTRL_MODULE_REGRDWR \
_IOWR(NVHOST_IOCTL_MAGIC, 12, struct nvhost_ctrl_module_regrdwr_args)
+#define NVHOST_IOCTL_CTRL_SYNC_FENCE_SET_NAME \
+ _IOWR(NVHOST_IOCTL_MAGIC, 13, struct nvhost_ctrl_sync_fence_name_args)
#define NVHOST_IOCTL_CTRL_LAST \
- _IOC_NR(NVHOST_IOCTL_CTRL_MODULE_REGRDWR)
+ _IOC_NR(NVHOST_IOCTL_CTRL_SYNC_FENCE_SET_NAME)
#define NVHOST_IOCTL_CTRL_MAX_ARG_SIZE \
sizeof(struct nvhost_ctrl_syncpt_waitmex_args)