diff --git a/hosts/focalor/hardware.nix b/hosts/focalor/hardware.nix index b290f2f..126d39c 100755 --- a/hosts/focalor/hardware.nix +++ b/hosts/focalor/hardware.nix @@ -9,8 +9,12 @@ ]; boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "uas" "usbhid" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; + boot.initrd.kernelModules = [ "vfio" "vfio_iommu_type1" "vfio_pci" ]; boot.kernelModules = [ "kvm-amd" ]; + boot.kernelParams = [ + "amd_iommu=on" + "vfio-pci.ids=10de:2484,10de228b,1022:149c,15b7:5045,1dbe:5236,1022:149c" + ]; boot.extraModulePackages = [ ]; fileSystems."/" = diff --git a/hosts/focalor/scripts/end.sh b/hosts/focalor/scripts/end.sh new file mode 100644 index 0000000..a08a269 --- /dev/null +++ b/hosts/focalor/scripts/end.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +set -x + +virsh nodedev-reattach pci_0000_0a_00_0 +virsh nodedev-reattach pci_0000_0a_00_1 +virsh nodedev-reattach pci_0000_06_00_1 +virsh nodedev-reattach pci_0000_06_00_3 +virsh nodedev-reattach pci_0000_0c_00_3 + +modprobe -r vfio-pci + +modprobe nvidia_modeset +modprobe nvidia_uvm +modprobe nvidia_drm +modprobe nvidia + +modprobe -r xhci_pci +modprobe xhci_pci + +systemctl restart display-manager diff --git a/hosts/focalor/vfio.nix b/hosts/focalor/vfio.nix index eb144df..e0d73f7 100755 --- a/hosts/focalor/vfio.nix +++ b/hosts/focalor/vfio.nix @@ -17,6 +17,9 @@ }).fd]; }; }; + hooks.qemu = { + end = "./scripts/end.sh"; + }; }; users.extraUsers.regent.extraGroups = [ "libvirtd" ];