Device control, device capabilities, and device memory management.
Data Structures | |
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... | |
struct | NvRmGpuClockAsyncNotImplemented |
OS-specific type of asynchronous clock request handle (unimplemented). More... | |
Modules | |
GPU access API: Device management (safety subset) | |
Macros | |
#define | NVRM_GPU_CLOCK_ASYNC_REQ_HANDLE_PRIFMT "p" |
Format macro for printf for printing NvRmGpuClockAsyncReqHandle. More... | |
#define | NVRM_GPU_CLOCK_ASYNC_REQ_INVALID_HANDLE (NULL) |
Invalid handle value. More... | |
#define | NVRM_GPU_DEFINE_DEVICE_EVENT_SESSION_ATTR(x) NvRmGpuDeviceEventSessionOpenAttr x = { NULL, 0 } |
Definer macro for NvRmGpuDeviceEventSessionOpenAttr. More... | |
Functions | |
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... | |
#define NVRM_GPU_CLOCK_ASYNC_REQ_HANDLE_PRIFMT "p" |
Format macro for printf for printing NvRmGpuClockAsyncReqHandle.
The use is similar to PRIu64 for printing uint64_t.
Definition at line 880 of file nvrm_gpu.h.
#define NVRM_GPU_CLOCK_ASYNC_REQ_INVALID_HANDLE (NULL) |
#define NVRM_GPU_DEFINE_DEVICE_EVENT_SESSION_ATTR | ( | x | ) | NvRmGpuDeviceEventSessionOpenAttr x = { NULL, 0 } |
Definer macro for NvRmGpuDeviceEventSessionOpenAttr.
This macro defines a variable of type NvRmGpuDeviceEventSessionOpenAttr with the default values.
Definition at line 1903 of file nvrm_gpu.h.
OS-specific type of asynchronous clock request handle.
Asynchronous clock request handle is a waitable handle for clock change requests. This allows one to issue multiple clock change requests concurrently (e.g., GPU clock and memory clock for multiple devices) and then wait for all of them to complete.
Use NVRM_GPU_CLOCK_ASYNC_REQ_INVALID_HANDLE to safely initialize a handle.
Definition at line 908 of file nvrm_gpu.h.
typedef struct NvRmGpuClockDomainInfoRec NvRmGpuClockDomainInfo |
Clock domain info.
typedef struct NvRmGpuClockGetEntryRec NvRmGpuClockGetEntry |
Entry for clock get request.
typedef struct NvRmGpuClockPointRec NvRmGpuClockPoint |
Clock voltage/frequency point.
typedef struct NvRmGpuClockRangeRec NvRmGpuClockRange |
Frequency range for clock domain.
typedef struct NvRmGpuClockSetEntryRec NvRmGpuClockSetEntry |
Entry for clock set request.
typedef enum NvRmGpuClockType NvRmGpuClockType |
Request type for clock get.
typedef struct NvRmGpuDeviceEventInfoRec NvRmGpuDeviceEventInfo |
GPU device event.
Data type for a single GPU device event. This contains the timestamp and the event type.
typedef struct NvRmGpuDeviceEventSessionRec NvRmGpuDeviceEventSession |
Device event session handle.
Definition at line 352 of file nvrm_gpu.h.
Extensible attribute structure for NvRmGpuDeviceEventSessionOpen().
enum NvRmGpuClockDomain |
Clock domains.
The GPU has different clock domains that can be queried or requested separately. These include the memory clock and the graphics clock.
Enumerator | |
---|---|
NvRmGpuClockDomain_MCLK | Memory clock. |
NvRmGpuClockDomain_GPCCLK | Main graphics core clock. |
NvRmGpuClockDomain_Count | Number of clock domains. |
Definition at line 918 of file nvrm_gpu.h.
enum NvRmGpuClockType |
Request type for clock get.
Definition at line 934 of file nvrm_gpu.h.
enum NvRmGpuDeviceCurrent |
Electric current sensors.
Enumerator | |
---|---|
NvRmGpuDeviceCurrent_Bus | Bus current. |
Definition at line 1507 of file nvrm_gpu.h.
enum NvRmGpuDeviceEventId |
GPU device event type
Definition at line 1803 of file nvrm_gpu.h.
enum NvRmGpuDevicePower |
Electric power sensors.
Enumerator | |
---|---|
NvRmGpuDevicePower_Bus | Power consumed at the regulator. |
Definition at line 1593 of file nvrm_gpu.h.
Temperature sensors.
Enumerator | |
---|---|
NvRmGpuDeviceTemperature_InternalSensor | The internal GPU temperature sensor. |
Definition at line 1678 of file nvrm_gpu.h.
enum NvRmGpuDeviceVoltage |
Voltage sensors.
Enumerator | |
---|---|
NvRmGpuDeviceVoltage_Core | Core GPU voltage. |
NvRmGpuDeviceVoltage_SRAM | SRAM voltage. |
NvRmGpuDeviceVoltage_Bus | Bus voltage. |
Definition at line 1415 of file nvrm_gpu.h.
NvError NvRmGpuClockCloseAsyncReq | ( | NvRmGpuDevice * | hDevice, |
NvRmGpuClockAsyncReqHandle | hReq | ||
) |
Closes an asynchronous clock request handle.
Frees all resources related to an asynchronous request created with NvRmGpuClockSet(). It is not mandatory to wait for request completion before closing the handle.
[in] | hDevice | Device handle |
[in] | hReq | Asynchronous request handle to close. May be NULL . |
NvSuccess | Handle closed successfully, or NULL handle was provided. |
NvError_* | Unspecified error. The error code is returned for diagnostic purposes. |
Usage considerations
NvError NvRmGpuClockGet | ( | NvRmGpuDevice * | hDevice, |
NvRmGpuClockGetEntry * | pClkGetEntries, | ||
size_t | numEntries | ||
) |
Request one or more clock domain frequency state.
This function can be used to request control frequencies on clock domains. This function accepts one or more requests. The request is targeted for:
[in] | hDevice | Device handle |
[in,out] | pClkGetEntries | Array of clock request entries. For each entry, the clock domain and clock types must be set. Upon a successful call the associated frequency will be returned on a successful call. It is allowed to mix several clocks domains and clock request types in the same request. |
[in] | numEntries | Number of request entries. |
NvSuccess | Successful request |
NvError_NotSupported | Clock controls API not supported. |
NvError_* | Unspecified error. The error code is returned for diagnostic purposes. |
Usage considerations
NvError NvRmGpuClockGetDomains | ( | NvRmGpuDevice * | hDevice, |
const NvRmGpuClockDomainInfo ** | infos, | ||
size_t * | pNumDomains | ||
) |
Returns available GPU clock domains for the device.
[in] | hDevice | Device handle. |
[out] | infos | Array of available clock domains. This list is valid during the life-time of the hDevice handle. The returned pointer must not be freed by the caller. |
[out] | pNumDomains | Number of domains in array. |
NvSuccess | Successful request. |
NvError_NotSupported | Clock controls API not supported by this device. Capability NvRmGpuDeviceInfo::hasClockControls for this device is false . |
NvError_* | Unspecified error. Error code returned for diagnostics. |
false
.
Usage considerations
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.
Each clock domain has VF points, defined as frequencies for which voltage is optimal. In general, the clock arbiter will try to program frequencies which correspond to VF points.
[in] | hDevice | Device handle. |
[in] | domain | Clock domain to query. |
[out] | pClkPoints | Pointer to receive the array of optimal VF points. The allocated array must contain space for at least NvRmGpuClockDomainInfo::maxVfPoints (as retrieved by NvRmGpuClockGetDomains()). |
[out] | pNumPoints | Number of VF points. May vary depending on thermal conditions, and will be at most NvRmGpuClockDomainInfo::maxVfPoints. |
NvSuccess | Successful request. |
NvError_NotSupported | Clock controls API not supported by this device. |
NvError_* | Unspecified error. Error code returned for diagnostics. |
Usage considerations
NvError NvRmGpuClockSet | ( | NvRmGpuDevice * | hDevice, |
const NvRmGpuClockSetEntry * | pClkSetEntries, | ||
size_t | numEntries, | ||
NvRmGpuClockAsyncReqHandle * | phReq | ||
) |
Requests minimum clocks for one or more clock domains.
This function allows the caller to request minimum GPU clocks for one or more GPU clock domains. Both synchronous and asynchronous requests are supported.
In the asynchronous case, a waitable clock handle is returned. When setting clocks on multiple devices, the asynchronous mode allows one to perform all requests concurrently, and then wait until the clocks have been set. Clock stabilization can take a while.
When another request is made for a clock domain in the same NvRmGpuDevice instance, the previous requests are overridden.
The actually programmed clock frequency may not be exactly the requested frequency. Generally, the clock arbiter chooses the optimal voltage-frequency point that is at least as high as the highest frequency requested by any GPU user. However, depending on the thermal and other conditions, the actual GPU frequency may be also lower. Use NvRmGpuClockGet() to query the programmed and the effective frequencies. NvRmGpuDeviceEventSession can be also used to monitor changes in the GPU frequencies.
[in] | hDevice | Device handle. |
[in] | pClkSetEntries | Array of request entries. Each entry requests target frequency for one clock domain. If a clock domain appears multiple times in one call (not recommended), then only the last entry will be taken into account. |
[in] | numEntries | Number of entries in the pClkSetEntries array. |
[out] | phReq | Pointer to asynchronous request handle or NULL for a synchronous request
|
NvSuccess | The request was successfully made. In the synchronous case, the wait was also successful. In the asynchronous case, the request handle is returned. |
NvError_NotSupported | Clock controls API not supported by this device. |
NvError_Busy | A temporary blocking condition when submitting the asynchronous request. The user should try again. |
NvError_* | Unspecified error. The error code is returned for diagnostic purposes. |
Usage considerations
NULL
.NvError NvRmGpuClockWaitAnyEvent | ( | NvRmGpuDevice * | hDevice, |
uint32_t | timeoutMs | ||
) |
This function is not implemented and it should be deleted.
Usage considerations
NvError NvRmGpuClockWaitAsyncReq | ( | NvRmGpuDevice * | hDevice, |
const NvRmGpuClockAsyncReqHandle * | phReqs, | ||
size_t | numEntries, | ||
uint32_t | timeoutMs | ||
) |
Waits for the completion of one or more asynchronous clock requests.
[in] | hDevice | Device handle |
[in] | phReqs | Array of request handles. |
[in] | numEntries | Number of entries in the request array. |
[in] | timeoutMs | Wait timeout in milliseconds. Use as follows:
|
NvSuccess | All requests have completed. |
NvError_Timeout | Timeout was reached before all requests were completed. |
NvError_BadValue | One or more of the handles is invalid. |
NvError_* | Unspecified error. The error code is returned for diagnostic purposes. |
phReq
is left undefined. The handles should be closed without any further operation on them.
Usage considerations
NvError NvRmGpuDeviceEventSessionClose | ( | NvRmGpuDeviceEventSession * | hSession | ) |
Closes the device event session.
[in] | hSession | Device event session handle to close. May be NULL . |
NvSuccess | Event session closed successfully or hSession was NULL . |
NvError_* | Unspecified error while closing the session. The session is closed, regardless. The error code is returned for diagnostic purposes. |
Usage considerations
NvError NvRmGpuDeviceEventSessionOpen | ( | NvRmGpuDevice * | hDevice, |
const NvRmGpuDeviceEventSessionOpenAttr * | attr, | ||
NvRmGpuDeviceEventSession ** | phSession | ||
) |
Opens a session to monitor device events.
[in] | hDevice | Device handle. |
[in] | attr | Event session attributes. The attribute structure contains the device event filter list. |
[out] | phSession | Pointer to receive the event session handle on success. |
NvSuccess | Device event session created successfully. |
NvError_NotSupported | This device does not support device events. |
NvError_* | Unspecified error. The error code is returned for diagnostic purposes. |
Usage considerations
|
inlinestatic |
Assigns device events attribute structure with a list of all events to listen to.
[out] | attr | Non-NULL pointer to the device events attribute struct. |
Usage considerations
Definition at line 1929 of file nvrm_gpu.h.
References NvRmGpuDeviceEventSessionOpenAttrRec::filterList, NvRmGpuDeviceEventSessionOpenAttrRec::filterListSize, NV_ARRAY_SIZE, NvRmGpuDeviceEventId_AlarmClockArbiterFailed, NvRmGpuDeviceEventId_AlarmGpuLost, NvRmGpuDeviceEventId_AlarmLocalTargetVfNotPossible, NvRmGpuDeviceEventId_AlarmPowerAboveThreshold, NvRmGpuDeviceEventId_AlarmTargetVfNotPossible, NvRmGpuDeviceEventId_AlarmThermalAboveThreshold, NvRmGpuDeviceEventId_AlarmVfTableUpdateFailed, and NvRmGpuDeviceEventId_VfUpdate.
NvError NvRmGpuDeviceEventSessionRead | ( | NvRmGpuDeviceEventSession * | hSession, |
NvRmGpuDeviceEventInfo * | pEventInfo, | ||
uint32_t | timeoutMs | ||
) |
Read next device event.
[in] | hSession | Event session handle |
[out] | pEventInfo | Pointer to receive the event on success |
[in] | timeoutMs | Timeout value in milliseconds. Special values:
|
NvSuccess | Successful request |
NvError_Timeout | Timeout occurred before an event was available |
NvError_* | Unspecified error. The error code is returned for diagnostic purposes. |
Usage considerations
NvError NvRmGpuDeviceGetCurrent | ( | NvRmGpuDevice * | hDevice, |
NvRmGpuDeviceCurrent | which, | ||
uint64_t * | pCurrentMicroAmpere | ||
) |
Retrieves the electric current reading.
[in] | hDevice | Device handle. |
[in] | which | The current sensor to query. |
[out] | pCurrentMicroAmpere | Pointer to receive the current in microamperes. |
NvSuccess | Successful request |
NvError_* | Unspecified error. The error code is returned for diagnostic purposes. |
Usage considerations
NvError NvRmGpuDeviceGetPower | ( | NvRmGpuDevice * | hDevice, |
NvRmGpuDevicePower | which, | ||
uint64_t * | pPowerMicroWatt | ||
) |
Retrieves the power sensor reading.
[in] | hDevice | Device handle. |
[in] | which | The power sensor to query. |
[out] | pPowerMicroWatt | Power in microwatts. |
NvSuccess | Successful request |
NvError_NotSupported | Not supported on this device |
NvError_* | Unspecified error. The error code is returned for diagnostic purposes. |
Usage considerations
NvError NvRmGpuDeviceGetTemperature | ( | NvRmGpuDevice * | hDevice, |
NvRmGpuDeviceTemperature | which, | ||
int32_t * | pTemperatureMilliCelsius | ||
) |
Retrieves the temperature sensor reading.
[in] | hDevice | Device handle. |
[in] | which | Temperature sensor to query. |
[out] | pTemperatureMilliCelsius | Pointer to receive the temperature reading in millidegrees Celsius. |
NvSuccess | Successful request |
NvError_NotSupported | Not supported on this device |
NvError_* | Unspecified error. The error code is returned for diagnostic purposes. |
Usage considerations
NvError NvRmGpuDeviceGetVoltage | ( | NvRmGpuDevice * | hDevice, |
NvRmGpuDeviceVoltage | which, | ||
uint64_t * | pVoltageMicroVolt | ||
) |
Retrieves the voltage sensor reading.
[in] | hDevice | Device handle |
[in] | which | The voltage sensor to query |
[out] | pVoltageMicroVolt | non-NULL pointer to receive the voltage in microvolts. |
NvSuccess | Successful request |
NvError_NotSupported | Not supported on this device |
NvError_* | Unspecified error. The error code is returned for diagnostic purposes. |
Usage considerations
NvError NvRmGpuDeviceListCurrentSensors | ( | NvRmGpuDevice * | hDevice, |
const NvRmGpuDeviceCurrent ** | pSensors, | ||
size_t * | pNumSensors | ||
) |
Returns the list of available electric current sensors for the device.
[in] | hDevice | Device handle. |
[out] | pSensors | Non-NULL pointer to receive a pointer to the array of available sensors. The returned pointer may be NULL if no sensors are available. The returned pointer is valid for the life-time of hDevice and it must not be freed by the caller. |
[out] | pNumSensors | Non-NULL pointer to receive the number of available sensors. |
NvSuccess | Successful request |
NvError_* | Unspecified error. The error code is returned for diagnostic purposes. |
Usage considerations
NvError NvRmGpuDeviceListPowerSensors | ( | NvRmGpuDevice * | hDevice, |
const NvRmGpuDevicePower ** | pSensors, | ||
size_t * | pNumSensors | ||
) |
Returns the list of available power sensors for the device.
[in] | hDevice | Device handle. |
[out] | pSensors | Non-NULL pointer to receive a pointer to the array of available sensors. The returned pointer may be NULL if no sensors are available. The returned pointer is valid for the life-time of hDevice and it must not be freed by the caller. |
[out] | pNumSensors | Non-NULL pointer to receive the number of available sensors. |
NvSuccess | Successful request |
NvError_* | Unspecified error. The error code is returned for diagnostic purposes. |
Usage considerations
NvError NvRmGpuDeviceListTemperatureSensors | ( | NvRmGpuDevice * | hDevice, |
const NvRmGpuDeviceTemperature ** | pSensors, | ||
size_t * | pNumSensors | ||
) |
Returns the list of available temperature sensors for the device.
[in] | hDevice | Device handle. |
[out] | pSensors | Non-NULL pointer to receive a pointer to the array of available sensors. The returned pointer may be NULL if no sensors are available. The returned pointer is valid for the life-time of hDevice and it must not be freed by the caller. |
[out] | pNumSensors | Non-NULL pointer to receive the number of available sensors. |
NvSuccess | Successful request |
NvError_NotSupported | Not supported on this device |
NvError_* | Unspecified error. The error code is returned for diagnostic purposes. |
Usage considerations
NvError NvRmGpuDeviceListVoltageSensors | ( | NvRmGpuDevice * | hDevice, |
const NvRmGpuDeviceVoltage ** | pSensors, | ||
size_t * | pNumSensors | ||
) |
Returns the list of available voltage sensors for the device.
[in] | hDevice | Device handle. |
[out] | pSensors | Non-NULL pointer to receive a pointer to the array of available sensors. The returned pointer may be NULL if no sensors are available. The returned pointer is valid for the life-time of hDevice and it must not be freed by the caller. |
[out] | pNumSensors | Non-NULL pointer to receive the number of available sensors. |
NvSuccess | Successful request |
NvError_* | Unspecified error. The error code is returned for diagnostic purposes. |
Usage considerations
NvError NvRmGpuDeviceThermalAlertSetLimit | ( | NvRmGpuDevice * | hDevice, |
int32_t | temperature_mC | ||
) |
Sets the thermal alert limit.
hDevice | Device handle. |
temperature_mC | Thermal temperature alert threshold in millidegrees Celsius. |
NvSuccess | Successful operation |
NvError_NotSupported | Operation not supported for the device. |
NvError_* | Unspecified error. The error code is returned for diagnostic purposes. |
Usage considerations