static int apl_log_buffer_status(struct avs_dev *adev, union avs_notify_msg *msg)
{
struct apl_log_buffer_layout layout;
- unsigned long flags;
void __iomem *addr, *buf;
addr = avs_log_buffer_addr(adev, msg->log.core);
memcpy_fromio(&layout, addr, sizeof(layout));
- spin_lock_irqsave(&adev->dbg.trace_lock, flags);
if (!kfifo_initialized(&adev->dbg.trace_fifo))
/* consume the logs regardless of consumer presence */
goto update_read_ptr;
wake_up(&adev->dbg.trace_waitq);
update_read_ptr:
- spin_unlock_irqrestore(&adev->dbg.trace_lock, flags);
writel(layout.write_ptr, addr);
return 0;
}
* gathered before dumping stack
*/
lbs_msg.log.core = msg->ext.coredump.core_id;
- avs_dsp_op(adev, log_buffer_status, &lbs_msg);
+ avs_log_buffer_status_locked(adev, &lbs_msg);
}
pos = dump + AVS_FW_REGS_SIZE;
(avs_sram_addr(adev, AVS_DEBUG_WINDOW) + __offset); \
})
+static inline int avs_log_buffer_status_locked(struct avs_dev *adev, union avs_notify_msg *msg)
+{
+ unsigned long flags;
+ int ret;
+
+ spin_lock_irqsave(&adev->dbg.trace_lock, flags);
+ ret = avs_dsp_op(adev, log_buffer_status, msg);
+ spin_unlock_irqrestore(&adev->dbg.trace_lock, flags);
+
+ return ret;
+}
+
struct apl_log_buffer_layout {
u32 read_ptr;
u32 write_ptr;
break;
case AVS_NOTIFY_LOG_BUFFER_STATUS:
- avs_dsp_op(adev, log_buffer_status, &msg);
+ avs_log_buffer_status_locked(adev, &msg);
break;
case AVS_NOTIFY_EXCEPTION_CAUGHT:
static int
skl_log_buffer_status(struct avs_dev *adev, union avs_notify_msg *msg)
{
- unsigned long flags;
void __iomem *buf;
u16 size, write, offset;
- spin_lock_irqsave(&adev->dbg.trace_lock, flags);
- if (!kfifo_initialized(&adev->dbg.trace_fifo)) {
- spin_unlock_irqrestore(&adev->dbg.trace_lock, flags);
+ if (!kfifo_initialized(&adev->dbg.trace_fifo))
return 0;
- }
size = avs_log_buffer_size(adev) / 2;
write = readl(avs_sram_addr(adev, AVS_FW_REGS_WINDOW) + FW_REGS_DBG_LOG_WP(msg->log.core));
buf = avs_log_buffer_addr(adev, msg->log.core) + offset;
__kfifo_fromio_locked(&adev->dbg.trace_fifo, buf, size, &adev->dbg.fifo_lock);
wake_up(&adev->dbg.trace_waitq);
- spin_unlock_irqrestore(&adev->dbg.trace_lock, flags);
return 0;
}