drm/amd: Pass drm_device to kfd
authorHarish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Wed, 26 Sep 2018 20:09:37 +0000 (16:09 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 3 Oct 2019 14:11:03 +0000 (09:11 -0500)
kfd needs drm_device to call into drm_cgroup functions

Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
drivers/gpu/drm/amd/amdkfd/kfd_device.c
drivers/gpu/drm/amd/amdkfd/kfd_priv.h

index 4a66e7ae03434b34b26b447847b63ea2b01397e7..221047dba601d92645fa1f10b6e9950687906e71 100644 (file)
@@ -204,7 +204,7 @@ void amdgpu_amdkfd_device_init(struct amdgpu_device *adev)
                                        adev->doorbell_index.last_non_cp;
                }
 
-               kgd2kfd_device_init(adev->kfd.dev, &gpu_resources);
+               kgd2kfd_device_init(adev->kfd.dev, adev->ddev, &gpu_resources);
        }
 }
 
index e39c106ac634cd0e2bd738d11709a3caa54b1d4e..4eb2fb85de26df5c2c4d16bdf6f705b67bec6185 100644 (file)
@@ -251,6 +251,7 @@ struct kfd_dev *kgd2kfd_probe(struct kgd_dev *kgd, struct pci_dev *pdev,
                              const struct kfd2kgd_calls *f2g,
                              unsigned int asic_type, bool vf);
 bool kgd2kfd_device_init(struct kfd_dev *kfd,
+                        struct drm_device *ddev,
                         const struct kgd2kfd_shared_resources *gpu_resources);
 void kgd2kfd_device_exit(struct kfd_dev *kfd);
 void kgd2kfd_suspend(struct kfd_dev *kfd);
index edfbae5c289d7ac7d6f6cf62bbc455413fb6f863..96a9e0653db22f4deb76ecf3a4a327fdd486dc55 100644 (file)
@@ -533,10 +533,12 @@ static void kfd_cwsr_init(struct kfd_dev *kfd)
 }
 
 bool kgd2kfd_device_init(struct kfd_dev *kfd,
+                        struct drm_device *ddev,
                         const struct kgd2kfd_shared_resources *gpu_resources)
 {
        unsigned int size;
 
+       kfd->ddev = ddev;
        kfd->mec_fw_version = amdgpu_amdkfd_get_fw_version(kfd->kgd,
                        KGD_ENGINE_MEC1);
        kfd->sdma_fw_version = amdgpu_amdkfd_get_fw_version(kfd->kgd,
index abaed582d1df4277fc54ad7afbe97bd3bb491236..36926aeea84d067602f2ec34b89ce3e63aed0892 100644 (file)
@@ -47,6 +47,8 @@
 /* GPU ID hash width in bits */
 #define KFD_GPU_ID_HASH_WIDTH 16
 
+struct drm_device;
+
 /* Use upper bits of mmap offset to store KFD driver specific information.
  * BITS[63:62] - Encode MMAP type
  * BITS[61:46] - Encode gpu_id. To identify to which GPU the offset belongs to
@@ -226,6 +228,7 @@ struct kfd_dev {
 
        const struct kfd_device_info *device_info;
        struct pci_dev *pdev;
+       struct drm_device *ddev;
 
        unsigned int id;                /* topology stub index */