[PATCH 3/5] iommu/amd - Add a README variable for the IOMMU debugfs
From: Gary R Hook
Date: Fri Jan 26 2018 - 18:52:48 EST
Provide help text via a filesystem entry
Signed-off-by: Gary R Hook <gary.hook@xxxxxxx>
---
drivers/iommu/amd_iommu_debugfs.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/drivers/iommu/amd_iommu_debugfs.c b/drivers/iommu/amd_iommu_debugfs.c
index c449f3a7452c..5066d3976912 100644
--- a/drivers/iommu/amd_iommu_debugfs.c
+++ b/drivers/iommu/amd_iommu_debugfs.c
@@ -81,6 +81,31 @@ static const struct file_operations amd_iommu_debugfs_dtecount_ops = {
.write = NULL,
};
+static char readmetext[] =
+"count Count of active devices\n"
+"verbose Provide additional descriptive text\n"
+"\n";
+
+static ssize_t amd_iommu_debugfs_readme_read(struct file *filp,
+ char __user *ubuf,
+ size_t count, loff_t *offp)
+{
+ ssize_t ret;
+
+ ret = simple_read_from_buffer(ubuf, count, offp,
+ readmetext, strlen(readmetext));
+
+ return ret;
+}
+
+
+static const struct file_operations amd_iommu_debugfs_readme_ops = {
+ .owner = THIS_MODULE,
+ .open = simple_open,
+ .read = amd_iommu_debugfs_readme_read,
+ .write = NULL,
+};
+
void amd_iommu_debugfs_setup(struct amd_iommu *iommu)
{
char name[MAX_NAME_LEN + 1];
@@ -115,6 +140,12 @@ void amd_iommu_debugfs_setup(struct amd_iommu *iommu)
if (!d_dte)
goto err;
+ d_dte = debugfs_create_file("README", 0400,
+ iommu->debugfs_instance, iommu,
+ &amd_iommu_debugfs_readme_ops);
+ if (!d_dte)
+ goto err;
+
return;
err: