Skip to content

Commit 8884a5d

Browse files
Jyri Sarhakv2019i
authored andcommitted
debug: debug_stream_slot: Fix circular buffer alignment and update comments
The cache-line alignment was removed from circular buffer descriptors on last moments of debug_stream_slot PR's review process. This broke the circular buffer alignment and its now fixed in this PR. The commit also contains the documentation update for the alignment removal change that was also forgotten from the original PR. Since this only affects the offsets of the circular buffers, that are explicitly written in the debug window slot, there is no need to update anything on the host side client. Also the unaligned circular buffers appeared to work just fine, because of that. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
1 parent 0ab4441 commit 8884a5d

2 files changed

Lines changed: 35 additions & 40 deletions

File tree

src/debug/debug_stream/debug_stream_slot.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,9 @@ int debug_stream_slot_send_record(struct debug_stream_record *rec)
100100
static int debug_stream_slot_init(void)
101101
{
102102
struct debug_stream_slot_hdr *hdr = debug_stream_get_slot();
103-
size_t hdr_size = offsetof(struct debug_stream_slot_hdr,
104-
section_desc[CONFIG_MP_MAX_NUM_CPUS]);
103+
size_t hdr_size = ALIGN_UP(offsetof(struct debug_stream_slot_hdr,
104+
section_desc[CONFIG_MP_MAX_NUM_CPUS]),
105+
CONFIG_DCACHE_LINE_SIZE);
105106
size_t section_area_size = ADSP_DW_SLOT_SIZE - hdr_size;
106107
size_t section_size = ALIGN_DOWN(section_area_size /
107108
CONFIG_MP_MAX_NUM_CPUS,

src/include/user/debug_stream_slot.h

Lines changed: 32 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -24,43 +24,36 @@
2424
* structure that is initialized once at DSP boot time. All elements
2525
* in bellow example are 32-bit unsigned integers:
2626
*
27-
* -------------------------------------------------- ---
28-
* | id = DEBUG_STREAM_IDENTIFIER | |
29-
* | total_size = 4096 | 64 bytes
30-
* | num_sections = CONFIG_MP_MAX_NUM_CPUS * | |
31-
* | <padding> | |
32-
* -------------------------------------------------- ---
33-
* | section_descriptor [] = { | |
34-
* | { | |
35-
* | core_id = 0 | |
36-
* | size = 1344 | 64 bytes
37-
* | offset = 64 | |
38-
* | } | |
39-
* | <padding> | |
40-
* -------------------------------------------------- ---
41-
* | { | |
42-
* | core_id = 1 | |
43-
* | size = 1344 | 64 bytes
44-
* | offset = 1344+64 | |
45-
* | } | |
46-
* | <padding> | |
47-
* -------------------------------------------------- ---
48-
* | { | |
49-
* | core_id = 2 | |
50-
* | size = 1344 | 64 bytes
51-
* | offset = 2*1344+64 | |
52-
* | } | |
53-
* | } | |
54-
* | <padding> | |
55-
* -------------------------------------------------- ---
27+
* --------------------------------------------------
28+
* | id = DEBUG_STREAM_IDENTIFIER |
29+
* | total_size = 4096 |
30+
* | num_sections = CONFIG_MP_MAX_NUM_CPUS * |
31+
* | section_descriptor [] = { |
32+
* | { |
33+
* | core_id = 0 |
34+
* | size = 1344 |
35+
* | offset = 64 |
36+
* | } |
37+
* | { |
38+
* | core_id = 1 |
39+
* | size = 1344 |
40+
* | offset = 1344+64 |
41+
* | } |
42+
* | { |
43+
* | core_id = 2 |
44+
* | size = 1344 |
45+
* | offset = 2*1344+64 |
46+
* | } |
47+
* | } |
48+
* | <padding> |
49+
* -------------------------------------------------- n * 64 bytes
5650
* * CONFIG_MP_MAX_NUM_CPUS is 3 in this example
5751
*
5852
* The header contains generic information like identifier, total
5953
* size, and number of sections. After the generic fields there is an
60-
* array of section descriptors. Each array element is cacheline
61-
* aligned. The array has 'num_sections' number of elements. Each
62-
* element in the array describes a circular buffer, one for each DSP
63-
* core.
54+
* array of section descriptors. The array has 'num_sections' number
55+
* of elements. Each element in the array describes a circular buffer,
56+
* one for each DSP core.
6457
*
6558
* The remaining memory in the debug window slot is divided between
6659
* those sections. The buffers are not necessarily of equal size, like
@@ -82,11 +75,12 @@
8275
* The debug stream writes the records of abstract data to the
8376
* circular buffer, and updates the w_ptr when the record is
8477
* completely written. The host side receiver tries to keep up with the
85-
* w_ptr and keeps track of its read position. The size of the record
86-
* is written - again - after each record and before the next. This is
87-
* to allow parsing the stream backwards in an overrun recovery
88-
* situation. The w_ptr value is updated last, when the record is
89-
* completely written.
78+
* w_ptr and keeps track of its read position.
79+
*
80+
* The size of the record is written - again - after each record and
81+
* before the next. This is to allow parsing the stream backwards in
82+
* an overrun recovery situation. The w_ptr value is updated last,
83+
* when the record is completely written.
9084
*/
9185

9286
#include <stdint.h>

0 commit comments

Comments
 (0)