162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0-only
262306a36Sopenharmony_cimenu "DMABUF options"
362306a36Sopenharmony_ci
462306a36Sopenharmony_ciconfig SYNC_FILE
562306a36Sopenharmony_ci	bool "Explicit Synchronization Framework"
662306a36Sopenharmony_ci	default n
762306a36Sopenharmony_ci	select DMA_SHARED_BUFFER
862306a36Sopenharmony_ci	help
962306a36Sopenharmony_ci	  The Sync File Framework adds explicit synchronization via
1062306a36Sopenharmony_ci	  userspace. It enables send/receive 'struct dma_fence' objects to/from
1162306a36Sopenharmony_ci	  userspace via Sync File fds for synchronization between drivers via
1262306a36Sopenharmony_ci	  userspace components. It has been ported from Android.
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci	  The first and main user for this is graphics in which a fence is
1562306a36Sopenharmony_ci	  associated with a buffer. When a job is submitted to the GPU a fence
1662306a36Sopenharmony_ci	  is attached to the buffer and is transferred via userspace, using Sync
1762306a36Sopenharmony_ci	  Files fds, to the DRM driver for example. More details at
1862306a36Sopenharmony_ci	  Documentation/driver-api/sync_file.rst.
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ciconfig SW_SYNC
2162306a36Sopenharmony_ci	bool "Sync File Validation Framework"
2262306a36Sopenharmony_ci	default n
2362306a36Sopenharmony_ci	depends on SYNC_FILE
2462306a36Sopenharmony_ci	depends on DEBUG_FS
2562306a36Sopenharmony_ci	help
2662306a36Sopenharmony_ci	  A sync object driver that uses a 32bit counter to coordinate
2762306a36Sopenharmony_ci	  synchronization.  Useful when there is no hardware primitive backing
2862306a36Sopenharmony_ci	  the synchronization.
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci	  WARNING: improper use of this can result in deadlocking kernel
3162306a36Sopenharmony_ci	  drivers from userspace. Intended for test and debug only.
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ciconfig UDMABUF
3462306a36Sopenharmony_ci	bool "userspace dmabuf misc driver"
3562306a36Sopenharmony_ci	default n
3662306a36Sopenharmony_ci	depends on DMA_SHARED_BUFFER
3762306a36Sopenharmony_ci	depends on MEMFD_CREATE || COMPILE_TEST
3862306a36Sopenharmony_ci	help
3962306a36Sopenharmony_ci	  A driver to let userspace turn memfd regions into dma-bufs.
4062306a36Sopenharmony_ci	  Qemu can use this to create host dmabufs for guest framebuffers.
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ciconfig DMABUF_MOVE_NOTIFY
4362306a36Sopenharmony_ci	bool "Move notify between drivers (EXPERIMENTAL)"
4462306a36Sopenharmony_ci	default n
4562306a36Sopenharmony_ci	depends on DMA_SHARED_BUFFER
4662306a36Sopenharmony_ci	help
4762306a36Sopenharmony_ci	  Don't pin buffers if the dynamic DMA-buf interface is available on
4862306a36Sopenharmony_ci	  both the exporter as well as the importer. This fixes a security
4962306a36Sopenharmony_ci	  problem where userspace is able to pin unrestricted amounts of memory
5062306a36Sopenharmony_ci	  through DMA-buf.
5162306a36Sopenharmony_ci	  This is marked experimental because we don't yet have a consistent
5262306a36Sopenharmony_ci	  execution context and memory management between drivers.
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ciconfig DMABUF_DEBUG
5562306a36Sopenharmony_ci	bool "DMA-BUF debug checks"
5662306a36Sopenharmony_ci	depends on DMA_SHARED_BUFFER
5762306a36Sopenharmony_ci	default y if DMA_API_DEBUG
5862306a36Sopenharmony_ci	help
5962306a36Sopenharmony_ci	  This option enables additional checks for DMA-BUF importers and
6062306a36Sopenharmony_ci	  exporters. Specifically it validates that importers do not peek at the
6162306a36Sopenharmony_ci	  underlying struct page when they import a buffer.
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ciconfig DMABUF_SELFTESTS
6462306a36Sopenharmony_ci	tristate "Selftests for the dma-buf interfaces"
6562306a36Sopenharmony_ci	default n
6662306a36Sopenharmony_ci	depends on DMA_SHARED_BUFFER
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ciconfig DMABUF_PROCESS_INFO
6962306a36Sopenharmony_ci	bool "Show dmabuf usage of all processes"
7062306a36Sopenharmony_ci	default n
7162306a36Sopenharmony_ci	depends on DMA_SHARED_BUFFER
7262306a36Sopenharmony_ci	depends on PROC_FS || DEBUG_FS
7362306a36Sopenharmony_ci	help
7462306a36Sopenharmony_ci	  Choose this option to show dmabuf objects usage of all processes.
7562306a36Sopenharmony_ci	  Firstly, with this option, when a process creates a dmabuf object,
7662306a36Sopenharmony_ci	  its pid and task_comm will be recorded in the dmabuf.
7762306a36Sopenharmony_ci	  Secondly, this option creates dma_buf/process_bufinfo file in
7862306a36Sopenharmony_ci	  debugfs (if DEBUG_FS enabled) and process_dmabuf_info file in procfs
7962306a36Sopenharmony_ci	  (if PROC_FS enabled) to show dmabuf objects usage of all processes.
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_cimenuconfig DMABUF_HEAPS
8262306a36Sopenharmony_ci	bool "DMA-BUF Userland Memory Heaps"
8362306a36Sopenharmony_ci	select DMA_SHARED_BUFFER
8462306a36Sopenharmony_ci	help
8562306a36Sopenharmony_ci	  Choose this option to enable the DMA-BUF userland memory heaps.
8662306a36Sopenharmony_ci	  This options creates per heap chardevs in /dev/dma_heap/ which
8762306a36Sopenharmony_ci	  allows userspace to allocate dma-bufs that can be shared
8862306a36Sopenharmony_ci	  between drivers.
8962306a36Sopenharmony_ci
9062306a36Sopenharmony_cimenuconfig DMABUF_SYSFS_STATS
9162306a36Sopenharmony_ci	bool "DMA-BUF sysfs statistics (DEPRECATED)"
9262306a36Sopenharmony_ci	depends on DMA_SHARED_BUFFER
9362306a36Sopenharmony_ci	help
9462306a36Sopenharmony_ci	   Choose this option to enable DMA-BUF sysfs statistics
9562306a36Sopenharmony_ci	   in location /sys/kernel/dmabuf/buffers.
9662306a36Sopenharmony_ci
9762306a36Sopenharmony_ci	   /sys/kernel/dmabuf/buffers/<inode_number> will contain
9862306a36Sopenharmony_ci	   statistics for the DMA-BUF with the unique inode number
9962306a36Sopenharmony_ci	   <inode_number>.
10062306a36Sopenharmony_ci
10162306a36Sopenharmony_ci	   This option is deprecated and should sooner or later be removed.
10262306a36Sopenharmony_ci	   Android is the only user of this and it turned out that this resulted
10362306a36Sopenharmony_ci	   in quite some performance problems.
10462306a36Sopenharmony_ci
10562306a36Sopenharmony_cisource "drivers/dma-buf/heaps/Kconfig"
10662306a36Sopenharmony_ci
10762306a36Sopenharmony_ciendmenu
108