All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cezary Rojewski <cezary.rojewski@intel.com>
To: alsa-devel@alsa-project.org, broonie@kernel.org
Cc: Cezary Rojewski <cezary.rojewski@intel.com>,
	pierre-louis.bossart@linux.intel.com, tiwai@suse.com,
	hdegoede@redhat.com, amadeuszx.slawinski@linux.intel.com
Subject: [PATCH v2 16/16] ASoC: Intel: avs: Allow for dumping debug window snapshot
Date: Fri,  2 Dec 2022 16:28:41 +0100	[thread overview]
Message-ID: <20221202152841.672536-17-cezary.rojewski@intel.com> (raw)
In-Reply-To: <20221202152841.672536-1-cezary.rojewski@intel.com>

Add new read-only debugfs entry which dumps entire content of the SRAM
window 2 i.e.: the debug window.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 sound/soc/intel/avs/debugfs.c   | 26 ++++++++++++++++++++++++++
 sound/soc/intel/avs/registers.h |  3 ++-
 2 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/sound/soc/intel/avs/debugfs.c b/sound/soc/intel/avs/debugfs.c
index e9042d4328c4..bdd388ec01ea 100644
--- a/sound/soc/intel/avs/debugfs.c
+++ b/sound/soc/intel/avs/debugfs.c
@@ -71,6 +71,31 @@ static const struct file_operations fw_regs_fops = {
 	.llseek = no_llseek,
 };
 
+static ssize_t debug_window_read(struct file *file, char __user *to, size_t count, loff_t *ppos)
+{
+	struct avs_dev *adev = file->private_data;
+	size_t size;
+	char *buf;
+	int ret;
+
+	size = adev->hw_cfg.dsp_cores * AVS_WINDOW_CHUNK_SIZE;
+	buf = kzalloc(size, GFP_KERNEL);
+	if (!buf)
+		return -ENOMEM;
+
+	memcpy_fromio(buf, avs_sram_addr(adev, AVS_DEBUG_WINDOW), size);
+
+	ret = simple_read_from_buffer(to, count, ppos, buf, size);
+	kfree(buf);
+	return ret;
+}
+
+static const struct file_operations debug_window_fops = {
+	.open = simple_open,
+	.read = debug_window_read,
+	.llseek = no_llseek,
+};
+
 static ssize_t probe_points_read(struct file *file, char __user *to, size_t count, loff_t *ppos)
 {
 	struct avs_dev *adev = file->private_data;
@@ -393,6 +418,7 @@ void avs_debugfs_init(struct avs_dev *adev)
 	debugfs_create_file("strace", 0444, adev->debugfs_root, adev, &strace_fops);
 	debugfs_create_file("trace_control", 0644, adev->debugfs_root, adev, &trace_control_fops);
 	debugfs_create_file("fw_regs", 0444, adev->debugfs_root, adev, &fw_regs_fops);
+	debugfs_create_file("debug_window", 0444, adev->debugfs_root, adev, &debug_window_fops);
 
 	debugfs_create_u32("trace_aging_period", 0644, adev->debugfs_root,
 			   &adev->aging_timer_period);
diff --git a/sound/soc/intel/avs/registers.h b/sound/soc/intel/avs/registers.h
index 95be86148cf3..2b464e466ed5 100644
--- a/sound/soc/intel/avs/registers.h
+++ b/sound/soc/intel/avs/registers.h
@@ -59,7 +59,8 @@
 #define AVS_FW_REG_STATUS(adev)		(AVS_FW_REG_BASE(adev) + 0x0)
 #define AVS_FW_REG_ERROR_CODE(adev)	(AVS_FW_REG_BASE(adev) + 0x4)
 
-#define AVS_FW_REGS_SIZE		PAGE_SIZE
+#define AVS_WINDOW_CHUNK_SIZE		PAGE_SIZE
+#define AVS_FW_REGS_SIZE		AVS_WINDOW_CHUNK_SIZE
 #define AVS_FW_REGS_WINDOW		0
 /* DSP -> HOST communication window */
 #define AVS_UPLINK_WINDOW		AVS_FW_REGS_WINDOW
-- 
2.25.1


  parent reply	other threads:[~2022-12-02 15:16 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-02 15:28 [PATCH v2 00/16] ASoC: Intel: avs: Data probing and fw logging Cezary Rojewski
2022-12-02 15:28 ` [PATCH v2 01/16] ALSA: hda: Allow for compress stream to hdac_ext_stream assignment Cezary Rojewski
2022-12-02 15:28 ` [PATCH v2 02/16] ALSA: hda: Prepare for compress stream support Cezary Rojewski
2022-12-02 15:28 ` [PATCH v2 03/16] ALSA: hda: Interrupt servicing and BDL setup for compress streams Cezary Rojewski
2022-12-02 15:28 ` [PATCH v2 04/16] ASoC: Intel: avs: Introduce avs_log_buffer_status_locked() Cezary Rojewski
2022-12-02 15:28 ` [PATCH v2 05/16] ASoC: Intel: avs: Drop fifo_lock Cezary Rojewski
2022-12-02 15:28 ` [PATCH v2 06/16] ASoC: Intel: avs: Introduce debug-context aware helpers Cezary Rojewski
2022-12-02 15:28 ` [PATCH v2 07/16] ASoC: Intel: avs: Make enable_logs() dependent on DEBUG_FS Cezary Rojewski
2022-12-02 15:28 ` [PATCH v2 08/16] ASoC: Intel: avs: Drop usage of debug members in non-debug code Cezary Rojewski
2022-12-02 15:28 ` [PATCH v2 09/16] ASoC: Intel: avs: Add data probing requests Cezary Rojewski
2022-12-02 15:28 ` [PATCH v2 10/16] ASoC: Intel: avs: Probe compress operations Cezary Rojewski
2022-12-02 15:28 ` [PATCH v2 11/16] ASoC: Intel: avs: Data probing soc-component Cezary Rojewski
2022-12-02 15:28 ` [PATCH v2 12/16] ASoC: Intel: avs: Add probe machine board Cezary Rojewski
2022-12-02 15:28 ` [PATCH v2 13/16] ASoC: Intel: avs: Probing and firmware tracing over debugfs Cezary Rojewski
2022-12-02 15:28 ` [PATCH v2 14/16] ASoC: Intel: avs: Gather remaining logs on strace_release() Cezary Rojewski
2022-12-02 15:28 ` [PATCH v2 15/16] ASoC: Intel: avs: Allow for dumping FW_REGS area Cezary Rojewski
2022-12-02 15:28 ` Cezary Rojewski [this message]
2022-12-05 19:02 ` [PATCH v2 00/16] ASoC: Intel: avs: Data probing and fw logging Mark Brown

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=20221202152841.672536-17-cezary.rojewski@intel.com \
    --to=cezary.rojewski@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=amadeuszx.slawinski@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=hdegoede@redhat.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=tiwai@suse.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 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.