[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260126160036.2b2c66a7@fedora>
Date: Mon, 26 Jan 2026 16:00:36 +0100
From: Boris Brezillon <boris.brezillon@...labora.com>
To: Alice Ryhl <aliceryhl@...gle.com>
Cc: Danilo Krummrich <dakr@...nel.org>, Daniel Almeida
<daniel.almeida@...labora.com>, Janne Grunau <j@...nau.net>, Matthew Brost
<matthew.brost@...el.com>, "Thomas Hellström"
<thomas.hellstrom@...ux.intel.com>, Lyude Paul <lyude@...hat.com>, Asahi
Lina <lina+kernel@...hilina.net>, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org
Subject: Re: [PATCH v3 3/6] rust: gpuvm: add GpuVm::obtain()
On Wed, 21 Jan 2026 11:31:19 +0000
Alice Ryhl <aliceryhl@...gle.com> wrote:
> +/// A [`GpuVmBo`] object in the GEM list.
> +///
> +/// # Invariants
> +///
> +/// Points at a `drm_gpuvm_bo` that contains a valid `T::VmBoData` and is present in the gem list.
> +pub struct GpuVmBoResident<T: DriverGpuVm>(NonNull<GpuVmBo<T>>);
I find the name a bit confusing: BO residency is often used to refer to
memory backing the buffer object, and in this case, you can end up with
a GpuVmBoResident being returned for a BO that has been evicted (one
that's no longer resident).
> +
> +impl<T: DriverGpuVm> GpuVmBoResident<T> {
> + /// Returns a raw pointer to underlying C value.
> + #[inline]
> + pub fn as_raw(&self) -> *mut bindings::drm_gpuvm_bo {
> + // SAFETY: The pointer references a valid `drm_gpuvm_bo`.
> + unsafe { (*self.0.as_ptr()).inner.get() }
> + }
> +}
Powered by blists - more mailing lists