diff --git a/installer-rs/crates/phoebus-core/src/nvidia.rs b/installer-rs/crates/phoebus-core/src/nvidia.rs index 2164f9b..d744279 100644 --- a/installer-rs/crates/phoebus-core/src/nvidia.rs +++ b/installer-rs/crates/phoebus-core/src/nvidia.rs @@ -13,18 +13,27 @@ //! //! Branch policy (NVIDIA/Gentoo, verified 2026-09): //! -//! * **Turing / Ampere / Ada / Hopper / Blackwell** use the current -//! `x11-drivers/nvidia-drivers` branch with NVIDIA's *open* kernel modules -//! (`USE=kernel-open`). The open modules support Turing (GTX 16xx / RTX 20xx) -//! and newer. They are mandatory from driver 595 and are required for -//! Blackwell (RTX 50xx). -//! * **Maxwell / Pascal / Volta** cannot use the open modules. They are pinned -//! to the newest proprietary branch below the open-mandatory cut (595) with -//! `USE=-kernel-open`, and `>=x11-drivers/nvidia-drivers-595` is masked. +//! * **Turing / Ampere / Ada / Hopper** use the current +//! `x11-drivers/nvidia-drivers` branch. NVIDIA's *open* kernel modules +//! (`USE=kernel-open`) support Turing (GTX 16xx / RTX 20xx) and newer and are +//! recommended there; they become mandatory from driver 595. +//! * **Blackwell (RTX 50xx)** requires the open kernel modules; the proprietary +//! kernel modules cannot drive it. +//! * **Maxwell / Pascal / Volta** cannot use the open modules and are served +//! only by the proprietary branch. NVIDIA's 580 series is the **last** branch +//! to support those architectures, so the install is capped below the next +//! series with `USE=-kernel-open` and +//! `>=x11-drivers/nvidia-drivers-581` masked. //! * **Fermi / Kepler and older** are not served by a security-supported //! proprietary branch; they fall back to the in-tree `nouveau` driver. This //! is reported, never silently substituted as NVIDIA success. //! +//! One driver install covers every adapter, so the branch is computed across +//! the whole device set. A Blackwell GPU (open-only) together with a +//! Maxwell/Pascal/Volta GPU (proprietary-only) has **no** single compatible +//! branch; the plan says so explicitly instead of installing a driver that +//! cannot accelerate one of the cards. +//! //! The Debian live medium ships a single signed branch (550.163.01 in Debian //! 13/testing). That branch's proprietary kernel modules cover Maxwell through //! Ada/Hopper; it does not support Blackwell, so Blackwell live boots fall back @@ -39,10 +48,18 @@ use crate::nvidia_devices; pub const GENTOO_ATOM: &str = "x11-drivers/nvidia-drivers"; /// The first NVIDIA driver series that makes the open kernel modules mandatory -/// (`USE=kernel-open` can no longer be disabled). Maxwell/Pascal/Volta are -/// pinned below this cut. +/// (`USE=kernel-open` can no longer be disabled). Informational: the +/// Maxwell/Pascal/Volta cap is the earlier legacy cut below, not this one. pub const OPEN_MANDATORY_SERIES: u32 = 595; +/// The last NVIDIA driver series that supports Maxwell, Pascal and Volta. +/// +/// NVIDIA confirmed the 580 series is the final branch with full feature +/// support for those architectures +/// (). The next +/// series is masked so Portage cannot install a branch that drops the GPU. +pub const LEGACY_PROPRIETARY_LAST_SERIES: u32 = 580; + /// The NVIDIA branch bundled on the Debian live medium. It is a property of /// the signed Debian archive, not of the detected GPU. pub const LIVE_DEBIAN_BRANCH: &str = "550.163.01"; @@ -274,13 +291,54 @@ impl NvidiaPlan { }; } - // The branch must serve the oldest supported adapter present, because - // one driver install covers every card. Maxwell/Pascal/Volta force the - // proprietary branch; otherwise the open modules are used. - let needs_proprietary = supported - .iter() - .any(|d| d.support() == NvidiaSupport::Proprietary); - let flavor = if needs_proprietary { + // One driver install covers every adapter, so compute compatibility + // across the whole set rather than assuming the oldest card's branch + // serves the newer ones. + let requires_open = supported.iter().any(|d| { + d.generation + .map(|g| g.requires_open_modules()) + .unwrap_or(false) + }); + let requires_proprietary = supported.iter().any(|d| { + d.generation + .map(|g| g.requires_proprietary_modules()) + .unwrap_or(false) + }); + if requires_open && requires_proprietary { + // A Blackwell-class GPU needs the open kernel modules; a + // Maxwell/Pascal/Volta GPU needs the proprietary modules. No + // single branch serves both, so do not install a driver that can + // only accelerate one of them. + let open_only: Vec = supported + .iter() + .filter(|d| d.generation.map(|g| g.requires_open_modules()).unwrap_or(false)) + .map(|d| format!("{} ({})", d.pci_id, d.generation.map(|g| g.as_str()).unwrap_or("unknown"))) + .collect(); + let prop_only: Vec = supported + .iter() + .filter(|d| { + d.generation + .map(|g| g.requires_proprietary_modules()) + .unwrap_or(false) + }) + .map(|d| format!("{} ({})", d.pci_id, d.generation.map(|g| g.as_str()).unwrap_or("unknown"))) + .collect(); + return Self { + devices, + supported: false, + generation: None, + flavor: None, + branch: "nouveau".into(), + reason: format!( + "no single NVIDIA branch serves both {} (open kernel modules only) and \ + {} (proprietary only); leaving all NVIDIA adapters on the in-tree nouveau \ + fallback instead of shipping a driver that cannot accelerate one of them", + open_only.join(", "), + prop_only.join(", ") + ), + }; + } + let flavor = if requires_proprietary { NvidiaModuleFlavor::Proprietary } else { NvidiaModuleFlavor::Open @@ -326,10 +384,12 @@ impl NvidiaPlan { flavor: Some(flavor), branch: match flavor { NvidiaModuleFlavor::Open => { - format!("current open kernel modules (>= {OPEN_MANDATORY_SERIES})") + format!("current open kernel modules (mandatory from {OPEN_MANDATORY_SERIES})") } NvidiaModuleFlavor::Proprietary => { - format!("proprietary (for Maxwell/Pascal/Volta; capped below {OPEN_MANDATORY_SERIES})") + format!( + "proprietary (Maxwell/Pascal/Volta; capped at the last supporting series {LEGACY_PROPRIETARY_LAST_SERIES})" + ) } }, reason, @@ -359,12 +419,16 @@ impl NvidiaPlan { } } - /// `package.mask` lines. Maxwell/Pascal/Volta must stay below the branch - /// that made the open modules mandatory. + /// `package.mask` lines. Maxwell/Pascal/Volta are capped at the last + /// NVIDIA series that supports them; the next series (which drops those + /// architectures) is masked so Portage cannot install it. pub fn gentoo_package_mask(&self) -> Vec { match self.flavor { Some(NvidiaModuleFlavor::Proprietary) => { - vec![format!(">={GENTOO_ATOM}-{OPEN_MANDATORY_SERIES}")] + vec![format!( + ">={GENTOO_ATOM}-{}", + LEGACY_PROPRIETARY_LAST_SERIES + 1 + )] } _ => Vec::new(), } @@ -700,14 +764,17 @@ mod tests { } #[test] - fn pascal_uses_the_proprietary_branch_and_is_masked_below_595() { + fn pascal_uses_the_proprietary_branch_capped_after_580() { let hw = hardware(vec![nvidia("10de:1b81", "GP104 [GeForce GTX 1070]")]); let plan = NvidiaPlan::for_hardware(&hw); assert_eq!(plan.flavor, Some(NvidiaModuleFlavor::Proprietary)); + // 580 is the last branch that supports Maxwell/Pascal/Volta; the next + // series is masked so Portage cannot install a branch without the GPU. assert_eq!( plan.gentoo_package_mask(), - vec![">=x11-drivers/nvidia-drivers-595".to_string()] + vec![">=x11-drivers/nvidia-drivers-581".to_string()] ); + assert!(plan.branch.contains("580")); assert!(plan.gentoo_package_use()[0].contains("-kernel-open")); } @@ -756,7 +823,9 @@ mod tests { } #[test] - fn mixed_old_and_new_picks_the_proprietary_branch_for_the_oldest() { + fn mixed_pascal_and_ampere_stays_proprietary_and_supported() { + // Ampere can use either flavor, so the proprietary-only Pascal still + // leaves a single compatible branch. let hw = hardware(vec![ nvidia("10de:1b81", "GP104 [GeForce GTX 1070]"), nvidia("10de:2482", "GA104 [GeForce RTX 3070]"), @@ -766,6 +835,23 @@ mod tests { assert_eq!(plan.flavor, Some(NvidiaModuleFlavor::Proprietary)); } + #[test] + fn blackwell_plus_pascal_has_no_single_compatible_branch() { + // Blackwell needs NVIDIA's open kernel modules; Pascal can only use the + // proprietary modules. No one branch serves both, so the plan must not + // claim support. + let hw = hardware(vec![ + nvidia("10de:1b81", "GP104 [GeForce GTX 1070]"), + nvidia("10de:2b85", "GB202 [GeForce RTX 5090]"), + ]); + let plan = NvidiaPlan::for_hardware(&hw); + assert!(!plan.supported); + assert_eq!(plan.branch, "nouveau"); + assert_eq!(plan.flavor, None); + assert!(plan.reason.contains("no single NVIDIA branch"), "{}", plan.reason); + assert!(plan.gentoo_atom().is_none()); + } + #[test] fn no_nvidia_gpu_has_no_plan() { let hw = hardware(vec![GpuInfo { diff --git a/installer-rs/crates/phoebus-core/src/system.rs b/installer-rs/crates/phoebus-core/src/system.rs index 2b848ea..63e6e13 100644 --- a/installer-rs/crates/phoebus-core/src/system.rs +++ b/installer-rs/crates/phoebus-core/src/system.rs @@ -414,8 +414,8 @@ pub fn package_use(config: &InstallConfig, hardware: &HardwareReport) -> String o } -/// Scoped `package.mask` lines. Maxwell/Pascal/Volta must stay below the -/// branch that made NVIDIA's open kernel modules mandatory. +/// Scoped `package.mask` lines. Maxwell/Pascal/Volta must stay on the last +/// NVIDIA series that supports them (580); the next series is masked. pub fn package_mask(config: &InstallConfig, hardware: &HardwareReport) -> String { let _ = config; let nvidia = crate::nvidia::NvidiaPlan::for_hardware(hardware); @@ -1982,7 +1982,7 @@ mod tests { } #[test] - fn nvidia_pascal_uses_proprietary_and_masks_the_open_mandatory_branch() { + fn nvidia_pascal_uses_proprietary_and_is_capped_after_580() { let cfg = InstallConfig::default(); let hw = nvidia_hw("10de:1b81"); let use_text = package_use(&cfg, &hw); @@ -1990,7 +1990,7 @@ mod tests { assert_eq!( package_mask(&cfg, &hw), "# NVIDIA: proprietary branch required for Maxwell/Pascal/Volta.\n\ - >=x11-drivers/nvidia-drivers-595\n" + >=x11-drivers/nvidia-drivers-581\n" ); }