<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/dma-buf/Makefile, branch v6.19.11</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.19.11</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.19.11'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2025-11-20T19:02:19+00:00</updated>
<entry>
<title>dma-buf: provide phys_vec to scatter-gather mapping routine</title>
<updated>2025-11-20T19:02:19+00:00</updated>
<author>
<name>Leon Romanovsky</name>
<email>leonro@nvidia.com</email>
</author>
<published>2025-11-20T09:28:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3aa31a8bb11e47c0ff2b306988d1756b810c1c3c'/>
<id>urn:sha1:3aa31a8bb11e47c0ff2b306988d1756b810c1c3c</id>
<content type='text'>
Add dma_buf_phys_vec_to_sgt() and dma_buf_free_sgt() helpers to convert
an array of MMIO physical address ranges into scatter-gather tables with
proper DMA mapping.

These common functions are a starting point and support any PCI
drivers creating mappings from their BAR's MMIO addresses. VFIO is one
case, as shortly will be RDMA. We can review existing DRM drivers to
refactor them separately. We hope this will evolve into routines to
help common DRM that include mixed CPU and MMIO mappings.

Compared to the dma_map_resource() abuse this implementation handles
the complicated PCI P2P scenarios properly, especially when an IOMMU
is enabled:

 - Direct bus address mapping without IOVA allocation for
   PCI_P2PDMA_MAP_BUS_ADDR, using pci_p2pdma_bus_addr_map(). This
   happens if the IOMMU is enabled but the PCIe switch ACS flags allow
   transactions to avoid the host bridge.

   Further, this handles the slightly obscure, case of MMIO with a
   phys_addr_t that is different from the physical BAR programming
   (bus offset). The phys_addr_t is converted to a dma_addr_t and
   accommodates this effect. This enables certain real systems to
   work, especially on ARM platforms.

 - Mapping through host bridge with IOVA allocation and DMA_ATTR_MMIO
   attribute for MMIO memory regions (PCI_P2PDMA_MAP_THRU_HOST_BRIDGE).
   This happens when the IOMMU is enabled and the ACS flags are forcing
   all traffic to the IOMMU - ie for virtualization systems.

 - Cases where P2P is not supported through the host bridge/CPU. The
   P2P subsystem is the proper place to detect this and block it.

Helper functions fill_sg_entry() and calc_sg_nents() handle the
scatter-gather table construction, splitting large regions into
UINT_MAX-sized chunks to fit within sg-&gt;length field limits.

Since the physical address based DMA API forbids use of the CPU list
of the scatterlist this will produce a mangled scatterlist that has
a fully zero-length and NULL'd CPU list. The list is 0 length,
all the struct page pointers are NULL and zero sized. This is stronger
and more robust than the existing mangle_sg_table() technique. It is
a future project to migrate DMABUF as a subsystem away from using
scatterlist for this data structure.

Reviewed-by: Kevin Tian &lt;kevin.tian@intel.com&gt;
Reviewed-by: Nicolin Chen &lt;nicolinc@nvidia.com&gt;
Reviewed-by: Jason Gunthorpe &lt;jgg@nvidia.com&gt;
Tested-by: Alex Mastro &lt;amastro@fb.com&gt;
Tested-by: Nicolin Chen &lt;nicolinc@nvidia.com&gt;
Signed-off-by: Leon Romanovsky &lt;leonro@nvidia.com&gt;
Acked-by: Christian König &lt;christian.koenig@amd.com&gt;
Acked-by: Ankit Agrawal &lt;ankita@nvidia.com&gt;
Link: https://lore.kernel.org/r/20251120-dmabuf-vfio-v9-6-d7f71607f371@nvidia.com
Signed-off-by: Alex Williamson &lt;alex@shazbot.org&gt;
</content>
</entry>
<entry>
<title>dma-buf: cleanup dma_fence_unwrap implementation</title>
<updated>2022-05-30T12:16:32+00:00</updated>
<author>
<name>Christian König</name>
<email>christian.koenig@amd.com</email>
</author>
<published>2022-04-24T14:55:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=01357a5a45ed8eb9543183f5c9c6713ae60fc1f3'/>
<id>urn:sha1:01357a5a45ed8eb9543183f5c9c6713ae60fc1f3</id>
<content type='text'>
Move the code from the inline functions into exported functions.

Signed-off-by: Christian König &lt;christian.koenig@amd.com&gt;
Acked-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20220518135844.3338-3-christian.koenig@amd.com
</content>
</entry>
<entry>
<title>dma-buf: add dma_fence_unwrap v2</title>
<updated>2022-03-25T13:18:28+00:00</updated>
<author>
<name>Christian König</name>
<email>christian.koenig@amd.com</email>
</author>
<published>2022-03-11T09:27:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=64a8f92fd783e750cdb81af75942dcd53bbf61bd'/>
<id>urn:sha1:64a8f92fd783e750cdb81af75942dcd53bbf61bd</id>
<content type='text'>
Add a general purpose helper to deep dive into dma_fence_chain/dma_fence_array
structures and iterate over all the fences in them.

This is useful when we need to flatten out all fences in those structures.

v2: some selftests cleanup, improved function naming and documentation

Signed-off-by: Christian König &lt;christian.koenig@amd.com&gt;
Reviewed-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20220311110244.1245-1-christian.koenig@amd.com
</content>
</entry>
<entry>
<title>dma-buf: add dma_resv selftest v4</title>
<updated>2021-10-22T12:19:51+00:00</updated>
<author>
<name>Christian König</name>
<email>christian.koenig@amd.com</email>
</author>
<published>2021-09-24T15:10:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=1d51775cd3f51899ce85afab686c7f641ff32d4e'/>
<id>urn:sha1:1d51775cd3f51899ce85afab686c7f641ff32d4e</id>
<content type='text'>
Just exercising a very minor subset of the functionality, but already
proven useful.

v2: add missing locking
v3: some more cleanup and consolidation, add unlocked test as well
v4: add a dma_resv_get_fences selftest

Signed-off-by: Christian König &lt;christian.koenig@amd.com&gt;
Reviewed-by: Tvrtko Ursulin &lt;tvrtko.ursulin@intel.com&gt; (v3)
Reviewed-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt; (v3)
Link: https://patchwork.freedesktop.org/patch/msgid/20211005113742.1101-4-christian.koenig@amd.com
</content>
</entry>
<entry>
<title>dma-buf: nuke seqno-fence</title>
<updated>2021-08-16T12:07:17+00:00</updated>
<author>
<name>Christian König</name>
<email>christian.koenig@amd.com</email>
</author>
<published>2021-07-28T17:51:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=992c238188a83befa0094a8c00bfead31aa302ed'/>
<id>urn:sha1:992c238188a83befa0094a8c00bfead31aa302ed</id>
<content type='text'>
Entirely unused.

Signed-off-by: Christian König &lt;christian.koenig@amd.com&gt;
Acked-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20210729070330.41443-1-christian.koenig@amd.com
</content>
</entry>
<entry>
<title>dmabuf: Add the capability to expose DMA-BUF stats in sysfs</title>
<updated>2021-06-15T09:50:24+00:00</updated>
<author>
<name>Hridya Valsaraju</name>
<email>hridya@google.com</email>
</author>
<published>2021-06-03T21:47:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=bdb8d06dfefd666d5981d884b535b04105869fcc'/>
<id>urn:sha1:bdb8d06dfefd666d5981d884b535b04105869fcc</id>
<content type='text'>
Overview
========
The patch adds DMA-BUF statistics to /sys/kernel/dmabuf/buffers. It
allows statistics to be enabled for each DMA-BUF in sysfs by enabling
the config CONFIG_DMABUF_SYSFS_STATS.

The following stats will be exposed by the interface:

/sys/kernel/dmabuf/buffers/&lt;inode_number&gt;/exporter_name
/sys/kernel/dmabuf/buffers/&lt;inode_number&gt;/size
/sys/kernel/dmabuf/buffers/&lt;inode_number&gt;/attachments/&lt;attach_uid&gt;/device
/sys/kernel/dmabuf/buffers/&lt;inode_number&gt;/attachments/&lt;attach_uid&gt;/map_counter

The inode_number is unique for each DMA-BUF and was added earlier [1]
in order to allow userspace to track DMA-BUF usage across different
processes.

Use Cases
=========
The interface provides a way to gather DMA-BUF per-buffer statistics
from production devices. These statistics will be used to derive DMA-BUF
per-exporter stats and per-device usage stats for Android Bug reports.
The corresponding userspace changes can be found at [2].
Telemetry tools will also capture this information(along with other
memory metrics) periodically as well as on important events like a
foreground app kill (which might have been triggered by Low Memory
Killer). It will also contribute to provide a snapshot of the system
memory usage on other events such as OOM kills and Application Not
Responding events.

Background
==========
Currently, there are two existing interfaces that provide information
about DMA-BUFs.
1) /sys/kernel/debug/dma_buf/bufinfo
debugfs is however unsuitable to be mounted in production systems and
cannot be considered as an alternative to the sysfs interface being
proposed.
2) proc/&lt;pid&gt;/fdinfo/&lt;fd&gt;
The proc/&lt;pid&gt;/fdinfo/&lt;fd&gt; files expose information about DMA-BUF fds.
However, the existing procfs interfaces can only provide information
about the buffers for which processes hold fds or have the buffers
mmapped into their address space. Since the procfs interfaces alone
cannot provide a full picture of all DMA-BUFs in the system, there is
the need for an alternate interface to provide this information on
production systems.

The patch contains the following major improvements over v1:
1) Each attachment is represented by its own directory to allow creating
a symlink to the importing device and to also provide room for future
expansion.
2) The number of distinct mappings of each attachment is exposed in a
separate file.
3) The per-buffer statistics are now in /sys/kernel/dmabuf/buffers
inorder to make the interface expandable in future.

All of the improvements above are based on suggestions/feedback from
Daniel Vetter and Christian König.

A shell script that can be run on a classic Linux environment to read
out the DMA-BUF statistics can be found at [3](suggested by John
Stultz).

[1]: https://lore.kernel.org/patchwork/patch/1088791/
[2]: https://android-review.googlesource.com/q/topic:%22dmabuf-sysfs%22+(status:open%20OR%20status:merged)
[3]: https://android-review.googlesource.com/c/platform/system/memory/libmeminfo/+/1549734

Reviewed-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Hridya Valsaraju &lt;hridya@google.com&gt;
Reported-by: kernel test robot &lt;lkp@intel.com&gt;
Signed-off-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20210603214758.2955251-1-hridya@google.com
</content>
</entry>
<entry>
<title>dma-buf: Exercise dma-fence-chain under selftests</title>
<updated>2020-04-09T18:58:55+00:00</updated>
<author>
<name>Chris Wilson</name>
<email>chris@chris-wilson.co.uk</email>
</author>
<published>2020-04-09T11:01:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=dc2f7e67a28a5cbe4ea905dafaa6903df670014a'/>
<id>urn:sha1:dc2f7e67a28a5cbe4ea905dafaa6903df670014a</id>
<content type='text'>
A few very simple testcases to exercise the dma-fence-chain API.

Signed-off-by: Chris Wilson &lt;chris@chris-wilson.co.uk&gt;
Reviewed-by: Venkata Sandeep Dhanalakota &lt;venkata.s.dhanalakota@intel.com&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20200409110101.18400-3-chris@chris-wilson.co.uk
</content>
</entry>
<entry>
<title>dma-buf: heaps: Add heap helpers</title>
<updated>2019-12-11T05:43:35+00:00</updated>
<author>
<name>John Stultz</name>
<email>john.stultz@linaro.org</email>
</author>
<published>2019-12-03T17:26:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5248eb12fea890a03b4cdc3ef546d6319d4d9b73'/>
<id>urn:sha1:5248eb12fea890a03b4cdc3ef546d6319d4d9b73</id>
<content type='text'>
Add generic helper dmabuf ops for dma heaps, so we can reduce
the amount of duplicative code for the exported dmabufs.

This code is an evolution of the Android ION implementation, so
thanks to its original authors and maintainters:
  Rebecca Schultz Zavin, Colin Cross, Laura Abbott, and others!

Cc: Laura Abbott &lt;labbott@redhat.com&gt;
Cc: Benjamin Gaignard &lt;benjamin.gaignard@linaro.org&gt;
Cc: Sumit Semwal &lt;sumit.semwal@linaro.org&gt;
Cc: Liam Mark &lt;lmark@codeaurora.org&gt;
Cc: Pratik Patel &lt;pratikp@codeaurora.org&gt;
Cc: Brian Starkey &lt;Brian.Starkey@arm.com&gt;
Cc: Vincent Donnefort &lt;Vincent.Donnefort@arm.com&gt;
Cc: Sudipto Paul &lt;Sudipto.Paul@arm.com&gt;
Cc: Andrew F. Davis &lt;afd@ti.com&gt;
Cc: Christoph Hellwig &lt;hch@infradead.org&gt;
Cc: Chenbo Feng &lt;fengc@google.com&gt;
Cc: Alistair Strachan &lt;astrachan@google.com&gt;
Cc: Hridya Valsaraju &lt;hridya@google.com&gt;
Cc: Sandeep Patil &lt;sspatil@google.com&gt;
Cc: Hillf Danton &lt;hdanton@sina.com&gt;
Cc: Dave Airlie &lt;airlied@gmail.com&gt;
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Benjamin Gaignard &lt;benjamin.gaignard@linaro.org&gt;
Reviewed-by: Brian Starkey &lt;brian.starkey@arm.com&gt;
Acked-by: Sandeep Patil &lt;sspatil@android.com&gt;
Acked-by: Laura Abbott &lt;labbott@redhat.com&gt;
Tested-by: Ayan Kumar Halder &lt;ayan.halder@arm.com&gt;
Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
Signed-off-by: Sumit Semwal &lt;sumit.semwal@linaro.org&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20191203172641.66642-3-john.stultz@linaro.org
</content>
</entry>
<entry>
<title>dma-buf: Add dma-buf heaps framework</title>
<updated>2019-12-11T05:43:33+00:00</updated>
<author>
<name>Andrew F. Davis</name>
<email>afd@ti.com</email>
</author>
<published>2019-12-03T17:26:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c02a81fba74fe3488ad6b08bfb5a1329005418f8'/>
<id>urn:sha1:c02a81fba74fe3488ad6b08bfb5a1329005418f8</id>
<content type='text'>
This framework allows a unified userspace interface for dma-buf
exporters, allowing userland to allocate specific types of memory
for use in dma-buf sharing.

Each heap is given its own device node, which a user can allocate
a dma-buf fd from using the DMA_HEAP_IOC_ALLOC.

This code is an evoluiton of the Android ION implementation,
and a big thanks is due to its authors/maintainers over time
for their effort:
  Rebecca Schultz Zavin, Colin Cross, Benjamin Gaignard,
  Laura Abbott, and many other contributors!

Cc: Laura Abbott &lt;labbott@redhat.com&gt;
Cc: Benjamin Gaignard &lt;benjamin.gaignard@linaro.org&gt;
Cc: Sumit Semwal &lt;sumit.semwal@linaro.org&gt;
Cc: Liam Mark &lt;lmark@codeaurora.org&gt;
Cc: Pratik Patel &lt;pratikp@codeaurora.org&gt;
Cc: Brian Starkey &lt;Brian.Starkey@arm.com&gt;
Cc: Vincent Donnefort &lt;Vincent.Donnefort@arm.com&gt;
Cc: Sudipto Paul &lt;Sudipto.Paul@arm.com&gt;
Cc: Andrew F. Davis &lt;afd@ti.com&gt;
Cc: Christoph Hellwig &lt;hch@infradead.org&gt;
Cc: Chenbo Feng &lt;fengc@google.com&gt;
Cc: Alistair Strachan &lt;astrachan@google.com&gt;
Cc: Hridya Valsaraju &lt;hridya@google.com&gt;
Cc: Sandeep Patil &lt;sspatil@google.com&gt;
Cc: Hillf Danton &lt;hdanton@sina.com&gt;
Cc: Dave Airlie &lt;airlied@gmail.com&gt;
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Brian Starkey &lt;brian.starkey@arm.com&gt;
Acked-by: Sandeep Patil &lt;sspatil@android.com&gt;
Signed-off-by: Andrew F. Davis &lt;afd@ti.com&gt;
Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
Signed-off-by: Sumit Semwal &lt;sumit.semwal@linaro.org&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20191203172641.66642-2-john.stultz@linaro.org
</content>
</entry>
<entry>
<title>Revert "dma-buf: Add dma-buf heaps framework"</title>
<updated>2019-10-30T20:41:49+00:00</updated>
<author>
<name>Sean Paul</name>
<email>seanpaul@chromium.org</email>
</author>
<published>2019-10-30T20:29:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=fae7d7d5f374eadbb0b5dd31b39162e7176e9c3d'/>
<id>urn:sha1:fae7d7d5f374eadbb0b5dd31b39162e7176e9c3d</id>
<content type='text'>
This reverts commit a69b0e855d3fd278ff6f09a23e1edf929538e304.

This patchset doesn't meet the UAPI requirements set out in [1] for the DRM
subsystem. Once the userspace component is reviewed and ready for merge
we can try again.

[1]- https://01.org/linuxgraphics/gfx-docs/drm/gpu/drm-uapi.html#open-source-userspace-requirements

Fixes: a69b0e855d3f ("dma-buf: Add dma-buf heaps framework")
Cc: Laura Abbott &lt;labbott@redhat.com&gt;
Cc: Benjamin Gaignard &lt;benjamin.gaignard@linaro.org&gt;
Cc: Sumit Semwal &lt;sumit.semwal@linaro.org&gt;
Cc: Liam Mark &lt;lmark@codeaurora.org&gt;
Cc: Pratik Patel &lt;pratikp@codeaurora.org&gt;
Cc: Brian Starkey &lt;Brian.Starkey@arm.com&gt;
Cc: Vincent Donnefort &lt;Vincent.Donnefort@arm.com&gt;
Cc: Sudipto Paul &lt;Sudipto.Paul@arm.com&gt;
Cc: Andrew F. Davis &lt;afd@ti.com&gt;
Cc: Christoph Hellwig &lt;hch@infradead.org&gt;
Cc: Chenbo Feng &lt;fengc@google.com&gt;
Cc: Alistair Strachan &lt;astrachan@google.com&gt;
Cc: Hridya Valsaraju &lt;hridya@google.com&gt;
Cc: Hillf Danton &lt;hdanton@sina.com&gt;
Cc: dri-devel@lists.freedesktop.org
Cc: Brian Starkey &lt;brian.starkey@arm.com&gt;
Cc: John Stultz &lt;john.stultz@linaro.org&gt;
Cc: Mauro Carvalho Chehab &lt;mchehab+samsung@kernel.org&gt;
Cc: "David S. Miller" &lt;davem@davemloft.net&gt;
Cc: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Cc: Rob Herring &lt;robh@kernel.org&gt;
Cc: Jonathan Cameron &lt;Jonathan.Cameron@huawei.com&gt;
Cc: "Paul E. McKenney" &lt;paulmck@linux.ibm.com&gt;
Cc: Sean Paul &lt;seanpaul@chromium.org&gt;
Cc: "Andrew F. Davis" &lt;afd@ti.com&gt;
Cc: linux-media@vger.kernel.org
Cc: linaro-mm-sig@lists.linaro.org
Acked-by: David Airlie &lt;airlied@linux.ie&gt;
Signed-off-by: Sean Paul &lt;sean@poorly.run&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20191030203003.101156-6-sean@poorly.run
</content>
</entry>
</feed>
