virtio: multiple fixes

Review Request #86 — Created Aug. 25, 2015 and submitted — Latest diff uploaded

avgapon
illumos-gate
6166
dffde8c...
general
  • virtio_register_msi: handle alloc/free size mismatch.

  • virtio_register_msi: do not destroy sc_intr_htable if everything goes well.
    Explicitly return success instead of falling through to the error handling code.

  • virtio_enable_msi: disable interrupts in out_bind error handling block.

  • virtio: do not switch to 24-byte offset until MSI-X mode is enabled:

    • be explicit that it is MSI-X mode that requires 24-byte offset, not MSI;
    • set 20-byte offset as early as possible;
    • remember the interrupt type in virtion_register_*, use it in virtio_enable_msi.

Tested in a bhyve VM configured to provide virtio-net and virtio-block devices.

$ echo '::interrupts -d' | mdb -k
IRQ  Vect IPL Bus    Trg Type   CPU Share APIC/INT# Driver Name(s)
1    0x42 5   ISA    Edg Fixed  0   1     0x0/0x1   i8042#1
4    0xb0 12  ISA    Edg Fixed  0   1     0x0/0x4   asy#1
9    0x80 9   PCI    Lvl Fixed  0   1     0x0/0x9   acpi_wrapper_isr
12   0x43 5   ISA    Edg Fixed  0   1     0x0/0xc   i8042#1
24   0x40 5   PCI    Edg MSI-X  0   1     -         vioblk#0
25   0x41 5   PCI    Edg MSI-X  0   1     -         vioblk#0
26   0x60 6   PCI    Edg MSI-X  0   1     -         vioif#2
27   0x61 6   PCI    Edg MSI-X  0   1     -         vioif#2
208  0xd0 14         Edg IPI    all 1     -         kcpc_hw_overflow_intr
209  0xd1 14         Edg IPI    all 1     -         cbe_fire
240  0xe0 15         Edg IPI    all 1     -         apic_error_intr
Loading...