Skip to content

Commit 7b189cf

Browse files
committed
ASoC: SOF: special-case a part of the debug memory window
The debug memory window is split in 4KiB large slots. Slot zero is used for slot descriptors, which leaves one or two more free slots for actual useful work. One of them is usually used for mtrace logging, which leaves no free slots on some systems and only one such slot on others. This commit repurposes the free space in slot zero after slot descriptors to be used as slot number 15, the highest possible slot number. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
1 parent dde614e commit 7b189cf

3 files changed

Lines changed: 26 additions & 3 deletions

File tree

include/sound/sof/ipc4/header.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -542,10 +542,16 @@ struct sof_ipc4_notify_resource_data {
542542
#define SOF_IPC4_DEBUG_DESCRIPTOR_SIZE 12 /* 3 x u32 */
543543

544544
/*
545-
* The debug memory window is divided into 16 slots, and the
546-
* first slot is used as a recorder for the other 15 slots.
545+
* The debug memory window is divided into 16 slots, and slot zero is used as a
546+
* recorder for the other 15 slots.
547+
* Note, that the last slot number 15 is used in a special way: so far on all
548+
* ADSP platforms the debug memory window has 2 or 3 pages, i.e. it can only
549+
* fit 1 or 2 slots in addition to the first slot with descriptors. But those
550+
* descriptors occupy much less than 1kB of memory, so more than 3 kB of memory
551+
* remain unused there. We use index 15 to point to those 3kB of memory in slot
552+
* zero to be used for the GDB stub communication.
547553
*/
548-
#define SOF_IPC4_MAX_DEBUG_SLOTS 15
554+
#define SOF_IPC4_MAX_DEBUG_SLOTS 15 /* usable slots 1..15 */
549555
#define SOF_IPC4_DEBUG_SLOT_SIZE 0x1000
550556

551557
/* debug log slot types */

sound/soc/sof/ipc4-priv.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ void sof_ipc4_update_cpc_from_manifest(struct snd_sof_dev *sdev,
120120

121121
size_t sof_ipc4_find_debug_slot_offset_by_type(struct snd_sof_dev *sdev,
122122
u32 slot_type);
123+
ssize_t sof_ipc4_find_debug_slot_offset_by_index(struct snd_sof_dev *sdev,
124+
unsigned int index);
123125

124126
void sof_ipc4_mic_privacy_state_change(struct snd_sof_dev *sdev, bool state);
125127

sound/soc/sof/ipc4.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,21 @@ static int sof_ipc4_init_msg_memory(struct snd_sof_dev *sdev)
552552
return 0;
553553
}
554554

555+
ssize_t sof_ipc4_find_debug_slot_offset_by_index(struct snd_sof_dev *sdev,
556+
unsigned int index)
557+
{
558+
if (!index || index > SOF_IPC4_MAX_DEBUG_SLOTS)
559+
return -EINVAL;
560+
561+
/* Slots 1..14 */
562+
if (index < SOF_IPC4_MAX_DEBUG_SLOTS)
563+
return sdev->debug_box.offset + index * SOF_IPC4_DEBUG_SLOT_SIZE;
564+
565+
/* Slot 15: see comment for SOF_IPC4_MAX_DEBUG_SLOTS in header.h */
566+
return sdev->debug_box.offset + 1024;
567+
}
568+
EXPORT_SYMBOL(sof_ipc4_find_debug_slot_offset_by_index);
569+
555570
size_t sof_ipc4_find_debug_slot_offset_by_type(struct snd_sof_dev *sdev,
556571
u32 slot_type)
557572
{

0 commit comments

Comments
 (0)