From: Sumit Garg <sumit.garg@kernel.org>
To: Vincent Donnefort <vdonnefort@google.com>
Cc: Sumit Garg <sumit.garg@kernel.org>, Will Deacon <will@kernel.org>,
brendan.jackman@linux.dev, catalin.marinas@arm.com,
rppt@kernel.org, akpm@linux-foundation.org,
sudeep.holla@kernel.org, jenswi@kernel.org, robh@kernel.org,
mark.rutland@arm.com, ardb@kernel.org, thierry.reding@kernel.org,
david@kernel.org, danielmentz@google.com,
linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org,
op-tee@lists.trustedfirmware.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 0/8] arm64: Unmap FF-A lent memory from direct map
Date: Mon, 9 Nov 2026 11:52:33 +0530 [thread overview]
Message-ID: <avFmqak7gxqCW3UB@sumit-xelite> (raw)
In-Reply-To: <au2vtZFyfUVWeils@google.com>
On Fri, 06 Nov 2026 at 10:45:09 +0000, Vincent Donnefort wrote:
>[...]
>
>> > > Yeah I saw that constraint too, let's leave it for future extension
>> > > then although having this reordering dependency fixed will be ideal.
>> > >
>> > > >
>> > > > So the only case it would work would be when a reserved memory has set
>> > > > "linux,cma-default".
>> > > >
>> > >
>> > > Let's rather just turn DT based default CMA pool to support PTE-level
>> > > mapping and keep it configurable via Kconfig or cmdline or DT.
>> >
>> > If we need a DT declaration anyway, a Kconfig and a cmdline option aren't really
>> > necessary.
>>
>> Agree, it rather makes sense for DT independent generic CMA pool.
>>
>> >
>> > Also, Rob wasn't very keen on having a DT option for the reserved memory and
>> > suggested to have a compatible string instead [1]. So perhaps we could have a
>> > a separate driver that handles the unmapping.
>> >
>> > linux,cma {
>> > compatible = "shared-dma-pool", "unmap-on-alloc";
>> > reusable;
>> > linux,cma-default;
>> > ...
>> > }
>> >
>> > That "unmap-on-alloc" driver sets the memblock flags and register some cma hooks
>> > (to be defined) for cma_alloc/cma_free where it unmaps/re-maps into the linear
>> > map.
>> >
>> > The nice property is optee won't need to be modified anymore. The downside is
>> > the entire pool is now mapped at PTE-level.
>>
>> Sounds reasonable to me. If folks are really worried about performance
>> with generic CMA PTE-level map then OP-TEE already supports no-map based
>> reserved carveouts for protected DMABufs too.
>>
>> -Sumit
>>
>> >
>> > [1] http://lore.kernel.org/all/20260902172436.GB1440252-robh@kernel.org/
>> >
>> > --
>> > Vincent
>
>I have just looked deeper into and cma_alloc can't unmap automatically the
>default pool. Callers expect a valid linear mapping right after the alocation.
>dma_direct_alloc() and dma_direct_alloc_pages() zero the allocated page,
>dma_direct_alloc_no_mapping() runs cache maintenance on it, and the userspace
>available heap /dev/dma_heap/linux,cma zeroes it.
>
>Also, it isn't possible to use two compatible strings for the reserved memory.
>The registration stops at the first matching compatible string. Layering drivers
>won't work either.
>
>So while the pool can still be generic and serve as linux,cma-default:
>
> linux,cma {
> compatible = "unmappable-dma-pool";
> reusable;
> linux,cma-default;
> }
>
>We can't escape providing an additional API to unmap/remap in the linear map.
>
Yeah it's fine to invoke these additional APIs post the CMA allocation
for protected DMA buffers.
-Sumit
prev parent reply other threads:[~2026-11-09 6:22 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-21 11:00 Vincent Donnefort
2026-09-21 11:00 ` [PATCH v2 1/8] memblock: Introduce MEMBLOCK_PTEMAP Vincent Donnefort
2026-10-28 17:08 ` Mike Rapoport
2026-09-21 11:00 ` [PATCH v2 2/8] arm64: Introduce can_set_direct_map_range() Vincent Donnefort
2026-09-21 11:00 ` [PATCH v2 3/8] arm64: Introduce __set_direct_map*() Vincent Donnefort
2026-09-21 11:00 ` [PATCH v2 4/8] arm64: Add support for MEMBLOCK_PTEMAP Vincent Donnefort
2026-09-21 11:00 ` [PATCH v2 5/8] firmware: arm_ffa: Introduce ffa-lend-pool Vincent Donnefort
2026-09-21 11:00 ` [PATCH v2 6/8] optee: Add support for arm,ffa-lend-pool Vincent Donnefort
2026-09-21 11:00 ` [PATCH v2 7/8] dt-bindings: reserved-memory: Add Arm FF-A lend pool Vincent Donnefort
2026-09-21 15:20 ` Rob Herring (Arm)
2026-09-21 11:00 ` [PATCH v2 8/8] dt-bindings: firmware: optee: Add memory-region property Vincent Donnefort
2026-09-22 5:57 ` [PATCH v2 0/8] arm64: Unmap FF-A lent memory from direct map Sumit Garg
2026-09-22 10:57 ` Thierry Reding
2026-09-22 14:55 ` Will Deacon
2026-09-26 12:13 ` Sumit Garg
2026-09-29 11:33 ` Will Deacon
2026-10-01 12:34 ` Sumit Garg
2026-10-05 10:48 ` Vincent Donnefort
2026-10-05 11:02 ` Vincent Donnefort
2026-10-12 13:16 ` Sumit Garg
2026-10-13 9:37 ` Vincent Donnefort
2026-10-13 9:56 ` Sumit Garg
2026-10-28 14:50 ` Vincent Donnefort
2026-10-30 6:30 ` Sumit Garg
2026-11-06 10:45 ` Vincent Donnefort
2026-11-09 6:22 ` Sumit Garg [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=avFmqak7gxqCW3UB@sumit-xelite \
--to=sumit.garg@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=ardb@kernel.org \
--cc=brendan.jackman@linux.dev \
--cc=catalin.marinas@arm.com \
--cc=danielmentz@google.com \
--cc=david@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jenswi@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mark.rutland@arm.com \
--cc=op-tee@lists.trustedfirmware.org \
--cc=robh@kernel.org \
--cc=rppt@kernel.org \
--cc=sudeep.holla@kernel.org \
--cc=thierry.reding@kernel.org \
--cc=vdonnefort@google.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®