diff --git a/files/iommu.sh b/files/iommu.sh new file mode 100644 index 0000000..5f43528 --- /dev/null +++ b/files/iommu.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +shopt -s nullglob +lastgroup="" +for g in `find /sys/kernel/iommu_groups/* -maxdepth 0 -type d | sort -V`; do + for d in $g/devices/*; do + if [ "${g##*/}" != "$lastgroup" ]; then + echo -en "Group ${g##*/}:\t" + else + echo -en "\t\t" + fi + lastgroup=${g##*/} + lspci -nms ${d##*/} | awk -F'"' '{printf "[%s:%s]", $4, $6}' + if [[ -e "$d"/reset ]]; then echo -en " [R] "; else echo -en " "; fi + + lspci -mms ${d##*/} | awk -F'"' '{printf "%s %-40s %s\n", $1, $2, $6}' + for u in ${d}/usb*/; do + bus=$(cat "${u}/busnum") + lsusb -s $bus: | \ + awk '{gsub(/:/,"",$4); printf "%s|%s %s %s %s|", $6, $1, $2, $3, $4; for(i=7;i<=NF;i++){printf "%s ", $i}; printf "\n"}' | \ + awk -F'|' '{printf "USB:\t\t[%s]\t\t %-40s %s\n", $1, $2, $3}' + done + done +done diff --git a/linux.yaml b/linux.yaml index 31fc2ed..22dd4a7 100644 --- a/linux.yaml +++ b/linux.yaml @@ -102,6 +102,14 @@ state: present with_items: "{{ proxmox_additional_packages }}" tags: packages + # Copy IOMMU groups script + - name: copy iommu.sh script + copy: + src: "iommu.sh" + dest: "/root/iommu.sh" + owner: "root" + group: "root" + mode: '0755' - hosts: proxmox_vm:&linux roles: