aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c50
1 files changed, 35 insertions, 15 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
index 0f9947edb12a..c31a8849e9f8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
@@ -76,6 +76,7 @@ void amdgpu_amdkfd_device_probe(struct amdgpu_device *adev)
76 kfd2kgd = amdgpu_amdkfd_gfx_8_0_get_functions(); 76 kfd2kgd = amdgpu_amdkfd_gfx_8_0_get_functions();
77 break; 77 break;
78 case CHIP_VEGA10: 78 case CHIP_VEGA10:
79 case CHIP_VEGA20:
79 case CHIP_RAVEN: 80 case CHIP_RAVEN:
80 kfd2kgd = amdgpu_amdkfd_gfx_9_0_get_functions(); 81 kfd2kgd = amdgpu_amdkfd_gfx_9_0_get_functions();
81 break; 82 break;
@@ -123,7 +124,7 @@ static void amdgpu_doorbell_get_kfd_info(struct amdgpu_device *adev,
123 124
124void amdgpu_amdkfd_device_init(struct amdgpu_device *adev) 125void amdgpu_amdkfd_device_init(struct amdgpu_device *adev)
125{ 126{
126 int i; 127 int i, n;
127 int last_valid_bit; 128 int last_valid_bit;
128 if (adev->kfd) { 129 if (adev->kfd) {
129 struct kgd2kfd_shared_resources gpu_resources = { 130 struct kgd2kfd_shared_resources gpu_resources = {
@@ -162,7 +163,15 @@ void amdgpu_amdkfd_device_init(struct amdgpu_device *adev)
162 &gpu_resources.doorbell_physical_address, 163 &gpu_resources.doorbell_physical_address,
163 &gpu_resources.doorbell_aperture_size, 164 &gpu_resources.doorbell_aperture_size,
164 &gpu_resources.doorbell_start_offset); 165 &gpu_resources.doorbell_start_offset);
165 if (adev->asic_type >= CHIP_VEGA10) { 166
167 if (adev->asic_type < CHIP_VEGA10) {
168 kgd2kfd->device_init(adev->kfd, &gpu_resources);
169 return;
170 }
171
172 n = (adev->asic_type < CHIP_VEGA20) ? 2 : 8;
173
174 for (i = 0; i < n; i += 2) {
166 /* On SOC15 the BIF is involved in routing 175 /* On SOC15 the BIF is involved in routing
167 * doorbells using the low 12 bits of the 176 * doorbells using the low 12 bits of the
168 * address. Communicate the assignments to 177 * address. Communicate the assignments to
@@ -170,20 +179,31 @@ void amdgpu_amdkfd_device_init(struct amdgpu_device *adev)
170 * process in case of 64-bit doorbells so we 179 * process in case of 64-bit doorbells so we
171 * can use each doorbell assignment twice. 180 * can use each doorbell assignment twice.
172 */ 181 */
173 gpu_resources.sdma_doorbell[0][0] = 182 if (adev->asic_type == CHIP_VEGA10) {
174 AMDGPU_DOORBELL64_sDMA_ENGINE0; 183 gpu_resources.sdma_doorbell[0][i] =
175 gpu_resources.sdma_doorbell[0][1] = 184 AMDGPU_VEGA10_DOORBELL64_sDMA_ENGINE0 + (i >> 1);
176 AMDGPU_DOORBELL64_sDMA_ENGINE0 + 0x200; 185 gpu_resources.sdma_doorbell[0][i+1] =
177 gpu_resources.sdma_doorbell[1][0] = 186 AMDGPU_VEGA10_DOORBELL64_sDMA_ENGINE0 + 0x200 + (i >> 1);
178 AMDGPU_DOORBELL64_sDMA_ENGINE1; 187 gpu_resources.sdma_doorbell[1][i] =
179 gpu_resources.sdma_doorbell[1][1] = 188 AMDGPU_VEGA10_DOORBELL64_sDMA_ENGINE1 + (i >> 1);
180 AMDGPU_DOORBELL64_sDMA_ENGINE1 + 0x200; 189 gpu_resources.sdma_doorbell[1][i+1] =
181 /* Doorbells 0x0f0-0ff and 0x2f0-2ff are reserved for 190 AMDGPU_VEGA10_DOORBELL64_sDMA_ENGINE1 + 0x200 + (i >> 1);
182 * SDMA, IH and VCN. So don't use them for the CP. 191 } else {
183 */ 192 gpu_resources.sdma_doorbell[0][i] =
184 gpu_resources.reserved_doorbell_mask = 0x1f0; 193 AMDGPU_DOORBELL64_sDMA_ENGINE0 + (i >> 1);
185 gpu_resources.reserved_doorbell_val = 0x0f0; 194 gpu_resources.sdma_doorbell[0][i+1] =
195 AMDGPU_DOORBELL64_sDMA_ENGINE0 + 0x200 + (i >> 1);
196 gpu_resources.sdma_doorbell[1][i] =
197 AMDGPU_DOORBELL64_sDMA_ENGINE1 + (i >> 1);
198 gpu_resources.sdma_doorbell[1][i+1] =
199 AMDGPU_DOORBELL64_sDMA_ENGINE1 + 0x200 + (i >> 1);
200 }
186 } 201 }
202 /* Doorbells 0x0e0-0ff and 0x2e0-2ff are reserved for
203 * SDMA, IH and VCN. So don't use them for the CP.
204 */
205 gpu_resources.reserved_doorbell_mask = 0x1e0;
206 gpu_resources.reserved_doorbell_val = 0x0e0;
187 207
188 kgd2kfd->device_init(adev->kfd, &gpu_resources); 208 kgd2kfd->device_init(adev->kfd, &gpu_resources);
189 } 209 }