Skip to contentSkip to conversation

drm/amdgpu: add amdgpu <--> amdkfd gfx7 interface

DISCUSSION Dan Carpenter 2 participants 2 messages Jul 28, 2015 – Jul 29, 2015

lore
Share & tools
lore
#0 lore raw

Hello Oded Gabbay,

The patch 32c22e994f44: "drm/amdgpu: add amdgpu <--> amdkfd gfx7 interface" from Jun 12, 2015, leads to the following static checker warning:

	drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c:453 kgd_hqd_destroy()
	warn: bitwise AND condition is false here

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c
439 static int kgd_hqd_destroy(struct kgd_dev *kgd, uint32_t reset_type,
440 unsigned int timeout, uint32_t pipe_id,
441 uint32_t queue_id)
442 {
443 struct amdgpu_device *adev = get_amdgpu_device(kgd);
444 uint32_t temp;
445
446 acquire_queue(kgd, pipe_id, queue_id);
447 WREG32(mmCP_HQD_PQ_DOORBELL_CONTROL, 0);
448
449 WREG32(mmCP_HQD_DEQUEUE_REQUEST, reset_type);
450
451 while (true) {
452 temp = RREG32(mmCP_HQD_ACTIVE);
453 if (temp & CP_HQD_ACTIVE__ACTIVE__SHIFT)

                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Never true. ANDing against a shift is weird. A zero shift is sort of pointless, also.

   454                          break;
   455                  if (timeout == 0) {
   456                          pr_err("kfd: cp queue preemption time out (%dms)\n",
   457                                  temp);
   458                          release_queue(kgd);
   459                          return -ETIME;
   460                  }
   461                  msleep(20);
   462                  timeout -= 20;
   463          }
   464  
   465          release_queue(kgd);
   466          return 0;
   467  }

regards,
dan carpenter
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#1 lore raw
Quoted 48 lines · Dan Carpenter

Hello Oded Gabbay,

The patch 32c22e994f44: "drm/amdgpu: add amdgpu <--> amdkfd gfx7 interface" from Jun 12, 2015, leads to the following static checker warning:

        drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c:453

kgd_hqd_destroy()
warn: bitwise AND condition is false here

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c
439 static int kgd_hqd_destroy(struct kgd_dev *kgd, uint32_t
reset_type,
440 unsigned int timeout, uint32_t
pipe_id,
441 uint32_t queue_id)

   442  {
   443          struct amdgpu_device *adev = get_amdgpu_device(kgd);
   444          uint32_t temp;
   445
   446          acquire_queue(kgd, pipe_id, queue_id);
   447          WREG32(mmCP_HQD_PQ_DOORBELL_CONTROL, 0);
   448
   449          WREG32(mmCP_HQD_DEQUEUE_REQUEST, reset_type);
   450
   451          while (true) {
   452                  temp = RREG32(mmCP_HQD_ACTIVE);
   453                  if (temp & CP_HQD_ACTIVE__ACTIVE__SHIFT)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Never true. ANDing against a shift is weird. A zero shift is sort of pointless, also.

   454                          break;
   455                  if (timeout == 0) {
   456                          pr_err("kfd: cp queue preemption time out
(%dms)\n",
   457                                  temp);
   458                          release_queue(kgd);
   459                          return -ETIME;
   460                  }
   461                  msleep(20);
   462                  timeout -= 20;
   463          }
   464
   465          release_queue(kgd);
   466          return 0;
   467  }
Quoted 3 lines

regards,
dan carpenter

​Dan, thanks for catching that!
Will send a fix shortly.

​ Oded

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel