xref: /linux/drivers/dma-buf/Kconfig (revision 25768de50b1f2dbb6ea44bd5148a87fe2c9c3688)
1ec8f24b7SThomas Gleixner# SPDX-License-Identifier: GPL-2.0-only
262304fb1SGustavo Padovanmenu "DMABUF options"
362304fb1SGustavo Padovan
462304fb1SGustavo Padovanconfig SYNC_FILE
531954660SGustavo Padovan	bool "Explicit Synchronization Framework"
662304fb1SGustavo Padovan	default n
762304fb1SGustavo Padovan	select DMA_SHARED_BUFFER
8a7f7f624SMasahiro Yamada	help
93e8a3844SChristophe JAILLET	  The Sync File Framework adds explicit synchronization via
10f54d1867SChris Wilson	  userspace. It enables send/receive 'struct dma_fence' objects to/from
1131954660SGustavo Padovan	  userspace via Sync File fds for synchronization between drivers via
1231954660SGustavo Padovan	  userspace components. It has been ported from Android.
1331954660SGustavo Padovan
1431954660SGustavo Padovan	  The first and main user for this is graphics in which a fence is
1531954660SGustavo Padovan	  associated with a buffer. When a job is submitted to the GPU a fence
1631954660SGustavo Padovan	  is attached to the buffer and is transferred via userspace, using Sync
1731954660SGustavo Padovan	  Files fds, to the DRM driver for example. More details at
18baa293e9SMauro Carvalho Chehab	  Documentation/driver-api/sync_file.rst.
1931954660SGustavo Padovan
2035538d78SGustavo Padovanconfig SW_SYNC
2135538d78SGustavo Padovan	bool "Sync File Validation Framework"
2235538d78SGustavo Padovan	default n
2335538d78SGustavo Padovan	depends on SYNC_FILE
2435538d78SGustavo Padovan	depends on DEBUG_FS
25a7f7f624SMasahiro Yamada	help
2635538d78SGustavo Padovan	  A sync object driver that uses a 32bit counter to coordinate
2735538d78SGustavo Padovan	  synchronization.  Useful when there is no hardware primitive backing
2835538d78SGustavo Padovan	  the synchronization.
2935538d78SGustavo Padovan
3035538d78SGustavo Padovan	  WARNING: improper use of this can result in deadlocking kernel
3135538d78SGustavo Padovan	  drivers from userspace. Intended for test and debug only.
3235538d78SGustavo Padovan
33fbb0de79SGerd Hoffmannconfig UDMABUF
34fbb0de79SGerd Hoffmann	bool "userspace dmabuf misc driver"
35fbb0de79SGerd Hoffmann	default n
36fbb0de79SGerd Hoffmann	depends on DMA_SHARED_BUFFER
3768d2f70eSGerd Hoffmann	depends on MEMFD_CREATE || COMPILE_TEST
38725553d2SArnd Bergmann	depends on MMU
39*18d7de82SHuan Yang	select VMAP_PFN
40fbb0de79SGerd Hoffmann	help
41fbb0de79SGerd Hoffmann	  A driver to let userspace turn memfd regions into dma-bufs.
42fbb0de79SGerd Hoffmann	  Qemu can use this to create host dmabufs for guest framebuffers.
43fbb0de79SGerd Hoffmann
44bb42df46SChristian Königconfig DMABUF_MOVE_NOTIFY
45bb42df46SChristian König	bool "Move notify between drivers (EXPERIMENTAL)"
46bb42df46SChristian König	default n
47c4f3a346SGeert Uytterhoeven	depends on DMA_SHARED_BUFFER
48bb42df46SChristian König	help
49518110cdSGeert Uytterhoeven	  Don't pin buffers if the dynamic DMA-buf interface is available on
50518110cdSGeert Uytterhoeven	  both the exporter as well as the importer. This fixes a security
51518110cdSGeert Uytterhoeven	  problem where userspace is able to pin unrestricted amounts of memory
52518110cdSGeert Uytterhoeven	  through DMA-buf.
53518110cdSGeert Uytterhoeven	  This is marked experimental because we don't yet have a consistent
54518110cdSGeert Uytterhoeven	  execution context and memory management between drivers.
55bb42df46SChristian König
5684335675SDaniel Vetterconfig DMABUF_DEBUG
5784335675SDaniel Vetter	bool "DMA-BUF debug checks"
58cca62758SGeert Uytterhoeven	depends on DMA_SHARED_BUFFER
5984335675SDaniel Vetter	default y if DMA_API_DEBUG
6084335675SDaniel Vetter	help
6184335675SDaniel Vetter	  This option enables additional checks for DMA-BUF importers and
6284335675SDaniel Vetter	  exporters. Specifically it validates that importers do not peek at the
6384335675SDaniel Vetter	  underlying struct page when they import a buffer.
6484335675SDaniel Vetter
659536b64aSChris Wilsonconfig DMABUF_SELFTESTS
669536b64aSChris Wilson	tristate "Selftests for the dma-buf interfaces"
679536b64aSChris Wilson	default n
689536b64aSChris Wilson	depends on DMA_SHARED_BUFFER
699536b64aSChris Wilson
70c02a81fbSAndrew F. Davismenuconfig DMABUF_HEAPS
71c02a81fbSAndrew F. Davis	bool "DMA-BUF Userland Memory Heaps"
72c02a81fbSAndrew F. Davis	select DMA_SHARED_BUFFER
73c02a81fbSAndrew F. Davis	help
74c02a81fbSAndrew F. Davis	  Choose this option to enable the DMA-BUF userland memory heaps.
75c02a81fbSAndrew F. Davis	  This options creates per heap chardevs in /dev/dma_heap/ which
76c02a81fbSAndrew F. Davis	  allows userspace to allocate dma-bufs that can be shared
77c02a81fbSAndrew F. Davis	  between drivers.
78c02a81fbSAndrew F. Davis
79bdb8d06dSHridya Valsarajumenuconfig DMABUF_SYSFS_STATS
80e0a9f1feSChristian König	bool "DMA-BUF sysfs statistics (DEPRECATED)"
8187fd9ef4SGeert Uytterhoeven	depends on DMA_SHARED_BUFFER
82bdb8d06dSHridya Valsaraju	help
83bdb8d06dSHridya Valsaraju	   Choose this option to enable DMA-BUF sysfs statistics
84bdb8d06dSHridya Valsaraju	   in location /sys/kernel/dmabuf/buffers.
85bdb8d06dSHridya Valsaraju
86bdb8d06dSHridya Valsaraju	   /sys/kernel/dmabuf/buffers/<inode_number> will contain
87bdb8d06dSHridya Valsaraju	   statistics for the DMA-BUF with the unique inode number
88bdb8d06dSHridya Valsaraju	   <inode_number>.
89bdb8d06dSHridya Valsaraju
90e0a9f1feSChristian König	   This option is deprecated and should sooner or later be removed.
91e0a9f1feSChristian König	   Android is the only user of this and it turned out that this resulted
92e0a9f1feSChristian König	   in quite some performance problems.
93e0a9f1feSChristian König
94efa04fefSJohn Stultzsource "drivers/dma-buf/heaps/Kconfig"
95efa04fefSJohn Stultz
9662304fb1SGustavo Padovanendmenu
97