1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */ 2*4882a593Smuzhiyun /* 3*4882a593Smuzhiyun * Copyright (C) 2012 Google, Inc. 4*4882a593Smuzhiyun * 5*4882a593Smuzhiyun * This program is distributed in the hope that it will be useful, 6*4882a593Smuzhiyun * but WITHOUT ANY WARRANTY; without even the implied warranty of 7*4882a593Smuzhiyun * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 8*4882a593Smuzhiyun * GNU General Public License for more details. 9*4882a593Smuzhiyun * 10*4882a593Smuzhiyun */ 11*4882a593Smuzhiyun 12*4882a593Smuzhiyun #ifndef _UAPI_LINUX_SYNC_H 13*4882a593Smuzhiyun #define _UAPI_LINUX_SYNC_H 14*4882a593Smuzhiyun 15*4882a593Smuzhiyun #include <linux/ioctl.h> 16*4882a593Smuzhiyun #include <linux/types.h> 17*4882a593Smuzhiyun 18*4882a593Smuzhiyun /** 19*4882a593Smuzhiyun * struct sync_merge_data - data passed to merge ioctl 20*4882a593Smuzhiyun * @name: name of new fence 21*4882a593Smuzhiyun * @fd2: file descriptor of second fence 22*4882a593Smuzhiyun * @fence: returns the fd of the new fence to userspace 23*4882a593Smuzhiyun * @flags: merge_data flags 24*4882a593Smuzhiyun * @pad: padding for 64-bit alignment, should always be zero 25*4882a593Smuzhiyun */ 26*4882a593Smuzhiyun struct sync_merge_data { 27*4882a593Smuzhiyun char name[32]; 28*4882a593Smuzhiyun __s32 fd2; 29*4882a593Smuzhiyun __s32 fence; 30*4882a593Smuzhiyun __u32 flags; 31*4882a593Smuzhiyun __u32 pad; 32*4882a593Smuzhiyun }; 33*4882a593Smuzhiyun 34*4882a593Smuzhiyun /** 35*4882a593Smuzhiyun * struct sync_fence_info - detailed fence information 36*4882a593Smuzhiyun * @obj_name: name of parent sync_timeline 37*4882a593Smuzhiyun * @driver_name: name of driver implementing the parent 38*4882a593Smuzhiyun * @status: status of the fence 0:active 1:signaled <0:error 39*4882a593Smuzhiyun * @flags: fence_info flags 40*4882a593Smuzhiyun * @timestamp_ns: timestamp of status change in nanoseconds 41*4882a593Smuzhiyun */ 42*4882a593Smuzhiyun struct sync_fence_info { 43*4882a593Smuzhiyun char obj_name[32]; 44*4882a593Smuzhiyun char driver_name[32]; 45*4882a593Smuzhiyun __s32 status; 46*4882a593Smuzhiyun __u32 flags; 47*4882a593Smuzhiyun __u64 timestamp_ns; 48*4882a593Smuzhiyun }; 49*4882a593Smuzhiyun 50*4882a593Smuzhiyun /** 51*4882a593Smuzhiyun * struct sync_file_info - data returned from fence info ioctl 52*4882a593Smuzhiyun * @name: name of fence 53*4882a593Smuzhiyun * @status: status of fence. 1: signaled 0:active <0:error 54*4882a593Smuzhiyun * @flags: sync_file_info flags 55*4882a593Smuzhiyun * @num_fences number of fences in the sync_file 56*4882a593Smuzhiyun * @pad: padding for 64-bit alignment, should always be zero 57*4882a593Smuzhiyun * @sync_fence_info: pointer to array of structs sync_fence_info with all 58*4882a593Smuzhiyun * fences in the sync_file 59*4882a593Smuzhiyun */ 60*4882a593Smuzhiyun struct sync_file_info { 61*4882a593Smuzhiyun char name[32]; 62*4882a593Smuzhiyun __s32 status; 63*4882a593Smuzhiyun __u32 flags; 64*4882a593Smuzhiyun __u32 num_fences; 65*4882a593Smuzhiyun __u32 pad; 66*4882a593Smuzhiyun 67*4882a593Smuzhiyun __u64 sync_fence_info; 68*4882a593Smuzhiyun }; 69*4882a593Smuzhiyun 70*4882a593Smuzhiyun #define SYNC_IOC_MAGIC '>' 71*4882a593Smuzhiyun 72*4882a593Smuzhiyun /** 73*4882a593Smuzhiyun * Opcodes 0, 1 and 2 were burned during a API change to avoid users of the 74*4882a593Smuzhiyun * old API to get weird errors when trying to handling sync_files. The API 75*4882a593Smuzhiyun * change happened during the de-stage of the Sync Framework when there was 76*4882a593Smuzhiyun * no upstream users available. 77*4882a593Smuzhiyun */ 78*4882a593Smuzhiyun 79*4882a593Smuzhiyun /** 80*4882a593Smuzhiyun * DOC: SYNC_IOC_MERGE - merge two fences 81*4882a593Smuzhiyun * 82*4882a593Smuzhiyun * Takes a struct sync_merge_data. Creates a new fence containing copies of 83*4882a593Smuzhiyun * the sync_pts in both the calling fd and sync_merge_data.fd2. Returns the 84*4882a593Smuzhiyun * new fence's fd in sync_merge_data.fence 85*4882a593Smuzhiyun */ 86*4882a593Smuzhiyun #define SYNC_IOC_MERGE _IOWR(SYNC_IOC_MAGIC, 3, struct sync_merge_data) 87*4882a593Smuzhiyun 88*4882a593Smuzhiyun /** 89*4882a593Smuzhiyun * DOC: SYNC_IOC_FILE_INFO - get detailed information on a sync_file 90*4882a593Smuzhiyun * 91*4882a593Smuzhiyun * Takes a struct sync_file_info. If num_fences is 0, the field is updated 92*4882a593Smuzhiyun * with the actual number of fences. If num_fences is > 0, the system will 93*4882a593Smuzhiyun * use the pointer provided on sync_fence_info to return up to num_fences of 94*4882a593Smuzhiyun * struct sync_fence_info, with detailed fence information. 95*4882a593Smuzhiyun */ 96*4882a593Smuzhiyun #define SYNC_IOC_FILE_INFO _IOWR(SYNC_IOC_MAGIC, 4, struct sync_file_info) 97*4882a593Smuzhiyun 98*4882a593Smuzhiyun #endif /* _UAPI_LINUX_SYNC_H */ 99