virtualization improvements
This commit is contained in:
parent
34f8e2640f
commit
3c6cc3e1d2
1 changed files with 28 additions and 26 deletions
|
@ -1,4 +1,4 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
{ config, nixpkgs-xr, pkgs, lib, ... }:
|
||||
let
|
||||
passthrough = pkgs.writeShellApplication {
|
||||
name = "passthrough.sh";
|
||||
|
@ -24,43 +24,42 @@ let
|
|||
echo 0 > /sys/class/vtconsole/vtcon1/bind
|
||||
|
||||
# Unbind EFI-Framebuffer
|
||||
echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/unbind
|
||||
#echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/unbind
|
||||
|
||||
# Unbind the GPU from display driver
|
||||
virsh nodedev-detach pci_0000_03_00_0
|
||||
virsh nodedev-detach pci_0000_03_00_1
|
||||
virsh nodedev-detach pci_0000_03_00_2
|
||||
|
||||
# Unload Modules
|
||||
modprobe -r amdgpu
|
||||
|
||||
# We love race conditions
|
||||
sleep 2
|
||||
|
||||
# Unload Modules
|
||||
modprobe -r nvidia_drm nvidia_modeset nvidia_uvm nvidia
|
||||
|
||||
# Unbind the GPU from display driver
|
||||
virsh nodedev-detach pci_0000_01_00_0
|
||||
virsh nodedev-detach pci_0000_01_00_1
|
||||
|
||||
# Load VFIO Kernel Module
|
||||
modprobe vfio_pci
|
||||
|
||||
sleep 2
|
||||
modprobe vfio vfio_pci vfio_iommu_type1
|
||||
|
||||
elif [[ "$HOOK_NAME/$STATE_NAME" == "release/end" ]]; then
|
||||
|
||||
# Re-Bind GPU to Nvidia Driver (replace the pci addresses with yours)
|
||||
virsh nodedev-reattach pci_0000_01_00_0
|
||||
virsh nodedev-reattach pci_0000_01_00_1
|
||||
modprobe -r vfio_iommu_type1 vfio_pci vfio
|
||||
|
||||
modprobe -r vfio-pci
|
||||
|
||||
#bind efi
|
||||
echo "efi-framebuffer.0" > /sys/bus/platform/drivers/efi-framebuffer/bind
|
||||
|
||||
# Reload nvidia modules
|
||||
modprobe nvidia_drm
|
||||
modprobe nvidia_modeset
|
||||
modprobe nvidia_uvm
|
||||
modprobe nvidia
|
||||
# Re-Bind GPU to Host
|
||||
virsh nodedev-reattach pci_0000_03_00_0
|
||||
virsh nodedev-reattach pci_0000_03_00_1
|
||||
virsh nodedev-reattach pci_0000_03_00_2
|
||||
|
||||
# Rebind VT consoles
|
||||
echo 1 > /sys/class/vtconsole/vtcon0/bind
|
||||
bin/echo 1 > /sys/class/vtconsole/vtcon1/bind
|
||||
echo 1 > /sys/class/vtconsole/vtcon1/bind
|
||||
|
||||
sleep 2
|
||||
|
||||
# Bind Framebuffer
|
||||
#echo "efi-framebuffer.0" > /sys/bus/platform/drivers/efi-framebuffer/bind
|
||||
|
||||
# Reload Modules
|
||||
modprobe amdgpu
|
||||
|
||||
fi
|
||||
|
||||
|
@ -99,6 +98,9 @@ in {
|
|||
databaseDir = "/home/stitchynyan/.local/share/syncthing";
|
||||
dataDir = "/home/stitchynyan";
|
||||
};
|
||||
|
||||
environment.systemPackages = [
|
||||
pkgs.wlx-overlay-s ];
|
||||
|
||||
networking.hostName = "malachite";
|
||||
|
||||
|
|
Loading…
Reference in a new issue