054bf836f1
* libhsakmt/virtio: Add alloc memory align api Signed-off-by: Honglei Huang <honghuan@amd.com> * libhsakmt/virtio: Rename CLGL BO to AMDGPU BO Rename VHSA_BO_CLGL to VHSA_BO_AMDGPU to support generic AMDGPU buffer objects, not just CL/GL interop. * libhsakmt/virtio: Add atomic helpers and node lookup Add vhsakmt_atomic_inc/dec macros and vhsakmt_get_node_by_id helper function. * libhsakmt/virtio: Add AMDGPU device initialization support Add vamdgpu_device_initialize and vamdgpu_device_deinitialize functions. * libhsakmt/virtio: Add AMDGPU device handle and DRM command support Add vamdgpu_device_get_fd, vdrmCommandWriteRead and update vhsaKmtGetAMDGPUDeviceHandle. * libhsakmt/virtio: Add AMDGPU BO free and CPU map support Add vamdgpu_bo_free and vamdgpu_bo_cpu_map functions. * libhsakmt/virtio: Add AMDGPU BO import and export support Add vamdgpu_bo_import, vamdgpu_bo_export and vhsakmt_bo_from_resid functions. * libhsakmt/virtio: Add AMDGPU BO VA operation support Add vamdgpu_bo_va_op function. * libhsakmt/virtio: Add dma buf export support Add vhsaKmtExportDMABufHandle API in virtio driver to support export feature. * libhsakmt/virtio: Fix potential deadlock in userptr deregistration Refactor vhsakmt_deregister_userptr_non_svm to avoid calling vhsakmt_destroy_userptr while holding the bo_handles_mutex lock. Previously, destroying userptrs directly while iterating the tree could cause deadlock issues due to nested locking. - Move interval tree removal from vhsakmt_destroy_userptr to caller - Collect BOs to free in a temporary array during tree traversal - Destroy BOs after releasing the mutex to avoid lock contention - Use dynamic array with realloc to handle arbitrary number of BOs Signed-off-by: Honglei Huang <honghuan@amd.com> * rocr: driver/virtio: Implement DMA-BUF import/export and memory mapping APIs Implement the missing DMA-BUF handling and memory mapping functions in the virtio KFD driver to enable cross-process memory sharing: - ExportDMABuf: Export HSA memory as DMA-BUF file descriptor - ImportDMABuf: Import DMA-BUF fd as shareable buffer object - Map: Map imported buffer into virtual address space with permissions - Unmap: Unmap buffer from virtual address space - ReleaseShareableHandle: Free imported buffer object Also add drm_perm() helper to convert HSA access permissions to AMDGPU VM page flags (READABLE/WRITEABLE). These APIs enable IPC memory sharing between HSA processes through DMA-BUF mechanism in virtualized environments. Signed-off-by: Honglei Huang <honghuan@amd.com> * libhsakmt/virtio: Add register memory APIs Add two new memory registration functions to the virtio HSA KMT library: 1. vhsaKmtRegisterMemory: A simplified wrapper for vhsaKmtRegisterMemoryWithFlags that uses default CoarseGrain memory flags. 2. vhsaKmtRegisterMemoryToNodes: A stub implementation for registering memory to specific nodes. Returns HSAKMT_STATUS_NOT_IMPLEMENTED as it's currently not used in ROCR. Changes: - Added function declarations in hsakmt_virtio.h - Implemented functions in hsakmt_virtio_memory.c - Exported symbols in libhsakmt_virtio.ver Signed-off-by: Honglei Huang <honghuan@amd.com> * libhsakmt/virtio: Add graphics handle registration and mapping APIs - Add vhsaKmtRegisterGraphicsHandleToNodesExt() with flags support - Add vhsaKmtMapGraphicHandle() and vhsaKmtUnmapGraphicHandle() stubs - Refactor existing registration API to use extended version Signed-off-by: Honglei Huang <honghuan@amd.com> * libhsakmt/virtio: Add virtio support for queue APIs Implement vhsaKmtUpdateQueue, vhsaKmtSetQueueCUMask, vhsaKmtAllocQueueGWS and vhsaKmtGetQueueInfo functions with virtio protocol extensions and symbol exports. Signed-off-by: Honglei Huang <honghuan@amd.com> * libhsakmt/virtio: Add new virtio API support for model, SMI, and XNACK mode Add three new API functions to the virtio backend: - vhsaKmtModelEnabled: Check if pre-silicon model is enabled (returns false for virtio) - vhsaKmtOpenSMI: Open SMI interface for a node (not yet supported in virtio) - vhsaKmtSetXNACKMode: Set XNACK mode via virtio control command Signed-off-by: Honglei Huang <honghuan@amd.com> * libhsakmt/virtio: Add shared memory support for virtio backend Implement shared memory APIs for the virtio backend to enable memory sharing between processes: - Add vhsaKmtShareMemory() to share memory regions and create shared memory handles - Add vhsaKmtRegisterSharedHandle() to register shared memory handles in the current process - Add vhsaKmtRegisterSharedHandleToNodes() for node-specific shared memory registration Signed-off-by: Honglei Huang <honghuan@amd.com> * libhsakmt/virtio: Add memory management APIs for virtio Add the following new memory management APIs to virtio implementation: - vhsaKmtSetMemoryUserData: Set user data for memory pointer - vhsaKmtSetMemoryPolicy: Configure memory policy for nodes - vhsaKmtSVMGetAttr: Get SVM (Shared Virtual Memory) attributes - vhsaKmtSVMSetAttr: Set SVM attributes - vhsaKmtReplaceAsanHeaderPage: ASAN header page replacement (stub) - vhsaKmtReturnAsanHeaderPage: ASAN header page return (stub) Changes include: - Added API declarations in hsakmt_virtio.h - Implemented functions in hsakmt_virtio_memory.c - Extended protocol definitions in hsakmt_virtio_proto.h - Added user_data field to vhsakmt_bo structure - Exported new symbols in libhsakmt_virtio.ver Signed-off-by: Honglei Huang <honghuan@amd.com> * libhsakmt/virtio: Add SPM APIs Add three new SPM-related APIs to the virtio interface: - vhsaKmtSPMAcquire: Acquire SPM resources on a preferred node - vhsaKmtSPMRelease: Release SPM resources on a preferred node - vhsaKmtSPMSetDestBuffer: Set destination buffer for SPM data with optional userptr support and data loss detection These APIs extend the virtio command protocol with new query types: - VHSAKMT_CCMD_QUERY_SPM_ACQUIRE - VHSAKMT_CCMD_QUERY_SPM_RELEASE - VHSAKMT_CCMD_QUERY_SPM_SET_DST_BUFFER The implementation includes proper buffer management for both direct BO access and userptr fallback for smaller buffers. Signed-off-by: Honglei Huang <honghuan@amd.com> * libhsakmt/virtio: Add virtio stub for hsaKmtAisReadWriteFile API Add vhsaKmtAisReadWriteFile stub implementation for the virtio backend to support AIS (Accelerated I/O Service) file read/write operations. This stub currently returns HSAKMT_STATUS_NOT_IMPLEMENTED. Changes include: - Add vhsaKmtAisReadWriteFile declaration in hsakmt_virtio.h - Add stub implementation in hsakmt_virtio_memory.c - Export the symbol in libhsakmt_virtio.ver Signed-off-by: energystoryhhl <energystoryhhl@users.noreply.github.com> * libhsakmt/virtio: Add vamdgpu_bo_query_info and vamdgpu_bo_set_metadata APIs Implement two new virtio wrapper functions for AMDGPU buffer object operations: 1. vamdgpu_bo_query_info: Query buffer object information including allocation parameters, memory usage, and metadata. 2. vamdgpu_bo_set_metadata: Set metadata for a buffer object, allowing applications to attach custom data to GPU memory allocations. Signed-off-by: Honglei Huang <honghuan@amd.com> * libhsakmt/virtio: Add ProcessVMRead/Write stub implementations for virtio Add vhsaKmtProcessVMRead and vhsaKmtProcessVMWrite stub functions to the virtio interface. These APIs return HSAKMT_STATUS_NOT_IMPLEMENTED since they are not supported in the baremetal implementation, matching the behavior of the deprecated hsaKmtProcessVMRead/Write APIs. Signed-off-by: energystoryhhl <energystoryhhl@users.noreply.github.com> --------- Signed-off-by: Honglei Huang <honghuan@amd.com> Signed-off-by: energystoryhhl <energystoryhhl@users.noreply.github.com> Co-authored-by: energystoryhhl <energystoryhhl@users.noreply.github.com>
202 rader
14 KiB
C
202 rader
14 KiB
C
/*
|
|
* Copyright © 2025 Advanced Micro Devices, Inc.
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person
|
|
* obtaining a copy of this software and associated documentation
|
|
* files (the "Software"), to deal in the Software without
|
|
* restriction, including without limitation the rights to use, copy,
|
|
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
* of the Software, and to permit persons to whom the Software is
|
|
* furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice (including
|
|
* the next paragraph) shall be included in all copies or substantial
|
|
* portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
* DEALINGS IN THE SOFTWARE.
|
|
*/
|
|
|
|
#ifndef HSAKMT_VIRTIO_H
|
|
#define HSAKMT_VIRTIO_H
|
|
|
|
#if defined(__linux__)
|
|
#include "hsakmt/linux/kfd_ioctl.h"
|
|
#endif
|
|
|
|
// Forward declaration for HsaKFDContext to avoid dependency issues
|
|
typedef struct _HsaKFDContext HsaKFDContext;
|
|
|
|
#include "hsakmt/hsakmt.h"
|
|
#include <libdrm/amdgpu.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtOpenKFD(void);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtCloseKFD(void);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtAllocMemory(HSAuint32 PreferredNode, HSAuint64 SizeInBytes,
|
|
HsaMemFlags MemFlags, void** MemoryAddress);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtAllocMemoryAlign(HSAuint32 PreferredNode, HSAuint64 SizeInBytes,
|
|
HSAuint64 Alignment, HsaMemFlags MemFlags,
|
|
void** MemoryAddress);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtFreeMemory(void* MemoryAddress, HSAuint64 SizeInBytes);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtMapMemoryToGPUNodes(void* MemoryAddress, HSAuint64 MemorySizeInBytes,
|
|
HSAuint64* AlternateVAGPU,
|
|
HsaMemMapFlags MemMapFlags,
|
|
HSAuint64 NumberOfNodes, HSAuint32* NodeArray);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtUnmapMemoryToGPU(void* MemoryAddress);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtAvailableMemory(HSAuint32 Node, HSAuint64* AvailableBytes);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtMapMemoryToGPU(void* MemoryAddress, HSAuint64 MemorySizeInBytes,
|
|
HSAuint64* AlternateVAGPU);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtRegisterMemoryWithFlags(void* MemoryAddress,
|
|
HSAuint64 MemorySizeInBytes,
|
|
HsaMemFlags MemFlags);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtRegisterMemory(void* MemoryAddress, HSAuint64 MemorySizeInBytes);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtRegisterMemoryToNodes(void* MemoryAddress,
|
|
HSAuint64 MemorySizeInBytes,
|
|
HSAuint32 NumberOfNodes, HSAuint32* NodeArray);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtDeregisterMemory(void* MemoryAddress);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtGetVersion(HsaVersionInfo* v);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtAcquireSystemProperties(HsaSystemProperties* SystemProperties);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtReleaseSystemProperties(void);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtGetNodeProperties(HSAuint32 NodeId,
|
|
HsaNodeProperties* NodeProperties);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtGetXNACKMode(HSAint32* enable);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtRuntimeEnable(void* rDebug, bool setupTtmp);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtRuntimeDisable(void);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtGetNodeMemoryProperties(HSAuint32 NodeId, HSAuint32 NumBanks,
|
|
HsaMemoryProperties* MemoryProperties);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtGetNodeCacheProperties(HSAuint32 NodeId, HSAuint32 ProcessorId,
|
|
HSAuint32 NumCaches,
|
|
HsaCacheProperties* CacheProperties);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtGetNodeIoLinkProperties(HSAuint32 NodeId, HSAuint32 NumIoLinks,
|
|
HsaIoLinkProperties* IoLinkProperties);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtGetClockCounters(HSAuint32 NodeId, HsaClockCounters* Counters);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtGetAMDGPUDeviceHandle(HSAuint32 NodeId,
|
|
HsaAMDGPUDeviceHandle* DeviceHandle);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtQueryPointerInfo(const void* Pointer, HsaPointerInfo* PointerInfo);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtGetTileConfig(HSAuint32 NodeId, HsaGpuTileConfig* config);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtCreateEvent(HsaEventDescriptor* EventDesc, _Bool ManualReset,
|
|
_Bool IsSignaled, HsaEvent** Event);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtDestroyEvent(HsaEvent* Event);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtSetEvent(HsaEvent* Event);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtResetEvent(HsaEvent* Event);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtQueryEventState(HsaEvent* Event);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtWaitOnMultipleEvents(HsaEvent* Events[], HSAuint32 NumEvents,
|
|
bool WaitOnAll, HSAuint32 Milliseconds);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtWaitOnEvent(HsaEvent* Event, HSAuint32 Milliseconds);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtWaitOnEvent_Ext(HsaEvent* Event, HSAuint32 Milliseconds,
|
|
uint64_t* event_age);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtWaitOnMultipleEvents_Ext(HsaEvent* Events[], HSAuint32 NumEvents,
|
|
bool WaitOnAll, HSAuint32 Milliseconds,
|
|
uint64_t* event_age);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtSetTrapHandler(HSAuint32 NodeId, void* TrapHandlerBaseAddress,
|
|
HSAuint64 TrapHandlerSizeInBytes,
|
|
void* TrapBufferBaseAddress,
|
|
HSAuint64 TrapBufferSizeInBytes);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtCreateQueueExt(HSAuint32 NodeId, HSA_QUEUE_TYPE Type,
|
|
HSAuint32 QueuePercentage,
|
|
HSA_QUEUE_PRIORITY Priority, HSAuint32 SdmaEngineId,
|
|
void* QueueAddress, HSAuint64 QueueSizeInBytes,
|
|
HsaEvent* Event, HsaQueueResource* QueueResource);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtCreateQueue(HSAuint32 NodeId, HSA_QUEUE_TYPE Type,
|
|
HSAuint32 QueuePercentage, HSA_QUEUE_PRIORITY Priority,
|
|
void* QueueAddress, HSAuint64 QueueSizeInBytes,
|
|
HsaEvent* Event, HsaQueueResource* QueueResource);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtDestroyQueue(HSA_QUEUEID QueueId);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtUpdateQueue(HSA_QUEUEID QueueId, HSAuint32 QueuePercentage,
|
|
HSA_QUEUE_PRIORITY Priority, void* QueueAddress,
|
|
HSAuint64 QueueSize, HsaEvent* Event);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtGetQueueInfo(HSA_QUEUEID QueueId, HsaQueueInfo* QueueInfo);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtSetQueueCUMask(HSA_QUEUEID QueueId, HSAuint32 CUMaskCount,
|
|
HSAuint32* QueueCUMask);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtAllocQueueGWS(HSA_QUEUEID QueueId, HSAuint32 nGWS,
|
|
HSAuint32* firstGWS);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtRegisterGraphicsHandleToNodesExt(
|
|
HSAuint64 GraphicsResourceHandle, HsaGraphicsResourceInfo* GraphicsResourceInfo,
|
|
HSAuint64 NumberOfNodes, HSAuint32* NodeArray, HSA_REGISTER_MEM_FLAGS RegisterFlags);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtRegisterGraphicsHandleToNodes(
|
|
HSAuint64 GraphicsResourceHandle, HsaGraphicsResourceInfo* GraphicsResourceInfo,
|
|
HSAuint64 NumberOfNodes, HSAuint32* NodeArray);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtMapGraphicHandle(HSAuint32 NodeId, HSAuint64 GraphicDeviceHandle,
|
|
HSAuint64 GraphicResourceHandle,
|
|
HSAuint64 GraphicResourceOffset,
|
|
HSAuint64 GraphicResourceSize,
|
|
HSAuint64* FlatMemoryAddress);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtUnmapGraphicHandle(HSAuint32 NodeId, HSAuint64 FlatMemoryAddress,
|
|
HSAuint64 SizeInBytes);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtExportDMABufHandle(void* MemoryAddress, HSAuint64 MemorySizeInBytes,
|
|
int* DMABufFd, HSAuint64* Offset);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtGetRuntimeCapabilities(HSAuint32* caps_mask);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtModelEnabled(bool* enable);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtOpenSMI(HSAuint32 NodeId, int* fd);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtSetXNACKMode(HSAint32 enable);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtShareMemory(void* MemoryAddress, HSAuint64 SizeInBytes,
|
|
HsaSharedMemoryHandle* SharedMemoryHandle);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtRegisterSharedHandleToNodes(
|
|
const HsaSharedMemoryHandle* SharedMemoryHandle, void** MemoryAddress, HSAuint64* SizeInBytes,
|
|
HSAuint64 NumberOfNodes, HSAuint32* NodeArray);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtRegisterSharedHandle(const HsaSharedMemoryHandle* SharedMemoryHandle,
|
|
void** MemoryAddress, HSAuint64* SizeInBytes);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtSetMemoryUserData(const void* Pointer, void* UserData);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtSetMemoryPolicy(HSAuint32 Node, HSAuint32 DefaultPolicy,
|
|
HSAuint32 AlternatePolicy,
|
|
void* MemoryAddressAlternate,
|
|
HSAuint64 MemorySizeInBytes);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtSVMGetAttr(void* start_addr, HSAuint64 size, unsigned int nattr,
|
|
HSA_SVM_ATTRIBUTE* attrs);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtSVMSetAttr(void* start_addr, HSAuint64 size, unsigned int nattr,
|
|
HSA_SVM_ATTRIBUTE* attrs);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtReplaceAsanHeaderPage(void* addr);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtReturnAsanHeaderPage(void* addr);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtSPMAcquire(HSAuint32 PreferredNode);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtSPMRelease(HSAuint32 PreferredNode);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtSPMSetDestBuffer(HSAuint32 PreferredNode, HSAuint32 SizeInBytes,
|
|
HSAuint32* timeout, HSAuint32* SizeCopied,
|
|
void* DestMemoryAddress, bool* isSPMDataLoss);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtAisReadWriteFile(void* MemoryAddress, HSAuint64 MemorySizeInBytes,
|
|
HSAint32 fd, HSAint64 file_offset,
|
|
HsaAisFlags AisFlags, HSAuint64* SizeCopiedInBytes,
|
|
HSAint32* status);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtProcessVMRead(HSAuint32 Pid, HsaMemoryRange* LocalMemoryArray,
|
|
HSAuint64 LocalMemoryArrayCount,
|
|
HsaMemoryRange* RemoteMemoryArray,
|
|
HSAuint64 RemoteMemoryArrayCount,
|
|
HSAuint64* SizeCopied);
|
|
HSAKMT_STATUS HSAKMTAPI vhsaKmtProcessVMWrite(HSAuint32 Pid, HsaMemoryRange* LocalMemoryArray,
|
|
HSAuint64 LocalMemoryArrayCount,
|
|
HsaMemoryRange* RemoteMemoryArray,
|
|
HSAuint64 RemoteMemoryArrayCount,
|
|
HSAuint64* SizeCopied);
|
|
|
|
int vamdgpu_query_gpu_info(amdgpu_device_handle dev, void* out);
|
|
int vamdgpu_device_initialize(int fd, uint32_t* major_version, uint32_t* minor_version,
|
|
amdgpu_device_handle* device_handle);
|
|
int vamdgpu_device_deinitialize(amdgpu_device_handle device_handle);
|
|
int vamdgpu_device_get_fd(amdgpu_device_handle device_handle);
|
|
int vdrmCommandWriteRead(int fd, unsigned long drmCommandIndex, void* data, unsigned long size);
|
|
int vamdgpu_bo_cpu_map(amdgpu_bo_handle buf_handle, void** cpu);
|
|
int vamdgpu_bo_free(amdgpu_bo_handle buf_handle);
|
|
int vamdgpu_bo_export(amdgpu_bo_handle buf_handle, enum amdgpu_bo_handle_type type,
|
|
uint32_t* shared_handle);
|
|
int vamdgpu_bo_import(amdgpu_device_handle dev, enum amdgpu_bo_handle_type type,
|
|
uint32_t shared_handle, struct amdgpu_bo_import_result* output);
|
|
int vamdgpu_bo_va_op(amdgpu_bo_handle bo, uint64_t offset, uint64_t size, uint64_t addr,
|
|
uint64_t flags, uint32_t ops);
|
|
int vamdgpu_bo_query_info(amdgpu_bo_handle bo, struct amdgpu_bo_info* info);
|
|
int vamdgpu_bo_set_metadata(amdgpu_bo_handle bo, struct amdgpu_bo_metadata* info);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* HSAKMT_VIRTIO_H */
|