fix MSI-X support in virtio driver
driver - device drivers
- There is an obvious size mismatch for allocation and deallocation of
countare not necessarily equal.
- Rather obviously, there is a missing return statement in
virtio_register_msifor the success case. Currently the control flow just proceeds to the error handling code where
- It seems that
virtio_enable_msimisses the interrupt teardown code for the case where
ddi_intr_block_enableare successful, but there is a later error.
- My understanding of the VirtIO specification is that the 24-byte offset for PCI configuration accesses should be used only when MSI-X mode is enabled for a device.
That is, only when the enable bit is set in the control register of the MSI-X capabilities. But currently the code sets
I believe that MSI-X is not actually activated until
- It seems that there is a little bit of confusion in the code between MSI and MSI-X handling.
I believe that the 20-byte offset should be used if MSI but not MSI-X happens to be supported (even if otherwise MSI is much more similar to MSI-X than to the legacy interrupts mode).
At least, the VirtIO specification explicitly talks about the 24-byte offset only for MSI-X mode.