From 66a5ae978df83195ee1c82bdec5bb5180dbdbb69 Mon Sep 17 00:00:00 2001 From: Tomasz Lauda Date: Thu, 19 Dec 2019 14:13:06 +0100 Subject: [PATCH] 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 --- src/include/sof/sof.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/include/sof/sof.h b/src/include/sof/sof.h index f7438d612f59..dcb3a4c4395c 100644 --- a/src/include/sof/sof.h +++ b/src/include/sof/sof.h @@ -9,12 +9,20 @@ #define __SOF_SOF_H__ #include +#include +#include struct dma_trace_data; struct ipc; struct sa; -/* general firmware context */ +/** + * \brief General firmware context. + * This structure holds all the global pointers, which can potentially + * be accessed by SMP code, hence it should be aligned to platform's + * data cache line size. Alignments in the both beginning and end are needed + * to avoid potential before and after data evictions. + */ struct sof { /* init data */ int argc; @@ -28,6 +36,8 @@ struct sof { /* DMA for Trace*/ struct dma_trace_data *dmat; -}; + + __aligned(PLATFORM_DCACHE_ALIGN) int alignment[0]; +} __aligned(PLATFORM_DCACHE_ALIGN); #endif /* __SOF_SOF_H__ */