about summary refs log tree commit diff
path: root/pkgs/os-specific
diff options
context:
space:
mode:
authorSamuel Dionne-Riel <samuel@dionne-riel.com>2020-09-13 23:26:21 -0400
committerMilan <me@pbb.lc>2020-12-31 18:20:49 +0100
commit4e75a31e98d2219c1deb450fc90ecd98ced83b58 (patch)
tree49ba3fdaa55cb59fbbeed905a14d288ff7241ccc /pkgs/os-specific
parentf9d5de05d255dca286d12a6630a97a2b81dcaea7 (diff)
downloadnixlib-4e75a31e98d2219c1deb450fc90ecd98ced83b58.tar
nixlib-4e75a31e98d2219c1deb450fc90ecd98ced83b58.tar.gz
nixlib-4e75a31e98d2219c1deb450fc90ecd98ced83b58.tar.bz2
nixlib-4e75a31e98d2219c1deb450fc90ecd98ced83b58.tar.lz
nixlib-4e75a31e98d2219c1deb450fc90ecd98ced83b58.tar.xz
nixlib-4e75a31e98d2219c1deb450fc90ecd98ced83b58.tar.zst
nixlib-4e75a31e98d2219c1deb450fc90ecd98ced83b58.zip
linux: configure aarch64 contiguous memory allocator via kernel config
As per the in-line comment, this is where distros should configure it.
Not via kernel command line parameters.

As found by looking at the implementation, while exploring the cause of
a bug on the Raspberry Pi 4, it was found that `cma=` on the command
line parameters will overwrite the values a device tree will have
configured for a given platform.

With this, the more recent 5.4 vendor kernel boots just fine on the
Raspberry Pi 4 using our common configuration.
Diffstat (limited to 'pkgs/os-specific')
-rw-r--r--pkgs/os-specific/linux/kernel/common-config.nix6
1 files changed, 6 insertions, 0 deletions
diff --git a/pkgs/os-specific/linux/kernel/common-config.nix b/pkgs/os-specific/linux/kernel/common-config.nix
index 47e49dbe01d7..2f81444f78fe 100644
--- a/pkgs/os-specific/linux/kernel/common-config.nix
+++ b/pkgs/os-specific/linux/kernel/common-config.nix
@@ -819,6 +819,12 @@ let
 
       # See comments on https://github.com/NixOS/nixpkgs/commit/9b67ea9106102d882f53d62890468071900b9647
       CRYPTO_AEGIS128_SIMD = whenAtLeast "5.4" no;
+
+      # Distros should configure the default as a kernel option.
+      # We previously defined it on the kernel command line as cma=
+      # The kernel command line will override a platform-specific configuration from its device tree.
+      # https://github.com/torvalds/linux/blob/856deb866d16e29bd65952e0289066f6078af773/kernel/dma/contiguous.c#L35-L44
+      CMA_SIZE_MBYTES = freeform "32";
     };
   };
 in