Pcifront patches from Konrad Wilk plus another fix

devel-3.9
Rafal Wojtczuk 14 years ago
parent 4747049199
commit e62da971bc

@ -0,0 +1,55 @@
http://git.kernel.org/?p=linux/kernel/git/konrad/xen.git;a=commit;h=621d869f36b215d63bb99e7ecd7a11f029821b85
xen-pcifront: Claim PCI resources before going live.
author Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Fri, 18 Jun 2010 19:31:47 +0000 (15:31 -0400)
committer Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Fri, 18 Jun 2010 19:40:37 +0000 (15:40 -0400)
We were missing the important step of claiming (and setting the
parent of IO and MEM regions to 'PCI IO' and 'PCI mem' respectivly)
of the BARs. This meant that during hot inserts we would get:
igb 0000:01:00.1: device not available (can't reserve [mem 0xfb840000-0xfb85ffff])
even thought the memory region had been reserved before.
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
--- linux-2.6.34.1/drivers/xen/pcifront/pci_op.c.orig2 2010-09-29 16:31:58.702675503 +0200
+++ linux-2.6.34.1/drivers/xen/pcifront/pci_op.c 2010-09-29 16:38:47.260675349 +0200
@@ -426,7 +426,7 @@ static int pcifront_claim_resource(struc
r = &dev->resource[i];
if (!r->parent && r->start && r->flags) {
- dev_dbg(&pdev->xdev->dev, "claiming resource %s/%d\n",
+ dev_info(&pdev->xdev->dev, "claiming resource %s/%d\n",
pci_name(dev), i);
pci_claim_resource(dev, i);
}
@@ -516,14 +516,15 @@ int __devinit pcifront_scan_root(struct
list_add(&bus_entry->list, &pdev->root_buses);
+ /* pci_scan_bus_parented skips devices which do not have a have
+ * devfn==0. The pcifront_scan_bus enumerates all devfn. */
+ err = pcifront_scan_bus(pdev, domain, bus, b);
+
/* Claim resources before going "live" with our devices */
pci_walk_bus(b, pcifront_claim_resource, pdev);
pci_bus_add_devices(b);
- /* pci_scan_bus_parented skips devices which do not have a have
- * devfn==0. The pcifront_scan_bus enumerates all devfn. */
- err = pcifront_scan_bus(pdev, domain, bus, b);
return err;
@@ -560,6 +561,9 @@ int __devinit pcifront_rescan_root(struc
err = pcifront_scan_bus(pdev, domain, bus, b);
+ /* Claim resources before going "live" with our devices */
+ pci_walk_bus(b, pcifront_claim_resource, pdev);
+
return err;
}

@ -0,0 +1,56 @@
http://git.kernel.org/?p=linux/kernel/git/konrad/xen.git;a=commitdiff;h=4a65de894fc0af05397eedca180d0ea7d8c6caba#patch1
git/pub/scm / linux/kernel/git/konrad/xen.git / commitdiff
? search: re
summary | shortlog | log | commit | commitdiff | tree
raw | patch (parent: 621d869)
xen-pcifront: Don't race with udev when discovering new devices.
author Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Fri, 23 Jul 2010 14:35:57 +0000 (10:35 -0400)
committer Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Fri, 23 Jul 2010 15:15:56 +0000 (11:15 -0400)
We inadvertly would call 'pci_bus_add_device' right after discovering
the device, but before claiming the BARs. This ended up firing off
a uevent and udev loading the module and the modules failing to
request_region as they were not claimed. We fix this by holding off
going live by calling 'pci_bus_add_devices' at the end.
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
--- linux-2.6.34.1/drivers/xen/pcifront/pci_op.c.orig3 2010-09-29 16:32:08.324675371 +0200
+++ linux-2.6.34.1/drivers/xen/pcifront/pci_op.c 2010-09-29 16:37:23.215674973 +0200
@@ -456,17 +456,10 @@ int __devinit pcifront_scan_bus(struct p
}
d = pci_scan_single_device(b, devfn);
- if (d) {
+ if (d)
dev_info(&pdev->xdev->dev, "New device on "
"%04x:%02x:%02x.%02x found.\n", domain, bus,
PCI_SLOT(devfn), PCI_FUNC(devfn));
- err = pci_bus_add_device(d);
- if (err) {
- dev_err(&pdev->xdev->dev, "Failed to add "
- " device to bus.\n");
- return err;
- }
- }
}
return 0;
@@ -523,6 +516,7 @@ int __devinit pcifront_scan_root(struct
/* Claim resources before going "live" with our devices */
pci_walk_bus(b, pcifront_claim_resource, pdev);
+ /* Create SysFS and notify udev of the devices. Aka: "going live" */
pci_bus_add_devices(b);
@@ -564,6 +558,9 @@ int __devinit pcifront_rescan_root(struc
/* Claim resources before going "live" with our devices */
pci_walk_bus(b, pcifront_claim_resource, pdev);
+ /* Create SysFS and notify udev of the devices. Aka: "going live" */
+ pci_bus_add_devices(b);
+
return err;
}

@ -0,0 +1,127 @@
http://git.kernel.org/?p=linux/kernel/git/konrad/xen.git;a=commitdiff;h=978b7df39be386f9a875bb14fcd84145e8ad0ee2#patch1
git/pub/scm / linux/kernel/git/konrad/xen.git / commitdiff
? search: re
summary | shortlog | log | commit | commitdiff | tree
raw | patch (parent: 28a4d3a)
xen-pcifront: Enforce scanning of device functions on initial execution.
author Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Tue, 8 Jun 2010 16:59:41 +0000 (12:59 -0400)
committer Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Fri, 18 Jun 2010 19:40:27 +0000 (15:40 -0400)
'pci_scan_slot' abondons scanning of functions above 0 if a device with
function has not been detected. We need to be able to scan functions
above 0 in case the user has passed in devices without the function 0
for the slot/bus. To that end we are reusing the code that existed in
the rescan code path and make usage of it in the initial execution
path.
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
--- linux-2.6.34.1/drivers/xen/pcifront/pci_op.c.orig 2010-09-29 16:31:32.330675478 +0200
+++ linux-2.6.34.1/drivers/xen/pcifront/pci_op.c 2010-09-29 16:39:23.197674096 +0200
@@ -435,6 +435,43 @@ static int pcifront_claim_resource(struc
return 0;
}
+int __devinit pcifront_scan_bus(struct pcifront_device *pdev,
+ unsigned int domain, unsigned int bus,
+ struct pci_bus *b)
+{
+ struct pci_dev *d;
+ unsigned int devfn;
+ int err;
+
+ /* Scan the bus for functions and add.
+ * We omit handling of PCI bridge attachment because pciback prevents
+ * bridges from being exported.
+ */
+ for (devfn = 0; devfn < 0x100; devfn++) {
+ d = pci_get_slot(b, devfn);
+ if (d) {
+ /* Device is already known. */
+ pci_dev_put(d);
+ continue;
+ }
+
+ d = pci_scan_single_device(b, devfn);
+ if (d) {
+ dev_info(&pdev->xdev->dev, "New device on "
+ "%04x:%02x:%02x.%02x found.\n", domain, bus,
+ PCI_SLOT(devfn), PCI_FUNC(devfn));
+ err = pci_bus_add_device(d);
+ if (err) {
+ dev_err(&pdev->xdev->dev, "Failed to add "
+ " device to bus.\n");
+ return err;
+ }
+ }
+ }
+
+ return 0;
+}
+
int __devinit pcifront_scan_root(struct pcifront_device *pdev,
unsigned int domain, unsigned int bus)
{
@@ -484,7 +521,11 @@ int __devinit pcifront_scan_root(struct
pci_bus_add_devices(b);
- return 0;
+ /* pci_scan_bus_parented skips devices which do not have a have
+ * devfn==0. The pcifront_scan_bus enumerates all devfn. */
+ err = pcifront_scan_bus(pdev, domain, bus, b);
+
+ return err;
err_out:
kfree(bus_entry);
@@ -496,10 +537,9 @@ int __devinit pcifront_scan_root(struct
int __devinit pcifront_rescan_root(struct pcifront_device *pdev,
unsigned int domain, unsigned int bus)
{
+ int err;
struct pci_bus *b;
- struct pci_dev *d;
- unsigned int devfn;
-
+
#ifndef CONFIG_PCI_DOMAINS
if (domain != 0) {
dev_err(&pdev->xdev->dev,
@@ -518,34 +558,9 @@ int __devinit pcifront_rescan_root(struc
/* If the bus is unknown, create it. */
return pcifront_scan_root(pdev, domain, bus);
- /* Rescan the bus for newly attached functions and add.
- * We omit handling of PCI bridge attachment because pciback prevents
- * bridges from being exported.
- */
- for (devfn = 0; devfn < 0x100; devfn++) {
- d = pci_get_slot(b, devfn);
- if(d) {
- /* Device is already known. */
- pci_dev_put(d);
- continue;
- }
-
- d = pci_scan_single_device(b, devfn);
- if (d) {
- int err;
-
- dev_info(&pdev->xdev->dev, "New device on "
- "%04x:%02x:%02x.%02x found.\n", domain, bus,
- PCI_SLOT(devfn), PCI_FUNC(devfn));
- err = pci_bus_add_device(d);
- if (err)
- dev_err(&pdev->xdev->dev,
- "error %d adding device, continuing.\n",
- err);
- }
- }
+ err = pcifront_scan_bus(pdev, domain, bus, b);
- return 0;
+ return err;
}
static void free_root_bus_devs(struct pci_bus *bus)

@ -0,0 +1,14 @@
unbind_from_irqhandler takes irq, not evtchn, as its first argument.
Signed-off-by: Rafal Wojtczuk <rafal@invisiblethingslab.com>
--- linux-2.6.34.1/drivers/xen/pcifront/xenbus.c.orig 2010-09-29 16:47:39.961674359 +0200
+++ linux-2.6.34.1/drivers/xen/pcifront/xenbus.c 2010-09-29 16:47:49.458675391 +0200
@@ -61,7 +61,7 @@ static void free_pdev(struct pcifront_de
/*For PCIE_AER error handling job*/
flush_scheduled_work();
- unbind_from_irqhandler(pdev->evtchn, pdev);
+ unbind_from_irqhandler(irq_from_evtchn(pdev->evtchn), pdev);
if (pdev->evtchn != INVALID_EVTCHN)
xenbus_free_evtchn(pdev->xdev, pdev->evtchn);

@ -837,4 +837,9 @@
patches.xen/xen-x86_64-dump-user-pgt
patches.xen/xen-x86_64-note-init-p2m
patches.xen/pcifront-enforce-scan.patch
patches.xen/pcifront-claim.patch
patches.xen/pcifront-dont-race-udev.patch
patches.xen/pcifront-irq-not-evtchn.patch
patches.qubes/nuke_balloon_minimum_target.patch

Loading…
Cancel
Save