summaryrefslogtreecommitdiff
path: root/drivers/iommu/iommu-debug.c
diff options
context:
space:
mode:
authorMitchel Humpherys <mitchelh@codeaurora.org>2015-08-26 11:52:57 -0700
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-22 11:14:06 -0700
commit95166863001eb12e8634cb9946ac805b5894fe21 (patch)
treeadc82df1275266062180ee8d4d7cd05728f95abd /drivers/iommu/iommu-debug.c
parent31cff0aa7f187d580cf6af267c50b0ffc0e64738 (diff)
iommu/iommu-debug: Only uniquify directory names for dynamic domains
The subdirectories under "attach" currently get a UUID appended to their name to ensure that there won't be any collisions when multiple domains are attached to the same device. This is only needed for dynamic domains since those are the only types of domains that can be attached to the same device concurrently. Only do the uniquification for dynamic domains since the resulting directory name is a bit messy with the UUID. Change-Id: Ia86b192e5b9d6a63132228fa86549a2977ec74a4 Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Diffstat (limited to 'drivers/iommu/iommu-debug.c')
-rw-r--r--drivers/iommu/iommu-debug.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/drivers/iommu/iommu-debug.c b/drivers/iommu/iommu-debug.c
index f6f135c4354f..8438581ba171 100644
--- a/drivers/iommu/iommu-debug.c
+++ b/drivers/iommu/iommu-debug.c
@@ -195,25 +195,38 @@ static const struct file_operations iommu_debug_attachment_reg_write_fops = {
static int iommu_debug_attach_add_debugfs(
struct iommu_debug_attachment *attach)
{
- uuid_le uuid;
- char *attach_name;
+ const char *attach_name;
struct device *dev = attach->dev;
struct iommu_domain *domain = attach->domain;
+ int is_dynamic;
- uuid_le_gen(&uuid);
- attach_name = kasprintf(GFP_KERNEL, "%s-%pUl", dev_name(dev), uuid.b);
- if (!attach_name)
- return -ENOMEM;
+ if (iommu_domain_get_attr(domain, DOMAIN_ATTR_DYNAMIC, &is_dynamic))
+ is_dynamic = 0;
+
+ if (is_dynamic) {
+ uuid_le uuid;
+
+ uuid_le_gen(&uuid);
+ attach_name = kasprintf(GFP_KERNEL, "%s-%pUl", dev_name(dev),
+ uuid.b);
+ if (!attach_name)
+ return -ENOMEM;
+ } else {
+ attach_name = dev_name(dev);
+ }
attach->dentry = debugfs_create_dir(attach_name,
debugfs_attachments_dir);
if (!attach->dentry) {
pr_err("Couldn't create iommu/attachments/%s debugfs directory for domain 0x%p\n",
attach_name, domain);
- kfree(attach_name);
+ if (is_dynamic)
+ kfree(attach_name);
return -EIO;
}
- kfree(attach_name);
+
+ if (is_dynamic)
+ kfree(attach_name);
if (!debugfs_create_file(
"info", S_IRUSR, attach->dentry, attach,