Fix type mismatch passed to queue suspend/resume
The queue IDs passed over to the kernel via kfd_ioctl_dbg_trap_args->ptr
should be a list of uint32_t's. Need to convert from the passed in
64 bit HSA_QUEUEID to 32 bit uint32_t's.
Change-Id: I8718566d9f9ffc90ce0b2ecc129b10c49d73186a
Signed-off-by: Philip Cox <Philip.Cox@amd.com>
[ROCm/ROCR-Runtime commit: 608bc7c3a0]
Cette révision appartient à :
@@ -440,15 +440,25 @@ hsaKmtQueueSuspend(
|
||||
HSAuint32 GracePeriod, // IN
|
||||
HSAuint32 Flags) // IN
|
||||
{
|
||||
HSAKMT_STATUS result;
|
||||
uint32_t *queue_ids_ptr;
|
||||
|
||||
CHECK_KFD_OPEN();
|
||||
|
||||
return debug_trap(INVALID_NODEID,
|
||||
queue_ids_ptr = convert_queue_ids(NumQueues, Queues);
|
||||
if (!queue_ids_ptr)
|
||||
return HSAKMT_STATUS_NO_MEMORY;
|
||||
|
||||
result = debug_trap(INVALID_NODEID,
|
||||
KFD_IOC_DBG_TRAP_NODE_SUSPEND,
|
||||
Flags,
|
||||
NumQueues,
|
||||
GracePeriod,
|
||||
Pid,
|
||||
(HSAuint64)Queues);
|
||||
(HSAuint64)queue_ids_ptr);
|
||||
|
||||
free(queue_ids_ptr);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Resume the execution of a set of queues. If a queue is not
|
||||
@@ -493,14 +503,22 @@ hsaKmtQueueResume(
|
||||
HSA_QUEUEID *Queues, // IN
|
||||
HSAuint32 Flags) // IN
|
||||
{
|
||||
HSAKMT_STATUS result;
|
||||
uint32_t *queue_ids_ptr;
|
||||
|
||||
CHECK_KFD_OPEN();
|
||||
|
||||
return debug_trap(INVALID_NODEID,
|
||||
queue_ids_ptr = convert_queue_ids(NumQueues, Queues);
|
||||
if (!queue_ids_ptr)
|
||||
return HSAKMT_STATUS_NO_MEMORY;
|
||||
|
||||
result = debug_trap(INVALID_NODEID,
|
||||
KFD_IOC_DBG_TRAP_NODE_RESUME,
|
||||
Flags,
|
||||
NumQueues,
|
||||
0,
|
||||
Pid,
|
||||
(HSAuint64) Queues);
|
||||
(HSAuint64)queue_ids_ptr);
|
||||
free(queue_ids_ptr);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -136,6 +136,7 @@ HSAKMT_STATUS init_device_debugging_memory(unsigned int NumNodes);
|
||||
void destroy_device_debugging_memory(void);
|
||||
HSAKMT_STATUS init_counter_props(unsigned int NumNodes);
|
||||
void destroy_counter_props(void);
|
||||
uint32_t *convert_queue_ids(HSAuint32 NumQueues, HSA_QUEUEID *Queues);
|
||||
|
||||
extern int kmtIoctl(int fd, unsigned long request, void *arg);
|
||||
|
||||
|
||||
@@ -800,3 +800,20 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtSetTrapHandler(HSAuint32 Node,
|
||||
return (err == -1) ? HSAKMT_STATUS_ERROR : HSAKMT_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t *convert_queue_ids(HSAuint32 NumQueues, HSA_QUEUEID *Queues)
|
||||
{
|
||||
uint32_t *queue_ids_ptr;
|
||||
unsigned int i;
|
||||
|
||||
queue_ids_ptr = malloc(NumQueues * sizeof(uint32_t));
|
||||
if (!queue_ids_ptr)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < NumQueues; i++) {
|
||||
struct queue *q = PORT_UINT64_TO_VPTR(Queues[i]);
|
||||
|
||||
queue_ids_ptr[i] = q->queue_id;
|
||||
}
|
||||
return queue_ids_ptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -222,6 +222,7 @@ TEST_F(KFDDBGTest, BasicDebuggerSuspendResume) {
|
||||
m_pIsaGen->CompileShader(iterate_isa_gfx9, "iterate_isa", isaBuffer);
|
||||
|
||||
PM4Queue queue1;
|
||||
HsaQueueResource *qResources;
|
||||
HSA_QUEUEID queue_ids[2];
|
||||
|
||||
ASSERT_SUCCESS(queue1.Create(defaultGPUNode));
|
||||
@@ -243,7 +244,8 @@ TEST_F(KFDDBGTest, BasicDebuggerSuspendResume) {
|
||||
|
||||
// Submit the shader, queue1
|
||||
dispatch1->Submit(queue1);
|
||||
queue_ids[0] = 0;
|
||||
qResources = queue1.GetResource();
|
||||
queue_ids[0] = qResources->QueueId;
|
||||
|
||||
ASSERT_SUCCESS(hsaKmtQueueSuspend(
|
||||
INVALID_PID,
|
||||
|
||||
Référencer dans un nouveau ticket
Bloquer un utilisateur