]> rtime.felk.cvut.cz Git - jailhouse.git/commitdiff
core: Disable non-root PCI devices on shutdown
authorJan Kiszka <jan.kiszka@siemens.com>
Thu, 7 May 2015 17:27:12 +0000 (19:27 +0200)
committerJan Kiszka <jan.kiszka@siemens.com>
Thu, 7 May 2015 17:30:51 +0000 (19:30 +0200)
We already disable PCI devices that are removed when a cell is
destroyed but we should also do this on hypervisor shutdown to avoid
that those device later on annoy Linux with unexpected activities.

The change is bigger as it re-indents the shutdown loop to maintain
readability.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
hypervisor/pci.c

index 41e5b3551c76b72955f42ec2e177b8dfe67fcd7c..46826aea7764f91891d570ce94e7aa9d6fdbdf7c 100644 (file)
@@ -807,11 +807,18 @@ void pci_shutdown(void)
        if (!root_cell.pci_devices)
                return;
 
-       for_each_configured_pci_device(device, &root_cell)
-               if (device->cell)
-                       for_each_pci_cap(cap, device, n)
-                               if (cap->id == PCI_CAP_MSI)
-                                       pci_restore_msi(device, cap);
-                               else if (cap->id == PCI_CAP_MSIX)
-                                       pci_restore_msix(device, cap);
+       for_each_configured_pci_device(device, &root_cell) {
+               if (!device->cell)
+                       continue;
+
+               for_each_pci_cap(cap, device, n)
+                       if (cap->id == PCI_CAP_MSI)
+                               pci_restore_msi(device, cap);
+                       else if (cap->id == PCI_CAP_MSIX)
+                               pci_restore_msix(device, cap);
+
+               if (device->cell != &root_cell)
+                       pci_write_config(device->info->bdf, PCI_CFG_COMMAND,
+                                        PCI_CMD_INTX_OFF, 2);
+       }
 }