Skip to content

Commit

Permalink
dynamic vfio
Browse files Browse the repository at this point in the history
  • Loading branch information
appaquet committed Dec 6, 2024
1 parent 920bfba commit f985fed
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 201 deletions.
131 changes: 0 additions & 131 deletions gpu-old.sh

This file was deleted.

69 changes: 0 additions & 69 deletions gpu.sh

This file was deleted.

11 changes: 10 additions & 1 deletion nixos/deskapp/gpu-switch.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{ lib, pkgs, config, ... }:
{ pkgs, config, ... }:

# TODO: systemd on boot to switch ?
# TODO: qemu hooks

let
# Keep in sync with ./virt/default.nix
Expand Down Expand Up @@ -60,6 +63,12 @@ let
sleep 5
fi
gpu_driver=$(get_bus_driver $gpu_bus)
if [ "$gpu_driver" == "$to_driver" ]; then
echo "Loading drivers bound to $to_driver automatically"
exit 0
fi
sleep 2
echo "Binding GPU to $to_driver"
echo $gpu_bus >/sys/bus/pci/drivers/$to_driver/bind
Expand Down

0 comments on commit f985fed

Please sign in to comment.