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
cfg = config.virtualisation.kvmgt;
kernelPackages = config.boot.kernelPackages;
vgpuOptions = {
uuid = mkOption {
type = types.string;
description = "UUID of VGPU device. You can generate one with <package>libossp_uuid</package>.";
};
};
in {
options = {
virtualisation.kvmgt = {
@ -45,7 +48,13 @@ in {
assertion = versionAtLeast kernelPackages.kernel.version "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:
nameValuePair "kvmgt-${name}" {
description = "KVMGT VGPU ${name} path";
@ -55,6 +64,7 @@ in {
};
}
) cfg.vgpus;
systemd.services = mapAttrs' (name: value:
nameValuePair "kvmgt-${name}" {
description = "KVMGT VGPU ${name}";