quickpassthrough/vfio-verify

32 lines
1.2 KiB
Text
Raw Normal View History

#!/bin/bash
# Get the scripts directory
2022-03-03 21:18:44 -05:00
SCRIPTDIR=$(dirname "$(which $0)")
2022-03-10 10:48:54 -05:00
cd "$SCRIPTDIR"
2022-03-01 03:02:29 -05:00
# 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
2022-03-01 03:02:29 -05:00
# 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 "#------------------------------------------#"
2022-03-01 03:02:29 -05:00
# 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!
2022-03-10 10:48:54 -05:00
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.
"
2022-03-01 03:02:29 -05:00
else
# Tell user to run the setup first if the kernel_args file is not found
echo "Please run \"$SCRIPTDIR/vfio-setup\" first!"
2022-03-03 21:18:44 -05:00
fi