11 #ifndef INCLUDED_nvrm_gpu_H
12 #define INCLUDED_nvrm_gpu_H
21 #if defined(__cplusplus)
94 #define NVRM_GPU_DEFINE_LIB_OPEN_ATTR(x) \
95 NvRmGpuLibOpenAttr x = { 0 }
161 #define NVRM_GPU_DEVICE_INDEX_DEFAULT (-1)
190 #define NVRM_GPU_DEFINE_DEVICE_OPEN_ATTR(x) \
191 NvRmGpuDeviceOpenAttr x = { NvRmGpuSyncType_Default, false }
241 #if NVOS_IS_LINUX || NVOS_IS_QNX
242 #define NVRM_GPU_CLOCK_ASYNC_REQ_HANDLE_PRIFMT "d"
245 #define NVRM_GPU_CLOCK_ASYNC_REQ_HANDLE_PRIFMT "p"
309 size_t *pNumDomains);
369 NvRmGpuClockAsyncReqHandle *phReq);
387 const NvRmGpuClockAsyncReqHandle *phReqs,
403 NvRmGpuClockAsyncReqHandle hReq);
468 uint64_t *pVoltageMicroVolt);
500 uint64_t *pCurrentMicroAmpere);
532 uint64_t *pPowerMicroWatt);
565 int32_t *pTemperatureMilliCelsius);
576 int32_t temperature_mC);
613 #define NVRM_GPU_DEFINE_DEVICE_EVENT_SESSION_ATTR(x) \
614 NvRmGpuDeviceEventSessionOpenAttr x = { NULL, 0 }
684 #if defined(__cplusplus)
688 #if !defined(NV_SDK_BUILD)
689 #include "nvrm_gpu_priv.h"
NvError NvRmGpuDeviceEventSessionOpen(NvRmGpuDevice *hDevice, const NvRmGpuDeviceEventSessionOpenAttr *attr, NvRmGpuDeviceEventSession **phSession)
Opens the session to monitor device events.
struct NvRmGpuDeviceRec NvRmGpuDevice
Device handle type.
struct NvRmGpuDeviceEventSessionOpenAttrRec NvRmGpuDeviceEventSessionOpenAttr
Holds the events for which to listen.
Actual clock frequency programmed (including PLL constraints).
Main graphics core clock.
struct NvRmGpuLibOpenAttrRec NvRmGpuLibOpenAttr
VF update occurred for a clock domain, either because one session changed target frequency or because...
NvError NvRmGpuLibDetachDevice(NvRmGpuLib *const hlib, const int deviceIndex)
Detach and power down a GPU.
One clock domain frequency is below target.
NvRmGpuDeviceEventId
Holds information about the GPU device event.
GPU lost (non-recoverable).
const NvRmGpuLibDeviceListEntry * NvRmGpuLibListDevices(NvRmGpuLib *hlib, size_t *pnumDevices)
Returns a pointer to the device array.
NvRmGpuDeviceState deviceState
NvError NvRmGpuDeviceGetTemperature(NvRmGpuDevice *hDevice, NvRmGpuDeviceTemperature which, int32_t *pTemperatureMilliCelsius)
Gets the temperature.
NvError NvRmGpuClockGetPoints(NvRmGpuDevice *hDevice, NvRmGpuClockDomain domain, NvRmGpuClockPoint *pClkPoints, size_t *pNumPoints)
Gets VF points for a given clock domain.
NvError NvRmGpuDeviceGetPower(NvRmGpuDevice *hDevice, NvRmGpuDevicePower which, uint64_t *pPowerMicroWatt)
Gets the power consumed by the GPU.
NvRmGpuClockDomain
Clock domains.
NvError NvRmGpuDeviceEventSessionRead(NvRmGpuDeviceEventSession *hSession, NvRmGpuDeviceEventInfo *pEventInfo, uint32_t timeoutMs)
Reads detailed event information from the event session.
One clock domain frequency is below local target frequency requested by one session.
NvError NvRmGpuDeviceListTemperatureSensors(NvRmGpuDevice *hDevice, const NvRmGpuDeviceTemperature **pSensors, size_t *numSensors)
Gets the list of available temperature sensors.
static void NvRmGpuDeviceEventSessionOpenAttrSetAllEvents(NvRmGpuDeviceEventSessionOpenAttr *attr)
struct NvRmGpuDeviceEventSessionRec NvRmGpuDeviceEventSession
struct NvRmGpuClockPointRec NvRmGpuClockPoint
NvError NvRmGpuClockGet(NvRmGpuDevice *hDevice, NvRmGpuClockGetEntry *pClkGetEntries, size_t numEntries)
Gets clock state(s).
NvError NvRmGpuDeviceClose(NvRmGpuDevice *hDevice)
Closes the GPU device.
Target clock frequency requested by application.
struct NvRmGpuLibDeviceListEntryRec NvRmGpuLibDeviceListEntry
NvError NvRmGpuDeviceListCurrentSensors(NvRmGpuDevice *hDevice, const NvRmGpuDeviceCurrent **pSensors, size_t *numSensors)
Gets a list of the available current sensors.
NvError NvRmGpuClockWaitAnyEvent(NvRmGpuDevice *hDevice, uint32_t timeoutMs)
Waits on any clock update event.
NvRmGpuDeviceEventId eventId
NvError NvRmGpuDeviceListPowerSensors(NvRmGpuDevice *hDevice, const NvRmGpuDevicePower **pSensors, size_t *numSensors)
Gets a list of the available power sensors.
struct NvRmGpuClockGetEntryRec NvRmGpuClockGetEntry
NvError NvRmGpuClockGetDomains(NvRmGpuDevice *hDevice, const NvRmGpuClockDomainInfo **infos, size_t *pNumDomains)
Gets configurable clock domains.
struct NvRmGpuClockRangeRec NvRmGpuClockRange
NvError NvRmGpuClockCloseAsyncReq(NvRmGpuDevice *hDevice, NvRmGpuClockAsyncReqHandle hReq)
Closes an asynchronous request handle.
NvError NvRmGpuClockSet(NvRmGpuDevice *hDevice, const NvRmGpuClockSetEntry *pClkSetEntries, size_t numEntries, NvRmGpuClockAsyncReqHandle *phReq)
Sets a clock request.
const NvRmGpuDeviceEventId * filterList
Holds the events for which to listen.
struct NvRmGpuClockDomainInfoRec NvRmGpuClockDomainInfo
NvError NvRmGpuDeviceThermalAlertSetLimit(NvRmGpuDevice *hDevice, int32_t temperature_mC)
Sets the thermal alert limit.
NvRmGpuLib * NvRmGpuLibOpen(const NvRmGpuLibOpenAttr *attr)
Opens a new instance of the library.
struct NvRmGpuDeviceOpenAttrRec NvRmGpuDeviceOpenAttr
NvError NvRmGpuClockWaitAsyncReq(NvRmGpuDevice *hDevice, const NvRmGpuClockAsyncReqHandle *phReqs, size_t numEntries, uint32_t timeoutMs)
Waits for completion of one or more asynchronous requests.
struct NvRmGpuLibRec NvRmGpuLib
Library handle type.
NvError NvRmGpuDeviceGetVoltage(NvRmGpuDevice *hDevice, NvRmGpuDeviceVoltage which, uint64_t *pVoltageMicroVolt)
Gets the current voltage.
NvRmGpuClockDomain domain
in: Clock domain to query
struct NvRmGpuClockSetEntryRec NvRmGpuClockSetEntry
NvError NvRmGpuDeviceEventSessionClose(NvRmGpuDeviceEventSession *hSession)
Closes the event session.
NvError NvRmGpuLibClose(NvRmGpuLib *hlib)
Closes the library and releases all resources.
NvRmGpuClockDomain domain
NvRmGpuClockType type
in: Frequency type (target, actual or effective)
struct NvRmGpuClockAsyncNotImplemented * NvRmGpuClockAsyncReqHandle
bool sandboxFriendlyChannels
If true, channels are created in sandbox-friendly manner.
NvRmGpuSyncType syncType
The default sync type for all input/output sync objects.
Effective clock, measured from hardware.
NvError NvRmGpuLibAttachDevice(NvRmGpuLib *const hlib, const int deviceIndex)
Power up and attach a GPU.
uint64_t freqHz
out: Frequency in Hz
NvError NvRmGpuDeviceGetCurrent(NvRmGpuDevice *hDevice, NvRmGpuDeviceCurrent which, uint64_t *pCurrentMicroAmpere)
Gets the current drawn by the GPU.
NvError NvRmGpuDeviceListVoltageSensors(NvRmGpuDevice *hDevice, const NvRmGpuDeviceVoltage **pSensors, size_t *numSensors)
Gets a list of the available voltage sensors.
Holds the events for which to listen.
size_t filterListSize
Holds the size of the filter list.
Temperature above threshold.
NvError NvRmGpuDeviceOpen(NvRmGpuLib *hLib, int deviceIndex, const NvRmGpuDeviceOpenAttr *attr, NvRmGpuDevice **phDevice)
Opens the GPU device.
NvRmGpuClockDomain domain
struct NvRmGpuDeviceEventInfoRec NvRmGpuDeviceEventInfo