From: Waldemar Kozaczuk <jwkozac...@gmail.com>
Committer: Nadav Har'El <n...@scylladb.com>
Branch: master

Fixed pci::function constructor to explicitly initialize msi flags

This trivial patch addresses the bug identified during investigation of
the issue #917 which describes random instances of OSv hanging when
booting on VirtualBox.

During boot process OSv probes and initializes AHCI driver which
requires setting up appropriate interrupt handler like so:

    if (_pci_dev.is_msix() || _pci_dev.is_msi() ) {
        _msi.easy_register({ { 0, [=] { ack_irq(); }, nullptr} });
    } else {
        _gsi.reset(new gsi_level_interrupt(_pci_dev.get_interrupt_line(),
[=] { return ack_irq(); }, [] {}));
    }

Because _have_msi and _msi_enabled member variables of pci::function
object are not explicitly initialized during instantiation they may
lead to false positive detection of MSI capability where in reality
GSI (Global System Interrupt) is only available.

Concluding this patch forces explicit initialization of _have_msi and
 _msi_enabled to false.

Fixes #917

Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com>
Message-Id: <1507694716-31676-1-git-send-email-jwkozac...@gmail.com>

---
diff --git a/drivers/pci-function.cc b/drivers/pci-function.cc
--- a/drivers/pci-function.cc
+++ b/drivers/pci-function.cc
@@ -178,7 +178,7 @@ namespace pci {
     }

     function::function(u8 bus, u8 device, u8 func)
- : _bus(bus), _device(device), _func(func), _have_msix(false), _msix_enabled(false) + : _bus(bus), _device(device), _func(func), _have_msix(false), _msix_enabled(false), _have_msi(false), _msi_enabled(false)
     {

     }

--
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to