This ensures that no vector is left over from the previous usage that
could trigger unexpected or even invalid interrupts when the new user
starts configuring the device.

Signed-off-by: Jan Kiszka <[email protected]>
---
 hypervisor/pci.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/hypervisor/pci.c b/hypervisor/pci.c
index 913fde5..2f95dd7 100644
--- a/hypervisor/pci.c
+++ b/hypervisor/pci.c
@@ -577,10 +577,16 @@ void pci_reset_device(struct pci_device *device)
        pci_write_config(device->info->bdf, PCI_CFG_COMMAND,
                         PCI_CMD_INTX_OFF, 2);
 
-       for_each_pci_cap(cap, device, n)
+       for_each_pci_cap(cap, device, n) {
                if (cap->id == PCI_CAP_MSI || cap->id == PCI_CAP_MSIX)
                        /* Disable MSI/MSI-X by clearing the control word. */
                        pci_write_config(device->info->bdf, cap->start+2, 0, 2);
+               if (cap->id == PCI_CAP_MSIX)
+                       /* Mask each MSI-X vector also physically. */
+                       for (n = 0; n < device->info->num_msix_vectors; n++)
+                               mmio_write32(&device->msix_table[n].raw[3],
+                                            device->msix_vectors[n].raw[3]);
+       }
 }
 
 static int pci_add_physical_device(struct cell *cell, struct pci_device 
*device)
-- 
2.1.4

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to