18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_cimenu "DMABUF options"
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ciconfig SYNC_FILE
58c2ecf20Sopenharmony_ci	bool "Explicit Synchronization Framework"
68c2ecf20Sopenharmony_ci	default n
78c2ecf20Sopenharmony_ci	select DMA_SHARED_BUFFER
88c2ecf20Sopenharmony_ci	help
98c2ecf20Sopenharmony_ci	  The Sync File Framework adds explicit synchronization via
108c2ecf20Sopenharmony_ci	  userspace. It enables send/receive 'struct dma_fence' objects to/from
118c2ecf20Sopenharmony_ci	  userspace via Sync File fds for synchronization between drivers via
128c2ecf20Sopenharmony_ci	  userspace components. It has been ported from Android.
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci	  The first and main user for this is graphics in which a fence is
158c2ecf20Sopenharmony_ci	  associated with a buffer. When a job is submitted to the GPU a fence
168c2ecf20Sopenharmony_ci	  is attached to the buffer and is transferred via userspace, using Sync
178c2ecf20Sopenharmony_ci	  Files fds, to the DRM driver for example. More details at
188c2ecf20Sopenharmony_ci	  Documentation/driver-api/sync_file.rst.
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ciconfig SW_SYNC
218c2ecf20Sopenharmony_ci	bool "Sync File Validation Framework"
228c2ecf20Sopenharmony_ci	default n
238c2ecf20Sopenharmony_ci	depends on SYNC_FILE
248c2ecf20Sopenharmony_ci	depends on DEBUG_FS
258c2ecf20Sopenharmony_ci	help
268c2ecf20Sopenharmony_ci	  A sync object driver that uses a 32bit counter to coordinate
278c2ecf20Sopenharmony_ci	  synchronization.  Useful when there is no hardware primitive backing
288c2ecf20Sopenharmony_ci	  the synchronization.
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci	  WARNING: improper use of this can result in deadlocking kernel
318c2ecf20Sopenharmony_ci	  drivers from userspace. Intended for test and debug only.
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ciconfig UDMABUF
348c2ecf20Sopenharmony_ci	bool "userspace dmabuf misc driver"
358c2ecf20Sopenharmony_ci	default n
368c2ecf20Sopenharmony_ci	depends on DMA_SHARED_BUFFER
378c2ecf20Sopenharmony_ci	depends on MEMFD_CREATE || COMPILE_TEST
388c2ecf20Sopenharmony_ci	help
398c2ecf20Sopenharmony_ci	  A driver to let userspace turn memfd regions into dma-bufs.
408c2ecf20Sopenharmony_ci	  Qemu can use this to create host dmabufs for guest framebuffers.
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ciconfig DMABUF_MOVE_NOTIFY
438c2ecf20Sopenharmony_ci	bool "Move notify between drivers (EXPERIMENTAL)"
448c2ecf20Sopenharmony_ci	default n
458c2ecf20Sopenharmony_ci	depends on DMA_SHARED_BUFFER
468c2ecf20Sopenharmony_ci	help
478c2ecf20Sopenharmony_ci	  Don't pin buffers if the dynamic DMA-buf interface is available on
488c2ecf20Sopenharmony_ci	  both the exporter as well as the importer. This fixes a security
498c2ecf20Sopenharmony_ci	  problem where userspace is able to pin unrestricted amounts of memory
508c2ecf20Sopenharmony_ci	  through DMA-buf.
518c2ecf20Sopenharmony_ci	  This is marked experimental because we don't yet have a consistent
528c2ecf20Sopenharmony_ci	  execution context and memory management between drivers.
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ciconfig DMABUF_SELFTESTS
558c2ecf20Sopenharmony_ci	tristate "Selftests for the dma-buf interfaces"
568c2ecf20Sopenharmony_ci	default n
578c2ecf20Sopenharmony_ci	depends on DMA_SHARED_BUFFER
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ciconfig DMABUF_PROCESS_INFO
608c2ecf20Sopenharmony_ci	bool "Show dmabuf usage of all processes"
618c2ecf20Sopenharmony_ci	default n
628c2ecf20Sopenharmony_ci	depends on DMA_SHARED_BUFFER
638c2ecf20Sopenharmony_ci	depends on PROC_FS || DEBUG_FS
648c2ecf20Sopenharmony_ci	help
658c2ecf20Sopenharmony_ci	  Choose this option to show dmabuf objects usage of all processes.
668c2ecf20Sopenharmony_ci	  Firstly, with this option, when a process creates a dmabuf object,
678c2ecf20Sopenharmony_ci	  its pid and task_comm will be recorded in the dmabuf.
688c2ecf20Sopenharmony_ci	  Secondly, this option creates dma_buf/process_bufinfo file in
698c2ecf20Sopenharmony_ci	  debugfs (if DEBUG_FS enabled) and process_dmabuf_info file in procfs
708c2ecf20Sopenharmony_ci	  (if PROC_FS enabled) to show dmabuf objects usage of all processes.
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_cimenuconfig DMABUF_HEAPS
738c2ecf20Sopenharmony_ci	bool "DMA-BUF Userland Memory Heaps"
748c2ecf20Sopenharmony_ci	select DMA_SHARED_BUFFER
758c2ecf20Sopenharmony_ci	help
768c2ecf20Sopenharmony_ci	  Choose this option to enable the DMA-BUF userland memory heaps.
778c2ecf20Sopenharmony_ci	  This options creates per heap chardevs in /dev/dma_heap/ which
788c2ecf20Sopenharmony_ci	  allows userspace to allocate dma-bufs that can be shared
798c2ecf20Sopenharmony_ci	  between drivers.
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_cimenuconfig DMABUF_SYSFS_STATS
828c2ecf20Sopenharmony_ci	bool "DMA-BUF sysfs statistics"
838c2ecf20Sopenharmony_ci	depends on DMA_SHARED_BUFFER
848c2ecf20Sopenharmony_ci	help
858c2ecf20Sopenharmony_ci	   Choose this option to enable DMA-BUF sysfs statistics
868c2ecf20Sopenharmony_ci	   in location /sys/kernel/dmabuf/buffers.
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ci	   /sys/kernel/dmabuf/buffers/<inode_number> will contain
898c2ecf20Sopenharmony_ci	   statistics for the DMA-BUF with the unique inode number
908c2ecf20Sopenharmony_ci	   <inode_number>.
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_cisource "drivers/dma-buf/heaps/Kconfig"
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ciendmenu
95