From: Gary R Hook <gary.hook@amd.com>
To: iommu@lists.linux-foundation.org
Cc: joro@8bytes.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/5] iommu/amd - Add a 'verbose' switch for IOMMU debugfs
Date: Fri, 26 Jan 2018 17:52:26 -0600 [thread overview]
Message-ID: <151701074611.16448.6376879206073473408.stgit@taos> (raw)
In-Reply-To: <151701071164.16448.3611271062222336838.stgit@taos>
Enable more descriptive debugfs output via a 'verbose' variable.
Signed-off-by: Gary R Hook <gary.hook@amd.com>
---
drivers/iommu/amd_iommu_debugfs.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/amd_iommu_debugfs.c b/drivers/iommu/amd_iommu_debugfs.c
index 18f70934961d..c449f3a7452c 100644
--- a/drivers/iommu/amd_iommu_debugfs.c
+++ b/drivers/iommu/amd_iommu_debugfs.c
@@ -27,6 +27,8 @@ static DEFINE_RWLOCK(iommu_debugfs_lock);
#define MAX_NAME_LEN 20
+static unsigned int amd_iommu_verbose;
+
static unsigned int amd_iommu_count_valid_dtes(int start, int end)
{
unsigned int n = 0;
@@ -61,7 +63,10 @@ static ssize_t amd_iommu_debugfs_dtecount_read(struct file *filp,
return -ENOMEM;
n = amd_iommu_count_valid_dtes(0, 0xFFFF);
- oboff += OSCNPRINTF("%d\n", n);
+ if (amd_iommu_verbose)
+ oboff += OSCNPRINTF("# DTEs: %d\n", n);
+ else
+ oboff += OSCNPRINTF("%d\n", n);
ret = simple_read_from_buffer(ubuf, count, offp, obuf, oboff);
kfree(obuf);
@@ -79,6 +84,7 @@ static const struct file_operations amd_iommu_debugfs_dtecount_ops = {
void amd_iommu_debugfs_setup(struct amd_iommu *iommu)
{
char name[MAX_NAME_LEN + 1];
+ struct dentry *d_verbose;
struct dentry *d_dte;
unsigned long flags;
@@ -97,6 +103,12 @@ void amd_iommu_debugfs_setup(struct amd_iommu *iommu)
if (!iommu->debugfs_instance)
goto err;
+ d_verbose = debugfs_create_u32("verbose", 0600,
+ iommu->debugfs_instance,
+ &amd_iommu_verbose);
+ if (!d_verbose)
+ goto err;
+
d_dte = debugfs_create_file("count", 0400,
iommu->debugfs_instance, iommu,
&amd_iommu_debugfs_dtecount_ops);
next prev parent reply other threads:[~2018-01-26 23:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-26 23:52 [PATCH 0/5] Add debugfs info for the AMD IOMMU Gary R Hook
2018-01-26 23:52 ` [PATCH 1/5] iommu/amd - Add debugfs support Gary R Hook
2018-01-27 0:00 ` Borislav Petkov
2018-01-29 19:05 ` Gary R Hook
2018-01-26 23:52 ` Gary R Hook [this message]
2018-01-26 23:52 ` [PATCH 3/5] iommu/amd - Add a README variable for the IOMMU debugfs Gary R Hook
2018-01-26 23:52 ` [PATCH 4/5] iommu/amd - Expose the active IOMMU device table entries Gary R Hook
2018-01-26 23:52 ` [PATCH 5/5] iommu/amd - Add a debugfs entry to specify a IOMMU device table entry Gary R Hook
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=151701074611.16448.6376879206073473408.stgit@taos \
--to=gary.hook@amd.com \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.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®