ls-iommu
A tool to list devices in iommu groups, useful for setting up VFIO
This tool is a go implementation and extension to the small bash script provided by Wendell from Level1Techs. It's purpose was to just list every device and their associated IOMMU group.
This project does the same thing, but extends the functionality by implementing arguments to list the output in different ways or provide just the details needed without having to hop through grep, sed, awk or perl pipe hoops.
Currently the program supports the same behavior as Wendell's ls-iommu script but can also be told to display only devices in selected IOMMU groups, only GPUs or only USB controllers and also locate related devices.
More extended functionality is planned.
Features
- Has a flag to generate default ouptut text compatible with the bash version of ls-iommu (
--legacy
) - Can locate and display only GPUs, USB Controllers and Network cards
- List devices of individual or multiple IOMMU groups
- Can show you kernel driver info for the devices
- Can attempt to get related devices (devices that share vendorID) or devices located in the same IOMMU group as the device(s), the best method is used for -r depending on what you look for.
- Flag to list only VendorID:DeviceID for all devices found
- Flag to list only PCI Address for all devices found
- A flag you can use to ignore specific VendorIDs when doing a related devices search
- Can show only the info you are interested in on the device line using -F and then providing a comma separated list of objects you want to show on the device line (this does not affect the extra lines provided by
-k
) - Has a flag to get the vbios path for gpus (
-g --rom
or-g -i X --rom
)
Build instructions
Prerequisites:
- Go 1.20+
- git
git clone https://github.com/HikariKnight/ls-iommu.git
cd ls-iommu
CGO_ENABLED=0 go build
The binary ls-iommu
will now be located the root of the project directory.
Nvidia GPU is not shown
I have a Lenovo Ideapad 5 15ITL05 laptop with Intel TigerLake-LP GT2 [Iris Xe Graphics] and NVIDIA GeForce MX450.
When I run the command
lspci -nn | grep NVIDIA
, it lists my NVIDIA GPU:01:00.0 3D controller [0302]: NVIDIA Corporation TU117M [GeForce MX450] [10de:1f97] (rev a1)
However, the output of
ls-iommu -g
only shows my Intel integrated GPU:IOMMU Group 0: 0000:00:02.0 VGA compatible controller [0300] Intel Corporation TigerLake-LP GT2 [Iris Xe Graphics] [8086:9a49] (rev 01)
I saw this in your code. Does this mean my laptop does not support GPU passthrough because of Nvidia being "3D controller" and not "VGA compatible controller"?
Error: failed to determine memory area for node
Just adding this here to keep track of it
First reported in: https://github.com/HikariKnight/quickpassthrough/issues/13
however the issue is rooted in ls-iommu and the ghw library. current fix will be to wait for a new release of ghw as a patch to fix this bug has been made but not merged
Temporary solution is to add main branch to go.mod while waiting for a new release