summaryrefslogtreecommitdiffstats
path: root/sound/soc/intel/avs/utils.c
diff options
context:
space:
mode:
authorCezary Rojewski <cezary.rojewski@intel.com>2022-05-16 12:11:08 +0200
committerMark Brown <broonie@kernel.org>2022-05-17 12:57:59 +0200
commit4b86115cb91a3d34ce7da87b734572ce6063babc (patch)
treeedbdee1469d013bb85a16b3340e0c373b53175ac /sound/soc/intel/avs/utils.c
parentASoC: Intel: avs: Coredump and recovery flow (diff)
downloadlinux-4b86115cb91a3d34ce7da87b734572ce6063babc.tar.xz
linux-4b86115cb91a3d34ce7da87b734572ce6063babc.zip
ASoC: Intel: avs: Prepare for firmware tracing
Firmware provides its own debug functionality. While coredump is one of these, traces are the main area of interest. kfifo is enlisted to cache log data that is being pumped to driver through SRAM. Separate DSP operations are declared as actual feature implementation differs between firmware generations. As log gathering involves usage of IPCs, add all necessary: ENABLE_LOGS and SYSTEM_TIME. Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com> Link: https://lore.kernel.org/r/20220516101116.190192-8-cezary.rojewski@intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/intel/avs/utils.c')
-rw-r--r--sound/soc/intel/avs/utils.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/sound/soc/intel/avs/utils.c b/sound/soc/intel/avs/utils.c
index 6473e3ae4c6e..13611dee9787 100644
--- a/sound/soc/intel/avs/utils.c
+++ b/sound/soc/intel/avs/utils.c
@@ -7,6 +7,7 @@
//
#include <linux/firmware.h>
+#include <linux/kfifo.h>
#include <linux/slab.h>
#include "avs.h"
#include "messages.h"
@@ -299,3 +300,25 @@ void avs_release_firmwares(struct avs_dev *adev)
kfree(entry);
}
}
+
+unsigned int __kfifo_fromio_locked(struct kfifo *fifo, const void __iomem *src, unsigned int len,
+ spinlock_t *lock)
+{
+ struct __kfifo *__fifo = &fifo->kfifo;
+ unsigned long flags;
+ unsigned int l, off;
+
+ spin_lock_irqsave(lock, flags);
+ len = min(len, kfifo_avail(fifo));
+ off = __fifo->in & __fifo->mask;
+ l = min(len, kfifo_size(fifo) - off);
+
+ memcpy_fromio(__fifo->data + off, src, l);
+ memcpy_fromio(__fifo->data, src + l, len - l);
+ /* Make sure data copied from SRAM is visible to all CPUs. */
+ smp_mb();
+ __fifo->in += len;
+ spin_unlock_irqrestore(lock, flags);
+
+ return len;
+}