Skip to content

Commit 66cb904

Browse files
committed
rtos: alloc: Fix SOF_MEM_FLAG_* values
Commit 5821682 ("heap: simplify heap API") changed the heap API to make it more like Linux kernel API. For example: -> rballoc_align(flags, caps, bytes, align) transformed into: -> rballoc_align(flags, bytes, align) So, caps was merged into flags! Causing overrun_permitted to be set and making a lots of test (e.g SRC, Compress) to fail. The original `flags` were the SOF_BUF_ flags mostly sent from Linux and read from topology (e.g SOF_BUF_OVERRUN_PERMITTED, SOF_BUF_UNDERRUN_PERMITTED). But the new `flags` SOF_MEM_FLAG_* did not take this into account and overlap with the older flags. For now, what we can do is just shift the new flags so that they do not overlap with the old flags. Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
1 parent 42c0875 commit 66cb904

File tree

2 files changed

+28
-16
lines changed

2 files changed

+28
-16
lines changed

posix/include/rtos/alloc.h

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,28 @@
3232
* @{
3333
*/
3434

35+
/*
36+
* for compatibility with the initial `flags` meaning
37+
* SOF_MEM_FLAG_ should start at BIT(2)
38+
* the first two positions are reserved for SOF_BUF_ flags
39+
*/
40+
3541
/** \brief Indicates we should return DMA-able memory. */
36-
#define SOF_MEM_FLAG_DMA BIT(0)
42+
#define SOF_MEM_FLAG_DMA BIT(2)
3743
/** \brief Indicates that original content should not be copied by realloc. */
38-
#define SOF_MEM_FLAG_NO_COPY BIT(1)
44+
#define SOF_MEM_FLAG_NO_COPY BIT(3)
3945
/** \brief Indicates that if we should return uncached address. */
40-
#define SOF_MEM_FLAG_COHERENT BIT(2)
46+
#define SOF_MEM_FLAG_COHERENT BIT(4)
4147
/** \brief Indicates that if we should return L3 address. */
42-
#define SOF_MEM_FLAG_L3 BIT(3)
48+
#define SOF_MEM_FLAG_L3 BIT(5)
4349
/** \brief Indicates that if we should return Low power memory address. */
44-
#define SOF_MEM_FLAG_LOW_POWER BIT(4)
50+
#define SOF_MEM_FLAG_LOW_POWER BIT(6)
4551
/** \brief Indicates that if we should return kernel memory address. */
46-
#define SOF_MEM_FLAG_KERNEL BIT(5)
52+
#define SOF_MEM_FLAG_KERNEL BIT(7)
4753
/** \brief Indicates that if we should return user memory address. */
48-
#define SOF_MEM_FLAG_USER BIT(6)
54+
#define SOF_MEM_FLAG_USER BIT(8)
4955
/** \brief Indicates that if we should return shared user memory address. */
50-
#define SOF_MEM_FLAG_USER_SHARED_BUFFER BIT(7)
56+
#define SOF_MEM_FLAG_USER_SHARED_BUFFER BIT(9)
5157

5258
/** @} */
5359

zephyr/include/rtos/alloc.h

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,32 @@
1919
* @{
2020
*/
2121

22+
/*
23+
* for compatibility with the initial `flags` meaning
24+
* SOF_MEM_FLAG_ should start at BIT(2)
25+
* the first two positions are reserved for SOF_BUF_ flags
26+
*/
27+
2228
/** \name Heap zone flags
2329
* @{
2430
*/
2531

2632
/** \brief Indicates we should return DMA-able memory. */
27-
#define SOF_MEM_FLAG_DMA BIT(0)
33+
#define SOF_MEM_FLAG_DMA BIT(1)
2834
/** \brief Indicates that original content should not be copied by realloc. */
29-
#define SOF_MEM_FLAG_NO_COPY BIT(1)
35+
#define SOF_MEM_FLAG_NO_COPY BIT(2)
3036
/** \brief Indicates that if we should return uncached address. */
31-
#define SOF_MEM_FLAG_COHERENT BIT(2)
37+
#define SOF_MEM_FLAG_COHERENT BIT(3)
3238
/** \brief Indicates that if we should return L3 address. */
33-
#define SOF_MEM_FLAG_L3 BIT(3)
39+
#define SOF_MEM_FLAG_L3 BIT(4)
3440
/** \brief Indicates that if we should return Low power memory address. */
35-
#define SOF_MEM_FLAG_LOW_POWER BIT(4)
41+
#define SOF_MEM_FLAG_LOW_POWER BIT(5)
3642
/** \brief Indicates that if we should return kernel memory address. */
37-
#define SOF_MEM_FLAG_KERNEL BIT(5)
43+
#define SOF_MEM_FLAG_KERNEL BIT(6)
3844
/** \brief Indicates that if we should return user memory address. */
39-
#define SOF_MEM_FLAG_USER BIT(6)
45+
#define SOF_MEM_FLAG_USER BIT(7)
4046
/** \brief Indicates that if we should return shared user memory address. */
41-
#define SOF_MEM_FLAG_USER_SHARED_BUFFER BIT(7)
47+
#define SOF_MEM_FLAG_USER_SHARED_BUFFER BIT(8)
4248

4349
/** @} */
4450

0 commit comments

Comments
 (0)