x86/jailhouse: Enable PCI mmconfig access in inmates
authorOtavio Pontes <otavio.pontes@intel.com>
Wed, 7 Mar 2018 07:39:14 +0000 (08:39 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 8 Mar 2018 11:30:38 +0000 (12:30 +0100)
Use the PCI mmconfig base address exported by jailhouse in boot parameters
in order to access the memory mapped PCI configuration space.

[Jan: rebased, fixed !CONFIG_PCI_MMCONFIG, used pcibios_last_bus]

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: jailhouse-dev@googlegroups.com
Cc: linux-pci@vger.kernel.org
Cc: virtualization@lists.linux-foundation.org
Cc: Bjorn Helgaas <bhelgaas@google.com>
Link: https://lkml.kernel.org/r/2ee9e4401fa22377b3965893a558120f169be82b.1520408357.git.jan.kiszka@siemens.com
arch/x86/include/asm/pci_x86.h
arch/x86/kernel/jailhouse.c
arch/x86/pci/mmconfig-shared.c

index eb66fa9..959d618 100644 (file)
@@ -151,6 +151,8 @@ extern int pci_mmconfig_insert(struct device *dev, u16 seg, u8 start, u8 end,
                               phys_addr_t addr);
 extern int pci_mmconfig_delete(u16 seg, u8 start, u8 end);
 extern struct pci_mmcfg_region *pci_mmconfig_lookup(int segment, int bus);
+extern struct pci_mmcfg_region *__init pci_mmconfig_add(int segment, int start,
+                                                       int end, u64 addr);
 
 extern struct list_head pci_mmcfg_list;
 
index b68fd89..fa183a1 100644 (file)
@@ -124,6 +124,14 @@ static int __init jailhouse_pci_arch_init(void)
        if (pcibios_last_bus < 0)
                pcibios_last_bus = 0xff;
 
+#ifdef CONFIG_PCI_MMCONFIG
+       if (setup_data.pci_mmconfig_base) {
+               pci_mmconfig_add(0, 0, pcibios_last_bus,
+                                setup_data.pci_mmconfig_base);
+               pci_mmcfg_arch_init();
+       }
+#endif
+
        return 0;
 }
 
index 0b40482..7389db5 100644 (file)
@@ -94,8 +94,8 @@ static struct pci_mmcfg_region *pci_mmconfig_alloc(int segment, int start,
        return new;
 }
 
-static struct pci_mmcfg_region *__init pci_mmconfig_add(int segment, int start,
-                                                       int end, u64 addr)
+struct pci_mmcfg_region *__init pci_mmconfig_add(int segment, int start,
+                                                int end, u64 addr)
 {
        struct pci_mmcfg_region *new;