From bdafc17d5c5e4966b85c0ab218fb3508a6937481 Mon Sep 17 00:00:00 2001 From: Ville Granroth Date: Wed, 19 May 2021 17:58:02 +0300 Subject: [PATCH] added bunch of srcipts --- iommu.sh | 8 ++++++++ iommureset.sh | 2 ++ usbiommu.sh | 2 ++ 3 files changed, 12 insertions(+) create mode 100755 iommu.sh create mode 100755 iommureset.sh create mode 100755 usbiommu.sh diff --git a/iommu.sh b/iommu.sh new file mode 100755 index 0000000..2dad4c6 --- /dev/null +++ b/iommu.sh @@ -0,0 +1,8 @@ +#!/bin/bash +shopt -s nullglob +for g in /sys/kernel/iommu_groups/*; do + echo "IOMMU Group ${g##*/}:" + for d in $g/devices/*; do + echo -e "\t$(lspci -nns ${d##*/})" + done; +done; diff --git a/iommureset.sh b/iommureset.sh new file mode 100755 index 0000000..86ca10d --- /dev/null +++ b/iommureset.sh @@ -0,0 +1,2 @@ +#!/bin/bash +for iommu_group in $(find /sys/kernel/iommu_groups/ -maxdepth 1 -mindepth 1 -type d);do echo "IOMMU group $(basename "$iommu_group")"; for device in $(\ls -1 "$iommu_group"/devices/); do if [[ -e "$iommu_group"/devices/"$device"/reset ]]; then echo -n "[RESET]"; fi; echo -n $'\t';lspci -nns "$device"; done; done diff --git a/usbiommu.sh b/usbiommu.sh new file mode 100755 index 0000000..49d5d06 --- /dev/null +++ b/usbiommu.sh @@ -0,0 +1,2 @@ +#!/bin/bash +for usb_ctrl in /sys/bus/pci/devices/*/usb*; do pci_path=${usb_ctrl%/*}; iommu_group=$(readlink $pci_path/iommu_group); echo "Bus $(cat $usb_ctrl/busnum) --> ${pci_path##*/} (IOMMU group ${iommu_group##*/})"; lsusb -s ${usb_ctrl#*/usb}:; echo; done