[PATCH 11/20] dma: support marking SRAM for coherent DMA use
Sascha Hauer
sha at pengutronix.de
Mon Jun 7 00:39:25 PDT 2021
On Mon, May 31, 2021 at 09:38:12AM +0200, Ahmad Fatoum wrote:
> The RISC-V architecture allows overriding the dma_alloc_coherent and
> dma_free_coherent. Allow this to be controlled by device tree.
>
> Cache-coherent SoCs won't need this, but incoherent ones that have
> uncached regions can register them here.
>
> Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
> ---
> common/Kconfig | 4 ++
> common/Makefile | 3 +-
> drivers/dma/Kconfig | 6 ++
> drivers/dma/Makefile | 1 +
> drivers/dma/coherent-pool.c | 120 ++++++++++++++++++++++++++++++++++++
> 5 files changed, 133 insertions(+), 1 deletion(-)
> create mode 100644 drivers/dma/coherent-pool.c
>
> diff --git a/common/Kconfig b/common/Kconfig
> index ce349d4ebbf6..dbbcbb946fff 100644
> --- a/common/Kconfig
> +++ b/common/Kconfig
> @@ -303,6 +303,9 @@ config EXPERIMENTAL
> bool
> prompt "Prompt for experimental code"
>
> +config TLSF
> + bool
> +
> choice
> prompt "malloc implementation"
>
> @@ -311,6 +314,7 @@ config MALLOC_DLMALLOC
>
> config MALLOC_TLSF
> bool "tlsf"
> + select TLSF
>
> config MALLOC_DUMMY
> bool "dummy malloc"
> diff --git a/common/Makefile b/common/Makefile
> index 382a4f661f67..0777d2030c99 100644
> --- a/common/Makefile
> +++ b/common/Makefile
> @@ -40,7 +40,8 @@ obj-$(CONFIG_GLOBALVAR) += globalvar.o
> obj-$(CONFIG_GREGORIAN_CALENDER) += date.o
> obj-$(CONFIG_KALLSYMS) += kallsyms.o
> obj-$(CONFIG_MALLOC_DLMALLOC) += dlmalloc.o
> -obj-$(CONFIG_MALLOC_TLSF) += tlsf_malloc.o tlsf.o calloc.o
> +obj-$(CONFIG_TLSF) += tlsf.o
> +obj-$(CONFIG_MALLOC_TLSF) += tlsf_malloc.o calloc.o
> KASAN_SANITIZE_tlsf.o := n
> obj-$(CONFIG_MALLOC_DUMMY) += dummy_malloc.o calloc.o
> obj-$(CONFIG_MEMINFO) += meminfo.o
> diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
> index c75fc8b9811f..6bc915585fbe 100644
> --- a/drivers/dma/Kconfig
> +++ b/drivers/dma/Kconfig
> @@ -1,5 +1,11 @@
> menu "DMA support"
>
> +config DMA_COHERENT_POOLS
> + bool
> + depends on RISCV
> + select TLSF
> + imply SRAM
This symbol is invisible and selected when needed. We shouldn't need
this "depends on RISCV"
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the barebox
mailing list