From de8f54ead27aa6e944b8fa916540431d48858b09 Mon Sep 17 00:00:00 2001 From: Myned Date: Fri, 6 Dec 2024 19:43:29 -0600 Subject: [PATCH] iommu.sh: initial script Signed-off-by: Myned --- options/custom/scripts/default.nix | 5 +++++ options/custom/scripts/iommu.sh | 12 ++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 options/custom/scripts/iommu.sh diff --git a/options/custom/scripts/default.nix b/options/custom/scripts/default.nix index 719d083..5924c4b 100644 --- a/options/custom/scripts/default.nix +++ b/options/custom/scripts/default.nix @@ -94,6 +94,11 @@ in { libnotify systemd ]) + (bash "iommu" [ + coreutils + findutils + pciutils + ]) (bash "launch" [ argc coreutils diff --git a/options/custom/scripts/iommu.sh b/options/custom/scripts/iommu.sh new file mode 100644 index 0000000..11cf9a3 --- /dev/null +++ b/options/custom/scripts/iommu.sh @@ -0,0 +1,12 @@ +#! /usr/bin/env bash + +# https://wiki.archlinux.org/title/PCI_passthrough_via_OVMF#Ensuring_that_the_groups_are_valid + +shopt -s nullglob + +for g in $(find /sys/kernel/iommu_groups/* -maxdepth 0 -type d | sort -V); do + echo "IOMMU Group ${g##*/}:" + for d in "$g"/devices/*; do + echo -e "\t$(lspci -nns "${d##*/}")" + done +done