From: "Alexandre Courbot" <acourbot@nvidia.com>
To: "Alistair Popple" <apopple@nvidia.com>
Cc: "Eliot Courtney" <ecourtney@nvidia.com>,
"Yury Norov" <yury.norov@gmail.com>,
"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>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"Daniel Almeida" <daniel.almeida@collabora.com>,
"Tamir Duberstein" <tamird@kernel.org>,
"Onur Özkan" <work@onurozkan.dev>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"Jonathan Corbet" <corbet@lwn.net>,
"Shuah Khan" <skhan@linuxfoundation.org>,
"John Hubbard" <jhubbard@nvidia.com>,
"Timur Tabi" <ttabi@nvidia.com>,
rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
nova-gpu@lists.linux.dev, dri-devel@lists.freedesktop.org,
linux-doc@vger.kernel.org,
"Joel Fernandes" <joelagnelf@nvidia.com>
Subject: Re: [PATCH v2 08/12] gpu: nova-core: mm: Add support to use PRAMIN windows to write to VRAM
Date: Thu, 20 Aug 2026 09:34:52 +0900 [thread overview]
Message-ID: <DKTCLGI8RHLG.17R4H0FFO4N6A@nvidia.com> (raw)
In-Reply-To: <aoY1pT_TC1VSKMzQ@nvdebian.thelocal>
On Thu Aug 20, 2026 at 8:05 AM JST, Alistair Popple wrote:
> On 2026-08-10 at 23:55 +1000, Eliot Courtney <ecourtney@nvidia.com> wrote...
>> From: Joel Fernandes <joelagnelf@nvidia.com>
>>
>> PRAMIN apertures are a crucial mechanism for direct CPU read/write to
>> VRAM. Add a `Pramin` manager whose `window_at()` returns a typed MMIO
>> view of VRAM through the 1 MiB PRAMIN aperture in BAR0, validating the
>> view against the VRAM region and repositioning the window as needed for
>> the accessed address.
>>
>> A view borrows `Pramin` mutably, so the window cannot move while
>> the view is in use, and it inserts an ordering point on Drop.
>>
>> Signed-off-by: Joel Fernandes <joelagnelf@nvidia.com>
>> [ecourtney: split the registers and HAL into the two preceding patches]
>> [ecourtney: rebase w.r.t. Bar0 lifetime changes and register projections]
>> [ecourtney: drop the window guard and mutex, use &mut self]
>> [ecourtney: position at init to avoid reads, reposition in window_offset]
>> [ecourtney: return typed MMIO views instead of read/write accessors]
>> [ecourtney: insert an ordering read when a view drops]
>> [ecourtney: declare the window location, drop the doc examples]
>> [ecourtney: add the copyright header, doc and naming cleanups]
>> [ecourtney: the pramin module is mm-internal]
>> Co-developed-by: Eliot Courtney <ecourtney@nvidia.com>
>> Signed-off-by: Eliot Courtney <ecourtney@nvidia.com>
>> ---
>> drivers/gpu/nova-core/mm.rs | 1 +
>> drivers/gpu/nova-core/mm/pramin.rs | 178 +++++++++++++++++++++++++++++++++++++
>> 2 files changed, 179 insertions(+)
>>
>> diff --git a/drivers/gpu/nova-core/mm.rs b/drivers/gpu/nova-core/mm.rs
>> index 07dce4ce2473..ef5b1cad56c3 100644
>> --- a/drivers/gpu/nova-core/mm.rs
>> +++ b/drivers/gpu/nova-core/mm.rs
>> @@ -20,6 +20,7 @@
>> };
>>
>> mod hal;
>> +mod pramin;
>> mod regs;
>>
>> /// Physical VRAM address in GPU video memory.
>> diff --git a/drivers/gpu/nova-core/mm/pramin.rs b/drivers/gpu/nova-core/mm/pramin.rs
>> new file mode 100644
>> index 000000000000..20be3fc471ba
>> --- /dev/null
>> +++ b/drivers/gpu/nova-core/mm/pramin.rs
>> @@ -0,0 +1,178 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
>> +
>> +//! Utilities for accessing VRAM through the PRAMIN window.
>> +
>> +use core::ops::Range;
>> +
>> +use kernel::{
>> + io::{
>> + io_project,
>> + register,
>> + register::OffsetLoc,
>> + Io,
>> + Mmio, //
>> + },
>> + prelude::*,
>> + ptr::{
>> + Alignable,
>> + Alignment, //
>> + },
>> + sizes::{
>> + SZ_1M,
>> + SZ_64K, //
>> + },
>> +};
>> +
>> +use crate::{
>> + driver::{
>> + Bar0,
>> + NovaRegisters, //
>> + },
>> + gpu::Chipset,
>> + mm::{
>> + hal::{
>> + self,
>> + MmHal, //
>> + },
>> + VramAddress, //
>> + },
>> + num::IntoSafeCast, //
>> +};
>> +
>> +/// Size of the PRAMIN window (1 MiB).
>> +const WINDOW_SIZE: usize = SZ_1M;
>> +
>> +/// The PRAMIN window, which is a 1 MiB window into VRAM at a fixed BAR0 offset.
>> +#[derive(FromBytes, IntoBytes)]
>> +struct PraminWindow([u8; WINDOW_SIZE]);
>> +
>> +register! {
>> + base: NovaRegisters;
>
> I tried building this on drm-rust-next against the base commit
> (4c9ba407018e8deb06dbc643112bac8f40404f95) but am getting some build errors:
I think you also need [1] (the v3 might also work, but not tested yet).
[1] https://patch.msgid.link/20260805-typed_register-v2-0-c3ca142220a0@garyguo.net
next prev parent reply other threads:[~2026-08-20 0:35 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-10 13:55 [PATCH v2 00/12] gpu: nova-core: add PRAMIN window support Eliot Courtney
2026-08-10 13:55 ` [PATCH v2 01/12] rust: num: use const_assert! in Bounded Eliot Courtney
2026-08-10 14:07 ` sashiko-bot
2026-08-10 14:23 ` Gary Guo
2026-08-10 22:24 ` Danilo Krummrich
2026-08-21 13:53 ` Alexandre Courbot
2026-08-21 14:01 ` Alexandre Courbot
2026-08-10 13:55 ` [PATCH v2 02/12] rust: num: reject Bounded::shr overshifts at build time Eliot Courtney
2026-08-10 14:23 ` Gary Guo
2026-08-10 22:25 ` Danilo Krummrich
2026-08-10 13:55 ` [PATCH v2 03/12] rust: num: add Bounded::shr_exact Eliot Courtney
2026-08-10 22:25 ` Danilo Krummrich
2026-08-10 13:55 ` [PATCH v2 04/12] gpu: nova-core: mm: Add VramAddress type Eliot Courtney
2026-08-10 22:24 ` Danilo Krummrich
2026-08-17 6:00 ` Alistair Popple
2026-08-17 8:20 ` Eliot Courtney
2026-08-17 11:41 ` Alistair Popple
2026-08-10 13:55 ` [PATCH v2 05/12] gpu: nova-core: mm: Implement Alignable and Debug for VramAddress Eliot Courtney
2026-08-10 13:55 ` [PATCH v2 06/12] gpu: nova-core: mm: Add PRAMIN window registers Eliot Courtney
2026-08-10 13:55 ` [PATCH v2 07/12] gpu: nova-core: mm: Add the memory management HAL Eliot Courtney
2026-08-10 13:55 ` [PATCH v2 08/12] gpu: nova-core: mm: Add support to use PRAMIN windows to write to VRAM Eliot Courtney
2026-08-19 23:05 ` Alistair Popple
2026-08-20 0:34 ` Alexandre Courbot [this message]
2026-08-10 13:55 ` [PATCH v2 09/12] docs: gpu: nova-core: Document the PRAMIN aperture mechanism Eliot Courtney
2026-08-10 13:55 ` [PATCH v2 10/12] gpu: nova-core: mm: Add GpuMm centralized memory manager Eliot Courtney
2026-08-10 14:09 ` sashiko-bot
2026-08-10 13:55 ` [PATCH v2 11/12] gpu: nova-core: Add self-test assertion macros and config option Eliot Courtney
2026-08-10 14:09 ` sashiko-bot
2026-08-10 13:55 ` [PATCH v2 12/12] gpu: nova-core: mm: Add PRAMIN aperture self-tests Eliot Courtney
2026-08-10 14:16 ` sashiko-bot
2026-08-10 22:26 ` [PATCH v2 00/12] gpu: nova-core: add PRAMIN window support Danilo Krummrich
2026-08-11 12:31 ` Miguel Ojeda
2026-08-11 12:31 ` Miguel Ojeda
2026-08-12 4:54 ` Alexandre Courbot
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=DKTCLGI8RHLG.17R4H0FFO4N6A@nvidia.com \
--to=acourbot@nvidia.com \
--cc=a.hindborg@kernel.org \
--cc=airlied@gmail.com \
--cc=aliceryhl@google.com \
--cc=apopple@nvidia.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=corbet@lwn.net \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=ecourtney@nvidia.com \
--cc=gary@garyguo.net \
--cc=jhubbard@nvidia.com \
--cc=joelagnelf@nvidia.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=nova-gpu@lists.linux.dev \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=simona@ffwll.ch \
--cc=skhan@linuxfoundation.org \
--cc=tamird@kernel.org \
--cc=tmgross@umich.edu \
--cc=ttabi@nvidia.com \
--cc=tzimmermann@suse.de \
--cc=work@onurozkan.dev \
--cc=yury.norov@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.