fix(nvidia): cap the legacy branch at 580 and reject mixed open/proprietary hardware

NVIDIA's 580 series is the last to support Maxwell/Pascal/Volta, and
Blackwell requires the open kernel modules. The policy previously masked
>=595, which permits branches that already dropped those architectures,
and assumed the oldest card's branch could serve every newer card.

- Mask >=x11-drivers/nvidia-drivers-581 for the proprietary branch (the
  first series after the last supporting one).
- Compute compatibility across the whole device set: Blackwell plus a
  proprietary-only GPU has no single branch and is reported as an
  explicit incompatibility (nouveau) instead of installing a driver that
  cannot accelerate one card.
- Pascal + Ampere remains proprietary and supported (Ampere accepts
  either flavor).
This commit is contained in:
Phoebus 2026-09-23 06:06:51 -07:00
parent dc5e27e60a
commit b32683da99
2 changed files with 115 additions and 29 deletions

View file

@ -13,18 +13,27 @@
//! //!
//! Branch policy (NVIDIA/Gentoo, verified 2026-09): //! Branch policy (NVIDIA/Gentoo, verified 2026-09):
//! //!
//! * **Turing / Ampere / Ada / Hopper / Blackwell** use the current //! * **Turing / Ampere / Ada / Hopper** use the current
//! `x11-drivers/nvidia-drivers` branch with NVIDIA's *open* kernel modules //! `x11-drivers/nvidia-drivers` branch. NVIDIA's *open* kernel modules
//! (`USE=kernel-open`). The open modules support Turing (GTX 16xx / RTX 20xx) //! (`USE=kernel-open`) support Turing (GTX 16xx / RTX 20xx) and newer and are
//! and newer. They are mandatory from driver 595 and are required for //! recommended there; they become mandatory from driver 595.
//! Blackwell (RTX 50xx). //! * **Blackwell (RTX 50xx)** requires the open kernel modules; the proprietary
//! * **Maxwell / Pascal / Volta** cannot use the open modules. They are pinned //! kernel modules cannot drive it.
//! to the newest proprietary branch below the open-mandatory cut (595) with //! * **Maxwell / Pascal / Volta** cannot use the open modules and are served
//! `USE=-kernel-open`, and `>=x11-drivers/nvidia-drivers-595` is masked. //! 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 //! * **Fermi / Kepler and older** are not served by a security-supported
//! proprietary branch; they fall back to the in-tree `nouveau` driver. This //! proprietary branch; they fall back to the in-tree `nouveau` driver. This
//! is reported, never silently substituted as NVIDIA success. //! 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 //! 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 //! 13/testing). That branch's proprietary kernel modules cover Maxwell through
//! Ada/Hopper; it does not support Blackwell, so Blackwell live boots fall back //! 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"; pub const GENTOO_ATOM: &str = "x11-drivers/nvidia-drivers";
/// The first NVIDIA driver series that makes the open kernel modules mandatory /// The first NVIDIA driver series that makes the open kernel modules mandatory
/// (`USE=kernel-open` can no longer be disabled). Maxwell/Pascal/Volta are /// (`USE=kernel-open` can no longer be disabled). Informational: the
/// pinned below this cut. /// Maxwell/Pascal/Volta cap is the earlier legacy cut below, not this one.
pub const OPEN_MANDATORY_SERIES: u32 = 595; 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
/// (<https://nvidia.custhelp.com/app/answers/detail/a_id/5676>). 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 NVIDIA branch bundled on the Debian live medium. It is a property of
/// the signed Debian archive, not of the detected GPU. /// the signed Debian archive, not of the detected GPU.
pub const LIVE_DEBIAN_BRANCH: &str = "550.163.01"; 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 adapter, so compute compatibility
// one driver install covers every card. Maxwell/Pascal/Volta force the // across the whole set rather than assuming the oldest card's branch
// proprietary branch; otherwise the open modules are used. // serves the newer ones.
let needs_proprietary = supported let requires_open = supported.iter().any(|d| {
.iter() d.generation
.any(|d| d.support() == NvidiaSupport::Proprietary); .map(|g| g.requires_open_modules())
let flavor = if needs_proprietary { .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<String> = 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<String> = 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 NvidiaModuleFlavor::Proprietary
} else { } else {
NvidiaModuleFlavor::Open NvidiaModuleFlavor::Open
@ -326,10 +384,12 @@ impl NvidiaPlan {
flavor: Some(flavor), flavor: Some(flavor),
branch: match flavor { branch: match flavor {
NvidiaModuleFlavor::Open => { NvidiaModuleFlavor::Open => {
format!("current open kernel modules (>= {OPEN_MANDATORY_SERIES})") format!("current open kernel modules (mandatory from {OPEN_MANDATORY_SERIES})")
} }
NvidiaModuleFlavor::Proprietary => { 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, reason,
@ -359,12 +419,16 @@ impl NvidiaPlan {
} }
} }
/// `package.mask` lines. Maxwell/Pascal/Volta must stay below the branch /// `package.mask` lines. Maxwell/Pascal/Volta are capped at the last
/// that made the open modules mandatory. /// 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<String> { pub fn gentoo_package_mask(&self) -> Vec<String> {
match self.flavor { match self.flavor {
Some(NvidiaModuleFlavor::Proprietary) => { Some(NvidiaModuleFlavor::Proprietary) => {
vec![format!(">={GENTOO_ATOM}-{OPEN_MANDATORY_SERIES}")] vec![format!(
">={GENTOO_ATOM}-{}",
LEGACY_PROPRIETARY_LAST_SERIES + 1
)]
} }
_ => Vec::new(), _ => Vec::new(),
} }
@ -700,14 +764,17 @@ mod tests {
} }
#[test] #[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 hw = hardware(vec![nvidia("10de:1b81", "GP104 [GeForce GTX 1070]")]);
let plan = NvidiaPlan::for_hardware(&hw); let plan = NvidiaPlan::for_hardware(&hw);
assert_eq!(plan.flavor, Some(NvidiaModuleFlavor::Proprietary)); 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!( assert_eq!(
plan.gentoo_package_mask(), 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")); assert!(plan.gentoo_package_use()[0].contains("-kernel-open"));
} }
@ -756,7 +823,9 @@ mod tests {
} }
#[test] #[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![ let hw = hardware(vec![
nvidia("10de:1b81", "GP104 [GeForce GTX 1070]"), nvidia("10de:1b81", "GP104 [GeForce GTX 1070]"),
nvidia("10de:2482", "GA104 [GeForce RTX 3070]"), nvidia("10de:2482", "GA104 [GeForce RTX 3070]"),
@ -766,6 +835,23 @@ mod tests {
assert_eq!(plan.flavor, Some(NvidiaModuleFlavor::Proprietary)); 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] #[test]
fn no_nvidia_gpu_has_no_plan() { fn no_nvidia_gpu_has_no_plan() {
let hw = hardware(vec![GpuInfo { let hw = hardware(vec![GpuInfo {

View file

@ -414,8 +414,8 @@ pub fn package_use(config: &InstallConfig, hardware: &HardwareReport) -> String
o o
} }
/// Scoped `package.mask` lines. Maxwell/Pascal/Volta must stay below the /// Scoped `package.mask` lines. Maxwell/Pascal/Volta must stay on the last
/// branch that made NVIDIA's open kernel modules mandatory. /// NVIDIA series that supports them (580); the next series is masked.
pub fn package_mask(config: &InstallConfig, hardware: &HardwareReport) -> String { pub fn package_mask(config: &InstallConfig, hardware: &HardwareReport) -> String {
let _ = config; let _ = config;
let nvidia = crate::nvidia::NvidiaPlan::for_hardware(hardware); let nvidia = crate::nvidia::NvidiaPlan::for_hardware(hardware);
@ -1982,7 +1982,7 @@ mod tests {
} }
#[test] #[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 cfg = InstallConfig::default();
let hw = nvidia_hw("10de:1b81"); let hw = nvidia_hw("10de:1b81");
let use_text = package_use(&cfg, &hw); let use_text = package_use(&cfg, &hw);
@ -1990,7 +1990,7 @@ mod tests {
assert_eq!( assert_eq!(
package_mask(&cfg, &hw), package_mask(&cfg, &hw),
"# NVIDIA: proprietary branch required for Maxwell/Pascal/Volta.\n\ "# NVIDIA: proprietary branch required for Maxwell/Pascal/Volta.\n\
>=x11-drivers/nvidia-drivers-595\n" >=x11-drivers/nvidia-drivers-581\n"
); );
} }