]> rtime.felk.cvut.cz Git - jailhouse.git/commitdiff
pci: add list for virtual PCI devices to cell, makes lookup faster
authorHenning Schild <henning.schild@siemens.com>
Mon, 24 Nov 2014 17:54:13 +0000 (18:54 +0100)
committerJan Kiszka <jan.kiszka@siemens.com>
Wed, 26 Nov 2014 18:21:16 +0000 (19:21 +0100)
Add a list of virtual PCI devices to a cell, that way we do need to go
through all PCI devices when looking for virtual ones. This lookup is on
the mmio path, which should be fast.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
hypervisor/arch/x86/include/asm/cell.h
hypervisor/include/jailhouse/pci.h
hypervisor/pci.c

index 18a32743df11aae6ef1585d6b62db026aef0e67a..66f5f7f740e16ad93e1c6f6a1ebc295697815b31 100644 (file)
@@ -74,6 +74,8 @@ struct cell {
        struct pci_device *pci_devices;
        /** List of PCI devices assigned to this cell that support MSI-X. */
        struct pci_device *msix_device_list;
+       /** List of virtual PCI devices assigned to this cell. */
+       struct pci_device *virtual_device_list;
        /** Shadow value of PCI config space address port register. */
        u32 pci_addr_port_val;
 
index 0fa9e5f02e1b221048ca00c2f67e438c8947077c..5f5703841510d42b136c519a639fb83d56f144aa 100644 (file)
@@ -122,6 +122,8 @@ struct pci_device {
        union pci_msix_registers msix_registers;
        /** Next PCI device in this cell with MSI-X support. */
        struct pci_device *next_msix_device;
+       /** Next virtual PCI device in this cell. */
+       struct pci_device *next_virtual_device;
        /** Real MSI-X table. */
        union pci_msix_vector *msix_table;
        /** Shadow state of MSI-X table. */
index 76b97bdd14ddcc7fa4646748be7ae076931f6774..489579c8849dafb4bcefee0765c7681fdfd2bb0f 100644 (file)
@@ -519,6 +519,13 @@ void pci_prepare_handover(void)
        }
 }
 
+static void pci_add_virtual_device(struct cell *cell, struct pci_device *device)
+{
+       device->cell = cell;
+       device->next_virtual_device = cell->virtual_device_list;
+       cell->virtual_device_list = device;
+}
+
 static int pci_add_device(struct cell *cell, struct pci_device *device)
 {
        unsigned int size = device->info->msix_region_size;
@@ -556,6 +563,19 @@ error_remove_dev:
        return err;
 }
 
+static void pci_remove_virtual_device(struct pci_device *device)
+{
+       struct pci_device *prev = device->cell->virtual_device_list;
+
+       if (prev == device) {
+               device->cell->virtual_device_list = device->next_virtual_device;
+       } else {
+               while (prev->next_virtual_device != device)
+                       prev = prev->next_virtual_device;
+               prev->next_virtual_device = device->next_virtual_device;
+       }
+}
+
 static void pci_remove_device(struct pci_device *device)
 {
        unsigned int size = device->info->msix_region_size;