gpu: nova-core: use GPU Architecture to simplify HAL selections

Replace per-chipset match arms with Architecture-based matching in the
falcon and FB HAL selection functions. This reduces the number of match
arms that need updating when new chipsets are added within an existing
architecture.

Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Acked-by: Danilo Krummrich <dakr@kernel.org>
Reviewed-by: Gary Guo <gary@garyguo.net>
Link: https://patch.msgid.link/20260411024953.473149-3-jhubbard@nvidia.com
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
This commit is contained in:
John Hubbard 2026-04-10 19:49:27 -07:00 committed by Alexandre Courbot
parent 777123bf2b
commit b3bdb42619
2 changed files with 20 additions and 16 deletions

View File

@ -9,7 +9,10 @@
FalconBromParams,
FalconEngine, //
},
gpu::Chipset,
gpu::{
Architecture,
Chipset, //
},
};
mod ga102;
@ -74,14 +77,15 @@ fn signature_reg_fuse_version(
pub(super) fn falcon_hal<E: FalconEngine + 'static>(
chipset: Chipset,
) -> Result<KBox<dyn FalconHal<E>>> {
use Chipset::*;
let hal = match chipset {
GA100 | // GA100 boots like Turing so use Turing HAL
TU102 | TU104 | TU106 | TU116 | TU117 => {
let hal = match chipset.arch() {
Architecture::Turing => {
KBox::new(tu102::Tu102::<E>::new(), GFP_KERNEL)? as KBox<dyn FalconHal<E>>
}
GA102 | GA103 | GA104 | GA106 | GA107 | AD102 | AD103 | AD104 | AD106 | AD107 => {
// GA100 boots like Turing so use Turing HAL
Architecture::Ampere if chipset == Chipset::GA100 => {
KBox::new(tu102::Tu102::<E>::new(), GFP_KERNEL)? as KBox<dyn FalconHal<E>>
}
Architecture::Ampere | Architecture::Ada => {
KBox::new(ga102::Ga102::<E>::new(), GFP_KERNEL)? as KBox<dyn FalconHal<E>>
}
};

View File

@ -4,7 +4,10 @@
use crate::{
driver::Bar0,
gpu::Chipset, //
gpu::{
Architecture,
Chipset, //
},
};
mod ga100;
@ -32,13 +35,10 @@ pub(crate) trait FbHal {
/// Returns the HAL corresponding to `chipset`.
pub(super) fn fb_hal(chipset: Chipset) -> &'static dyn FbHal {
use Chipset::*;
match chipset {
TU102 | TU104 | TU106 | TU117 | TU116 => tu102::TU102_HAL,
GA100 => ga100::GA100_HAL,
GA102 | GA103 | GA104 | GA106 | GA107 | AD102 | AD103 | AD104 | AD106 | AD107 => {
ga102::GA102_HAL
}
match chipset.arch() {
Architecture::Turing => tu102::TU102_HAL,
Architecture::Ampere if chipset == Chipset::GA100 => ga100::GA100_HAL,
Architecture::Ampere => ga102::GA102_HAL,
Architecture::Ada => ga102::GA102_HAL,
}
}