diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index 6e6b80e..3881d3a 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c @@ -440,6 +440,8 @@ int acpi_pci_irq_enable(struct pci_dev *dev) * driver reported one, then use it. Exit in any case. */ if (gsi < 0) { + dev_warn(&dev->dev, "?!?!? %s gsi < 0: %d\n", __func__, gsi); + if (acpi_isa_register_gsi(dev)) dev_warn(&dev->dev, "PCI INT %c: no GSI\n", pin_name(pin)); @@ -448,7 +450,13 @@ int acpi_pci_irq_enable(struct pci_dev *dev) return 0; } + rc = acpi_register_gsi(&dev->dev, gsi, triggering, polarity); + dev_warn(&dev->dev, "?!?!? %s: PCI INT %c%s -> GSI %u (%s, %s) -> IRQ/rc %d\n", + __func__, pin_name(pin), link_desc, gsi, + (triggering == ACPI_LEVEL_SENSITIVE) ? "level" : "edge", + (polarity == ACPI_ACTIVE_LOW) ? "low" : "high", rc); + if (rc < 0) { dev_warn(&dev->dev, "PCI INT %c: failed to register GSI\n", pin_name(pin)); diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 2c9ac70..8eda95e 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -7,6 +7,8 @@ * Copyright 1997 -- 2000 Martin Mares */ +#define DEBUG + #include #include #include @@ -1598,12 +1600,13 @@ bool pci_check_pme_status(struct pci_dev *dev) pmcsr |= PCI_PM_CTRL_PME_STATUS; if (pmcsr & PCI_PM_CTRL_PME_ENABLE) { /* Disable PME to avoid interrupt flood. */ + dev_warn(&dev->dev, "%s: Disable PME to avoid interrupt flood.\n", __func__); pmcsr &= ~PCI_PM_CTRL_PME_ENABLE; ret = true; } pci_write_config_word(dev, pmcsr_pos, pmcsr); - + dev_warn(&dev->dev, "%s: ret:%d\n", __func__, ret); return ret; } @@ -1753,7 +1756,7 @@ void pci_pme_active(struct pci_dev *dev, bool enable) } } - dev_dbg(&dev->dev, "PME# %s\n", enable ? "enabled" : "disabled"); + dev_warn(&dev->dev, "PME# %s\n", enable ? "enabled" : "disabled"); } EXPORT_SYMBOL(pci_pme_active); @@ -1816,7 +1819,7 @@ int __pci_enable_wake(struct pci_dev *dev, pci_power_t state, pci_pme_active(dev, false); dev->wakeup_prepared = false; } - + dev_warn(&dev->dev, "%s ret:%d\n", __func__, ret); return ret; } EXPORT_SYMBOL(__pci_enable_wake); @@ -2905,6 +2908,8 @@ void pci_intx(struct pci_dev *pdev, int enable) pci_read_config_word(pdev, PCI_COMMAND, &pci_command); + dev_warn(&pdev->dev, "?!??!? %s: enable:%d\n",__func__, enable); + if (enable) new = pci_command & ~PCI_COMMAND_INTX_DISABLE; else @@ -2912,6 +2917,7 @@ void pci_intx(struct pci_dev *pdev, int enable) if (new != pci_command) { struct pci_devres *dr; + dev_warn(&pdev->dev, "?!??!? %s: enable:%d new != pci_command\n",__func__, enable); pci_write_config_word(pdev, PCI_COMMAND, new); @@ -3172,6 +3178,8 @@ static int pci_pm_reset(struct pci_dev *dev, int probe) { u16 csr; + dev_err(&dev->dev, "%s: probe:%d dev->current_state:%d\n", __func__, probe, dev->current_state); + if (!dev->pm_cap) return -ENOTTY; @@ -3179,8 +3187,10 @@ static int pci_pm_reset(struct pci_dev *dev, int probe) if (csr & PCI_PM_CTRL_NO_SOFT_RESET) return -ENOTTY; - if (probe) + if (probe){ + dev_err(&dev->dev, "%s: probe ok\n", __func__); return 0; + } if (dev->current_state != PCI_D0) return -EINVAL; @@ -3195,13 +3205,15 @@ static int pci_pm_reset(struct pci_dev *dev, int probe) pci_write_config_word(dev, dev->pm_cap + PCI_PM_CTRL, csr); pci_dev_d3_sleep(dev); + dev_err(&dev->dev, "%s: done state: dev->current_state:%d\n", __func__, dev->current_state); + return 0; } void pci_reset_secondary_bus(struct pci_dev *dev) { u16 ctrl; - + dev_err(&dev->dev, "%s\n", __func__); pci_read_config_word(dev, PCI_BRIDGE_CONTROL, &ctrl); ctrl |= PCI_BRIDGE_CTL_BUS_RESET; pci_write_config_word(dev, PCI_BRIDGE_CONTROL, ctrl); @@ -3222,6 +3234,7 @@ void pci_reset_secondary_bus(struct pci_dev *dev) * but we don't make use of them yet. */ ssleep(1); + dev_err(&dev->dev, "%s done.\n", __func__); } void __weak pcibios_reset_secondary_bus(struct pci_dev *dev) @@ -3245,7 +3258,7 @@ EXPORT_SYMBOL_GPL(pci_reset_bridge_secondary_bus); static int pci_parent_bus_reset(struct pci_dev *dev, int probe) { struct pci_dev *pdev; - + dev_err(&dev->dev, "%s\n", __func__); if (pci_is_root_bus(dev->bus) || dev->subordinate || !dev->bus->self) return -ENOTTY; @@ -3257,7 +3270,7 @@ static int pci_parent_bus_reset(struct pci_dev *dev, int probe) return 0; pci_reset_bridge_secondary_bus(dev->bus->self); - + dev_err(&dev->dev, "%s done.\n", __func__); return 0; } @@ -3279,13 +3292,21 @@ static int pci_reset_hotplug_slot(struct hotplug_slot *hotplug, int probe) static int pci_dev_reset_slot_function(struct pci_dev *dev, int probe) { struct pci_dev *pdev; + dev_warn(&dev->dev, "%s probe: %d \n", __func__, probe); if (dev->subordinate || !dev->slot) return -ENOTTY; list_for_each_entry(pdev, &dev->bus->devices, bus_list) - if (pdev != dev && pdev->slot == dev->slot) + dev_warn(&dev->dev, "%s: testing pdev:%02x:%02x.%d pdev->slot:%d dev->slot:%d\n", __func__, pdev->bus->number, PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn), pdev->slot, dev->slot); + + if (pdev != dev && pdev->slot == dev->slot){ + dev_warn(&dev->dev, "%s: pdev!=dev && pdev->slot==dev->slot returning -ENOTTY \n", __func__); return -ENOTTY; + } else { + dev_warn(&dev->dev, "%s: not pdev!=dev && pdev->slot==dev->slot\n", __func__); + } + dev_warn(&dev->dev, "%s doing pci_reset_hotplug_slot()", __func__); return pci_reset_hotplug_slot(dev->slot->hotplug, probe); } @@ -3293,33 +3314,79 @@ static int pci_dev_reset_slot_function(struct pci_dev *dev, int probe) static int __pci_dev_reset(struct pci_dev *dev, int probe) { int rc; - + dev_warn(&dev->dev, "%s probe:%d \n", __func__, probe); might_sleep(); rc = pci_dev_specific_reset(dev, probe); - if (rc != -ENOTTY) + if (rc != -ENOTTY){ + dev_warn(&dev->dev, "%s pci_dev_specific_reset succeeded rc:%d\n", __func__, rc); goto done; - + } rc = pcie_flr(dev, probe); - if (rc != -ENOTTY) + if (rc != -ENOTTY){ + dev_warn(&dev->dev, "%s pcie_flr succeeded rc:%d\n", __func__, rc); goto done; - + } rc = pci_af_flr(dev, probe); - if (rc != -ENOTTY) + if (rc != -ENOTTY){ + dev_warn(&dev->dev, "%s pci_af_flr succeeded rc:%d\n", __func__, rc); goto done; - + } rc = pci_pm_reset(dev, probe); - if (rc != -ENOTTY) + if (rc != -ENOTTY){ + dev_warn(&dev->dev, "%s pci_pm_reset succeeded rc:%d\n", __func__, rc); goto done; - + } rc = pci_dev_reset_slot_function(dev, probe); - if (rc != -ENOTTY) + if (rc != -ENOTTY){ + dev_warn(&dev->dev, "%s pci_dev_reset_slot_function rc:%d\n", __func__, rc); goto done; + } + rc = pci_parent_bus_reset(dev, probe); +done: + dev_warn(&dev->dev, "%s done rc:%d.\n", __func__, rc); + return rc; +} + + +int pci_dev_reset_xen(struct pci_dev *dev) +{ + int probe=0; + int rc; + dev_warn(&dev->dev, "%s probe:%d \n", __func__, probe); + might_sleep(); + rc = pci_dev_specific_reset(dev, probe); + if (rc != -ENOTTY){ + dev_warn(&dev->dev, "%s pci_dev_specific_reset succeeded rc:%d\n", __func__, rc); + goto done; + } + rc = pcie_flr(dev, probe); + if (rc != -ENOTTY){ + dev_warn(&dev->dev, "%s pcie_flr succeeded rc:%d\n", __func__, rc); + goto done; + } + rc = pci_af_flr(dev, probe); + if (rc != -ENOTTY){ + dev_warn(&dev->dev, "%s pci_af_flr succeeded rc:%d\n", __func__, rc); + goto done; + } + rc = pci_pm_reset(dev, probe); + if (rc != -ENOTTY){ + dev_warn(&dev->dev, "%s pci_pm_reset succeeded rc:%d\n", __func__, rc); + goto done; + } + rc = pci_dev_reset_slot_function(dev, probe); + if (rc != -ENOTTY){ + dev_warn(&dev->dev, "%s pci_dev_reset_slot_function rc:%d\n", __func__, rc); + goto done; + } rc = pci_parent_bus_reset(dev, probe); done: + dev_warn(&dev->dev, "%s done rc:%d.\n", __func__, rc); return rc; } +EXPORT_SYMBOL_GPL(pci_dev_reset_xen); static void pci_dev_lock(struct pci_dev *dev) { diff --git a/drivers/pci/pcie/pme.c b/drivers/pci/pcie/pme.c index 82e06a8..dd78847 100644 --- a/drivers/pci/pcie/pme.c +++ b/drivers/pci/pcie/pme.c @@ -185,6 +185,10 @@ static void pcie_pme_handle_request(struct pci_dev *port, u16 req_id) if (found) { /* The device is there, but we have to check its PME status. */ found = pci_check_pme_status(dev); + dev_warn(&port->dev, "PME interrupt from %02x:%02x.%d found device %02x:%02x.%d found:%d\n", + busnr, PCI_SLOT(devfn), PCI_FUNC(devfn), + dev->bus->number,PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn), found); + if (found) { if (dev->pme_poll) dev->pme_poll = false; @@ -199,14 +203,14 @@ static void pcie_pme_handle_request(struct pci_dev *port, u16 req_id) * assuming that the PME was reported by a PCIe-PCI bridge that * used devfn different from zero. */ - dev_dbg(&port->dev, "PME interrupt generated for non-existent device %02x:%02x.%d\n", + dev_warn(&port->dev, "PME interrupt generated for non-existent device %02x:%02x.%d\n", busnr, PCI_SLOT(devfn), PCI_FUNC(devfn)); found = pcie_pme_from_pci_bridge(bus, 0); } out: if (!found) - dev_dbg(&port->dev, "Spurious native PME interrupt!\n"); + dev_warn(&port->dev, "Spurious native PME interrupt %02x:%02x.%d!\n",busnr, PCI_SLOT(devfn), PCI_FUNC(devfn)); } /** @@ -363,7 +367,7 @@ static int pcie_pme_probe(struct pcie_device *srv) pcie_pme_mark_devices(port); pcie_pme_interrupt_enable(port, true); } - + dev_info(&port->dev, "?!?!?!? %s: srv->irq:%d ret: %d \n",__func__, srv->irq, ret); return ret; } diff --git a/drivers/xen/evtchn.c b/drivers/xen/evtchn.c index 00f40f0..7381158 100644 --- a/drivers/xen/evtchn.c +++ b/drivers/xen/evtchn.c @@ -330,7 +330,9 @@ static void evtchn_unbind_from_user(struct per_user_data *u, BUG_ON(irq < 0); unbind_from_irqhandler(irq, evtchn); - + if(irq==16){ + pr_err("?!?!?!?! %s: %d\n",__func__, irq); + } del_evtchn(u, evtchn); } diff --git a/drivers/xen/xen-pciback/pci_stub.c b/drivers/xen/xen-pciback/pci_stub.c index 259ba26..b5fe02b 100644 --- a/drivers/xen/xen-pciback/pci_stub.c +++ b/drivers/xen/xen-pciback/pci_stub.c @@ -7,6 +7,9 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#define DEBUG + + #include #include #include @@ -82,6 +85,8 @@ static struct pcistub_device *pcistub_device_alloc(struct pci_dev *dev) kref_init(&psdev->kref); spin_lock_init(&psdev->lock); + dev_dbg(&dev->dev, "pcistub_device_alloc done.\n"); + return psdev; } @@ -103,7 +108,10 @@ static void pcistub_device_release(struct kref *kref) /* Call the reset function which does not take lock as this * is called from "unbind" which takes a device_lock mutex. */ - __pci_reset_function_locked(dev); + /* __pci_reset_function_locked(dev); */ + + pci_dev_reset_xen(dev); + if (pci_load_and_free_saved_state(dev, &dev_data->pci_saved_state)) dev_dbg(&dev->dev, "Could not reload PCI state\n"); else @@ -137,6 +145,8 @@ static void pcistub_device_release(struct kref *kref) pci_dev_put(dev); kfree(psdev); + dev_dbg(&dev->dev, "pcistub_device_release done.\n"); + } static inline void pcistub_device_get(struct pcistub_device *psdev) @@ -256,6 +266,8 @@ void pcistub_put_pci_dev(struct pci_dev *dev) struct pcistub_device *psdev, *found_psdev = NULL; unsigned long flags; + dev_dbg(&dev->dev, "%s\n",__func__); + spin_lock_irqsave(&pcistub_devices_lock, flags); list_for_each_entry(psdev, &pcistub_devices, dev_list) { @@ -280,7 +292,9 @@ void pcistub_put_pci_dev(struct pci_dev *dev) /* This is OK - we are running from workqueue context * and want to inhibit the user from fiddling with 'reset' */ - pci_reset_function(dev); + /* pci_reset_function(dev); */ + pci_dev_reset_xen(dev); + pci_restore_state(dev); /* This disables the device. */ @@ -298,6 +312,8 @@ void pcistub_put_pci_dev(struct pci_dev *dev) pcistub_device_put(found_psdev); up_write(&pcistub_sem); + dev_dbg(&dev->dev, "%s done.\n",__func__); + } static int pcistub_match_one(struct pci_dev *dev, @@ -404,13 +420,16 @@ static int pcistub_init_device(struct pci_dev *dev) dev_err(&dev->dev, "Could not store PCI conf saved state!\n"); else { dev_dbg(&dev->dev, "resetting (FLR, D3, etc) the device\n"); - __pci_reset_function_locked(dev); + + /* __pci_reset_function_locked(dev); */ + pci_dev_reset_xen(dev); + pci_restore_state(dev); } /* Now disable the device (this also ensures some private device * data is setup before we export) */ - dev_dbg(&dev->dev, "reset device\n"); + dev_warn(&dev->dev, "reset device\n"); xen_pcibk_reset_device(dev); dev->dev_flags |= PCI_DEV_FLAGS_ASSIGNED; @@ -508,7 +527,7 @@ static int pcistub_probe(struct pci_dev *dev, const struct pci_device_id *id) { int err = 0; - dev_dbg(&dev->dev, "probing...\n"); + dev_dbg(&dev->dev, "%s: probing...\n",__func__); if (pcistub_match(dev)) { @@ -528,6 +547,8 @@ static int pcistub_probe(struct pci_dev *dev, const struct pci_device_id *id) err = -ENODEV; out: + dev_dbg(&dev->dev, "%s: probing... done.\n",__func__); + return err; } @@ -538,7 +559,7 @@ static void pcistub_remove(struct pci_dev *dev) struct pcistub_device *psdev, *found_psdev = NULL; unsigned long flags; - dev_dbg(&dev->dev, "removing\n"); + dev_dbg(&dev->dev, "%s: removing\n",__func__); spin_lock_irqsave(&pcistub_devices_lock, flags); @@ -576,6 +597,8 @@ static void pcistub_remove(struct pci_dev *dev) /* the final put for releasing from the list */ pcistub_device_put(found_psdev); + dev_dbg(&dev->dev, "%s: removing done.\n",__func__); + } } diff --git a/drivers/xen/xen-pciback/pciback_ops.c b/drivers/xen/xen-pciback/pciback_ops.c index c4a0666..b997908 100644 --- a/drivers/xen/xen-pciback/pciback_ops.c +++ b/drivers/xen/xen-pciback/pciback_ops.c @@ -6,6 +6,8 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#define DEBUG + #include #include #include diff --git a/drivers/xen/xen-pciback/vpci.c b/drivers/xen/xen-pciback/vpci.c index 51afff9..300193f 100644 --- a/drivers/xen/xen-pciback/vpci.c +++ b/drivers/xen/xen-pciback/vpci.c @@ -7,6 +7,8 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#define DEBUG + #include #include #include diff --git a/drivers/xen/xen-pciback/xenbus.c b/drivers/xen/xen-pciback/xenbus.c index c214daa..48093c5 100644 --- a/drivers/xen/xen-pciback/xenbus.c +++ b/drivers/xen/xen-pciback/xenbus.c @@ -6,6 +6,8 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#define DEBUG + #include #include #include diff --git a/include/linux/pci.h b/include/linux/pci.h index 96453f9..117188f 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -970,6 +970,7 @@ int pcie_set_mps(struct pci_dev *dev, int mps); int pcie_get_minimum_link(struct pci_dev *dev, enum pci_bus_speed *speed, enum pcie_link_width *width); int __pci_reset_function(struct pci_dev *dev); +int pci_dev_reset_xen(struct pci_dev *dev); int __pci_reset_function_locked(struct pci_dev *dev); int pci_reset_function(struct pci_dev *dev); int pci_try_reset_function(struct pci_dev *dev); diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c index e2514b0..0fa0e5d 100644 --- a/kernel/irq/spurious.c +++ b/kernel/irq/spurious.c @@ -202,6 +202,7 @@ __report_bad_irq(unsigned int irq, struct irq_desc *desc, printk(KERN_ERR "irq %d: nobody cared (try booting with " "the \"irqpoll\" option)\n", irq); } + print_irq_desc(irq, desc); dump_stack(); printk(KERN_ERR "handlers:\n"); @@ -417,7 +418,7 @@ void note_interrupt(unsigned int irq, struct irq_desc *desc, /* * Now kill the IRQ */ - printk(KERN_EMERG "Disabling IRQ #%d\n", irq); + printk(KERN_EMERG "Disabling IRQ #%d unhandled: %d\n", irq, desc->irqs_unhandled); desc->istate |= IRQS_SPURIOUS_DISABLED; desc->depth++; irq_disable(desc);