memory: add platform_shared_commit function

Adds platform_shared_commit function for keeping shared data
synchronized. It's used after usage of data shared by different
cores. Such data is either statically marked with SHARED_DATA
or dynamically allocated with SOF_MEM_FLAG_SHARED flag.
cAVS platforms use uncached memory region, so no additional
synchronization is needed, but for SMP platforms without
uncache this function should writeback and invalidate data.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
This commit is contained in:
Tomasz Lauda 2020-01-10 14:09:10 +01:00 committed by Liam Girdwood
parent f190608d76
commit 82b8d08a28
5 changed files with 40 additions and 0 deletions

View File

@ -29,6 +29,15 @@ static inline void *platform_shared_get(void *ptr, int bytes)
return ptr;
}
/**
* \brief Function for keeping shared data synchronized.
* It's used after usage of data shared by different cores.
* Such data is either statically marked with SHARED_DATA
* or dynamically allocated with SOF_MEM_FLAG_SHARED flag.
* Does nothing, since BYT doesn't support SMP.
*/
static inline void platform_shared_commit(void *ptr, int bytes) { }
static inline void *platform_rfree_prepare(void *ptr)
{
return ptr;

View File

@ -29,6 +29,15 @@ static inline void *platform_shared_get(void *ptr, int bytes)
return ptr;
}
/**
* \brief Function for keeping shared data synchronized.
* It's used after usage of data shared by different cores.
* Such data is either statically marked with SHARED_DATA
* or dynamically allocated with SOF_MEM_FLAG_SHARED flag.
* Does nothing, since HSW doesn't support SMP.
*/
static inline void platform_shared_commit(void *ptr, int bytes) { }
static inline void *platform_rfree_prepare(void *ptr)
{
return ptr;

View File

@ -188,6 +188,15 @@ static inline void *platform_shared_get(void *ptr, int bytes)
return ptr;
}
/**
* \brief Function for keeping shared data synchronized.
* It's used after usage of data shared by different cores.
* Such data is either statically marked with SHARED_DATA
* or dynamically allocated with SOF_MEM_FLAG_SHARED flag.
* Does nothing, since IMX doesn't support SMP.
*/
static inline void platform_shared_commit(void *ptr, int bytes) { }
static inline void *platform_rfree_prepare(void *ptr)
{
return ptr;

View File

@ -111,6 +111,17 @@ static inline void *platform_shared_get(void *ptr, int bytes)
#endif
}
/**
* \brief Function for keeping shared data synchronized.
* It's used after usage of data shared by different cores.
* Such data is either statically marked with SHARED_DATA
* or dynamically allocated with SOF_MEM_FLAG_SHARED flag.
* cAVS platforms use uncached memory region, so no additional
* synchronization is needed, but for SMP platforms without uncache
* this macro should writeback and invalidate data.
*/
static inline void platform_shared_commit(void *ptr, int bytes) { }
/**
* \brief Transforms pointer if necessary before freeing the memory.
* \param[in,out] ptr Pointer to the allocated memory.

View File

@ -34,6 +34,8 @@ static inline void *platform_shared_get(void *ptr, int bytes)
return ptr;
}
static inline void platform_shared_commit(void *ptr, int bytes) { }
#endif /* __PLATFORM_LIB_MEMORY_H__ */
#else