File tree Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -320,6 +320,31 @@ void idxd_wq_unmap_portal(struct idxd_wq *wq)
320
320
devm_iounmap (dev , wq -> dportal );
321
321
}
322
322
323
+ void idxd_wq_disable_cleanup (struct idxd_wq * wq )
324
+ {
325
+ struct idxd_device * idxd = wq -> idxd ;
326
+ struct device * dev = & idxd -> pdev -> dev ;
327
+ int i , wq_offset ;
328
+
329
+ lockdep_assert_held (& idxd -> dev_lock );
330
+ memset (& wq -> wqcfg , 0 , sizeof (wq -> wqcfg ));
331
+ wq -> type = IDXD_WQT_NONE ;
332
+ wq -> size = 0 ;
333
+ wq -> group = NULL ;
334
+ wq -> threshold = 0 ;
335
+ wq -> priority = 0 ;
336
+ clear_bit (WQ_FLAG_DEDICATED , & wq -> flags );
337
+ memset (wq -> name , 0 , WQ_NAME_SIZE );
338
+
339
+ for (i = 0 ; i < 8 ; i ++ ) {
340
+ wq_offset = idxd -> wqcfg_offset + wq -> id * 32 + i * sizeof (u32 );
341
+ iowrite32 (0 , idxd -> reg_base + wq_offset );
342
+ dev_dbg (dev , "WQ[%d][%d][%#x]: %#x\n" ,
343
+ wq -> id , i , wq_offset ,
344
+ ioread32 (idxd -> reg_base + wq_offset ));
345
+ }
346
+ }
347
+
323
348
/* Device control bits */
324
349
static inline bool idxd_is_enabled (struct idxd_device * idxd )
325
350
{
Original file line number Diff line number Diff line change @@ -290,6 +290,7 @@ int idxd_wq_enable(struct idxd_wq *wq);
290
290
int idxd_wq_disable (struct idxd_wq * wq );
291
291
int idxd_wq_map_portal (struct idxd_wq * wq );
292
292
void idxd_wq_unmap_portal (struct idxd_wq * wq );
293
+ void idxd_wq_disable_cleanup (struct idxd_wq * wq );
293
294
294
295
/* submission */
295
296
int idxd_submit_desc (struct idxd_wq * wq , struct idxd_desc * desc );
Original file line number Diff line number Diff line change @@ -315,6 +315,11 @@ static int idxd_config_bus_remove(struct device *dev)
315
315
idxd_unregister_dma_device (idxd );
316
316
spin_lock_irqsave (& idxd -> dev_lock , flags );
317
317
rc = idxd_device_disable (idxd );
318
+ for (i = 0 ; i < idxd -> max_wqs ; i ++ ) {
319
+ struct idxd_wq * wq = & idxd -> wqs [i ];
320
+
321
+ idxd_wq_disable_cleanup (wq );
322
+ }
318
323
spin_unlock_irqrestore (& idxd -> dev_lock , flags );
319
324
module_put (THIS_MODULE );
320
325
if (rc < 0 )
You can’t perform that action at this time.
0 commit comments