Skip to content

Commit 66a5ae9

Browse files
tlaudalrgirdwo
authored andcommitted
sof: align sof structure to cache line size
Aligns sof structure to cache line size. It is needed in order to assure that no data will be randomly overwritten by cache eviction with multicore access. Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
1 parent 1c60097 commit 66a5ae9

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

src/include/sof/sof.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,20 @@
99
#define __SOF_SOF_H__
1010

1111
#include <arch/sof.h>
12+
#include <sof/common.h>
13+
#include <sof/lib/memory.h>
1214

1315
struct dma_trace_data;
1416
struct ipc;
1517
struct sa;
1618

17-
/* general firmware context */
19+
/**
20+
* \brief General firmware context.
21+
* This structure holds all the global pointers, which can potentially
22+
* be accessed by SMP code, hence it should be aligned to platform's
23+
* data cache line size. Alignments in the both beginning and end are needed
24+
* to avoid potential before and after data evictions.
25+
*/
1826
struct sof {
1927
/* init data */
2028
int argc;
@@ -28,6 +36,8 @@ struct sof {
2836

2937
/* DMA for Trace*/
3038
struct dma_trace_data *dmat;
31-
};
39+
40+
__aligned(PLATFORM_DCACHE_ALIGN) int alignment[0];
41+
} __aligned(PLATFORM_DCACHE_ALIGN);
3242

3343
#endif /* __SOF_SOF_H__ */

0 commit comments

Comments
 (0)