diff options
| author | John Hubbard <jhubbard@nvidia.com> | 2026-04-10 19:49:26 -0700 |
|---|---|---|
| committer | Alexandre Courbot <acourbot@nvidia.com> | 2026-04-30 10:02:55 +0900 |
| commit | 777123bf2be607701b397f07198370700d2bfbdd (patch) | |
| tree | b3941a921fb0af48f16221aaaa9628271053a99e | |
| parent | 013ff3b4d0222f6154226b6b2b0a8c9af0e3ebc9 (diff) | |
gpu: nova-core: factor .fwsignature* selection into a new find_gsp_sigs_section()
Keep Gsp::new() from getting too cluttered, by factoring out the
selection of .fwsignature* items. This will continue to grow as we add
GPUs.
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Acked-by: Danilo Krummrich <dakr@kernel.org>
Link: https://patch.msgid.link/20260411024953.473149-2-jhubbard@nvidia.com
[acourbot: fix minor conflict.]
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
| -rw-r--r-- | drivers/gpu/nova-core/firmware/gsp.rs | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/drivers/gpu/nova-core/firmware/gsp.rs b/drivers/gpu/nova-core/firmware/gsp.rs index c423191b21f0..71b238b76349 100644 --- a/drivers/gpu/nova-core/firmware/gsp.rs +++ b/drivers/gpu/nova-core/firmware/gsp.rs @@ -63,6 +63,18 @@ pub(crate) struct GspFirmware { } impl GspFirmware { + fn find_gsp_sigs_section(chipset: Chipset) -> &'static str { + match chipset.arch() { + Architecture::Turing if matches!(chipset, Chipset::TU116 | Chipset::TU117) => { + ".fwsignature_tu11x" + } + Architecture::Turing => ".fwsignature_tu10x", + Architecture::Ampere if chipset == Chipset::GA100 => ".fwsignature_ga100", + Architecture::Ampere => ".fwsignature_ga10x", + Architecture::Ada => ".fwsignature_ad10x", + } + } + /// Loads the GSP firmware binaries, map them into `dev`'s address-space, and creates the page /// tables expected by the GSP bootloader to load it. pub(crate) fn new<'a>( @@ -131,17 +143,7 @@ impl GspFirmware { }, size, signatures: { - let sigs_section = match chipset.arch() { - Architecture::Turing - if matches!(chipset, Chipset::TU116 | Chipset::TU117) => - { - ".fwsignature_tu11x" - } - Architecture::Turing => ".fwsignature_tu10x", - Architecture::Ampere if chipset == Chipset::GA100 => ".fwsignature_ga100", - Architecture::Ampere => ".fwsignature_ga10x", - Architecture::Ada => ".fwsignature_ad10x", - }; + let sigs_section = Self::find_gsp_sigs_section(chipset); elf::elf64_section(firmware.data(), sigs_section) .ok_or(EINVAL) |
