Line 9: |
Line 9: |
| | 0 || Open | | | 0 || Open |
| |- | | |- |
− | | 1 || [[#Ioctl]] | + | | 1 || Ioctl |
| |- | | |- |
| | 2 || Close | | | 2 || Close |
Line 28: |
Line 28: |
| |} | | |} |
| | | |
− | == Ioctl == | + | == Ioctls == |
− | Just like any standard build of the NVIDIA graphics' drivers, the nvdrv:a service operates mainly by processing requests and sending them to the kernel (not verified) through IOCtl commands.
| + | The ioctl number is generated with the following primitive (see Linux kernel): |
− | Note that these commands are generated with the following primitive (see Linux kernel):
| |
| | | |
| #define _IOC(inout, group, num, len) \ | | #define _IOC(inout, group, num, len) \ |
| (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num)) | | (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num)) |
| | | |
− | The following table contains valid commands for group 0x00. | + | The following table contains known ioctls. |
− | This group consists in commands for the "/dev/nvhost-ctrl" interface and a few global commands for every nvhost channel (e.g.: "/dev/nvhost-gpu").
| + | |
| {| class="wikitable" border="1" | | {| class="wikitable" border="1" |
− | ! Value || Description || Notes | + | ! Device || Value || Description || Notes |
| |- | | |- |
− | | 0xC0??0001 || NVHOST32_IOCTL_CHANNEL_SUBMIT || ?? == size is unknown | + | | /dev/nvhost-* || 0xC0??0001 || NVHOST32_IOCTL_CHANNEL_SUBMIT || ?? == size is unknown |
| |- | | |- |
− | | 0xC0080002 || NVHOST_IOCTL_CHANNEL_GET_SYNCPOINT || | + | | /dev/nvhost-* || 0xC0080002 || NVHOST_IOCTL_CHANNEL_GET_SYNCPOINT || |
| |- | | |- |
− | | 0xC0080003 || NVHOST_IOCTL_CHANNEL_GET_WAITBASE || | + | | /dev/nvhost-* || 0xC0080003 || NVHOST_IOCTL_CHANNEL_GET_WAITBASE || |
| |- | | |- |
− | | 0xC0080004 || NVHOST_IOCTL_CHANNEL_SET_TIMEOUT_EX || | + | | /dev/nvhost-* || 0xC0080004 || NVHOST_IOCTL_CHANNEL_SET_TIMEOUT_EX || |
| |- | | |- |
− | | 0xC01C0009 || NVHOST_IOCTL_CHANNEL_SUBMIT(?) || | + | | /dev/nvhost-* || 0xC01C0009 || NVHOST_IOCTL_CHANNEL_SUBMIT(?) || |
| |- | | |- |
− | | 0xC01C000A || NVHOST_IOCTL_CHANNEL_MODULE_REGRDWR(?) || | + | | /dev/nvhost-* || 0xC01C000A || NVHOST_IOCTL_CHANNEL_MODULE_REGRDWR(?) || |
| |- | | |- |
− | | 0xC0080014 || NVHOST_IOCTL_CTRL_SYNCPT_READ || | + | | /dev/nvhost-* || 0xC0080014 || NVHOST_IOCTL_CTRL_SYNCPT_READ || |
| |- | | |- |
− | | 0x40040015 || NVHOST_IOCTL_CTRL_SYNCPT_INCR || | + | | /dev/nvhost-* || 0x40040015 || NVHOST_IOCTL_CTRL_SYNCPT_INCR || |
| |- | | |- |
− | | 0xC00C0016 || NVHOST_IOCTL_CTRL_SYNCPT_WAIT || | + | | /dev/nvhost-* || 0xC00C0016 || NVHOST_IOCTL_CTRL_SYNCPT_WAIT || |
| |- | | |- |
− | | 0x40080017 || NVHOST_IOCTL_CTRL_MODULE_MUTEX || | + | | /dev/nvhost-* || 0x40080017 || NVHOST_IOCTL_CTRL_MODULE_MUTEX || |
| |- | | |- |
− | | 0xC0180018 || NVHOST32_IOCTL_CTRL_MODULE_REGRDWR || | + | | /dev/nvhost-* || 0xC0180018 || NVHOST32_IOCTL_CTRL_MODULE_REGRDWR || |
| |- | | |- |
− | | 0xC0100019 || NVHOST_IOCTL_CTRL_SYNCPT_WAITEX || | + | | /dev/nvhost-* || 0xC0100019 || NVHOST_IOCTL_CTRL_SYNCPT_WAITEX || |
| |- | | |- |
− | | 0xC008001A || NVHOST_IOCTL_CTRL_SYNCPT_READ_MAX || | + | | /dev/nvhost-* || 0xC008001A || NVHOST_IOCTL_CTRL_SYNCPT_READ_MAX || |
| |- | | |- |
− | | 0xC004001C || NVHOST_IOCTL_CTRL_GET_VERSION(?) || | + | | /dev/nvhost-* || 0xC004001C || NVHOST_IOCTL_CTRL_GET_VERSION(?) || |
| |- | | |- |
− | | 0xC010001D || Unknown || NvRmSyncWaitEvent (wait on event? | + | | /dev/nvhost-* || 0xC010001D || || NvRmSyncWaitEvent (wait on event?) |
| |- | | |- |
− | | 0xC010001E || Unknown || NvRmSyncWaitEvent (wait on event?) | + | | /dev/nvhost-* || 0xC010001E || || NvRmSyncWaitEvent (wait on event?) |
| |- | | |- |
− | | 0xC004001F || Unknown || NvRmSyncWaitEvent (signal event?) | + | | /dev/nvhost-* || 0xC004001F || || NvRmSyncWaitEvent (signal event?) |
| |- | | |- |
− | | 0xC0040020 || Unknown || NvRmSyncWaitEvent (signal event?) | + | | /dev/nvhost-* || 0xC0040020 || || NvRmSyncWaitEvent (signal event?) |
| |- | | |- |
− | | 0x40080021 || Unknown || Returns busy? | + | | /dev/nvhost-* || 0x40080021 || || Returns busy? |
| |- | | |- |
− | |} | + | | /dev/nvmap || 0xC0080101 || NVMAP_IOC_CREATE || |
− | | |
− | | |
− | The following table contains valid commands for group 0x01.
| |
− | This group consists in commands for the "/dev/nvmap" interface.
| |
− | {| class="wikitable" border="1"
| |
− | ! Value || Description || Notes
| |
| |- | | |- |
− | | 0xC0080101 || NVMAP_IOC_CREATE || | + | | /dev/nvmap || 0xC0080103 || NVMAP_IOC_FROM_ID || |
| |- | | |- |
− | | 0xC0080103 || NVMAP_IOC_FROM_ID || | + | | /dev/nvmap || 0xC0200104 || NVMAP_IOC_ALLOC || |
| |- | | |- |
− | | 0xC0200104 || NVMAP_IOC_ALLOC || | + | | /dev/nvmap || 0xC0180105 || NVMAP_IOC_FREE || |
| |- | | |- |
− | | 0xC0180105 || NVMAP_IOC_FREE || | + | | /dev/nvmap || 0xC00C0109 || NVMAP_IOC_PARAM || |
| |- | | |- |
− | | 0xC00C0109 || NVMAP_IOC_PARAM || | + | | /dev/nvmap || 0xC008010E || NVMAP_IOC_GET_ID || |
| |- | | |- |
− | | 0xC008010E || NVMAP_IOC_GET_ID || | + | | /dev/nvhost-as-gpu || 0x40044101 || NVGPU_AS_IOCTL_BIND_CHANNEL || |
| |- | | |- |
− | |} | + | | /dev/nvhost-as-gpu || 0xC0184102 || NVGPU32_AS_IOCTL_ALLOC_SPACE || |
− | | |
− | | |
− | The following table contains valid commands for group 0x41 ('A').
| |
− | This group consists in commands for the "/dev/nvhost-as-gpu" interface.
| |
− | {| class="wikitable" border="1"
| |
− | ! Value || Description || Notes
| |
| |- | | |- |
− | | 0x40044101 || NVGPU_AS_IOCTL_BIND_CHANNEL || | + | | /dev/nvhost-as-gpu || 0xC0104103 || NVGPU_AS_IOCTL_FREE_SPACE || |
| |- | | |- |
− | | 0xC0184102 || NVGPU32_AS_IOCTL_ALLOC_SPACE || | + | | /dev/nvhost-as-gpu || 0xC0184104 || NVGPU_AS_IOCTL_MAP_BUFFER || |
| |- | | |- |
− | | 0xC0104103 || NVGPU_AS_IOCTL_FREE_SPACE || | + | | /dev/nvhost-as-gpu || 0xC0084105 || NVGPU_AS_IOCTL_UNMAP_BUFFER || |
| |- | | |- |
− | | 0xC0184104 || NVGPU_AS_IOCTL_MAP_BUFFER || | + | | /dev/nvhost-as-gpu || 0xC0284106 || NVGPU_AS_IOCTL_ALLOC_SPACE || |
| |- | | |- |
− | | 0xC0084105 || NVGPU_AS_IOCTL_UNMAP_BUFFER || | + | | /dev/nvhost-as-gpu || 0x40104107 || || |
| |- | | |- |
− | | 0xC0284106 || NVGPU_AS_IOCTL_ALLOC_SPACE || | + | | /dev/nvhost-as-gpu || 0xC0404108 || || |
| |- | | |- |
− | | 0x40104107 || Unknown || | + | | /dev/nvhost-as-gpu || 0x40284109 || || |
| |- | | |- |
− | | 0xC0404108 || Unknown || | + | | /dev/nvhost-as-gpu || 0xC0144114 || || |
| |- | | |- |
− | | 0x40284109 || Unknown || | + | | /dev/nvhost-dbg-gpu || 0xC0??4402 || NVGPU_DBG_GPU_IOCTL_REG_OPS || ?? == size is unknown |
| |- | | |- |
− | | 0xC0144114 || Unknown || | + | | /dev/nvhost-ctrl-gpu || 0x80044701 || NVGPU_GPU_IOCTL_ZCULL_GET_CTX_SIZE || |
| |- | | |- |
− | |} | + | | /dev/nvhost-ctrl-gpu || 0x80284702 || NVGPU_GPU_IOCTL_ZCULL_GET_INFO || |
− | | |
− | | |
− | The following table contains valid commands for group 0x44 ('D').
| |
− | This group consists in commands for the "/dev/nvhost-dbg-gpu" interface.
| |
− | {| class="wikitable" border="1"
| |
− | ! Value || Description || Notes
| |
| |- | | |- |
− | | 0xC0??4402 || NVGPU_DBG_GPU_IOCTL_REG_OPS || ?? == size is unknown | + | | /dev/nvhost-ctrl-gpu || 0x402C4703 || NVGPU_GPU_IOCTL_ZBC_SET_TABLE || |
| |- | | |- |
− | |} | + | | /dev/nvhost-ctrl-gpu || 0xC0344704 || NVGPU_GPU_IOCTL_ZBC_QUERY_TABLE || |
− | | |
− | | |
− | The following table contains valid commands for group 0x47 ('G').
| |
− | This group consists in commands for the "/dev/nvhost-ctrl-gpu" interface.
| |
− | {| class="wikitable" border="1"
| |
− | ! Value || Description || Notes
| |
| |- | | |- |
− | | 0x80044701 || NVGPU_GPU_IOCTL_ZCULL_GET_CTX_SIZE || | + | | /dev/nvhost-ctrl-gpu || 0xC0B04705 || NVGPU_GPU_IOCTL_GET_CHARACTERISTICS || |
| |- | | |- |
− | | 0x80284702 || NVGPU_GPU_IOCTL_ZCULL_GET_INFO || | + | | /dev/nvhost-ctrl-gpu || 0xC0184706 || NVGPU_AS_IOCTL_ALLOC_SPACE || |
| |- | | |- |
− | | 0x402C4703 || NVGPU_GPU_IOCTL_ZBC_SET_TABLE || | + | | /dev/nvhost-ctrl-gpu || 0x40084707 || || |
| |- | | |- |
− | | 0xC0344704 || NVGPU_GPU_IOCTL_ZBC_QUERY_TABLE || | + | | /dev/nvhost-ctrl-gpu || 0x4008470E || || |
| |- | | |- |
− | | 0xC0B04705 || NVGPU_GPU_IOCTL_GET_CHARACTERISTICS || | + | | /dev/nvhost-ctrl-gpu || 0x4010470F || || |
| |- | | |- |
− | | 0xC0184706 || NVGPU_AS_IOCTL_ALLOC_SPACE || | + | | /dev/nvhost-ctrl-gpu || 0xC0084710 || || |
| |- | | |- |
− | | 0x40084707 || Unknown || | + | | /dev/nvhost-ctrl-gpu || 0x80084711 || || |
| |- | | |- |
− | | 0x4008470E || Unknown || | + | | /dev/nvhost-ctrl-gpu || 0x80084714 || || |
| |- | | |- |
− | | 0x4010470F || Unknown || | + | | /dev/nvhost-ctrl-gpu || 0xC008471B || || |
− | |-
| |
− | | 0xC0084710 || Unknown ||
| |
− | |-
| |
− | | 0x80084711 || Unknown ||
| |
− | |-
| |
− | | 0x80084714 || Unknown ||
| |
− | |-
| |
− | | 0xC008471B || Unknown ||
| |
− | |-
| |
− | | 0xC010471C || Unknown ||
| |
− | |-
| |
− | |}
| |
− | | |
− | | |
− | The following table contains valid commands for group 0x48 ('H').
| |
− | This group consists in commands common to all nvhost channels (depending if they implement them or not), but they are only listed here in relation to the interface "/dev/nvhost-gpu" for convenience.
| |
− | {| class="wikitable" border="1"
| |
− | ! Value || Description || Notes
| |
| |- | | |- |
− | | 0x40044801 || NVGPU_IOCTL_CHANNEL_SET_NVMAP_FD || | + | | /dev/nvhost-ctrl-gpu || 0xC010471C || || |
| |- | | |- |
− | | 0x40044803 || NVGPU_IOCTL_CHANNEL_SET_TIMEOUT(?) || | + | | /dev/nvhost-* || 0x40044801 || NVGPU_IOCTL_CHANNEL_SET_NVMAP_FD || |
| |- | | |- |
− | | 0x40084805 || NVGPU_IOCTL_CHANNEL_SET_TIMEOUT_EX(?) || | + | | /dev/nvhost-* || 0x40044803 || NVGPU_IOCTL_CHANNEL_SET_TIMEOUT(?) || |
| |- | | |- |
− | | 0xC0044807 || NVGPU_IOCTL_CHANNEL_CYCLE_STATS || | + | | /dev/nvhost-* || 0x40084805 || NVGPU_IOCTL_CHANNEL_SET_TIMEOUT_EX(?) || |
| |- | | |- |
− | | 0xC0184808 || NVGPU_IOCTL_CHANNEL_SUBMIT_GPFIFO || | + | | /dev/nvhost-* || 0xC0044807 || NVGPU_IOCTL_CHANNEL_CYCLE_STATS || |
| |- | | |- |
− | | 0xC0104809 || NVGPU_IOCTL_CHANNEL_ALLOC_OBJ_CTX || | + | | /dev/nvhost-* || 0xC0184808 || NVGPU_IOCTL_CHANNEL_SUBMIT_GPFIFO || |
| |- | | |- |
− | | 0x4008480A || NVGPU_IOCTL_CHANNEL_FREE_OBJ_CTX || | + | | /dev/nvhost-* || 0xC0104809 || NVGPU_IOCTL_CHANNEL_ALLOC_OBJ_CTX || |
| |- | | |- |
− | | 0xC010480B || NVGPU_IOCTL_CHANNEL_ZCULL_BIND || | + | | /dev/nvhost-* || 0x4008480A || NVGPU_IOCTL_CHANNEL_FREE_OBJ_CTX || |
| |- | | |- |
− | | 0xC018480C || NVGPU_IOCTL_CHANNEL_SET_ERROR_NOTIFIER || | + | | /dev/nvhost-* || 0xC010480B || NVGPU_IOCTL_CHANNEL_ZCULL_BIND || |
| |- | | |- |
− | | 0x4004480D || NVGPU_IOCTL_CHANNEL_OPEN || | + | | /dev/nvhost-* || 0xC018480C || NVGPU_IOCTL_CHANNEL_SET_ERROR_NOTIFIER || |
| |- | | |- |
− | | 0x0000480E || NVGPU_IOCTL_CHANNEL_ENABLE || | + | | /dev/nvhost-* || 0x4004480D || NVGPU_IOCTL_CHANNEL_OPEN || |
| |- | | |- |
− | | 0x0000480F || NVGPU_IOCTL_CHANNEL_DISABLE || | + | | /dev/nvhost-* || 0x0000480E || NVGPU_IOCTL_CHANNEL_ENABLE || |
| |- | | |- |
− | | 0x00004810 || NVGPU_IOCTL_CHANNEL_PREEMPT || | + | | /dev/nvhost-* || 0x0000480F || NVGPU_IOCTL_CHANNEL_DISABLE || |
| |- | | |- |
− | | 0x00004811 || NVGPU_IOCTL_CHANNEL_FORCE_RESET || | + | | /dev/nvhost-* || 0x00004810 || NVGPU_IOCTL_CHANNEL_PREEMPT || |
| |- | | |- |
− | | 0x40084812 || NVGPU_IOCTL_CHANNEL_EVENTS_CTRL || | + | | /dev/nvhost-* || 0x00004811 || NVGPU_IOCTL_CHANNEL_FORCE_RESET || |
| |- | | |- |
− | | 0xC0104813 || NVGPU_IOCTL_CHANNEL_CYCLE_STATS_SNAPSHOT || | + | | /dev/nvhost-* || 0x40084812 || NVGPU_IOCTL_CHANNEL_EVENTS_CTRL || |
| |- | | |- |
− | | 0x80804816 || Unknown || | + | | /dev/nvhost-* || 0xC0104813 || NVGPU_IOCTL_CHANNEL_CYCLE_STATS_SNAPSHOT || |
| |- | | |- |
− | | 0xC0104817 || Unknown || | + | | /dev/nvhost-* || 0x80804816 || || |
| |- | | |- |
− | | 0x40204818 || Unknown || | + | | /dev/nvhost-* || 0xC0104817 || || |
| |- | | |- |
− | | 0xC0184819 || Unknown || | + | | /dev/nvhost-* || 0x40204818 || || |
| |- | | |- |
− | | 0xC020481A || Unknown || | + | | /dev/nvhost-* || 0xC0184819 || || |
| |- | | |- |
| + | | /dev/nvhost-* || 0xC020481A || || |
| |} | | |} |