Devices behind IOMMU would get DMA page fault error without proper IOMMU setting.
Make the identify example support setting VFIO group for those devices.
Unbind the device:
$ echo -n "0000:02:00.0" > /sys/bus/pci/devices/0000\:02\:00.0/driver/unbind
Bind to VFIO-PCI driver:
$ lspci -n -s 0000:02:00.0
02:00.0 0108: 8086:f1a8 (rev 03)
$ echo -n "8086 f1a8" > /sys/bus/pci/drivers/vfio-pci/new_id
*Find out and check the IOMMU group
$ ls -l /sys/bus/pci/devices/0000:02:00.0/iommu_group
lrwxrwxrwx 1 root root 0 May 28 12:26 /sys/bus/pci/devices/0000:02:00.0/iommu_group -> ../../../../kernel/iommu_groups/7
$ ls /dev/vfio/
7 vfio
Run the identify example
$ build/bin/nvm-identify-userspace --ctrl=02:00.0 --vfio=7
Resetting controller and setting up admin queues...
------------- Controller information -------------
PCI Vendor ID : 86 80
PCI Subsystem Vendor ID : 86 80
NVM Express version : 1.3.0
Controller page size : 4096
Max queue entries : 256
Serial Number : BTNHXXXXXXXXXXXXX
Model Number : INTEL SSDPEKNW512G8
Firmware revision : 002C
Max data transfer size : 131072
Max outstanding commands: 0
Max number of namespaces: 1
Current number of CQs : 8
Current number of SQs : 8
Devices behind IOMMU would get DMA page fault error without proper IOMMU setting. Make the identify example support setting VFIO group for those devices.
Reference document: https://www.kernel.org/doc/Documentation/vfio.txt
Usage example:
Run the identify example $ build/bin/nvm-identify-userspace --ctrl=02:00.0 --vfio=7 Resetting controller and setting up admin queues... ------------- Controller information ------------- PCI Vendor ID : 86 80 PCI Subsystem Vendor ID : 86 80 NVM Express version : 1.3.0 Controller page size : 4096 Max queue entries : 256 Serial Number : BTNHXXXXXXXXXXXXX
Model Number : INTEL SSDPEKNW512G8
Firmware revision : 002C
Max data transfer size : 131072 Max outstanding commands: 0 Max number of namespaces: 1 Current number of CQs : 8 Current number of SQs : 8
Goodbye!