3

I am using the IOMMU API for linux and I would like to get a specific device that belongs to a specific group of a known group ID.

The iommu_group structure has a field for the device list but it is not accessible. Is there a way to get it?

John Vardas
  • 31
  • 1
  • 1
  • 3

3 Answers3

5

Please try:

find /sys/kernel/iommu_groups/ -type l

Rami Rosen

Louis Maddox
  • 5,226
  • 5
  • 36
  • 66
Rami Rosen
  • 330
  • 2
  • 2
1

Question too short. Neither the computer description, neither level of your knowledge. Also the time is a little passed.

Well, iommu groups are mainly used for passing the device through the host computer to hosted virtual machine.

You definitely must have mother-board, BIOS, CPU, and kernel supporting virtual technologies with all necessary switches enabled and modules loaded. Than you can list a pci devices and their iommu grouping. By using Linux kernel > 4.2 (I use kernel 4.8 in Debian 9) you can simply type:

# dmesg |egrep group |awk '{print $NF" "$0}' |sort -n

as root to obtain the group sorted listing of PCI devices.

There are standard and shortned methods how to unbind the group member devices from the kernel driver and how to rebind it with dummy pci-stub or vfio-pci driver.

In case I told here something you know, sorry you didnot tell me enough I can note it. :-)

J.

schweik
  • 164
  • 7
0

if you want to know which device corresponds to each link u can feed them to lspci -nns to get a hint.

find /sys/kernel/iommu_groups/ -type l -exec basename {} \; \
 | xargs -I % lspci -nns %

Inspiration taken from here

If you want to know the devices for each group in a nice formatted list, see this gist

Booker B
  • 131
  • 2
  • 9