From 76777c40a6d4651eee3091a414a398cf43e0d00b Mon Sep 17 00:00:00 2001 From: Jared Johnstone Date: Wed, 7 Oct 2020 14:46:17 +1100 Subject: [PATCH] Added flag: -iommugroups to color-print iommu groups then exit. --- README.md | 6 +++++- main | 10 ++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 84f4dc0..d346ab8 100644 --- a/README.md +++ b/README.md @@ -143,7 +143,7 @@ This example would catch any: 3. A PCI device with ID `10ec:8168`. -`-taskset 0,1,2,3,4,5` / `-taskset 0,2,4,8` +`-taskset 0,1,2,3,4,5` / `-taskset 0,2,4,8` The taskset argument will take the threads you give it and only lets the VM execute on those threads. It also creates only that many threads on the VM. (6 and 4 in the examples respectively) This can significantly reduce latency if the guestis having trouble, even if you haven't configured any host pinning. @@ -157,6 +157,10 @@ This example would catch any: A quick terminal color test then exits. +`-iommugroups` / `-iommugrouping` + + Prints IOMMU groupings if available then exists. + ## Notes and Gotchas. - If you don't set any `-usb` or `-pci` arguments the VM will run in a window on your desktop as is normal for Qemu. Useful for testing the VM actually boots, installing OSes or using liveCDs. - The absolute minimum requirement to get started is the `-image` and `-iso` arguments with OVMF available. You can install an OS, VirtIO+Nvidia drivers if needed, and have it ready for a passthrough on the next boot. diff --git a/main b/main index 1fdb5a7..078741f 100755 --- a/main +++ b/main @@ -310,10 +310,16 @@ while [ $# -gt 0 ] do case "$1" in -colortest|-colourtest) - echo "Ok, doing a color test then exiting..." + echo -e "${colors[green]}Ok, printing a color test then exiting...${colors[white]}" for i in $(sort <<< ${!colors[@]}) ; do echo -e "Test for: ${colors[$i]}$i ${colors[white]}" ; done - exit 0 + exit $? ;; + -iommugroups|-iommugrouping) + echo -e "${colors[green]}Ok, printing IOMMU Groups then exiting...${colors[white]}" + iommuDir="/sys/kernel/iommu_groups"; + if [ -d $iommuDir ]; then for g in `ls -1v $iommuDir`; do echo "IOMMU Group $g"; for d in $iommuDir/$g/devices/* ; do echo -e "${colors[cyan]}\t$(lspci -nns ${d##*/})${colors[white]}"; done; done ; else echo "Couldn't find $iommuDir" ; fi + exit $? + ;; -bridge|-BRIDGE) bridgeArgs="$(sed 's/,/ /g' <<<$2)" shift