Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- configfile=/etc/vfio-pci1.cfg
- vfiobind() {
- dev="$1"
- vendor=$(cat /sys/bus/pci/devices/$dev/vendor)
- device=$(cat /sys/bus/pci/devices/$dev/device)
- if [ -e /sys/bus/pci/devices/$dev/driver/module/drivers/pci\:vfio-pci ]; then
- echo "Skipping $dev because it is already using the vfio-pci driver"
- continue;
- fi
- if [ -e /sys/bus/pci/devices/$dev/driver ]; then
- echo "Unbinding $dev"
- echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
- echo "Unbound $dev"
- fi
- echo "Plugging $dev into vfio-pci"
- echo $vendor $device > /sys/bus/pci/drivers/vfio-pci/new_id
- echo "Plugged $dev into vfio-pci"
- }
- modprobe vfio-pci
- cat $configfile | while read line;do
- echo $line | grep ^# >/dev/null 2>&1 && continue
- vfiobind $line
- done
- qemu-system-x86_64 \
- -enable-kvm \
- -M q35 \
- -m 8192 \
- -cpu host,kvm=off \
- -smp 4,sockets=1,cores=4,threads=1 \
- -vga none \
- -nographic \
- -nodefaults \
- -device ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1 \
- -device vfio-pci,host=01:00.0,x-vga=on \
- -device vfio-pci,host=01:00.1 \
- -device virtio-scsi-pci,id=scsi \
- -drive file=/home/shi/windows1.img,id=disk,format=raw,if=none -device scsi-hd,drive=disk \
- -drive file=/home/shi/win10/win10.iso,id=isocd,format=raw,if=none -device scsi-cd,drive=isocd \
- -boot strict=on
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement