[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c9e8fb6d-38ea-473e-9421-d09140a4c142@nvidia.com>
Date: Wed, 22 Oct 2025 16:43:32 -0400
From: Joel Fernandes <joelagnelf@...dia.com>
To: John Hubbard <jhubbard@...dia.com>, linux-kernel@...r.kernel.org,
rust-for-linux@...r.kernel.org, dri-devel@...ts.freedesktop.org,
dakr@...nel.org, acourbot@...dia.com
Cc: Alistair Popple <apopple@...dia.com>, Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>, Boqun Feng <boqun.feng@...il.com>,
Gary Guo <gary@...yguo.net>, bjorn3_gh@...tonmail.com,
Benno Lossin <lossin@...nel.org>, Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>,
David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>,
Timur Tabi <ttabi@...dia.com>, joel@...lfernandes.org,
Elle Rhumsaa <elle@...thered-steel.dev>,
Daniel Almeida <daniel.almeida@...labora.com>, nouveau@...ts.freedesktop.org
Subject: Re: [PATCH 6/7] nova-core: mm: Add support to use PRAMIN windows to
write to VRAM
Hi,
On 10/22/2025 1:48 PM, Joel Fernandes wrote:
>>> + /// * `fb_offset` - Starting byte offset in VRAM (framebuffer) where access begins.
>>> + /// Must be aligned to `T::alignment()`.
>>> + /// * `num_items` - Number of items of type `T` to process.
>>> + /// * `operation` - Closure called for each item to perform the actual read/write.
>>> + /// Takes two parameters:
>>> + /// - `data_idx`: Index of the item in the data array (0..num_items)
>>> + /// - `pramin_offset`: BAR0 offset in the PRAMIN aperture to access
>>> + ///
>>> + /// The function automatically handles PRAMIN window repositioning when accessing
>>> + /// data that spans multiple 1MB windows.
>>> + fn access_vram<T: PraminNum, F>(
>>> + &self,
>>> + fb_offset: usize,
>>> + num_items: usize,
>>> + mut operation: F,
>>> + ) -> Result
>> This is far too much functionality, and the code can be made much smaller
>> and simpler.
>> and still get what we need. Open RM only supplies small accessors
>> (8 thru 64 bits wide), and no "bulk access". The calling code can loop if
>> necessary.
>> The code uses a sliding window approach to reposition the moving window,
> abstracting away the details of the moving window from the caller.
For completeness: I chatted with John and wanted to update the thread. The main
"benefit" from this extra complexity is if we write > 1MB at a time (automatic
sliding of window). However, in all frankness I *currently* don't have such a
use case - all writes are within 1MB. Just to be clear though I do feel we will
need this though if we use PRAMIN as the primary way to access "instance memory"
instead of BAR2 since instance memory is much larger than the window.
So for next version of this patch, I will keep it simple (KISS principal). We
can add in the abstracted moving-window for >1MB writes when we need it as this
patch on the list and is not going anywhere. Also I think since we're exposing
the details of the window size to the caller, we could come up with compile-time
checks to make sure they're within bounds, so I'll proceed accordingly.
Thanks!
- Joel
Powered by blists - more mailing lists