linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] PCI: Extend isolated function probing to s390
@ 2022-03-25 13:16 Niklas Schnelle
  2022-03-25 13:16 ` [PATCH 2/2] s390/pci: allow zPCI zbus without a function zero Niklas Schnelle
  0 siblings, 1 reply; 2+ messages in thread
From: Niklas Schnelle @ 2022-03-25 13:16 UTC (permalink / raw)
  To: Bjorn Helgaas, Jan Kiszka, Matthew Rosato, Pierre Morel
  Cc: linux-s390, linux-pci

Like the jailhouse hypervisor s390's PCI architecture allows passing
isolated PCI functions to an 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.

Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
 drivers/pci/probe.c        | 4 ++--
 include/linux/hypervisor.h | 9 +++++++++
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 17a969942d37..e8fd89a1f984 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2869,11 +2869,11 @@ static unsigned int pci_scan_child_bus_extend(struct pci_bus *bus,
 		nr_devs = pci_scan_slot(bus, devfn);
 
 		/*
-		 * The Jailhouse hypervisor may pass individual functions of a
+		 * Some hypervisors may pass individual functions of a
 		 * multi-function device to a guest without passing function 0.
 		 * Look for them as well.
 		 */
-		if (jailhouse_paravirt() && nr_devs == 0) {
+		if (hypervisor_isolated_pci_functions() && nr_devs == 0) {
 			for (fn = 1; fn < 8; fn++) {
 				dev = pci_scan_single_device(bus, devfn + fn);
 				if (dev)
diff --git a/include/linux/hypervisor.h b/include/linux/hypervisor.h
index fc08b433c856..52abd459f9a3 100644
--- a/include/linux/hypervisor.h
+++ b/include/linux/hypervisor.h
@@ -32,4 +32,13 @@ static inline bool jailhouse_paravirt(void)
 
 #endif /* !CONFIG_X86 */
 
+static inline bool hypervisor_isolated_pci_functions(void)
+{
+	if (IS_ENABLED(CONFIG_S390))
+		return true;
+	else
+		return jailhouse_paravirt();
+}
+
+
 #endif /* __LINUX_HYPEVISOR_H */
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-03-25 13:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-25 13:16 [PATCH 1/2] PCI: Extend isolated function probing to s390 Niklas Schnelle
2022-03-25 13:16 ` [PATCH 2/2] s390/pci: allow zPCI zbus without a function zero Niklas Schnelle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).