Remove deprecated implementation of hsaKmtMapGraphicHandle
The KFD implementation has been removed and will not be upstreamed.
This API has been superseded by hsaKmtRegisterGraphicsHandleToNodes.
Change-Id: I5f2d8da3260974618cdb6ea3fdcd77d37b82c9cb
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Amber Lin <Amber.Lin@amd.com>
[ROCm/ROCR-Runtime commit: 374bd89d8c]
Этот коммит содержится в:
коммит произвёл
Amber Lin
родитель
dd782c86c0
Коммит
fce3048015
@@ -326,20 +326,6 @@ struct kfd_ioctl_unmap_memory_from_gpu_args {
|
||||
uint32_t pad;
|
||||
};
|
||||
|
||||
/* TODO: remove this. It's only implemented for Kaveri and was never
|
||||
* upstreamed. There are no open-source users of this interface. It
|
||||
* has been superseded by the pair of get_dmabuf_info and
|
||||
* import_dmabuf, which is implemented for all supported GPUs.
|
||||
*/
|
||||
struct kfd_ioctl_open_graphic_handle_args {
|
||||
uint64_t va_addr; /* to KFD */
|
||||
uint64_t handle; /* from KFD */
|
||||
uint32_t gpu_id; /* to KFD */
|
||||
int graphic_device_fd; /* to KFD */
|
||||
uint32_t graphic_handle; /* to KFD */
|
||||
uint32_t pad;
|
||||
};
|
||||
|
||||
struct kfd_ioctl_set_process_dgpu_aperture_args {
|
||||
uint64_t dgpu_base;
|
||||
uint64_t dgpu_limit;
|
||||
@@ -537,11 +523,7 @@ struct kfd_ioctl_cross_memory_copy_args {
|
||||
#define AMDKFD_IOC_GET_QUEUE_WAVE_STATE \
|
||||
AMDKFD_IOWR(0x20, struct kfd_ioctl_get_queue_wave_state_args)
|
||||
|
||||
/* TODO: remove this */
|
||||
#define AMDKFD_IOC_OPEN_GRAPHIC_HANDLE \
|
||||
AMDKFD_IOWR(0x21, struct kfd_ioctl_open_graphic_handle_args)
|
||||
|
||||
#define AMDKFD_COMMAND_START 0x01
|
||||
#define AMDKFD_COMMAND_END 0x22
|
||||
#define AMDKFD_COMMAND_END 0x21
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1235,65 +1235,6 @@ void *fmm_allocate_host(uint32_t node_id, uint64_t MemorySizeInBytes,
|
||||
return fmm_allocate_host_cpu(MemorySizeInBytes, flags);
|
||||
}
|
||||
|
||||
void *fmm_open_graphic_handle(uint32_t gpu_id,
|
||||
int32_t graphic_device_handle,
|
||||
uint32_t graphic_handle,
|
||||
uint64_t MemorySizeInBytes)
|
||||
{
|
||||
|
||||
void *mem = NULL;
|
||||
int32_t i = gpu_mem_find_by_gpu_id(gpu_id);
|
||||
struct kfd_ioctl_open_graphic_handle_args open_graphic_handle_args;
|
||||
struct kfd_ioctl_unmap_memory_from_gpu_args unmap_args;
|
||||
|
||||
/* If not found or aperture isn't properly initialized/supported */
|
||||
if (i < 0 || !aperture_is_valid(gpu_mem[i].gpuvm_aperture.base,
|
||||
gpu_mem[i].gpuvm_aperture.limit))
|
||||
return NULL;
|
||||
|
||||
pthread_mutex_lock(&gpu_mem[i].gpuvm_aperture.fmm_mutex);
|
||||
/* Allocate address space */
|
||||
mem = aperture_allocate_area(&gpu_mem[i].gpuvm_aperture,
|
||||
MemorySizeInBytes, GPUVM_APP_OFFSET);
|
||||
if (!mem)
|
||||
goto out;
|
||||
|
||||
/* Allocate local memory */
|
||||
open_graphic_handle_args.gpu_id = gpu_id;
|
||||
open_graphic_handle_args.graphic_device_fd = graphic_device_handle;
|
||||
open_graphic_handle_args.graphic_handle = graphic_handle;
|
||||
open_graphic_handle_args.va_addr =
|
||||
VOID_PTRS_SUB(mem, gpu_mem[i].gpuvm_aperture.base);
|
||||
|
||||
if (kmtIoctl(kfd_fd, AMDKFD_IOC_OPEN_GRAPHIC_HANDLE,
|
||||
&open_graphic_handle_args))
|
||||
goto release_area;
|
||||
|
||||
/* Allocate object */
|
||||
if (!aperture_allocate_object(&gpu_mem[i].gpuvm_aperture, mem,
|
||||
open_graphic_handle_args.handle,
|
||||
MemorySizeInBytes, 0))
|
||||
goto release_mem;
|
||||
|
||||
pthread_mutex_unlock(&gpu_mem[i].gpuvm_aperture.fmm_mutex);
|
||||
|
||||
/* That's all. Just return the new address */
|
||||
return mem;
|
||||
|
||||
release_mem:
|
||||
unmap_args.handle = open_graphic_handle_args.handle;
|
||||
unmap_args.device_ids_array_ptr = 0;
|
||||
unmap_args.device_ids_array_size = 0;
|
||||
kmtIoctl(kfd_fd, AMDKFD_IOC_UNMAP_MEMORY_FROM_GPU, &unmap_args);
|
||||
release_area:
|
||||
aperture_release_area(&gpu_mem[i].gpuvm_aperture, mem,
|
||||
MemorySizeInBytes);
|
||||
out:
|
||||
pthread_mutex_unlock(&gpu_mem[i].gpuvm_aperture.fmm_mutex);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void __fmm_release(void *address, manageable_aperture_t *aperture)
|
||||
{
|
||||
struct kfd_ioctl_free_memory_of_gpu_args args;
|
||||
|
||||
@@ -53,10 +53,6 @@ void *fmm_allocate_device(uint32_t gpu_id, uint64_t MemorySizeInBytes, HsaMemFla
|
||||
void *fmm_allocate_doorbell(uint32_t gpu_id, uint64_t MemorySizeInBytes, uint64_t doorbell_offset);
|
||||
void *fmm_allocate_host(uint32_t node_id, uint64_t MemorySizeInBytes,
|
||||
HsaMemFlags flags);
|
||||
void *fmm_open_graphic_handle(uint32_t gpu_id,
|
||||
int32_t graphic_device_handle,
|
||||
uint32_t graphic_handle,
|
||||
uint64_t MemorySizeInBytes);
|
||||
void fmm_print(uint32_t node);
|
||||
bool fmm_is_inside_some_aperture(void *address);
|
||||
void fmm_release(void *address);
|
||||
|
||||
@@ -460,30 +460,12 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtMapGraphicHandle(HSAuint32 NodeId,
|
||||
HSAuint64 GraphicResourceSize,
|
||||
HSAuint64 *FlatMemoryAddress)
|
||||
{
|
||||
|
||||
CHECK_KFD_OPEN();
|
||||
HSAKMT_STATUS result;
|
||||
uint32_t gpu_id;
|
||||
void *graphic_handle;
|
||||
|
||||
if (GraphicResourceOffset != 0)
|
||||
return HSAKMT_STATUS_NOT_IMPLEMENTED;
|
||||
|
||||
result = validate_nodeid(NodeId, &gpu_id);
|
||||
if (result != HSAKMT_STATUS_SUCCESS)
|
||||
return result;
|
||||
|
||||
graphic_handle = fmm_open_graphic_handle(gpu_id,
|
||||
GraphicDeviceHandle,
|
||||
GraphicResourceHandle,
|
||||
GraphicResourceSize);
|
||||
|
||||
*FlatMemoryAddress = PORT_VPTR_TO_UINT64(graphic_handle);
|
||||
|
||||
if (*FlatMemoryAddress)
|
||||
return HSAKMT_STATUS_SUCCESS;
|
||||
else
|
||||
return HSAKMT_STATUS_NO_MEMORY;
|
||||
/* This API was only ever implemented in KFD for Kaveri and
|
||||
* was never upstreamed. There are no open-source users of
|
||||
* this interface. It has been superseded by
|
||||
* RegisterGraphicsHandleToNodes.
|
||||
*/
|
||||
return HSAKMT_STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
HSAKMT_STATUS HSAKMTAPI hsaKmtUnmapGraphicHandle(HSAuint32 NodeId,
|
||||
|
||||
Ссылка в новой задаче
Block a user