@@ -490,11 +490,14 @@ impl GpuManager::ver {
490490 . zip ( & mgr. pipes . frag )
491491 . zip ( & mgr. pipes . comp )
492492 {
493- p_pipes. try_push ( fw:: initdata:: raw:: PipeChannels :: ver {
494- vtx : v. lock ( ) . to_raw ( ) ,
495- frag : f. lock ( ) . to_raw ( ) ,
496- comp : c. lock ( ) . to_raw ( ) ,
497- } ) ?;
493+ p_pipes. push (
494+ fw:: initdata:: raw:: PipeChannels :: ver {
495+ vtx : v. lock ( ) . to_raw ( ) ,
496+ frag : f. lock ( ) . to_raw ( ) ,
497+ comp : c. lock ( ) . to_raw ( ) ,
498+ } ,
499+ GFP_KERNEL ,
500+ ) ?;
498501 }
499502
500503 mgr. as_mut ( )
@@ -532,7 +535,7 @@ impl GpuManager::ver {
532535 raw. sgx_sram_ptr = U64 ( mapping. iova ( ) ) ;
533536 } ) ;
534537
535- mgr. as_mut ( ) . io_mappings_mut ( ) . try_push ( mapping) ?;
538+ mgr. as_mut ( ) . io_mappings_mut ( ) . push ( mapping, GFP_KERNEL ) ?;
536539 }
537540
538541 let mgr = Arc :: from ( mgr) ;
@@ -601,7 +604,10 @@ impl GpuManager::ver {
601604 #[ ver( G < G14X ) ]
602605 let map_kernel_to_user = false ;
603606
604- Ok ( Box :: try_new ( mmu:: Uat :: new ( dev, cfg, map_kernel_to_user) ?) ?)
607+ Ok ( Box :: new (
608+ mmu:: Uat :: new ( dev, cfg, map_kernel_to_user) ?,
609+ GFP_KERNEL ,
610+ ) ?)
605611 }
606612
607613 /// Actually create the final GpuManager instance, as a UniqueArc.
@@ -624,18 +630,36 @@ impl GpuManager::ver {
624630 } ;
625631
626632 for _i in 0 ..=NUM_PIPES - 1 {
627- pipes. vtx . try_push ( Box :: pin_init ( Mutex :: new_named (
628- channel:: PipeChannel :: ver:: new ( dev, & mut alloc) ?,
629- c_str ! ( "pipe_vtx" ) ,
630- ) ) ?) ?;
631- pipes. frag . try_push ( Box :: pin_init ( Mutex :: new_named (
632- channel:: PipeChannel :: ver:: new ( dev, & mut alloc) ?,
633- c_str ! ( "pipe_frag" ) ,
634- ) ) ?) ?;
635- pipes. comp . try_push ( Box :: pin_init ( Mutex :: new_named (
636- channel:: PipeChannel :: ver:: new ( dev, & mut alloc) ?,
637- c_str ! ( "pipe_comp" ) ,
638- ) ) ?) ?;
633+ pipes. vtx . push (
634+ Box :: pin_init (
635+ Mutex :: new_named (
636+ channel:: PipeChannel :: ver:: new ( dev, & mut alloc) ?,
637+ c_str ! ( "pipe_vtx" ) ,
638+ ) ,
639+ GFP_KERNEL ,
640+ ) ?,
641+ GFP_KERNEL ,
642+ ) ?;
643+ pipes. frag . push (
644+ Box :: pin_init (
645+ Mutex :: new_named (
646+ channel:: PipeChannel :: ver:: new ( dev, & mut alloc) ?,
647+ c_str ! ( "pipe_frag" ) ,
648+ ) ,
649+ GFP_KERNEL ,
650+ ) ?,
651+ GFP_KERNEL ,
652+ ) ?;
653+ pipes. comp . push (
654+ Box :: pin_init (
655+ Mutex :: new_named (
656+ channel:: PipeChannel :: ver:: new ( dev, & mut alloc) ?,
657+ c_str ! ( "pipe_comp" ) ,
658+ ) ,
659+ GFP_KERNEL ,
660+ ) ?,
661+ GFP_KERNEL ,
662+ ) ?;
639663 }
640664
641665 let fwctl_channel = channel:: FwCtlChannel :: new ( dev, & mut alloc) ?;
@@ -1182,18 +1206,21 @@ impl GpuManager for GpuManager::ver {
11821206 ) -> Result < Box < dyn queue:: Queue > > {
11831207 let mut kalloc = self . alloc ( ) ;
11841208 let id = self . ids . queue . next ( ) ;
1185- Ok ( Box :: try_new ( queue:: Queue :: ver:: new (
1186- & self . dev ,
1187- vm,
1188- & mut kalloc,
1189- ualloc,
1190- ualloc_priv,
1191- self . event_manager . clone ( ) ,
1192- & self . buffer_mgr ,
1193- id,
1194- priority,
1195- caps,
1196- ) ?) ?)
1209+ Ok ( Box :: new (
1210+ queue:: Queue :: ver:: new (
1211+ & self . dev ,
1212+ vm,
1213+ & mut kalloc,
1214+ ualloc,
1215+ ualloc_priv,
1216+ self . event_manager . clone ( ) ,
1217+ & self . buffer_mgr ,
1218+ id,
1219+ priority,
1220+ caps,
1221+ ) ?,
1222+ GFP_KERNEL ,
1223+ ) ?)
11971224 }
11981225
11991226 fn kick_firmware ( & self ) -> Result {
@@ -1357,7 +1384,7 @@ impl GpuManager for GpuManager::ver {
13571384 fn add_completed_work ( & self , work : Vec < Box < dyn workqueue:: GenSubmittedWork > > ) {
13581385 let mut garbage = self . garbage_work . lock ( ) ;
13591386
1360- if garbage. try_reserve ( work. len ( ) ) . is_err ( ) {
1387+ if garbage. reserve ( work. len ( ) , GFP_KERNEL ) . is_err ( ) {
13611388 dev_err ! (
13621389 self . dev,
13631390 "Failed to reserve space for completed work, deadlock possible.\n "
@@ -1367,15 +1394,15 @@ impl GpuManager for GpuManager::ver {
13671394
13681395 for i in work {
13691396 garbage
1370- . try_push ( i )
1371- . expect ( "try_push () failed after try_reserve ()" ) ;
1397+ . push ( i , GFP_KERNEL )
1398+ . expect ( "push () failed after reserve ()" ) ;
13721399 }
13731400 }
13741401
13751402 fn free_context ( & self , ctx : Box < fw:: types:: GpuObject < fw:: workqueue:: GpuContextData > > ) {
13761403 let mut garbage = self . garbage_contexts . lock ( ) ;
13771404
1378- if garbage. try_push ( ctx) . is_err ( ) {
1405+ if garbage. push ( ctx, GFP_KERNEL ) . is_err ( ) {
13791406 dev_err ! (
13801407 self . dev,
13811408 "Failed to reserve space for freed context, deadlock possible.\n "
0 commit comments