Skip to content

Commit

Permalink
consoleDrivers function made more robust for multiple runs.
Browse files Browse the repository at this point in the history
Also solved undesirable mmap issue.
  • Loading branch information
Jared J committed Jul 21, 2020
1 parent 79edd28 commit 2428dba
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 4 deletions.
8 changes: 4 additions & 4 deletions main
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,9 @@ function bridger {
function consoleDrivers { # Toggles rendering to Ctrl+Alt+F[0-9]. Needs to be unhooked for GPU passthrough.
if [ "$DRY" -eq "0" ]
then
if [[ "$1" -eq 'bind' ]]; then bindstate='1';else bindstate='0';fi
sleep 1 ; echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/bind
if [[ "$1" -eq 'bind' ]]; then bindBoolean="1"; bindState="$1" ; else bindBoolean="0" ; bindState="unbind" ; fi
for vtconsole in /sys/class/vtconsole/*; do echo $bindBoolean > $vtconsole/bind ; done
echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/$bindState
fi
}

Expand Down Expand Up @@ -157,7 +158,6 @@ function enumeratePCIs { # This makes arguments and also unbinds from drivers. O
if ! lsmod|grep -q vfio_pci; then modprobe vfio-pci; fi
if [ "$?" -ne "0" ]; then echo "Could not modprove vfio-pci. Please fix this."; exit 1 ; fi
if systemctl is-active display-manager >/dev/null && [ "$DRY" -eq "0" ]; then systemctl stop display-manager ; export dm="seen" ; fi
consoleDrivers unbind # Required to avoid GPU mmap issues

lspciOutput="$(lspci -nn)"
PCIDevices="$(grep -E "$pciREGEX" <<<"$lspciOutput")"
Expand Down Expand Up @@ -376,7 +376,7 @@ if [ ! -z "$usbREGEX" ]; then usbREGEX=$(regexCleanup "$usbREGEX") ; fi
if [ ! -z "$pciREGEX" ]; then pciREGEX=$(regexCleanup "$pciREGEX") ; fi

if [ ! -z "$usbREGEX" ]; then enumerateUSBs ; fi
if [ ! -z "$pciREGEX" ]; then enumeratePCIs unbind vfiobind ; consoleDrivers unbind ; fi
if [ ! -z "$pciREGEX" ]; then consoleDrivers unbind ; enumeratePCIs unbind vfiobind ; fi # consoleDrivers is required to avoid GPU mmap issues

# _____ _
#| ___| |_ _
Expand Down
48 changes: 48 additions & 0 deletions nohup.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
This will not be a dry run, please use sudo.
This will not be a dry run, please use sudo.
-taskset not specified, using all host cores: (12) with (24) threads.
-bios argument not provided, using discovered default: /usr/share/ovmf/x64/OVMF_CODE.fd

PCI:
/home/jared/vfio/main: line 126: echo: write error: No such device
Matched: 09:00.0 VGA compatible controller [0300]: NVIDIA Corporation TU102 [GeForce RTX 2080 Ti] [10de:1e04] (rev a1)
[INFO] Driver is 'nvidia' and will be rebound on VM exit
Unbinding from it's driver
Binding it to vfio-pci
Matched: 09:00.1 Audio device [0403]: NVIDIA Corporation TU102 High Definition Audio Controller [10de:10f7] (rev a1)
[INFO] Driver is 'snd_hda_intel' and will be rebound on VM exit
Unbinding from it's driver
Binding it to vfio-pci
Matched: 09:00.2 USB controller [0c03]: NVIDIA Corporation TU102 USB 3.1 Host Controller [10de:1ad6] (rev a1)
[INFO] Driver is 'xhci_hcd' and will be rebound on VM exit
Unbinding from it's driver
Binding it to vfio-pci
Matched: 09:00.3 Serial bus controller [0c80]: NVIDIA Corporation TU102 USB Type-C UCSI Controller [10de:1ad7] (rev a1)
[INFO] Driver is 'nvidia-gpu' and will be rebound on VM exit
Unbinding from it's driver
Binding it to vfio-pci
/home/jared/vfio/main: line 126: echo: write error: No such device
Unable to init server: Could not connect: Connection refused
WARNING: Image format was not specified for '/dev/zvol/jared-desktop/windows' and probing guessed raw.
Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
Specify the 'raw' format explicitly to remove the restrictions.
qemu-system-x86_64: warning: This family of AMD CPU doesn't support hyperthreading(2)
Please configure -smp options properly or try enabling topoext feature.
qemu-system-x86_64: -device vfio-pci,host=0000:09:00.0,id=hostdev0: Failed to mmap 0000:09:00.0 BAR 3. Performance may be slow
gtk initialization failed
/home/jared/vfio/main: line 126: echo: write error: No such device
PCI:
/home/jared/vfio/main: line 126: echo: write error: No such device
Matched: 09:00.0 VGA compatible controller [0300]: NVIDIA Corporation TU102 [GeForce RTX 2080 Ti] [10de:1e04] (rev a1)
Rebinding 10de:1e04 to driver: nvidia
10de:1e04 successfully rebound to nvidia
Matched: 09:00.1 Audio device [0403]: NVIDIA Corporation TU102 High Definition Audio Controller [10de:10f7] (rev a1)
Rebinding 10de:10f7 to driver: snd_hda_intel
10de:10f7 successfully rebound to snd_hda_intel
Matched: 09:00.2 USB controller [0c03]: NVIDIA Corporation TU102 USB 3.1 Host Controller [10de:1ad6] (rev a1)
Rebinding 10de:1ad6 to driver: xhci_hcd
10de:1ad6 successfully rebound to xhci_hcd
Matched: 09:00.3 Serial bus controller [0c80]: NVIDIA Corporation TU102 USB Type-C UCSI Controller [10de:1ad7] (rev a1)
Rebinding 10de:1ad7 to driver: nvidia-gpu
10de:1ad7 successfully rebound to nvidia-gpu
Attempting to restore your display-manager...

0 comments on commit 2428dba

Please sign in to comment.