NVIDIA DriveOS Linux SDK API Reference

7.2.5.0 Early Access Release
nvsciipc.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2018-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4  *
5  * NVIDIA CORPORATION and its licensors retain all intellectual property
6  * and proprietary rights in and to this software, related documentation
7  * and any modifications thereto. Any use, reproduction, disclosure or
8  * distribution of this software and related documentation without an express
9  * license agreement from NVIDIA CORPORATION is strictly prohibited.
10  */
11 
12 #ifndef INCLUDED_NVSCIIPC_H
13 #define INCLUDED_NVSCIIPC_H
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
19 #include <stdint.h>
20 #include <stddef.h>
21 #ifdef __QNX__
22 #include <sys/iofunc.h>
23 #endif
24 #include "nvscierror.h"
25 #include "nvscievent.h"
26 
76 /* use constant global version variable instead of macro for consistency with
77  * version check API of existing NvSci family
78  */
79 
81 static const uint32_t NvSciIpcMajorVersion = 1U;
82 
84 static const uint32_t NvSciIpcMinorVersion = 5U;
85 
262 #ifdef __QNX__
263 /*******************************************************************/
264 /********************* ACCESS CONTROL ******************************/
265 /*******************************************************************/
266 
305 #endif /* __QNX___ */
306 
307 /*******************************************************************/
308 /************************ DATA TYPES *******************************/
309 /*******************************************************************/
310 
314 typedef uint64_t NvSciIpcEndpoint;
315 
317 
318 #if defined(__QNX__)
319 /* nvsciipc custom ability can be created or looked up w/ this ID */
320 #ifndef NVSCIIPC_ABILITY_ID
321 #define NVSCIIPC_ABILITY_ID "NvSciIpcEndpoint"
322 #endif /* NVSCIIPC_ABILITY_ID */
323 #endif /* __QNX__ */
324 
328 #define NVSCIIPC_BACKEND_ITC 0U
329 #define NVSCIIPC_BACKEND_IPC 1U
330 #define NVSCIIPC_BACKEND_ITC_NVSCICOM 2U
331 #define NVSCIIPC_BACKEND_IPC_NVSCICOM 3U
332 #define NVSCIIPC_BACKEND_ITC_IVCLIB 4U
333 #define NVSCIIPC_BACKEND_IPC_IVCLIB 5U
334 #define NVSCIIPC_BACKEND_IVC 6U
335 #define NVSCIIPC_BACKEND_C2C 7U
336 #define NVSCIIPC_BACKEND_C2C_PCIE 7U
337 #define NVSCIIPC_BACKEND_C2C_NPM 8U
338 #if defined(__linux__)
339  /* (NVSCIIPC_BACKEND_C2C_NPM + 1U) */
340  #define NVSCIIPC_BACKEND_MAX 9U
341 #elif defined(__QNX__)
342  /* (NVSCIIPC_BACKEND_IPC_PCIE + 1U) */
343  #define NVSCIIPC_BACKEND_MAX 8U
344 #endif
345 
346 #define NVSCIIPC_INVALID_IRQ (0xFFFFFFFFU)
347 #define NVSCIIPC_INVALID_IID (-1)
348 
352 typedef uint64_t NvSciIpcEndpointVuid;
353 
355 
362  uint32_t gid;
366  uint32_t backend;
370  int32_t irq;
372  int32_t id;
376  uint32_t notiIpaType;
378  uint32_t uid;
379 };
380 
386  uint32_t nframes;
388  uint32_t frame_size;
389 };
390 
395 #define NVSCIIPC_MAX_ENDPOINT_NAME 64U
396 
397 /* NvSciIPC Event type */
399 #define NV_SCI_IPC_EVENT_READ 0x01U
400 
401 #define NV_SCI_IPC_EVENT_WRITE 0x02U
402 
403 #define NV_SCI_IPC_EVENT_CONN_EST 0x04U
404 
405 #define NV_SCI_IPC_EVENT_CONN_RESET 0x08U
406 
407 #define NV_SCI_IPC_EVENT_WRITE_EMPTY 0x10U
408 
409 #define NV_SCI_IPC_EVENT_ASYNC_ERROR 0x20U
410 
411 #define NV_SCI_IPC_EVENT_CONN_EST_ALL (NV_SCI_IPC_EVENT_CONN_EST | \
412  NV_SCI_IPC_EVENT_WRITE | NV_SCI_IPC_EVENT_WRITE_EMPTY | \
413  NV_SCI_IPC_EVENT_READ)
414 
416 #define NVSCIIPC_INFINITE_WAIT -1LL
417 
418 /* NvSciIpc Asynchronous erros */
420 #define NV_SCI_ASYNC_PCIE_EDMA_XFER_ERROR 0x1U
421 
422 #define NV_SCI_ASYNC_PCIE_AER_UNCORRECTABLE_FATAL 0x2U
423 
424 #define NV_SCI_ASYNC_PCIE_AER_UNCORRECTABLE_NONFATAL 0x4U
425 
426 #define NV_SCI_ASYNC_PCIE_VALIDATION_ERROR 0x8U
427 
428 /*******************************************************************/
429 /********************* FUNCTION TYPES ******************************/
430 /*******************************************************************/
431 
460 NvSciError NvSciIpcInit(void);
461 
495 void NvSciIpcDeinit(void);
496 
530 NvSciError NvSciIpcOpenCfgBlob(void);
531 
577 NvSciError NvSciIpcGetEndpointAccessInfo(const char *endpoint,
579 
607 void NvSciIpcCloseCfgBlob(void);
608 
674 NvSciError NvSciIpcOpenEndpoint(const char *endpoint, NvSciIpcEndpoint *handle);
675 
747 NvSciError NvSciIpcOpenEndpointWithEventService(const char *endpoint,
748  NvSciIpcEndpoint *handle, NvSciEventService *eventService);
749 
800  NvSciEventNotifier **eventNotifier);
801 
810 
864 NvSciError NvSciIpcCloseEndpointSafe(NvSciIpcEndpoint handle, bool clear);
865 
874 
925 
933 NvSciError NvSciIpcRead(NvSciIpcEndpoint handle, void *buf, size_t size,
934  int32_t *bytes);
935 
993 NvSciError NvSciIpcReadSafe(NvSciIpcEndpoint handle, void *buf, uint32_t size,
994  uint32_t *bytes);
995 
1057  const volatile void **buf);
1058 
1107 
1115 NvSciError NvSciIpcWrite(NvSciIpcEndpoint handle, const void *buf, size_t size,
1116  int32_t *bytes);
1117 
1176 NvSciError NvSciIpcWriteSafe(NvSciIpcEndpoint handle, const void *buf,
1177  uint32_t size, uint32_t *bytes);
1178 
1237  volatile void **buf);
1238 
1292 
1333  NvSciIpcEndpointInfo *info);
1334 
1335 #ifndef __QNX__
1336 
1380 NvSciError NvSciIpcGetLinuxEventFd(NvSciIpcEndpoint handle, int32_t *fd);
1381 #endif /* !__QNX__ */
1382 
1390 NvSciError NvSciIpcGetEvent(NvSciIpcEndpoint handle, uint32_t *events);
1391 
1501 NvSciError NvSciIpcGetEventSafe(NvSciIpcEndpoint handle, uint32_t *events);
1502 
1503 #if defined(__QNX__)
1504 
1580 int32_t NvSciIpcWaitEventQnx(int32_t chid, int64_t microseconds, uint32_t bytes,
1581  void *pulse);
1582 
1591 NvSciError NvSciIpcSetQnxPulseParam(NvSciIpcEndpoint handle,
1592  int32_t coid, int16_t pulsePriority, int16_t pulseCode,
1593  void *pulseValue);
1594 
1673 NvSciError NvSciIpcSetQnxPulseParamSafe(NvSciIpcEndpoint handle,
1674  int32_t coid, int16_t pulsePriority, int16_t pulseCode);
1675 
1676 
1736 NvSciError NvSciIpcInspectEventQnx(int32_t chid, uint16_t numEvents,
1737  uint32_t epCount, NvSciIpcEndpoint **epHandleArray);
1738 #endif /* __QNX__ */
1739 
1786 NvSciError NvSciIpcGetAsyncErrors(NvSciIpcEndpoint handle, uint32_t* errors);
1787 
1845 NvSciError NvSciIpcEnableNotification(NvSciIpcEndpoint handle, bool flag);
1846 
1889  uint32_t majorVer,
1890  uint32_t minorVer,
1891  bool* isCompatible);
1892 
1896 #ifdef __cplusplus
1897 }
1898 #endif
1899 #endif /* INCLUDED_NVSCIIPC_H */
1900 
NvSciIpcEndpointAccessInfo
Defines access information about NvSciIpc endpoint.
Definition: nvsciipc.h:360
NvSciIpcWriteAdvance
NvSciError NvSciIpcWriteAdvance(NvSciIpcEndpoint handle)
Advance to the next write frame of the endpoint.
nvscievent.h
NVIDIA Software Communications Interface (SCI) : NvSci Event Service
NvSciIpcEndpointVuid
uint64_t NvSciIpcEndpointVuid
VUID(VM unique ID) of the NvSciIpc endpoint.
Definition: nvsciipc.h:352
NvSciIpcDeinit
void NvSciIpcDeinit(void)
De-initializes the NvSciIpc library.
NvSciIpcCloseEndpoint
void NvSciIpcCloseEndpoint(NvSciIpcEndpoint handle)
Closes an endpoint with the given handle.
NvSciIpcGetEndpointInfo
NvSciError NvSciIpcGetEndpointInfo(NvSciIpcEndpoint handle, NvSciIpcEndpointInfo *info)
Returns endpoint information.
NvSciIpcOpenEndpoint
NvSciError NvSciIpcOpenEndpoint(const char *endpoint, NvSciIpcEndpoint *handle)
Opens an endpoint with the given name.
NvSciIpcEndpointAccessInfo::notiIpaType
uint32_t notiIpaType
type of IPA to used to notify peer in inter-VM NVSCIIPC_TRAP_IPA, NVSCIIP_MSI_IPA
Definition: nvsciipc.h:376
NvSciIpcGetEventSafe
NvSciError NvSciIpcGetEventSafe(NvSciIpcEndpoint handle, uint32_t *events)
Get Events (safety version)
NvSciIpcOpenEndpointWithEventService
NvSciError NvSciIpcOpenEndpointWithEventService(const char *endpoint, NvSciIpcEndpoint *handle, NvSciEventService *eventService)
Opens an endpoint with the given name and event service.
NvSciIpcRead
NvSciError NvSciIpcRead(NvSciIpcEndpoint handle, void *buf, size_t size, int32_t *bytes)
Reads a frame from the endpoint.
NvSciEventNotifier
An abstract interface to notify event to event consumer and to register event handler of the event co...
Definition: nvscievent.h:457
NvSciIpcGetLinuxEventFd
NvSciError NvSciIpcGetLinuxEventFd(NvSciIpcEndpoint handle, int32_t *fd)
Returns the NvSciIpc file descriptor for a given endpoint.
NvSciIpcReadAdvance
NvSciError NvSciIpcReadAdvance(NvSciIpcEndpoint handle)
Advance to the next read frame of the endpoint.
NvSciIpcEndpointAccessInfo::backend
uint32_t backend
backend type of the endpoint NVSCIIPC_BACKEND_ITC, NVSCIIPC_BACKEND_IPC, NVSCIIPC_BACKEND_IVC,...
Definition: nvsciipc.h:366
NvSciIpcResetEndpointSafe
NvSciError NvSciIpcResetEndpointSafe(NvSciIpcEndpoint handle)
Resets an endpoint.
NvSciIpcEndpointAccessInfo::uid
uint32_t uid
User id per endpoint.
Definition: nvsciipc.h:378
NvSciIpcEndpointAccessInfo::gid
uint32_t gid
unique group id of the endpoint
Definition: nvsciipc.h:362
NvSciIpcResetEndpoint
void NvSciIpcResetEndpoint(NvSciIpcEndpoint handle)
Resets an endpoint.
NvSciIpcGetEvent
NvSciError NvSciIpcGetEvent(NvSciIpcEndpoint handle, uint32_t *events)
Get Events.
NvSciIpcEnableNotification
NvSciError NvSciIpcEnableNotification(NvSciIpcEndpoint handle, bool flag)
Enable event notification (or polling)
NvSciIpcReadGetNextFrame
NvSciError NvSciIpcReadGetNextFrame(NvSciIpcEndpoint handle, const volatile void **buf)
Get a pointer to the read frame from the endpoint.
NvSciIpcEndpointAccessInfo::id
int32_t id
Queue id (Intra-VM: 0 or 1, Inter-VM: IVC queue ID of PCT.
Definition: nvsciipc.h:372
NvSciIpcEndpoint
uint64_t NvSciIpcEndpoint
Handle to the NvSciIpc endpoint.
Definition: nvsciipc.h:314
NvSciIpcReadSafe
NvSciError NvSciIpcReadSafe(NvSciIpcEndpoint handle, void *buf, uint32_t size, uint32_t *bytes)
Reads a frame from the endpoint (safety version)
NvSciIpcEndpointAccessInfo::vuid
NvSciIpcEndpointVuid vuid
VM-wide unique id(VUID) per endpoint.
Definition: nvsciipc.h:368
NvSciIpcMinorVersion
static const uint32_t NvSciIpcMinorVersion
NvSciIpc API Minor version number.
Definition: nvsciipc.h:84
NvSciIpcWriteGetNextFrame
NvSciError NvSciIpcWriteGetNextFrame(NvSciIpcEndpoint handle, volatile void **buf)
Get a pointer to the write frame from the endpoint.
NvSciIpcEndpointAccessInfo::irq
int32_t irq
IRQ number of IVC signalling (inter-VM endpoint only) (-1: N/A)
Definition: nvsciipc.h:370
NvSciIpcInit
NvSciError NvSciIpcInit(void)
Initializes the NvSciIpc library.
NvSciIpcCloseCfgBlob
void NvSciIpcCloseCfgBlob(void)
Closes NvSciIpc ConfigBlob.
NvSciIpcCloseEndpointSafe
NvSciError NvSciIpcCloseEndpointSafe(NvSciIpcEndpoint handle, bool clear)
Closes an endpoint with the given handle (safety version)
NvSciIpcWrite
NvSciError NvSciIpcWrite(NvSciIpcEndpoint handle, const void *buf, size_t size, int32_t *bytes)
Writes a frame to the endpoint.
NvSciIpcOpenCfgBlob
NvSciError NvSciIpcOpenCfgBlob(void)
Opens NvSciIpc ConfigBlob.
handle
const WFDCommitType const WFDHandle handle
Definition: wfdext.h:532
NvSciIpcEndpointInfo::frame_size
uint32_t frame_size
Holds the frame size in bytes.
Definition: nvsciipc.h:388
NvSciIpcGetEventNotifier
NvSciError NvSciIpcGetEventNotifier(NvSciIpcEndpoint handle, NvSciEventNotifier **eventNotifier)
Get NvSciIpc event notifier.
NvSciIpcCheckVersionCompatibility
NvSciError NvSciIpcCheckVersionCompatibility(uint32_t majorVer, uint32_t minorVer, bool *isCompatible)
Check NvSciIpc library version compatibility.
NvSciIpcGetAsyncErrors
NvSciError NvSciIpcGetAsyncErrors(NvSciIpcEndpoint handle, uint32_t *errors)
Get asynchronouse errors.
NvSciIpcEndpointInfo::nframes
uint32_t nframes
Holds the number of frames.
Definition: nvsciipc.h:386
NvSciIpcEndpointInfo
Defines information about the NvSciIpc endpoint.
Definition: nvsciipc.h:384
NvSciIpcMajorVersion
static const uint32_t NvSciIpcMajorVersion
NvSciIpc API Major version number.
Definition: nvsciipc.h:81
NvSciIpcGetEndpointAccessInfo
NvSciError NvSciIpcGetEndpointAccessInfo(const char *endpoint, NvSciIpcEndpointAccessInfo *info)
Gets endpoint access information from ConfigBlob.
NvSciIpcWriteSafe
NvSciError NvSciIpcWriteSafe(NvSciIpcEndpoint handle, const void *buf, uint32_t size, uint32_t *bytes)
Writes a frame to the endpoint.
NvSciEventService
An abstract interface for a program's event handling infrastructure.
Definition: nvscievent.h:283