List of APIs to initialize/de-initialize NvSciBuf module.
Functions | |
| NvSciError | NvSciBufModuleOpen (NvSciBufModule *newModule) |
| Initializes and returns a new NvSciBufModule with no NvSciBufAttrLists, buffers, or NvSciBufObjs bound to it. More... | |
| void | NvSciBufModuleClose (NvSciBufModule module) |
| Releases the NvSciBufModule obtained through an earlier call to NvSciBufModuleOpen(). More... | |
| NvSciError | NvSciBufCheckVersionCompatibility (uint32_t majorVer, uint32_t minorVer, bool *isCompatible) |
| Checks if loaded NvSciBuf library version is compatible with NvSciBuf library version with which elements dependent on NvSciBuf were built. More... | |
| NvSciError | NvSciBufObjValidate (NvSciBufObj bufObj) |
| Validates the NvSciBufObj satisfies the constraints of the NvSciBufAttrList that it is associated with. More... | |
| NvSciError | NvSciBufAttrListValidateReconciledAgainstAttrs (const NvSciBufAttrList reconciledAttrList, const NvSciBufAttrKeyValuePair *pairArray, const size_t pairCount) |
| Validate the reconciled NvSciBufAttrList against the set of all attributes that the user has set in the unreconciled NvSciBufAttrList(s). More... | |
| NvSciError | NvSciBufObjGetMaxPerm (const NvSciBufObj bufObj, const NvSciIpcEndpoint ipcEndpoint, NvSciBufAttrValAccessPerm *accPerm) |
| Retrieve the NvSciBufAttrValAccessPerm of an NvSciBufObj for given NvSciIpcEndpoint. More... | |
| NvSciError | NvSciBufObjGetDmaBufFd (NvSciBufObj bufObj, int *fd) |
| Generate a new dma-buf file descriptor corresponding to the provided NvSciBufObj. More... | |
| NvSciError | NvSciBufObjGetDmaMap (NvSciBufObj bufObj, uint64_t hid, uint64_t *pIovaAddr) |
| Map the buffer represented by bufObj into a hardware engine's IOVA space via the SMMU and return the contiguous IOVA address. More... | |
| NvSciError | NvSciBufObjGetDmaMapAtAddr (NvSciBufObj bufObj, uint64_t hid, uint64_t fixedIovaAddr, uint64_t *pActualIovaAddr) |
| Same as NvSciBufObjGetDmaMap, but install the mapping at a caller-specified IOVA. More... | |
| NvSciError | NvSciBufObjUnmapDma (NvSciBufObj bufObj, uint64_t hid, uint64_t iovaAddr) |
| Tear down a DMA IOVA mapping previously created via either NvSciBufObjGetDmaMap or NvSciBufObjGetDmaMapAtAddr. More... | |
| NvSciError NvSciBufAttrListValidateReconciledAgainstAttrs | ( | const NvSciBufAttrList | reconciledAttrList, |
| const NvSciBufAttrKeyValuePair * | pairArray, | ||
| const size_t | pairCount | ||
| ) |
Validate the reconciled NvSciBufAttrList against the set of all attributes that the user has set in the unreconciled NvSciBufAttrList(s).
This API provides the safety mechanism to detect and report any reconciliation errors.
| [in] | reconciledAttrList | reconciled NvSciBufAttrList that need to be validated |
| [in] | pairArray | Array of NvSciBufAttrKeyValuePair structures that the user has used to set in the unreconciled NvSciBufAttrList. Valid value: pairArray is valid input if it is not NULL and key member of every NvSciBufAttrKeyValuePair in the array is a valid enumeration value defined by the NvSciBufAttrKey enum and value member of every NvSciBufAttrKeyValuePair in the array is not NULL. |
| [in] | pairCount | Number of elements/entries in pairArray. Valid value: pairCount is valid input if it is non-zero. |
Usage considerations
| NvSciError NvSciBufCheckVersionCompatibility | ( | uint32_t | majorVer, |
| uint32_t | minorVer, | ||
| bool * | isCompatible | ||
| ) |
Checks if loaded NvSciBuf library version is compatible with NvSciBuf library version with which elements dependent on NvSciBuf were built.
This function checks loaded NvSciBuf library version with input NvSciBuf library version and sets output variable true provided major version of the loaded library is same as majorVer and minor version of the loaded library is not less than minorVer.
| [in] | majorVer | build major version. Valid value: majorVer is NvSciBufMajorVersion. |
| [in] | minorVer | build minor version. Valid value: [0 - <= NvSciBufMajorVersion]. |
| [out] | isCompatible | boolean value stating if loaded NvSciBuf library is compatible or not. |
Usage considerations
| void NvSciBufModuleClose | ( | NvSciBufModule | module | ) |
Releases the NvSciBufModule obtained through an earlier call to NvSciBufModuleOpen().
Once the NvSciBufModule is closed and all NvSciBufAttrLists and NvSciBufObjs bound to it are freed, the NvSciBufModule will be de-initialized in the calling process.
| [in] | module | The NvSciBufModule to close. |
Usage considerations
| NvSciError NvSciBufModuleOpen | ( | NvSciBufModule * | newModule | ) |
Initializes and returns a new NvSciBufModule with no NvSciBufAttrLists, buffers, or NvSciBufObjs bound to it.
| [out] | newModule | The new NvSciBufModule. |
Usage considerations
| NvSciError NvSciBufObjGetDmaBufFd | ( | NvSciBufObj | bufObj, |
| int * | fd | ||
| ) |
Generate a new dma-buf file descriptor corresponding to the provided NvSciBufObj.
This API is specific to Linux OS.
| [in] | bufObj | NvSciBufObj from which new file descriptor is generated |
| [out] | fd | dma-buf File Descriptor corresponding to the underlying memory of the NvSciBufObj. The caller owns this returned file descriptor and is responsible for closing the file descriptor. Valid Value: non NULL Pointer. |
Usage considerations
| NvSciError NvSciBufObjGetDmaMap | ( | NvSciBufObj | bufObj, |
| uint64_t | hid, | ||
| uint64_t * | pIovaAddr | ||
| ) |
Map the buffer represented by bufObj into a hardware engine's IOVA space via the SMMU and return the contiguous IOVA address.
Use this when an off-CPU consumer (e.g. PCIe eDMA, VIC) needs an SMMU-contiguous IOVA over a buffer that NvSciBuf allocated and shared. The mapping persists until NvSciBufObjUnmapDma is called with the same hid and the returned address. The SMMU mapping inherits bufObj 's reconciled access permission; bufObj must have been reconciled with at least NvSciBufAccessPerm_Readonly.
This API is specific to QNX/Tegra.
Buffers reconciled with a consumer engine that NvSciBufHwEngName documents as isochronous are not supported and cause this call to return NvSciError_AccessDenied.
The PCIe-side peer's unreconciled attribute list must set NvSciBufGeneralAttrKey_PeerHwEngineArray to include a NvSciBufHwEngName_PCIe entry, and must set NvSciBufGeneralAttrKey_PeerLocationInfo with the remote SoC ID. Buffers reconciled without these constraints may fail to map, or map but transfer incorrectly, because their pitch, alignment or contiguity is not guaranteed to satisfy PCIe-side requirements.
NvSciBuf does not transmit buffer metadata (represented by the datatype attribute keys, e.g. pitch, plane offsets, alignment padding) across the PCIe link; the remote consumer of the IOVA cannot derive layout from the IOVA alone. The producer is responsible for communicating that metadata out-of-band. Applies equally to NvSciBufObjGetDmaMapAtAddr.
| [in] | bufObj | NvSciBufObj to map. |
| [in] | hid | SMMU StreamID of the target engine. Not necessarily 1:1 with NvSciBufHwEngName — an engine class may have multiple instances, each with its own StreamID. |
| [out] | pIovaAddr | On success, receives the contiguous IOVA address to program into the consumer's descriptor. Valid Value: non NULL pointer. |
Usage considerations
| NvSciError NvSciBufObjGetDmaMapAtAddr | ( | NvSciBufObj | bufObj, |
| uint64_t | hid, | ||
| uint64_t | fixedIovaAddr, | ||
| uint64_t * | pActualIovaAddr | ||
| ) |
Same as NvSciBufObjGetDmaMap, but install the mapping at a caller-specified IOVA.
Required by streaming protocols (e.g. PCIe eDMA ring buffers) where the producer and consumer agree on a fixed device address up front.
This API is specific to QNX/Tegra.
fixedIovaAddr must be 4 KiB aligned (the worst-case SMMU page size assumed by NvSciBuf), must lie within the engine's SMMU aperture, and must not collide with any existing mapping in that engine's SMMU domain. Failure of any of these returns NvSciError_ResourceError without installing a mapping.
On NvSciError_Success, *pActualIovaAddr is guaranteed to equal fixedIovaAddr; the implementation never silently relocates a colliding request. A NvSciError_Success return may therefore be treated as proof that DMA descriptors targeting fixedIovaAddr will land at the buffer's pages. This is safe under concurrency: if multiple callers target the same IOVA on the same engine, exactly one succeeds and the rest return NvSciError_ResourceError. The successful mapping is never disturbed by a losing caller.
On QNX, fixed-IOVA requests are honoured only against IOVA windows previously reserved on the engine's hwid through the platform's IOVA reservation interface, with the fixed-IOVA mode set. Calls outside any reserved window return NvSciError_ResourceError. Reserving a window requires the launcher to grant the process the RESERVE_IOVA_REGION_INTERFACE_ABILITY ability under "NvMap/Interfaces"; without it the reservation fails and this API returns NvSciError_AccessDenied for any subsequent fixed-IOVA call.
The isochronous-engine restriction (see NvSciBufHwEngName) and the reconciliation/image-layout requirements documented on NvSciBufObjGetDmaMap apply unchanged.
| [in] | bufObj | NvSciBufObj to map. |
| [in] | hid | SMMU StreamID identifying the consumer that will access the buffer; see NvSciBufObjGetDmaMap for the full description of this parameter. |
| [in] | fixedIovaAddr | IOVA at which the mapping must be installed. Valid Value: non-zero, 4 KiB aligned. |
| [out] | pActualIovaAddr | On success, receives the IOVA actually installed. Per the no-relocation contract above, this equals fixedIovaAddr. Valid Value: non NULL pointer. |
Usage considerations
| NvSciError NvSciBufObjGetMaxPerm | ( | const NvSciBufObj | bufObj, |
| const NvSciIpcEndpoint | ipcEndpoint, | ||
| NvSciBufAttrValAccessPerm * | accPerm | ||
| ) |
Retrieve the NvSciBufAttrValAccessPerm of an NvSciBufObj for given NvSciIpcEndpoint.
Application can use this API to ensure that when an NvSciBufObj is exported with NvSciBufAccessPerm_Auto, the NvSciBufObj will be exported with appropriate NvSciBufAttrValAccessPerm expected by the application.
| [in] | bufObj | object for which access permissions need to be retrieved. |
| [in] | ipcEndpoint | NvSciIpcEndpoint of the peer for which the permissions need to retrieved. Valid value: valid NvSciIpcEndpoint returned by NvSciIpc to identify the peer. |
| [out] | accPerm | address at which the retrieved access permissions need to be stored. Valid Value: non NULL Pointer. |
Usage considerations
| NvSciError NvSciBufObjUnmapDma | ( | NvSciBufObj | bufObj, |
| uint64_t | hid, | ||
| uint64_t | iovaAddr | ||
| ) |
Tear down a DMA IOVA mapping previously created via either NvSciBufObjGetDmaMap or NvSciBufObjGetDmaMapAtAddr.
The same call serves both flavours: the underlying SMMU manager does not distinguish fixed from dynamically-assigned mappings at unmap time.
This API is specific to QNX/Tegra.
The (bufObj, iovaAddr) pair is the caller's responsibility. iovaAddr must be an address returned by a prior NvSciBufObjGetDmaMap or NvSciBufObjGetDmaMapAtAddr call against either bufObj itself or a peer NvSciBufObj backing the same underlying memory (for example one obtained via NvSciBufObjDup or NvSciBufObjIpcImport). NvSciBuf does not track per-NvSciBufObj IOVAs and cannot validate the pair; the call is a thin pass-through that resolves bufObj to its underlying memory handle and forwards the unmap to the SMMU manager.
Passing an iovaAddr that does not name a current mapping under bufObj 's memory handle is undefined and may be destructive: the call may succeed and act as a no-op, may succeed and tear down a different mapping under the same memory handle, or may return NvSciError_ResourceError.
A redundant unmap of a (memory handle, IOVA) pair that has already been torn down (double-unmap) returns NvSciError_ResourceError; there is no distinguishable "already unmapped" success code.
| [in] | bufObj | NvSciBufObj whose mapping is being released. |
| [in] | hid | SMMU StreamID; must match the value passed to the corresponding map call. See NvSciBufObjGetDmaMap for the full description of this parameter. |
| [in] | iovaAddr | IOVA returned by the map call. Valid Value: non-zero. |
Usage considerations
| NvSciError NvSciBufObjValidate | ( | NvSciBufObj | bufObj | ) |
Validates the NvSciBufObj satisfies the constraints of the NvSciBufAttrList that it is associated with.
| [in] | bufObj | The NvSciBufObj to validate |
Usage considerations