13d0407baSopenharmony_ci# SPDX-License-Identifier: GPL-2.0-only
23d0407baSopenharmony_cimenu "DMABUF options"
33d0407baSopenharmony_ci
43d0407baSopenharmony_ciconfig SYNC_FILE
53d0407baSopenharmony_ci	bool "Explicit Synchronization Framework"
63d0407baSopenharmony_ci	default n
73d0407baSopenharmony_ci	select DMA_SHARED_BUFFER
83d0407baSopenharmony_ci	help
93d0407baSopenharmony_ci	  The Sync File Framework adds explicit synchronization via
103d0407baSopenharmony_ci	  userspace. It enables send/receive 'struct dma_fence' objects to/from
113d0407baSopenharmony_ci	  userspace via Sync File fds for synchronization between drivers via
123d0407baSopenharmony_ci	  userspace components. It has been ported from Android.
133d0407baSopenharmony_ci
143d0407baSopenharmony_ci	  The first and main user for this is graphics in which a fence is
153d0407baSopenharmony_ci	  associated with a buffer. When a job is submitted to the GPU a fence
163d0407baSopenharmony_ci	  is attached to the buffer and is transferred via userspace, using Sync
173d0407baSopenharmony_ci	  Files fds, to the DRM driver for example. More details at
183d0407baSopenharmony_ci	  Documentation/driver-api/sync_file.rst.
193d0407baSopenharmony_ci
203d0407baSopenharmony_ciconfig SW_SYNC
213d0407baSopenharmony_ci	bool "Sync File Validation Framework"
223d0407baSopenharmony_ci	default n
233d0407baSopenharmony_ci	depends on SYNC_FILE
243d0407baSopenharmony_ci	help
253d0407baSopenharmony_ci	  A sync object driver that uses a 32bit counter to coordinate
263d0407baSopenharmony_ci	  synchronization.  Useful when there is no hardware primitive backing
273d0407baSopenharmony_ci	  the synchronization.
283d0407baSopenharmony_ci
293d0407baSopenharmony_ci	  WARNING: improper use of this can result in deadlocking kernel
303d0407baSopenharmony_ci	  drivers from userspace. Intended for test and debug only.
313d0407baSopenharmony_ci
323d0407baSopenharmony_ciconfig UDMABUF
333d0407baSopenharmony_ci	bool "userspace dmabuf misc driver"
343d0407baSopenharmony_ci	default n
353d0407baSopenharmony_ci	depends on DMA_SHARED_BUFFER
363d0407baSopenharmony_ci	depends on MEMFD_CREATE || COMPILE_TEST
373d0407baSopenharmony_ci	help
383d0407baSopenharmony_ci	  A driver to let userspace turn memfd regions into dma-bufs.
393d0407baSopenharmony_ci	  Qemu can use this to create host dmabufs for guest framebuffers.
403d0407baSopenharmony_ci
413d0407baSopenharmony_ciconfig DMABUF_MOVE_NOTIFY
423d0407baSopenharmony_ci	bool "Move notify between drivers (EXPERIMENTAL)"
433d0407baSopenharmony_ci	default n
443d0407baSopenharmony_ci	depends on DMA_SHARED_BUFFER
453d0407baSopenharmony_ci	help
463d0407baSopenharmony_ci	  Don't pin buffers if the dynamic DMA-buf interface is available on
473d0407baSopenharmony_ci	  both the exporter as well as the importer. This fixes a security
483d0407baSopenharmony_ci	  problem where userspace is able to pin unrestricted amounts of memory
493d0407baSopenharmony_ci	  through DMA-buf.
503d0407baSopenharmony_ci	  This is marked experimental because we don't yet have a consistent
513d0407baSopenharmony_ci	  execution context and memory management between drivers.
523d0407baSopenharmony_ci
533d0407baSopenharmony_ciconfig DMABUF_SELFTESTS
543d0407baSopenharmony_ci	tristate "Selftests for the dma-buf interfaces"
553d0407baSopenharmony_ci	default n
563d0407baSopenharmony_ci	depends on DMA_SHARED_BUFFER
573d0407baSopenharmony_ci
583d0407baSopenharmony_ciconfig DMABUF_PROCESS_INFO
593d0407baSopenharmony_ci	bool "Show dmabuf usage of all processes"
603d0407baSopenharmony_ci	default n
613d0407baSopenharmony_ci	depends on DMA_SHARED_BUFFER
623d0407baSopenharmony_ci	depends on PROC_FS || DEBUG_FS
633d0407baSopenharmony_ci	help
643d0407baSopenharmony_ci	  Choose this option to show dmabuf objects usage of all processes.
653d0407baSopenharmony_ci	  Firstly, with this option, when a process creates a dmabuf object,
663d0407baSopenharmony_ci	  its pid and task_comm will be recorded in the dmabuf.
673d0407baSopenharmony_ci	  Secondly, this option creates dma_buf/process_bufinfo file in
683d0407baSopenharmony_ci	  debugfs (if DEBUG_FS enabled) and process_dmabuf_info file in procfs
693d0407baSopenharmony_ci	  (if PROC_FS enabled) to show dmabuf objects usage of all processes.
703d0407baSopenharmony_ci
713d0407baSopenharmony_cimenuconfig DMABUF_HEAPS
723d0407baSopenharmony_ci	bool "DMA-BUF Userland Memory Heaps"
733d0407baSopenharmony_ci	select DMA_SHARED_BUFFER
743d0407baSopenharmony_ci	help
753d0407baSopenharmony_ci	  Choose this option to enable the DMA-BUF userland memory heaps.
763d0407baSopenharmony_ci	  This options creates per heap chardevs in /dev/dma_heap/ which
773d0407baSopenharmony_ci	  allows userspace to allocate dma-bufs that can be shared
783d0407baSopenharmony_ci	  between drivers.
793d0407baSopenharmony_ci
803d0407baSopenharmony_cimenuconfig DMABUF_SYSFS_STATS
813d0407baSopenharmony_ci	bool "DMA-BUF sysfs statistics"
823d0407baSopenharmony_ci	depends on DMA_SHARED_BUFFER
833d0407baSopenharmony_ci	help
843d0407baSopenharmony_ci	   Choose this option to enable DMA-BUF sysfs statistics
853d0407baSopenharmony_ci	   in location /sys/kernel/dmabuf/buffers.
863d0407baSopenharmony_ci
873d0407baSopenharmony_ci	   /sys/kernel/dmabuf/buffers/<inode_number> will contain
883d0407baSopenharmony_ci	   statistics for the DMA-BUF with the unique inode number
893d0407baSopenharmony_ci	   <inode_number>.
903d0407baSopenharmony_ci
913d0407baSopenharmony_cisource "drivers/dma-buf/heaps/Kconfig"
923d0407baSopenharmony_ci
933d0407baSopenharmony_ciendmenu
94