drm/amdkfd: Introduce asic-specific mqd_manager_init function
authorOak Zeng <ozeng@amd.com>
Mon, 3 Dec 2018 19:56:14 +0000 (13:56 -0600)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 24 May 2019 17:21:02 +0000 (12:21 -0500)
Global function mqd_manager_init just calls asic-specific functions and it
is not necessary. Delete it and introduce a mqd_manager_init interface in
dqm for asic-specific mqd manager init. Call mqd_manager_init interface
directly to initialize mqd manager

Signed-off-by: Oak Zeng <ozeng@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
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_cik.c
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_v9.c
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_vi.c
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c
drivers/gpu/drm/amd/amdkfd/kfd_priv.h

index cf6b57627842b82f1afd92975959655ebeecce97..a5cc64559bf17e0fb2a9abb4c46697f14cf22aa9 100644 (file)
@@ -583,7 +583,7 @@ static struct mqd_manager *get_mqd_manager(
 
        mqd_mgr = dqm->mqd_mgrs[type];
        if (!mqd_mgr) {
-               mqd_mgr = mqd_manager_init(type, dqm->dev);
+               mqd_mgr = dqm->asic_ops.mqd_manager_init(type, dqm->dev);
                if (!mqd_mgr)
                        pr_err("mqd manager is NULL");
                dqm->mqd_mgrs[type] = mqd_mgr;
index 2770f3ece89f60fa9ecc3032d813db735f84329d..a5d83ec1c6a8410d8ca94362076266739389d595 100644 (file)
@@ -158,6 +158,8 @@ struct device_queue_manager_asic_ops {
        void    (*init_sdma_vm)(struct device_queue_manager *dqm,
                                struct queue *q,
                                struct qcm_process_device *qpd);
+       struct mqd_manager *    (*mqd_manager_init)(enum KFD_MQD_TYPE type,
+                                struct kfd_dev *dev);
 };
 
 /**
index aed4c21417bfe5eb6be313faee3ec1c0c0c9f885..0d26506798cf2e88174cf1839f2fab1163debce7 100644 (file)
@@ -48,6 +48,7 @@ void device_queue_manager_init_cik(
        asic_ops->set_cache_memory_policy = set_cache_memory_policy_cik;
        asic_ops->update_qpd = update_qpd_cik;
        asic_ops->init_sdma_vm = init_sdma_vm;
+       asic_ops->mqd_manager_init = mqd_manager_init_cik;
 }
 
 void device_queue_manager_init_cik_hawaii(
@@ -56,6 +57,7 @@ void device_queue_manager_init_cik_hawaii(
        asic_ops->set_cache_memory_policy = set_cache_memory_policy_cik;
        asic_ops->update_qpd = update_qpd_cik_hawaii;
        asic_ops->init_sdma_vm = init_sdma_vm_hawaii;
+       asic_ops->mqd_manager_init = mqd_manager_init_cik_hawaii;
 }
 
 static uint32_t compute_sh_mem_bases_64bit(unsigned int top_address_nybble)
index 417515332c35119a39eced74c1460d77774f5c8e..e9fe393823716d6d4c98e2fff9d8201756efde16 100644 (file)
@@ -37,6 +37,7 @@ void device_queue_manager_init_v9(
 {
        asic_ops->update_qpd = update_qpd_v9;
        asic_ops->init_sdma_vm = init_sdma_vm_v9;
+       asic_ops->mqd_manager_init = mqd_manager_init_v9;
 }
 
 static uint32_t compute_sh_mem_bases_64bit(struct kfd_process_device *pdd)
index c3a5dcfe877ade0c32fb4e901aa6fd29c462581d..3a7cb2f883661d0993cd5f1839b901e06864eaa8 100644 (file)
@@ -54,6 +54,7 @@ void device_queue_manager_init_vi(
        asic_ops->set_cache_memory_policy = set_cache_memory_policy_vi;
        asic_ops->update_qpd = update_qpd_vi;
        asic_ops->init_sdma_vm = init_sdma_vm;
+       asic_ops->mqd_manager_init = mqd_manager_init_vi;
 }
 
 void device_queue_manager_init_vi_tonga(
@@ -62,6 +63,7 @@ void device_queue_manager_init_vi_tonga(
        asic_ops->set_cache_memory_policy = set_cache_memory_policy_vi_tonga;
        asic_ops->update_qpd = update_qpd_vi_tonga;
        asic_ops->init_sdma_vm = init_sdma_vm_tonga;
+       asic_ops->mqd_manager_init = mqd_manager_init_vi_tonga;
 }
 
 static uint32_t compute_sh_mem_bases_64bit(unsigned int top_address_nybble)
index aed9b9b82213ddcf97014fee1ec96ac0ebc2a265..eeb2b60a36b55746bd6d9b3dd8fc0e4483c42001 100644 (file)
 #include "kfd_mqd_manager.h"
 #include "amdgpu_amdkfd.h"
 
-struct mqd_manager *mqd_manager_init(enum KFD_MQD_TYPE type,
-                                       struct kfd_dev *dev)
-{
-       switch (dev->device_info->asic_family) {
-       case CHIP_KAVERI:
-               return mqd_manager_init_cik(type, dev);
-       case CHIP_HAWAII:
-               return mqd_manager_init_cik_hawaii(type, dev);
-       case CHIP_CARRIZO:
-               return mqd_manager_init_vi(type, dev);
-       case CHIP_TONGA:
-       case CHIP_FIJI:
-       case CHIP_POLARIS10:
-       case CHIP_POLARIS11:
-       case CHIP_POLARIS12:
-               return mqd_manager_init_vi_tonga(type, dev);
-       case CHIP_VEGA10:
-       case CHIP_VEGA12:
-       case CHIP_VEGA20:
-       case CHIP_RAVEN:
-               return mqd_manager_init_v9(type, dev);
-       default:
-               WARN(1, "Unexpected ASIC family %u",
-                    dev->device_info->asic_family);
-       }
-
-       return NULL;
-}
-
 void mqd_symmetrically_map_cu_mask(struct mqd_manager *mm,
                const uint32_t *cu_mask, uint32_t cu_mask_count,
                uint32_t *se_mask)
index eac687b79ad8e6e48cf83ddd4d9a621352558923..2aebcc8219d1b4dc6de5bd61604372b964e0efca 100644 (file)
@@ -819,8 +819,6 @@ void uninit_queue(struct queue *q);
 void print_queue_properties(struct queue_properties *q);
 void print_queue(struct queue *q);
 
-struct mqd_manager *mqd_manager_init(enum KFD_MQD_TYPE type,
-                                       struct kfd_dev *dev);
 struct mqd_manager *mqd_manager_init_cik(enum KFD_MQD_TYPE type,
                struct kfd_dev *dev);
 struct mqd_manager *mqd_manager_init_cik_hawaii(enum KFD_MQD_TYPE type,