Project

General

Profile

Actions

Bug #6166

closed

fix MSI-X support in virtio driver

Added by Andriy Gapon almost 6 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
driver - device drivers
Start date:
2015-08-26
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:

Description

  • There is an obvious size mismatch for allocation and deallocation of sc_intr_htable in virtio_register_msi as handler_count and count are not necessarily equal.
  • Rather obviously, there is a missing return statement in virtio_register_msi for the success case. Currently the control flow just proceeds to the error handling code where sc_intr_htable is destroyed.
  • It seems that virtio_enable_msi misses the interrupt teardown code for the case where ddi_intr_enable / ddi_intr_block_enable are 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 sc_config_offset to VIRTIO_CONFIG_DEVICE_CONFIG_MSI in virtio_register_msi.
    I believe that MSI-X is not actually activated until virtio_enable_msi successfully calls ddi_intr_enable or ddi_intr_block_enable.
  • 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.

Related issues

Blocks illumos gate - Bug #6341: virtio doesn't try hard enough to get MSI interruptsRejected2015-10-16

Actions
Blocks illumos gate - Bug #6340: virtio lies about falling back to INTx interruptsClosed2015-10-16

Actions
Actions

Also available in: Atom PDF