public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jingqi Liu <Jingqi.liu@intel.com>
To: iommu@lists.linux.dev, Lu Baolu <baolu.lu@linux.intel.com>,
	Tian Kevin <kevin.tian@intel.com>, Joerg Roedel <joro@8bytes.org>,
	Will Deacon <will@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>
Cc: linux-kernel@vger.kernel.org, Jingqi Liu <Jingqi.liu@intel.com>
Subject: [PATCH 1/5] iommu/vt-d: debugfs: Define domain_translation_struct file ops
Date: Sun, 25 Jun 2023 23:04:38 +0800	[thread overview]
Message-ID: <20230625150442.42197-2-Jingqi.liu@intel.com> (raw)
In-Reply-To: <20230625150442.42197-1-Jingqi.liu@intel.com>

Define domain_translation_struct file_operations instead of using
DEFINE_SHOW_ATTRIBUTE() in order to specify source identifier and pasid
to dump the specified page table.

Signed-off-by: Jingqi Liu <Jingqi.liu@intel.com>
---
 drivers/iommu/intel/debugfs.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/intel/debugfs.c b/drivers/iommu/intel/debugfs.c
index 1f925285104e..072cfef19175 100644
--- a/drivers/iommu/intel/debugfs.c
+++ b/drivers/iommu/intel/debugfs.c
@@ -391,7 +391,25 @@ static int domain_translation_struct_show(struct seq_file *m, void *unused)
 	return bus_for_each_dev(&pci_bus_type, NULL, m,
 				show_device_domain_translation);
 }
-DEFINE_SHOW_ATTRIBUTE(domain_translation_struct);
+
+static int domain_translation_struct_open(struct inode *inode,
+					  struct file *filp)
+{
+	/*
+	 * Allocate one 1Mbyte buffer to save sequential file output,
+	 * since the default size of input buffer is 1Mbyte when the
+	 * user reads.
+	 */
+	return single_open_size(filp, domain_translation_struct_show,
+				inode->i_private, SZ_1M);
+}
+
+static const struct file_operations domain_translation_struct_fops = {
+	.open		= domain_translation_struct_open,
+	.read		= seq_read,
+	.llseek		= seq_lseek,
+	.release	= single_release,
+};
 
 static void invalidation_queue_entry_show(struct seq_file *m,
 					  struct intel_iommu *iommu)
-- 
2.21.3


  reply	other threads:[~2023-06-25 15:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-25 15:04 [PATCH 0/5] iommu/vt-d: debugfs: Enhancements to IOMMU debugfs Jingqi Liu
2023-06-25 15:04 ` Jingqi Liu [this message]
2023-06-25 15:04 ` [PATCH 2/5] iommu/vt-d: debugfs: Support specifying source identifier and PASID Jingqi Liu
2023-06-25 15:04 ` [PATCH 3/5] iommu/vt-d: debugfs: Dump the corresponding page table of a pasid Jingqi Liu
2023-06-25 15:04 ` [PATCH 4/5] iommu/vt-d: debugfs: Support dumping a specified page table Jingqi Liu
2023-06-25 15:04 ` [PATCH 5/5] iommu/vt-d: debugfs: Dump entry pointing to huge page Jingqi Liu
2023-07-03  7:15 ` [PATCH 0/5] iommu/vt-d: debugfs: Enhancements to IOMMU debugfs Tian, Kevin
2023-07-03 14:37   ` Liu, Jingqi
2023-07-04  7:54     ` Tian, Kevin
2023-07-11  1:40       ` Liu, Jingqi
2023-07-11  2:52         ` Baolu Lu
2023-07-11  6:23           ` Liu, Jingqi

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=20230625150442.42197-2-Jingqi.liu@intel.com \
    --to=jingqi.liu@intel.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=will@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