Created
March 2, 2020 16:37
-
-
Save jcvenegas/2601379c0520f0153de6b92c9579a361 to your computer and use it in GitHub Desktop.
vfio
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set -o errexit | |
set -o nounset | |
set -o pipefail | |
set -o errtrace | |
sudo modprobe vfio_pci | |
sudo modprobe vfio_iommu_type1 allow_unsafe_interrupts | |
bus_slot="03:00.0" | |
vendor_id=$(lspci -n -s "${bus_slot}" | awk '{print $3}' | cut -d\: -f1) | |
product_id=$(lspci -n -s "${bus_slot}" | awk '{print $3}' | cut -d\: -f2) | |
echo "Description: $(lspci | grep ${bus_slot})" | |
echo "VID: ${vendor_id}" | |
echo "PID: ${product_id}" | |
#what is the prefix? | |
pci_slot_with_prefix="0000:${bus_slot}" | |
echo "${pci_slot_with_prefix}" | sudo tee "/sys/bus/pci/devices/${pci_slot_with_prefix}/driver/unbind" | |
echo "${vendor_id} ${product_id}" | sudo tee "/sys/bus/pci/drivers/vfio-pci/new_id" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment