[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aAqccVvLIEZw-zrU@pollux>
Date: Thu, 24 Apr 2025 22:17:53 +0200
From: Danilo Krummrich <dakr@...nel.org>
To: Joel Fernandes <joelagnelf@...dia.com>
Cc: Alexandre Courbot <acourbot@...dia.com>,
Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>,
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>,
Jonathan Corbet <corbet@....net>,
John Hubbard <jhubbard@...dia.com>, Ben Skeggs <bskeggs@...dia.com>,
Timur Tabi <ttabi@...dia.com>, Alistair Popple <apopple@...dia.com>,
linux-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org,
nouveau@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org
Subject: Re: [PATCH 13/16] gpu: nova-core: Add support for VBIOS ucode
extraction for boot
On Thu, Apr 24, 2025 at 03:54:48PM -0400, Joel Fernandes wrote:
> On Wed, Apr 23, 2025 at 05:02:58PM +0200, Danilo Krummrich wrote:
> > On Wed, Apr 23, 2025 at 10:52:42AM -0400, Joel Fernandes wrote:
> > > Hello, Danilo,
> > > Thanks for all the feedback. Due to the volume of feedback, I will respond
> > > incrementally in multiple emails so we can discuss as we go - hope that's Ok but
> > > let me know if that is annoying.
> >
> > That's perfectly fine, whatever works best for you. :)
> >
> > > On 4/23/2025 10:06 AM, Danilo Krummrich wrote:
> > >
> > > >> +impl Vbios {
> > > >> + /// Read bytes from the ROM at the current end of the data vector
> > > >> + fn read_more(bar0: &Devres<Bar0>, data: &mut KVec<u8>, len: usize) -> Result {
> > > >> + let current_len = data.len();
> > > >> + let start = ROM_OFFSET + current_len;
> > > >> +
> > > >> + // Ensure length is a multiple of 4 for 32-bit reads
> > > >> + if len % core::mem::size_of::<u32>() != 0 {
> > > >> + pr_err!("VBIOS read length {} is not a multiple of 4\n", len);
> > > >
> > > > Please don't use any of the pr_*() print macros within a driver, use the dev_*()
> > > > ones instead.
> > >
> > > Ok I'll switch to this. One slight complication is I've to retrieve the 'dev'
> > > from the Bar0 and pass that along, but that should be doable.
> >
> > You can also pass the pci::Device reference to VBios::probe() directly.
>
>
> This turns out to be rather difficult to do in the whole vbios.rs because
> we'd have to them propogate pdev to various class methods which may print
> errors
Note that you can always create an ARef<pci::Device> instance from a
&pci::Device, which you can store temporarily if needed. Though I don't think
it's needed here.
> (some of which don't make sense to pass pdev to, like try_from()).
Yeah, it's indeed difficult with a TryFrom or From impl. I guess you're
referring to things like
impl TryFrom<&[u8]> for PcirStruct
and I actually think that's a bit of an abuse of the TryFrom trait. A &[u8]
isn't really something that is "natural" to convert to a PcirStruct.
Instead you should just move this code into a normal constructor, i.e.
PcirStruct::new(). Here you can then also pass a device reference to print
errors.
We should really stick to dev_*() print macros from within driver code.
Powered by blists - more mailing lists