1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

scripts: fix non-root script

* load IOMMU type 1 kernel module
 * determine IOMMU group dynamically
 * add user dkr to fpga group
This commit is contained in:
Daniel Krebs 2018-03-26 14:31:51 +02:00
parent b21d6ddb9d
commit ac483b2110

12
fpga/scripts/non_root.sh Normal file → Executable file
View file

@ -1,16 +1,22 @@
#!/bin/bash
IOMMU_GROUP=24
# PCI-e parameters of FPGA card
PCI_BDF="0000:03:00.0"
PCI_VID="10ee"
PCI_PID="7022"
modprobe vfio
modprobe vfio_pci
modprobe vfio_iommu_type1
echo "10ee 7022" > /sys/bus/pci/drivers/vfio-pci/new_id
echo ${PCI_BDF} > /sys/bus/pci/drivers/vfio-pci/bind
IOMMU_GROUP=`basename $(readlink /sys/bus/pci/devices/${PCI_BDF}/iommu_group)`
# bind to vfio driver
echo "${PCI_VID} ${PCI_PID}" > /sys/bus/pci/drivers/vfio-pci/new_id
groupadd -f fpga
usermod -G fpga -a svg
usermod -G fpga -a dkr
chgrp fpga /dev/vfio/${IOMMU_GROUP}
chmod g+rw /dev/vfio/${IOMMU_GROUP}