Merge branch 'drm-next-4.18' of git://people.freedesktop.org/~agd5f/linux into drm...
[linux-2.6-microblaze.git] / drivers / gpu / drm / amd / amdgpu / amdgpu_amdkfd.c
index 887702c..bd36ee9 100644 (file)
@@ -92,6 +92,10 @@ void amdgpu_amdkfd_device_probe(struct amdgpu_device *adev)
        case CHIP_POLARIS11:
                kfd2kgd = amdgpu_amdkfd_gfx_8_0_get_functions();
                break;
+       case CHIP_VEGA10:
+       case CHIP_RAVEN:
+               kfd2kgd = amdgpu_amdkfd_gfx_9_0_get_functions();
+               break;
        default:
                dev_dbg(adev->dev, "kfd not supported on this ASIC\n");
                return;
@@ -175,6 +179,28 @@ void amdgpu_amdkfd_device_init(struct amdgpu_device *adev)
                                &gpu_resources.doorbell_physical_address,
                                &gpu_resources.doorbell_aperture_size,
                                &gpu_resources.doorbell_start_offset);
+               if (adev->asic_type >= CHIP_VEGA10) {
+                       /* On SOC15 the BIF is involved in routing
+                        * doorbells using the low 12 bits of the
+                        * address. Communicate the assignments to
+                        * KFD. KFD uses two doorbell pages per
+                        * process in case of 64-bit doorbells so we
+                        * can use each doorbell assignment twice.
+                        */
+                       gpu_resources.sdma_doorbell[0][0] =
+                               AMDGPU_DOORBELL64_sDMA_ENGINE0;
+                       gpu_resources.sdma_doorbell[0][1] =
+                               AMDGPU_DOORBELL64_sDMA_ENGINE0 + 0x200;
+                       gpu_resources.sdma_doorbell[1][0] =
+                               AMDGPU_DOORBELL64_sDMA_ENGINE1;
+                       gpu_resources.sdma_doorbell[1][1] =
+                               AMDGPU_DOORBELL64_sDMA_ENGINE1 + 0x200;
+                       /* Doorbells 0x0f0-0ff and 0x2f0-2ff are reserved for
+                        * SDMA, IH and VCN. So don't use them for the CP.
+                        */
+                       gpu_resources.reserved_doorbell_mask = 0x1f0;
+                       gpu_resources.reserved_doorbell_val  = 0x0f0;
+               }
 
                kgd2kfd->device_init(adev->kfd, &gpu_resources);
        }