All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alan Previn <alan.previn.teres.alexis@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [Intel-gfx 4/6] drm/i915/guc: Provide debugfs for log relay sub-buf info
Date: Mon,  9 May 2022 14:01:49 -0700	[thread overview]
Message-ID: <20220509210151.1843173-5-alan.previn.teres.alexis@intel.com> (raw)
In-Reply-To: <20220509210151.1843173-1-alan.previn.teres.alexis@intel.com>

In order to provide alignment between IGT intel_guc_logger tool and
i915 kernel's guc log relay channels without requiring updating both
repositories everytime a sizing change is made, provide that info
via debugfs files.

Signed-off-by: Alan Previn <alan.previn.teres.alexis@intel.com>
---
 drivers/gpu/drm/i915/gt/uc/intel_guc_log.c    | 10 ++++-
 drivers/gpu/drm/i915/gt/uc/intel_guc_log.h    |  2 +
 .../drm/i915/gt/uc/intel_guc_log_debugfs.c    | 41 +++++++++++++++++++
 3 files changed, 51 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c
index f454d53a8bca..35709202b09c 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c
@@ -15,7 +15,7 @@
 
 static void guc_log_copy_debuglogs_for_relay(struct intel_guc_log *log);
 
-static u32 intel_guc_log_size(struct intel_guc_log *log)
+u32 intel_guc_log_size(struct intel_guc_log *log)
 {
 	/*
 	 *  GuC Log buffer Layout:
@@ -41,6 +41,12 @@ static u32 intel_guc_log_size(struct intel_guc_log *log)
 	return PAGE_SIZE + CRASH_BUFFER_SIZE + DEBUG_BUFFER_SIZE + CAPTURE_BUFFER_SIZE;
 }
 
+#define GUC_LOG_RELAY_SUBBUF_COUNT 8
+u32 intel_guc_log_relay_subbuf_count(struct intel_guc_log *log)
+{
+	return GUC_LOG_RELAY_SUBBUF_COUNT;
+}
+
 /**
  * DOC: GuC firmware log
  *
@@ -411,7 +417,7 @@ static int guc_log_relay_create(struct intel_guc_log *log)
 	 * latency, for consuming the logs from relay. Also doesn't take
 	 * up too much memory.
 	 */
-	n_subbufs = 8;
+	n_subbufs = intel_guc_log_relay_subbuf_count(log);
 
 	guc_log_relay_chan = relay_open("guc_log",
 					dev_priv->drm.primary->debugfs_root,
diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_log.h b/drivers/gpu/drm/i915/gt/uc/intel_guc_log.h
index 18007e639be9..9e55bd7d2051 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_log.h
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_log.h
@@ -73,6 +73,8 @@ unsigned int intel_guc_get_log_buffer_size(enum guc_log_buffer_type type);
 size_t intel_guc_get_log_buffer_offset(enum guc_log_buffer_type type);
 int intel_guc_log_create(struct intel_guc_log *log);
 void intel_guc_log_destroy(struct intel_guc_log *log);
+u32 intel_guc_log_size(struct intel_guc_log *log);
+u32 intel_guc_log_relay_subbuf_count(struct intel_guc_log *log);
 
 int intel_guc_log_set_level(struct intel_guc_log *log, u32 level);
 bool intel_guc_log_relay_created(const struct intel_guc_log *log);
diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_log_debugfs.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_log_debugfs.c
index ddfbe334689f..983afc89b17e 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_log_debugfs.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_log_debugfs.c
@@ -105,10 +105,49 @@ DEFINE_SIMPLE_ATTRIBUTE(guc_log_level_fops,
 			guc_log_level_get, guc_log_level_set,
 			"%lld\n");
 
+static int guc_log_relay_buf_size_get(void *data, u64 *val)
+{
+	struct intel_guc_log *log = data;
+
+	if (!log)
+		return -ENODEV;
+	if (!log->vma)
+		return -ENODEV;
+
+	*val = (u64)intel_guc_log_size(log);
+
+	return 0;
+}
+
+DEFINE_SIMPLE_ATTRIBUTE(guc_log_relay_buf_size_fops,
+			guc_log_relay_buf_size_get, NULL,
+			"%lld\n");
+
+static int guc_log_relay_subbuf_count_get(void *data, u64 *val)
+{
+	struct intel_guc_log *log = data;
+
+	if (!log)
+		return -ENODEV;
+	if (!log->vma)
+		return -ENODEV;
+
+	*val = intel_guc_log_relay_subbuf_count(log);
+
+	return 0;
+}
+
+DEFINE_SIMPLE_ATTRIBUTE(guc_log_relay_subbuf_count_fops,
+			guc_log_relay_subbuf_count_get, NULL,
+			"%lld\n");
+
 static int guc_log_relay_open(struct inode *inode, struct file *file)
 {
 	struct intel_guc_log *log = inode->i_private;
 
+	if (!log)
+		return -ENODEV;
+
 	if (!intel_guc_is_ready(log_to_guc(log)))
 		return -ENODEV;
 
@@ -166,6 +205,8 @@ void intel_guc_log_debugfs_register(struct intel_guc_log *log,
 		{ "guc_load_err_log_dump", &guc_load_err_log_dump_fops, NULL },
 		{ "guc_log_level", &guc_log_level_fops, NULL },
 		{ "guc_log_relay", &guc_log_relay_fops, NULL },
+		{ "guc_log_relay_buf_size", &guc_log_relay_buf_size_fops, NULL },
+		{ "guc_log_relay_subbuf_count", &guc_log_relay_subbuf_count_fops, NULL },
 	};
 
 	if (!intel_guc_is_supported(log_to_guc(log)))
-- 
2.25.1


  parent reply	other threads:[~2022-05-09 21:01 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-09 21:01 [Intel-gfx] [Intel-gfx 0/6] Update GuC relay logging debugfs Alan Previn
2022-05-09 21:01 ` [Intel-gfx] [Intel-gfx 1/6] drm/i915/guc: Fix GuC relay log debugfs failing open Alan Previn
2022-07-19  3:58   ` Dixit, Ashutosh
2022-12-06  8:32   ` Tvrtko Ursulin
2022-12-06  8:35     ` Tvrtko Ursulin
2022-05-09 21:01 ` [Intel-gfx] [Intel-gfx 2/6] drm/i915/guc: Add unaligned wc memcpy for copying GuC Log Alan Previn
2022-07-19 17:54   ` Dixit, Ashutosh
2022-05-09 21:01 ` [Intel-gfx] [Intel-gfx 3/6] drm/i915/guc: Add a helper for log buffer size Alan Previn
2022-07-20  2:49   ` Dixit, Ashutosh
2022-12-06  1:56     ` Teres Alexis, Alan Previn
2022-05-09 21:01 ` Alan Previn [this message]
2022-07-20  3:40   ` [Intel-gfx] [Intel-gfx 4/6] drm/i915/guc: Provide debugfs for log relay sub-buf info Dixit, Ashutosh
2022-12-06  1:55     ` Teres Alexis, Alan Previn
2022-12-07  6:00       ` Dixit, Ashutosh
2022-05-09 21:01 ` [Intel-gfx] [Intel-gfx 5/6] drm/i915/guc: Rename GuC log relay debugfs descriptively Alan Previn
2022-07-20  5:39   ` Dixit, Ashutosh
2022-12-06  1:58     ` Teres Alexis, Alan Previn
2022-05-09 21:01 ` [Intel-gfx] [Intel-gfx 6/6] drm/i915/guc: Move guc_log_relay_chan debugfs path to uc Alan Previn
2022-07-20 19:08   ` Dixit, Ashutosh
2022-12-06  2:01     ` Teres Alexis, Alan Previn
2022-12-06  6:08       ` Teres Alexis, Alan Previn
2022-05-09 21:25 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for Update GuC relay logging debugfs Patchwork
2022-05-09 21:41 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-05-10 10:00 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2022-05-11 21:45   ` Teres Alexis, Alan Previn

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=20220509210151.1843173-5-alan.previn.teres.alexis@intel.com \
    --to=alan.previn.teres.alexis@intel.com \
    --cc=intel-gfx@lists.freedesktop.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.