Re: [PATCH v3] misc: sram: Add DMA-BUF Heap exporting of SRAM areas

From: Greg Kroah-Hartman
Date: Thu Jul 13 2023 - 15:28:55 EST


On Thu, Jul 13, 2023 at 02:13:16PM -0500, Andrew Davis wrote:
> This new export type exposes to userspace the SRAM area as a DMA-BUF Heap,
> this allows for allocations of DMA-BUFs that can be consumed by various
> DMA-BUF supporting devices.

What devices exactly?

And what userspace tools/programs are going to use this api?

>
> Signed-off-by: Andrew Davis <afd@xxxxxx>
> ---
>
> Changes from v2:
> - Make sram_dma_heap_allocate static (kernel test robot)
> - Rebase on v6.5-rc1
>
> drivers/misc/Kconfig | 7 +
> drivers/misc/Makefile | 1 +
> drivers/misc/sram-dma-heap.c | 245 +++++++++++++++++++++++++++++++++++
> drivers/misc/sram.c | 6 +
> drivers/misc/sram.h | 16 +++
> 5 files changed, 275 insertions(+)
> create mode 100644 drivers/misc/sram-dma-heap.c
>
> diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
> index 75e427f124b28..ee34dfb61605f 100644
> --- a/drivers/misc/Kconfig
> +++ b/drivers/misc/Kconfig
> @@ -448,6 +448,13 @@ config SRAM
> config SRAM_EXEC
> bool
>
> +config SRAM_DMA_HEAP
> + bool "Export on-chip SRAM pools using DMA-Heaps"
> + depends on DMABUF_HEAPS && SRAM
> + help
> + This driver allows the export of on-chip SRAM marked as both pool
> + and exportable to userspace using the DMA-Heaps interface.

Module name?

> config DW_XDATA_PCIE
> depends on PCI
> tristate "Synopsys DesignWare xData PCIe driver"
> diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
> index f2a4d1ff65d46..5e7516bfaa8de 100644
> --- a/drivers/misc/Makefile
> +++ b/drivers/misc/Makefile
> @@ -47,6 +47,7 @@ obj-$(CONFIG_VMWARE_VMCI) += vmw_vmci/
> obj-$(CONFIG_LATTICE_ECP3_CONFIG) += lattice-ecp3-config.o
> obj-$(CONFIG_SRAM) += sram.o
> obj-$(CONFIG_SRAM_EXEC) += sram-exec.o
> +obj-$(CONFIG_SRAM_DMA_HEAP) += sram-dma-heap.o
> obj-$(CONFIG_GENWQE) += genwqe/
> obj-$(CONFIG_ECHO) += echo/
> obj-$(CONFIG_CXL_BASE) += cxl/
> diff --git a/drivers/misc/sram-dma-heap.c b/drivers/misc/sram-dma-heap.c
> new file mode 100644
> index 0000000000000..c054c04dff33e
> --- /dev/null
> +++ b/drivers/misc/sram-dma-heap.c
> @@ -0,0 +1,245 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * SRAM DMA-Heap userspace exporter
> + *
> + * Copyright (C) 2019-2022 Texas Instruments Incorporated - https://www.ti.com/
> + * Andrew Davis <afd@xxxxxx>

It's 2023 :(

And this needs review from the dma-buf maintainers before I could do
anything with it.

thanks,

greg k-h