aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd
diff options
context:
space:
mode:
authorOded Gabbay <oded.gabbay@amd.com>2015-01-15 05:07:48 -0500
committerOded Gabbay <oded.gabbay@amd.com>2015-01-15 05:07:48 -0500
commit939f4a20a7468fa6903d5b55bc8d5eb3afdeb012 (patch)
tree237201cce70e002079f6ee99a6af2164fe23dd13 /drivers/gpu/drm/amd
parentc51841fbbb566fa9cdf14c5263377969ed3f92cb (diff)
drm/amdkfd: Remove sync_with_hw() from amdkfd
This patch completely removes the sync_with_hw() because it was broken and actually there is no point of using it. This function was used to: - Make sure that the submitted packet to the HIQ (which is a kernel queue) was read by the CP. However, it was discovered that the method this function used to do that (checking wptr == rptr) is not consistent with how the actual CP firmware works in all cases. - Make sure that the queue is empty before issuing the next packet. To achieve that, the function blocked amdkfd from continuing until the recently submitted packet was consumed. However, the acquire_packet_buffer() already checks if there is enough room for a new packet so calling sync_with_hw() is redundant. Signed-off-by: Oded Gabbay <oded.gabbay@amd.com> Acked-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd')
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c24
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.h2
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c4
3 files changed, 0 insertions, 30 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c b/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c
index 75950ed7a1bc..c04b1ac60bd9 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c
@@ -262,28 +262,6 @@ static void submit_packet(struct kernel_queue *kq)
262 kq->pending_wptr); 262 kq->pending_wptr);
263} 263}
264 264
265static int sync_with_hw(struct kernel_queue *kq, unsigned long timeout_ms)
266{
267 unsigned long org_timeout_ms;
268
269 BUG_ON(!kq);
270
271 org_timeout_ms = timeout_ms;
272 timeout_ms += jiffies * 1000 / HZ;
273 while (*kq->wptr_kernel != *kq->rptr_kernel) {
274 if (time_after(jiffies * 1000 / HZ, timeout_ms)) {
275 pr_err("kfd: kernel_queue %s timeout expired %lu\n",
276 __func__, org_timeout_ms);
277 pr_err("kfd: wptr: %d rptr: %d\n",
278 *kq->wptr_kernel, *kq->rptr_kernel);
279 return -ETIME;
280 }
281 schedule();
282 }
283
284 return 0;
285}
286
287static void rollback_packet(struct kernel_queue *kq) 265static void rollback_packet(struct kernel_queue *kq)
288{ 266{
289 BUG_ON(!kq); 267 BUG_ON(!kq);
@@ -305,7 +283,6 @@ struct kernel_queue *kernel_queue_init(struct kfd_dev *dev,
305 kq->ops.uninitialize = uninitialize; 283 kq->ops.uninitialize = uninitialize;
306 kq->ops.acquire_packet_buffer = acquire_packet_buffer; 284 kq->ops.acquire_packet_buffer = acquire_packet_buffer;
307 kq->ops.submit_packet = submit_packet; 285 kq->ops.submit_packet = submit_packet;
308 kq->ops.sync_with_hw = sync_with_hw;
309 kq->ops.rollback_packet = rollback_packet; 286 kq->ops.rollback_packet = rollback_packet;
310 287
311 switch (dev->device_info->asic_family) { 288 switch (dev->device_info->asic_family) {
@@ -349,7 +326,6 @@ static __attribute__((unused)) void test_kq(struct kfd_dev *dev)
349 for (i = 0; i < 5; i++) 326 for (i = 0; i < 5; i++)
350 buffer[i] = kq->nop_packet; 327 buffer[i] = kq->nop_packet;
351 kq->ops.submit_packet(kq); 328 kq->ops.submit_packet(kq);
352 kq->ops.sync_with_hw(kq, 1000);
353 329
354 pr_err("kfd: ending kernel queue test\n"); 330 pr_err("kfd: ending kernel queue test\n");
355} 331}
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.h b/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.h
index 2659d936ba73..594053136ee4 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.h
@@ -61,8 +61,6 @@ struct kernel_queue_ops {
61 unsigned int **buffer_ptr); 61 unsigned int **buffer_ptr);
62 62
63 void (*submit_packet)(struct kernel_queue *kq); 63 void (*submit_packet)(struct kernel_queue *kq);
64 int (*sync_with_hw)(struct kernel_queue *kq,
65 unsigned long timeout_ms);
66 void (*rollback_packet)(struct kernel_queue *kq); 64 void (*rollback_packet)(struct kernel_queue *kq);
67}; 65};
68 66
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c
index 5fb5c032d5d8..e2533d875f43 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c
@@ -376,7 +376,6 @@ int pm_send_set_resources(struct packet_manager *pm,
376 packet->queue_mask_hi = upper_32_bits(res->queue_mask); 376 packet->queue_mask_hi = upper_32_bits(res->queue_mask);
377 377
378 pm->priv_queue->ops.submit_packet(pm->priv_queue); 378 pm->priv_queue->ops.submit_packet(pm->priv_queue);
379 pm->priv_queue->ops.sync_with_hw(pm->priv_queue, KFD_HIQ_TIMEOUT);
380 379
381 mutex_unlock(&pm->lock); 380 mutex_unlock(&pm->lock);
382 381
@@ -413,7 +412,6 @@ int pm_send_runlist(struct packet_manager *pm, struct list_head *dqm_queues)
413 goto fail_create_runlist; 412 goto fail_create_runlist;
414 413
415 pm->priv_queue->ops.submit_packet(pm->priv_queue); 414 pm->priv_queue->ops.submit_packet(pm->priv_queue);
416 pm->priv_queue->ops.sync_with_hw(pm->priv_queue, KFD_HIQ_TIMEOUT);
417 415
418 mutex_unlock(&pm->lock); 416 mutex_unlock(&pm->lock);
419 417
@@ -460,7 +458,6 @@ int pm_send_query_status(struct packet_manager *pm, uint64_t fence_address,
460 packet->data_lo = lower_32_bits((uint64_t)fence_value); 458 packet->data_lo = lower_32_bits((uint64_t)fence_value);
461 459
462 pm->priv_queue->ops.submit_packet(pm->priv_queue); 460 pm->priv_queue->ops.submit_packet(pm->priv_queue);
463 pm->priv_queue->ops.sync_with_hw(pm->priv_queue, KFD_HIQ_TIMEOUT);
464 mutex_unlock(&pm->lock); 461 mutex_unlock(&pm->lock);
465 462
466 return 0; 463 return 0;
@@ -538,7 +535,6 @@ int pm_send_unmap_queue(struct packet_manager *pm, enum kfd_queue_type type,
538 }; 535 };
539 536
540 pm->priv_queue->ops.submit_packet(pm->priv_queue); 537 pm->priv_queue->ops.submit_packet(pm->priv_queue);
541 pm->priv_queue->ops.sync_with_hw(pm->priv_queue, KFD_HIQ_TIMEOUT);
542 538
543 mutex_unlock(&pm->lock); 539 mutex_unlock(&pm->lock);
544 return 0; 540 return 0;