@@ -372,6 +372,66 @@ static int domain_translation_struct_show(struct seq_file *m, void *unused)
372
372
}
373
373
DEFINE_SHOW_ATTRIBUTE (domain_translation_struct );
374
374
375
+ static void invalidation_queue_entry_show (struct seq_file * m ,
376
+ struct intel_iommu * iommu )
377
+ {
378
+ int index , shift = qi_shift (iommu );
379
+ struct qi_desc * desc ;
380
+ int offset ;
381
+
382
+ if (ecap_smts (iommu -> ecap ))
383
+ seq_puts (m , "Index\t\tqw0\t\t\tqw1\t\t\tqw2\t\t\tqw3\t\t\tstatus\n" );
384
+ else
385
+ seq_puts (m , "Index\t\tqw0\t\t\tqw1\t\t\tstatus\n" );
386
+
387
+ for (index = 0 ; index < QI_LENGTH ; index ++ ) {
388
+ offset = index << shift ;
389
+ desc = iommu -> qi -> desc + offset ;
390
+ if (ecap_smts (iommu -> ecap ))
391
+ seq_printf (m , "%5d\t%016llx\t%016llx\t%016llx\t%016llx\t%016x\n" ,
392
+ index , desc -> qw0 , desc -> qw1 ,
393
+ desc -> qw2 , desc -> qw3 ,
394
+ iommu -> qi -> desc_status [index ]);
395
+ else
396
+ seq_printf (m , "%5d\t%016llx\t%016llx\t%016x\n" ,
397
+ index , desc -> qw0 , desc -> qw1 ,
398
+ iommu -> qi -> desc_status [index ]);
399
+ }
400
+ }
401
+
402
+ static int invalidation_queue_show (struct seq_file * m , void * unused )
403
+ {
404
+ struct dmar_drhd_unit * drhd ;
405
+ struct intel_iommu * iommu ;
406
+ unsigned long flags ;
407
+ struct q_inval * qi ;
408
+ int shift ;
409
+
410
+ rcu_read_lock ();
411
+ for_each_active_iommu (iommu , drhd ) {
412
+ qi = iommu -> qi ;
413
+ shift = qi_shift (iommu );
414
+
415
+ if (!qi || !ecap_qis (iommu -> ecap ))
416
+ continue ;
417
+
418
+ seq_printf (m , "Invalidation queue on IOMMU: %s\n" , iommu -> name );
419
+
420
+ raw_spin_lock_irqsave (& qi -> q_lock , flags );
421
+ seq_printf (m , " Base: 0x%llx\tHead: %lld\tTail: %lld\n" ,
422
+ (u64 )virt_to_phys (qi -> desc ),
423
+ dmar_readq (iommu -> reg + DMAR_IQH_REG ) >> shift ,
424
+ dmar_readq (iommu -> reg + DMAR_IQT_REG ) >> shift );
425
+ invalidation_queue_entry_show (m , iommu );
426
+ raw_spin_unlock_irqrestore (& qi -> q_lock , flags );
427
+ seq_putc (m , '\n' );
428
+ }
429
+ rcu_read_unlock ();
430
+
431
+ return 0 ;
432
+ }
433
+ DEFINE_SHOW_ATTRIBUTE (invalidation_queue );
434
+
375
435
#ifdef CONFIG_IRQ_REMAP
376
436
static void ir_tbl_remap_entry_show (struct seq_file * m ,
377
437
struct intel_iommu * iommu )
@@ -490,6 +550,8 @@ void __init intel_iommu_debugfs_init(void)
490
550
debugfs_create_file ("domain_translation_struct" , 0444 ,
491
551
intel_iommu_debug , NULL ,
492
552
& domain_translation_struct_fops );
553
+ debugfs_create_file ("invalidation_queue" , 0444 , intel_iommu_debug ,
554
+ NULL , & invalidation_queue_fops );
493
555
#ifdef CONFIG_IRQ_REMAP
494
556
debugfs_create_file ("ir_translation_struct" , 0444 , intel_iommu_debug ,
495
557
NULL , & ir_translation_struct_fops );
0 commit comments