Skip to content

Commit db2aad0

Browse files
lema1-devalexdeucher
authored andcommitted
drm/amdgpu: move the drm client creation behind drm device registration
This patch is to eliminate interrupt warning below: "[drm] Fence fallback timer expired on ring sdma0.0". An early vm pt clearing job is sent to SDMA ahead of interrupt enabled. And re-locating the drm client creation following after drm_dev_register looks like a more proper flow. v2: wrap the drm client creation Fixes: 1819200 ("drm/amdkfd: Export DMABufs from KFD using GEM handles") Signed-off-by: Le Ma <le.ma@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Reviewed-by: Lijo Lazar <lijo.lazar@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent c92c108 commit db2aad0

3 files changed

Lines changed: 27 additions & 11 deletions

File tree

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,31 @@ static void amdgpu_amdkfd_reset_work(struct work_struct *work)
141141
static const struct drm_client_funcs kfd_client_funcs = {
142142
.unregister = drm_client_release,
143143
};
144+
145+
int amdgpu_amdkfd_drm_client_create(struct amdgpu_device *adev)
146+
{
147+
int ret;
148+
149+
if (!adev->kfd.init_complete)
150+
return 0;
151+
152+
ret = drm_client_init(&adev->ddev, &adev->kfd.client, "kfd",
153+
&kfd_client_funcs);
154+
if (ret) {
155+
dev_err(adev->dev, "Failed to init DRM client: %d\n",
156+
ret);
157+
return ret;
158+
}
159+
160+
drm_client_register(&adev->kfd.client);
161+
162+
return 0;
163+
}
164+
144165
void amdgpu_amdkfd_device_init(struct amdgpu_device *adev)
145166
{
146167
int i;
147168
int last_valid_bit;
148-
int ret;
149169

150170
amdgpu_amdkfd_gpuvm_init_mem_limits();
151171

@@ -164,12 +184,6 @@ void amdgpu_amdkfd_device_init(struct amdgpu_device *adev)
164184
.enable_mes = adev->enable_mes,
165185
};
166186

167-
ret = drm_client_init(&adev->ddev, &adev->kfd.client, "kfd", &kfd_client_funcs);
168-
if (ret) {
169-
dev_err(adev->dev, "Failed to init DRM client: %d\n", ret);
170-
return;
171-
}
172-
173187
/* this is going to have a few of the MSBs set that we need to
174188
* clear
175189
*/
@@ -208,10 +222,6 @@ void amdgpu_amdkfd_device_init(struct amdgpu_device *adev)
208222

209223
adev->kfd.init_complete = kgd2kfd_device_init(adev->kfd.dev,
210224
&gpu_resources);
211-
if (adev->kfd.init_complete)
212-
drm_client_register(&adev->kfd.client);
213-
else
214-
drm_client_release(&adev->kfd.client);
215225

216226
amdgpu_amdkfd_total_mem_size += adev->gmc.real_vram_size;
217227

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@ int amdgpu_queue_mask_bit_to_set_resource_bit(struct amdgpu_device *adev,
182182
struct amdgpu_amdkfd_fence *amdgpu_amdkfd_fence_create(u64 context,
183183
struct mm_struct *mm,
184184
struct svm_range_bo *svm_bo);
185+
186+
int amdgpu_amdkfd_drm_client_create(struct amdgpu_device *adev);
185187
#if defined(CONFIG_DEBUG_FS)
186188
int kfd_debugfs_kfd_mem_limits(struct seq_file *m, void *data);
187189
#endif

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2255,6 +2255,10 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
22552255
if (ret)
22562256
goto err_pci;
22572257

2258+
ret = amdgpu_amdkfd_drm_client_create(adev);
2259+
if (ret)
2260+
goto err_pci;
2261+
22582262
/*
22592263
* 1. don't init fbdev on hw without DCE
22602264
* 2. don't init fbdev if there are no connectors

0 commit comments

Comments
 (0)