File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -239,8 +239,13 @@ static int amdgpu_xcp_dev_alloc(struct amdgpu_device *adev)
239
239
240
240
for (i = 1 ; i < MAX_XCP ; i ++ ) {
241
241
ret = amdgpu_xcp_drm_dev_alloc (& p_ddev );
242
- if (ret )
242
+ if (ret == - ENOSPC ) {
243
+ dev_warn (adev -> dev ,
244
+ "Skip xcp node #%d when out of drm node resource." , i );
245
+ return 0 ;
246
+ } else if (ret ) {
243
247
return ret ;
248
+ }
244
249
245
250
/* Redirect all IOCTLs to the primary device */
246
251
adev -> xcp_mgr -> xcp [i ].rdev = p_ddev -> render -> dev ;
@@ -328,6 +333,9 @@ int amdgpu_xcp_dev_register(struct amdgpu_device *adev,
328
333
return 0 ;
329
334
330
335
for (i = 1 ; i < MAX_XCP ; i ++ ) {
336
+ if (!adev -> xcp_mgr -> xcp [i ].ddev )
337
+ break ;
338
+
331
339
ret = drm_dev_register (adev -> xcp_mgr -> xcp [i ].ddev , ent -> driver_data );
332
340
if (ret )
333
341
return ret ;
@@ -345,6 +353,9 @@ void amdgpu_xcp_dev_unplug(struct amdgpu_device *adev)
345
353
return ;
346
354
347
355
for (i = 1 ; i < MAX_XCP ; i ++ ) {
356
+ if (!adev -> xcp_mgr -> xcp [i ].ddev )
357
+ break ;
358
+
348
359
p_ddev = adev -> xcp_mgr -> xcp [i ].ddev ;
349
360
drm_dev_unplug (p_ddev );
350
361
p_ddev -> render -> dev = adev -> xcp_mgr -> xcp [i ].rdev ;
Original file line number Diff line number Diff line change @@ -1915,7 +1915,14 @@ int kfd_topology_add_device(struct kfd_node *gpu)
1915
1915
const char * asic_name = amdgpu_asic_name [gpu -> adev -> asic_type ];
1916
1916
1917
1917
gpu_id = kfd_generate_gpu_id (gpu );
1918
- pr_debug ("Adding new GPU (ID: 0x%x) to topology\n" , gpu_id );
1918
+ if (gpu -> xcp && !gpu -> xcp -> ddev ) {
1919
+ dev_warn (gpu -> adev -> dev ,
1920
+ "Won't add GPU (ID: 0x%x) to topology since it has no drm node assigned." ,
1921
+ gpu_id );
1922
+ return 0 ;
1923
+ } else {
1924
+ pr_debug ("Adding new GPU (ID: 0x%x) to topology\n" , gpu_id );
1925
+ }
1919
1926
1920
1927
/* Check to see if this gpu device exists in the topology_device_list.
1921
1928
* If so, assign the gpu to that device,
You can’t perform that action at this time.
0 commit comments