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

drm/amdkfd: Enable processes isolation on gfx9

When amdgpu enable enforce_isolation, KFD enables single-process mode in
HWS and sets exec_cleaner_shader bit in MAP_PROCESS.

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

authored by

Amber Lin and committed by
Alex Deucher
87758a0e f846250b

+17 -4
+13 -1
drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c
··· 37 37 struct kfd_node *kfd = pm->dqm->dev; 38 38 struct kfd_process_device *pdd = 39 39 container_of(qpd, struct kfd_process_device, qpd); 40 + struct amdgpu_device *adev = kfd->adev; 40 41 41 42 packet = (struct pm4_mes_map_process *)buffer; 42 43 memset(buffer, 0, sizeof(struct pm4_mes_map_process)); 43 44 packet->header.u32All = pm_build_pm4_header(IT_MAP_PROCESS, 44 45 sizeof(struct pm4_mes_map_process)); 46 + if (adev->enforce_isolation[kfd->node_id]) 47 + packet->bitfields2.exec_cleaner_shader = 1; 45 48 packet->bitfields2.diq_enable = (qpd->is_debug) ? 1 : 0; 46 49 packet->bitfields2.process_quantum = 10; 47 50 packet->bitfields2.pasid = qpd->pqm->process->pasid; ··· 92 89 struct pm4_mes_map_process_aldebaran *packet; 93 90 uint64_t vm_page_table_base_addr = qpd->page_table_base; 94 91 struct kfd_dev *kfd = pm->dqm->dev->kfd; 92 + struct kfd_node *knode = pm->dqm->dev; 95 93 struct kfd_process_device *pdd = 96 94 container_of(qpd, struct kfd_process_device, qpd); 97 95 int i; 96 + struct amdgpu_device *adev = kfd->adev; 98 97 99 98 packet = (struct pm4_mes_map_process_aldebaran *)buffer; 100 99 memset(buffer, 0, sizeof(struct pm4_mes_map_process_aldebaran)); 101 100 packet->header.u32All = pm_build_pm4_header(IT_MAP_PROCESS, 102 101 sizeof(struct pm4_mes_map_process_aldebaran)); 102 + if (adev->enforce_isolation[knode->node_id]) 103 + packet->bitfields2.exec_cleaner_shader = 1; 103 104 packet->bitfields2.diq_enable = (qpd->is_debug) ? 1 : 0; 104 105 packet->bitfields2.process_quantum = 10; 105 106 packet->bitfields2.pasid = qpd->pqm->process->pasid; ··· 151 144 152 145 int concurrent_proc_cnt = 0; 153 146 struct kfd_node *kfd = pm->dqm->dev; 147 + struct amdgpu_device *adev = kfd->adev; 154 148 155 149 /* Determine the number of processes to map together to HW: 156 150 * it can not exceed the number of VMIDs available to the 157 151 * scheduler, and it is determined by the smaller of the number 158 152 * of processes in the runlist and kfd module parameter 159 153 * hws_max_conc_proc. 154 + * However, if enforce_isolation is set (toggle LDS/VGPRs/SGPRs 155 + * cleaner between process switch), enable single-process mode 156 + * in HWS. 160 157 * Note: the arbitration between the number of VMIDs and 161 158 * hws_max_conc_proc has been done in 162 159 * kgd2kfd_device_init(). 163 160 */ 164 - concurrent_proc_cnt = min(pm->dqm->processes_count, 161 + concurrent_proc_cnt = adev->enforce_isolation[kfd->node_id] ? 162 + 1 : min(pm->dqm->processes_count, 165 163 kfd->max_proc_per_quantum); 166 164 167 165 packet = (struct pm4_mes_runlist *)buffer;
+3 -2
drivers/gpu/drm/amd/amdkfd/kfd_pm4_headers_ai.h
··· 145 145 146 146 union { 147 147 struct { 148 - uint32_t pasid:16; 149 - uint32_t reserved1:2; 148 + uint32_t pasid:16; /* 0 - 15 */ 149 + uint32_t reserved1:1; /* 16 */ 150 + uint32_t exec_cleaner_shader:1; /* 17 */ 150 151 uint32_t debug_vmid:4; 151 152 uint32_t new_debug:1; 152 153 uint32_t reserved2:1;
+1 -1
drivers/gpu/drm/amd/amdkfd/kfd_pm4_headers_aldebaran.h
··· 37 37 struct { 38 38 uint32_t pasid:16; /* 0 - 15 */ 39 39 uint32_t single_memops:1; /* 16 */ 40 - uint32_t reserved1:1; /* 17 */ 40 + uint32_t exec_cleaner_shader:1; /* 17 */ 41 41 uint32_t debug_vmid:4; /* 18 - 21 */ 42 42 uint32_t new_debug:1; /* 22 */ 43 43 uint32_t tmz:1; /* 23 */