Skip to content

Instantly share code, notes, and snippets.

View arthurrasmusson's full-sized avatar

Arthur Rasmusson arthurrasmusson

View GitHub Profile
@arthurrasmusson
arthurrasmusson / list-iommu-groups.sh
Created March 3, 2023 15:19
list-iommu-groups: A simple script to list IOMMU Groups on a device from the (VFIO in 2019) article from Level1Techs Forum.
#!/bin/bash
for d in /sys/kernel/iommu_groups/*/devices/*; do
n=${d#*/iommu_groups/*}; n=${n%%/*}
printf 'IOMMU Group %s ' "$n"
lspci -nns "${d##*/}"
done
@arthurrasmusson
arthurrasmusson / simple_vgpu_script.sh
Last active May 5, 2023 20:26
Creates vGPUs using sysfs. Basically it echos values.
#!/bin/bash
#
# This script creates a vGPU by echoing values into sysfs.
# Once this script has been run you'll have a passthrough-ready vGPU
# (bound to vfio-pci) inside /sys/bus/pci/devices/ matching
# the parent device address (PF) and virtual device address (VF).
# For example:
# /sys/bus/pci/devices/0000:d0:00.0/virtfn0/
# or
# /sys/bus/pci/devices/0000:d0:00.1/
@arthurrasmusson
arthurrasmusson / remove-all-mdevs.sh
Created February 11, 2022 21:30
Stops all mdevs - useful for debugging.
#!/bin/bash
echo 1 > /sys/class/mdev_bus/*/*-*-*-*-*/remove