Difference between revisions of "OpenRM"

From Open-IOV
Jump to navigation Jump to search
 
Line 1: Line 1:
OpenRM refers to the open sourcing of the NVIDIA kernel module for Linux, specifically the RM Core or the internal resource manager.
OpenRM refers to the open sourcing of the NVIDIA kernel module for Linux, specifically the RM Core or the internal resource manager.


Through the open sourced code ([https://github.com/NVIDIA/open-gpu-kernel-modules located here]) we have been able to deduce 7 top level APIs that are being exposed to the Linux developers.
Through the open sourced code ([https://github.com/NVIDIA/open-gpu-kernel-modules located here]) we have been able to deduce 7 top level APIs that are being exposed to the Linux developers.<blockquote>An absence of critical technical documentation has historically slowed growth and adoption of developer ecosystems for GPU virtualization.  


== Interaction With OpenRM ==
This [https://creativecommons.org/licenses/by/4.0/ CC-BY-4.0] licensed content can either be used with attribution, or used as inspiration for new documentation, created by GPU vendors for public commercial distribution as developer documentation.
 
Where possible, this documentation will clearly label dates and versions of observed-but-not-guaranteed behaviour vs. vendor-documented stable interfaces/behaviour with guarantees of forward or backward compatibility.</blockquote>
 
==Interaction With OpenRM==
All of OpenRM is a high scale object oriented abstraction layer for the GPU, all resources are internally classes which have control definitions (methods) on how you can use them. These classes can also represent physical resources or engines.
All of OpenRM is a high scale object oriented abstraction layer for the GPU, all resources are internally classes which have control definitions (methods) on how you can use them. These classes can also represent physical resources or engines.


=== Alloc (Client) ===
===Alloc (Client)===
This is analogous to calling an object constructor in a higher level programming language, such as C#.
This is analogous to calling an object constructor in a higher level programming language, such as C#.


The data for this call requires the following components:
The data for this call requires the following components:


# hRoot - RM Client Id (given by the kernel module for an individual process that is interacting with the kernel module).
#hRoot - RM Client Id (given by the kernel module for an individual process that is interacting with the kernel module).
# hObjectParent - Parent of the resource we are allocating.
#hObjectParent - Parent of the resource we are allocating.
# hObjectNew - New object to allocate.
#hObjectNew - New object to allocate.
# hClass - Class of the object we are dealing with.
#hClass - Class of the object we are dealing with.
# pAllocParams - Pointer to values passed into the constructor call.
#pAllocParams - Pointer to values passed into the constructor call.
# status - Status of the constructor call (did it succeed or fail)
#status - Status of the constructor call (did it succeed or fail)


=== Alloc Memory 64 ===
===Alloc Memory 64===
This creates a CPU's mapping to a resource.
This creates a CPU's mapping to a resource.


The data for this call requires the following components:
The data for this call requires the following components:


# hRoot - RM Client Id (given by the kernel module for an individual process that is interacting with the kernel module).
#hRoot - RM Client Id (given by the kernel module for an individual process that is interacting with the kernel module).
# hObjectParent - Parent of the resource we create the CPU mapping to.
#hObjectParent - Parent of the resource we create the CPU mapping to.
# hObjectNew - Mapping object resource id.
#hObjectNew - Mapping object resource id.
# hClass - Class of the mapped object.
#hClass - Class of the mapped object.
# flags - Flags to use on the mapped object.
#flags - Flags to use on the mapped object.
# pMemory - pointer for the memory to map.
#pMemory - pointer for the memory to map.
# pLimit - Edge of memory map.
#pLimit - Edge of memory map.
# status - Status of the constructor call.
#status - Status of the constructor call.


NOTE: Seems to be deprecated.
NOTE: Seems to be deprecated.


=== Control ===
===Control===
This is a control command which is analogous to calling a method on a class.
This is a control command which is analogous to calling a method on a class.


The data for this call requires the following components:
The data for this call requires the following components:


# hClient - RM Client Id.
#hClient - RM Client Id.
# hObject - Object id.
#hObject - Object id.
# cmd - Method to call.
#cmd - Method to call.
# params - Parameters into this method.
#params - Parameters into this method.
# paramsSize - Size of the params.
#paramsSize - Size of the params.
# status - Status of the control call.
#status - Status of the control call.


NOTE: The control will overwrite the object we pass in over the params pointer.
NOTE: The control will overwrite the object we pass in over the params pointer.


=== Dup Object ===
===Dup Object===
Duplicates the object, or clones the object, which is a deep copy. This procedure can be used across processes in order to produce shared memory.
Duplicates the object, or clones the object, which is a deep copy. This procedure can be used across processes in order to produce shared memory.


The data for this call requires the following components:
The data for this call requires the following components:


# hClient - RM Client Id.
#hClient - RM Client Id.
# hParent - Parent of the object.
#hParent - Parent of the object.
# hObject - Object destination for duplicating.
#hObject - Object destination for duplicating.
# hClientSrc - Client source id.
#hClientSrc - Client source id.
# hObjectSrc - Object source.
#hObjectSrc - Object source.
# flags - Flags to use.
#flags - Flags to use.
# status - Status of the duplication.
#status - Status of the duplication.


=== Free ===
===Free===
Frees an object from the object tree.
Frees an object from the object tree.


The data for this call requires the following components:
The data for this call requires the following components:


# hRoot - Client Id.
#hRoot - Client Id.
# hObjectParent - Parent of the object.
#hObjectParent - Parent of the object.
# hObjectOld - Object to call the destructor on.
#hObjectOld - Object to call the destructor on.
# status - Status of the free.
#status - Status of the free.


=== Vid Heap Control ===
===Vid Heap Control===
TODO: Figure out what this does.
TODO: Figure out what this does.


NOTE: Seems to be deprecated.
NOTE: Seems to be deprecated.


=== Map Memory ===
===Map Memory===
This seems to be the same as alloc memory but seems to be used more often.
This seems to be the same as alloc memory but seems to be used more often.


The data for this call requires the following components:
The data for this call requires the following components:


# hClient - Client Id.
#hClient - Client Id.
# hDevice - Device id.
#hDevice - Device id.
# hMemory - Memory resource.
#hMemory - Memory resource.
# offset - Offset of the memory.
#offset - Offset of the memory.
# length - Length of the memory.
#length - Length of the memory.
# pLinearAddress - Pointer for returned address.
#pLinearAddress - Pointer for returned address.
# status - Status of the map memory.
#status - Status of the map memory.
# flags - Flags to use.
#flags - Flags to use.


=== Unmap Memory ===
===Unmap Memory===
This unmaps the CPU memory mapping from the resource.
This unmaps the CPU memory mapping from the resource.


The data for this call requires the following components:
The data for this call requires the following components:


# hClient - Client Id.
#hClient - Client Id.
# hDevice - Device Id.
#hDevice - Device Id.
# hMemory - Memory Id.
#hMemory - Memory Id.
# pLinearAddress - pointer to virtual address.
#pLinearAddress - pointer to virtual address.
# status - Status of the unmap command.
#status - Status of the unmap command.
# flags - Flags to use.
#flags - Flags to use.


=== Alloc Context DMA 2 ===
===Alloc Context DMA 2===
Allocates a context for DMA.
Allocates a context for DMA.


The data for this call requires the following components:
The data for this call requires the following components:


# hObjectParent - Object parent.
#hObjectParent - Object parent.
# hSubDevice - Sub device to allocate on.
#hSubDevice - Sub device to allocate on.
# hObjectNew - Context id.
#hObjectNew - Context id.
# hClass - Type of class.
#hClass - Type of class.
# flags - Flags to use.
#flags - Flags to use.
# selector - UNKNOWN.
#selector - UNKNOWN.
# hMemory - Handle for Memory resource to DMA map.
#hMemory - Handle for Memory resource to DMA map.
# offset - Offset for the DMA mapping.
#offset - Offset for the DMA mapping.
# limit - Limit of the DMA map.
#limit - Limit of the DMA map.
# status - Status of the allocation.
#status - Status of the allocation.


NOTE: Seems to be deprecated.
NOTE: Seems to be deprecated.


=== Map Memory DMA ===
===Map Memory DMA===
Map a region of memory for DMA access.
Map a region of memory for DMA access.


The data for this call requires the following components:
The data for this call requires the following components:


# hClient - Client Id.
#hClient - Client Id.
# hDevice - Device Id.
#hDevice - Device Id.
# hDma - DMA Id.
#hDma - DMA Id.
# hMemory - Memory Id.
#hMemory - Memory Id.
# offset - Offset of the region.
#offset - Offset of the region.
# limit - Limit of the region.
#limit - Limit of the region.
# flags - flags to use.
#flags - flags to use.
# dmaOffset - Offset of the mapping.
#dmaOffset - Offset of the mapping.
# status - Status of the map Memory DMA.
#status - Status of the map Memory DMA.


=== Un-map Memory DMA ===
===Un-map Memory DMA===
Unmaps a region of memory for DMA access.
Unmaps a region of memory for DMA access.


The data for this call requires the following components:
The data for this call requires the following components:


# hClient - Client Id.
#hClient - Client Id.
# hDevice - Device Id.
#hDevice - Device Id.
# hDma - DMA handle.
#hDma - DMA handle.
# hMemory - Memory handle.
#hMemory - Memory handle.
# flags - Flags to use.
#flags - Flags to use.
# dmaOffset - DMA Offset to unmap.
#dmaOffset - DMA Offset to unmap.
# status - Status of the unmap Memory DMA.
#status - Status of the unmap Memory DMA.


=== Bind Context DMA ===
===Bind Context DMA===
Binds a context for DMA interaction to a channel.
Binds a context for DMA interaction to a channel.


The data for this call requires the following components:
The data for this call requires the following components:


# hClient - Client Id.
#hClient - Client Id.
# hChannel - Channel Id.
#hChannel - Channel Id.
# hCtxDma - Context for DMA Id.
#hCtxDma - Context for DMA Id.
# status - Status of the bind context DMA.
#status - Status of the bind context DMA.


NOTE: Seems to be deprecated.
NOTE: Seems to be deprecated.


=== Share ===
===Share===
Sharing of a resource between multiple clients.
Sharing of a resource between multiple clients.


Line 167: Line 171:
The data for this call requires the following components:
The data for this call requires the following components:


# hClient - Client Id.
#hClient - Client Id.
# hObject - Resource Id.
#hObject - Resource Id.
# sharePolicy - Share policy.
#sharePolicy - Share policy.
# status - Status of sharing.
#status - Status of sharing.


=== Add VBlank Callback ===
===Add VBlank Callback===
TODO: Figure out what this does.
TODO: Figure out what this does.


NOTE: Seems to be deprecated.
NOTE: Seems to be deprecated.


== Engines ==
==Engines==
There are engines which internally act as classes inside the OpenRM driver.
There are engines which internally act as classes inside the OpenRM driver.


These classes have a few key components that make them unique.
These classes have a few key components that make them unique.


=== Table of Engines ===
===Table of Engines===
{| class="wikitable sortable mw-collapsible"
{| class="wikitable sortable mw-collapsible"
|+Engines
|+Engines

Latest revision as of 00:26, 2 March 2023

OpenRM refers to the open sourcing of the NVIDIA kernel module for Linux, specifically the RM Core or the internal resource manager.

Through the open sourced code (located here) we have been able to deduce 7 top level APIs that are being exposed to the Linux developers.

An absence of critical technical documentation has historically slowed growth and adoption of developer ecosystems for GPU virtualization.

This CC-BY-4.0 licensed content can either be used with attribution, or used as inspiration for new documentation, created by GPU vendors for public commercial distribution as developer documentation.

Where possible, this documentation will clearly label dates and versions of observed-but-not-guaranteed behaviour vs. vendor-documented stable interfaces/behaviour with guarantees of forward or backward compatibility.

Interaction With OpenRM

All of OpenRM is a high scale object oriented abstraction layer for the GPU, all resources are internally classes which have control definitions (methods) on how you can use them. These classes can also represent physical resources or engines.

Alloc (Client)

This is analogous to calling an object constructor in a higher level programming language, such as C#.

The data for this call requires the following components:

  1. hRoot - RM Client Id (given by the kernel module for an individual process that is interacting with the kernel module).
  2. hObjectParent - Parent of the resource we are allocating.
  3. hObjectNew - New object to allocate.
  4. hClass - Class of the object we are dealing with.
  5. pAllocParams - Pointer to values passed into the constructor call.
  6. status - Status of the constructor call (did it succeed or fail)

Alloc Memory 64

This creates a CPU's mapping to a resource.

The data for this call requires the following components:

  1. hRoot - RM Client Id (given by the kernel module for an individual process that is interacting with the kernel module).
  2. hObjectParent - Parent of the resource we create the CPU mapping to.
  3. hObjectNew - Mapping object resource id.
  4. hClass - Class of the mapped object.
  5. flags - Flags to use on the mapped object.
  6. pMemory - pointer for the memory to map.
  7. pLimit - Edge of memory map.
  8. status - Status of the constructor call.

NOTE: Seems to be deprecated.

Control

This is a control command which is analogous to calling a method on a class.

The data for this call requires the following components:

  1. hClient - RM Client Id.
  2. hObject - Object id.
  3. cmd - Method to call.
  4. params - Parameters into this method.
  5. paramsSize - Size of the params.
  6. status - Status of the control call.

NOTE: The control will overwrite the object we pass in over the params pointer.

Dup Object

Duplicates the object, or clones the object, which is a deep copy. This procedure can be used across processes in order to produce shared memory.

The data for this call requires the following components:

  1. hClient - RM Client Id.
  2. hParent - Parent of the object.
  3. hObject - Object destination for duplicating.
  4. hClientSrc - Client source id.
  5. hObjectSrc - Object source.
  6. flags - Flags to use.
  7. status - Status of the duplication.

Free

Frees an object from the object tree.

The data for this call requires the following components:

  1. hRoot - Client Id.
  2. hObjectParent - Parent of the object.
  3. hObjectOld - Object to call the destructor on.
  4. status - Status of the free.

Vid Heap Control

TODO: Figure out what this does.

NOTE: Seems to be deprecated.

Map Memory

This seems to be the same as alloc memory but seems to be used more often.

The data for this call requires the following components:

  1. hClient - Client Id.
  2. hDevice - Device id.
  3. hMemory - Memory resource.
  4. offset - Offset of the memory.
  5. length - Length of the memory.
  6. pLinearAddress - Pointer for returned address.
  7. status - Status of the map memory.
  8. flags - Flags to use.

Unmap Memory

This unmaps the CPU memory mapping from the resource.

The data for this call requires the following components:

  1. hClient - Client Id.
  2. hDevice - Device Id.
  3. hMemory - Memory Id.
  4. pLinearAddress - pointer to virtual address.
  5. status - Status of the unmap command.
  6. flags - Flags to use.

Alloc Context DMA 2

Allocates a context for DMA.

The data for this call requires the following components:

  1. hObjectParent - Object parent.
  2. hSubDevice - Sub device to allocate on.
  3. hObjectNew - Context id.
  4. hClass - Type of class.
  5. flags - Flags to use.
  6. selector - UNKNOWN.
  7. hMemory - Handle for Memory resource to DMA map.
  8. offset - Offset for the DMA mapping.
  9. limit - Limit of the DMA map.
  10. status - Status of the allocation.

NOTE: Seems to be deprecated.

Map Memory DMA

Map a region of memory for DMA access.

The data for this call requires the following components:

  1. hClient - Client Id.
  2. hDevice - Device Id.
  3. hDma - DMA Id.
  4. hMemory - Memory Id.
  5. offset - Offset of the region.
  6. limit - Limit of the region.
  7. flags - flags to use.
  8. dmaOffset - Offset of the mapping.
  9. status - Status of the map Memory DMA.

Un-map Memory DMA

Unmaps a region of memory for DMA access.

The data for this call requires the following components:

  1. hClient - Client Id.
  2. hDevice - Device Id.
  3. hDma - DMA handle.
  4. hMemory - Memory handle.
  5. flags - Flags to use.
  6. dmaOffset - DMA Offset to unmap.
  7. status - Status of the unmap Memory DMA.

Bind Context DMA

Binds a context for DMA interaction to a channel.

The data for this call requires the following components:

  1. hClient - Client Id.
  2. hChannel - Channel Id.
  3. hCtxDma - Context for DMA Id.
  4. status - Status of the bind context DMA.

NOTE: Seems to be deprecated.

Share

Sharing of a resource between multiple clients.

TODO: Understand this sharing more.

The data for this call requires the following components:

  1. hClient - Client Id.
  2. hObject - Resource Id.
  3. sharePolicy - Share policy.
  4. status - Status of sharing.

Add VBlank Callback

TODO: Figure out what this does.

NOTE: Seems to be deprecated.

Engines

There are engines which internally act as classes inside the OpenRM driver.

These classes have a few key components that make them unique.

Table of Engines

Engines
Engine Description
Invalid Does not exist.
Software Abstraction layer for software processes inside the OS Software.
GPU Interaction layer with the GPU.
Falcon Interaction with the Falcon on the GPU.
Master Control Unknown.
Kernel Master Control Interaction with the PMC.[1]
Private Ring Interaction with a private messaging ring.
Software Interrupt Interaction with software interrupts.
Memory System Interaction with the memory system.
Kernel Memory System Interaction with the kernel memory system.
Memory Manager Interaction with the memory management system.
FBFlcn Interaction with the FBFlcn subsystem.
TMR Interaction with the TMR on specific chips.
DMA Interaction with a GPU's DMA access.
Kernel FIFO First in First out queue in the GPU driver.
FIFO Interaction with a generic FIFO.
OS Interaction with the OS.
BUS PCI Bus interaction
Kernel BUS Internal module BUS.
INFOROM Interaction with the INFOROM Region on the GPU.
PERF Unknown.
Kernel PERF Unknown.
BIF Unknown.
Kernel BIF Unknown.
SF Unknown.
GPIO Interaction with GPIO.
CLK Clock manager system.
Kernel Display Kernel Display system.
DISP Display system.
DPU Data Processing Unit.