Devicetree
 help / color / mirror / Atom feed
From: Maxime Ripard <mripard@kernel.org>
To: "Rob Herring" <robh@kernel.org>,
	"Saravana Kannan" <saravanak@google.com>,
	"Sumit Semwal" <sumit.semwal@linaro.org>,
	"Benjamin Gaignard" <benjamin.gaignard@collabora.com>,
	"Brian Starkey" <Brian.Starkey@arm.com>,
	"John Stultz" <jstultz@google.com>,
	"T.J. Mercier" <tjmercier@google.com>,
	"Christian König" <christian.koenig@amd.com>
Cc: Mattijs Korpershoek <mkorpershoek@kernel.org>,
	 devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-media@vger.kernel.org,  dri-devel@lists.freedesktop.org,
	linaro-mm-sig@lists.linaro.org
Subject: Re: [PATCH v3 0/2] dma-buf: heaps: Support carved-out heaps
Date: Fri, 25 Apr 2025 09:55:59 +0200	[thread overview]
Message-ID: <20250425-refined-nano-vole-efe21e@houat> (raw)
In-Reply-To: <20250407-dma-buf-ecc-heap-v3-0-97cdd36a5f29@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 2658 bytes --]

Hi,

On Mon, Apr 07, 2025 at 06:29:06PM +0200, Maxime Ripard wrote:
> Hi,
> 
> This series is the follow-up of the discussion that John and I had some
> time ago here:
> 
> https://lore.kernel.org/all/CANDhNCquJn6bH3KxKf65BWiTYLVqSd9892-xtFDHHqqyrroCMQ@mail.gmail.com/
> 
> The initial problem we were discussing was that I'm currently working on
> a platform which has a memory layout with ECC enabled. However, enabling
> the ECC has a number of drawbacks on that platform: lower performance,
> increased memory usage, etc. So for things like framebuffers, the
> trade-off isn't great and thus there's a memory region with ECC disabled
> to allocate from for such use cases.
> 
> After a suggestion from John, I chose to first start using heap
> allocations flags to allow for userspace to ask for a particular ECC
> setup. This is then backed by a new heap type that runs from reserved
> memory chunks flagged as such, and the existing DT properties to specify
> the ECC properties.
> 
> After further discussion, it was considered that flags were not the
> right solution, and relying on the names of the heaps would be enough to
> let userspace know the kind of buffer it deals with.
> 
> Thus, even though the uAPI part of it has been dropped in this second
> version, we still need a driver to create heaps out of carved-out memory
> regions. In addition to the original usecase, a similar driver can be
> found in BSPs from most vendors, so I believe it would be a useful
> addition to the kernel.
> 
> I submitted a draft PR to the DT schema for the bindings used in this
> PR:
> https://github.com/devicetree-org/dt-schema/pull/138

One thing the discussion about the CMA heap naming[1] with John made me
realize is that if we have both a region that is exported as a
carved-out heap, and with devices pointing to it with reserved-memory,
we wouldn't use the same allocator in both cases.

It looks like we have four cases:

  - We have a shared-dma-pool region with the reusable property: the
    region is registered as a CMA area, the devices will allocate from
    that.

  - We have a shared-dma-pool region without the reusable property: the
    region is registered as a coherent DMA area, and the devices will
    allocate from that pool.

  - We have a restricted-dma-pool region, devices will allocate from
    swiotlb

  - We have any other region, we can do whatever.

So, the driver only supports the fourth case, and should be
significantly more complicated.

I'll work on that.

Maxime

1: https://lore.kernel.org/dri-devel/20250422191939.555963-1-jkangas@redhat.com/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]

      parent reply	other threads:[~2025-04-25  7:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-07 16:29 [PATCH v3 0/2] dma-buf: heaps: Support carved-out heaps Maxime Ripard
2025-04-07 16:29 ` [PATCH v3 1/2] dma-buf: heaps: system: Remove global variable Maxime Ripard
2025-04-07 17:49   ` Christian König
2025-04-08  8:43   ` Mattijs Korpershoek
2025-04-07 16:29 ` [PATCH v3 2/2] dma-buf: heaps: Introduce a new heap for reserved memory Maxime Ripard
2025-04-10  7:42   ` Mattijs Korpershoek
2025-04-11 20:26   ` T.J. Mercier
2025-04-14 17:43     ` Andrew Davis
2025-04-25  7:33       ` Maxime Ripard
2025-04-25  7:55 ` Maxime Ripard [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=20250425-refined-nano-vole-efe21e@houat \
    --to=mripard@kernel.org \
    --cc=Brian.Starkey@arm.com \
    --cc=benjamin.gaignard@collabora.com \
    --cc=christian.koenig@amd.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jstultz@google.com \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mkorpershoek@kernel.org \
    --cc=robh@kernel.org \
    --cc=saravanak@google.com \
    --cc=sumit.semwal@linaro.org \
    --cc=tjmercier@google.com \
    /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