aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iommu/amd_iommu.c
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2011-12-01 10:53:47 -0500
committerJoerg Roedel <joerg.roedel@amd.com>2011-12-12 09:19:06 -0500
commit399be2f51979aaf4e3391d98d11e3aeaac7633a4 (patch)
treebcc956e6e6f6766a4d5480e9b582c31f1a35f70a /drivers/iommu/amd_iommu.c
parent6a113ddc03bcc32d3d440dce42b445868d5be093 (diff)
iommu/amd: Add stat counter for IOMMUv2 events
Add some interesting statistic counters for events when IOMMUv2 is active. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'drivers/iommu/amd_iommu.c')
-rw-r--r--drivers/iommu/amd_iommu.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index e453bbd09445..2a46b1d7a601 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -359,6 +359,11 @@ DECLARE_STATS_COUNTER(domain_flush_single);
359DECLARE_STATS_COUNTER(domain_flush_all); 359DECLARE_STATS_COUNTER(domain_flush_all);
360DECLARE_STATS_COUNTER(alloced_io_mem); 360DECLARE_STATS_COUNTER(alloced_io_mem);
361DECLARE_STATS_COUNTER(total_map_requests); 361DECLARE_STATS_COUNTER(total_map_requests);
362DECLARE_STATS_COUNTER(complete_ppr);
363DECLARE_STATS_COUNTER(invalidate_iotlb);
364DECLARE_STATS_COUNTER(invalidate_iotlb_all);
365DECLARE_STATS_COUNTER(pri_requests);
366
362 367
363static struct dentry *stats_dir; 368static struct dentry *stats_dir;
364static struct dentry *de_fflush; 369static struct dentry *de_fflush;
@@ -393,6 +398,10 @@ static void amd_iommu_stats_init(void)
393 amd_iommu_stats_add(&domain_flush_all); 398 amd_iommu_stats_add(&domain_flush_all);
394 amd_iommu_stats_add(&alloced_io_mem); 399 amd_iommu_stats_add(&alloced_io_mem);
395 amd_iommu_stats_add(&total_map_requests); 400 amd_iommu_stats_add(&total_map_requests);
401 amd_iommu_stats_add(&complete_ppr);
402 amd_iommu_stats_add(&invalidate_iotlb);
403 amd_iommu_stats_add(&invalidate_iotlb_all);
404 amd_iommu_stats_add(&pri_requests);
396} 405}
397 406
398#endif 407#endif
@@ -509,6 +518,8 @@ static void iommu_handle_ppr_entry(struct amd_iommu *iommu, u32 head)
509 volatile u64 *raw; 518 volatile u64 *raw;
510 int i; 519 int i;
511 520
521 INC_STATS_COUNTER(pri_requests);
522
512 raw = (u64 *)(iommu->ppr_log + head); 523 raw = (u64 *)(iommu->ppr_log + head);
513 524
514 /* 525 /*
@@ -3356,6 +3367,8 @@ out:
3356static int __amd_iommu_flush_page(struct protection_domain *domain, int pasid, 3367static int __amd_iommu_flush_page(struct protection_domain *domain, int pasid,
3357 u64 address) 3368 u64 address)
3358{ 3369{
3370 INC_STATS_COUNTER(invalidate_iotlb);
3371
3359 return __flush_pasid(domain, pasid, address, false); 3372 return __flush_pasid(domain, pasid, address, false);
3360} 3373}
3361 3374
@@ -3376,6 +3389,8 @@ EXPORT_SYMBOL(amd_iommu_flush_page);
3376 3389
3377static int __amd_iommu_flush_tlb(struct protection_domain *domain, int pasid) 3390static int __amd_iommu_flush_tlb(struct protection_domain *domain, int pasid)
3378{ 3391{
3392 INC_STATS_COUNTER(invalidate_iotlb_all);
3393
3379 return __flush_pasid(domain, pasid, CMD_INV_IOMMU_ALL_PAGES_ADDRESS, 3394 return __flush_pasid(domain, pasid, CMD_INV_IOMMU_ALL_PAGES_ADDRESS,
3380 true); 3395 true);
3381} 3396}
@@ -3495,6 +3510,8 @@ int amd_iommu_complete_ppr(struct pci_dev *pdev, int pasid,
3495 struct amd_iommu *iommu; 3510 struct amd_iommu *iommu;
3496 struct iommu_cmd cmd; 3511 struct iommu_cmd cmd;
3497 3512
3513 INC_STATS_COUNTER(complete_ppr);
3514
3498 dev_data = get_dev_data(&pdev->dev); 3515 dev_data = get_dev_data(&pdev->dev);
3499 iommu = amd_iommu_rlookup_table[dev_data->devid]; 3516 iommu = amd_iommu_rlookup_table[dev_data->devid];
3500 3517