Skip to content

Commit

Permalink
core: pci: Mask MSI-X vectors on reset also physically
Browse files Browse the repository at this point in the history
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 <jan.kiszka@siemens.com>
  • Loading branch information
jan-kiszka committed Jan 14, 2017
1 parent 10f24b2 commit 6446553
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion hypervisor/pci.c
Expand Up @@ -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)
Expand Down

0 comments on commit 6446553

Please sign in to comment.