11 #ifndef INCLUDED_nvrm_gpu_H
12 #define INCLUDED_nvrm_gpu_H
21 #if defined(__cplusplus)
165 #define NVRM_GPU_DEFINE_LIB_OPEN_ATTR(x) \
166 NvRmGpuLibOpenAttr x = { 0U }
398 #define NVRM_GPU_DEVICE_INDEX_DEFAULT (-1)
506 #define NVRM_GPU_DEFINE_DEVICE_OPEN_ATTR(x) \
507 NvRmGpuDeviceOpenAttr x = { NvRmGpuSyncType_Default, false }
566 #if NVOS_IS_LINUX || NVOS_IS_QNX
572 #define NVRM_GPU_CLOCK_ASYNC_REQ_HANDLE_PRIFMT "d"
590 #define NVRM_GPU_CLOCK_ASYNC_REQ_HANDLE_PRIFMT "p"
760 size_t *pNumDomains);
895 NvRmGpuClockAsyncReqHandle *phReq);
921 const NvRmGpuClockAsyncReqHandle *phReqs,
946 NvRmGpuClockAsyncReqHandle hReq);
1025 size_t *pNumSensors);
1048 uint64_t *pVoltageMicroVolt);
1079 size_t *pNumSensors);
1101 uint64_t *pCurrentMicroAmpere);
1130 size_t *pNumSensors);
1152 uint64_t *pPowerMicroWatt);
1182 size_t *pNumSensors);
1205 int32_t *pTemperatureMilliCelsius);
1223 int32_t temperature_mC);
1330 #define NVRM_GPU_DEFINE_DEVICE_EVENT_SESSION_ATTR(x) \
1331 NvRmGpuDeviceEventSessionOpenAttr x = { NULL, 0 }
1431 uint32_t timeoutMs);
1449 #if defined(__cplusplus)
1453 #if !defined(NV_SDK_BUILD)
1454 #include "nvrm_gpu_priv.h"
NvError NvRmGpuClockWaitAsyncReq(NvRmGpuDevice *hDevice, const NvRmGpuClockAsyncReqHandle *phReqs, size_t numEntries, uint32_t timeoutMs)
Waits for the completion of one or more asynchronous clock requests.
Power consumed at the regulator.
uint32_t reserved
Dummy field for C/C++ ABI compatibility.
static void NvRmGpuDeviceEventSessionOpenAttrSetAllEvents(NvRmGpuDeviceEventSessionOpenAttr *attr)
Assigns device events attribute structure with a list of all events to listen to. ...
Synchronization type is Android/Linux sync fd.
NvRmGpuLibDeviceState
Device attachment state.
NvRmGpuLibDeviceState deviceState
Device attachment state.
NvError NvRmGpuDeviceThermalAlertSetLimit(NvRmGpuDevice *hDevice, int32_t temperature_mC)
Sets the thermal alert limit.
Entry for clock set request.
A clock domain frequency is below local target frequency requested by a session.
NvError NvRmGpuDeviceGetPower(NvRmGpuDevice *hDevice, NvRmGpuDevicePower which, uint64_t *pPowerMicroWatt)
Retrieves the power sensor reading.
NvRmGpuDeviceVoltage
Voltage sensors.
struct NvRmGpuClockGetEntryRec NvRmGpuClockGetEntry
Entry for clock get request.
Synchronization type is Tegra HOST1X syncpoint.
NvRmGpuClockType
Request type for clock get.
struct NvRmGpuClockRangeRec NvRmGpuClockRange
Frequency range for clock domain.
Clock frequency programmed to the HW (including PLL constraints).
size_t maxVfPoints
Maximum number of voltage/frequency points returned by NvRmGpuClockGetPoints()
A clock domain frequency is below target.
struct NvRmGpuDeviceEventSessionRec NvRmGpuDeviceEventSession
Device event session handle.
NvError NvRmGpuDeviceGetVoltage(NvRmGpuDevice *hDevice, NvRmGpuDeviceVoltage which, uint64_t *pVoltageMicroVolt)
Retrieves the voltage sensor reading.
Extensible attribute structure for NvRmGpuDeviceOpen()
Main graphics core clock.
NvError NvRmGpuDeviceListVoltageSensors(NvRmGpuDevice *hDevice, const NvRmGpuDeviceVoltage **pSensors, size_t *pNumSensors)
Returns the list of available voltage sensors for the device.
bool hasDeviceStateControl
Indicates whether the device can be attached/detached by the user.
NvError
The NvError enumeration contains ALL return / error codes.
Device is detached and powered off.
struct NvRmGpuLibRec NvRmGpuLib
Library handle.
int deviceIndex
Internal device index. Used in NvRmGpuDeviceOpen()
NvRmGpuClockRange range
Frequency range of the clock domain.
NvError NvRmGpuClockWaitAnyEvent(NvRmGpuDevice *hDevice, uint32_t timeoutMs)
This function is not implemented and it should be deleted.
uint64_t timeNs
GPU time (in nanoseconds)
Device is attached and may be opened with NvRmGpuDeviceOpen()
Voltage/frequency update occurred for a clock domain.
NvRmGpuDeviceTemperature
Temperature sensors.
NvError NvRmGpuDeviceListPowerSensors(NvRmGpuDevice *hDevice, const NvRmGpuDevicePower **pSensors, size_t *pNumSensors)
Returns the list of available power sensors for the device.
NvError NvRmGpuDeviceClose(NvRmGpuDevice *hDevice)
Closes the GPU device.
struct NvRmGpuLibOpenAttrRec NvRmGpuLibOpenAttr
Extensible attribute structure for NvRmGpuLibOpen()
NvError NvRmGpuDeviceOpen(NvRmGpuLib *hLib, int deviceIndex, const NvRmGpuDeviceOpenAttr *attr, NvRmGpuDevice **phDevice)
Opens a GPU device.
OS-specific type of asynchronous clock request handle (unimplemented).
NvError NvRmGpuDeviceListTemperatureSensors(NvRmGpuDevice *hDevice, const NvRmGpuDeviceTemperature **pSensors, size_t *pNumSensors)
Returns the list of available temperature sensors for the device.
NvRmGpuDeviceEventId eventId
Event type.
uint64_t freqHz
Frequency for clock request.
struct NvRmGpuDeviceEventInfoRec NvRmGpuDeviceEventInfo
GPU device event.
Temperature above threshold.
Target clock frequency requested by the user.
NvError NvRmGpuDeviceEventSessionOpen(NvRmGpuDevice *hDevice, const NvRmGpuDeviceEventSessionOpenAttr *attr, NvRmGpuDeviceEventSession **phSession)
Opens a session to monitor device events.
NvError NvRmGpuDeviceGetCurrent(NvRmGpuDevice *hDevice, NvRmGpuDeviceCurrent which, uint64_t *pCurrentMicroAmpere)
Retrieves the electric current reading.
NvError NvRmGpuClockSet(NvRmGpuDevice *hDevice, const NvRmGpuClockSetEntry *pClkSetEntries, size_t numEntries, NvRmGpuClockAsyncReqHandle *phReq)
Requests minimum clocks for one or more clock domains.
NvError NvRmGpuDeviceEventSessionRead(NvRmGpuDeviceEventSession *hSession, NvRmGpuDeviceEventInfo *pEventInfo, uint32_t timeoutMs)
Read next device event.
const NvRmGpuDeviceEventId * filterList
List of events to listen.
struct NvRmGpuClockSetEntryRec NvRmGpuClockSetEntry
Entry for clock set request.
NvRmGpuLib * NvRmGpuLibOpen(const NvRmGpuLibOpenAttr *attr)
Opens a new instance of the nvrm_gpu library.
Device state is not known.
struct NvRmGpuClockAsyncNotImplemented * NvRmGpuClockAsyncReqHandle
OS-specific type of asynchronous clock request handle.
The internal GPU temperature sensor.
Clock voltage/frequency point.
NvRmGpuSyncType
Inter-engine synchronization type for GPU jobs.
NvError NvRmGpuLibAttachDevice(NvRmGpuLib *hLib, int deviceIndex)
Attaches and powers up a GPU.
struct NvRmGpuDeviceEventSessionOpenAttrRec NvRmGpuDeviceEventSessionOpenAttr
Extensible attribute structure for NvRmGpuDeviceEventSessionOpen().
NvRmGpuClockDomain domain
(IN) Domain for the clock request
NvError NvRmGpuLibDetachDevice(NvRmGpuLib *hLib, int deviceIndex)
Powers down and detaches a GPU.
NvError NvRmGpuClockGet(NvRmGpuDevice *hDevice, NvRmGpuClockGetEntry *pClkGetEntries, size_t numEntries)
Request one or more clock domain frequency state.
NvError NvRmGpuDeviceListCurrentSensors(NvRmGpuDevice *hDevice, const NvRmGpuDeviceCurrent **pSensors, size_t *pNumSensors)
Returns the list of available electric current sensors for the device.
const NvRmGpuLibDeviceListEntry * NvRmGpuLibListDevices(NvRmGpuLib *hLib, size_t *pNumDevices)
Returns the list of probed GPUs.
NvRmGpuClockDomain domain
Domain for clock request.
struct NvRmGpuDeviceRec NvRmGpuDevice
Device handle.
NvRmGpuClockType type
(IN) Request type
bool sandboxFriendlyChannels
Ignored field.
Effective clock as measured from hardware.
NvRmGpuSyncType syncType
The default sync type for this device.
struct NvRmGpuDeviceOpenAttrRec NvRmGpuDeviceOpenAttr
Extensible attribute structure for NvRmGpuDeviceOpen()
NvError NvRmGpuLibClose(NvRmGpuLib *hLib)
Closes the library and releases all resources.
NvRmGpuDevicePower
Electric power sensors.
struct NvRmGpuLibDeviceListEntryRec NvRmGpuLibDeviceListEntry
Device list entry.
#define NV_ARRAY_SIZE(x)
Macro for determining the size of an array.
NvError NvRmGpuClockGetDomains(NvRmGpuDevice *hDevice, const NvRmGpuClockDomainInfo **infos, size_t *pNumDomains)
Returns available GPU clock domains for the device.
NVIDIA Common Definitions
const char * name
Informative device name.
uint64_t freqHz
(OUT) Frequency in Hz
Extensible attribute structure for NvRmGpuLibOpen()
NvRmGpuClockDomain
Clock domains.
NvError NvRmGpuClockCloseAsyncReq(NvRmGpuDevice *hDevice, NvRmGpuClockAsyncReqHandle hReq)
Closes an asynchronous clock request handle.
struct NvRmGpuClockPointRec NvRmGpuClockPoint
Clock voltage/frequency point.
Device exists, but not enough privileges to access.
NvRmGpuDeviceEventId
GPU device event type.
NvError NvRmGpuDeviceEventSessionClose(NvRmGpuDeviceEventSession *hSession)
Closes the device event session.
Frequency range for clock domain.
NvError NvRmGpuClockGetPoints(NvRmGpuDevice *hDevice, NvRmGpuClockDomain domain, NvRmGpuClockPoint *pClkPoints, size_t *pNumPoints)
Retrieves voltage/frequency (VF) points for a given clock domain.
Entry for clock get request.
NvRmGpuDeviceCurrent
Electric current sensors.
struct NvRmGpuClockDomainInfoRec NvRmGpuClockDomainInfo
Clock domain info.
Extensible attribute structure for NvRmGpuDeviceEventSessionOpen().
The clock arbiter has failed.
size_t filterListSize
Number of entries in the event list.
NvError NvRmGpuDeviceGetTemperature(NvRmGpuDevice *hDevice, NvRmGpuDeviceTemperature which, int32_t *pTemperatureMilliCelsius)
Retrieves the temperature sensor reading.
NvRmGpuClockDomain domain
Clock domain.