Skip to content

Commit

Permalink
sof: align sof structure to cache line size
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
tlauda authored and lrgirdwo committed Jan 13, 2020
1 parent 1c60097 commit 66a5ae9
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/include/sof/sof.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,20 @@
#define __SOF_SOF_H__

#include <arch/sof.h>
#include <sof/common.h>
#include <sof/lib/memory.h>

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;
Expand All @@ -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__ */

0 comments on commit 66a5ae9

Please sign in to comment.