On Fri, 28 Jul 2023 06:20:36 -0400 Normand Leclerc <leclercnorm@xxxxxxxxxxxx> wrote: > Hi, > > I have a CameraLink capture card of which I do not have Linux > drivers. I wanted to used it in Windows 11 under KVM. > > I have managed to have the card recognized in the OS, installed > drivers and the system does see the clock and data valid; great! But > this doesn’t happen without hickups; KVM has to be started twice. > The first time KVM starts, the driver tells me that there is not > enough ressources for the API. > > Even though the card seems to be working well, I cannot capture > anything. The software is not able to fully use the card. > > The system is: > AMD Ryzen 7950x3d > ASROCK Steel Legend x670e > Teledyne XTIUM-CL MX4 (capture card) > Archlinux system (Linux omega 6.4.6-artix1-1 #1 SMP PREEMPT_DYNAMIC > Wed, 26 Jul 2023 13:47:50 +0000 x86_64 GNU/Linux) > > lspci after boot for the card: > > 01:00.0 Memory controller [0580]: Coreco Inc Device [11ec:f81b] > Flags: fast devsel, IRQ 255, IOMMU group 12 > Memory at fb000000 (32-bit, non-prefetchable) [disabled] > [size=16M] Capabilities: [80] Power Management version 3 > Capabilities: [90] MSI: Enable- Count=1/1 Maskable- 64bit+ > Capabilities: [c0] Express Endpoint, MSI 00 > Capabilities: [100] Advanced Error Reporting > Capabilities: [150] Device Serial Number > 00-00-00-00-00-00-00-00 Capabilities: [300] Secondary PCI Express > > > After vfio driver assignment: > > 01:00.0 Memory controller [0580]: Coreco Inc Device [11ec:f81b] > Flags: fast devsel, IRQ 255, IOMMU group 12 > Memory at fb000000 (32-bit, non-prefetchable) [disabled] > [size=16M] Capabilities: [80] Power Management version 3 > Capabilities: [90] MSI: Enable- Count=1/1 Maskable- 64bit+ > Capabilities: [c0] Express Endpoint, MSI 00 > Capabilities: [100] Advanced Error Reporting > Capabilities: [150] Device Serial Number > 00-00-00-00-00-00-00-00 Capabilities: [300] Secondary PCI Express > Kernel driver in use: vfio-pci > > Starting KVM first time (second time is the same): > > 01:00.0 Memory controller [0580]: Coreco Inc Device [11ec:f81b] > Flags: fast devsel, IRQ 135, IOMMU group 12 > Memory at fb000000 (32-bit, non-prefetchable) [disabled] > [size=16M] Capabilities: [80] Power Management version 3 > Capabilities: [90] MSI: Enable- Count=1/1 Maskable- 64bit+ > Capabilities: [c0] Express Endpoint, MSI 00 > Capabilities: [100] Advanced Error Reporting > Capabilities: [150] Device Serial Number > 00-00-00-00-00-00-00-00 Capabilities: [300] Secondary PCI Express > Kernel driver in use: vfio-pci > > First time KVM starts, lsirq does not show IRQ 135; second time, it > does. > > If kernel has not been started with irqpoll, I get the infamous > “nobody cared” message and irq135 gets disabled. Running kernel with > irqpoll, lsirq shows a whole bunch on interrupts (probably at each > frame the grabber sees). > > It is as if the interrupt assigned to the card is not what KVM is > using to pass down to the guest Windows machine. The interrupt does > not get to the capture card’s software and it fails. The "irqpoll" option the kernel suggests for spurious interrupts really doesn't work with device assignment. It sounds like INTx disable and/or status reporting is broken on this device. The device supports MSI, but clearly doesn't seem to be using it. You can read a bit about how vfio interrupts work and how you might make Windows use MSI here: http://vfio.blogspot.com/2014/09/vfio-interrupts-and-how-to-coax-windows.html Another option is to use the nointxmask=1 option of the vfio-pci module which will register the legacy INTx interrupt of the device as exclusive. This removes our dependency on working INTx disable and status reporting, but it comes at the cost of sometimes being very difficult to configure. You might need to install the card into a different slot or potentially even disable other drivers for devices that try to share the interrupt line with this device. Thanks, Alex