From: Greg KH <gregkh@linuxfoundation.org>
To: Timur Tabi <timur@kernel.org>
Cc: "Alexandre Courbot" <acourbot@nvidia.com>,
"Danilo Krummrich" <dakr@kernel.org>,
"John Hubbard" <jhubbard@nvidia.com>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Alex Gaynor" <alex.gaynor@gmail.com>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <benno.lossin@proton.me>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org,
"Timur Tabi" <ttabi@nvidia.com>
Subject: Re: [PATCH] rust: add basic ELF sections parser
Date: Sat, 31 May 2025 14:25:11 +0200 [thread overview]
Message-ID: <2025053109-flatterer-error-7432@gregkh> (raw)
In-Reply-To: <CAOZdJXVSByiwGWusdajdTVma2aC3ibZtSz9XBpRy4MJrKuxfvw@mail.gmail.com>
On Sat, May 31, 2025 at 05:17:48AM -0500, Timur Tabi wrote:
> On Sat, May 31, 2025 at 12:45 AM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> > > IMHO, Nova should really do what Nouveau does, and just have the image
> > > parser in the driver itself, without any generic Rust code to do it.
> > > After all, what Nova needs to do with these images is driver-specific.
> >
> > Again, no, do not do any firmware image parsing in the kernel please
> > unless you can prove exactly why it MUST be done there.
>
> Nouveau is already doing all this, just in C. This entire argument is
> over a 12-line function:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c#n1824
>
> Nouveau needs to do this in kernel space because, once it finds the
> appropriate section in the ELF image, it reads a hardware register to
> determine how to patch it:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/nouveau/nvkm/falcon/gm200.c#n342
>
> Since this hardware register cannot be read in user-space, this needs
> to be done in the kernel.
What exactly do you mean by this? That is what I have been asking, what
is the specific reason why this can't be done in userspace? What
hardware "thing" can't be read by userspace, and why not? Userspace has
access to PCI devices directly, surely there is nothing "secret" here.
> Please note that there other drivers in Linux that iterate over ELF
> sections in order to parse their firmware images:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/imagination/pvr_fw_util.c#n29
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c#n925
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/remoteproc/qcom_q6v5_mss.c#n1374
As pointed out before, those have "slipped in" and should not be used to
justify continuing to do the same thing.
Again, just do it in userspace, if it's "just" 12 lines in the kernel,
then put those 12 lines in userspace and you are fine.
And the proposed patch was NOT 12 lines of rust, so please don't
conflate the two things here. That's not what we are talking about.
greg k-h
next prev parent reply other threads:[~2025-05-31 12:25 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-15 6:03 [PATCH] rust: add basic ELF sections parser Alexandre Courbot
2025-05-15 7:38 ` Greg KH
2025-05-15 8:32 ` Alexandre Courbot
2025-05-15 11:25 ` Alexandre Courbot
2025-05-15 11:42 ` Greg KH
2025-05-15 13:09 ` Alexandre Courbot
2025-05-15 14:30 ` Timur Tabi
2025-05-15 19:17 ` John Hubbard
2025-05-16 13:15 ` Greg KH
2025-05-16 13:26 ` Alexandre Courbot
2025-05-16 13:32 ` Greg KH
2025-05-16 13:35 ` Danilo Krummrich
2025-05-16 14:35 ` Alexandre Courbot
2025-05-16 16:01 ` Danilo Krummrich
2025-05-16 19:00 ` John Hubbard
2025-05-17 10:13 ` Danilo Krummrich
2025-05-17 13:41 ` Alexandre Courbot
2025-05-16 16:28 ` Timur Tabi
2025-05-17 0:51 ` Alexandre Courbot
2025-05-29 6:53 ` Alexandre Courbot
2025-05-29 8:01 ` Greg KH
2025-05-30 0:58 ` Alexandre Courbot
2025-05-30 6:21 ` Greg KH
2025-05-30 6:56 ` Alexandre Courbot
2025-05-30 9:00 ` Greg KH
2025-05-30 6:22 ` Greg KH
2025-05-30 6:59 ` Alexandre Courbot
2025-05-30 9:01 ` Greg KH
2025-05-30 14:34 ` Alexandre Courbot
2025-05-30 15:42 ` Greg KH
2025-05-30 18:10 ` Timur Tabi
2025-05-31 5:45 ` Greg KH
2025-05-31 10:17 ` Timur Tabi
2025-05-31 12:25 ` Greg KH [this message]
2025-05-31 14:38 ` Timur Tabi
2025-05-31 15:28 ` Danilo Krummrich
2025-06-01 7:48 ` Greg KH
2025-05-31 12:33 ` Alexandre Courbot
2025-05-31 13:30 ` Greg KH
2025-06-01 12:23 ` Alexandre Courbot
2025-06-13 3:32 ` Alexandre Courbot
2025-06-24 14:26 ` Greg KH
2025-06-24 14:51 ` 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=2025053109-flatterer-error-7432@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=benno.lossin@proton.me \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=dakr@kernel.org \
--cc=gary@garyguo.net \
--cc=jhubbard@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=timur@kernel.org \
--cc=tmgross@umich.edu \
--cc=ttabi@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;
as well as URLs for NNTP newsgroup(s).