When a driver's vmap callback returns an error (e.g. -ENOMEM), dma_buf_vmap()
triggers a WARN_ON_ONCE(). This is incorrect as vmap operations can legitimately
fail due to resource exhaustion or other transient conditions, as documented.
Fix this by removing the WARN_ON_ONCE(). The error code is already correctly
propagated to the caller.
Reported-by: syzbot+cd944c467e4d4bc24cf6(a)syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug\?extid\=4317d7108e14e5d56308
Signed-off-by: Szymon Wilczek <szymonwilczek(a)gmx.com>
---
drivers/dma-buf/dma-buf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
index edaa9e4ee4ae..14b55f67ee1c 100644
--- a/drivers/dma-buf/dma-buf.c
+++ b/drivers/dma-buf/dma-buf.c
@@ -1525,7 +1525,7 @@ int dma_buf_vmap(struct dma_buf *dmabuf, struct iosys_map *map)
BUG_ON(iosys_map_is_set(&dmabuf->vmap_ptr));
ret = dmabuf->ops->vmap(dmabuf, &ptr);
- if (WARN_ON_ONCE(ret))
+ if (ret)
return ret;
dmabuf->vmap_ptr = ptr;
--
2.52.0
This makes a few changes to the way immediate mode works, and then it
implements a Rust immediate mode GPUVM abstraction on top of that.
Please see the following branch for example usage in Tyr:
https://gitlab.freedesktop.org/panfrost/linux/-/merge_requests/53
For context, please see this previous patch:
https://lore.kernel.org/rust-for-linux/20250621-gpuvm-v3-1-10203da06867@col…
and the commit message of the last patch.
Signed-off-by: Alice Ryhl <aliceryhl(a)google.com>
---
Alice Ryhl (4):
drm/gpuvm: take GEM lock inside drm_gpuvm_bo_obtain_prealloc()
drm/gpuvm: drm_gpuvm_bo_obtain() requires lock and staged mode
drm/gpuvm: use const for drm_gpuva_op_* ptrs
rust: drm: add GPUVM immediate mode abstraction
MAINTAINERS | 1 +
drivers/gpu/drm/drm_gpuvm.c | 80 ++++--
drivers/gpu/drm/imagination/pvr_vm.c | 2 +-
drivers/gpu/drm/msm/msm_gem.h | 2 +-
drivers/gpu/drm/msm/msm_gem_vma.c | 2 +-
drivers/gpu/drm/nouveau/nouveau_uvmm.c | 2 +-
drivers/gpu/drm/panthor/panthor_mmu.c | 10 -
drivers/gpu/drm/xe/xe_vm.c | 4 +-
include/drm/drm_gpuvm.h | 12 +-
rust/bindings/bindings_helper.h | 2 +
rust/helpers/drm_gpuvm.c | 43 +++
rust/helpers/helpers.c | 1 +
rust/kernel/drm/gpuvm/mod.rs | 394 +++++++++++++++++++++++++++
rust/kernel/drm/gpuvm/sm_ops.rs | 469 +++++++++++++++++++++++++++++++++
rust/kernel/drm/gpuvm/va.rs | 148 +++++++++++
rust/kernel/drm/gpuvm/vm_bo.rs | 213 +++++++++++++++
rust/kernel/drm/mod.rs | 1 +
17 files changed, 1337 insertions(+), 49 deletions(-)
---
base-commit: 77b686f688126a5f758b51441a03186e9eb1b0f1
change-id: 20251128-gpuvm-rust-b719cac27ad6
Best regards,
--
Alice Ryhl <aliceryhl(a)google.com>
Hi,
Here are kernel-doc fixes for mm subsystem, based on mm-hotfixes-unstable
branch. This series is split from previous assorted kernel-doc fixes series
[1] with review trailers applied.
I'm also including textsearch fix since there's currently no maintainer
for include/linux/textsearch.h (get_maintainer.pl only shows LKML).
Enjoy!
[1]: https://lore.kernel.org/linux-fsdevel/20251215113903.46555-1-bagasdotme@gma…
Bagas Sanjaya (4):
mm: Describe @flags parameter in memalloc_flags_save()
textsearch: Describe @list member in ts_ops search
mm: vmalloc: Fix up vrealloc_node_align() kernel-doc macro name
mm, kfence: Describe @slab parameter in __kfence_obj_info()
include/linux/kfence.h | 1 +
include/linux/sched/mm.h | 1 +
include/linux/textsearch.h | 1 +
mm/vmalloc.c | 2 +-
4 files changed, 4 insertions(+), 1 deletion(-)
base-commit: 980dbceadd50af9437257d8095d4a3606818e8c4
--
An old man doll... just what I always wanted! - Clara
This series improve stability of the capture by fixing the
handling of the overrun which was leading to captured
frame corruption.
Locking within the driver is also simplified and the way
DMA is handled is reworked allowing to avoid having a
specific handling for the JPEG data.
Performances of capture can now be increased via the usage
of a DMA->MDMA chaining which allows for capture of higher
resolution / framerate.
Signed-off-by: Alain Volmat <alain.volmat(a)foss.st.com>
---
Alain Volmat (12):
media: stm32: dcmi: Switch from __maybe_unused to pm_sleep_ptr()
media: stm32: dcmi: perform dmaengine_slave_config at probe
media: stm32: dcmi: only create dma descriptor once at buf_prepare
media: stm32: dcmi: stop the dma transfer on overrun
media: stm32: dcmi: rework spin_lock calls
media: stm32: dcmi: perform all dma handling within irq_thread
media: stm32: dcmi: use dmaengine_terminate_async in irq context
media: stm32: dcmi: continuous mode capture in JPEG
dt-bindings: media: st: dcmi: add DMA-MDMA chaining properties
media: stm32: dcmi: addition of DMA-MDMA chaining support
ARM: dts: stm32: add sram node within stm32mp151.dtsi
ARM: dts: stm32: enable DCMI DMA-MDMA chaining on stm32mp157c-ev1.dts
.../devicetree/bindings/media/st,stm32-dcmi.yaml | 13 +-
arch/arm/boot/dts/st/stm32mp151.dtsi | 8 +
arch/arm/boot/dts/st/stm32mp157c-ev1.dts | 15 +
drivers/media/platform/st/stm32/stm32-dcmi.c | 470 ++++++++++++++-------
4 files changed, 341 insertions(+), 165 deletions(-)
---
base-commit: f7231cff1f3ff8259bef02dc4999bc132abf29cf
change-id: 20251213-stm32-dcmi-dma-chaining-9ea1da83007d
Best regards,
--
Alain Volmat <alain.volmat(a)foss.st.com>
Hi,
Here are assorted kernel-doc fixes for 6.19 cycle. As the name
implies, for the merging strategy, the patches can be taken by
respective maintainers to appropriate fixes branches (targetting
6.19 of course) (e.g. for mm it will be mm-hotfixes).
Enjoy!
Bagas Sanjaya (14):
genalloc: Describe @start_addr parameter in genpool_algo_t
mm: Describe @flags parameter in memalloc_flags_save()
textsearch: Describe @list member in ts_ops search
mm: vmalloc: Fix up vrealloc_node_align() kernel-doc macro name
mm, kfence: Describe @slab parameter in __kfence_obj_info()
virtio: Describe @map and @vmap members in virtio_device struct
fs: Describe @isnew parameter in ilookup5_nowait()
VFS: fix __start_dirop() kernel-doc warnings
drm/amd/display: Don't use kernel-doc comment in
dc_register_software_state struct
drm/amdgpu: Describe @AMD_IP_BLOCK_TYPE_RAS in amd_ip_block_type enum
drm/gem/shmem: Describe @shmem and @size parameters
drm/scheduler: Describe @result in drm_sched_job_done()
drm/gpusvm: Fix drm_gpusvm_pages_valid_unlocked() kernel-doc comment
net: bridge: Describe @tunnel_hash member in net_bridge_vlan_group
struct
drivers/gpu/drm/amd/display/dc/dc.h | 2 +-
drivers/gpu/drm/amd/include/amd_shared.h | 1 +
drivers/gpu/drm/drm_gem_shmem_helper.c | 3 ++-
drivers/gpu/drm/drm_gpusvm.c | 4 ++--
drivers/gpu/drm/scheduler/sched_main.c | 1 +
fs/inode.c | 1 +
fs/namei.c | 3 ++-
include/linux/genalloc.h | 1 +
include/linux/kfence.h | 1 +
include/linux/sched/mm.h | 1 +
include/linux/textsearch.h | 1 +
include/linux/virtio.h | 2 ++
mm/vmalloc.c | 2 +-
net/bridge/br_private.h | 1 +
14 files changed, 18 insertions(+), 6 deletions(-)
base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
--
An old man doll... just what I always wanted! - Clara
Changelog:
v6:
* Fixed wrong error check from pcim_p2pdma_init().
* Documented pcim_p2pdma_provider() function.
* Improved commit messages.
* Added VFIO DMA-BUF selftest.
* Added __counted_by(nr_ranges) annotation to struct vfio_device_feature_dma_buf.
* Fixed error unwind when dma_buf_fd() fails.
* Document latest changes to p2pmem.
* Removed EXPORT_SYMBOL_GPL from pci_p2pdma_map_type.
* Moved DMA mapping logic to DMA-BUF.
* Removed types patch to avoid dependencies between subsystems.
* Moved vfio_pci_dma_buf_move() in err_undo block.
* Added nvgrace patch.
v5: https://lore.kernel.org/all/cover.1760368250.git.leon@kernel.org
* Rebased on top of v6.18-rc1.
* Added more validation logic to make sure that DMA-BUF length doesn't
overflow in various scenarios.
* Hide kernel config from the users.
* Fixed type conversion issue. DMA ranges are exposed with u64 length,
but DMA-BUF uses "unsigned int" as a length for SG entries.
* Added check to prevent from VFIO drivers which reports BAR size
different from PCI, do not use DMA-BUF functionality.
v4: https://lore.kernel.org/all/cover.1759070796.git.leon@kernel.org
* Split pcim_p2pdma_provider() to two functions, one that initializes
array of providers and another to return right provider pointer.
v3: https://lore.kernel.org/all/cover.1758804980.git.leon@kernel.org
* Changed pcim_p2pdma_enable() to be pcim_p2pdma_provider().
* Cache provider in vfio_pci_dma_buf struct instead of BAR index.
* Removed misleading comment from pcim_p2pdma_provider().
* Moved MMIO check to be in pcim_p2pdma_provider().
v2: https://lore.kernel.org/all/cover.1757589589.git.leon@kernel.org/
* Added extra patch which adds new CONFIG, so next patches can reuse
* it.
* Squashed "PCI/P2PDMA: Remove redundant bus_offset from map state"
into the other patch.
* Fixed revoke calls to be aligned with true->false semantics.
* Extended p2pdma_providers to be per-BAR and not global to whole
* device.
* Fixed possible race between dmabuf states and revoke.
* Moved revoke to PCI BAR zap block.
v1: https://lore.kernel.org/all/cover.1754311439.git.leon@kernel.org
* Changed commit messages.
* Reused DMA_ATTR_MMIO attribute.
* Returned support for multiple DMA ranges per-dMABUF.
v0: https://lore.kernel.org/all/cover.1753274085.git.leonro@nvidia.com
---------------------------------------------------------------------------
Based on "[PATCH v6 00/16] dma-mapping: migrate to physical address-based API"
https://lore.kernel.org/all/cover.1757423202.git.leonro@nvidia.com/ series.
---------------------------------------------------------------------------
This series extends the VFIO PCI subsystem to support exporting MMIO
regions from PCI device BARs as dma-buf objects, enabling safe sharing of
non-struct page memory with controlled lifetime management. This allows RDMA
and other subsystems to import dma-buf FDs and build them into memory regions
for PCI P2P operations.
The series supports a use case for SPDK where a NVMe device will be
owned by SPDK through VFIO but interacting with a RDMA device. The RDMA
device may directly access the NVMe CMB or directly manipulate the NVMe
device's doorbell using PCI P2P.
However, as a general mechanism, it can support many other scenarios with
VFIO. This dmabuf approach can be usable by iommufd as well for generic
and safe P2P mappings.
In addition to the SPDK use-case mentioned above, the capability added
in this patch series can also be useful when a buffer (located in device
memory such as VRAM) needs to be shared between any two dGPU devices or
instances (assuming one of them is bound to VFIO PCI) as long as they
are P2P DMA compatible.
The implementation provides a revocable attachment mechanism using dma-buf
move operations. MMIO regions are normally pinned as BARs don't change
physical addresses, but access is revoked when the VFIO device is closed
or a PCI reset is issued. This ensures kernel self-defense against
potentially hostile userspace.
The series includes significant refactoring of the PCI P2PDMA subsystem
to separate core P2P functionality from memory allocation features,
making it more modular and suitable for VFIO use cases that don't need
struct page support.
-----------------------------------------------------------------------
The series is based originally on
https://lore.kernel.org/all/20250307052248.405803-1-vivek.kasireddy@intel.c…
but heavily rewritten to be based on DMA physical API.
-----------------------------------------------------------------------
The WIP branch can be found here:
https://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git/log/?h=…
Thanks
---
Jason Gunthorpe (2):
PCI/P2PDMA: Document DMABUF model
vfio/nvgrace: Support get_dmabuf_phys
Leon Romanovsky (7):
PCI/P2PDMA: Separate the mmap() support from the core logic
PCI/P2PDMA: Simplify bus address mapping API
PCI/P2PDMA: Refactor to separate core P2P functionality from memory allocation
PCI/P2PDMA: Provide an access to pci_p2pdma_map_type() function
dma-buf: provide phys_vec to scatter-gather mapping routine
vfio/pci: Enable peer-to-peer DMA transactions by default
vfio/pci: Add dma-buf export support for MMIO regions
Vivek Kasireddy (2):
vfio: Export vfio device get and put registration helpers
vfio/pci: Share the core device pointer while invoking feature functions
Documentation/driver-api/pci/p2pdma.rst | 95 +++++++---
block/blk-mq-dma.c | 2 +-
drivers/dma-buf/dma-buf.c | 235 ++++++++++++++++++++++++
drivers/iommu/dma-iommu.c | 4 +-
drivers/pci/p2pdma.c | 182 +++++++++++++-----
drivers/vfio/pci/Kconfig | 3 +
drivers/vfio/pci/Makefile | 1 +
drivers/vfio/pci/nvgrace-gpu/main.c | 56 ++++++
drivers/vfio/pci/vfio_pci.c | 5 +
drivers/vfio/pci/vfio_pci_config.c | 22 ++-
drivers/vfio/pci/vfio_pci_core.c | 56 ++++--
drivers/vfio/pci/vfio_pci_dmabuf.c | 315 ++++++++++++++++++++++++++++++++
drivers/vfio/pci/vfio_pci_priv.h | 23 +++
drivers/vfio/vfio_main.c | 2 +
include/linux/dma-buf.h | 18 ++
include/linux/pci-p2pdma.h | 120 +++++++-----
include/linux/vfio.h | 2 +
include/linux/vfio_pci_core.h | 42 +++++
include/uapi/linux/vfio.h | 27 +++
kernel/dma/direct.c | 4 +-
mm/hmm.c | 2 +-
21 files changed, 1077 insertions(+), 139 deletions(-)
---
base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
change-id: 20251016-dmabuf-vfio-6cef732adf5a
Best regards,
--
Leon Romanovsky <leonro(a)nvidia.com>
From: Lukas Bulwahn <lukas.bulwahn(a)redhat.com>
The intent of commit 646013f513f3 ("dma-buf: enable DMABUF_DEBUG by default
on DEBUG kernels") is clear, but it mixes up the config option name. The
config option for kernel debugging is named DEBUG_KERNEL, not DEBUG.
Fix up the DMABUF_DEBUG definition to use the intended name.
Fixes: 646013f513f3 ("dma-buf: enable DMABUF_DEBUG by default on DEBUG kernels")
Signed-off-by: Lukas Bulwahn <lukas.bulwahn(a)redhat.com>
---
drivers/dma-buf/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/dma-buf/Kconfig b/drivers/dma-buf/Kconfig
index fdd823e446cc..426c9ad3364f 100644
--- a/drivers/dma-buf/Kconfig
+++ b/drivers/dma-buf/Kconfig
@@ -55,7 +55,7 @@ config DMABUF_MOVE_NOTIFY
config DMABUF_DEBUG
bool "DMA-BUF debug checks"
depends on DMA_SHARED_BUFFER
- default y if DEBUG
+ default y if DEBUG_KERNEL
help
This option enables additional checks for DMA-BUF importers and
exporters. Specifically it validates that importers do not peek at the
--
2.51.1