Thunk API to allocate queue GWS
Change-Id: I6c5b109e2567cb71aed9245923cfcbeee6295ab2 Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
Αυτή η υποβολή περιλαμβάνεται σε:
@@ -571,6 +571,18 @@ hsaKmtUnmapGraphicHandle(
|
||||
HSAuint64 SizeInBytes //IN
|
||||
);
|
||||
|
||||
/**
|
||||
Allocate GWS resource for a queue
|
||||
*/
|
||||
|
||||
HSAKMT_STATUS
|
||||
HSAKMTAPI
|
||||
hsaKmtAllocQueueGWS(
|
||||
HSAuint32 NodeId, //IN
|
||||
HSA_QUEUEID QueueId, //IN
|
||||
HSAuint32 nGWS, //IN
|
||||
HSAuint32 *firstGWS //OUT
|
||||
);
|
||||
|
||||
/**
|
||||
Notifies the kernel driver that a process wants to use GPU debugging facilities
|
||||
|
||||
@@ -64,6 +64,7 @@ hsaKmtSetWaveLaunchTrapOverride;
|
||||
hsaKmtSetWaveLaunchMode;
|
||||
hsaKmtQueueSuspend;
|
||||
hsaKmtQueueResume;
|
||||
hsaKmtAllocQueueGWS;
|
||||
|
||||
local: *;
|
||||
};
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/mman.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
||||
/* 1024 doorbells, 4 or 8 bytes each doorbell depending on ASIC generation */
|
||||
#define DOORBELL_SIZE_GFX7 4
|
||||
@@ -817,3 +818,44 @@ uint32_t *convert_queue_ids(HSAuint32 NumQueues, HSA_QUEUEID *Queues)
|
||||
return queue_ids_ptr;
|
||||
}
|
||||
|
||||
HSAKMT_STATUS
|
||||
HSAKMTAPI
|
||||
hsaKmtAllocQueueGWS(
|
||||
HSAuint32 NodeId,
|
||||
HSA_QUEUEID QueueId,
|
||||
HSAuint32 nGWS,
|
||||
HSAuint32 *firstGWS)
|
||||
{
|
||||
struct kfd_ioctl_alloc_queue_gws_args args = {0};
|
||||
struct queue *q = PORT_UINT64_TO_VPTR(QueueId);
|
||||
HSAKMT_STATUS result;
|
||||
uint32_t gpu_id;
|
||||
|
||||
CHECK_KFD_OPEN();
|
||||
|
||||
result = validate_nodeid(NodeId, &gpu_id);
|
||||
if (result != HSAKMT_STATUS_SUCCESS) {
|
||||
pr_err("[%s] invalid node ID: %d\n", __func__, NodeId);
|
||||
return result;
|
||||
}
|
||||
|
||||
args.gpu_id = gpu_id;
|
||||
args.queue_id = (HSAuint32)q->queue_id;
|
||||
args.num_gws = nGWS;
|
||||
|
||||
int err = kmtIoctl(kfd_fd, AMDKFD_IOC_ALLOC_QUEUE_GWS, &args);
|
||||
|
||||
if (!err && firstGWS)
|
||||
*firstGWS = args.first_gws;
|
||||
|
||||
if (!err)
|
||||
return HSAKMT_STATUS_SUCCESS;
|
||||
else if (err == -EINVAL)
|
||||
return HSAKMT_STATUS_INVALID_PARAMETER;
|
||||
else if (err == -EBUSY)
|
||||
return HSAKMT_STATUS_OUT_OF_RESOURCES;
|
||||
else if (err == -ENODEV)
|
||||
return HSAKMT_STATUS_NOT_SUPPORTED;
|
||||
else
|
||||
return HSAKMT_STATUS_ERROR;
|
||||
}
|
||||
|
||||
Αναφορά σε νέο ζήτημα
Block a user