Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PCI: Extend isolated function probing to s390

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>

authored by

Niklas Schnelle and committed by
Bjorn Helgaas
189c6c33 db360b1e

+9 -1
+1 -1
drivers/pci/probe.c
··· 2668 2668 * a hypervisor that passes through individual PCI 2669 2669 * functions. 2670 2670 */ 2671 - if (!jailhouse_paravirt()) 2671 + if (!hypervisor_isolated_pci_functions()) 2672 2672 break; 2673 2673 } 2674 2674 fn = next_fn(bus, dev, fn);
+8
include/linux/hypervisor.h
··· 32 32 33 33 #endif /* !CONFIG_X86 */ 34 34 35 + static inline bool hypervisor_isolated_pci_functions(void) 36 + { 37 + if (IS_ENABLED(CONFIG_S390)) 38 + return true; 39 + 40 + return jailhouse_paravirt(); 41 + } 42 + 35 43 #endif /* __LINUX_HYPEVISOR_H */