Skip to content

Commit 2428dba

Browse files
author
Jared J
committed
consoleDrivers function made more robust for multiple runs.
Also solved undesirable mmap issue.
1 parent 79edd28 commit 2428dba

File tree

2 files changed

+52
-4
lines changed

2 files changed

+52
-4
lines changed

main

+4-4
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,9 @@ function bridger {
122122
function consoleDrivers { # Toggles rendering to Ctrl+Alt+F[0-9]. Needs to be unhooked for GPU passthrough.
123123
if [ "$DRY" -eq "0" ]
124124
then
125-
if [[ "$1" -eq 'bind' ]]; then bindstate='1';else bindstate='0';fi
126-
sleep 1 ; echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/bind
125+
if [[ "$1" -eq 'bind' ]]; then bindBoolean="1"; bindState="$1" ; else bindBoolean="0" ; bindState="unbind" ; fi
126+
for vtconsole in /sys/class/vtconsole/*; do echo $bindBoolean > $vtconsole/bind ; done
127+
echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/$bindState
127128
fi
128129
}
129130

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

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

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

381381
# _____ _
382382
#| ___| |_ _

nohup.out

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
This will not be a dry run, please use sudo.
2+
This will not be a dry run, please use sudo.
3+
-taskset not specified, using all host cores: (12) with (24) threads.
4+
-bios argument not provided, using discovered default: /usr/share/ovmf/x64/OVMF_CODE.fd
5+
6+
PCI:
7+
/home/jared/vfio/main: line 126: echo: write error: No such device
8+
Matched: 09:00.0 VGA compatible controller [0300]: NVIDIA Corporation TU102 [GeForce RTX 2080 Ti] [10de:1e04] (rev a1)
9+
[INFO] Driver is 'nvidia' and will be rebound on VM exit
10+
Unbinding from it's driver
11+
Binding it to vfio-pci
12+
Matched: 09:00.1 Audio device [0403]: NVIDIA Corporation TU102 High Definition Audio Controller [10de:10f7] (rev a1)
13+
[INFO] Driver is 'snd_hda_intel' and will be rebound on VM exit
14+
Unbinding from it's driver
15+
Binding it to vfio-pci
16+
Matched: 09:00.2 USB controller [0c03]: NVIDIA Corporation TU102 USB 3.1 Host Controller [10de:1ad6] (rev a1)
17+
[INFO] Driver is 'xhci_hcd' and will be rebound on VM exit
18+
Unbinding from it's driver
19+
Binding it to vfio-pci
20+
Matched: 09:00.3 Serial bus controller [0c80]: NVIDIA Corporation TU102 USB Type-C UCSI Controller [10de:1ad7] (rev a1)
21+
[INFO] Driver is 'nvidia-gpu' and will be rebound on VM exit
22+
Unbinding from it's driver
23+
Binding it to vfio-pci
24+
/home/jared/vfio/main: line 126: echo: write error: No such device
25+
Unable to init server: Could not connect: Connection refused
26+
WARNING: Image format was not specified for '/dev/zvol/jared-desktop/windows' and probing guessed raw.
27+
Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
28+
Specify the 'raw' format explicitly to remove the restrictions.
29+
qemu-system-x86_64: warning: This family of AMD CPU doesn't support hyperthreading(2)
30+
Please configure -smp options properly or try enabling topoext feature.
31+
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
32+
gtk initialization failed
33+
/home/jared/vfio/main: line 126: echo: write error: No such device
34+
PCI:
35+
/home/jared/vfio/main: line 126: echo: write error: No such device
36+
Matched: 09:00.0 VGA compatible controller [0300]: NVIDIA Corporation TU102 [GeForce RTX 2080 Ti] [10de:1e04] (rev a1)
37+
Rebinding 10de:1e04 to driver: nvidia
38+
10de:1e04 successfully rebound to nvidia
39+
Matched: 09:00.1 Audio device [0403]: NVIDIA Corporation TU102 High Definition Audio Controller [10de:10f7] (rev a1)
40+
Rebinding 10de:10f7 to driver: snd_hda_intel
41+
10de:10f7 successfully rebound to snd_hda_intel
42+
Matched: 09:00.2 USB controller [0c03]: NVIDIA Corporation TU102 USB 3.1 Host Controller [10de:1ad6] (rev a1)
43+
Rebinding 10de:1ad6 to driver: xhci_hcd
44+
10de:1ad6 successfully rebound to xhci_hcd
45+
Matched: 09:00.3 Serial bus controller [0c80]: NVIDIA Corporation TU102 USB Type-C UCSI Controller [10de:1ad7] (rev a1)
46+
Rebinding 10de:1ad7 to driver: nvidia-gpu
47+
10de:1ad7 successfully rebound to nvidia-gpu
48+
Attempting to restore your display-manager...

0 commit comments

Comments
 (0)