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 15/16] ASoC: Intel: avs: Allow for dumping FW_REGS area
Date: Thu,  1 Dec 2022 18:56:18 +0100	[thread overview]
Message-ID: <20221201175619.504758-16-cezary.rojewski@intel.com> (raw)
In-Reply-To: <20221201175619.504758-1-cezary.rojewski@intel.com>

SRAM0 window begins with a block of memory, usually of size PAGE_SIZE,
dedicated to the base firmware registers. When debugging firmware, it is
desirable to be able to dump them at will.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 sound/soc/intel/avs/debugfs.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/sound/soc/intel/avs/debugfs.c b/sound/soc/intel/avs/debugfs.c
index e7b0b99824aa..e9042d4328c4 100644
--- a/sound/soc/intel/avs/debugfs.c
+++ b/sound/soc/intel/avs/debugfs.c
@@ -48,6 +48,29 @@ void avs_dump_fw_log_wakeup(struct avs_dev *adev, const void __iomem *src, unsig
 	wake_up(&adev->trace_waitq);
 }
 
+static ssize_t fw_regs_read(struct file *file, char __user *to, size_t count, loff_t *ppos)
+{
+	struct avs_dev *adev = file->private_data;
+	char *buf;
+	int ret;
+
+	buf = kzalloc(AVS_FW_REGS_SIZE, GFP_KERNEL);
+	if (!buf)
+		return -ENOMEM;
+
+	memcpy_fromio(buf, avs_sram_addr(adev, AVS_FW_REGS_WINDOW), AVS_FW_REGS_SIZE);
+
+	ret = simple_read_from_buffer(to, count, ppos, buf, AVS_FW_REGS_SIZE);
+	kfree(buf);
+	return ret;
+}
+
+static const struct file_operations fw_regs_fops = {
+	.open = simple_open,
+	.read = fw_regs_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;
@@ -369,6 +392,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_u32("trace_aging_period", 0644, adev->debugfs_root,
 			   &adev->aging_timer_period);
-- 
2.25.1


  parent reply	other threads:[~2022-12-01 17:44 UTC|newest]

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

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=20221201175619.504758-16-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.