vfio reformatting and such

This commit is contained in:
Gerg-L 2024-06-08 13:04:48 -04:00
parent 6847448a39
commit a029177bde
Signed by: gerg-l
SSH key fingerprint: SHA256:FPYDHIkvMocr4wdmZXpgpJjsb2Tw6rASs2ISPbOb0KI
2 changed files with 79 additions and 85 deletions

View file

@ -46,12 +46,6 @@ in
''; '';
}; };
boot.kernelPatches = lib.singleton {
name = "fix_amd_mem_access";
patch = null;
extraStructuredConfig.HSA_AMD_SVM = lib.kernel.yes;
};
systemd.tmpfiles.rules = [ systemd.tmpfiles.rules = [
"L /etc/X11/xorg.conf.d/99-custom.conf - - - - /etc/Xorg/2_mon.conf" "L /etc/X11/xorg.conf.d/99-custom.conf - - - - /etc/Xorg/2_mon.conf"
@ -70,9 +64,27 @@ in
"vfio_iommu_type1.allow_unsafe_interrupts=1" "vfio_iommu_type1.allow_unsafe_interrupts=1"
"kvm.ignore_msrs=1" "kvm.ignore_msrs=1"
]; ];
kernelPatches = lib.singleton {
name = "fix_amd_mem_access";
patch = null;
extraStructuredConfig.HSA_AMD_SVM = lib.kernel.yes;
}; };
virtualisation = { };
libvirtd = {
environment = {
systemPackages = [
pkgs.dmidecode
cfg_monitors
];
shellAliases = {
vm-start = "virsh start Windows";
vm-stop = "virsh shutdown Windows";
};
};
programs.virt-manager.enable = true;
virtualisation.libvirtd = {
enable = true; enable = true;
qemu = { qemu = {
# Patch to disable hooking the mouse via evdev at VM startup # Patch to disable hooking the mouse via evdev at VM startup
@ -107,22 +119,8 @@ in
namespaces = [] namespaces = []
''; '';
}; };
}; hooks.qemu = {
}; # Ordering is based on the name
environment = {
systemPackages = [
pkgs.dmidecode
cfg_monitors
];
shellAliases = {
vm-start = "virsh start Windows";
vm-stop = "virsh shutdown Windows";
};
};
programs.virt-manager.enable = true;
virtualisation.libvirtd.hooks.qemu = {
"AAA" = lib.getExe ( "AAA" = lib.getExe (
pkgs.writeShellApplication { pkgs.writeShellApplication {
name = "qemu-hook"; name = "qemu-hook";
@ -139,9 +137,7 @@ in
if [ "$GUEST_NAME" != "Windows" ]; then if [ "$GUEST_NAME" != "Windows" ]; then
exit 0 exit 0
fi else if [ "$OPERATION" == "prepare" ]; then
if [ "$OPERATION" == "prepare" ]; then
# Stop display-manager # Stop display-manager
systemctl stop display-manager.service systemctl stop display-manager.service
@ -161,10 +157,7 @@ in
ln -fs /etc/Xorg/1_mon.conf /etc/X11/xorg.conf.d/99-custom.conf ln -fs /etc/Xorg/1_mon.conf /etc/X11/xorg.conf.d/99-custom.conf
touch /etc/Xorg/ONE_MONITOR touch /etc/Xorg/ONE_MONITOR
systemctl start display-manager.service systemctl start display-manager.service
fi else if [ "$OPERATION" == "release" ]; then
if [ "$OPERATION" == "release" ]; then
# Dual gpu/monitor stuff # Dual gpu/monitor stuff
systemctl stop display-manager.service systemctl stop display-manager.service
@ -186,12 +179,13 @@ in
# Restart display-manager # Restart display-manager
systemctl start display-manager.service systemctl start display-manager.service
else
exit 0
fi fi
''; '';
} }
); );
}; };
};
inherit _file; inherit _file;
} }

View file

@ -52,7 +52,7 @@
forceImportAll = true; forceImportAll = true;
}; };
kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages; kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
#disable hibernate and set cache max #set ARC max
kernelParams = [ "zfs.zfs_arc_max=17179869184" ]; kernelParams = [ "zfs.zfs_arc_max=17179869184" ];
initrd = { initrd = {
#module for multiple swap devices #module for multiple swap devices