DF-1900 / fix.diff
diff --git a/sys/dev/drm/amd/amdgpu/amdgpu_amdkfd.c b/sys/dev/drm/amd/amdgpu/amdgpu_amdkfd.c --- a/sys/dev/drm/amd/amdgpu/amdgpu_amdkfd.c +++ b/sys/dev/drm/amd/amdgpu/amdgpu_amdkfd.c @@ -125,7 +125,7 @@ void amdgpu_amdkfd_device_init(struct amdgpu_device *adev) { int i, n; - int last_valid_bit; + unsigned int last_valid_bit; if (adev->kfd) { struct kgd2kfd_shared_resources gpu_resources = { .compute_vmid_bitmap = compute_vmid_bitmap, @@ -153,9 +153,9 @@ /* According to linux/bitmap.h we shouldn't use bitmap_clear if * nbits is not compile time constant */ - last_valid_bit = 1 /* only first MEC can have compute queues */ + last_valid_bit = min_t(unsigned int, KGD_MAX_QUEUES, 1 /* only first MEC can have compute queues */ * adev->gfx.mec.num_pipe_per_mec - * adev->gfx.mec.num_queue_per_pipe; + * adev->gfx.mec.num_queue_per_pipe); for (i = last_valid_bit; i < KGD_MAX_QUEUES; ++i) clear_bit(i, gpu_resources.queue_bitmap); |