Merge tag 'pci-v3.13-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci

Pull PCI updates from Bjorn Helgaas:
"PCI device hotplug
- Move device_del() from pci_stop_dev() to pci_destroy_dev() (Rafael
Wysocki)

Host bridge drivers
- Update maintainers for DesignWare, i.MX6, Armada, R-Car (Bjorn
Helgaas)
- mvebu: Return 'unsupported' for Interrupt Line and Interrupt Pin
(Jason Gunthorpe)

Miscellaneous
- Avoid unnecessary CPU switch when calling .probe() (Alexander
Duyck)
- Revert "workqueue: allow work_on_cpu() to be called recursively"
(Bjorn Helgaas)
- Disable Bus Master only on kexec reboot (Khalid Aziz)
- Omit PCI ID macro strings to shorten quirk names for LTO (Michal
Marek)"

* tag 'pci-v3.13-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci:
MAINTAINERS: Add DesignWare, i.MX6, Armada, R-Car PCI host maintainers
PCI: Disable Bus Master only on kexec reboot
PCI: mvebu: Return 'unsupported' for Interrupt Line and Interrupt Pin
PCI: Omit PCI ID macro strings to shorten quirk names
PCI: Move device_del() from pci_stop_dev() to pci_destroy_dev()
Revert "workqueue: allow work_on_cpu() to be called recursively"
PCI: Avoid unnecessary CPU switch when calling driver .probe() method

Changed files
+103 -46
drivers
include
linux
kernel
+33
MAINTAINERS
··· 6465 6465 F: include/linux/pci* 6466 6466 F: arch/x86/pci/ 6467 6467 6468 + PCI DRIVER FOR IMX6 6469 + M: Richard Zhu <r65037@freescale.com> 6470 + M: Shawn Guo <shawn.guo@linaro.org> 6471 + L: linux-pci@vger.kernel.org 6472 + L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 6473 + S: Maintained 6474 + F: drivers/pci/host/*imx6* 6475 + 6476 + PCI DRIVER FOR MVEBU (Marvell Armada 370 and Armada XP SOC support) 6477 + M: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> 6478 + M: Jason Cooper <jason@lakedaemon.net> 6479 + L: linux-pci@vger.kernel.org 6480 + L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 6481 + S: Maintained 6482 + F: drivers/pci/host/*mvebu* 6483 + 6468 6484 PCI DRIVER FOR NVIDIA TEGRA 6469 6485 M: Thierry Reding <thierry.reding@gmail.com> 6470 6486 L: linux-tegra@vger.kernel.org 6487 + L: linux-pci@vger.kernel.org 6471 6488 S: Supported 6472 6489 F: Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt 6473 6490 F: drivers/pci/host/pci-tegra.c 6474 6491 6492 + PCI DRIVER FOR RENESAS R-CAR 6493 + M: Simon Horman <horms@verge.net.au> 6494 + L: linux-pci@vger.kernel.org 6495 + L: linux-sh@vger.kernel.org 6496 + S: Maintained 6497 + F: drivers/pci/host/*rcar* 6498 + 6475 6499 PCI DRIVER FOR SAMSUNG EXYNOS 6476 6500 M: Jingoo Han <jg1.han@samsung.com> 6477 6501 L: linux-pci@vger.kernel.org 6502 + L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 6503 + L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) 6478 6504 S: Maintained 6479 6505 F: drivers/pci/host/pci-exynos.c 6506 + 6507 + PCI DRIVER FOR SYNOPSIS DESIGNWARE 6508 + M: Mohit Kumar <mohit.kumar@st.com> 6509 + M: Jingoo Han <jg1.han@samsung.com> 6510 + L: linux-pci@vger.kernel.org 6511 + S: Maintained 6512 + F: drivers/pci/host/*designware* 6480 6513 6481 6514 PCMCIA SUBSYSTEM 6482 6515 P: Linux PCMCIA Team
+5
drivers/pci/host/pci-mvebu.c
··· 447 447 *value = 0; 448 448 break; 449 449 450 + case PCI_INTERRUPT_LINE: 451 + /* LINE PIN MIN_GNT MAX_LAT */ 452 + *value = 0; 453 + break; 454 + 450 455 default: 451 456 *value = 0xffffffff; 452 457 return PCIBIOS_BAD_REGISTER_NUMBER;
+30 -8
drivers/pci/pci-driver.c
··· 19 19 #include <linux/cpu.h> 20 20 #include <linux/pm_runtime.h> 21 21 #include <linux/suspend.h> 22 + #include <linux/kexec.h> 22 23 #include "pci.h" 23 24 24 25 struct pci_dynid { ··· 289 288 int error, node; 290 289 struct drv_dev_and_id ddi = { drv, dev, id }; 291 290 292 - /* Execute driver initialization on node where the device's 293 - bus is attached to. This way the driver likely allocates 294 - its local memory on the right node without any need to 295 - change it. */ 291 + /* 292 + * Execute driver initialization on node where the device is 293 + * attached. This way the driver likely allocates its local memory 294 + * on the right node. 295 + */ 296 296 node = dev_to_node(&dev->dev); 297 - if (node >= 0) { 297 + 298 + /* 299 + * On NUMA systems, we are likely to call a PF probe function using 300 + * work_on_cpu(). If that probe calls pci_enable_sriov() (which 301 + * adds the VF devices via pci_bus_add_device()), we may re-enter 302 + * this function to call the VF probe function. Calling 303 + * work_on_cpu() again will cause a lockdep warning. Since VFs are 304 + * always on the same node as the PF, we can work around this by 305 + * avoiding work_on_cpu() when we're already on the correct node. 306 + * 307 + * Preemption is enabled, so it's theoretically unsafe to use 308 + * numa_node_id(), but even if we run the probe function on the 309 + * wrong node, it should be functionally correct. 310 + */ 311 + if (node >= 0 && node != numa_node_id()) { 298 312 int cpu; 299 313 300 314 get_online_cpus(); ··· 321 305 put_online_cpus(); 322 306 } else 323 307 error = local_pci_probe(&ddi); 308 + 324 309 return error; 325 310 } 326 311 ··· 416 399 pci_msi_shutdown(pci_dev); 417 400 pci_msix_shutdown(pci_dev); 418 401 402 + #ifdef CONFIG_KEXEC 419 403 /* 420 - * Turn off Bus Master bit on the device to tell it to not 421 - * continue to do DMA. Don't touch devices in D3cold or unknown states. 404 + * If this is a kexec reboot, turn off Bus Master bit on the 405 + * device to tell it to not continue to do DMA. Don't touch 406 + * devices in D3cold or unknown states. 407 + * If it is not a kexec reboot, firmware will hit the PCI 408 + * devices with big hammer and stop their DMA any way. 422 409 */ 423 - if (pci_dev->current_state <= PCI_D3hot) 410 + if (kexec_in_progress && (pci_dev->current_state <= PCI_D3hot)) 424 411 pci_clear_master(pci_dev); 412 + #endif 425 413 } 426 414 427 415 #ifdef CONFIG_PM
+3 -1
drivers/pci/remove.c
··· 24 24 if (dev->is_added) { 25 25 pci_proc_detach_device(dev); 26 26 pci_remove_sysfs_dev_files(dev); 27 - device_del(&dev->dev); 27 + device_release_driver(&dev->dev); 28 28 dev->is_added = 0; 29 29 } 30 30 ··· 34 34 35 35 static void pci_destroy_dev(struct pci_dev *dev) 36 36 { 37 + device_del(&dev->dev); 38 + 37 39 down_write(&pci_bus_sem); 38 40 list_del(&dev->bus_list); 39 41 up_write(&pci_bus_sem);
+3
include/linux/kexec.h
··· 198 198 extern size_t vmcoreinfo_size; 199 199 extern size_t vmcoreinfo_max_size; 200 200 201 + /* flag to track if kexec reboot is in progress */ 202 + extern bool kexec_in_progress; 203 + 201 204 int __init parse_crashkernel(char *cmdline, unsigned long long system_ram, 202 205 unsigned long long *crash_size, unsigned long long *crash_base); 203 206 int parse_crashkernel_high(char *cmdline, unsigned long long system_ram,
+15 -15
include/linux/pci.h
··· 1567 1567 /* Anonymous variables would be nice... */ 1568 1568 #define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, class, \ 1569 1569 class_shift, hook) \ 1570 - static const struct pci_fixup __pci_fixup_##name __used \ 1570 + static const struct pci_fixup __PASTE(__pci_fixup_##name,__LINE__) __used \ 1571 1571 __attribute__((__section__(#section), aligned((sizeof(void *))))) \ 1572 1572 = { vendor, device, class, class_shift, hook }; 1573 1573 1574 1574 #define DECLARE_PCI_FIXUP_CLASS_EARLY(vendor, device, class, \ 1575 1575 class_shift, hook) \ 1576 1576 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \ 1577 - vendor##device##hook, vendor, device, class, class_shift, hook) 1577 + hook, vendor, device, class, class_shift, hook) 1578 1578 #define DECLARE_PCI_FIXUP_CLASS_HEADER(vendor, device, class, \ 1579 1579 class_shift, hook) \ 1580 1580 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_header, \ 1581 - vendor##device##hook, vendor, device, class, class_shift, hook) 1581 + hook, vendor, device, class, class_shift, hook) 1582 1582 #define DECLARE_PCI_FIXUP_CLASS_FINAL(vendor, device, class, \ 1583 1583 class_shift, hook) \ 1584 1584 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_final, \ 1585 - vendor##device##hook, vendor, device, class, class_shift, hook) 1585 + hook, vendor, device, class, class_shift, hook) 1586 1586 #define DECLARE_PCI_FIXUP_CLASS_ENABLE(vendor, device, class, \ 1587 1587 class_shift, hook) \ 1588 1588 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable, \ 1589 - vendor##device##hook, vendor, device, class, class_shift, hook) 1589 + hook, vendor, device, class, class_shift, hook) 1590 1590 #define DECLARE_PCI_FIXUP_CLASS_RESUME(vendor, device, class, \ 1591 1591 class_shift, hook) \ 1592 1592 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \ 1593 - resume##vendor##device##hook, vendor, device, class, \ 1593 + resume##hook, vendor, device, class, \ 1594 1594 class_shift, hook) 1595 1595 #define DECLARE_PCI_FIXUP_CLASS_RESUME_EARLY(vendor, device, class, \ 1596 1596 class_shift, hook) \ 1597 1597 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume_early, \ 1598 - resume_early##vendor##device##hook, vendor, device, \ 1598 + resume_early##hook, vendor, device, \ 1599 1599 class, class_shift, hook) 1600 1600 #define DECLARE_PCI_FIXUP_CLASS_SUSPEND(vendor, device, class, \ 1601 1601 class_shift, hook) \ 1602 1602 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \ 1603 - suspend##vendor##device##hook, vendor, device, class, \ 1603 + suspend##hook, vendor, device, class, \ 1604 1604 class_shift, hook) 1605 1605 1606 1606 #define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \ 1607 1607 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \ 1608 - vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook) 1608 + hook, vendor, device, PCI_ANY_ID, 0, hook) 1609 1609 #define DECLARE_PCI_FIXUP_HEADER(vendor, device, hook) \ 1610 1610 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_header, \ 1611 - vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook) 1611 + hook, vendor, device, PCI_ANY_ID, 0, hook) 1612 1612 #define DECLARE_PCI_FIXUP_FINAL(vendor, device, hook) \ 1613 1613 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_final, \ 1614 - vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook) 1614 + hook, vendor, device, PCI_ANY_ID, 0, hook) 1615 1615 #define DECLARE_PCI_FIXUP_ENABLE(vendor, device, hook) \ 1616 1616 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable, \ 1617 - vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook) 1617 + hook, vendor, device, PCI_ANY_ID, 0, hook) 1618 1618 #define DECLARE_PCI_FIXUP_RESUME(vendor, device, hook) \ 1619 1619 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \ 1620 - resume##vendor##device##hook, vendor, device, \ 1620 + resume##hook, vendor, device, \ 1621 1621 PCI_ANY_ID, 0, hook) 1622 1622 #define DECLARE_PCI_FIXUP_RESUME_EARLY(vendor, device, hook) \ 1623 1623 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume_early, \ 1624 - resume_early##vendor##device##hook, vendor, device, \ 1624 + resume_early##hook, vendor, device, \ 1625 1625 PCI_ANY_ID, 0, hook) 1626 1626 #define DECLARE_PCI_FIXUP_SUSPEND(vendor, device, hook) \ 1627 1627 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \ 1628 - suspend##vendor##device##hook, vendor, device, \ 1628 + suspend##hook, vendor, device, \ 1629 1629 PCI_ANY_ID, 0, hook) 1630 1630 1631 1631 #ifdef CONFIG_PCI_QUIRKS
+4
kernel/kexec.c
··· 47 47 size_t vmcoreinfo_size; 48 48 size_t vmcoreinfo_max_size = sizeof(vmcoreinfo_data); 49 49 50 + /* Flag to indicate we are going to kexec a new kernel */ 51 + bool kexec_in_progress = false; 52 + 50 53 /* Location of the reserved area for the crash kernel */ 51 54 struct resource crashk_res = { 52 55 .name = "Crash kernel", ··· 1678 1675 } else 1679 1676 #endif 1680 1677 { 1678 + kexec_in_progress = true; 1681 1679 kernel_restart_prepare(NULL); 1682 1680 printk(KERN_EMERG "Starting new kernel\n"); 1683 1681 machine_shutdown();
+10 -22
kernel/workqueue.c
··· 2851 2851 return false; 2852 2852 } 2853 2853 2854 - static bool __flush_work(struct work_struct *work) 2855 - { 2856 - struct wq_barrier barr; 2857 - 2858 - if (start_flush_work(work, &barr)) { 2859 - wait_for_completion(&barr.done); 2860 - destroy_work_on_stack(&barr.work); 2861 - return true; 2862 - } else { 2863 - return false; 2864 - } 2865 - } 2866 - 2867 2854 /** 2868 2855 * flush_work - wait for a work to finish executing the last queueing instance 2869 2856 * @work: the work to flush ··· 2864 2877 */ 2865 2878 bool flush_work(struct work_struct *work) 2866 2879 { 2880 + struct wq_barrier barr; 2881 + 2867 2882 lock_map_acquire(&work->lockdep_map); 2868 2883 lock_map_release(&work->lockdep_map); 2869 2884 2870 - return __flush_work(work); 2885 + if (start_flush_work(work, &barr)) { 2886 + wait_for_completion(&barr.done); 2887 + destroy_work_on_stack(&barr.work); 2888 + return true; 2889 + } else { 2890 + return false; 2891 + } 2871 2892 } 2872 2893 EXPORT_SYMBOL_GPL(flush_work); 2873 2894 ··· 4827 4832 4828 4833 INIT_WORK_ONSTACK(&wfc.work, work_for_cpu_fn); 4829 4834 schedule_work_on(cpu, &wfc.work); 4830 - 4831 - /* 4832 - * The work item is on-stack and can't lead to deadlock through 4833 - * flushing. Use __flush_work() to avoid spurious lockdep warnings 4834 - * when work_on_cpu()s are nested. 4835 - */ 4836 - __flush_work(&wfc.work); 4837 - 4835 + flush_work(&wfc.work); 4838 4836 return wfc.ret; 4839 4837 } 4840 4838 EXPORT_SYMBOL_GPL(work_on_cpu);