kvmgt service: use modprobe, force-load module

This commit is contained in:
Nikolay Amiantov 2019-07-07 23:39:44 +03:00
parent ddc8398e7f
commit 13b8156030

View File

@ -4,13 +4,16 @@ with lib;
let let
cfg = config.virtualisation.kvmgt; cfg = config.virtualisation.kvmgt;
kernelPackages = config.boot.kernelPackages; kernelPackages = config.boot.kernelPackages;
vgpuOptions = { vgpuOptions = {
uuid = mkOption { uuid = mkOption {
type = types.string; type = types.string;
description = "UUID of VGPU device. You can generate one with <package>libossp_uuid</package>."; description = "UUID of VGPU device. You can generate one with <package>libossp_uuid</package>.";
}; };
}; };
in { in {
options = { options = {
virtualisation.kvmgt = { virtualisation.kvmgt = {
@ -45,7 +48,13 @@ in {
assertion = versionAtLeast kernelPackages.kernel.version "4.16"; assertion = versionAtLeast kernelPackages.kernel.version "4.16";
message = "KVMGT is not properly supported for kernels older than 4.16"; message = "KVMGT is not properly supported for kernels older than 4.16";
}; };
boot.kernelParams = [ "i915.enable_gvt=1" ];
boot.kernelModules = [ "kvmgt" ];
boot.extraModprobeConfig = ''
options i915 enable_gvt=1
'';
systemd.paths = mapAttrs' (name: value: systemd.paths = mapAttrs' (name: value:
nameValuePair "kvmgt-${name}" { nameValuePair "kvmgt-${name}" {
description = "KVMGT VGPU ${name} path"; description = "KVMGT VGPU ${name} path";
@ -55,6 +64,7 @@ in {
}; };
} }
) cfg.vgpus; ) cfg.vgpus;
systemd.services = mapAttrs' (name: value: systemd.services = mapAttrs' (name: value:
nameValuePair "kvmgt-${name}" { nameValuePair "kvmgt-${name}" {
description = "KVMGT VGPU ${name}"; description = "KVMGT VGPU ${name}";