Blob Blame History Raw
From: Sebastian Ott <sebott@linux.ibm.com>
Date: Wed, 12 Sep 2018 12:47:37 +0200
Subject: s390/pci: map IOV resources
Git-commit: cfbb4a7ab6bd5df7aca826b92ebb3565efd3d801
Patch-mainline: v5.1-rc1
References: jsc#SLE-5803 FATE#327056

Map IOV resources such that pci common code recognizes the IOV
capability of PFs.

Signed-off-by: Sebastian Ott <sebott@linux.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Acked-by: Petr Tesarik <ptesarik@suse.com>
---
 arch/s390/pci/pci.c |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -487,6 +487,15 @@ void arch_teardown_msi_irqs(struct pci_d
 	}
 }
 
+#ifdef CONFIG_PCI_IOV
+static struct resource iov_res = {
+	.name	= "PCI IOV res",
+	.start	= 0,
+	.end	= -1,
+	.flags	= IORESOURCE_MEM,
+};
+#endif
+
 static void zpci_map_resources(struct pci_dev *pdev)
 {
 	resource_size_t len;
@@ -500,6 +509,17 @@ static void zpci_map_resources(struct pc
 			(resource_size_t __force) pci_iomap(pdev, i, 0);
 		pdev->resource[i].end = pdev->resource[i].start + len - 1;
 	}
+
+#ifdef CONFIG_PCI_IOV
+	i = PCI_IOV_RESOURCES;
+
+	for (; i < PCI_SRIOV_NUM_BARS + PCI_IOV_RESOURCES; i++) {
+		len = pci_resource_len(pdev, i);
+		if (!len)
+			continue;
+		pdev->resource[i].parent = &iov_res;
+	}
+#endif
 }
 
 static void zpci_unmap_resources(struct pci_dev *pdev)