From: Qinxin Xia <xiaqinxin@huawei.com>
To: <robin.murphy@arm.com>, <nicolinc@nvidia.com>, <will@kernel.org>,
<jpb@kernel.org>
Cc: <linux-arm-kernel@lists.infradead.org>, <iommu@lists.linux.dev>,
<xiaqinxin@huawei.com>, <wangzhou1@hisilicon.com>,
<prime.zeng@hisilicon.com>, <fanghao11@huawei.com>,
<jonathan.cameron@huawei.com>, <wuyifan50@huawei.com>,
<linuxarm@huawei.com>, <linux-kernel@vger.kernel.org>
Subject: [PATCH 4/5] iommu/arm-smmu-v3: Add device symlink in stream table debugfs
Date: Wed, 20 May 2026 14:37:10 +0800 [thread overview]
Message-ID: <20260520063714.2440584-4-xiaqinxin@huawei.com> (raw)
In-Reply-To: <20260328101706.3448655-1-xiaqinxin@huawei.com>
Add a symlink named under each stream table entry directory pointing to
the sysfs directory of the actual device. This aids debugging
by providing direct access to device attributes.
/sys/kernel/debug/iommu/arm_smmu_v3/smmu0/stream_table/
└── <sid>/
├─── ste
└─── <dev_name>
Signed-off-by: Qinxin Xia <xiaqinxin@huawei.com>
---
.../iommu/arm/arm-smmu-v3/arm-smmu-v3-debugfs.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-debugfs.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-debugfs.c
index a5866f34264f..9babc7d640fd 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-debugfs.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-debugfs.c
@@ -10,6 +10,7 @@
* ├── stream_table
* ├── <sid>/ # Stream ID
* ├── ste # Stream Table Entry
+ * ├── <dev_name> # Symlink to device sysfs directory
*
* The capabilities file provides detailed information about:
* - translation stage support (Stage1/Stage2)
@@ -31,6 +32,7 @@
#include <linux/cleanup.h>
#include <linux/debugfs.h>
+#include <linux/kobject.h>
#include <linux/slab.h>
#include "arm-smmu-v3.h"
@@ -314,6 +316,7 @@ int arm_smmu_debugfs_create_stream_table(struct arm_smmu_device *smmu,
struct dentry *stream_dir, *dev_dir;
struct arm_smmu_master *master;
struct ste_context *ctx;
+ char *path = NULL, *full_path;
char name[64];
u32 sid;
int i;
@@ -338,6 +341,9 @@ int arm_smmu_debugfs_create_stream_table(struct arm_smmu_device *smmu,
if (!master || !master->num_streams)
return -ENODEV;
+ /* Get device sysfs path once, reuse for all streams */
+ path = kobject_get_path(&dev->kobj, GFP_KERNEL);
+
for (i = 0; i < master->num_streams; i++) {
sid = master->streams[i].id;
snprintf(name, sizeof(name), "%u", sid);
@@ -357,8 +363,19 @@ int arm_smmu_debugfs_create_stream_table(struct arm_smmu_device *smmu,
spin_unlock(&smmu->debugfs->stream_lock);
debugfs_create_file("ste", 0444, dev_dir, ctx,
&smmu_debugfs_ste_fops);
+
+ /* Create a symlink to the device's sysfs directory */
+ if (path) {
+ full_path = kasprintf(GFP_KERNEL, "/sys%s", path);
+ if (full_path) {
+ debugfs_create_symlink(dev_name(dev), dev_dir,
+ full_path);
+ kfree(full_path);
+ }
+ }
}
+ kfree(path);
return 0;
}
--
2.33.0
next prev parent reply other threads:[~2026-05-20 6:37 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-20 6:37 [PATCH 0/5] Add debugfs support for ARM SMMUv3 Qinxin Xia
2026-05-20 6:37 ` [PATCH 1/5] iommu/arm-smmu-v3: Add basic debugfs framework Qinxin Xia
2026-05-27 0:41 ` Nicolin Chen
2026-05-20 6:37 ` [PATCH 2/5] iommu/arm-smmu-v3: Add register display to debugfs Qinxin Xia
2026-05-27 1:28 ` Nicolin Chen
2026-05-20 6:37 ` [PATCH 3/5] iommu/arm-smmu-v3: Add Stream Table Entry " Qinxin Xia
2026-05-27 2:18 ` Nicolin Chen
2026-05-27 2:43 ` Nicolin Chen
2026-05-20 6:37 ` Qinxin Xia [this message]
2026-05-20 6:37 ` [PATCH 5/5] iommu/arm-smmu-v3: Add Context Descriptor " Qinxin Xia
2026-05-27 2:40 ` Nicolin Chen
2026-05-27 0:07 ` [PATCH 0/5] Add debugfs support for ARM SMMUv3 Nicolin Chen
2026-07-28 2:21 ` Qinxin Xia
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=20260520063714.2440584-4-xiaqinxin@huawei.com \
--to=xiaqinxin@huawei.com \
--cc=fanghao11@huawei.com \
--cc=iommu@lists.linux.dev \
--cc=jonathan.cameron@huawei.com \
--cc=jpb@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=nicolinc@nvidia.com \
--cc=prime.zeng@hisilicon.com \
--cc=robin.murphy@arm.com \
--cc=wangzhou1@hisilicon.com \
--cc=will@kernel.org \
--cc=wuyifan50@huawei.com \
/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®