feat(hardware): xe-aware GuC, class-based NPU detect, latestKernel + VM test
Harden the hardware-enablement broad seed for newer hardware: - xe vs i915: intel.guc emits the i915 param (i915.enable_guc=3), which the newer `xe` driver (Lunar Lake / Battlemage / Panther Lake, recent Xe GPUs) ignores — it enables GuC by default. hardware-db.sh now reads the in-use GPU driver (lspci -k) and writes `intel.guc = false` on xe hardware, so the toggle isn't a misleading no-op there. - NPU detection by PCI accelerator class [1200] (+ keywords), attributing the vendor, instead of a fixed device-ID list — so new NPUs (e.g. Panther Lake) are caught without a code change. Known IDs kept as a fallback/reference. - Kernel awareness: a nomarchy.hardware.latestKernel escape hatch (linuxPackages_latest) for very-new hardware whose drivers only just landed, and a build-time warning when npu.enable predates the shipped kernel (amdxdna needs 6.14+, intel_vpu wants recent). Downstream default is 6.18, which already carries amd-pstate + amdxdna; the reference host pins latest. - VM test (checks.hardware-toggles, pkgs.testers.runNixOSTest): boots a minimal VM with the toggles on and asserts the config landed — amd_pstate + i915.enable_guc in /proc/cmdline, fprintd.service present, pam_fprintd in /etc/pam.d/sudo. Passing. (Hardware behaviour still needs bare metal.) Docs: README + template note latestKernel; ROADMAP records the hardening. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -28,9 +28,12 @@ in
|
||||
default = cfg.intel.enable;
|
||||
defaultText = lib.literalExpression "config.nomarchy.hardware.intel.enable";
|
||||
description = ''
|
||||
Load the GPU's GuC/HuC firmware (i915.enable_guc=3) — better power
|
||||
management and HuC-accelerated media on Gen11+ (Xe) iGPUs. On by
|
||||
default with intel.enable; safe on modern Intel graphics.
|
||||
Load the GPU's GuC/HuC firmware via the i915 param
|
||||
(i915.enable_guc=3) — better power management and HuC-accelerated
|
||||
media. On by default with intel.enable. NOTE: this is the *i915*
|
||||
driver's param; the newer `xe` driver (Lunar Lake / Battlemage /
|
||||
Panther Lake and other recent Xe GPUs) enables GuC by default and
|
||||
ignores it, so the installer turns this off on xe-driver hardware.
|
||||
'';
|
||||
};
|
||||
|
||||
@@ -98,7 +101,14 @@ in
|
||||
the on-die NPU (AI accelerator) kernel driver — amdxdna on AMD (Ryzen
|
||||
AI), intel_vpu on Intel (Core Ultra and newer). Opt-in and experimental:
|
||||
this loads the in-kernel driver only; the userspace runtime (AMD XRT /
|
||||
oneAPI Level Zero NPU) is yours to add'';
|
||||
oneAPI Level Zero NPU) is yours to add. Needs a recent kernel (see
|
||||
latestKernel)'';
|
||||
|
||||
latestKernel = lib.mkEnableOption ''
|
||||
the latest mainline kernel (pkgs.linuxPackages_latest) instead of the
|
||||
distro default — for very new hardware whose drivers (a fresh NPU, the
|
||||
`xe` GPU driver, new-platform enablement) only landed recently. Off by
|
||||
default; the default kernel already carries amd-pstate and amdxdna (6.14+)'';
|
||||
};
|
||||
|
||||
config = lib.mkMerge [
|
||||
@@ -136,12 +146,32 @@ in
|
||||
security.pam.services.sudo.fprintAuth = true;
|
||||
})
|
||||
|
||||
# ── Newest kernel for very-new hardware (opt-in escape hatch) ──────
|
||||
(lib.mkIf cfg.latestKernel {
|
||||
boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
|
||||
})
|
||||
|
||||
# ── NPU (in-kernel driver only; userspace runtime is BYO) ──────────
|
||||
# The driver has to actually be in the running kernel — warn (don't fail)
|
||||
# when it predates the shipped one, pointing at latestKernel.
|
||||
(lib.mkIf (cfg.npu.enable && cfg.amd.enable) {
|
||||
boot.kernelModules = [ "amdxdna" ];
|
||||
warnings = lib.optional
|
||||
(!lib.versionAtLeast config.boot.kernelPackages.kernel.version "6.14")
|
||||
''
|
||||
nomarchy.hardware.npu: the amdxdna driver needs kernel >= 6.14, but
|
||||
this config ships ${config.boot.kernelPackages.kernel.version}. Set
|
||||
nomarchy.hardware.latestKernel = true.'';
|
||||
})
|
||||
(lib.mkIf (cfg.npu.enable && cfg.intel.enable) {
|
||||
boot.kernelModules = [ "intel_vpu" ];
|
||||
warnings = lib.optional
|
||||
(!lib.versionAtLeast config.boot.kernelPackages.kernel.version "6.11")
|
||||
''
|
||||
nomarchy.hardware.npu: the intel_vpu driver (especially for newer
|
||||
NPUs) wants a recent kernel, but this config ships
|
||||
${config.boot.kernelPackages.kernel.version}. Consider
|
||||
nomarchy.hardware.latestKernel = true.'';
|
||||
})
|
||||
|
||||
# ── Sanity ─────────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user