lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 22 Sep 2015 16:49:17 -0700
From:	David Daney <ddaney.cavm@...il.com>
To:	linux-kernel@...r.kernel.org, Bjorn Helgaas <bhelgaas@...gle.com>,
	linux-pci@...r.kernel.org, Will Deacon <will.deacon@....com>,
	Rob Herring <robh+dt@...nel.org>,
	Pawel Moll <pawel.moll@....com>,
	Mark Rutland <mark.rutland@....com>,
	Ian Campbell <ijc+devicetree@...lion.org.uk>,
	Kumar Gala <galak@...eaurora.org>,
	linux-arm-kernel@...ts.infradead.org, devicetree@...r.kernel.org,
	Marc Zyngier <marc.zyngier@....com>
Cc:	David Daney <david.daney@...ium.com>
Subject: [PATCH v3 6/6] PCI: generic: Claim device resources if PCI_PROBE_ONLY

From: David Daney <david.daney@...ium.com>

In the case where the PCI_PROBE_ONLY flag is set, we need to claim the
resources for all PCI devices added to the bus.  Failure to claim
SRIOV BAR resources prevents SRIOV devices from being being enabled.

So, when the PCI_PROBE_ONLY flag is set, claim MEM and IO resources
for all devices that were added to the bus.

Signed-off-by: David Daney <david.daney@...ium.com>
---
Added this patch in v3.

 drivers/pci/host/pci-host-generic.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/drivers/pci/host/pci-host-generic.c b/drivers/pci/host/pci-host-generic.c
index e364232..b163fdc 100644
--- a/drivers/pci/host/pci-host-generic.c
+++ b/drivers/pci/host/pci-host-generic.c
@@ -209,6 +209,24 @@ static int gen_pci_parse_map_cfg_windows(struct gen_pci *pci)
 	return 0;
 }
 
+static int gen_pci_claim_resource_cb(struct pci_dev *dev, void *arg)
+{
+	int resno;
+
+	for (resno = 0; resno < PCI_BRIDGE_RESOURCES; resno++) {
+		struct resource *res = &dev->resource[resno];
+
+		/* If it already has a parent, don't claim it. */
+		if (res->parent)
+			continue;
+
+		if (resource_type(res) == IORESOURCE_MEM ||
+		    resource_type(res) == IORESOURCE_IO)
+			pci_claim_resource(dev, resno);
+	}
+	return 0;
+}
+
 static int gen_pci_probe(struct platform_device *pdev)
 {
 	int err;
@@ -277,6 +295,9 @@ static int gen_pci_probe(struct platform_device *pdev)
 	}
 
 	pci_bus_add_devices(bus);
+
+	if (pci_has_flag(PCI_PROBE_ONLY))
+		pci_walk_bus(bus, gen_pci_claim_resource_cb, NULL);
 	return 0;
 }
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ