Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/amdkfd: Set per-process flags only once for gfx9/10/11/12

Define set_cache_memory_policy() for these asics and move all static
changes from update_qpd() which is called each time a queue is created
to set_cache_memory_policy() which is called once during process
initialization

Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Reviewed-by: Amber Lin <Amber.Lin@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Harish Kasiviswanathan and committed by
Alex Deucher
61972cd9 289e6850

+112 -57
+25 -18
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_v10.c
··· 31 31 struct qcm_process_device *qpd); 32 32 static void init_sdma_vm_v10(struct device_queue_manager *dqm, struct queue *q, 33 33 struct qcm_process_device *qpd); 34 + static bool set_cache_memory_policy_v10(struct device_queue_manager *dqm, 35 + struct qcm_process_device *qpd, 36 + enum cache_policy default_policy, 37 + enum cache_policy alternate_policy, 38 + void __user *alternate_aperture_base, 39 + uint64_t alternate_aperture_size); 34 40 35 41 void device_queue_manager_init_v10( 36 42 struct device_queue_manager_asic_ops *asic_ops) 37 43 { 44 + asic_ops->set_cache_memory_policy = set_cache_memory_policy_v10; 38 45 asic_ops->update_qpd = update_qpd_v10; 39 46 asic_ops->init_sdma_vm = init_sdma_vm_v10; 40 47 asic_ops->mqd_manager_init = mqd_manager_init_v10; ··· 56 49 private_base; 57 50 } 58 51 52 + static bool set_cache_memory_policy_v10(struct device_queue_manager *dqm, 53 + struct qcm_process_device *qpd, 54 + enum cache_policy default_policy, 55 + enum cache_policy alternate_policy, 56 + void __user *alternate_aperture_base, 57 + uint64_t alternate_aperture_size) 58 + { 59 + qpd->sh_mem_config = (SH_MEM_ALIGNMENT_MODE_UNALIGNED << 60 + SH_MEM_CONFIG__ALIGNMENT_MODE__SHIFT) | 61 + (3 << SH_MEM_CONFIG__INITIAL_INST_PREFETCH__SHIFT); 62 + qpd->sh_mem_ape1_limit = 0; 63 + qpd->sh_mem_ape1_base = 0; 64 + qpd->sh_mem_bases = compute_sh_mem_bases_64bit(qpd_to_pdd(qpd)); 65 + 66 + pr_debug("sh_mem_bases 0x%X\n", qpd->sh_mem_bases); 67 + return true; 68 + } 69 + 59 70 static int update_qpd_v10(struct device_queue_manager *dqm, 60 71 struct qcm_process_device *qpd) 61 72 { 62 - struct kfd_process_device *pdd; 63 - 64 - pdd = qpd_to_pdd(qpd); 65 - 66 - /* check if sh_mem_config register already configured */ 67 - if (qpd->sh_mem_config == 0) { 68 - qpd->sh_mem_config = 69 - (SH_MEM_ALIGNMENT_MODE_UNALIGNED << 70 - SH_MEM_CONFIG__ALIGNMENT_MODE__SHIFT) | 71 - (3 << SH_MEM_CONFIG__INITIAL_INST_PREFETCH__SHIFT); 72 - qpd->sh_mem_ape1_limit = 0; 73 - qpd->sh_mem_ape1_base = 0; 74 - } 75 - 76 - qpd->sh_mem_bases = compute_sh_mem_bases_64bit(pdd); 77 - 78 - pr_debug("sh_mem_bases 0x%X\n", qpd->sh_mem_bases); 79 - 80 73 return 0; 81 74 } 82 75
+26 -19
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_v11.c
··· 30 30 struct qcm_process_device *qpd); 31 31 static void init_sdma_vm_v11(struct device_queue_manager *dqm, struct queue *q, 32 32 struct qcm_process_device *qpd); 33 + static bool set_cache_memory_policy_v11(struct device_queue_manager *dqm, 34 + struct qcm_process_device *qpd, 35 + enum cache_policy default_policy, 36 + enum cache_policy alternate_policy, 37 + void __user *alternate_aperture_base, 38 + uint64_t alternate_aperture_size); 33 39 34 40 void device_queue_manager_init_v11( 35 41 struct device_queue_manager_asic_ops *asic_ops) 36 42 { 43 + asic_ops->set_cache_memory_policy = set_cache_memory_policy_v11; 37 44 asic_ops->update_qpd = update_qpd_v11; 38 45 asic_ops->init_sdma_vm = init_sdma_vm_v11; 39 46 asic_ops->mqd_manager_init = mqd_manager_init_v11; ··· 55 48 private_base; 56 49 } 57 50 51 + static bool set_cache_memory_policy_v11(struct device_queue_manager *dqm, 52 + struct qcm_process_device *qpd, 53 + enum cache_policy default_policy, 54 + enum cache_policy alternate_policy, 55 + void __user *alternate_aperture_base, 56 + uint64_t alternate_aperture_size) 57 + { 58 + qpd->sh_mem_config = (SH_MEM_ALIGNMENT_MODE_UNALIGNED << 59 + SH_MEM_CONFIG__ALIGNMENT_MODE__SHIFT) | 60 + (3 << SH_MEM_CONFIG__INITIAL_INST_PREFETCH__SHIFT); 61 + 62 + qpd->sh_mem_ape1_limit = 0; 63 + qpd->sh_mem_ape1_base = 0; 64 + qpd->sh_mem_bases = compute_sh_mem_bases_64bit(qpd_to_pdd(qpd)); 65 + 66 + pr_debug("sh_mem_bases 0x%X\n", qpd->sh_mem_bases); 67 + return true; 68 + } 69 + 58 70 static int update_qpd_v11(struct device_queue_manager *dqm, 59 71 struct qcm_process_device *qpd) 60 72 { 61 - struct kfd_process_device *pdd; 62 - 63 - pdd = qpd_to_pdd(qpd); 64 - 65 - /* check if sh_mem_config register already configured */ 66 - if (qpd->sh_mem_config == 0) { 67 - qpd->sh_mem_config = 68 - (SH_MEM_ALIGNMENT_MODE_UNALIGNED << 69 - SH_MEM_CONFIG__ALIGNMENT_MODE__SHIFT) | 70 - (3 << SH_MEM_CONFIG__INITIAL_INST_PREFETCH__SHIFT); 71 - 72 - qpd->sh_mem_ape1_limit = 0; 73 - qpd->sh_mem_ape1_base = 0; 74 - } 75 - 76 - qpd->sh_mem_bases = compute_sh_mem_bases_64bit(pdd); 77 - 78 - pr_debug("sh_mem_bases 0x%X\n", qpd->sh_mem_bases); 79 - 80 73 return 0; 81 74 } 82 75
+26 -19
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_v12.c
··· 30 30 struct qcm_process_device *qpd); 31 31 static void init_sdma_vm_v12(struct device_queue_manager *dqm, struct queue *q, 32 32 struct qcm_process_device *qpd); 33 + static bool set_cache_memory_policy_v12(struct device_queue_manager *dqm, 34 + struct qcm_process_device *qpd, 35 + enum cache_policy default_policy, 36 + enum cache_policy alternate_policy, 37 + void __user *alternate_aperture_base, 38 + uint64_t alternate_aperture_size); 33 39 34 40 void device_queue_manager_init_v12( 35 41 struct device_queue_manager_asic_ops *asic_ops) 36 42 { 43 + asic_ops->set_cache_memory_policy = set_cache_memory_policy_v12; 37 44 asic_ops->update_qpd = update_qpd_v12; 38 45 asic_ops->init_sdma_vm = init_sdma_vm_v12; 39 46 asic_ops->mqd_manager_init = mqd_manager_init_v12; ··· 55 48 private_base; 56 49 } 57 50 51 + static bool set_cache_memory_policy_v12(struct device_queue_manager *dqm, 52 + struct qcm_process_device *qpd, 53 + enum cache_policy default_policy, 54 + enum cache_policy alternate_policy, 55 + void __user *alternate_aperture_base, 56 + uint64_t alternate_aperture_size) 57 + { 58 + qpd->sh_mem_config = (SH_MEM_ALIGNMENT_MODE_UNALIGNED << 59 + SH_MEM_CONFIG__ALIGNMENT_MODE__SHIFT) | 60 + (3 << SH_MEM_CONFIG__INITIAL_INST_PREFETCH__SHIFT); 61 + 62 + qpd->sh_mem_ape1_limit = 0; 63 + qpd->sh_mem_ape1_base = 0; 64 + qpd->sh_mem_bases = compute_sh_mem_bases_64bit(qpd_to_pdd(qpd)); 65 + 66 + pr_debug("sh_mem_bases 0x%X\n", qpd->sh_mem_bases); 67 + return true; 68 + } 69 + 58 70 static int update_qpd_v12(struct device_queue_manager *dqm, 59 71 struct qcm_process_device *qpd) 60 72 { 61 - struct kfd_process_device *pdd; 62 - 63 - pdd = qpd_to_pdd(qpd); 64 - 65 - /* check if sh_mem_config register already configured */ 66 - if (qpd->sh_mem_config == 0) { 67 - qpd->sh_mem_config = 68 - (SH_MEM_ALIGNMENT_MODE_UNALIGNED << 69 - SH_MEM_CONFIG__ALIGNMENT_MODE__SHIFT) | 70 - (3 << SH_MEM_CONFIG__INITIAL_INST_PREFETCH__SHIFT); 71 - 72 - qpd->sh_mem_ape1_limit = 0; 73 - qpd->sh_mem_ape1_base = 0; 74 - } 75 - 76 - qpd->sh_mem_bases = compute_sh_mem_bases_64bit(pdd); 77 - 78 - pr_debug("sh_mem_bases 0x%X\n", qpd->sh_mem_bases); 79 - 80 73 return 0; 81 74 } 82 75
+35 -1
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_v9.c
··· 30 30 struct qcm_process_device *qpd); 31 31 static void init_sdma_vm_v9(struct device_queue_manager *dqm, struct queue *q, 32 32 struct qcm_process_device *qpd); 33 + static bool set_cache_memory_policy_v9(struct device_queue_manager *dqm, 34 + struct qcm_process_device *qpd, 35 + enum cache_policy default_policy, 36 + enum cache_policy alternate_policy, 37 + void __user *alternate_aperture_base, 38 + uint64_t alternate_aperture_size); 33 39 34 40 void device_queue_manager_init_v9( 35 41 struct device_queue_manager_asic_ops *asic_ops) 36 42 { 43 + asic_ops->set_cache_memory_policy = set_cache_memory_policy_v9; 37 44 asic_ops->update_qpd = update_qpd_v9; 38 45 asic_ops->init_sdma_vm = init_sdma_vm_v9; 39 46 asic_ops->mqd_manager_init = mqd_manager_init_v9; ··· 55 48 private_base; 56 49 } 57 50 51 + static bool set_cache_memory_policy_v9(struct device_queue_manager *dqm, 52 + struct qcm_process_device *qpd, 53 + enum cache_policy default_policy, 54 + enum cache_policy alternate_policy, 55 + void __user *alternate_aperture_base, 56 + uint64_t alternate_aperture_size) 57 + { 58 + qpd->sh_mem_config = SH_MEM_ALIGNMENT_MODE_UNALIGNED << 59 + SH_MEM_CONFIG__ALIGNMENT_MODE__SHIFT; 60 + 61 + if (dqm->dev->kfd->noretry) 62 + qpd->sh_mem_config |= 1 << SH_MEM_CONFIG__RETRY_DISABLE__SHIFT; 63 + 64 + if (KFD_GC_VERSION(dqm->dev->kfd) == IP_VERSION(9, 4, 3) || 65 + KFD_GC_VERSION(dqm->dev->kfd) == IP_VERSION(9, 4, 4) || 66 + KFD_GC_VERSION(dqm->dev->kfd) == IP_VERSION(9, 5, 0)) 67 + qpd->sh_mem_config |= (1 << SH_MEM_CONFIG__F8_MODE__SHIFT); 68 + 69 + qpd->sh_mem_ape1_limit = 0; 70 + qpd->sh_mem_ape1_base = 0; 71 + qpd->sh_mem_bases = compute_sh_mem_bases_64bit(qpd_to_pdd(qpd)); 72 + 73 + pr_debug("sh_mem_bases 0x%X sh_mem_config 0x%X\n", qpd->sh_mem_bases, 74 + qpd->sh_mem_config); 75 + return true; 76 + } 77 + 58 78 static int update_qpd_v9(struct device_queue_manager *dqm, 59 79 struct qcm_process_device *qpd) 60 80 { 61 - struct kfd_process_device *pdd; 81 + struct kfd_process_device *pdd = qpd_to_pdd(qpd); 62 82 63 83 pdd = qpd_to_pdd(qpd); 64 84