Commit 58029b77 authored by Cezary Rojewski's avatar Cezary Rojewski Committed by Mark Brown

ASoC: Intel: avs: Drop fifo_lock

Log gathering is already locked, thanks to ->trace_lock.
Signed-off-by: default avatarCezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20221202152841.672536-6-cezary.rojewski@intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent bb03099b
...@@ -65,13 +65,12 @@ static int apl_log_buffer_status(struct avs_dev *adev, union avs_notify_msg *msg ...@@ -65,13 +65,12 @@ static int apl_log_buffer_status(struct avs_dev *adev, union avs_notify_msg *msg
buf = apl_log_payload_addr(addr); buf = apl_log_payload_addr(addr);
if (layout.read_ptr > layout.write_ptr) { if (layout.read_ptr > layout.write_ptr) {
__kfifo_fromio_locked(&adev->dbg.trace_fifo, buf + layout.read_ptr, __kfifo_fromio(&adev->dbg.trace_fifo, buf + layout.read_ptr,
apl_log_payload_size(adev) - layout.read_ptr, apl_log_payload_size(adev) - layout.read_ptr);
&adev->dbg.fifo_lock);
layout.read_ptr = 0; layout.read_ptr = 0;
} }
__kfifo_fromio_locked(&adev->dbg.trace_fifo, buf + layout.read_ptr, __kfifo_fromio(&adev->dbg.trace_fifo, buf + layout.read_ptr,
layout.write_ptr - layout.read_ptr, &adev->dbg.fifo_lock); layout.write_ptr - layout.read_ptr);
wake_up(&adev->dbg.trace_waitq); wake_up(&adev->dbg.trace_waitq);
......
...@@ -95,7 +95,6 @@ struct avs_fw_entry { ...@@ -95,7 +95,6 @@ struct avs_fw_entry {
struct avs_debug { struct avs_debug {
struct kfifo trace_fifo; struct kfifo trace_fifo;
spinlock_t fifo_lock; /* serialize I/O for trace_fifo */
spinlock_t trace_lock; /* serialize debug window I/O between each LOG_BUFFER_STATUS */ spinlock_t trace_lock; /* serialize debug window I/O between each LOG_BUFFER_STATUS */
wait_queue_head_t trace_waitq; wait_queue_head_t trace_waitq;
u32 aging_timer_period; u32 aging_timer_period;
...@@ -331,8 +330,7 @@ void avs_unregister_all_boards(struct avs_dev *adev); ...@@ -331,8 +330,7 @@ void avs_unregister_all_boards(struct avs_dev *adev);
/* Firmware tracing helpers */ /* Firmware tracing helpers */
unsigned int __kfifo_fromio_locked(struct kfifo *fifo, const void __iomem *src, unsigned int len, unsigned int __kfifo_fromio(struct kfifo *fifo, const void __iomem *src, unsigned int len);
spinlock_t *lock);
#define avs_log_buffer_size(adev) \ #define avs_log_buffer_size(adev) \
((adev)->fw_cfg.trace_log_bytes / (adev)->hw_cfg.dsp_cores) ((adev)->fw_cfg.trace_log_bytes / (adev)->hw_cfg.dsp_cores)
......
...@@ -68,7 +68,7 @@ skl_log_buffer_status(struct avs_dev *adev, union avs_notify_msg *msg) ...@@ -68,7 +68,7 @@ skl_log_buffer_status(struct avs_dev *adev, union avs_notify_msg *msg)
/* Address is guaranteed to exist in SRAM2. */ /* Address is guaranteed to exist in SRAM2. */
buf = avs_log_buffer_addr(adev, msg->log.core) + offset; buf = avs_log_buffer_addr(adev, msg->log.core) + offset;
__kfifo_fromio_locked(&adev->dbg.trace_fifo, buf, size, &adev->dbg.fifo_lock); __kfifo_fromio(&adev->dbg.trace_fifo, buf, size);
wake_up(&adev->dbg.trace_waitq); wake_up(&adev->dbg.trace_waitq);
return 0; return 0;
......
...@@ -301,14 +301,11 @@ void avs_release_firmwares(struct avs_dev *adev) ...@@ -301,14 +301,11 @@ void avs_release_firmwares(struct avs_dev *adev)
} }
} }
unsigned int __kfifo_fromio_locked(struct kfifo *fifo, const void __iomem *src, unsigned int len, unsigned int __kfifo_fromio(struct kfifo *fifo, const void __iomem *src, unsigned int len)
spinlock_t *lock)
{ {
struct __kfifo *__fifo = &fifo->kfifo; struct __kfifo *__fifo = &fifo->kfifo;
unsigned long flags;
unsigned int l, off; unsigned int l, off;
spin_lock_irqsave(lock, flags);
len = min(len, kfifo_avail(fifo)); len = min(len, kfifo_avail(fifo));
off = __fifo->in & __fifo->mask; off = __fifo->in & __fifo->mask;
l = min(len, kfifo_size(fifo) - off); l = min(len, kfifo_size(fifo) - off);
...@@ -318,7 +315,6 @@ unsigned int __kfifo_fromio_locked(struct kfifo *fifo, const void __iomem *src, ...@@ -318,7 +315,6 @@ unsigned int __kfifo_fromio_locked(struct kfifo *fifo, const void __iomem *src,
/* Make sure data copied from SRAM is visible to all CPUs. */ /* Make sure data copied from SRAM is visible to all CPUs. */
smp_mb(); smp_mb();
__fifo->in += len; __fifo->in += len;
spin_unlock_irqrestore(lock, flags);
return len; return len;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment