From 0f1ff9fa2e101be45b55303e21e3ace65b0a48c2 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Sat, 31 Dec 2016 01:22:49 +0100 Subject: first commit --- scripts/vfio-bind | 12 ++++++++++++ scripts/vfio-pcie-bind.service | 10 ++++++++++ 2 files changed, 22 insertions(+) create mode 100755 scripts/vfio-bind create mode 100644 scripts/vfio-pcie-bind.service (limited to 'scripts') diff --git a/scripts/vfio-bind b/scripts/vfio-bind new file mode 100755 index 0000000..f87f9c2 --- /dev/null +++ b/scripts/vfio-bind @@ -0,0 +1,12 @@ +#!/bin/bash + +modprobe vfio-pci + +for dev in "$@"; do + vendor=$(cat /sys/bus/pci/devices/$dev/vendor) + device=$(cat /sys/bus/pci/devices/$dev/device) + if [ -e /sys/bus/pci/devices/$dev/driver ]; then + echo $dev > /sys/bus/pci/devices/$dev/driver/unbind + fi + echo $vendor $device > /sys/bus/pci/drivers/vfio-pci/new_id +done diff --git a/scripts/vfio-pcie-bind.service b/scripts/vfio-pcie-bind.service new file mode 100644 index 0000000..f27dda6 --- /dev/null +++ b/scripts/vfio-pcie-bind.service @@ -0,0 +1,10 @@ +[Unit] +Description=Bind PCIe devices to the virtio driver on boot + +[Serivce] +Type=oneshot +ExecStart=/usr/local/bin/vfio-bind 0000:02:00.0 0000:02:00.1 0000:04:00.00 + +[Install] +WantedBy=multi-user.target +Before=libvirt-guests.service -- cgit v1.2.1