On 12/1/26 14:58, Boris Brezillon wrote:
> If a job is passed a dependency that's coming from the same queue the
> job is targeting, we can get rid of the dependency because of the
> implicit serialization provided by the queue. This will allow us to take
> benefit of the pipelining provided by the ring buffer (no extra
> MCU <-> CPU round-trip to have the job pushed to the ring buffer).
>
> Signed-off-by: Boris Brezillon <boris.brezillon(a)collabora.com>
> Cc: Xianzhong Li <xianzhong.li(a)nxp.com>
> ---
> Some recent effort to improve job pipelining [1] showed that the
> MCU <-> CPU round-trip that lets us signal job fences adds a
> non-negligible overhead, and this problem seems to be easier and
> more systematically fixed if it's addressed at the KMD side, so
> here's a patch doing exactly that.
>
> [1]https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/46172
> ---
> drivers/gpu/drm/panthor/panthor_drv.c | 41 +++++++++++++++++++++++++++++++++++
> 1 file changed, 41 insertions(+)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_drv.c b/drivers/gpu/drm/panthor/panthor_drv.c
> index dc8d0191aef4..cfffb9e2dec8 100644
> --- a/drivers/gpu/drm/panthor/panthor_drv.c
> +++ b/drivers/gpu/drm/panthor/panthor_drv.c
> @@ -7,6 +7,8 @@
> #include <asm/arch_timer.h>
> #endif
>
> +#include <linux/dma-fence-array.h>
> +#include <linux/dma-fence-chain.h>
> #include <linux/list.h>
> #include <linux/module.h>
> #include <linux/of_platform.h>
> @@ -591,6 +593,40 @@ panthor_submit_ctx_push_fences(struct panthor_submit_ctx *ctx)
> }
> }
>
> +static bool can_skip_dep(const struct drm_sched_job *job, struct dma_fence *fence)
> +{
> + if (!fence)
> + return true;
> +
> + /* This fence comes from our queue, and the serialization happening at
> + * the queue level makes it so we can skip the CPU wait.
> + */
> + if (fence->context == job->entity->fence_context ||
> + fence->context == job->entity->fence_context + 1)
> + return true;
> +
> + if (dma_fence_is_chain(fence)) {
> + dma_fence_chain_for_each(fence, fence) {
> + if (!can_skip_dep(job, dma_fence_chain_contained(fence)))
Recursion is usually not allowed inside the Linux kernel even when like in this case it is limited.
But you can use the dma_fence_unwrap_for_each() helper for this which should make the code much easier to write and understand.
But let me send you the cleanup patch for the dma_fence_unwrap_for_each() helper as well.
Regards,
Christian.
> + return false;
> + }
> +
> + return true;
> + } else if (dma_fence_is_array(fence)) {
> + struct dma_fence *sub_fence;
> + u32 index;
> +
> + dma_fence_array_for_each(sub_fence, index, fence) {
> + if (!can_skip_dep(job, sub_fence))
> + return false;
> + }
> +
> + return true;
> + }
> +
> + return false;
> +}
> +
> /**
> * panthor_submit_ctx_add_sync_deps_to_job() - Add sync wait operations as
> * job dependencies.
> @@ -637,6 +673,11 @@ panthor_submit_ctx_add_sync_deps_to_job(struct panthor_submit_ctx *ctx,
> return ret;
> }
>
> + if (can_skip_dep(job, fence)) {
> + dma_fence_put(fence);
> + continue;
> + }
> +
> ret = drm_sched_job_add_dependency(job, fence);
> if (ret)
> return ret;
>
> ---
> base-commit: 28f286b0dfa9610d4ee2447415e964e8bc603056
> change-id: 20261201-panhtor-dep-skip-9c6a3e2f7cc7
>
> Best regards,
This series tightens the alignment requirements for buffers that are shared
between confidential-computing guests and the host, and adds a common
allocator for host-shared memory.
When a guest runs with private memory, buffers shared with the hypervisor
are not only accessed by the guest. They are also accessed by the host
kernel, and the host may manage the corresponding shared/private state at a
granularity larger than the guest page size.
Architectures such as Arm can detect incorrect accesses to Realm physical
address space PFNs through GPC faults. However, relying on that as the only
line of defence is fragile and can still lead to kernel crashes. The risk
is especially visible for shared buffers that are later mmapped into
userspace, such as guest_memfd or dma-buf backed allocations. Once
userspace can access the mapping, the kernel cannot guarantee that
applications will only touch the intended 4K region rather than the whole
host page mapped into their address space. Those userspace addresses may
also be passed back into the kernel and accessed through the linear map,
resulting in a GPC fault.
To avoid this, host-shared buffers must satisfy two constraints:
- the address must be aligned to the CoCo shared-granule size
- the size must be a multiple of that granule size
The series adds a common CoCo shared-memory layer for enforcing these
constraints. It provides shared-granule geometry and range-validation
helpers, byte-oriented private/shared transition helpers, and
alloc_cc_shared_pages(). The allocator rounds a request to the architecture
shared granule, allocates suitably aligned contiguous pages, transitions
the complete allocation to shared state, and returns the transitioned size
alongside the page.
The corresponding free helper restores the complete allocation to private
state before returning it to the buddy allocator. If private state cannot
be restored safely, the allocation is deliberately leaked rather than
returning potentially shared memory for unrelated use.
The series also makes zeroing part of private-to-shared transitions, with
each architecture clearing memory at the appropriate point. Callers must
therefore initialize shared buffers after the transition; existing contents
are not preserved.
The shared-granule size defaults to PAGE_SIZE and can be overridden by an
architecture. The arm64 CCA changes to discover the host's IPA state change
alignment are not included in this series.
GIC ITS command queues and tables and the dma-buf system_cc_shared heap
use the common allocator. DMA direct, atomic DMA pools and SWIOTLB retain
their allocation paths and use the common layout or transition helpers.
Restricted DMA pools are checked for shared-granule alignment.
Hyper-V users of set_memory_encrypted() and set_memory_decrypted() are not
changed to use cc_make_shared() by this series. Those paths are not
currently used by the arm64 CCA code path, and therefore are not part of
the arm64 CCA IPA state change alignment problem addressed here.
Notes:
* Codex assisted with implementation, review and series organization.
Changes from v9:
https://lore.kernel.org/all/20261104164555.3555725-1-aneesh.kumar@kernel.org
* Leak allocations after failed sharing in the common allocator and SWIOTLB.
* Move x86 zeroing from the AMD, TDX and Hyper-V vTOM callbacks to
set_memory_decrypted(), after a successful transition
* Add set_memory_decrypted_nozero() for VGA mappings, which must change
memory attributes without clearing device memory.
* Zero memory even when encryption is inactive in the generic, arm64 and
pSeries implementations of set_memory_decrypted().
* Move pSeries zeroing after sharing. Document why pKVM and s390 must clear
private contents before sharing
* Drop the GIC ITS VPE L1 preallocation patch from this series.
This issue predates the series and will be addressed separately.
* Add mm/cc_shared.c and include/linux/cc_shared.h to the TSM MAINTAINERS
entry.
Changes from v8:
https://lore.kernel.org/all/20260924100529.1398790-1-aneesh.kumar@kernel.org
* Rebase onto the 7.4-rc1
* Move TDX and AMD (including SEV-SNP) zeroing to their finish callbacks
so private-to-shared transitions clear the final shared mapping.
* Clear __GFP_MOVABLE for shared allocations, which cannot be migrated.
* Resolve NUMA_NO_NODE in the common ITS allocation helper to preserve
placement for all ITS callers.
* Stop SWIOTLB allocation retries when the reduced pool would fall below
the shared granule size, avoiding an allocation retry loop.
Changes from v7:
https://lore.kernel.org/all/20260921144847.501151-1-aneesh.kumar@kernel.org
* Add the following new patches:
* "irqchip/gic-v3-its: Preallocate VPE L1 tables"
* "mm: Assert CoCo shared allocations may sleep"
* "mm: Zero memory during shared memory transitions"
* Drop the arm64 RHI and shared granule size patches so that the series can
be rebased on top of upstream to enable Shashiko review.
Changes from v6:
https://lore.kernel.org/all/20260904103452.1197239-1-aneesh.kumar@kernel.org
* Add a common allocator and geometry/transition helpers for CoCo host-shared
memory.
* Convert GIC ITS, dma-direct, atomic DMA pools, and the dma-buf
system_cc_shared heap to the common allocator.
* Limit dma-buf scatterlist entries to the requested buffer size so rounded
backing is not exposed to importers.
Changes from v5:
https://lore.kernel.org/all/20260706060432.1375570-1-aneesh.kumar@kernel.org
* Rebased to latest kernel
* Drop patch arm64: realm: Move Realm memory encryption ops to RSI code
Changes from v4:
https://lore.kernel.org/all/20260427063108.909019-1-aneesh.kumar@kernel.org
* Rename the helpers to use CoCo terminology
(mem_cc_shared_granule_size() / mem_cc_align_to_shared_granule() instead of
mem_decrypt_granule_size() / mem_decrypt_align()).
* Use __DMA_ATTR_ALLOC_CC_SHARED to pass CoCo shared allocation requirements
down to CMA-based allocation helpers.
* Add validation for restricted DMA pools to reject pools that are not aligned
to the shared granule size.
* Add dma-buf system heap handling for cc-shared buffers.
* Split the previous combined DMA/SWIOTLB/ITS change into smaller subsystem
patches covering ITS, DMA direct, SWIOTLB, restricted DMA pools, dma-buf
system heap, and arm64 Realm support.
* Rework arm64 Realm support by moving Realm memory encryption ops into RSI
code and exposing the CCA shared granule size through arm64_mem_crypt_ops.
Changes from v3:
https://lore.kernel.org/all/20260309102625.2315725-1-aneesh.kumar@kernel.org
* Fix build error reported by kernel test robot <lkp(a)intel.com>
Changes from v2:
https://lore.kernel.org/all/20251221160920.297689-1-aneesh.kumar@kernel.org
* Rebase to latest kernel
* Consider swiotlb always decrypted and don't align when allocating from swiotlb.
Changes from v1:
* Rename the helper to mem_encrypt_align
* Improve the commit message
* Handle DMA allocations from contiguous memory
* Handle DMA allocations from the pool
* swiotlb is still considered unencrypted. Support for an encrypted swiotlb pool
is left as TODO and is independent of this series.
Cc: Andrew Morton <akpm(a)linux-foundation.org>
Cc: Baoquan He <baoquan.he(a)linux.dev>
Cc: Mike Rapoport <rppt(a)kernel.org>
Cc: Pasha Tatashin <pasha.tatashin(a)soleen.com>
Cc: Pratyush Yadav <pratyush(a)kernel.org>
Cc: Catalin Marinas <catalin.marinas(a)arm.com>
Cc: "Christian König" <christian.koenig(a)amd.com>
Cc: Jason Gunthorpe <jgg(a)ziepe.ca>
Cc: Joerg Roedel (AMD) <joro(a)8bytes.org>
Cc: Marc Zyngier <maz(a)kernel.org>
Cc: Marek Szyprowski <m.szyprowski(a)samsung.com>
Cc: Robin Murphy <robin.murphy(a)arm.com>
Cc: Steven Price <steven.price(a)arm.com>
Cc: Sumit Semwal <sumit.semwal(a)linaro.org>
Cc: Suzuki K Poulose <suzuki.poulose(a)arm.com>
Cc: Thomas Gleixner <tglx(a)kernel.org>
Cc: Will Deacon <will(a)kernel.org>
Cc: Russell King <linux(a)armlinux.org.uk>
Cc: Benjamin Gaignard <benjamin.gaignard(a)collabora.com>
Cc: Brian Starkey <Brian.Starkey(a)arm.com>
Cc: John Stultz <jstultz(a)google.com>
Cc: Mark Rutland <mark.rutland(a)arm.com>
Cc: Radu Rendec <radu(a)rendec.net>
Cc: "T.J. Mercier" <tjmercier(a)google.com>
Cc: Madhavan Srinivasan <maddy(a)linux.ibm.com>
Cc: Michael Ellerman <mpe(a)ellerman.id.au>
Cc: Nicholas Piggin <npiggin(a)gmail.com>
Cc: Christophe Leroy (CS GROUP) <chleroy(a)kernel.org>
Cc: Ritesh Harjani (IBM) <ritesh.list(a)gmail.com>
Cc: Shrikanth Hegde <sshegde(a)linux.ibm.com>
Cc: Alexander Gordeev <agordeev(a)linux.ibm.com>
Cc: Gerald Schaefer <gerald.schaefer(a)linux.ibm.com>
Cc: Heiko Carstens <hca(a)linux.ibm.com>
Cc: Vasily Gorbik <gor(a)linux.ibm.com>
Cc: Christian Borntraeger <borntraeger(a)linux.ibm.com>
Cc: Sven Schnelle <svens(a)linux.ibm.com>
Cc: Ingo Molnar <mingo(a)redhat.com>
Cc: Borislav Petkov <bp(a)alien8.de>
Cc: Dave Hansen <dave.hansen(a)linux.intel.com>
Cc: x86(a)kernel.org
Cc: H. Peter Anvin <hpa(a)zytor.com>
Cc: Kiryl Shutsemau <kas(a)kernel.org>
Cc: Rick Edgecombe <rick.p.edgecombe(a)intel.com>
Cc: K. Y. Srinivasan <kys(a)microsoft.com>
Cc: Haiyang Zhang <haiyangz(a)microsoft.com>
Cc: Wei Liu <wei.liu(a)kernel.org>
Cc: Dexuan Cui <decui(a)microsoft.com>
Cc: Long Li <longli(a)microsoft.com>
Cc: Paolo Bonzini <pbonzini(a)redhat.com>
Cc: Vitaly Kuznetsov <vkuznets(a)redhat.com>
Cc: Andy Lutomirski <luto(a)kernel.org>
Cc: Peter Zijlstra <peterz(a)infradead.org>
Cc: dri-devel(a)lists.freedesktop.org
Cc: iommu(a)lists.linux.dev
Cc: linaro-mm-sig(a)lists.linaro.org
Cc: linux-arm-kernel(a)lists.infradead.org
Cc: linux-media(a)vger.kernel.org
Cc: linux-mm(a)kvack.org
Cc: kvmarm(a)lists.linux.dev
Cc: patches(a)lists.linux.dev
Aneesh Kumar K.V (Arm) (13):
mm: Add an allocator for CoCo shared memory
mm: Zero memory during shared memory transitions
irqchip/gic-v3-its: Resolve the default NUMA node explicitly
irqchip/gic-v3-its: Allocate shared tables using CoCo shared memory
allocator
dma-contiguous: Derive shared alignment from DMA attributes
dma-pool: Allocate CoCo atomic pools using CoCo shared memory
allocator
dma-direct: Align CoCo shared DMA allocations to the shared granule
size
swiotlb: Align shared IO TLB pools to the shared granule size
swiotlb: Reject misaligned restricted DMA pools for CoCo guests
dma-buf: system_heap: Limit scatterlist entries to the buffer size
dma-buf: system_heap: Allocate shared buffers using CoCo shared memory
allocator
swiotlb: Make rounded shared pool capacity allocatable
mm: Assert CoCo shared allocations may sleep
MAINTAINERS | 2 +
arch/arm/mm/dma-mapping.c | 5 +-
arch/arm64/mm/mem_encrypt.c | 8 +-
arch/powerpc/platforms/pseries/svm.c | 13 +-
arch/s390/mm/init.c | 7 +
arch/x86/hyperv/hv_init.c | 6 +-
arch/x86/include/asm/set_memory.h | 1 +
arch/x86/include/asm/vga.h | 4 +-
arch/x86/kernel/kvmclock.c | 6 +-
arch/x86/mm/mem_encrypt_amd.c | 1 +
arch/x86/mm/pat/set_memory.c | 19 +-
drivers/dma-buf/heaps/system_heap.c | 128 +++++-----
drivers/firmware/arm_rmm/rsi.c | 9 +
drivers/hv/connection.c | 41 ++-
drivers/hv/hv.c | 11 +-
drivers/hv/hv_common.c | 2 -
drivers/iommu/dma-iommu.c | 2 +-
drivers/irqchip/irq-gic-v3-its.c | 42 ++--
drivers/virt/coco/pkvm-guest/arm-pkvm-guest.c | 4 +
include/linux/cc_shared.h | 39 +++
include/linux/dma-map-ops.h | 9 +-
include/linux/set_memory.h | 8 +-
kernel/dma/contiguous.c | 41 ++-
kernel/dma/direct.c | 73 ++++--
kernel/dma/ops_helpers.c | 2 +-
kernel/dma/pool.c | 27 +-
kernel/dma/swiotlb.c | 94 ++++---
kernel/kexec_file.c | 3 +-
mm/Makefile | 1 +
mm/cc_shared.c | 238 ++++++++++++++++++
30 files changed, 635 insertions(+), 211 deletions(-)
create mode 100644 include/linux/cc_shared.h
create mode 100644 mm/cc_shared.c
base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3
prerequisite-patch-id: 121492d71cc22b2adbfdedd668868c5a449ad764
prerequisite-patch-id: ed31fd728f0adba3d60dcd6f3bae8da1a2193bcc
--
2.43.0
On 12/1/26 10:33, Alistair Popple wrote:
> On 2026-12-01 at 19:11 +1100, Christian König <christian.koenig(a)amd.com> wrote...
>> On 12/1/26 08:13, Alistair Popple wrote:
>>> On 2026-12-01 at 15:05 +1100, Dave Airlie <airlied(a)gmail.com> wrote...
>>>>> The problem is I can't figure out how to build that low level API.
>>
>> Seconded.
>>
>> I can give you quite a bunch of requirements based on what the high level DMA-buf API and uAPI has on functionality and based on what I have seen on use cases in the wild.
>
> I think a bunch of requirements would be helpful, because they've kind of been
> scattered across threads at this point and I concluded it was kind of impossible
> to build given the constraints.
>
> In particular the one thing that PCIe P2P, IOMMUFD, KVM, etc. all need is the
> physical address. That is the vendor agnostic thing below but providing that has
> been consistently NACKed and I can't see how you can make any low level API work
> without having the physical address.
Yeah good point, let's start with that one. There are multiple problems with using physical addresses.
First of all a physical address is only what the CPU can see, but there are a lot of use cases where you need to access resources the CPU can't reach. For example hidden device memory or even system memory where the CPU intentionally has no address for because of digital rights management reasons etc... Taking a look at all the use cases I have seen I would say that DMA-buf actually contains more non CPU accessible resources than CPU accessible ones.
Then especially for PCI a physical address is only halve the information you need. The importer can also need additional info to stitch together the TLP, like SH, snooping bit, atomic access ops etc....
Then there is the reason that we have seen a tremendous amount of cases where importers abused the physical address and/or struct page pointer which was unfortunately accessible through the SGT. To be honest I can't count the number of CVE entries given to such bugs.
There are some use cases for KVM for example which need physical addresses, but to be honest they look like corner cases.
Ideally even the exporter shouldn't work with physically addresses I think. For example even when you have a PCI P2P API which fills in your mapping it should work with PCI BAR, offset and length and and not a physical address into the BAR.
> I know in the past you've suggested passing all the importer context through to
> the exporter, but that is also a complete non-starter. It lets arbitrary drivers
> implement the mapping wrong and likely get all the life-times, which belong to
> the importer, wrong. So until we can solve that I'm not really seeing much of
> way forward here.
WOW, wait a second. With the exception of the old interface which pins things down the lifetime of the mapping belongs to the exporter and not the importer!
That's one of the reasons why the exporter needs the IOMMU context of the importer for example, otherwise you can't forcefully remove IOMMU mappings without relying on the importer doing that for you.
>> But I can't say either what the low level API needs to look like and one of the major reasons I want DMA-buf separated from that low level API is that it seems like this needs a different field of expertise and responsibilities.
>
> I get it, and I do appreciate the expertise provided here. However if DMA-buf
> is supposed to be some separate mechanism just for passing pointer types between
> exporter/importer with some lifetime and location negotiation rules it shouldn't
> also be seeking to impose constraints on what information those types actually
> contain. That is none of it's business and is up to what the low level API
> needs.
I have to admit that's a pretty good argument, but I would say the restriction is on the exporter, importer and which role is using what and not the low level API itself.
> If the low level API needs importer context and physical addresses to do
> anything useful then so be it.
As long as the low level API is only called by the exporter I have no problem with it taking physical addresses when it is sufficient for the use case.
I just think that we have use cases where the exporter needs to give additional information to the physical address to the IOMMU driver for example.
I need to attend some customer stuff now and will try to answer the rest of the mail later today.
Regards,
Christian.
>>>>>
>>>>> The current low level DMA API can't correctly handle PCIe P2P, or IOMMUFD, or
>>>>> the KVM/confidential compute use-cases (I'm less familiar with those). It can
>>>>> only handle creating a DMA mapping for system memory for a specific importing
>>>>> device.
>>>>>
>>>>> So I assume you are talking about some new API. Following Dave's lead lets call
>>>>> that shared_buf_map(). That would need to take some importing device context
>>>>> so that it could dispatch to the correct mapping code and a list of physical
>>>>> locations the exporter needs mapped.
>>>>>
>>>>> At a high level something like:
>>>>>
>>>>> struct dma_addr_list *shared_buf_map(import_context, location_list);
>>>>>
>>>>> Where the import_context is some importer specific struct opaque to the exporter
>>>>> and the location list is a list of either PCIe MMIO or system RAM physical
>>>>> addresses.
>>>>>
>>>>> Every exporter ->map_dma_buf() should call shared_buf_map() instead of
>>>>> open-coding their own mapping code, as I think we all agree we don't want that
>>>>> open-coded.
>>>>>
>>>>> Placement selection can be dealt with as a separate topic, so setting that
>>>>> aside means passing in the same location list regardless of importing device.
>>>>> shared_buf_map() then has to dispatch to the correct mapping generation code -
>>>>> either DMA API, PCIe peer-to-peer API, IOMMUFD API, KVM API or maybe some other
>>>>> importing device/driver specific API.
>>
>> That sounds totally sane to me, yes.
>
> Ok. The problem is how this shared_buf_map() gets the importer context.
>
> It would be easy enough to make work if an impoter could call eg.
> shared_buf_map(import_type, attachment) or something like that, but I got the
> impression from the middle-layer discussion that that would be undesirable and
> get NACKed because only exporter should call that. So not sure how to actually
> make that work, unless my impression there is wrong.
>
>>>>>
>>>>> I could see how that could be made to work, but it seems more complex than
>>>>> a dma_buf exporter op that returns a list of physical locations and a helper
>>>>> library that importers call to do the mapping into whatever importer specific
>>>>> context is needed. Instead you would have to add importer specific callbacks
>>>>> that the shared_buf_map code could call along with plumbing the importer context
>>>>> through.
>>
>> I've thought about that as well for a while but came to the conclusion that we most likely want some more differentiation here.
>>
>> On the one hand we have the vendor agnostic things like PCI P2P, IOMMU, IOVAs, bus addresses, CPU physical addresses etc... which a vendor agnostic API should be dealing with.
>
> Right - I'd like to tackle the vendor agnostic things, as they provide the most
> value. Vendor specific things have already been hacked up to work in all sorts
> of horrible ways, which is why I want to fix this so I can at least remove some
> of the horrid hacks from our code.
>
>> On the other hand we have vendor specific things like XGMI, GDS/GWS/OA, I2C, I2S, doorbells, <just name the strange thing people stuffed into a DMA-buf> which only specific drivers understand.
>>
>> The problem is now that those things at least partially overlap, for example a doorbell which is ringed by a PCI P2P write.
>
> I'd argue that a doorbell rung by a PCI P2P write isn't any different than any
> other PCI P2P access. The data in these buffers doesn't change the type from a
> buffer sharing perspective, the type of data in these buffers is always up to
> some other layer (eg. userspace), so I don't see the overlap.
>
>>>>
>>>> This is where I got to thinking it might end up, not that we have an
>>>> export function that actually exports anything, but merely advertises
>>>> this provider has an object with this fd and it can export it in these
>>>> ways.
>>>>
>>>> Then on import we'd have to go into the exporter and setup the object
>>>> that gets shared between that specific importer/exporter combination
>>>> and not always have a singular export, but one per import, that I
>>>> suppose could be refcounted per export if lots of importers wanted the
>>>> same thing.
>>
>> Yes that is a requirement of ROCm as well and we have hacked around such things massively with the KFD and all the rat tail of consequences seen by it.
>
> I should introduce you to RM :-)
>
> Thanks.
>
> - Alistair
>
>>> That sounds reasonably complex. Do you have a vague plan, ideally in the form
>>> of data-structures/API definitions, that would help explain what it would look
>>> like?
>>>
>>> For now I have sent a simplified RFC series -
>>> https://lore.kernel.org/dri-devel/20261201-dmabuf_shared_buf_v1_xe_rc5-v1-0… - that drops the placement
>>> bits and implements the rough plan I outlined in
>>> https://lore.kernel.org/dri-devel/awZ_Os1pXelOGaFP@nvdebian.thelocal/ . I'm not
>>> sure it addresses everything, but I'd be interested in getting feedback on what
>>> it gets right and what specifically needs fixing/changing, and how, to satisfy
>>> the design constraints.
>>>
>>> Thanks.
>>>
>>> - Alistair
>>>
>>>> Now maybe we can't call this dma-buf, but I think dma-buf is a subset of this.
>>
>> I would say that DMA-buf is the high level API which allows importers and exporters to exchange the data structures of the low level API.
>>
>> Christian.
>>
>>>>
>>>> Dave.
>>
On Sun, Nov 29, 2026 at 12:35:35PM +0100, Tomeu Vizoso wrote:
> Allow specifying a second sub-mailbox that could be used by the firmware
> in addition to the first one, which is taken by remoteproc.
>
> This is required by firmware that doesn't use rpmsg for their
> communication with the Linux kernel.
>
> Signed-off-by: Tomeu Vizoso <tomeu(a)tomeuvizoso.net>
>
> ---
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski(a)oss.qualcomm.com>
Best regards,
Krzysztof
On Sun, Nov 29, 2026 at 12:35:34PM +0100, Tomeu Vizoso wrote:
> Besides the existing L2 SRAM region, at least some C7x DSPs in K3 SoCs
> have an additional region called in the documentation "AUX L2 SRAM".
> This is just some more SRAM that is accessed separately.
>
> Also add the memory region for the control registers of the DRU (Data
> Routing Unit), which allow starting DMA transactions and polling for
> their completion.
>
> The two entries are optional, so existing device trees still validate,
> and are allowed only for the ti,am62a-c7xv-dsp compatible, the C7x
> generation that has them.
>
> Signed-off-by: Tomeu Vizoso <tomeu(a)tomeuvizoso.net>
>
> ---
>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski(a)oss.qualcomm.com>
Best regards,
Krzysztof
Hi guys,
On 12/1/26 08:13, Alistair Popple wrote:
> On 2026-12-01 at 15:05 +1100, Dave Airlie <airlied(a)gmail.com> wrote...
>>> The problem is I can't figure out how to build that low level API.
Seconded.
I can give you quite a bunch of requirements based on what the high level DMA-buf API and uAPI has on functionality and based on what I have seen on use cases in the wild.
But I can't say either what the low level API needs to look like and one of the major reasons I want DMA-buf separated from that low level API is that it seems like this needs a different field of expertise and responsibilities.
>>>
>>> The current low level DMA API can't correctly handle PCIe P2P, or IOMMUFD, or
>>> the KVM/confidential compute use-cases (I'm less familiar with those). It can
>>> only handle creating a DMA mapping for system memory for a specific importing
>>> device.
>>>
>>> So I assume you are talking about some new API. Following Dave's lead lets call
>>> that shared_buf_map(). That would need to take some importing device context
>>> so that it could dispatch to the correct mapping code and a list of physical
>>> locations the exporter needs mapped.
>>>
>>> At a high level something like:
>>>
>>> struct dma_addr_list *shared_buf_map(import_context, location_list);
>>>
>>> Where the import_context is some importer specific struct opaque to the exporter
>>> and the location list is a list of either PCIe MMIO or system RAM physical
>>> addresses.
>>>
>>> Every exporter ->map_dma_buf() should call shared_buf_map() instead of
>>> open-coding their own mapping code, as I think we all agree we don't want that
>>> open-coded.
>>>
>>> Placement selection can be dealt with as a separate topic, so setting that
>>> aside means passing in the same location list regardless of importing device.
>>> shared_buf_map() then has to dispatch to the correct mapping generation code -
>>> either DMA API, PCIe peer-to-peer API, IOMMUFD API, KVM API or maybe some other
>>> importing device/driver specific API.
That sounds totally sane to me, yes.
>>>
>>> I could see how that could be made to work, but it seems more complex than
>>> a dma_buf exporter op that returns a list of physical locations and a helper
>>> library that importers call to do the mapping into whatever importer specific
>>> context is needed. Instead you would have to add importer specific callbacks
>>> that the shared_buf_map code could call along with plumbing the importer context
>>> through.
I've thought about that as well for a while but came to the conclusion that we most likely want some more differentiation here.
On the one hand we have the vendor agnostic things like PCI P2P, IOMMU, IOVAs, bus addresses, CPU physical addresses etc... which a vendor agnostic API should be dealing with.
On the other hand we have vendor specific things like XGMI, GDS/GWS/OA, I2C, I2S, doorbells, <just name the strange thing people stuffed into a DMA-buf> which only specific drivers understand.
The problem is now that those things at least partially overlap, for example a doorbell which is ringed by a PCI P2P write.
>>
>> This is where I got to thinking it might end up, not that we have an
>> export function that actually exports anything, but merely advertises
>> this provider has an object with this fd and it can export it in these
>> ways.
>>
>> Then on import we'd have to go into the exporter and setup the object
>> that gets shared between that specific importer/exporter combination
>> and not always have a singular export, but one per import, that I
>> suppose could be refcounted per export if lots of importers wanted the
>> same thing.
Yes that is a requirement of ROCm as well and we have hacked around such things massively with the KFD and all the rat tail of consequences seen by it.
> That sounds reasonably complex. Do you have a vague plan, ideally in the form
> of data-structures/API definitions, that would help explain what it would look
> like?
>
> For now I have sent a simplified RFC series -
> https://lore.kernel.org/dri-devel/20261201-dmabuf_shared_buf_v1_xe_rc5-v1-0… - that drops the placement
> bits and implements the rough plan I outlined in
> https://lore.kernel.org/dri-devel/awZ_Os1pXelOGaFP@nvdebian.thelocal/ . I'm not
> sure it addresses everything, but I'd be interested in getting feedback on what
> it gets right and what specifically needs fixing/changing, and how, to satisfy
> the design constraints.
>
> Thanks.
>
> - Alistair
>
>> Now maybe we can't call this dma-buf, but I think dma-buf is a subset of this.
I would say that DMA-buf is the high level API which allows importers and exporters to exchange the data structures of the low level API.
Christian.
>>
>> Dave.
On Thu, 26 Nov 2026 11:59:09 +0530, Jayant Shekhar wrote:
> Add a binding for the Qualcomm DCP VirtIO display function.
> Document the framebuffer IOMMU context, DCP INTF output graph, DSI host
> indices, and connections to the external display chain. Firmware-owned
> display resources and internal paths are discovered at runtime.
>
> Assisted-by: LLM
> Signed-off-by: Jayant Shekhar <jayant.shekhar(a)oss.qualcomm.com>
> ---
> .../devicetree/bindings/display/msm/qcom,dcp.yaml | 159 +++++++++++++++++++++
> 1 file changed, 159 insertions(+)
>
My bot found errors running 'make dt_binding_check' on your patch:
yamllint warnings/errors:
dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/virtio/qcom,dcp-virtio.example.dtb: virtio@9be8000 (qcom,dcp-virtio): iommu-ranges: [[0,2214592512,0,67108864]] has less than 4 items
from schema $id: http://devicetree.org/schemas/virtio/qcom,dcp-virtio.yaml
Documentation/devicetree/bindings/virtio/qcom,dcp-virtio.example.dtb: virtio@9be8000 (qcom,dcp-virtio): iommu-ranges:0: [0,2214592512,0,67108864] is not of type "integer"
from schema $id: http://devicetree.org/schemas/virtio/qcom,dcp-virtio.yaml
Documentation/devicetree/bindings/virtio/qcom,dcp-virtio.example.dtb: virtio@9be8000 (qcom,dcp-virtio): iommu-ranges:0: [0,2214592512,0,67108864] is not of type "integer"
from schema $id: http://devicetree.org/schemas/virtio/qcom,dcp-virtio.yaml
doc reference errors (make refcheckdocs):
See https://patchwork.kernel.org/project/devicetree/patch/20261126-jshekhar-v3-…
The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.
On Mon, 23 Nov 2026 18:11:00 +0100
Olivier MOYSAN <olivier.moysan(a)foss.st.com> wrote:
> Hi Conor,
>
Leaving a lot more than I normally would given I don't provide
much insight but want to make sure it is visible for others.
> On 11/19/26 19:37, Conor Dooley wrote:
> > On Wed, Nov 18, 2026 at 04:17:45PM +0100, Olivier Moysan wrote:
> >> This series adds support for the STM32 Multi-function Digital Filter
> >> (MDF) found on STM32MP2 SoCs. MDF converts bitstreams from external
> >> sigma-delta modulators and PDM microphones into samples for IIO and
> >> ASoC consumers.
> >>
> >> The drivers support direct IIO conversions, cyclic DMA acquisition,
> >> CIC configuration and scaling, synchronized and interleaved filters,
> >> and external timer triggers. An ASoC DAI provides PDM microphone capture.
> >>
> >> This revision addresses the v1 review comments listed below and splits
> >> the driver patch into smaller functional patches for readability.
> >> It retains the existing IIO backend interface for external sigma-delta
> >> modulators, pending agreement on the preferred abstraction.
> >>
> >> These changes do not resolve all v1 review comments. In particular, the
> >> frontend/backend architecture, DT child-node model and complete clock
> >> topology remain open discussion points.
> >>
> >> * Open questions: MDF topology (backend/frontend)
> >>
> >> In Analog Devices use of the IIO backend framework, the AXI ADC is a
> >> hardware backend, while the AD9467 is a hardware frontend. The external
> >> sigma-delta modulator is actually a hardware frontend in the MDF signal
> >> chain. The difference from the AD9467 use case is which driver owns the
> >> aggregate IIO device.
> >
> > My red line here, that I probably made pretty clear on v1, is that what
> > is done needs to make sense when the ADC is feeding the MDF, it cannot
> > only work for the data coming in from sd modulators or w/e you connect
> > to the SITFx inputs.
> >
>
> I understand your concern. Let me first give some context on the use
> cases. This series only supports external devices connected to the
> serial interfaces (SITF): PDM microphones, which are the main use case,
> and sigma-delta modulators. Still, I think the MDF centered model
> (option 1 & 2) makes sense for the internal ADC to MDF path as well.
> Here is how it could look:
>
> - The ADC becomes a provider for the MDF filter, like an external
> modulator: it provides its resolution and vref and runs its
> conversions in MDF mode, while the filter handles decimation,
> trigger and DMA.
>
> - The routing is static. On the STM32 ADC, data routing to the MDF is a
> global setting for the ADC instance, not a per-channel configuration.
> An ADC instance feeding the MDF is dedicated to this path. It would
> not be a frontend for some channels and a backend for others at the
> same time.
>
> - The binding describes the data source of each filter: could be either
> a stream on a serial interface (the current st,sitf reference) or the
> ADC interface (reference to the ADC node). The binding can be
> completed this way without changing the rest of the model.
>
> - The same model also covers interleaved groups that mix filters fed by
> the ADC and filters fed by serial interfaces, as well as the audio
> use case described below.
>
> The STM32 ADC driver does not support a backend mode today, but it could
> be added as an exclusive per-instance mode, selected in DT, in which the
> ADC registers an IIO backend instead of an IIO device.
>
> I agree that the IIO device exposing a given analog signal is not the
> same when the signal is read directly from the ADC and when it goes
> through the MDF.
> I think this is consistent with the hardware: these are two distinct
> acquisition chains, with different configurations. As the routing is
> fixed in DT, userspace sees only one device for a given channel.
>
> >> Option 1:
> >> One option would be to generalize the existing backend abstraction to
> >> represent components contributing to an aggregate IIO device,
> >> independently of their position in the signal chain.
> >>
> >> The existing framework appears to provide the required mechanisms. None
> >> of these mechanisms inherently requires the provider to be a hardware backend.
> >> A generic component/provider model would support both topologies without
> >> duplicating interfaces or requiring reciprocal dependencies. The key
> >> point here is to preserve the compatibility of APIs and DT bindings.
> >>
> >> Option 2:
> >> Alternatively, if the backend abstraction should retain its hardware
> >> meaning, we could introduce an explicit frontend-provider abstraction
> >> sharing the existing infrastructure. Frontend operations would cover
> >> analog-side control and conversion parameters.
> >>
> >> Would generalizing the existing abstraction be acceptable, or would a
> >> separate frontend interface built on shared infrastructure be preferred?
> >
> > For either of these options, do you envisage the data being retrieved
> > from the mdf sysfs files rather than from the modulator?
> >
>
> Yes, in options 1 & 2, the MDF filter registers the IIO device that
> exposes the data. The modulator, or the ADC in the case above, only
> provides the analog-side information, such as the reference voltage used
> to compute the scale.
> This would generalize the IIO backend framework, regardless of where the
> companion component is placed in the chain.
>
> +---------------------+ +----------------+
> | frontend w/o iio dev| ----> | MDF |---> IIO dev
> | | | |
> +---------------------+ +----------------+
>
> This also resembles the way the acquisition chain is described in the
> ASoC framework, where the device is not attached to the codec. (see below)
>
> >>
> >> Option 3:
> >> An aggregate IIO device based on the component framework, as discussed
> >> in previous threads, could also be considered. I currently regard this
> >> as a fallback solution:
> >> https://lore.kernel.org/all/ec411432-4b77-4410-b0aa-b29f73b82c84@foss.st.co…
> >
> > You option 2 in the earlier thread had:
> > | 2 - DFSDM managed as a "hardware accelerator"
> > |
> > |
> > | +-------------+
> > | | Sysfs |
> > | | - Scale | +---------------+
> > | | - Raw data | | IIO char dev |
> > | +-------------+ +---------------+
> > | ^ /\
> > | | ||
> > | | || Userland
> > | -----------------------------------------------------------
> > | | || IIO fw
> > | | ||
> > | | ||
> > | -----------------------------------------------------------
> > | | ||
> > | +--|-------------||--+ +----------------+
> > | | | || | | | Drivers
> > | | | ======================= |
> > | | | | | || |
> > | | +-----------------+-----+--+ || |
> > | | +---------+-----+--+ || |
> > | +----------|---------+ +-----------||---+
> > | | ||
> > | -----------------------------------------------------------
> > | | ||
> > | +----------|---------+ +-----------||---+
> > | | | | || | Hardware
> > | | sd modulator | | DFSDM || |
> > | ============================================= |
> > | | | | |
> > | +----------+---------+ +----------------+
> > | |
> > | |
> > | Vref
> > |
> > | The DFSDM is a consumer of the SD modulator.
> > |
> > | In addition to its complexity, the main drawback of this approach is
> > | that it is unsuitable for interleaved mode.
> >
> > Two mails prior I had theorised a way to deal with the interleaved mode
> > https://lore.kernel.org/all/20261015-attentive-conflict-1a1f538de77d@spud/
> > but I never saw a response from you as to why something like that cannot
> > work. That's twice in that thread you said it was unsuitable without
> > providing the actual explanation for why?
> >
>
> Sorry, I did not respond to your proposal directly. Here is the explanation.
>
> In interleaved mode, filters 0 to N-1 are grouped, and synchronized by
> filter 0. The samples of all the filters are transferred through the
> filter 0 DMA request as a single interleaved stream. Filters 1 to N-1
> have no DMA transfer and no configuration of their own in this mode.
> Interleaved is used in audio (ex stereo) and analog (scan mode) use cases.
> Interleaved mode is needed in following use cases: multichannel audio
> capture (e.g. stereo microphones), and synchronous multichannel
> acquisition of analog sources (scan mode).
>
> With the MDF as a backend, each modulator would be a frontend
> registering its own IIO device. I see the following limitations:
>
> - One hardware buffer, several IIO devices.
> The interleaved stream is a single DMA buffer carrying samples from
> N modulators. A backend buffer is attached to a single IIO device.
> There is currently no way to share one hardware buffer between several
> frontends, or to demux it into several IIO devices.
> Jonathan described this as the swdemux/swmux concepts, which do not
> exist yet:
> https://lore.kernel.org/all/20261019022510.0d554b39@jic23-hlaptop/
>
> - Ownership of the interleaved data.
> With a dedicated cell value (e.g. -1) for the interleaved data, some
> node has to reference it. If it is one of the modulators, this
> modulator becomes in practice the aggregate device (or interleaver)
> It exposes the N channels and needs the scale and supplies of the
> other modulators.
> The choice of this modulator is arbitrary and nothing in the hardware
> reflects it. If it is a dedicated node, it describes a software
> construct rather than hardware.
>
> - Shared configuration.
> Because the configuration is common to the group, writing config
> (sampling_frequency or oversampling) on one frontend would silently
> change the other frontends.
>
> - Frontends unusable on their own.
> Filters 1 to N-1 have no DMA and no config of their own in this mode,
> so the frontend IIO devices linked to them could not acquire alone.
> Acquisition can be started through the filter 0 only.
> The current driver avoids this by only exposing the group, through
> filter 0.
>
> None of these points is impossible to solve in principle, but they
> require new IIO infrastructure (cross-device buffer demux, coordinated
> buffer enable, arbitration of shared attributes).
>
>
> * Audio use case
>
> Audio is currently the main use case for the MDF.
> The audio chain is modeled as follows in ASoC framework:
>
> Digital Audio Interface link
> +------------------------------------------------------+
> | +--------------------+ +----------------+ |
> | | DMIC | ----> | MDF | -----|--> audio device
> | | (Audio codec) | | (CPU DAI) | |
> | +--------------------+ +----------------+ |
> +------------------------------------------------------+
>
> - The sources are PDM microphones. They are handled on the ASoC side
> (e.g. the generic dmic codec). They have no IIO representation.
>
> - ALSA expects interleaved PCM frames for multichannel capture. An
> N-channel capture is exposed as a single audio device fed by the
> interleaved filter group, whereas N independent mono captures are
> exposed as N separate audio devices.
>
> - The data goes to the ASoC DAI through an ASoC callback, not to IIO
> userspace.
>
> So for audio, the interleaved stream is the data itself, not an
> optimisation of DMA resources. It is consumed as one multichannel
> stream whose sources have no IIO frontend. In a model where the MDF is
> only a backend of IIO frontends, there is no frontend to own this
> stream. The MDF would remain the data producer for audio while being a
> backend for the analog sources, i.e. two models in the same driver.
>
> This let me say that MDF as backend is "unsuitable" (complexity &
> missing IIO infrastructure)
>
> This is why I think the model should be centered on the MDF filter
> as the device producing the data, with the data sources
> (external modulators, or the internal ADC) providing their analog-side
> information. This model covers the serial interface and ADC sources,
> interleaved groups, and audio, with a single approach. Option 1 or 2
> from the cover letter, or the aggregate device of option 3, would fit it.
>
> Jonathan and Nuno, please let me know if you have an opinion on this.
> In particular on whether a frontend-provider abstraction (option 2)
> would be acceptable.
This whole thing is an interesting challenge. However, I don't have enough
visibility to really understand if this is more or less a one off thing
or more general. We have had a few ADI parts recently where we have seen
not dissimilar requirements for a composite device with shared back end
so it may well be that it is time to work out how to flesh out a more
general solution for IIO wrt to these devices.
Nuno and other ADI folk can you have a look at what Oliver has here
and conclude whether there is sufficient overlap to look for that general
solution or not?
>
> If not, it seems to me the that option 3 (aggregate IIO device based on
> component framework) has less drawbacks than the swmux/demux approach.
We are going to end up with something that at least a little bit smells
like a composite device even if we do go for a general IIO solution.
If this were all fairly low speed it would actually smell quite like
a sensor hub, but there we don't have the complexity of a DMA buffer
so we just deinterleave the streams in software.
Also remember is a separation between what we put in DT and what we do
with that description. So we may be able to describe things
more cleanly than the software model we build on top. That may give
us a path forwards before we get to a more universal solution.
IIRC you 'can' do a search for phandles that point to a device. I think
we did this somewhere to paper over reversing the direction when
the backend stuff was first introduced. It is horrible though!
I'm going to skip a detailed review of the driver for now
given my backlog is too large (and I have an excuse as we are
talking about the fundamental design)
Jonathan
>
> Best regards,
> Olivier
>
>
> > Cheers,
> > Conor.
> >
> >>
> >> * Driver implementation
> >>
> >> Serial interfaces (SITF) are shared resources managed directly by the
> >> MDF core and no longer have separate platform devices. This revision
> >> retains their DT nodes to describe configuration and clock connections,
> >> and to allow filters to reference their input bitstreams without
> >> duplicating shared settings.
> >>
> >> This revision also retains a platform device for each MDF filter, as
> >> each filter manages its own registers, interrupt, DMA channel and IIO
> >> acquisition state, with a separate suspend/resume lifecycle.
> >>
> >> * Clock management
> >>
> >> Several clock-management review comments are addressed in this revision:
> >> - The provider-side clock-frequency property has been removed. Consumers
> >> request CCK rates through assigned-clocks and assigned-clock-rates.
> >> - The clock-names property has been removed. The core acquires its single
> >> input clock by index, and CCK gating uses regmap-based clock operations.
> >> - Remove the unused clock-ranges property, as the core now explicitly
> >> shares the kernel clock with the serial interfaces and filters instead
> >> of relying on parent clock lookup.
> >>
> >> Clock topology point remains open, awaiting clarification of the MDF topology.
> >>
> >> Changes since v1:
> >> - Split the large IIO driver patch into smaller functional patches.
> >> - Replace provider-side clock-frequency with consumer-assigned CCK rates
> >> through the common clock framework.
> >> - Remove the platform devices for serial interfaces.
> >> - Replace the interleave phandle list with a filter count, covering
> >> consecutive filters starting at filter 0.
> >> - Simplify clock-output-names, remove clock-names, reset-names and
> >> filter-level clock properties, and move mdf-dai into an explicit
> >> property outside the conditional schema.
> >> - Rename the binding to match the STM32MP25 compatible, sort compatible
> >> entries, and simplify the binding patch subject.
> >> - Use unsigned long for match data, improve probe error reporting and
> >> wrapping, remove a probe-success debug message, and add kernel-doc for
> >> exported core functions.
> >> - Use scoped spinlock guards.
> >> - Remove empty serial-interface runtime-PM callbacks.
> >> - Remove the redundant ASoC platform module alias.
> >>
> >> Additional fixes since v1 (following Sashiko review):
> >> - Compute the settling-time discard count with 64-bit arithmetic.
> >> - Size cyclic DMA periods in complete scans and validate buffer and
> >> period alignment before starting DMA.
> >> - Fix backend-enable rollback so backend zero is disabled as well.
> >> - Use managed allocation for the conversion buffer and managed IIO
> >> triggered-buffer setup.
> >> - Release temporary synchronization and serial-interface firmware-node
> >> references. Replacing interleave phandles also removes the associated
> >> stored node references.
> >> - Avoid unregistering secondary interleaved filters that were never
> >> registered as IIO devices.
> >> - Use managed acquisition of the optional serial clock.
> >> - Replace the GCD-based CCK divider selection with a search for the
> >> largest valid divisor, allowing non-power-of-two divider values.
> >> - Remove the selection of the undefined COMMON_CLK_REGMAP symbol.
> >>
> >> Previous discussion:
> >> https://lore.kernel.org/all/20261001145702.2628429-1-olivier.moysan@foss.st…
> >>
> >> Signed-off-by: Olivier Moysan <olivier.moysan(a)foss.st.com>
> >> ---
> >> Olivier Moysan (11):
> >> dt-bindings: iio: adc: add stm32mp2 mdf filter
> >> iio: adc: stm32-mdf: add core registration
> >> iio: adc: stm32-mdf: add cck clocks provider
> >> iio: adc: stm32-mdf: add serial interfaces support
> >> iio: adc: stm32-mdf: add digital filter device support
> >> iio: adc: stm32-mdf: configure cic filters and sample rates
> >> iio: adc: stm32-mdf: add direct iio conversion support
> >> iio: adc: stm32-mdf: add dma buffered acquisition support
> >> iio: adc: stm32-mdf: add external timer trigger support
> >> iio: adc: stm32-mdf: add dmic audio filter support
> >> ASoC: stm32: add mdf dai support
> >>
> >> .../bindings/iio/adc/st,stm32mp25-mdf.yaml | 341 ++++
> >> drivers/iio/adc/Kconfig | 29 +
> >> drivers/iio/adc/Makefile | 3 +
> >> drivers/iio/adc/stm32-mdf-adc.c | 2080 ++++++++++++++++++++
> >> drivers/iio/adc/stm32-mdf-core.c | 899 +++++++++
> >> drivers/iio/adc/stm32-mdf-serial.c | 223 +++
> >> drivers/iio/adc/stm32-mdf.h | 275 +++
> >> include/linux/iio/adc/stm32-mdf-adc.h | 19 +
> >> sound/soc/stm/Kconfig | 15 +
> >> sound/soc/stm/Makefile | 3 +
> >> sound/soc/stm/stm32_amdf.c | 375 ++++
> >> 11 files changed, 4262 insertions(+)
> >> ---
> >> base-commit: d922ed738439e1d5b4701df7f4cdd49a09925624
> >> change-id: 20261112-upstream_mdf_v2-76040d99138e
> >>
> >> Best regards,
> >> --
> >> Olivier Moysan <olivier.moysan(a)foss.st.com>
> >>
>
>
On Fri Nov 27, 2026 at 6:30 PM GMT, Daniel Almeida wrote:
> dma_fence_begin_signalling() and dma_fence_end_signalling() mark the
> code that the completion of a dma-fence depends on, so that lockdep can
> check it against the dma-fence rules. However, up until now, it was not
> possible to use the signalling tokens from Rust. Thus, add support for
> it.
>
> Patch 1 adds SignallingSection, a guard that begins a section when it
> is created and ends it when it is dropped. Patch 2 makes
> DriverFence::signal() take a &SignallingSection, so that its callers
> have to be in one.
Do you need it being a guard? You can do things like
let a = SignallingSection::begin();
let b = SignallingSection::begin();
drop(a);
drop(b);
to break nesting. A closure-based approach wouldn't have this issue.
Best,
Gary
>
> Patch 5 of the JobQueue series [1] changes the same signature to
> signal(&self, res). I will rebase on top of it once it lands and add
> the section to its callers then.
>
> A follow-up series adds a workqueue whose work items run in a
> signalling section. Tyr will use both.
>
> This is based on drm-rust-next.
>
> [1] https://lore.kernel.org/r/20261124122951.878199-2-phasta@kernel.org
>
> ---
> Daniel Almeida (2):
> rust: dma_buf: dma_fence: add SignallingSection
> rust: dma_buf: dma_fence: require a SignallingSection in signal()
>
> rust/kernel/dma_buf/dma_fence.rs | 77 ++++++++++++++++++++++++++++++++++++++--
> rust/kernel/dma_buf/mod.rs | 3 +-
> 2 files changed, 76 insertions(+), 4 deletions(-)
> ---
> base-commit: abfb640b2374e26de8ff81d488c39d8254db538e
> change-id: 20261127-dma-fence-signalling-cae3def9aa97
>
> Best regards,
> --
> Daniel Almeida <daniel.almeida(a)collabora.com>
On 11/26/26 23:29, Dave Airlie wrote:
> On Thu, 26 Nov 2026 at 03:26, Christian König <christian.koenig(a)amd.com> wrote:
...
>>> The core then negotiates compatible types and adds converters between them,
>>
>> I have strong objections to that plan and would potentially NAK it.
>>
>> DMA-buf should *NEVER* accept CPU physical addresses nor provide conversion between different address types.
>>
>> Keep in mind that DMA-buf is solely a container for DMA addresses, nothing else and it should not provide any mapping functionality whatsoever.
>
> Is that because it's called dma-buf, if we just called it's shared-buf
> would that alleviate things? I just feel like there are use-cases
> where it containing CPU physical addresses might be what is optimal
> for a certain scenario, and re-creating a whole parallel
> infrastructure that ends up being 'I-can't-believe-it's-not-dma-buf'
> would end up being bad.
Well the problem is not so much transmitting CPU physical addresses between exporter and importer, but rather what the importer and DMA-buf layer should or should not be doing with them.
One of the few things which the DMA-buf design got right from the beginning is to avoid to much middle layering.
In other words the exporter is in control what is done with it's buffers and what isn't, so for example errors which come up while creating the mapping can be handled gracefully by the exporter. The map_attachment() callback either returns a fully populated mapping or an error code, nothing in between.
If we somehow prevent the CPU physical address from being casted to a struct page and/or used with vmf_insert_pfn/page/dma_map_page etc.. then there is not much of a problem with passing around physical addresses.
And if two drivers really need the system memory semantics with fine grained page faults, struct page refcounting etc... we still have memfd for that.
> If we need to shared object backings and have clearly typed and
> negotiated on what the backing contains then we should allow it.
> However I mostly agree on the mapping thing, I'd want drivers to
> negotiate and natively support whatever backings they can rather than
> having an intermediate trying to handle the conversions Not saying the
> code doing the conversions can't be a helper, bit it shouldn't ever be
> autoamtic or outside driver control.
Yes, exactly that's my concern as well. We need to avoid this middle layer trap.
Christian.
>
> Dave.