drm/amdkfd: Fix for-loop when allocating HQD (non-HWS)
authorBen Goz <ben.goz@amd.com>
Tue, 13 Jan 2015 09:18:06 +0000 (11:18 +0200)
committerOded Gabbay <oded.gabbay@amd.com>
Tue, 13 Jan 2015 09:18:06 +0000 (11:18 +0200)
commitf0ec5b9905ca8dfc44c6419dc068a335208398a7
treec9a2b614a750c74c503d61877bb1b7014db5dc35
parent6898f0a568742b3d751e82899b8e1b0fe1b134f5
drm/amdkfd: Fix for-loop when allocating HQD (non-HWS)

This patch fixes a minor bug in allocate_hqd(), where the loop run from the
next-to-allocate pipe until the number of pipes.

This is wrong because we need to consider the possibility where
next-to-allocate pipe is not 0, and thus, the for-loop only checks part of the
pipes and doesn't wrap-around, as it supposed to do.

Therefore, we add another counting variable to make sure we go over all the
pipes, regardless of where we start to look at the first iteration of the loop.

This bug only affected non-HWS mode. In HWS mode, the CP fw is responsible for
allocating the HQD.

Signed-off-by: Ben Goz <ben.goz@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c