From: pding <Pixel.Ding@xxxxxxx> kgd field is dependent on kgd device_init. Move the assignment to kfd device_init. Signed-off-by: pding <Pixel.Ding at amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 6 +++--- drivers/gpu/drm/amd/amdkfd/kfd_device.c | 8 ++++---- drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 6 +++--- drivers/gpu/drm/amd/include/kgd_kfd_interface.h | 4 ++-- drivers/gpu/drm/radeon/radeon_kfd.c | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c index c70cda0..5b10ce9 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c @@ -89,8 +89,7 @@ void amdgpu_amdkfd_device_probe(struct amdgpu_device *adev) return; } - adev->kfd = kgd2kfd->probe((struct kgd_dev *)adev, - adev->pdev, kfd2kgd); + adev->kfd = kgd2kfd->probe(adev->pdev, kfd2kgd); } void amdgpu_amdkfd_device_init(struct amdgpu_device *adev) @@ -131,7 +130,8 @@ void amdgpu_amdkfd_device_init(struct amdgpu_device *adev) &gpu_resources.doorbell_aperture_size, &gpu_resources.doorbell_start_offset); - kgd2kfd->device_init(adev->kfd, &gpu_resources); + kgd2kfd->device_init(adev->kfd, (struct kgd_dev *)adev, + &gpu_resources); } } diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c index 5df12b2..b95fc61 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c @@ -109,8 +109,8 @@ static const struct kfd_device_info *lookup_device_info(unsigned short did) return NULL; } -struct kfd_dev *kgd2kfd_probe(struct kgd_dev *kgd, - struct pci_dev *pdev, const struct kfd2kgd_calls *f2g) +struct kfd_dev *kgd2kfd_probe(struct pci_dev *pdev, + const struct kfd2kgd_calls *f2g) { struct kfd_dev *kfd; @@ -126,7 +126,6 @@ struct kfd_dev *kgd2kfd_probe(struct kgd_dev *kgd, if (!kfd) return NULL; - kfd->kgd = kgd; kfd->device_info = device_info; kfd->pdev = pdev; kfd->init_complete = false; @@ -217,11 +216,12 @@ static int iommu_invalid_ppr_cb(struct pci_dev *pdev, int pasid, return AMD_IOMMU_INV_PRI_RSP_INVALID; } -bool kgd2kfd_device_init(struct kfd_dev *kfd, +bool kgd2kfd_device_init(struct kfd_dev *kfd, struct kgd_dev *kgd, const struct kgd2kfd_shared_resources *gpu_resources) { unsigned int size; + kfd->kgd = kgd; kfd->shared_resources = *gpu_resources; /* calculate max size of mqds needed for queues */ diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h index 4cb90f5..cf97e7f 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h +++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h @@ -200,9 +200,9 @@ struct kfd_dev { /* KGD2KFD callbacks */ void kgd2kfd_exit(void); -struct kfd_dev *kgd2kfd_probe(struct kgd_dev *kgd, - struct pci_dev *pdev, const struct kfd2kgd_calls *f2g); -bool kgd2kfd_device_init(struct kfd_dev *kfd, +struct kfd_dev *kgd2kfd_probe(struct pci_dev *pdev, + const struct kfd2kgd_calls *f2g); +bool kgd2kfd_device_init(struct kfd_dev *kfd, struct kgd_dev *kgd, const struct kgd2kfd_shared_resources *gpu_resources); void kgd2kfd_device_exit(struct kfd_dev *kfd); diff --git a/drivers/gpu/drm/amd/include/kgd_kfd_interface.h b/drivers/gpu/drm/amd/include/kgd_kfd_interface.h index f516fd1..f9ca238 100644 --- a/drivers/gpu/drm/amd/include/kgd_kfd_interface.h +++ b/drivers/gpu/drm/amd/include/kgd_kfd_interface.h @@ -248,9 +248,9 @@ struct kfd2kgd_calls { */ struct kgd2kfd_calls { void (*exit)(void); - struct kfd_dev* (*probe)(struct kgd_dev *kgd, struct pci_dev *pdev, + struct kfd_dev* (*probe)(struct pci_dev *pdev, const struct kfd2kgd_calls *f2g); - bool (*device_init)(struct kfd_dev *kfd, + bool (*device_init)(struct kfd_dev *kfd, struct kgd_dev *kgd, const struct kgd2kfd_shared_resources *gpu_resources); void (*device_exit)(struct kfd_dev *kfd); void (*interrupt)(struct kfd_dev *kfd, const void *ih_ring_entry); diff --git a/drivers/gpu/drm/radeon/radeon_kfd.c b/drivers/gpu/drm/radeon/radeon_kfd.c index 385b4d7..083deb1 100644 --- a/drivers/gpu/drm/radeon/radeon_kfd.c +++ b/drivers/gpu/drm/radeon/radeon_kfd.c @@ -181,8 +181,7 @@ void radeon_kfd_fini(void) void radeon_kfd_device_probe(struct radeon_device *rdev) { if (kgd2kfd) - rdev->kfd = kgd2kfd->probe((struct kgd_dev *)rdev, - rdev->pdev, &kfd2kgd); + rdev->kfd = kgd2kfd->probe(rdev->pdev, &kfd2kgd); } void radeon_kfd_device_init(struct radeon_device *rdev) @@ -214,7 +213,8 @@ void radeon_kfd_device_init(struct radeon_device *rdev) &gpu_resources.doorbell_aperture_size, &gpu_resources.doorbell_start_offset); - kgd2kfd->device_init(rdev->kfd, &gpu_resources); + kgd2kfd->device_init(rdev->kfd, (struct kgd_dev *)rdev, + &gpu_resources); } } -- 2.9.5