Changes

3,626 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 84: 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 93: 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 100: 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 308: 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 336: Line 345:  
     __in u8  kind;
 
     __in u8  kind;
 
     u8      pad[7];
 
     u8      pad[7];
     __in u64 addr;
+
     __inout u64 addr;
 
   };
 
   };
   Line 377: 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 435: 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 481: Line 489:  
! Value || Direction || Size || Description || Notes
 
! Value || Direction || Size || Description || Notes
 
|-
 
|-
| 0x40010501 || In || 1 || NVDCUTIL_CRC_ENABLE_DISABLE ||
+
| 0x40010501 || In || 1 || NVDCUTIL_SW_HOTPLUG_IN_OUT ||
 
|-
 
|-
| 0x40010502 || In || 1 || NVDCUTIL_VIRTUAL_EDID_ENABLE_DISABLE ||
+
| 0x40010502 || In || 1 || NVDCUTIL_VIRTUAL_EDID_ON_OFF ||
 
|-
 
|-
 
| 0x42040503 || In || 1056 || NVDCUTIL_VIRTUAL_EDID_SET_DATA ||
 
| 0x42040503 || In || 1056 || NVDCUTIL_VIRTUAL_EDID_SET_DATA ||
 
|-
 
|-
 
| 0x803C0504 || Out || 60 || NVDCUTIL_GET_MODE ||
 
| 0x803C0504 || Out || 60 || NVDCUTIL_GET_MODE ||
 +
|-
 +
| 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 ||NVSCHED_CTRL_ENABLE||
+
| 0x00000601 || - || 0 || [[#NVSCHED_CTRL_ENABLE]] ||
 
|-
 
|-
| 0x00000602 || - || 0 ||NVSCHED_CTRL_DISABLE||
+
| 0x00000602 || - || 0 || [[#NVSCHED_CTRL_DISABLE]] ||
 
|-
 
|-
| 0x40180603 || In || 1056 ||NVSCHED_CTRL_ADD_APPLICATION||
+
| 0x40180603 || In || 24 || [[#NVSCHED_CTRL_ADD_APPLICATION]] ||
 
|-
 
|-
| 0x40180604 || In || 60 ||NVSCHED_CTRL_UPDATE_APPLICATION||
+
| 0x40180604 || In || 24 || [[#NVSCHED_CTRL_UPDATE_APPLICATION]] ||
 
|-
 
|-
| 0x40080605 || In || 60 ||NVSCHED_CTRL_REMOVE_APPLICATION||
+
| 0x40080605 || In || 8 || [[#NVSCHED_CTRL_REMOVE_APPLICATION]] ||
 
|-
 
|-
| 0x80080606 || Out || 60 ||NVSCHED_CTRL_GET_ID||
+
| 0x80080606 || Out || 8 || [[#NVSCHED_CTRL_GET_ID]] ||
 
|-
 
|-
| 0x80080607 || Out || 60 ||NVSCHED_CTRL_ADD_RUNLIST||
+
| 0x80080607 || Out || 8 || [[#NVSCHED_CTRL_ADD_RUNLIST]] ||
 
|-
 
|-
| 0x40180608 || In || 24 ||NVSCHED_CTRL_UPDATE_RUNLIST||
+
| 0x40180608 || In || 24 || [[#NVSCHED_CTRL_UPDATE_RUNLIST]] ||
 
|-
 
|-
| 0x40100609 || In || 16 ||NVSCHED_CTRL_LINK_RUNLIST||
+
| 0x40100609 || In || 16 || [[#NVSCHED_CTRL_LINK_RUNLIST]] ||
 
|-
 
|-
| 0x4010060A || In || 16 ||NVSCHED_CTRL_UNLINK_RUNLIST||
+
| 0x4010060A || In || 16 || [[#NVSCHED_CTRL_UNLINK_RUNLIST]] ||
 
|-
 
|-
| 0x4008060B || In || 8 ||NVSCHED_CTRL_REMOVE_RUNLIST||
+
| 0x4008060B || In || 8 || [[#NVSCHED_CTRL_REMOVE_RUNLIST]] ||
 
|-
 
|-
| 0x8001060C || Out || 1 ||NVSCHED_CTRL_HAS_OVERRUN_EVENT||
+
| 0x8001060C || Out || 1 || [[#NVSCHED_CTRL_HAS_OVERRUN_EVENT]] ||
 
|-
 
|-
| 0x8010060D || Out || 16 || ||
+
| 0x8010060D || Out || 16 || [[#NVSCHED_CTRL_GET_NEXT_OVERRUN_EVENT]] ||
 
|-
 
|-
| 0x400C060E || In || 12 ||NVSCHED_CTRL_PUT_CONDUCTOR_FLIP_FENCE||
+
| 0x400C060E || In || 12 || [[#NVSCHED_CTRL_PUT_CONDUCTOR_FLIP_FENCE]] ||
 
|-
 
|-
| 0x4008060F || In || 8 ||NVSCHED_CTRL_DETACH_APPLICATION||
+
| 0x4008060F || In || 8 || [[#NVSCHED_CTRL_DETACH_APPLICATION]] ||
 
|-
 
|-
 
| 0x40100610 || In || 16 || ||
 
| 0x40100610 || In || 16 || ||
Line 530: 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 ==
Line 537: Line 659:  
! 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 594: 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 711: 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 724: 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 731: 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 919: Line 1,043:  
| 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 || Seen on 1.0.0. Stubbed; does a debug print and returns 0.
 
|-
 
|-
| 0x40040007 || 4 || || Seen on 1.0.0. Sets a u32 based on input.
+
| 0x40040007 || 4 || NVHOST_IOCTL_CHANNEL_SET_SUBMIT_TIMEOUT || Seen on 1.0.0.
 
|-
 
|-
 
| 0x40080008 || 8 || NVHOST_IOCTL_CHANNEL_SET_CLK_RATE || Seen on 1.0.0.
 
| 0x40080008 || 8 || NVHOST_IOCTL_CHANNEL_SET_CLK_RATE || Seen on 1.0.0.
 
|-
 
|-
| 0xC0??0009 || Variable || NVHOST_IOCTL_CHANNEL_MAP_BUFFER || Seen on 1.0.0.
+
| 0xC0??0009 || Variable || NVHOST_IOCTL_CHANNEL_MAP_CMD_BUFFER || Seen on 1.0.0.
 
|-
 
|-
| 0xC0??000A || Variable || NVHOST_IOCTL_CHANNEL_UNMAP_BUFFER || Seen on 1.0.0.
+
| 0xC0??000A || Variable || NVHOST_IOCTL_CHANNEL_UNMAP_CMD_BUFFER || Seen on 1.0.0.
 
|-
 
|-
 
| 0x00000013 || 0 || || Seen on 1.0.0. This one sets a u32, and bool based on input.
 
| 0x00000013 || 0 || || Seen on 1.0.0. This one sets a u32, and bool based on input.
Line 975: Line 1,099:  
| 0xC020481A || 32 || [[#NVGPU_IOCTL_CHANNEL_ALLOC_GPFIFO_EX2]] || Seen on 1.0.0.
 
| 0xC020481A || 32 || [[#NVGPU_IOCTL_CHANNEL_ALLOC_GPFIFO_EX2]] || Seen on 1.0.0.
 
|-
 
|-
| 0xC018481B || 24 || (uses Ioctl2) ||
+
| 0xC018481B || 24 || || Uses Ioctl2.
 
|-
 
|-
| 0xC018481C || 24 || (uses Ioctl2) ||
+
| 0xC018481C || 24 || || Uses Ioctl2.
 
|-
 
|-
 
|- style="border-top: double"
 
|- style="border-top: double"
Line 1,132: 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,153: Line 1,278:  
|-
 
|-
 
| 2 || [[#ReadLog]]
 
| 2 || [[#ReadLog]]
 +
|-
 +
| 3 ||
 +
|-
 +
| 4 ||
 
|}
 
|}
   Line 1,163: 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 =