-
Notifications
You must be signed in to change notification settings - Fork 373
Need to add support for passing generic pci devices with VFIO #155
Comments
From @amshinde on November 18, 2017 19:39 There does not seem to be straight forward way to do this, as the device node and sysfs tree for devices is different for different devices. For eg, this is how the audio and graphics cards look on a machine that I was testing:
For the graphics device, the device nodes appear as :
Navigating sysfs based on major and minor number gives:
For the audio device, things were a bit different
In this case, the device symlink under sysfs does not give the pci device
Essentially one more traversal yielded the pci device information:
In summary, the structure of the device nodes varies from device to device. However instead of relying on the device symlinks under /sys/dev/char/$major-$minor/, I relaized that the path itself points to pci information:
graphics:
We can consider looking at the pci information in the above symlinks to decide if a device is pci and can be passed through VFIO. |
@amshinde @mcastelino -- in the initial comment for this, you talk about needing to verify its a PCI device and in its own iommu group. Do we really need to do this checking? Existing hypervisor should fail if it doesn't, and we could just make sure that the errors are propogated back appropriately? In general, is there more action required on this issue wrt Kata? |
From @sboeuf on March 9, 2018 19:46 After some discussions with @amshinde, we need to find a way to identify the device inside the VM. We need one identifier which will help us so that we can reliably find the device we've been passing through. This way, we can make it show up as the expected path |
@egernst, it's not clear to me if you're talking about rebinding drivers in the host, or the guest. If the guest, then I have draft code for this (working, but needs polish before merging). See #2938 for tracking. If the host, then this seems out of scope for an OCI runtime. It's input is the OCI runtime spec which gives /dev nodes, not PCI devices as PCI devices, implying they have already been rebound on the surrounding host. |
From @amshinde on November 18, 2017 19:33
Refer clearcontainers/runtime#821
We currently have support for passing vfio device groups with --device. The user is expected to perform the bind to vfio-pci for this.
We need to add support for the runtime to check if a device passed is a pci device and then pass it the container VM using pci passthrough/vfio. We need to make sure that the device is the only device in its iommo group. The runtime would then unbind the device from its current kernel driver and assign the device to vfio-pci, passing it to the VM with pci-passthrough. When the container exits, the runtime would then need to bind the device back to its host driver.
Copied from original issue: containers/virtcontainers#489
The text was updated successfully, but these errors were encountered: