On 25.03.2026 20:23, Jiri Pirko wrote:
> From: Jiri Pirko <jiri(a)nvidia.com>
>
> Confidential computing (CoCo) VMs/guests, such as AMD SEV and Intel TDX,
> run with private/encrypted memory which creates a challenge
> for devices that do not support DMA to it (no TDISP support).
>
> For kernel-only DMA operations, swiotlb bounce buffering provides a
> transparent solution by copying data through shared memory.
> However, the only way to get this memory into userspace is via the DMA
> API's dma_alloc_pages()/dma_mmap_pages() type interfaces which limits
> the use of the memory to a single DMA device, and is incompatible with
> pin_user_pages().
>
> These limitations are particularly problematic for the RDMA subsystem
> which makes heavy use of pin_user_pages() and expects flexible memory
> usage between many different DMA devices.
>
> This patch series enables userspace to explicitly request shared
> (decrypted) memory allocations from new dma-buf system_cc_shared heap.
> Userspace can mmap this memory and pass the dma-buf fd to other
> existing importers such as RDMA or DRM devices to access the
> memory. The DMA API is improved to allow the dma heap exporter to DMA
> map the shared memory to each importing device.
>
> Based on dma-mapping-for-next e7442a68cd1ee797b585f045d348781e9c0dde0d
I would like to merge this to dma-mapping-next, but I feel a bit
uncomfortable with my lack of knowledge about CoCo and friends. Could
those who know a bit more about it provide some Reviewed-by tags?
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
On Thu, Mar 26, 2026 at 2:15 AM Danilo Krummrich <dakr(a)kernel.org> wrote:
>
> @Lyude, Alice, Miguel: Please have a look at what I came up with below.
Sounds fine to me, thanks!
- Regarding the enabled unstable feature: looks good -- it will go
away this cycle anyway, so we may get a conflict, but that is fine.
- Regarding the `&raw`, that sounds also good. I see you did it
similarly to how I did it for `bitmap.rs` -- thanks!
(And for future reference, the `bitmap.rs` one was 1.92 instead of
1.82 because that one was for unions, while this one is
https://blog.rust-lang.org/2024/10/17/Rust-1.82.0/#safely-addressing-unsafe…).
- Regarding the `expect(unused)` -- using `cfg_attr` is fine since
it is a simple case, but if it becomes a big issue, then of course
please feel free to use `allow` (you already know this, but in case it
helps others: I wrote some considerations about this at
https://docs.kernel.org/rust/coding-guidelines.html#lints).
Cheers,
Miguel
Hi,
The recent introduction of heaps in the optee driver [1] made possible
the creation of heaps as modules.
It's generally a good idea if possible, including for the already
existing system and CMA heaps.
The system one is pretty trivial, the CMA one is a bit more involved,
especially since we have a call from kernel/dma/contiguous.c to the CMA
heap code. This was solved by turning the logic around and making the
CMA heap call into the contiguous DMA code.
Let me know what you think,
Maxime
1: https://lore.kernel.org/dri-devel/20250911135007.1275833-4-jens.wiklander@l…
Signed-off-by: Maxime Ripard <mripard(a)kernel.org>
---
Changes in v3:
- Squashed cma_get_name and cma_alloc/release patches
- Fixed typo in Export dev_get_cma_area commit title
- Fixed compilation failure with DMA_CMA but not OF_RESERVED_MEM
- Link to v2: https://lore.kernel.org/r/20260227-dma-buf-heaps-as-modules-v2-0-454aee7e06…
Changes in v2:
- Collect tags
- Don't export dma_contiguous_default_area anymore, but export
dev_get_cma_area instead
- Mentioned that heap modules can't be removed
- Link to v1: https://lore.kernel.org/r/20260225-dma-buf-heaps-as-modules-v1-0-2109225a09…
---
Maxime Ripard (8):
dma: contiguous: Turn heap registration logic around
dma: contiguous: Make dev_get_cma_area() a proper function
dma: contiguous: Make dma_contiguous_default_area static
dma: contiguous: Export dev_get_cma_area()
mm: cma: Export cma_alloc(), cma_release() and cma_get_name()
dma-buf: heaps: Export mem_accounting parameter
dma-buf: heaps: cma: Turn the heap into a module
dma-buf: heaps: system: Turn the heap into a module
drivers/dma-buf/dma-heap.c | 1 +
drivers/dma-buf/heaps/Kconfig | 4 ++--
drivers/dma-buf/heaps/cma_heap.c | 21 +++++----------------
drivers/dma-buf/heaps/system_heap.c | 5 +++++
include/linux/dma-map-ops.h | 18 ++++++++++--------
kernel/dma/contiguous.c | 37 ++++++++++++++++++++++++++++++++++---
mm/cma.c | 3 +++
7 files changed, 60 insertions(+), 29 deletions(-)
---
base-commit: 499a718536dc0e1c1d1b6211847207d58acd9916
change-id: 20260225-dma-buf-heaps-as-modules-1034b3ec9f2a
Best regards,
--
Maxime Ripard <mripard(a)kernel.org>
Finally coming back to this patch set here.
Fell free to add Reviewed-by: Christian König <christian.koenig(a)amd.com> to the first two patches as well and then please start pushing the patches to amd-staging-drm-next.
I probably need to go over the last patches once more, but I think it would be better to have the first few upstream first.
Regards,
Christian.
On 2/3/26 11:22, Pierre-Eric Pelloux-Prayer wrote:
> The drm/ttm patch modifies TTM to support multiple contexts for the pipelined moves.
>
> Then amdgpu/ttm is updated to express dependencies between jobs explicitely,
> instead of relying on the ordering of execution guaranteed by the use of a single
> instance.
> With all of this in place, we can use multiple entities, with each having access
> to the available SDMA instances.
>
> This rework also gives the opportunity to merge the clear functions into a single
> one and to optimize a bit GART usage.
>
> Since v3 some patches have been already reviewed and merged separately:
> - https://lists.freedesktop.org/archives/amd-gfx/2026-January/137747.html
> - https://gitlab.freedesktop.org/drm/kernel/-/commit/ddf055b80a544d6f36f77be5…
> This version depend on them.
>
> v3: https://lists.freedesktop.org/archives/dri-devel/2025-November/537830.html
>
> Pierre-Eric Pelloux-Prayer (12):
> drm/amdgpu: allocate clear entities dynamically
> drm/amdgpu: allocate move entities dynamically
> drm/amdgpu: round robin through clear_entities in amdgpu_fill_buffer
> drm/amdgpu: use TTM_NUM_MOVE_FENCES when reserving fences
> drm/amdgpu: use multiple entities in amdgpu_move_blit
> drm/amdgpu: pass all the sdma scheds to amdgpu_mman
> drm/amdgpu: only use working sdma schedulers for ttm
> drm/amdgpu: create multiple clear/move ttm entities
> drm/amdgpu: give ttm entities access to all the sdma scheds
> drm/amdgpu: get rid of amdgpu_ttm_clear_buffer
> drm/amdgpu: rename amdgpu_fill_buffer as amdgpu_ttm_clear_buffer
> drm/amdgpu: split amdgpu_ttm_set_buffer_funcs_status in 2 funcs
>
> drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 +
> drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 5 +-
> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 16 +-
> drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 4 +-
> drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 17 +-
> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 329 ++++++++++--------
> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 29 +-
> drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c | 6 +-
> drivers/gpu/drm/amd/amdgpu/cik_sdma.c | 13 +-
> drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c | 8 +-
> drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | 8 +-
> drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 15 +-
> drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c | 12 +-
> drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 11 +-
> drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 14 +-
> drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c | 5 +-
> drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c | 5 +-
> drivers/gpu/drm/amd/amdgpu/sdma_v7_1.c | 12 +-
> drivers/gpu/drm/amd/amdgpu/si_dma.c | 12 +-
> drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 5 +-
> drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 3 +-
> .../amd/display/amdgpu_dm/amdgpu_dm_plane.c | 6 +-
> .../drm/amd/display/amdgpu_dm/amdgpu_dm_wb.c | 6 +-
> 23 files changed, 300 insertions(+), 243 deletions(-)
>