NVIDIA GPU driver infrastructure
 help / color / mirror / Atom feed
From: "Danilo Krummrich" <dakr@kernel.org>
To: "Robin Murphy" <robin.murphy@arm.com>
Cc: "Alexandre Courbot" <acourbot@nvidia.com>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Abdiel Janulgue" <abdiel.janulgue@gmail.com>,
	"Daniel Almeida" <daniel.almeida@collabora.com>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Tamir Duberstein" <tamird@kernel.org>,
	"Onur Özkan" <work@onurozkan.dev>,
	"John Hubbard" <jhubbard@nvidia.com>,
	"Alistair Popple" <apopple@nvidia.com>,
	"Timur Tabi" <ttabi@nvidia.com>,
	"Eliot Courtney" <ecourtney@nvidia.com>,
	"Zhi Wang" <zhiw@nvidia.com>,
	nova-gpu@lists.linux.dev, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, driver-core@lists.linux.dev,
	rust-for-linux@vger.kernel.org
Subject: Re: [PATCH v2 2/3] rust: dma: rename dma_handle to dma_address
Date: Wed, 05 Aug 2026 22:39:50 +0200	[thread overview]
Message-ID: <DKHATVF1WAE7.NGVXJQD12XQ@kernel.org> (raw)
In-Reply-To: <3a87960b-8a20-4947-a8b5-d5197174317c@arm.com>

On Wed Aug 5, 2026 at 1:32 PM CEST, Robin Murphy wrote:
> To be fair, that is sort of the intent in the C API as well, to be clear 
> that DMA addresses must not simply be treated as physical addresses, and 
> aren't necessarily address-like in general e.g. comparing two 
> dma_handles is pretty meaningless, since they could have different 
> values but still refer to the same underlying memory, or vice-versa. 
> Adding or subtracting offsets within the bounds of the original 
> allocation/mapping size is pretty much the only arithmetic that _is_ valid.

Yes, I did suggest a dma::Range type [1] for this purpose, such that only this
kind arithmetic is possible to do.

The dma::Range type should have a method returning its embedded raw value which
then can be used to program registers etc.

This patch is only an intermediate step, that clarifies that intent of the
current usage of dma_handle() (or now dma_address()), which is not to serve as a
handle.

[1] https://github.com/Rust-for-Linux/linux/issues/1248

> However at the Rust level, the abstraction itself can convey (and even 
> enforce!) most of that, so for the sake of clarity here, particularly if 
> Rust programmers are likely to have their own expectations of what 
> "address" and "handle" mean, then I'm inclined to agree.

Yeah, as mentioned in the link below, the handle that represents the allocation
are the DMA container types (such as dma::Coherent) themselves.

>> Link: https://lore.kernel.org/all/DK75LUA4NLGI.3P29AIZQE20V2@kernel.org/

  reply	other threads:[~2026-08-05 20:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-05  5:01 [PATCH v2 0/3] gpu: nova-core: falcon: use I/O projections for DMA transfers Alexandre Courbot
2026-08-05  5:01 ` [PATCH v2 1/3] gpu: nova-core: falcon: remove unnecessary check Alexandre Courbot
2026-08-05  7:02   ` Ethan Plant
2026-08-05  5:01 ` [PATCH v2 2/3] rust: dma: rename dma_handle to dma_address Alexandre Courbot
2026-08-05 11:32   ` Robin Murphy
2026-08-05 20:39     ` Danilo Krummrich [this message]
2026-08-07 13:04       ` Gary Guo
2026-08-06 21:16   ` Danilo Krummrich
2026-08-05  5:01 ` [PATCH v2 3/3] gpu: nova-core: falcon: use I/O projection to check transfer bounds Alexandre Courbot
2026-08-06 21:25 ` [PATCH v2 0/3] gpu: nova-core: falcon: use I/O projections for DMA transfers Danilo Krummrich

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=DKHATVF1WAE7.NGVXJQD12XQ@kernel.org \
    --to=dakr@kernel.org \
    --cc=a.hindborg@kernel.org \
    --cc=abdiel.janulgue@gmail.com \
    --cc=acourbot@nvidia.com \
    --cc=airlied@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=apopple@nvidia.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=driver-core@lists.linux.dev \
    --cc=ecourtney@nvidia.com \
    --cc=gary@garyguo.net \
    --cc=jhubbard@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=nova-gpu@lists.linux.dev \
    --cc=ojeda@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tamird@kernel.org \
    --cc=tmgross@umich.edu \
    --cc=ttabi@nvidia.com \
    --cc=work@onurozkan.dev \
    --cc=zhiw@nvidia.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