diff options
author | Dave Airlie <airlied@redhat.com> | 2016-09-27 20:25:42 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2016-09-27 20:25:42 -0400 |
commit | 196ebdcc1db26977948c760664f024fa766950e4 (patch) | |
tree | 5dbc07df48744d1808ccae841e17a227798c11f4 | |
parent | 52f13a02b7d5f26feb69bf955bef10fbfaafbd7c (diff) | |
parent | e88a614c403573e861f82c063d8aee25cf109f17 (diff) |
Merge tag 'drm-amdkfd-next-2016-09-19' of git://people.freedesktop.org/~gabbayo/linux into drm-next
This is amdkfd's pull request for kernel 4.9. It contains a fix to a possible
infinite loop bug and a couple of other minor "cleaning" patches.
* tag 'drm-amdkfd-next-2016-09-19' of git://people.freedesktop.org/~gabbayo/linux:
drm/amdkfd: Pass 'struct queue_propertices' by reference
drm/amdkfd: Unify multiple calls to pr_debug() into one
drm/amdkfd: Fix possible infinite loop
drm/amdkfd: Reuse function to find a process through pasid
drm/amdkfd: Add some missing memset zero'ing in queue init func
drm/amdkfd: Tidy up kfd_generate_gpu_id() uint64_t bitshift unpack
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c | 17 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v8.c | 17 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdkfd/kfd_doorbell.c | 16 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c | 5 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdkfd/kfd_process.c | 61 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdkfd/kfd_queue.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 8 |
9 files changed, 65 insertions, 67 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c index 362bedc9e507..1a0a5f7cccbc 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c | |||
@@ -103,11 +103,11 @@ static bool kgd_hqd_is_occupied(struct kgd_dev *kgd, uint64_t queue_address, | |||
103 | uint32_t pipe_id, uint32_t queue_id); | 103 | uint32_t pipe_id, uint32_t queue_id); |
104 | 104 | ||
105 | static int kgd_hqd_destroy(struct kgd_dev *kgd, uint32_t reset_type, | 105 | static int kgd_hqd_destroy(struct kgd_dev *kgd, uint32_t reset_type, |
106 | unsigned int timeout, uint32_t pipe_id, | 106 | unsigned int utimeout, uint32_t pipe_id, |
107 | uint32_t queue_id); | 107 | uint32_t queue_id); |
108 | static bool kgd_hqd_sdma_is_occupied(struct kgd_dev *kgd, void *mqd); | 108 | static bool kgd_hqd_sdma_is_occupied(struct kgd_dev *kgd, void *mqd); |
109 | static int kgd_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd, | 109 | static int kgd_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd, |
110 | unsigned int timeout); | 110 | unsigned int utimeout); |
111 | static int kgd_address_watch_disable(struct kgd_dev *kgd); | 111 | static int kgd_address_watch_disable(struct kgd_dev *kgd); |
112 | static int kgd_address_watch_execute(struct kgd_dev *kgd, | 112 | static int kgd_address_watch_execute(struct kgd_dev *kgd, |
113 | unsigned int watch_point_id, | 113 | unsigned int watch_point_id, |
@@ -437,11 +437,12 @@ static bool kgd_hqd_sdma_is_occupied(struct kgd_dev *kgd, void *mqd) | |||
437 | } | 437 | } |
438 | 438 | ||
439 | static int kgd_hqd_destroy(struct kgd_dev *kgd, uint32_t reset_type, | 439 | static int kgd_hqd_destroy(struct kgd_dev *kgd, uint32_t reset_type, |
440 | unsigned int timeout, uint32_t pipe_id, | 440 | unsigned int utimeout, uint32_t pipe_id, |
441 | uint32_t queue_id) | 441 | uint32_t queue_id) |
442 | { | 442 | { |
443 | struct amdgpu_device *adev = get_amdgpu_device(kgd); | 443 | struct amdgpu_device *adev = get_amdgpu_device(kgd); |
444 | uint32_t temp; | 444 | uint32_t temp; |
445 | int timeout = utimeout; | ||
445 | 446 | ||
446 | acquire_queue(kgd, pipe_id, queue_id); | 447 | acquire_queue(kgd, pipe_id, queue_id); |
447 | WREG32(mmCP_HQD_PQ_DOORBELL_CONTROL, 0); | 448 | WREG32(mmCP_HQD_PQ_DOORBELL_CONTROL, 0); |
@@ -452,9 +453,8 @@ static int kgd_hqd_destroy(struct kgd_dev *kgd, uint32_t reset_type, | |||
452 | temp = RREG32(mmCP_HQD_ACTIVE); | 453 | temp = RREG32(mmCP_HQD_ACTIVE); |
453 | if (temp & CP_HQD_ACTIVE__ACTIVE_MASK) | 454 | if (temp & CP_HQD_ACTIVE__ACTIVE_MASK) |
454 | break; | 455 | break; |
455 | if (timeout == 0) { | 456 | if (timeout <= 0) { |
456 | pr_err("kfd: cp queue preemption time out (%dms)\n", | 457 | pr_err("kfd: cp queue preemption time out.\n"); |
457 | temp); | ||
458 | release_queue(kgd); | 458 | release_queue(kgd); |
459 | return -ETIME; | 459 | return -ETIME; |
460 | } | 460 | } |
@@ -467,12 +467,13 @@ static int kgd_hqd_destroy(struct kgd_dev *kgd, uint32_t reset_type, | |||
467 | } | 467 | } |
468 | 468 | ||
469 | static int kgd_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd, | 469 | static int kgd_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd, |
470 | unsigned int timeout) | 470 | unsigned int utimeout) |
471 | { | 471 | { |
472 | struct amdgpu_device *adev = get_amdgpu_device(kgd); | 472 | struct amdgpu_device *adev = get_amdgpu_device(kgd); |
473 | struct cik_sdma_rlc_registers *m; | 473 | struct cik_sdma_rlc_registers *m; |
474 | uint32_t sdma_base_addr; | 474 | uint32_t sdma_base_addr; |
475 | uint32_t temp; | 475 | uint32_t temp; |
476 | int timeout = utimeout; | ||
476 | 477 | ||
477 | m = get_sdma_mqd(mqd); | 478 | m = get_sdma_mqd(mqd); |
478 | sdma_base_addr = get_sdma_base_addr(m); | 479 | sdma_base_addr = get_sdma_base_addr(m); |
@@ -485,7 +486,7 @@ static int kgd_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd, | |||
485 | temp = RREG32(sdma_base_addr + mmSDMA0_RLC0_CONTEXT_STATUS); | 486 | temp = RREG32(sdma_base_addr + mmSDMA0_RLC0_CONTEXT_STATUS); |
486 | if (temp & SDMA0_STATUS_REG__RB_CMD_IDLE__SHIFT) | 487 | if (temp & SDMA0_STATUS_REG__RB_CMD_IDLE__SHIFT) |
487 | break; | 488 | break; |
488 | if (timeout == 0) | 489 | if (timeout <= 0) |
489 | return -ETIME; | 490 | return -ETIME; |
490 | msleep(20); | 491 | msleep(20); |
491 | timeout -= 20; | 492 | timeout -= 20; |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v8.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v8.c index 04b744d64b57..6697612239c2 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v8.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v8.c | |||
@@ -62,10 +62,10 @@ static bool kgd_hqd_is_occupied(struct kgd_dev *kgd, uint64_t queue_address, | |||
62 | uint32_t pipe_id, uint32_t queue_id); | 62 | uint32_t pipe_id, uint32_t queue_id); |
63 | static bool kgd_hqd_sdma_is_occupied(struct kgd_dev *kgd, void *mqd); | 63 | static bool kgd_hqd_sdma_is_occupied(struct kgd_dev *kgd, void *mqd); |
64 | static int kgd_hqd_destroy(struct kgd_dev *kgd, uint32_t reset_type, | 64 | static int kgd_hqd_destroy(struct kgd_dev *kgd, uint32_t reset_type, |
65 | unsigned int timeout, uint32_t pipe_id, | 65 | unsigned int utimeout, uint32_t pipe_id, |
66 | uint32_t queue_id); | 66 | uint32_t queue_id); |
67 | static int kgd_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd, | 67 | static int kgd_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd, |
68 | unsigned int timeout); | 68 | unsigned int utimeout); |
69 | static void write_vmid_invalidate_request(struct kgd_dev *kgd, uint8_t vmid); | 69 | static void write_vmid_invalidate_request(struct kgd_dev *kgd, uint8_t vmid); |
70 | static int kgd_address_watch_disable(struct kgd_dev *kgd); | 70 | static int kgd_address_watch_disable(struct kgd_dev *kgd); |
71 | static int kgd_address_watch_execute(struct kgd_dev *kgd, | 71 | static int kgd_address_watch_execute(struct kgd_dev *kgd, |
@@ -349,11 +349,12 @@ static bool kgd_hqd_sdma_is_occupied(struct kgd_dev *kgd, void *mqd) | |||
349 | } | 349 | } |
350 | 350 | ||
351 | static int kgd_hqd_destroy(struct kgd_dev *kgd, uint32_t reset_type, | 351 | static int kgd_hqd_destroy(struct kgd_dev *kgd, uint32_t reset_type, |
352 | unsigned int timeout, uint32_t pipe_id, | 352 | unsigned int utimeout, uint32_t pipe_id, |
353 | uint32_t queue_id) | 353 | uint32_t queue_id) |
354 | { | 354 | { |
355 | struct amdgpu_device *adev = get_amdgpu_device(kgd); | 355 | struct amdgpu_device *adev = get_amdgpu_device(kgd); |
356 | uint32_t temp; | 356 | uint32_t temp; |
357 | int timeout = utimeout; | ||
357 | 358 | ||
358 | acquire_queue(kgd, pipe_id, queue_id); | 359 | acquire_queue(kgd, pipe_id, queue_id); |
359 | 360 | ||
@@ -363,9 +364,8 @@ static int kgd_hqd_destroy(struct kgd_dev *kgd, uint32_t reset_type, | |||
363 | temp = RREG32(mmCP_HQD_ACTIVE); | 364 | temp = RREG32(mmCP_HQD_ACTIVE); |
364 | if (temp & CP_HQD_ACTIVE__ACTIVE_MASK) | 365 | if (temp & CP_HQD_ACTIVE__ACTIVE_MASK) |
365 | break; | 366 | break; |
366 | if (timeout == 0) { | 367 | if (timeout <= 0) { |
367 | pr_err("kfd: cp queue preemption time out (%dms)\n", | 368 | pr_err("kfd: cp queue preemption time out.\n"); |
368 | temp); | ||
369 | release_queue(kgd); | 369 | release_queue(kgd); |
370 | return -ETIME; | 370 | return -ETIME; |
371 | } | 371 | } |
@@ -378,12 +378,13 @@ static int kgd_hqd_destroy(struct kgd_dev *kgd, uint32_t reset_type, | |||
378 | } | 378 | } |
379 | 379 | ||
380 | static int kgd_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd, | 380 | static int kgd_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd, |
381 | unsigned int timeout) | 381 | unsigned int utimeout) |
382 | { | 382 | { |
383 | struct amdgpu_device *adev = get_amdgpu_device(kgd); | 383 | struct amdgpu_device *adev = get_amdgpu_device(kgd); |
384 | struct cik_sdma_rlc_registers *m; | 384 | struct cik_sdma_rlc_registers *m; |
385 | uint32_t sdma_base_addr; | 385 | uint32_t sdma_base_addr; |
386 | uint32_t temp; | 386 | uint32_t temp; |
387 | int timeout = utimeout; | ||
387 | 388 | ||
388 | m = get_sdma_mqd(mqd); | 389 | m = get_sdma_mqd(mqd); |
389 | sdma_base_addr = get_sdma_base_addr(m); | 390 | sdma_base_addr = get_sdma_base_addr(m); |
@@ -396,7 +397,7 @@ static int kgd_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd, | |||
396 | temp = RREG32(sdma_base_addr + mmSDMA0_RLC0_CONTEXT_STATUS); | 397 | temp = RREG32(sdma_base_addr + mmSDMA0_RLC0_CONTEXT_STATUS); |
397 | if (temp & SDMA0_STATUS_REG__RB_CMD_IDLE__SHIFT) | 398 | if (temp & SDMA0_STATUS_REG__RB_CMD_IDLE__SHIFT) |
398 | break; | 399 | break; |
399 | if (timeout == 0) | 400 | if (timeout <= 0) |
400 | return -ETIME; | 401 | return -ETIME; |
401 | msleep(20); | 402 | msleep(20); |
402 | timeout -= 20; | 403 | timeout -= 20; |
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_doorbell.c b/drivers/gpu/drm/amd/amdkfd/kfd_doorbell.c index e621eba63126..ad494b875311 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_doorbell.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_doorbell.c | |||
@@ -142,13 +142,15 @@ int kfd_doorbell_mmap(struct kfd_process *process, struct vm_area_struct *vma) | |||
142 | 142 | ||
143 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | 143 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
144 | 144 | ||
145 | pr_debug("mapping doorbell page:\n"); | 145 | pr_debug("kfd: mapping doorbell page in %s\n" |
146 | pr_debug(" target user address == 0x%08llX\n", | 146 | " target user address == 0x%08llX\n" |
147 | (unsigned long long) vma->vm_start); | 147 | " physical address == 0x%08llX\n" |
148 | pr_debug(" physical address == 0x%08llX\n", address); | 148 | " vm_flags == 0x%04lX\n" |
149 | pr_debug(" vm_flags == 0x%04lX\n", vma->vm_flags); | 149 | " size == 0x%04lX\n", |
150 | pr_debug(" size == 0x%04lX\n", | 150 | __func__, |
151 | doorbell_process_allocation()); | 151 | (unsigned long long) vma->vm_start, address, vma->vm_flags, |
152 | doorbell_process_allocation()); | ||
153 | |||
152 | 154 | ||
153 | return io_remap_pfn_range(vma, | 155 | return io_remap_pfn_range(vma, |
154 | vma->vm_start, | 156 | vma->vm_start, |
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c b/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c index 9beae87aadd5..d135cd002a95 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c | |||
@@ -47,6 +47,9 @@ static bool initialize(struct kernel_queue *kq, struct kfd_dev *dev, | |||
47 | pr_debug("amdkfd: In func %s initializing queue type %d size %d\n", | 47 | pr_debug("amdkfd: In func %s initializing queue type %d size %d\n", |
48 | __func__, KFD_QUEUE_TYPE_HIQ, queue_size); | 48 | __func__, KFD_QUEUE_TYPE_HIQ, queue_size); |
49 | 49 | ||
50 | memset(&prop, 0, sizeof(prop)); | ||
51 | memset(&nop, 0, sizeof(nop)); | ||
52 | |||
50 | nop.opcode = IT_NOP; | 53 | nop.opcode = IT_NOP; |
51 | nop.type = PM4_TYPE_3; | 54 | nop.type = PM4_TYPE_3; |
52 | nop.u32all |= PM4_COUNT_ZERO; | 55 | nop.u32all |= PM4_COUNT_ZERO; |
@@ -121,7 +124,7 @@ static bool initialize(struct kernel_queue *kq, struct kfd_dev *dev, | |||
121 | prop.eop_ring_buffer_address = kq->eop_gpu_addr; | 124 | prop.eop_ring_buffer_address = kq->eop_gpu_addr; |
122 | prop.eop_ring_buffer_size = PAGE_SIZE; | 125 | prop.eop_ring_buffer_size = PAGE_SIZE; |
123 | 126 | ||
124 | if (init_queue(&kq->queue, prop) != 0) | 127 | if (init_queue(&kq->queue, &prop) != 0) |
125 | goto err_init_queue; | 128 | goto err_init_queue; |
126 | 129 | ||
127 | kq->queue->device = dev; | 130 | kq->queue->device = dev; |
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h index 80113c335966..4750cabe4252 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h +++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h | |||
@@ -619,7 +619,7 @@ int kfd_init_apertures(struct kfd_process *process); | |||
619 | /* Queue Context Management */ | 619 | /* Queue Context Management */ |
620 | struct cik_sdma_rlc_registers *get_sdma_mqd(void *mqd); | 620 | struct cik_sdma_rlc_registers *get_sdma_mqd(void *mqd); |
621 | 621 | ||
622 | int init_queue(struct queue **q, struct queue_properties properties); | 622 | int init_queue(struct queue **q, const struct queue_properties *properties); |
623 | void uninit_queue(struct queue *q); | 623 | void uninit_queue(struct queue *q); |
624 | void print_queue_properties(struct queue_properties *q); | 624 | void print_queue_properties(struct queue_properties *q); |
625 | void print_queue(struct queue *q); | 625 | void print_queue(struct queue *q); |
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c index 4f3849ac8c07..ef7c8de7060e 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c | |||
@@ -404,58 +404,47 @@ void kfd_unbind_process_from_device(struct kfd_dev *dev, unsigned int pasid) | |||
404 | { | 404 | { |
405 | struct kfd_process *p; | 405 | struct kfd_process *p; |
406 | struct kfd_process_device *pdd; | 406 | struct kfd_process_device *pdd; |
407 | int idx, i; | ||
408 | 407 | ||
409 | BUG_ON(dev == NULL); | 408 | BUG_ON(dev == NULL); |
410 | 409 | ||
411 | idx = srcu_read_lock(&kfd_processes_srcu); | ||
412 | |||
413 | /* | 410 | /* |
414 | * Look for the process that matches the pasid. If there is no such | 411 | * Look for the process that matches the pasid. If there is no such |
415 | * process, we either released it in amdkfd's own notifier, or there | 412 | * process, we either released it in amdkfd's own notifier, or there |
416 | * is a bug. Unfortunately, there is no way to tell... | 413 | * is a bug. Unfortunately, there is no way to tell... |
417 | */ | 414 | */ |
418 | hash_for_each_rcu(kfd_processes_table, i, p, kfd_processes) | 415 | p = kfd_lookup_process_by_pasid(pasid); |
419 | if (p->pasid == pasid) { | 416 | if (!p) |
420 | 417 | return; | |
421 | srcu_read_unlock(&kfd_processes_srcu, idx); | ||
422 | |||
423 | pr_debug("Unbinding process %d from IOMMU\n", pasid); | ||
424 | 418 | ||
425 | mutex_lock(&p->mutex); | 419 | pr_debug("Unbinding process %d from IOMMU\n", pasid); |
426 | |||
427 | if ((dev->dbgmgr) && (dev->dbgmgr->pasid == p->pasid)) | ||
428 | kfd_dbgmgr_destroy(dev->dbgmgr); | ||
429 | |||
430 | pqm_uninit(&p->pqm); | ||
431 | 420 | ||
432 | pdd = kfd_get_process_device_data(dev, p); | 421 | if ((dev->dbgmgr) && (dev->dbgmgr->pasid == p->pasid)) |
422 | kfd_dbgmgr_destroy(dev->dbgmgr); | ||
433 | 423 | ||
434 | if (!pdd) { | 424 | pqm_uninit(&p->pqm); |
435 | mutex_unlock(&p->mutex); | ||
436 | return; | ||
437 | } | ||
438 | 425 | ||
439 | if (pdd->reset_wavefronts) { | 426 | pdd = kfd_get_process_device_data(dev, p); |
440 | dbgdev_wave_reset_wavefronts(pdd->dev, p); | ||
441 | pdd->reset_wavefronts = false; | ||
442 | } | ||
443 | 427 | ||
444 | /* | 428 | if (!pdd) { |
445 | * Just mark pdd as unbound, because we still need it | 429 | mutex_unlock(&p->mutex); |
446 | * to call amd_iommu_unbind_pasid() in when the | 430 | return; |
447 | * process exits. | 431 | } |
448 | * We don't call amd_iommu_unbind_pasid() here | ||
449 | * because the IOMMU called us. | ||
450 | */ | ||
451 | pdd->bound = false; | ||
452 | 432 | ||
453 | mutex_unlock(&p->mutex); | 433 | if (pdd->reset_wavefronts) { |
434 | dbgdev_wave_reset_wavefronts(pdd->dev, p); | ||
435 | pdd->reset_wavefronts = false; | ||
436 | } | ||
454 | 437 | ||
455 | return; | 438 | /* |
456 | } | 439 | * Just mark pdd as unbound, because we still need it |
440 | * to call amd_iommu_unbind_pasid() in when the | ||
441 | * process exits. | ||
442 | * We don't call amd_iommu_unbind_pasid() here | ||
443 | * because the IOMMU called us. | ||
444 | */ | ||
445 | pdd->bound = false; | ||
457 | 446 | ||
458 | srcu_read_unlock(&kfd_processes_srcu, idx); | 447 | mutex_unlock(&p->mutex); |
459 | } | 448 | } |
460 | 449 | ||
461 | struct kfd_process_device *kfd_get_first_process_device_data(struct kfd_process *p) | 450 | struct kfd_process_device *kfd_get_first_process_device_data(struct kfd_process *p) |
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c index 7b69070f7ecc..e1fb40b84c72 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | |||
@@ -129,7 +129,7 @@ static int create_cp_queue(struct process_queue_manager *pqm, | |||
129 | q_properties->vmid = 0; | 129 | q_properties->vmid = 0; |
130 | q_properties->queue_id = qid; | 130 | q_properties->queue_id = qid; |
131 | 131 | ||
132 | retval = init_queue(q, *q_properties); | 132 | retval = init_queue(q, q_properties); |
133 | if (retval != 0) | 133 | if (retval != 0) |
134 | goto err_init_queue; | 134 | goto err_init_queue; |
135 | 135 | ||
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_queue.c b/drivers/gpu/drm/amd/amdkfd/kfd_queue.c index 9a0c90b0702e..0ab197077f2d 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_queue.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_queue.c | |||
@@ -63,7 +63,7 @@ void print_queue(struct queue *q) | |||
63 | pr_debug("Queue Device Address: 0x%p\n", q->device); | 63 | pr_debug("Queue Device Address: 0x%p\n", q->device); |
64 | } | 64 | } |
65 | 65 | ||
66 | int init_queue(struct queue **q, struct queue_properties properties) | 66 | int init_queue(struct queue **q, const struct queue_properties *properties) |
67 | { | 67 | { |
68 | struct queue *tmp; | 68 | struct queue *tmp; |
69 | 69 | ||
@@ -73,7 +73,7 @@ int init_queue(struct queue **q, struct queue_properties properties) | |||
73 | if (!tmp) | 73 | if (!tmp) |
74 | return -ENOMEM; | 74 | return -ENOMEM; |
75 | 75 | ||
76 | memcpy(&tmp->properties, &properties, sizeof(struct queue_properties)); | 76 | memcpy(&tmp->properties, properties, sizeof(struct queue_properties)); |
77 | 77 | ||
78 | *q = tmp; | 78 | *q = tmp; |
79 | return 0; | 79 | return 0; |
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c index 884c96f50c3d..1e5064749959 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c | |||
@@ -1090,19 +1090,21 @@ static uint32_t kfd_generate_gpu_id(struct kfd_dev *gpu) | |||
1090 | { | 1090 | { |
1091 | uint32_t hashout; | 1091 | uint32_t hashout; |
1092 | uint32_t buf[7]; | 1092 | uint32_t buf[7]; |
1093 | uint64_t local_mem_size; | ||
1093 | int i; | 1094 | int i; |
1094 | 1095 | ||
1095 | if (!gpu) | 1096 | if (!gpu) |
1096 | return 0; | 1097 | return 0; |
1097 | 1098 | ||
1099 | local_mem_size = gpu->kfd2kgd->get_vmem_size(gpu->kgd); | ||
1100 | |||
1098 | buf[0] = gpu->pdev->devfn; | 1101 | buf[0] = gpu->pdev->devfn; |
1099 | buf[1] = gpu->pdev->subsystem_vendor; | 1102 | buf[1] = gpu->pdev->subsystem_vendor; |
1100 | buf[2] = gpu->pdev->subsystem_device; | 1103 | buf[2] = gpu->pdev->subsystem_device; |
1101 | buf[3] = gpu->pdev->device; | 1104 | buf[3] = gpu->pdev->device; |
1102 | buf[4] = gpu->pdev->bus->number; | 1105 | buf[4] = gpu->pdev->bus->number; |
1103 | buf[5] = (uint32_t)(gpu->kfd2kgd->get_vmem_size(gpu->kgd) | 1106 | buf[5] = lower_32_bits(local_mem_size); |
1104 | & 0xffffffff); | 1107 | buf[6] = upper_32_bits(local_mem_size); |
1105 | buf[6] = (uint32_t)(gpu->kfd2kgd->get_vmem_size(gpu->kgd) >> 32); | ||
1106 | 1108 | ||
1107 | for (i = 0, hashout = 0; i < 7; i++) | 1109 | for (i = 0, hashout = 0; i < 7; i++) |
1108 | hashout ^= hash_32(buf[i], KFD_GPU_ID_HASH_WIDTH); | 1110 | hashout ^= hash_32(buf[i], KFD_GPU_ID_HASH_WIDTH); |