Skip to content

Commit cdae16a

Browse files
committed
xtensa: gdb: update ring format
To match thesofproject/linux#5411 this commit updates the gdb ring buffer format as follows: 1. Larger ring space: there can be gdb commands longer than 128 bytes 2. Use 32-bit head and tail pointers 3. Use the reserved space in slot 0 of the debug window, since there are no free slots on Tiger Lake 4. Add a check to make sure our ring buffer isn't colliding with debug window slot descriptors Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
1 parent d9a4e1d commit cdae16a

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

soc/intel/intel_adsp/common/gdbstub_backend_sram.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,20 @@ these buffers via a pty for debugging without the kernel driver.
1313
*/
1414

1515
#include <soc.h>
16+
#include <adsp_debug_window.h>
1617
#include <adsp_memory.h>
1718
#include <mem_window.h>
1819
#include <zephyr/cache.h>
1920

20-
#define RING_SIZE 128
21+
#define RING_SIZE 512
22+
#define SOF_GDB_WINDOW_OFFSET 1024
23+
2124
struct gdb_sram_ring {
22-
unsigned char head;
25+
unsigned int head;
2326
/* Fill spaces are to ensure head/tail are in their own cache line */
24-
unsigned char fill1[63];
25-
unsigned char tail;
26-
unsigned char fill2[63];
27+
unsigned char fill1[60];
28+
unsigned int tail;
29+
unsigned char fill2[60];
2730
unsigned char data[RING_SIZE];
2831
};
2932
static inline unsigned int ring_next_head(const volatile struct gdb_sram_ring *ring)
@@ -46,13 +49,16 @@ static inline int ring_have_data(const volatile struct gdb_sram_ring *ring)
4649
return ring->head != ring->tail;
4750
}
4851

49-
#define RX_UNCACHED (uint8_t *) HP_SRAM_WIN2_BASE
50-
#define TX_UNCACHED (uint8_t *) (HP_SRAM_WIN2_BASE + sizeof(struct gdb_sram_ring))
52+
#define RX_UNCACHED (uint8_t *) (HP_SRAM_WIN2_BASE + SOF_GDB_WINDOW_OFFSET)
53+
#define TX_UNCACHED (uint8_t *) (RX_UNCACHED + sizeof(struct gdb_sram_ring))
54+
5155
static volatile struct gdb_sram_ring *rx;
5256
static volatile struct gdb_sram_ring *tx;
5357

5458
void z_gdb_backend_init(void)
5559
{
60+
__ASSERT_NO_MSG(sizeof(ADSP_DW->descs) <= SOF_GDB_WINDOW_OFFSET);
61+
5662
rx = sys_cache_uncached_ptr_get(RX_UNCACHED);
5763
tx = sys_cache_uncached_ptr_get(TX_UNCACHED);
5864
rx->head = rx->tail = 0;

0 commit comments

Comments
 (0)