NVIDIA DRIVE OS Linux SDK API Reference

5.1.15.2 Release
For Test and Development only
nvrm_gpu.h File Reference

Detailed Description

NVIDIA GPU access API

Description: This file contains API for GPU library management, clock controls, sensors, and device events.

Definition in file nvrm_gpu.h.

Go to the source code of this file.

Data Structures

struct  NvRmGpuLibOpenAttrRec
 Extensible attribute structure for NvRmGpuLibOpen() More...
 
struct  NvRmGpuLibDeviceListEntryRec
 Device list entry. More...
 
struct  NvRmGpuDeviceOpenAttrRec
 Extensible attribute structure for NvRmGpuDeviceOpen() More...
 
struct  NvRmGpuClockGetEntryRec
 Entry for clock get request. More...
 
struct  NvRmGpuClockSetEntryRec
 Entry for clock set request. More...
 
struct  NvRmGpuClockRangeRec
 Frequency range for clock domain. More...
 
struct  NvRmGpuClockPointRec
 Clock voltage/frequency point. More...
 
struct  NvRmGpuClockDomainInfoRec
 Clock domain info. More...
 
struct  NvRmGpuDeviceEventSessionOpenAttrRec
 Extensible attribute structure for NvRmGpuDeviceEventSessionOpen(). More...
 
struct  NvRmGpuDeviceEventInfoRec
 GPU device event. More...
 

Macros

#define NVRM_GPU_DEFINE_LIB_OPEN_ATTR(x)   NvRmGpuLibOpenAttr x = { 0U }
 Definer macro for NvRmGpuLibOpenAttr. More...
 
#define NVRM_GPU_DEVICE_INDEX_DEFAULT   (-1)
 Pseudo-index for the default (primary) device. More...
 
#define NVRM_GPU_DEFINE_DEVICE_OPEN_ATTR(x)   NvRmGpuDeviceOpenAttr x = { NvRmGpuSyncType_Default, false }
 Definer macro for NvRmGpuDeviceOpen(). More...
 
#define NVRM_GPU_CLOCK_ASYNC_REQ_HANDLE_PRIFMT   "p"
 Format macro for printf for printing NvRmGpuClockAsyncReqHandle. More...
 
#define NVRM_GPU_DEFINE_DEVICE_EVENT_SESSION_ATTR(x)   NvRmGpuDeviceEventSessionOpenAttr x = { NULL, 0 }
 Definer macro for NvRmGpuDeviceEventSessionOpenAttr. More...
 

Typedefs

typedef struct NvRmGpuLibRec NvRmGpuLib
 Library handle. More...
 
typedef struct NvRmGpuDeviceRec NvRmGpuDevice
 Device handle. More...
 
typedef struct NvRmGpuDeviceEventSessionRec NvRmGpuDeviceEventSession
 Device event session handle. More...
 
typedef struct NvRmGpuLibOpenAttrRec NvRmGpuLibOpenAttr
 Extensible attribute structure for NvRmGpuLibOpen() More...
 
typedef struct NvRmGpuLibDeviceListEntryRec NvRmGpuLibDeviceListEntry
 Device list entry. More...
 
typedef struct NvRmGpuDeviceOpenAttrRec NvRmGpuDeviceOpenAttr
 Extensible attribute structure for NvRmGpuDeviceOpen() More...
 
typedef struct NvRmGpuClockAsyncNotImplementedNvRmGpuClockAsyncReqHandle
 OS-specific type of asynchronous clock request handle. More...
 
typedef enum NvRmGpuClockType NvRmGpuClockType
 Request type for clock get. More...
 
typedef struct NvRmGpuClockGetEntryRec NvRmGpuClockGetEntry
 Entry for clock get request. More...
 
typedef struct NvRmGpuClockSetEntryRec NvRmGpuClockSetEntry
 Entry for clock set request. More...
 
typedef struct NvRmGpuClockRangeRec NvRmGpuClockRange
 Frequency range for clock domain. More...
 
typedef struct NvRmGpuClockPointRec NvRmGpuClockPoint
 Clock voltage/frequency point. More...
 
typedef struct NvRmGpuClockDomainInfoRec NvRmGpuClockDomainInfo
 Clock domain info. More...
 
typedef struct NvRmGpuDeviceEventSessionOpenAttrRec NvRmGpuDeviceEventSessionOpenAttr
 Extensible attribute structure for NvRmGpuDeviceEventSessionOpen(). More...
 
typedef struct NvRmGpuDeviceEventInfoRec NvRmGpuDeviceEventInfo
 GPU device event. More...
 

Enumerations

enum  NvRmGpuLibDeviceState {
  NvRmGpuLibDeviceState_Attached,
  NvRmGpuLibDeviceState_Detached,
  NvRmGpuLibDeviceState_InsufficientPrivileges,
  NvRmGpuLibDeviceState_Unknown
}
 Device attachment state. More...
 
enum  NvRmGpuSyncType {
  NvRmGpuSyncType_Default,
  NvRmGpuSyncType_SyncFd,
  NvRmGpuSyncType_Syncpoint
}
 Inter-engine synchronization type for GPU jobs. More...
 
enum  NvRmGpuClockDomain {
  NvRmGpuClockDomain_MCLK = 0,
  NvRmGpuClockDomain_GPCCLK,
  NvRmGpuClockDomain_Count
}
 Clock domains. More...
 
enum  NvRmGpuClockType {
  NvRmGpuClockType_Target = 1,
  NvRmGpuClockType_Actual = 2,
  NvRmGpuClockType_Effective = 3
}
 Request type for clock get. More...
 
enum  NvRmGpuDeviceVoltage {
  NvRmGpuDeviceVoltage_Core = 1,
  NvRmGpuDeviceVoltage_SRAM,
  NvRmGpuDeviceVoltage_Bus
}
 Voltage sensors. More...
 
enum  NvRmGpuDeviceCurrent { NvRmGpuDeviceCurrent_Bus = 1 }
 Electric current sensors. More...
 
enum  NvRmGpuDevicePower { NvRmGpuDevicePower_Bus = 1 }
 Electric power sensors. More...
 
enum  NvRmGpuDeviceTemperature { NvRmGpuDeviceTemperature_InternalSensor = 1 }
 Temperature sensors. More...
 
enum  NvRmGpuDeviceEventId {
  NvRmGpuDeviceEventId_VfUpdate = 0,
  NvRmGpuDeviceEventId_AlarmTargetVfNotPossible,
  NvRmGpuDeviceEventId_AlarmLocalTargetVfNotPossible,
  NvRmGpuDeviceEventId_AlarmClockArbiterFailed,
  NvRmGpuDeviceEventId_AlarmVfTableUpdateFailed,
  NvRmGpuDeviceEventId_AlarmThermalAboveThreshold,
  NvRmGpuDeviceEventId_AlarmPowerAboveThreshold,
  NvRmGpuDeviceEventId_AlarmGpuLost,
  NvRmGpuDeviceEventId_Count
}
 

Functions

NvRmGpuLibNvRmGpuLibOpen (const NvRmGpuLibOpenAttr *attr)
 Opens a new instance of the nvrm_gpu library. More...
 
NvError NvRmGpuLibClose (NvRmGpuLib *hLib)
 Closes the library and releases all resources. More...
 
const NvRmGpuLibDeviceListEntryNvRmGpuLibListDevices (NvRmGpuLib *hLib, size_t *pNumDevices)
 Returns the list of probed GPUs. More...
 
NvError NvRmGpuLibAttachDevice (NvRmGpuLib *hLib, int deviceIndex)
 Attaches and powers up a GPU. More...
 
NvError NvRmGpuLibDetachDevice (NvRmGpuLib *hLib, int deviceIndex)
 Powers down and detaches a GPU. More...
 
NvError NvRmGpuDeviceOpen (NvRmGpuLib *hLib, int deviceIndex, const NvRmGpuDeviceOpenAttr *attr, NvRmGpuDevice **phDevice)
 Opens a GPU device. More...
 
NvError NvRmGpuDeviceClose (NvRmGpuDevice *hDevice)
 Closes the GPU device. More...
 
NvError NvRmGpuClockGetDomains (NvRmGpuDevice *hDevice, const NvRmGpuClockDomainInfo **infos, size_t *pNumDomains)
 Returns available GPU clock domains for the device. More...
 
NvError NvRmGpuClockGetPoints (NvRmGpuDevice *hDevice, NvRmGpuClockDomain domain, NvRmGpuClockPoint *pClkPoints, size_t *pNumPoints)
 Retrieves voltage/frequency (VF) points for a given clock domain. For information about VF points, see NvRmGpuClockAsyncReqHandle. More...
 
NvError NvRmGpuClockSet (NvRmGpuDevice *hDevice, const NvRmGpuClockSetEntry *pClkSetEntries, size_t numEntries, NvRmGpuClockAsyncReqHandle *phReq)
 Requests minimum clocks for one or more clock domains. More...
 
NvError NvRmGpuClockWaitAsyncReq (NvRmGpuDevice *hDevice, const NvRmGpuClockAsyncReqHandle *phReqs, size_t numEntries, uint32_t timeoutMs)
 Waits for the completion of one or more asynchronous clock requests. More...
 
NvError NvRmGpuClockCloseAsyncReq (NvRmGpuDevice *hDevice, NvRmGpuClockAsyncReqHandle hReq)
 Closes an asynchronous clock request handle. More...
 
NvError NvRmGpuClockWaitAnyEvent (NvRmGpuDevice *hDevice, uint32_t timeoutMs)
 This function is not implemented and it should be deleted. More...
 
NvError NvRmGpuClockGet (NvRmGpuDevice *hDevice, NvRmGpuClockGetEntry *pClkGetEntries, size_t numEntries)
 Request one or more clock domain frequency state. More...
 
NvError NvRmGpuDeviceListVoltageSensors (NvRmGpuDevice *hDevice, const NvRmGpuDeviceVoltage **pSensors, size_t *pNumSensors)
 Returns the list of available voltage sensors for the device. More...
 
NvError NvRmGpuDeviceGetVoltage (NvRmGpuDevice *hDevice, NvRmGpuDeviceVoltage which, uint64_t *pVoltageMicroVolt)
 Retrieves the voltage sensor reading. More...
 
NvError NvRmGpuDeviceListCurrentSensors (NvRmGpuDevice *hDevice, const NvRmGpuDeviceCurrent **pSensors, size_t *pNumSensors)
 Returns the list of available electric current sensors for the device. More...
 
NvError NvRmGpuDeviceGetCurrent (NvRmGpuDevice *hDevice, NvRmGpuDeviceCurrent which, uint64_t *pCurrentMicroAmpere)
 Retrieves the electric current reading. More...
 
NvError NvRmGpuDeviceListPowerSensors (NvRmGpuDevice *hDevice, const NvRmGpuDevicePower **pSensors, size_t *pNumSensors)
 Returns the list of available power sensors for the device. More...
 
NvError NvRmGpuDeviceGetPower (NvRmGpuDevice *hDevice, NvRmGpuDevicePower which, uint64_t *pPowerMicroWatt)
 Retrieves the power sensor reading. More...
 
NvError NvRmGpuDeviceListTemperatureSensors (NvRmGpuDevice *hDevice, const NvRmGpuDeviceTemperature **pSensors, size_t *pNumSensors)
 Returns the list of available temperature sensors for the device. More...
 
NvError NvRmGpuDeviceGetTemperature (NvRmGpuDevice *hDevice, NvRmGpuDeviceTemperature which, int32_t *pTemperatureMilliCelsius)
 Retrieves the temperature sensor reading. More...
 
NvError NvRmGpuDeviceThermalAlertSetLimit (NvRmGpuDevice *hDevice, int32_t temperature_mC)
 Sets the thermal alert limit. More...
 
static void NvRmGpuDeviceEventSessionOpenAttrSetAllEvents (NvRmGpuDeviceEventSessionOpenAttr *attr)
 Assigns device events attribute structure with a list of all events to listen to. More...
 
NvError NvRmGpuDeviceEventSessionOpen (NvRmGpuDevice *hDevice, const NvRmGpuDeviceEventSessionOpenAttr *attr, NvRmGpuDeviceEventSession **phSession)
 Opens a session to monitor device events. More...
 
NvError NvRmGpuDeviceEventSessionRead (NvRmGpuDeviceEventSession *hSession, NvRmGpuDeviceEventInfo *pEventInfo, uint32_t timeoutMs)
 Read next device event. More...
 
NvError NvRmGpuDeviceEventSessionClose (NvRmGpuDeviceEventSession *hSession)
 Closes the device event session. More...