PCI: Extend isolated function probing to s390
authorNiklas Schnelle <schnelle@linux.ibm.com>
Tue, 28 Jun 2022 14:30:59 +0000 (16:30 +0200)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 22 Jul 2022 21:06:03 +0000 (16:06 -0500)
Like the jailhouse hypervisor, s390's PCI architecture allows passing
isolated PCI functions to a guest OS instance. As of now this is was not
utilized even with multi-function support as the s390 PCI code makes sure
that only virtual PCI busses including a function with devfn 0 are
presented to the PCI subsystem. A subsequent change will remove this
restriction.

Allow probing such functions by replacing the existing check for
jailhouse_paravirt() with a new hypervisor_isolated_pci_functions() helper.

Link: https://lore.kernel.org/r/20220628143100.3228092-5-schnelle@linux.ibm.com
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Pierre Morel <pmorel@linux.ibm.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>
drivers/pci/probe.c
include/linux/hypervisor.h

index 1f91ed6..4948531 100644 (file)
@@ -2668,7 +2668,7 @@ int pci_scan_slot(struct pci_bus *bus, int devfn)
                         * a hypervisor that passes through individual PCI
                         * functions.
                         */
-                       if (!jailhouse_paravirt())
+                       if (!hypervisor_isolated_pci_functions())
                                break;
                }
                fn = next_fn(bus, dev, fn);
index fc08b43..9efbc54 100644 (file)
@@ -32,4 +32,12 @@ static inline bool jailhouse_paravirt(void)
 
 #endif /* !CONFIG_X86 */
 
+static inline bool hypervisor_isolated_pci_functions(void)
+{
+       if (IS_ENABLED(CONFIG_S390))
+               return true;
+
+       return jailhouse_paravirt();
+}
+
 #endif /* __LINUX_HYPEVISOR_H */