drm/amdkfd: Use 64 bit sdma_bitmap
authorOak Zeng <Oak.Zeng@amd.com>
Thu, 1 Nov 2018 15:06:25 +0000 (11:06 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 24 May 2019 17:21:01 +0000 (12:21 -0500)
Maximumly support 64 sdma queues

Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h

index c6c9530e704e03f8c5fdda16ca3bd2b15673f5ce..0de8cf45c130e077018175f6a532d26f9410b1b2 100644 (file)
@@ -891,7 +891,7 @@ static int initialize_nocpsch(struct device_queue_manager *dqm)
        }
 
        dqm->vmid_bitmap = (1 << dqm->dev->vm_info.vmid_num_kfd) - 1;
-       dqm->sdma_bitmap = (1 << get_num_sdma_queues(dqm)) - 1;
+       dqm->sdma_bitmap = (1ULL << get_num_sdma_queues(dqm)) - 1;
 
        return 0;
 }
@@ -929,8 +929,8 @@ static int allocate_sdma_queue(struct device_queue_manager *dqm,
        if (dqm->sdma_bitmap == 0)
                return -ENOMEM;
 
-       bit = ffs(dqm->sdma_bitmap) - 1;
-       dqm->sdma_bitmap &= ~(1 << bit);
+       bit = __ffs64(dqm->sdma_bitmap);
+       dqm->sdma_bitmap &= ~(1ULL << bit);
        *sdma_queue_id = bit;
 
        return 0;
@@ -941,7 +941,7 @@ static void deallocate_sdma_queue(struct device_queue_manager *dqm,
 {
        if (sdma_queue_id >= get_num_sdma_queues(dqm))
                return;
-       dqm->sdma_bitmap |= (1 << sdma_queue_id);
+       dqm->sdma_bitmap |= (1ULL << sdma_queue_id);
 }
 
 static int create_sdma_queue_nocpsch(struct device_queue_manager *dqm,
@@ -1047,7 +1047,7 @@ static int initialize_cpsch(struct device_queue_manager *dqm)
        dqm->queue_count = dqm->processes_count = 0;
        dqm->sdma_queue_count = 0;
        dqm->active_runlist = false;
-       dqm->sdma_bitmap = (1 << get_num_sdma_queues(dqm)) - 1;
+       dqm->sdma_bitmap = (1ULL << get_num_sdma_queues(dqm)) - 1;
 
        INIT_WORK(&dqm->hw_exception_work, kfd_process_hw_exception);
 
index 70e38a2e23b95a4e7d8f7ec33fe62868c69c9383..2770f3ece89f60fa9ecc3032d813db735f84329d 100644 (file)
@@ -188,7 +188,7 @@ struct device_queue_manager {
        unsigned int            total_queue_count;
        unsigned int            next_pipe_to_allocate;
        unsigned int            *allocated_queues;
-       unsigned int            sdma_bitmap;
+       uint64_t                sdma_bitmap;
        unsigned int            vmid_bitmap;
        uint64_t                pipelines_addr;
        struct kfd_mem_obj      *pipeline_mem;