From 127439bee20cc1566ea05871a5aea25ca9c440c7 Mon Sep 17 00:00:00 2001 From: Tristan Druyen Date: Fri, 3 Nov 2023 23:52:30 +0100 Subject: [PATCH] Switch to linux-zen kernel - the kernel patch is needed to make the my m2 SSDs work in older 6.x kernels, should be fixed ~ 6.6 --- systems/nixos-pulse/default.nix | 8 +++++++- systems/nixos-pulse/lexar.patch | 31 +++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 systems/nixos-pulse/lexar.patch diff --git a/systems/nixos-pulse/default.nix b/systems/nixos-pulse/default.nix index 29bf802..49606e8 100644 --- a/systems/nixos-pulse/default.nix +++ b/systems/nixos-pulse/default.nix @@ -20,7 +20,13 @@ nixpkgs.hostPlatform = lib.mkDefault system; boot = { - kernelPackages = pkgs.linuxPackages_latest; + kernelPackages = pkgs.linuxPackages_zen; + kernelPatches = [ + { + name = "lexar"; + patch = ./lexar.patch; + } + ]; loader = { systemd-boot = { enable = true; diff --git a/systems/nixos-pulse/lexar.patch b/systems/nixos-pulse/lexar.patch new file mode 100644 index 0000000..74ac8b4 --- /dev/null +++ b/systems/nixos-pulse/lexar.patch @@ -0,0 +1,31 @@ +@@ -, +, @@ +---------- +---------- +--- + drivers/nvme/host/core.c | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) +--- a/drivers/nvme/host/core.c ++++ a/drivers/nvme/host/core.c +@@ -2255,11 +2255,17 @@ int nvme_enable_ctrl(struct nvme_ctrl *ctrl) + return ret; + } + +- if (ctrl->cap & NVME_CAP_CRMS_CRIMS) { +- ctrl->ctrl_config |= NVME_CC_CRIME; +- timeout = NVME_CRTO_CRIMT(crto); ++ if (crto == 0) { ++ timeout = NVME_CAP_TIMEOUT(ctrl->cap); ++ dev_warn(ctrl->device, "Ignoring bogus CRTO (0), falling back to NVME_CAP_TIMEOUT (%u)\n", ++ timeout); + } else { +- timeout = NVME_CRTO_CRWMT(crto); ++ if (ctrl->cap & NVME_CAP_CRMS_CRIMS) { ++ ctrl->ctrl_config |= NVME_CC_CRIME; ++ timeout = NVME_CRTO_CRIMT(crto); ++ } else { ++ timeout = NVME_CRTO_CRWMT(crto); ++ } + } + } else { + timeout = NVME_CAP_TIMEOUT(ctrl->cap); +--