33 lines
No EOL
1.3 KiB
Bash
Executable file
33 lines
No EOL
1.3 KiB
Bash
Executable file
#!/bin/bash
|
|
# shellcheck disable=SC2002,SC2164
|
|
|
|
# Get the scripts directory
|
|
SCRIPTDIR=$(dirname "$(which "$0")")
|
|
cd "$SCRIPTDIR"
|
|
|
|
# If there is a config generated, then $SCRIPTDIR/config/kernel_args
|
|
# should exist, which contains all the info we need
|
|
if [ -f "$SCRIPTDIR/config/kernel_args" ];
|
|
then
|
|
# Fetch part of the device id we need
|
|
DEVID=$(cat "$SCRIPTDIR/config/kernel_args" | cut -d " " -f 3 | cut -d "=" -f 2 | perl -pe "s/^([0-9a-f]{4}:).*/\1/")
|
|
echo "#------------------------------------------#"
|
|
# List info about the vfio gpu and what kernel driver is being used
|
|
lspci -d "$DEVID" -v | grep -iP "kernel driver|amd|radeon|nvidia|nouveau" | grep -vi "kernel modules"
|
|
echo "#------------------------------------------#"
|
|
|
|
printf "
|
|
If the \"Kernel driver in use\" for these devices are \"vfio-pci\", then VFIO has been successfully enabled!
|
|
|
|
NOTE: If your system freezes when starting a VM that uses your VFIO enabled card..
|
|
consider adding the below line to your bootloaders kernel arguments:
|
|
vfio_pci.disable_vga=1
|
|
|
|
That will disable video output from the card while it is connected to the Linux host.
|
|
"
|
|
|
|
else
|
|
# Tell user to run the setup first if the kernel_args file is not found
|
|
echo "Please run \"$SCRIPTDIR/vfio-setup\" first!"
|
|
|
|
fi |