From: "Alexandre Courbot" <acourbot@nvidia.com>
To: "Greg KH" <gregkh@linuxfoundation.org>
Cc: "Danilo Krummrich" <dakr@kernel.org>,
"Timur Tabi" <timur@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
Subject: Re: [PATCH] rust: add basic ELF sections parser
Date: Thu, 29 May 2025 15:53:42 +0900 [thread overview]
Message-ID: <DA8G3G918FS4.X8D7PQMT4TGB@nvidia.com> (raw)
In-Reply-To: <D9Y0VJKOAQAY.2GJSAZ5II54VV@nvidia.com>
Hi Greg,
On Sat May 17, 2025 at 9:51 AM JST, Alexandre Courbot wrote:
> On Sat May 17, 2025 at 1:28 AM JST, Timur Tabi wrote:
>> On Fri, May 16, 2025 at 9:35 AM Alexandre Courbot <acourbot@nvidia.com> wrote:
>>>
>>> We use ELF as a container format to associate binary blobs with named
>>> sections. Can we extract these sections into individual files that we
>>> load using request_firmware()? Why yes, we could.
>>
>> Actually, I don't think we can. This is the actual GSP-RM ELF image
>> you're talking about. This comes packaged as one binary blob and it's
>> intended to be mostly opaque. We can't just disassemble the ELF
>> sections and then re-assemble them in the driver.
>>
>> Unfortunately, for pre-Hopper booting, we need to do a little
>> pre-processing on the image, referencing the ELF sections, and based
>> on data from fuses that cannot be read in user-space.
>
> I'd like to reinforce Timur's point a bit because it is crucial to
> understanding why we need an ELF parser here.
>
> On post-Hopper, the GSP ELF binary is passed as-is to the booter
> firmware and it is the latter that performs the blob extraction from the
> ELF sections. So for these chips no ELF parsing takes place in the
> kernel which actually acts as a dumb pipe.
>
> However, pre-Hopper does not work like that, and for these the same GSP
> image (coming from the same ELF file) needs to be extracted by the
> kernel and handed out to booter. It's for these that we need to do the
> light parsing introduced by this patch.
>
> So while I believe this provides a strong justification for having the
> parser, I also understand Greg's reluctance to make this available to
> everyone when nova-core is the only user in sight and the general
> guideline is to avoid processing in the kernel.
>
> OTOH, it is quite short and trivial, and if some drivers need a
> packaging format then it might as well be ELF. The imagination DRM
> driver for instance appears to load firmware parts from an ELF binary
> obtained using request_firmware (lookup `process_elf_command_stream`) -
> very similar to what we are doing here.
>
> `drivers/remoteproc` also has what appears to be a complete ELF parser
> and loader, which it uses on firmware obtained using `request_firmware`
> (check `remoteproc_elf_loader.c` and how the arguments to the functions
> defined there are `struct firmware *`). Admittedly, it's probably easier
> to justify here, but the core principle is the same and we are just
> doing a much simpler version of that.
>
> And there are likely more examples, so there might be a case for a
> shared ELF parser. For nova-core purposes, either way would work.
Gentle ping on this, as you can there are other drivers using ELF as a
container format for firmware. In light of this information, I guess
there is a point for having a common parser in the kernel. What do you
think?
next prev parent reply other threads:[~2025-05-29 6:53 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-15 6:03 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 [this message]
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
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=DA8G3G918FS4.X8D7PQMT4TGB@nvidia.com \
--to=acourbot@nvidia.com \
--cc=a.hindborg@kernel.org \
--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=gregkh@linuxfoundation.org \
--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 \
/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
all inboxes | Powered by JetHome®