ra1nstorm / ra1nstorm-helper

Automatically configures an environment to run checkra1n
MIT License
219 stars 113 forks source link

Whole iommu-group passed through while my nic is in same group than my usb controller #131

Open rubentroncon opened 4 years ago

rubentroncon commented 4 years ago

Hi

I got the qemu MacOS VM running, but I'm having trouble with the PCI passthrough.

At the time of the setup, ra1nstorm correctly detected that the usb controller on which my iphone is connecting is residing on 00:14.0, which seems to fall under iommu_group 5 in my case. However, my nic also falls under that same iommu_group. The default scripts included with ra1nstorm iterate over the whole group, trying to bind every device under that iommu_group.

./BootVM.sh 
ioctl(TUNSETIFF): Device or resource busy
0000:00:14.0
0000:00:14.2
0000:00:14.3
0x8086 0x9ded
QEMU 4.2.0 monitor - type 'help' for more information
(qemu) qemu-system-x86_64: vfio: Cannot reset device 0000:00:14.0, no available reset mechanism.
qemu-system-x86_64: vfio: Cannot reset device 0000:00:14.0, no available reset mechanism.
0x8086 0x9ded
0000:00:14.0
0x8086 0x9def
0000:00:14.2
0x8086 0x9df0
0000:00:14.3
0000:00:14.0
0000:00:14.2
0000:00:14.3

This means that the VM starts, and the iphone is passed through perfectly, but as soon as the VM starts, my host loses the NIC, in so doing losing all network connections. As such I can't continue to download checkra1n.

I already tried editing the vfio-group.sh and vfic-ungroup.sh to statically define the USB controller (00:14.0) and not the other devices (NIC is on 00:14.3), but then qemu complains that not all devices in the iommu_group are bound to their vfio bus driver.

# ./BootVM.sh 
0000:00:14.0
0x8086 0x9ded
QEMU 4.2.0 monitor - type 'help' for more information
(qemu) qemu-system-x86_64: -device vfio-pci,host=00:14.0,bus=pcie.0: vfio 0000:00:14.0: group 5 is not viable
Please ensure all devices within the iommu_group are bound to their vfio bus driver.
0x8086 0x9ded
0000:00:14.0
0000:00:14.0