Changes

Jump to navigation Jump to search
6,014 bytes added ,  20:08, 16 May 2019
Line 30: Line 30:  
| 6 || [[#GetStatus]]
 
| 6 || [[#GetStatus]]
 
|-
 
|-
| 7 || [[#ForceSetClientPID]]
+
| 7 || [[#SetAruid]]
 
|-
 
|-
| 8 || [[#SetClientPID]]
+
| 8 || [[#SetAruidByPID]]
 
|-
 
|-
 
| 9 || [[#DumpGraphicsMemoryInfo]]
 
| 9 || [[#DumpGraphicsMemoryInfo]]
 
|-
 
|-
| 10 || [3.0.0+]
+
| 10 || [3.0.0+] [[#InitializeDevtools]]
 
|-
 
|-
 
| 11 || [3.0.0+] [[#Ioctl2]]
 
| 11 || [3.0.0+] [[#Ioctl2]]
Line 42: Line 42:  
| 12 || [3.0.0+] [[#Ioctl3]]
 
| 12 || [3.0.0+] [[#Ioctl3]]
 
|-
 
|-
| 13 || [3.0.0+]
+
| 13 || [3.0.0+] [[#FinishInitialize]]
 
|}
 
|}
   Line 63: Line 63:  
== QueryEvent ==
 
== QueryEvent ==
 
Takes two input u32s ('''fd''' and '''event_id'''), with the second word immediately after the first one. Returns an output u32 ('''error_code''') and a copy-handle ('''event_handle''').
 
Takes two input u32s ('''fd''' and '''event_id'''), with the second word immediately after the first one. Returns an output u32 ('''error_code''') and a copy-handle ('''event_handle''').
 +
 +
QueryEvent is only supported on (and implemented differently on):
 +
* /dev/nvhost-gpu
 +
** 1: SmException_BptIntReport
 +
** 2: SmException_BptPauseReport
 +
** 3: ErrorNotifierEvent
 +
* /dev/nvhost-ctrl: Used to get events for SyncPts.
 +
** If bit31-28 is 1, then lower 16-bits contain event_slot, bit27-16 contain syncpt_number.
 +
** If bit31-28 is 0, then lower 4-bits contain event_slot, bit31-4 contains syncpt_number.
 +
* /dev/nvhost-ctrl-gpu
 +
** 1: Returns error_event_handle.
 +
** 2: Returns unknown event.
 +
* /dev/nvhost-dbg-gpu
 +
** Ignores event_id.
    
== MapSharedMem ==
 
== MapSharedMem ==
Line 70: Line 84:  
Takes no input. Returns 0x10-bytes and an output u32 ('''error_code''').
 
Takes no input. Returns 0x10-bytes and an output u32 ('''error_code''').
   −
== ForceSetClientPID ==
+
== SetAruid ==
 
Takes an input u64 which must [[IPC_Marshalling|match]] the user-process PID ([[AM_services|AppletResourceUserId]]). Returns an output u32 ('''error_code''').
 
Takes an input u64 which must [[IPC_Marshalling|match]] the user-process PID ([[AM_services|AppletResourceUserId]]). Returns an output u32 ('''error_code''').
   −
== SetClientPID ==
+
== SetAruidByPID ==
 
Takes a PID-descriptor and an u64 which must [[IPC_Marshalling|match]] the user-process PID ([[AM_services|AppletResourceUserId]]). Returns an output u32 ('''error_code''').
 
Takes a PID-descriptor and an u64 which must [[IPC_Marshalling|match]] the user-process PID ([[AM_services|AppletResourceUserId]]). Returns an output u32 ('''error_code''').
   Line 79: Line 93:  
No input or output. Does nothing.
 
No input or output. Does nothing.
   −
== Cmd10 ==
+
== InitializeDevtools ==
 
Takes a copy-handle and an input u32. Returns an output u32 ('''error_code''').
 
Takes a copy-handle and an input u32. Returns an output u32 ('''error_code''').
   Line 86: Line 100:     
== Ioctl3 ==
 
== Ioctl3 ==
Same input/output as Ioctl2, except cmdhdr_word1 is 0x100B instead of 0xC0B.
+
Takes a type-0x21 buffer, a type-0x22 buffer, another type-0x22 buffer, and two input u32s. Returns an output u32 (error_code).
 +
Cmdhdr_word1 is 0x100B instead of 0xC0B.
   −
== Cmd13 ==
+
== FinishInitialize ==
 
Takes an input u64. No output.
 
Takes an input u64. No output.
 +
 +
This sets a boolean value based on the input u64 and the value of the "nv!nv_graphics_firmware_memory_margin" system configuration, but only for "nvdrv" (the other services default to false).
    
Official user-processes starting with 3.0.0 now use this at the end of nvdrv service init with value 0x1.
 
Official user-processes starting with 3.0.0 now use this at the end of nvdrv service init with value 0x1.
Line 294: Line 311:  
|-
 
|-
 
| 0x00000111 || - || 0 || || Returns NotSupported
 
| 0x00000111 || - || 0 || || Returns NotSupported
 +
|-
 +
| 0x40100112 || In || 16 || NVMAP_IOC_EXPORT_FOR_ARUID ||
 +
|-
 +
| 0x40100113 || In || 16 || NVMAP_IOC_IS_OWNED_BY_ARUID ||
 +
|-
 +
| 0x40100114 || In || 16 || NVMAP_IOC_REMOVE_EXPORT_FOR_ARUID ||
 
|}
 
|}
   Line 322: Line 345:  
     __in u8  kind;
 
     __in u8  kind;
 
     u8      pad[7];
 
     u8      pad[7];
     __in u64 addr;
+
     __inout u64 addr;
 
   };
 
   };
   Line 363: Line 386:  
| 0xC1100214 || Inout || 272 || TEGRA_DC_EXT_CONTROL_GET_OUTPUT_EDID ||
 
| 0xC1100214 || Inout || 272 || TEGRA_DC_EXT_CONTROL_GET_OUTPUT_EDID ||
 
|-
 
|-
| 0xC0040216 || Inout || 4 || TEGRA_DC_EXT_CONTROL_SET_EVENT0 ||
+
| 0xC0040216 || Inout || 4 || TEGRA_DC_EXT_CONTROL_GET_EXT_HPD_IN_EVENT ||
 
|-
 
|-
| 0xC0040217 || Inout || 4 || TEGRA_DC_EXT_CONTROL_SET_EVENT1 ||
+
| 0xC0040217 || Inout || 4 || TEGRA_DC_EXT_CONTROL_GET_EXT_HPD_OUT_EVENT ||
 
|-
 
|-
| 0xC0100218 || Inout || 16 || TEGRA_DC_EXT_CONTROL_SET_EVENT2 ||
+
| 0xC0100218 || Inout || 16 || TEGRA_DC_EXT_CONTROL_GET_VBLANK_HEAD0_EVENT ||
 
|-
 
|-
| 0xC0100219 || Inout || 16 || TEGRA_DC_EXT_CONTROL_SET_EVENT3 ||
+
| 0xC0100219 || Inout || 16 || TEGRA_DC_EXT_CONTROL_GET_VBLANK_HEAD1_EVENT ||
|-
  −
| 0xC0040220 || Inout || 4 || TEGRA_DC_EXT_CONTROL_SET_EVENT4 ||
   
|-
 
|-
 +
| 0xC0040220 || Inout || 4 || TEGRA_DC_EXT_CONTROL_GET_UNK_EVENT ||
 
|}
 
|}
   Line 421: Line 443:  
| 0x403C021C || In || 60 || TEGRA_DC_EXT_SET_MODE2 ||
 
| 0x403C021C || In || 60 || TEGRA_DC_EXT_SET_MODE2 ||
 
|-
 
|-
| 0xC03C021D || Inout || 60 || TEGRA_DC_EXT_VALIDATE_MODE2 ||
+
| 0xC03C021D || Inout || 60 || TEGRA_DC_EXT_VALIDATE_MODE2 ||
 
|-
 
|-
 
| 0xEF20021E || Inout || 12064 || TEGRA_DC_EXT_GET_MODE_DB2 ||
 
| 0xEF20021E || Inout || 12064 || TEGRA_DC_EXT_GET_MODE_DB2 ||
Line 467: Line 489:  
! Value || Direction || Size || Description || Notes
 
! Value || Direction || Size || Description || Notes
 
|-
 
|-
| 0x40010501 || In || 1 || ||
+
| 0x40010501 || In || 1 || NVDCUTIL_SW_HOTPLUG_IN_OUT ||
 +
|-
 +
| 0x40010502 || In || 1 || NVDCUTIL_VIRTUAL_EDID_ON_OFF ||
 
|-
 
|-
| 0x40010502 || In || 1 || ||
+
| 0x42040503 || In || 1056 || NVDCUTIL_VIRTUAL_EDID_SET_DATA ||
 
|-
 
|-
| 0x42040503 || In || 1056 || ||
+
| 0x803C0504 || Out || 60 || NVDCUTIL_GET_MODE ||
 
|-
 
|-
| 0x803C0504 || Out || 60 || NVDCUTIL_DISP_IOCTL_GET_DISPLAY_INFO ||
+
| 0x40010505 || In || 1 || NVDCUTIL_TELEMETRY_TEST_ON_OFF ||
 
|-
 
|-
 
|}
 
|}
    
== /dev/nvsched-ctrl ==
 
== /dev/nvsched-ctrl ==
 +
This is a customized scheduler device.
 +
 +
The way this device is exposed and configured is exclusive to the Switch, since other sources don't have an actual interface for the scheduler.
 +
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
! Value || Direction || Size || Description || Notes
 
! Value || Direction || Size || Description || Notes
 
|-
 
|-
| 0x00000601 || - || 0 || ||
+
| 0x00000601 || - || 0 || [[#NVSCHED_CTRL_ENABLE]] ||
 
|-
 
|-
| 0x00000602 || - || 0 || ||
+
| 0x00000602 || - || 0 || [[#NVSCHED_CTRL_DISABLE]] ||
 
|-
 
|-
| 0x40180603 || In || 1056 || ||
+
| 0x40180603 || In || 24 || [[#NVSCHED_CTRL_ADD_APPLICATION]] ||
 
|-
 
|-
| 0x40180604 || In || 60 || ||
+
| 0x40180604 || In || 24 || [[#NVSCHED_CTRL_UPDATE_APPLICATION]] ||
 
|-
 
|-
| 0x40080605 || In || 60 || ||
+
| 0x40080605 || In || 8 || [[#NVSCHED_CTRL_REMOVE_APPLICATION]] ||
 
|-
 
|-
| 0x80080606 || Out || 60 || ||
+
| 0x80080606 || Out || 8 || [[#NVSCHED_CTRL_GET_ID]] ||
 
|-
 
|-
| 0x80080607 || Out || 60 || ||
+
| 0x80080607 || Out || 8 || [[#NVSCHED_CTRL_ADD_RUNLIST]] ||
 
|-
 
|-
| 0x40180608 || In || 24 || ||
+
| 0x40180608 || In || 24 || [[#NVSCHED_CTRL_UPDATE_RUNLIST]] ||
 
|-
 
|-
| 0x40100609 || In || 16 || ||
+
| 0x40100609 || In || 16 || [[#NVSCHED_CTRL_LINK_RUNLIST]] ||
 
|-
 
|-
| 0x4010060A || In || 16 || ||
+
| 0x4010060A || In || 16 || [[#NVSCHED_CTRL_UNLINK_RUNLIST]] ||
 
|-
 
|-
| 0x4008060B || In || 8 || ||
+
| 0x4008060B || In || 8 || [[#NVSCHED_CTRL_REMOVE_RUNLIST]] ||
 
|-
 
|-
| 0x8001060C || Out || 1 || ||
+
| 0x8001060C || Out || 1 || [[#NVSCHED_CTRL_HAS_OVERRUN_EVENT]] ||
 
|-
 
|-
| 0x8010060D || Out || 16 || ||
+
| 0x8010060D || Out || 16 || [[#NVSCHED_CTRL_GET_NEXT_OVERRUN_EVENT]] ||
 
|-
 
|-
| 0x400C060E || In || 12 || ||
+
| 0x400C060E || In || 12 || [[#NVSCHED_CTRL_PUT_CONDUCTOR_FLIP_FENCE]] ||
 
|-
 
|-
| 0x4008060F || In || 8 || ||
+
| 0x4008060F || In || 8 || [[#NVSCHED_CTRL_DETACH_APPLICATION]] ||
 
|-
 
|-
 
| 0x40100610 || In || 16 || ||
 
| 0x40100610 || In || 16 || ||
Line 516: Line 544:  
|-
 
|-
 
|}
 
|}
 +
 +
=== NVSCHED_CTRL_ENABLE ===
 +
Enables the scheduler.
 +
 +
=== NVSCHED_CTRL_DISABLE ===
 +
Disables the scheduler.
 +
 +
=== NVSCHED_CTRL_ADD_APPLICATION ===
 +
Adds a new application to the scheduler.
 +
 +
  struct {
 +
    __in u64 application_id;
 +
    __in u64 priority;
 +
    __in u64 timeslice;
 +
  };
 +
 +
=== NVSCHED_CTRL_UPDATE_APPLICATION ===
 +
Updates the application parameters in the scheduler.
 +
 +
  struct {
 +
    __in u64 application_id;
 +
    __in u64 priority;
 +
    __in u64 timeslice;
 +
  };
 +
 +
=== NVSCHED_CTRL_REMOVE_APPLICATION ===
 +
Removes the application from the scheduler.
 +
 +
  struct {
 +
    __in u64 application_id;
 +
  };
 +
 +
=== NVSCHED_CTRL_GET_ID ===
 +
Returns the ID of the last scheduled object.
 +
 +
  struct {
 +
    __out u64 id;
 +
  };
 +
 +
=== NVSCHED_CTRL_ADD_RUNLIST ===
 +
Creates a new runlist and returns it's ID.
 +
 +
  struct {
 +
    __out u64 runlist_id;
 +
  };
 +
 +
=== NVSCHED_CTRL_UPDATE_RUNLIST ===
 +
Updates the runlist parameters in the scheduler.
 +
 +
  struct {
 +
    __in u64 runlist_id;
 +
    __in u64 priority;
 +
    __in u64 timeslice;
 +
  };
 +
 +
=== NVSCHED_CTRL_LINK_RUNLIST ===
 +
Links a runlist to a given application in the scheduler.
 +
 +
  struct {
 +
    __in u64 runlist_id;
 +
    __in u64 application_id;
 +
  };
 +
 +
=== NVSCHED_CTRL_UNLINK_RUNLIST ===
 +
Unlinks a runlist from a given application in the scheduler.
 +
 +
  struct {
 +
    __in u64 runlist_id;
 +
    __in u64 application_id;
 +
  };
 +
 +
=== NVSCHED_CTRL_REMOVE_RUNLIST ===
 +
Removes the runlist from the scheduler.
 +
 +
  struct {
 +
    __in u64 runlist_id;
 +
  };
 +
 +
=== NVSCHED_CTRL_HAS_OVERRUN_EVENT ===
 +
Returns a boolean to tell if the scheduler has an overrun event or not.
 +
 +
  struct {
 +
    __out u8 has_overrun;
 +
  };
 +
 +
=== NVSCHED_CTRL_GET_NEXT_OVERRUN_EVENT ===
 +
Returns the overrun event's data from the scheduler.
 +
 +
  struct {
 +
    __out u64 runlist_id;
 +
    __out u64 debt;
 +
  };
 +
 +
=== NVSCHED_CTRL_PUT_CONDUCTOR_FLIP_FENCE ===
 +
Installs a fence swap event?
 +
 +
  struct {
 +
    __in u32 fence_id;
 +
    __in u32 fence_value;
 +
    __in u32 swap_interval;
 +
  };
 +
 +
=== NVSCHED_CTRL_DETACH_APPLICATION ===
 +
Places the given application in detached state.
 +
 +
  struct {
 +
    __in u64 application_id;
 +
  };
    
== /dev/nverpt-ctrl ==
 
== /dev/nverpt-ctrl ==
Added in firmware version 4.0.0.
+
Added in firmware version 3.0.0.
    
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
! Value || Direction || Size || Description || Notes
 
! Value || Direction || Size || Description || Notes
 
|-
 
|-
| 0xC1280701 || Inout || 296 || ||
+
| 0xC1280701 || Inout || 296 || NVERPT_TELEMETRY_SUBMIT_DATA ||
 
|-
 
|-
| 0xCF580702 || Inout || 3928 || ||
+
| 0xCF580702 || Inout || 3928 || NVERPT_TELEMETRY_SUBMIT_DATA_EX ||
 
|-
 
|-
 
|}
 
|}
Line 580: Line 716:     
=== NVGPU_AS_IOCTL_FREE_SPACE ===
 
=== NVGPU_AS_IOCTL_FREE_SPACE ===
 +
This one frees pages from the device address space.
 +
 
   struct {
 
   struct {
 
     __in u64 offset;
 
     __in u64 offset;
Line 604: Line 742:  
=== NVGPU_AS_IOCTL_MAP_BUFFER_EX ===
 
=== NVGPU_AS_IOCTL_MAP_BUFFER_EX ===
 
Map a memory region in the device address space. Identical to Linux driver pretty much.
 
Map a memory region in the device address space. Identical to Linux driver pretty much.
 +
 +
Unaligned size will cause a [[#Panic]].
    
On success, the mapped memory region is locked by having [[SVC#MemoryState]] bit34 set.
 
On success, the mapped memory region is locked by having [[SVC#MemoryState]] bit34 set.
Line 695: Line 835:  
|-
 
|-
 
| 0x40044405 || In || 4 || NVGPU_DBG_GPU_IOCTL_SMPC_CTXSW_MODE ||
 
| 0x40044405 || In || 4 || NVGPU_DBG_GPU_IOCTL_SMPC_CTXSW_MODE ||
 +
|-
 +
| 0x40044406 || In || 4 || NVGPU_DBG_GPU_IOCTL_SUSPEND_RESUME_SM ||
 
|-
 
|-
 
| 0xC0184407 || Inout || 24 || NVGPU_DBG_GPU_IOCTL_PERFBUF_MAP ||
 
| 0xC0184407 || Inout || 24 || NVGPU_DBG_GPU_IOCTL_PERFBUF_MAP ||
Line 708: Line 850:  
| 0x8004440C || Out || 4 || NVGPU_DBG_GPU_IOCTL_GET_GR_CONTEXT_SIZE ||
 
| 0x8004440C || Out || 4 || NVGPU_DBG_GPU_IOCTL_GET_GR_CONTEXT_SIZE ||
 
|-
 
|-
| 0x0000440D || None || 0 || NVGPU_DBG_GPU_IOCTL_GET_GR_CONTEXT (uses Ioctl3) ||
+
| 0x0000440D || None || 0 || NVGPU_DBG_GPU_IOCTL_GET_GR_CONTEXT || Uses Ioctl3.
 
|-
 
|-
 
|}
 
|}
Line 715: Line 857:  
Returns [[#Errors|NotSupported]] on Open unless nn::settings::detail::GetDebugModeFlag is set.
 
Returns [[#Errors|NotSupported]] on Open unless nn::settings::detail::GetDebugModeFlag is set.
   −
{| class="wikitable" border="1"
+
This device is identical to [[#/dev/nvhost-dbg-gpu|/dev/nvhost-dbg-gpu]].
! Value || Direction || Size || Description || Notes
  −
|}
      
== /dev/nvhost-ctrl-gpu ==
 
== /dev/nvhost-ctrl-gpu ==
Line 738: Line 878:  
|-
 
|-
 
| 0x40084707 || In || 8 || [[#NVGPU_GPU_IOCTL_FLUSH_L2]] ||
 
| 0x40084707 || In || 8 || [[#NVGPU_GPU_IOCTL_FLUSH_L2]] ||
 +
|-
 +
| 0x4008470D || In || 8 || NVGPU_GPU_IOCTL_INVAL_ICACHE ||
 
|-
 
|-
 
| 0x4008470E || In || 8 || NVGPU_GPU_IOCTL_SET_MMUDEBUG_MODE ||
 
| 0x4008470E || In || 8 || NVGPU_GPU_IOCTL_SET_MMUDEBUG_MODE ||
Line 771: Line 913:  
   };
 
   };
   −
=== NVGPU_GPU_IOCTL_ZCULL_GET_CTX_SIZE ===
+
=== NVGPU_GPU_IOCTL_ZCULL_GET_INFO ===
 
Returns GPU's ZCULL information. Identical to Linux driver.
 
Returns GPU's ZCULL information. Identical to Linux driver.
   Line 893: Line 1,035:  
! Value || Size || Description || Notes
 
! Value || Size || Description || Notes
 
|-
 
|-
| 0xC0??0001 || Variable || NVHOST_IOCTL_CHANNEL_SUBMIT ||
+
| 0xC0??0001 || Variable || NVHOST_IOCTL_CHANNEL_SUBMIT || Seen on 1.0.0.
 +
|-
 +
| 0xC0080002 || 8 || NVHOST_IOCTL_CHANNEL_GET_SYNCPOINT || Seen on 1.0.0.
 
|-
 
|-
| 0xC0080002 || 8 || NVHOST_IOCTL_CHANNEL_GET_SYNCPOINT ||
+
| 0xC0080003 || 8 || NVHOST_IOCTL_CHANNEL_GET_WAITBASE || Seen on 1.0.0.
 
|-
 
|-
| 0xC0080003 || 8 || NVHOST_IOCTL_CHANNEL_GET_WAITBASE ||
+
| 0xC0080004 || 8 || NVHOST_IOCTL_CHANNEL_SET_TIMEOUT_EX || Seen on 1.0.0. Stubbed; does a debug print and returns 0.
 
|-
 
|-
| 0xC0080004 || 8 || NVHOST_IOCTL_CHANNEL_SET_TIMEOUT_EX ||
+
| 0x40040007 || 4 || NVHOST_IOCTL_CHANNEL_SET_SUBMIT_TIMEOUT || Seen on 1.0.0.
 
|-
 
|-
| 0x40040007 || 4 || ||
+
| 0x40080008 || 8 || NVHOST_IOCTL_CHANNEL_SET_CLK_RATE || Seen on 1.0.0.
 
|-
 
|-
| 0x40080008 || 8 || NVHOST_IOCTL_CHANNEL_SET_CLK_RATE ||
+
| 0xC0??0009 || Variable || NVHOST_IOCTL_CHANNEL_MAP_CMD_BUFFER || Seen on 1.0.0.
 
|-
 
|-
| 0xC0??0009 || Variable || NVHOST_IOCTL_CHANNEL_MAP_BUFFER ||
+
| 0xC0??000A || Variable || NVHOST_IOCTL_CHANNEL_UNMAP_CMD_BUFFER || Seen on 1.0.0.
 
|-
 
|-
| 0xC0??000A || Variable || NVHOST_IOCTL_CHANNEL_UNMAP_BUFFER ||
+
| 0x00000013 || 0 || || Seen on 1.0.0. This one sets a u32, and bool based on input.
 
|-
 
|-
| 0x00000013 || 0 || ||
+
| 0xC0080014 || || NVHOST_IOCTL_CHANNEL_GET_CLK_RATE || Seen on 1.0.0.
 
|- style="border-top: double"
 
|- style="border-top: double"
| 0x40044801 || 4 || [[#NVGPU_IOCTL_CHANNEL_SET_NVMAP_FD]] ||
+
| 0x40044801 || 4 || [[#NVGPU_IOCTL_CHANNEL_SET_NVMAP_FD]] || Seen on 1.0.0.
 +
|-
 +
| 0x40044803 || 4 || NVGPU_IOCTL_CHANNEL_SET_TIMEOUT || Seen on 1.0.0.
 
|-
 
|-
| 0x40044803 || 4 || NVGPU_IOCTL_CHANNEL_SET_TIMEOUT ||
+
| 0x40084805 || 8 || [[#NVGPU_IOCTL_CHANNEL_ALLOC_GPFIFO]] || Seen on 1.0.0.
 
|-
 
|-
| 0x40084805 || 8 || [[#NVGPU_IOCTL_CHANNEL_ALLOC_GPFIFO]] ||
+
| 0x40184806 || || NVGPU_IOCTL_CHANNEL_WAIT || Seen on 1.0.0.
 
|-
 
|-
| 0xC0044807 || 4 || NVGPU_IOCTL_CHANNEL_CYCLE_STATS ||
+
| 0xC0044807 || 4 || NVGPU_IOCTL_CHANNEL_CYCLE_STATS || Seen on 1.0.0.
 
|-
 
|-
| 0xC0??4808 || Variable || [[#NVGPU_IOCTL_CHANNEL_SUBMIT_GPFIFO]] ||
+
| 0xC0??4808 || Variable || [[#NVGPU_IOCTL_CHANNEL_SUBMIT_GPFIFO]] || Seen on 1.0.0.
 
|-
 
|-
| 0xC0104809 || 16 || [[#NVGPU_IOCTL_CHANNEL_ALLOC_OBJ_CTX]] ||
+
| 0xC0104809 || 16 || [[#NVGPU_IOCTL_CHANNEL_ALLOC_OBJ_CTX]] || Seen on 1.0.0.
 
|-
 
|-
| 0xC010480B || 16 || [[#NVGPU_IOCTL_CHANNEL_ZCULL_BIND]] ||
+
| 0x4008480A || || NVHOST_IOCTL_CHANNEL_FREE_OBJ_CTX || Seen on 1.0.0.
 
|-
 
|-
| 0xC018480C || 24 || [[#NVGPU_IOCTL_CHANNEL_SET_ERROR_NOTIFIER]] ||
+
| 0xC010480B || 16 || [[#NVGPU_IOCTL_CHANNEL_ZCULL_BIND]] || Seen on 1.0.0.
 
|-
 
|-
| 0x4004480D || 4 || [[#NVGPU_IOCTL_CHANNEL_SET_PRIORITY]] ||
+
| 0xC018480C || 24 || [[#NVGPU_IOCTL_CHANNEL_SET_ERROR_NOTIFIER]] || Seen on 1.0.0.
 
|-
 
|-
| 0x0000480E || 0 || [[#NVGPU_IOCTL_CHANNEL_ENABLE]] ||
+
| 0x4004480D || 4 || [[#NVGPU_IOCTL_CHANNEL_SET_PRIORITY]] || Seen on 1.0.0.
 
|-
 
|-
| 0x0000480F || 0 || [[#NVGPU_IOCTL_CHANNEL_DISABLE]] ||
+
| 0x0000480E || 0 || [[#NVGPU_IOCTL_CHANNEL_ENABLE]] || Seen on 1.0.0.
 
|-
 
|-
| 0x00004810 || 0 || [[#NVGPU_IOCTL_CHANNEL_PREEMPT]] ||
+
| 0x0000480F || 0 || [[#NVGPU_IOCTL_CHANNEL_DISABLE]] || Seen on 1.0.0.
 
|-
 
|-
| 0x00004811 || 0 || [[#NVGPU_IOCTL_CHANNEL_FORCE_RESET]] ||
+
| 0x00004810 || 0 || [[#NVGPU_IOCTL_CHANNEL_PREEMPT]] || Seen on 1.0.0.
 
|-
 
|-
| 0x40084812 || 8 || [[#NVGPU_IOCTL_CHANNEL_EVENT_ID_CONTROL]] ||
+
| 0x00004811 || 0 || [[#NVGPU_IOCTL_CHANNEL_FORCE_RESET]] || Seen on 1.0.0.
 
|-
 
|-
| 0xC0104813 || 16 || NVGPU_IOCTL_CHANNEL_CYCLE_STATS_SNAPSHOT ||
+
| 0x40084812 || 8 || [[#NVGPU_IOCTL_CHANNEL_EVENT_ID_CONTROL]] || Seen on 1.0.0.
 
|-
 
|-
| 0x80804816 || 128 || NVGPU_IOCTL_CHANNEL_GET_ERROR_INFO ||
+
| 0xC0104813 || 16 || NVGPU_IOCTL_CHANNEL_CYCLE_STATS_SNAPSHOT || Seen on 1.0.0.
 
|-
 
|-
| 0xC0104817 || 16 || [[#NVGPU_IOCTL_CHANNEL_GET_ERROR_NOTIFICATION]] ||
+
| 0x80804816 || 128 || NVGPU_IOCTL_CHANNEL_GET_ERROR_INFO || Seen on 1.0.0.
 
|-
 
|-
| 0x40204818 || 32 || [[#NVGPU_IOCTL_CHANNEL_ALLOC_GPFIFO_EX]] ||
+
| 0xC0104817 || 16 || [[#NVGPU_IOCTL_CHANNEL_GET_ERROR_NOTIFICATION]] || Seen on 1.0.0.
 
|-
 
|-
| 0xC0??4819 || Variable || [[#NVGPU_IOCTL_CHANNEL_SUBMIT_GPFIFO_RETRY]] ||
+
| 0x40204818 || 32 || [[#NVGPU_IOCTL_CHANNEL_ALLOC_GPFIFO_EX]] || Seen on 1.0.0.
 
|-
 
|-
| 0xC020481A || 32 || [[#NVGPU_IOCTL_CHANNEL_ALLOC_GPFIFO_EX2]] ||
+
| 0xC0??4819 || Variable || [[#NVGPU_IOCTL_CHANNEL_SUBMIT_GPFIFO_RETRY]] || Seen on 1.0.0.
 
|-
 
|-
| 0xC018481B || 24 || (uses Ioctl2) ||
+
| 0xC020481A || 32 || [[#NVGPU_IOCTL_CHANNEL_ALLOC_GPFIFO_EX2]] || Seen on 1.0.0.
 
|-
 
|-
| 0xC018481C || 24 || (uses Ioctl2) ||
+
| 0xC018481B || 24 ||  || Uses Ioctl2.
 +
|-
 +
| 0xC018481C || 24 || || Uses Ioctl2.
 
|-
 
|-
 
|- style="border-top: double"
 
|- style="border-top: double"
| 0x40084714 || 8 || NVGPU_IOCTL_CHANNEL_SET_USER_DATA || Sets an unknown user context address
+
| 0x40084714 || 8 || NVGPU_IOCTL_CHANNEL_SET_USER_DATA || Sets an unknown user context address. Seen on 1.0.0.
 
|-
 
|-
| 0x80084715 || 8 || NVGPU_IOCTL_CHANNEL_GET_USER_DATA || Gets an unknown user context address
+
| 0x80084715 || 8 || NVGPU_IOCTL_CHANNEL_GET_USER_DATA || Gets an unknown user context address. Seen on 1.0.0.
 
|}
 
|}
    
=== NVGPU_IOCTL_CHANNEL_SET_NVMAP_FD ===
 
=== NVGPU_IOCTL_CHANNEL_SET_NVMAP_FD ===
 
Binds a nvmap object to this channel. Identical to Linux driver.
 
Binds a nvmap object to this channel. Identical to Linux driver.
 +
 +
This ioctl is a no-op in the Linux driver, not sure about Switch?
    
   struct {
 
   struct {
Line 980: Line 1,130:     
   struct fence {
 
   struct fence {
     u32 id;
+
     u32 syncpt_id;
     u32 value;
+
     u32 syncpt_value;
 
   };
 
   };
 
    
 
    
 
   struct gpfifo_entry {
 
   struct gpfifo_entry {
     u32 entry0;                           // gpu_va_lo
+
     u64 entry;                           // gpu_iova | (unk_2bits << 40) | (size << 42) | (unk_flag << 63)
    u32 entry1;                          // gpu_va_hi | (unk_0x02 << 0x08) | (size << 0x0A) | (unk_0x01 << 0x1F)
   
   };
 
   };
 
    
 
    
 
   struct {
 
   struct {
     __in u64 gpfifo;                      // (ignored) pointer to gpfifo fence structs
+
     __in   u64 gpfifo;                      // (ignored) pointer to gpfifo fence structs
     __in u32 num_entries;                // number of fence objects being submitted
+
     __in   u32 num_entries;                // number of fence objects being submitted
     __in u32 flags;
+
     __in   u32 flags;
     __out struct fence fence_out;        // returned new fence object for others to wait on
+
     __inout struct fence fence_out;        // returned new fence object for others to wait on
     __in struct gpfifo_entry entries[];  // depends on num_entries
+
     __in   struct gpfifo_entry entries[];  // depends on num_entries
 
   };
 
   };
    
=== NVGPU_IOCTL_CHANNEL_ALLOC_OBJ_CTX ===
 
=== NVGPU_IOCTL_CHANNEL_ALLOC_OBJ_CTX ===
 
Allocates a graphics context object. Modified to ignore object's ID.
 
Allocates a graphics context object. Modified to ignore object's ID.
 +
 +
You can only have one object context allocated at a time. You must have bound an address space before using this.
    
   struct {
 
   struct {
 
     __in  u32 class_num;    // 0x902D=2d, 0xB197=3d, 0xB1C0=compute, 0xA140=kepler, 0xB0B5=DMA, 0xB06F=channel_gpfifo
 
     __in  u32 class_num;    // 0x902D=2d, 0xB197=3d, 0xB1C0=compute, 0xA140=kepler, 0xB0B5=DMA, 0xB06F=channel_gpfifo
     __in  u32 flags;
+
     __in  u32 flags;       // bit0: LOCKBOOST_ZERO
 
     __out u64 obj_id;      // (ignored) used for FREE_OBJ_CTX ioctl, which is not supported
 
     __out u64 obj_id;      // (ignored) used for FREE_OBJ_CTX ioctl, which is not supported
 
   };
 
   };
Line 1,016: Line 1,167:     
=== NVGPU_IOCTL_CHANNEL_SET_ERROR_NOTIFIER ===
 
=== NVGPU_IOCTL_CHANNEL_SET_ERROR_NOTIFIER ===
Initializes the error notifier for this channel. Identical to Linux driver.
+
Initializes the error notifier for this channel. Unlike for the Linux kernel, the Switch driver cannot write to an arbitrary userspace buffer. Thus new ioctls have been introduced to fetch the error information rather than using a shared memory buffer.
    
   struct {
 
   struct {
     __in u64 offset;
+
     __in u64 offset; // ignored
     __in u64 size;
+
     __in u64 size;   // ignored
     __in u32 mem;       // nvmap object handle
+
     __in u32 mem;     // must be non-zero to initialize, zero to de-initialize
     __in u32 padding;
+
     __in u32 padding; // ignored
 
   };
 
   };
   Line 1,049: Line 1,200:  
   struct {
 
   struct {
 
     __in u32 cmd;    // 0=disable, 1=enable, 2=clear
 
     __in u32 cmd;    // 0=disable, 1=enable, 2=clear
     __in u32 id;
+
     __in u32 id;     // same id's as for [[#QueryEvent]]
 
   };
 
   };
    
=== NVGPU_IOCTL_CHANNEL_GET_ERROR_NOTIFICATION ===
 
=== NVGPU_IOCTL_CHANNEL_GET_ERROR_NOTIFICATION ===
 
Returns the current error notification caught by the error notifier. Exclusive to the Switch.
 
Returns the current error notification caught by the error notifier. Exclusive to the Switch.
 +
 +
Despite being marked as inout this is all output.
    
   struct {
 
   struct {
     __out   u64 timestamp;    // nanoseconds since Jan. 1, 1970
+
     __out u64 timestamp;    // fetched straight from armGetSystemTick
     __out   u32 info32;      // error code
+
     __out u32 info32;      // error code
     __out   u16 info16;      // additional error info
+
     __out u16 info16;      // additional error info
     __inout u16 status;      // always 0xFFFF
+
     __out u16 status;      // always 0xFFFF
 
   };
 
   };
   −
=== NVGPU_IOCTL_CHANNEL_SUBMIT_GPFIFO_RETRY ===
+
=== NVGPU_IOCTL_CHANNEL_ALLOC_GPFIFO_EX ===
 
Allocates gpfifo entries with additional parameters. Exclusive to the Switch.
 
Allocates gpfifo entries with additional parameters. Exclusive to the Switch.
   Line 1,076: Line 1,229:  
   };
 
   };
   −
=== NVGPU_IOCTL_CHANNEL_SUBMIT_GPFIFO_EX ===
+
=== NVGPU_IOCTL_CHANNEL_SUBMIT_GPFIFO_RETRY ===
 
Submits a gpfifo object (async version). Exclusive to the Switch.
 
Submits a gpfifo object (async version). Exclusive to the Switch.
   Line 1,103: Line 1,256:  
NVIDIA memory profiler (this service is not available on retail units).  
 
NVIDIA memory profiler (this service is not available on retail units).  
 
/dev/nvhost-ctrl sends the ioctl NVHOST_IOCTL_CTRL_GET_CONFIG to check the config "nv!NV_MEMORY_PROFILER". If config_str returns "1", the applications attempts to talk to use nvmemp.
 
/dev/nvhost-ctrl sends the ioctl NVHOST_IOCTL_CTRL_GET_CONFIG to check the config "nv!NV_MEMORY_PROFILER". If config_str returns "1", the applications attempts to talk to use nvmemp.
 +
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
 
! Cmd || Name
 
! Cmd || Name
 
|-
 
|-
| 0 || Cmd0
+
| 0 || Open
 
|-
 
|-
| 1 || Cmd1
+
| 1 || GetPid
 
|}
 
|}
   Line 1,124: Line 1,278:  
|-
 
|-
 
| 2 || [[#ReadLog]]
 
| 2 || [[#ReadLog]]
 +
|-
 +
| 3 ||
 +
|-
 +
| 4 ||
 
|}
 
|}
   Line 1,134: Line 1,292:  
== ReadLog ==
 
== ReadLog ==
 
Takes fd and reads log into a type-6 buffer.
 
Takes fd and reads log into a type-6 buffer.
 +
 +
= nvgem:c =
 +
This is "nv::gemcontrol::INvGemControl".
 +
 +
{| class="wikitable" border="1"
 +
|-
 +
! Cmd || Name
 +
|-
 +
| 0 ||
 +
|-
 +
| 1 ||
 +
|-
 +
| 2 ||
 +
|-
 +
| 3 ||
 +
|-
 +
| 4 ||
 +
|-
 +
| [1.0.0-4.1.0] 5 ||
 +
|-
 +
| 6 ||
 +
|-
 +
| 7 || [3.0.0+]
 +
|}
 +
 +
= nvgem:cd =
 +
This is "nv::gemcoredump::INvGemCoreDump".
 +
 +
{| class="wikitable" border="1"
 +
|-
 +
! Cmd || Name
 +
|-
 +
| 0 ||
 +
|-
 +
| 1 ||
 +
|-
 +
| 2 ||
 +
|-
 +
| 3 || [8.0.0+]
 +
|-
 +
| 4 || [8.0.0+]
 +
|}
    
= Errors =
 
= Errors =

Navigation menu