Commit 35cdc81b authored by Oak Zeng's avatar Oak Zeng Committed by Alex Deucher

drm/amdkfd: Fix sdma_bitmap overflow issue

In the original formula, when sdma queue number is 64,
the left shift overflows. Use an equivalence that won't
overflow.
Signed-off-by: default avatarOak Zeng <Oak.Zeng@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 3a68a638
...@@ -880,8 +880,8 @@ static int initialize_nocpsch(struct device_queue_manager *dqm) ...@@ -880,8 +880,8 @@ static int initialize_nocpsch(struct device_queue_manager *dqm)
} }
dqm->vmid_bitmap = (1 << dqm->dev->vm_info.vmid_num_kfd) - 1; dqm->vmid_bitmap = (1 << dqm->dev->vm_info.vmid_num_kfd) - 1;
dqm->sdma_bitmap = (1ULL << get_num_sdma_queues(dqm)) - 1; dqm->sdma_bitmap = ~0ULL >> (64 - get_num_sdma_queues(dqm));
dqm->xgmi_sdma_bitmap = (1ULL << get_num_xgmi_sdma_queues(dqm)) - 1; dqm->xgmi_sdma_bitmap = ~0ULL >> (64 - get_num_xgmi_sdma_queues(dqm));
return 0; return 0;
} }
...@@ -1019,8 +1019,8 @@ static int initialize_cpsch(struct device_queue_manager *dqm) ...@@ -1019,8 +1019,8 @@ static int initialize_cpsch(struct device_queue_manager *dqm)
dqm->sdma_queue_count = 0; dqm->sdma_queue_count = 0;
dqm->xgmi_sdma_queue_count = 0; dqm->xgmi_sdma_queue_count = 0;
dqm->active_runlist = false; dqm->active_runlist = false;
dqm->sdma_bitmap = (1ULL << get_num_sdma_queues(dqm)) - 1; dqm->sdma_bitmap = ~0ULL >> (64 - get_num_sdma_queues(dqm));
dqm->xgmi_sdma_bitmap = (1ULL << get_num_xgmi_sdma_queues(dqm)) - 1; dqm->xgmi_sdma_bitmap = ~0ULL >> (64 - get_num_xgmi_sdma_queues(dqm));
INIT_WORK(&dqm->hw_exception_work, kfd_process_hw_exception); INIT_WORK(&dqm->hw_exception_work, kfd_process_hw_exception);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment