[PATCH 0/2] bouncebuf: Allow allocation from U-Boot heap

Certain platforms have IP's which are unable to access memory locations above a particular address. Add a config symbol which forces the bounce buffer to be allocated from U-Boot's heap area, and enable this option on the starfive visionfive2 boards which have this issue.
@E Shattow - Since you were observing this issue on your boards even after Heinrich's patches, please test this series on your board. Thanks.
Sughosh Ganu (2): bouncebuf: allow for allocating bounce buffer frome heap configs: starfive_visionfive2: allocate bounce buffer from heap
common/bouncebuf.c | 2 +- configs/starfive_visionfive2_defconfig | 1 + drivers/core/Kconfig | 7 +++++++ 3 files changed, 9 insertions(+), 1 deletion(-)

The current bounce buffer logic checks if the user passed buffer is DMA aligned, and if so, the same buffer is used. This can be an issue on platforms which have certain IP's that are unable to access memory addresses above a certain point. Introduce a config symbol that can be used by such platforms which forces the bounce buffer logic to allocate the buffer from the heap which is part of the U-Boot image area.
Signed-off-by: Sughosh Ganu sughosh.ganu@linaro.org --- common/bouncebuf.c | 2 +- drivers/core/Kconfig | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/common/bouncebuf.c b/common/bouncebuf.c index b2f87e4d93..f827378e5f 100644 --- a/common/bouncebuf.c +++ b/common/bouncebuf.c @@ -44,7 +44,7 @@ int bounce_buffer_start_extalign(struct bounce_buffer *state, void *data, state->len_aligned = roundup(len, alignment); state->flags = flags;
- if (!addr_is_aligned(state)) { + if (CONFIG_IS_ENABLED(BOUNCE_BUFFER_ALLOC) || !addr_is_aligned(state)) { state->bounce_buffer = memalign(alignment, state->len_aligned); if (!state->bounce_buffer) diff --git a/drivers/core/Kconfig b/drivers/core/Kconfig index 6b4330fe4e..94258e8761 100644 --- a/drivers/core/Kconfig +++ b/drivers/core/Kconfig @@ -476,4 +476,11 @@ config BOUNCE_BUFFER A second possible use of bounce buffers is their ability to provide aligned buffers for DMA operations.
+config BOUNCE_BUFFER_ALLOC + bool "Allocate memory for bounce buffer" + depends on BOUNCE_BUFFER + help + Certain platforms have IP's which are unable to access addresses above + a certain value. This symbol forces the bounce buffer to be allocated + from within the U-Boot image area for such platforms. endmenu

The boards using this config have a mmc controller IP which is unable to access memory regions above 4GB. Enable the CONFIG_BOUNCE_BUFFER_ALLOC config for these platforms. This symbol forces the allocation of the bounce buffer to be done from the U-Boot heap area.
Signed-off-by: Sughosh Ganu sughosh.ganu@linaro.org --- configs/starfive_visionfive2_defconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/configs/starfive_visionfive2_defconfig b/configs/starfive_visionfive2_defconfig index 20f89ae679..bd071880aa 100644 --- a/configs/starfive_visionfive2_defconfig +++ b/configs/starfive_visionfive2_defconfig @@ -86,6 +86,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SPL_DM_SEQ_ALIAS=y CONFIG_REGMAP=y CONFIG_SYSCON=y +CONFIG_BOUNCE_BUFFER_ALLOC=y CONFIG_SPL_CLK_COMPOSITE_CCF=y CONFIG_CLK_COMPOSITE_CCF=y CONFIG_SPL_CLK_JH7110=y
participants (1)
-
Sughosh Ganu