mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joerg Roedel <joerg.roedel@amd.com>
To: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org
Cc: Joerg Roedel <joerg.roedel@amd.com>
Subject: [PATCH 10/22] AMD IOMMU: add init code for statistic collection
Date: Mon, 15 Dec 2008 15:17:53 +0100	[thread overview]
Message-ID: <1229350685-3816-11-git-send-email-joerg.roedel@amd.com> (raw)
In-Reply-To: <1229350685-3816-1-git-send-email-joerg.roedel@amd.com>

Impact: create a new debugfs directory

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
 arch/x86/include/asm/amd_iommu_types.h |    2 +
 arch/x86/kernel/amd_iommu.c            |   37 ++++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/arch/x86/include/asm/amd_iommu_types.h b/arch/x86/include/asm/amd_iommu_types.h
index 1379c5f..95c8cd9 100644
--- a/arch/x86/include/asm/amd_iommu_types.h
+++ b/arch/x86/include/asm/amd_iommu_types.h
@@ -420,6 +420,8 @@ struct __iommu_counter {
 #define ADD_STATS_COUNTER(name, x)
 #define SUB_STATS_COUNTER(name, x)
 
+static inline void amd_iommu_stats_init(void) { }
+
 #endif /* CONFIG_AMD_IOMMU_STATS */
 
 #endif /* _ASM_X86_AMD_IOMMU_TYPES_H */
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
index 0734ae9..be1ddca 100644
--- a/arch/x86/kernel/amd_iommu.c
+++ b/arch/x86/kernel/amd_iommu.c
@@ -20,6 +20,7 @@
 #include <linux/pci.h>
 #include <linux/gfp.h>
 #include <linux/bitops.h>
+#include <linux/debugfs.h>
 #include <linux/scatterlist.h>
 #include <linux/iommu-helper.h>
 #ifdef CONFIG_IOMMU_API
@@ -56,6 +57,40 @@ static int dma_ops_unity_map(struct dma_ops_domain *dma_dom,
 static struct dma_ops_domain *find_protection_domain(u16 devid);
 
 
+#ifdef CONFIG_AMD_IOMMU_STATS
+
+/*
+ * Initialization code for statistics collection
+ */
+
+static struct dentry *stats_dir;
+static struct dentry *de_isolate;
+static struct dentry *de_fflush;
+
+static void amd_iommu_stats_add(struct __iommu_counter *cnt)
+{
+	if (stats_dir == NULL)
+		return;
+
+	cnt->dent = debugfs_create_u64(cnt->name, 0444, stats_dir,
+				       &cnt->value);
+}
+
+static void amd_iommu_stats_init(void)
+{
+	stats_dir = debugfs_create_dir("amd-iommu", NULL);
+	if (stats_dir == NULL)
+		return;
+
+	de_isolate = debugfs_create_bool("isolation", 0444, stats_dir,
+					 (u32 *)&amd_iommu_isolate);
+
+	de_fflush  = debugfs_create_bool("fullflush", 0444, stats_dir,
+					 (u32 *)&amd_iommu_unmap_flush);
+}
+
+#endif
+
 /* returns !0 if the IOMMU is caching non-present entries in its TLB */
 static int iommu_has_npcache(struct amd_iommu *iommu)
 {
@@ -1619,6 +1654,8 @@ int __init amd_iommu_init_dma_ops(void)
 
 	bus_register_notifier(&pci_bus_type, &device_nb);
 
+	amd_iommu_stats_init();
+
 	return 0;
 
 free_domains:
-- 
1.5.6.4



  parent reply	other threads:[~2008-12-15 14:25 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-15 14:17 [PATCH 0/22] more AMD IOMMU updates for 2.6.29 Joerg Roedel
2008-12-15 14:17 ` [PATCH 01/22] AMD IOMMU: add a domain flag for default domains Joerg Roedel
2008-12-15 14:17 ` [PATCH 02/22] AMD IOMMU: allocate a new protection for hotplugged devices Joerg Roedel
2008-12-15 14:17 ` [PATCH 03/22] AMD IOMMU: use dev_name instead of self-build print_devid Joerg Roedel
2008-12-15 15:16   ` David Vrabel
2008-12-15 15:26     ` Joerg Roedel
2008-12-15 14:17 ` [PATCH 04/22] AMD IOMMU: convert iommu->need_sync to bool Joerg Roedel
2008-12-15 14:17 ` [PATCH 05/22] AMD IOMMU: convert amd_iommu_isolate " Joerg Roedel
2008-12-15 14:17 ` [PATCH 06/22] AMD IOMMU: use calc_devid in prealloc_protection_domains Joerg Roedel
2008-12-15 14:17 ` [PATCH 07/22] AMD IOMMU: use dev_name in iommu_enable function Joerg Roedel
2008-12-15 14:17 ` [PATCH 08/22] AMD IOMMU: add Kconfig entry for statistic collection code Joerg Roedel
2008-12-15 14:17 ` [PATCH 09/22] AMD IOMMU: add necessary header defines for stats counting Joerg Roedel
2008-12-15 14:17 ` Joerg Roedel [this message]
2008-12-15 14:17 ` [PATCH 11/22] AMD IOMMU: add stats counter for completion wait events Joerg Roedel
2008-12-15 14:17 ` [PATCH 12/22] AMD IOMMU: add stats counter for map_single requests Joerg Roedel
2008-12-15 14:17 ` [PATCH 13/22] AMD IOMMU: add stats counter for unmap_single requests Joerg Roedel
2008-12-15 14:17 ` [PATCH 14/22] AMD IOMMU: add stats counter for map_sg requests Joerg Roedel
2008-12-15 14:17 ` [PATCH 15/22] AMD IOMMU: add stats counter for unmap_sg requests Joerg Roedel
2008-12-15 14:17 ` [PATCH 16/22] AMD IOMMU: add stats counter for alloc_coherent requests Joerg Roedel
2008-12-15 14:18 ` [PATCH 17/22] AMD IOMMU: add stats counter for free_coherent requests Joerg Roedel
2008-12-15 14:18 ` [PATCH 18/22] AMD IOMMU: add stats counter for cross-page request Joerg Roedel
2008-12-15 14:18 ` [PATCH 19/22] AMD IOMMU: add stats counter for single iommu domain tlb flushes Joerg Roedel
2008-12-15 14:18 ` [PATCH 20/22] AMD IOMMU: add stats counter for " Joerg Roedel
2008-12-15 14:18 ` [PATCH 21/22] AMD IOMMU: add statistics about allocated io memory Joerg Roedel
2008-12-15 14:18 ` [PATCH 22/22] AMD IOMMU: add statistics about total number of map requests Joerg Roedel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1229350685-3816-11-git-send-email-joerg.roedel@amd.com \
    --to=joerg.roedel@amd.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®