From: John Hubbard Date: Sat, 11 Apr 2026 02:49:26 +0000 (-0700) Subject: gpu: nova-core: factor .fwsignature* selection into a new find_gsp_sigs_section() X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=777123bf2be607701b397f07198370700d2bfbdd;p=thirdparty%2Fkernel%2Flinux.git 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 Reviewed-by: Gary Guo Acked-by: Danilo Krummrich Link: https://patch.msgid.link/20260411024953.473149-2-jhubbard@nvidia.com [acourbot: fix minor conflict.] Signed-off-by: Alexandre Courbot --- diff --git a/drivers/gpu/nova-core/firmware/gsp.rs b/drivers/gpu/nova-core/firmware/gsp.rs index c423191b21f01..71b238b763499 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)