13 Dec, 2016

1 commit


03 Oct, 2016

1 commit

  • * pci/hotplug:
    x86/PCI: VMD: Request userspace control of PCIe hotplug indicators
    PCI: pciehp: Allow exclusive userspace control of indicators
    PCI: pciehp: Remove useless pciehp_get_latch_status() calls
    PCI: pciehp: Clean up dmesg "Slot(%s)" messages
    PCI: pciehp: Remove unnecessary guard
    PCI: pciehp: Don't re-read Slot Status when handling surprise event
    PCI: pciehp: Don't re-read Slot Status when queuing hotplug event
    PCI: pciehp: Process all hotplug events before looking for new ones
    PCI: pciehp: Return IRQ_NONE when we can't read interrupt status
    PCI: pciehp: Rename pcie_isr() locals for clarity
    PCI: pciehp: Clear attention LED on device add

    Bjorn Helgaas
     

23 Sep, 2016

1 commit

  • PCIe hotplug supports optional Attention and Power Indicators, which are
    used internally by pciehp. Users can't control the Power Indicator, but
    they can control the Attention Indicator by writing to a sysfs "attention"
    file.

    The Slot Control register has two bits for each indicator, and the PCIe
    spec defines the encodings for each as (Reserved/On/Blinking/Off). For
    sysfs "attention" writes, pciehp_set_attention_status() maps into these
    encodings, so the only useful write values are 0 (Off), 1 (On), and 2
    (Blinking).

    However, some platforms use all four bits for platform-specific indicators,
    and they need to allow direct user control of them while preventing pciehp
    from using them at all.

    Add a "hotplug_user_indicators" flag to the pci_dev structure. When set,
    pciehp does not use either the Attention Indicator or the Power Indicator,
    and the low four bits (values 0x0 - 0xf) of sysfs "attention" write values
    are written directly to the Attention Indicator Control and Power Indicator
    Control fields.

    [bhelgaas: changelog, rename flag and accessors to s/attention/indicator/]
    Signed-off-by: Keith Busch
    Signed-off-by: Bjorn Helgaas

    Keith Busch
     

25 Aug, 2016

1 commit

  • This code is not being built as a module by anyone:

    obj-$(CONFIG_HOTPLUG_PCI_PCIE) += pciehp.o
    pciehp-objs := pciehp_core.o \

    drivers/pci/pcie/Kconfig:config HOTPLUG_PCI_PCIE
    drivers/pci/pcie/Kconfig: bool "PCI Express Hotplug driver"

    Remove uses of MODULE_DESCRIPTION(), MODULE_AUTHOR(), MODULE_LICENSE(),
    etc., so that when reading the driver there is no doubt it is builtin-only.
    The information is preserved in comments at the top of the file.

    Note that for non-modular code, module_init() translates to
    device_initcall(). One could argue that we should use subsys_initcall()
    here, but for now we stick with runtime equivalence.

    We delete module.h but we keep the moduleparam.h include, since we are
    keeping the module_param() that the file has as-is for now.

    Signed-off-by: Paul Gortmaker
    Signed-off-by: Bjorn Helgaas
    CC: Kristen Carlson Accardi

    Paul Gortmaker
     

09 Jan, 2016

1 commit

  • Fix all whitespace issues (missing or needed whitespace) in all files in
    drivers/pci. Code is compiled with allyesconfig before and after code
    changes and objects are recorded and checked with objdiff and they are not
    changed after this commit.

    Signed-off-by: Bogicevic Sasa
    Signed-off-by: Bjorn Helgaas

    Bogicevic Sasa
     

18 Jun, 2015

1 commit

  • The pciehp debug logging is overly verbose and often redundant. Almost all
    of the information printed by dbg_ctrl() is also printed by the normal PCI
    core enumeration code and by pcie_init().

    Remove the redundant debug info.

    When claiming a pciehp bridge, we print the slot characteristics, e.g.,

    Slot #6 AttnBtn- AttnInd- PwrInd- PwrCtrl- MRL- Interlock- NoCompl+ LLActRep+

    Add the Hot-Plug Capable and Hot-Plug Surprise bits to this information,
    and print it all in the same order as lspci does.

    No functional change except the message text changes.

    Signed-off-by: Bjorn Helgaas
    Reviewed-by: Rajat Jain
    Acked-by: Yinghai Lu

    Bjorn Helgaas
     

23 May, 2015

1 commit


22 May, 2015

1 commit

  • Jarod Wilson reports that ExpressCard hotplug doesn't work on HP ZBook G2.
    The problem turns out to be the ACPI-based "slot detection" code called
    from pciehp_probe() which uses questionable heuristics based on what ACPI
    objects are present for the PCIe port device to figure out whether to
    register a hotplug slot for that port.

    That code is used if there is at least one PCIe port having an ACPI device
    configuration object related to hotplug (such as _EJ0 or _RMV), and the
    Thunderbolt port on the ZBook has _RMV. Of course, Thunderbolt and PCIe
    native hotplug need not be mutually exclusive (as they aren't on the
    ZBook), so that rule is simply incorrect.

    Moreover, the ACPI-based "slot detection" check does not add any value if
    pciehp_probe() is called at all and the service type of the device object
    it has been called for is PCIE_PORT_SERVICE_HP, because PCIe hotplug
    services are only registered if the _OSC handshake in acpi_pci_root_add()
    allows the kernel to control the PCIe native hotplug feature. No more
    checks need to be carried out to decide whether or not to register a native
    PCIe hotlug slot in that case.

    For the above reasons, make pciehp_probe() check if it has been called for
    the right service type and drop the pointless ACPI-based "slot detection"
    check from it. Also remove the entire code whose only user is that check
    (the entire pciehp_acpi.c file goes away as a result) and drop function
    headers related to it from the internal pciehp header file.

    Link: http://lkml.kernel.org/r/1431632038-39917-1-git-send-email-jarod@redhat.com
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=98581
    Reported-by: Jarod Wilson
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Bjorn Helgaas
    Reviewed-by: Jarod Wilson
    Tested-by: Jarod Wilson

    Rafael J. Wysocki
     

28 Oct, 2014

1 commit

  • This reverts bceee4a97eb5 ("PCI: pciehp: Prevent NULL dereference during
    probe") because it was accidentally applied twice:

    62e4492c3063 ("PCI: Prevent NULL dereference during pciehp probe")
    bceee4a97eb5 ("PCI: pciehp: Prevent NULL dereference during probe")

    Revert the latter to dispose of the duplicated code block.

    [bhelgaas: tidy changelog, drop stable tag]
    Signed-off-by: Kamal Mostafa
    Signed-off-by: Bjorn Helgaas
    CC: Andreas Noever

    Kamal Mostafa
     

17 Sep, 2014

1 commit

  • pciehp assumes that dev->subordinate, the struct pci_bus for a bridge's
    secondary bus, exists. But we do not create that bus if we run out of bus
    numbers during enumeration. This leads to a NULL dereference in
    init_slot() (and other places).

    Change pciehp_probe() to return -ENODEV when no secondary bus is present.

    Signed-off-by: Andreas Noever
    Signed-off-by: Bjorn Helgaas
    CC: stable@vger.kernel.org # v3.2+

    Andreas Noever
     

17 Jun, 2014

1 commit

  • pciehp assumes that dev->subordinate exists. But we do not assign a bus if
    we run out of bus numbers during enumeration. This leads to a NULL
    dereference in init_slot() (and other places).

    Change pciehp_probe() to return -ENODEV when no subordinate bus is present.

    Signed-off-by: Andreas Noever
    Signed-off-by: Bjorn Helgaas

    Andreas Noever
     

11 Jun, 2014

2 commits

  • Merge quoted strings that are broken across lines into a single entity.
    The compiler merges them anyway, but checkpatch complains about it, and
    merging them makes it easier to grep for strings.

    No functional change.

    [bhelgaas: changelog, do the same for everything under drivers/pci]
    Signed-off-by: Ryan Desfosses
    Signed-off-by: Bjorn Helgaas

    Ryan Desfosses
     
  • Fix various whitespace errors.

    No functional change.

    [bhelgaas: fix other similar problems]
    Signed-off-by: Ryan Desfosses
    Signed-off-by: Bjorn Helgaas

    Ryan Desfosses
     

20 Feb, 2014

1 commit


12 Feb, 2014

1 commit

  • Today it is there is no protection around pciehp_enable_slot() and
    pciehp_disable_slot() to ensure that they complete before another
    hot-plug operation can be done on that particular slot.

    This patch introduces the slot->hotplug_lock to ensure that any hotplug
    operations (add / remove) complete before another hotplug event can begin
    processing on that particular slot.

    Signed-off-by: Rajat Jain
    Signed-off-by: Rajat Jain
    Signed-off-by: Guenter Roeck
    Signed-off-by: Bjorn Helgaas

    Rajat Jain
     

14 Jan, 2014

2 commits

  • * pci/dead-code:
    PCI: Make local functions static
    PCI: Remove unused alloc_pci_dev()
    PCI: Remove unused pci_renumber_slot()
    PCI: Remove unused pcie_aspm_enabled()
    PCI: Remove unused pci_vpd_truncate()
    PCI: Remove unused ID-Based Ordering support
    PCI: Remove unused Optimized Buffer Flush/Fill support
    PCI: Remove unused Latency Tolerance Reporting support
    PCI: Removed unused parts of Page Request Interface support

    Conflicts:
    drivers/pci/pci.c
    include/linux/pci.h

    Bjorn Helgaas
     
  • Using 'make namespacecheck' identify code which should be declared static.
    Checked for users in other driver/archs as well. Compile tested only.

    This stops exporting the following interfaces to modules:

    pci_target_state()
    pci_load_saved_state()

    [bhelgaas: retained pci_find_next_ext_capability() and pci_cfg_space_size()]
    Signed-off-by: Stephen Hemminger
    Signed-off-by: Bjorn Helgaas

    Stephen Hemminger
     

16 Dec, 2013

1 commit

  • These functions:

    pcie_enable_notification()
    pciehp_power_off_slot()
    pciehp_get_power_status()
    pciehp_get_attention_status()
    pciehp_set_attention_status()
    pciehp_get_latch_status()
    pciehp_get_adapter_status()
    pcie_write_cmd()

    now always return success, so this patch makes them void and drops the
    error-checking code in their callers.

    No functional change.

    Signed-off-by: Bjorn Helgaas

    Bjorn Helgaas
     

15 Nov, 2013

1 commit


15 Aug, 2013

1 commit

  • PCIe hotplug has a bus per slot, so we can just use a normal
    secondary bus reset. However, if a slot supports surprise removal,
    a bus reset can be seen as a presence detection change triggering
    a hot-remove followed by a hot-add. Disable presence detection from
    triggering an interrupt or being polled around the bus reset.

    Signed-off-by: Alex Williamson
    Signed-off-by: Bjorn Helgaas

    Alex Williamson
     

26 Feb, 2013

1 commit

  • Pull PCI changes from Bjorn Helgaas:
    "Host bridge hotplug
    - Major overhaul of ACPI host bridge add/start (Rafael Wysocki, Yinghai Lu)
    - Major overhaul of PCI/ACPI binding (Rafael Wysocki, Yinghai Lu)
    - Split out ACPI host bridge and ACPI PCI device hotplug (Yinghai Lu)
    - Stop caching _PRT and make independent of bus numbers (Yinghai Lu)

    PCI device hotplug
    - Clean up cpqphp dead code (Sasha Levin)
    - Disable ARI unless device and upstream bridge support it (Yijing Wang)
    - Initialize all hot-added devices (not functions 0-7) (Yijing Wang)

    Power management
    - Don't touch ASPM if disabled (Joe Lawrence)
    - Fix ASPM link state management (Myron Stowe)

    Miscellaneous
    - Fix PCI_EXP_FLAGS accessor (Alex Williamson)
    - Disable Bus Master in pci_device_shutdown (Konstantin Khlebnikov)
    - Document hotplug resource and MPS parameters (Yijing Wang)
    - Add accessor for PCIe capabilities (Myron Stowe)
    - Drop pciehp suspend/resume messages (Paul Bolle)
    - Make pci_slot built-in only (not a module) (Jiang Liu)
    - Remove unused PCI/ACPI bind ops (Jiang Liu)
    - Removed used pci_root_bus (Bjorn Helgaas)"

    * tag 'pci-v3.9-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (51 commits)
    PCI/ACPI: Don't cache _PRT, and don't associate them with bus numbers
    PCI: Fix PCI Express Capability accessors for PCI_EXP_FLAGS
    ACPI / PCI: Make pci_slot built-in only, not a module
    PCI/PM: Clear state_saved during suspend
    PCI: Use atomic_inc_return() rather than atomic_add_return()
    PCI: Catch attempts to disable already-disabled devices
    PCI: Disable Bus Master unconditionally in pci_device_shutdown()
    PCI: acpiphp: Remove dead code for PCI host bridge hotplug
    PCI: acpiphp: Create companion ACPI devices before creating PCI devices
    PCI: Remove unused "rc" in virtfn_add_bus()
    PCI: pciehp: Drop suspend/resume ENTRY messages
    PCI/ASPM: Don't touch ASPM if forcibly disabled
    PCI/ASPM: Deallocate upstream link state even if device is not PCIe
    PCI: Document MPS parameters pci=pcie_bus_safe, pci=pcie_bus_perf, etc
    PCI: Document hpiosize= and hpmemsize= resource reservation parameters
    PCI: Use PCI Express Capability accessor
    PCI: Introduce accessor to retrieve PCIe Capabilities Register
    PCI: Put pci_dev in device tree as early as possible
    PCI: Skip attaching driver in device_add()
    PCI: acpiphp: Keep driver loaded even if no slots found
    ...

    Linus Torvalds
     

02 Feb, 2013

1 commit

  • In each suspend and resume cycle my laptop prints these messages at
    KERN_INFO level:
    pciehp 0000:00:1c.1:pcie04: pciehp_suspend ENTRY
    pciehp 0000:00:1c.0:pcie04: pciehp_suspend ENTRY

    and
    pciehp 0000:00:1c.0:pcie04: pciehp_resume ENTRY
    pciehp 0000:00:1c.1:pcie04: pciehp_resume ENTRY

    Drop these messages, that were probably used to debug the suspend and
    resume code, but now serve no purpose.

    Signed-off-by: Paul Bolle
    Signed-off-by: Bjorn Helgaas

    Paul Bolle
     

13 Jan, 2013

1 commit

  • When we have a hotplug-capable PCIe port with a second hotplug-capable
    PCIe port below it, removing the device below the upstream port causes
    a deadlock.

    The deadlock happens because we use the pciehp_wq workqueue to run
    pciehp_power_thread(), which uses pciehp_disable_slot() to remove devices
    below the upstream port. When we remove the downstream PCIe port, we call
    pciehp_remove(), the pciehp driver's .remove() method. That calls
    flush_workqueue(pciehp_wq), which deadlocks because the
    pciehp_power_thread() work item is still running.

    This patch avoids the deadlock by creating a workqueue for every PCIe port
    and removing the single shared workqueue.

    Here's the call path that leads to the deadlock:

    pciehp_queue_pushbutton_work
    queue_work(pciehp_wq) # queue pciehp_power_thread
    ...

    pciehp_power_thread
    pciehp_disable_slot
    remove_board
    pciehp_unconfigure_device
    pci_stop_and_remove_bus_device
    ...
    pciehp_remove # pciehp driver .remove method
    pciehp_release_ctrl
    pcie_cleanup_slot
    flush_workqueue(pciehp_wq)

    This is fairly urgent because it can be caused by simply unplugging a
    Thunderbolt adapter, as reported by Daniel below.

    [bhelgaas: changelog]
    Reference: http://lkml.kernel.org/r/CAMVG2ssiRgcTD1bej2tkUUfsWmpL5eNtPcNif9va2-Gzb2u8nQ@mail.gmail.com
    Reported-and-tested-by: Daniel J Blueman
    Reviewed-by: Kenji Kaneshige
    Signed-off-by: Yijing Wang
    Signed-off-by: Bjorn Helgaas
    CC: stable@vger.kernel.org

    Yijing Wang
     

08 Sep, 2012

1 commit

  • Previously, the driver ignored resume unless the pciehp_force module_param
    was specified. On some laptops that means that interrupts are not
    delivered after S3, so card removals and insertions are not handled.
    This patch makes the driver handle resume regardless of pciehp_force.

    [bhelgaas: changelog]
    Signed-off-by: Oliver Neukum
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Bjorn Helgaas
    Reviewed-by: Rafael J. Wysocki

    Oliver Neukum
     

13 Jan, 2012

1 commit


06 Dec, 2011

2 commits

  • Use non-ordered workqueue for attention button events.

    Attention button events on each slot can be handled asynchronously. So
    we should use non-ordered workqueue. This patch also removes ordered
    workqueue in pciehp as a result.

    Signed-off-by: Kenji Kaneshige
    Signed-off-by: Jesse Barnes

    Kenji Kaneshige
     
  • Fix improper workqueue cleanup.

    In the current pciehp, pcied_cleanup() calls destroy_workqueue()
    before calling pcie_port_service_unregister(). This causes kernel oops
    because flush_workqueue() is called in the pcie_port_service_unregister()
    code path after the workqueue was destroyed. So pcied_cleanup() must call
    pcie_port_service_unregister() first before calling destroy_workqueue().

    Signed-off-by: Kenji Kaneshige
    Signed-off-by: Jesse Barnes

    Kenji Kaneshige
     

18 Oct, 2010

1 commit

  • * Rename pciehp_wq to pciehp_ordered_wq and add non-ordered pciehp_wq
    which is used instead of the system workqueue. This is to remove
    the use of flush_scheduled_work() which is deprecated and scheduled
    for removal.

    * With cmwq in place, there's no point in creating workqueues lazily.
    Create both pciehp_wq and pciehp_ordered_wq upfront.

    * Include workqueue.h from pciehp.h.

    Signed-off-by: Tejun Heo
    Acked-by: Jesse Barnes

    Tejun Heo
     

25 Aug, 2010

1 commit

  • After commit 852972acff8f10f3a15679be2059bb94916cba5d (ACPI: Disable
    ASPM if the platform won't provide _OSC control for PCIe) control of
    the PCIe Capability Structure is unconditionally requested by
    acpi_pci_root_add(), which in principle may cause problems to
    happen in two ways. First, the BIOS may refuse to give control of
    the PCIe Capability Structure if it is not asked for any of the
    _OSC features depending on it at the same time. Second, the BIOS may
    assume that control of the _OSC features depending on the PCIe
    Capability Structure will be requested in the future and may behave
    incorrectly if that doesn't happen. For this reason, control of
    the PCIe Capability Structure should always be requested along with
    control of any other _OSC features that may depend on it (ie. PCIe
    native PME, PCIe native hot-plug, PCIe AER).

    Rework the PCIe port driver so that (1) it checks which native PCIe
    port services can be enabled, according to the BIOS, and (2) it
    requests control of all these services simultaneously. In
    particular, this causes pcie_portdrv_probe() to fail if the BIOS
    refuses to grant control of the PCIe Capability Structure, which
    means that no native PCIe port services can be enabled for the PCIe
    Root Complex the given port belongs to. If that happens, ASPM is
    disabled to avoid problems with mishandling it by the part of the
    PCIe hierarchy for which control of the PCIe Capability Structure
    has not been received.

    Make it possible to override this behavior using 'pcie_ports=native'
    (use the PCIe native services regardless of the BIOS response to the
    control request), or 'pcie_ports=compat' (do not use the PCIe native
    services at all).

    Accordingly, rework the existing PCIe port service drivers so that
    they don't request control of the services directly.

    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Jesse Barnes

    Rafael J. Wysocki
     

30 Mar, 2010

1 commit

  • …it slab.h inclusion from percpu.h

    percpu.h is included by sched.h and module.h and thus ends up being
    included when building most .c files. percpu.h includes slab.h which
    in turn includes gfp.h making everything defined by the two files
    universally available and complicating inclusion dependencies.

    percpu.h -> slab.h dependency is about to be removed. Prepare for
    this change by updating users of gfp and slab facilities include those
    headers directly instead of assuming availability. As this conversion
    needs to touch large number of source files, the following script is
    used as the basis of conversion.

    http://userweb.kernel.org/~tj/misc/slabh-sweep.py

    The script does the followings.

    * Scan files for gfp and slab usages and update includes such that
    only the necessary includes are there. ie. if only gfp is used,
    gfp.h, if slab is used, slab.h.

    * When the script inserts a new include, it looks at the include
    blocks and try to put the new include such that its order conforms
    to its surrounding. It's put in the include block which contains
    core kernel includes, in the same order that the rest are ordered -
    alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
    doesn't seem to be any matching order.

    * If the script can't find a place to put a new include (mostly
    because the file doesn't have fitting include block), it prints out
    an error message indicating which .h file needs to be added to the
    file.

    The conversion was done in the following steps.

    1. The initial automatic conversion of all .c files updated slightly
    over 4000 files, deleting around 700 includes and adding ~480 gfp.h
    and ~3000 slab.h inclusions. The script emitted errors for ~400
    files.

    2. Each error was manually checked. Some didn't need the inclusion,
    some needed manual addition while adding it to implementation .h or
    embedding .c file was more appropriate for others. This step added
    inclusions to around 150 files.

    3. The script was run again and the output was compared to the edits
    from #2 to make sure no file was left behind.

    4. Several build tests were done and a couple of problems were fixed.
    e.g. lib/decompress_*.c used malloc/free() wrappers around slab
    APIs requiring slab.h to be added manually.

    5. The script was run on all .h files but without automatically
    editing them as sprinkling gfp.h and slab.h inclusions around .h
    files could easily lead to inclusion dependency hell. Most gfp.h
    inclusion directives were ignored as stuff from gfp.h was usually
    wildly available and often used in preprocessor macros. Each
    slab.h inclusion directive was examined and added manually as
    necessary.

    6. percpu.h was updated not to include slab.h.

    7. Build test were done on the following configurations and failures
    were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
    distributed build env didn't work with gcov compiles) and a few
    more options had to be turned off depending on archs to make things
    build (like ipr on powerpc/64 which failed due to missing writeq).

    * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
    * powerpc and powerpc64 SMP allmodconfig
    * sparc and sparc64 SMP allmodconfig
    * ia64 SMP allmodconfig
    * s390 SMP allmodconfig
    * alpha SMP allmodconfig
    * um on x86_64 SMP allmodconfig

    8. percpu.h modifications were reverted so that it could be applied as
    a separate patch and serve as bisection point.

    Given the fact that I had only a couple of failures from tests on step
    6, I'm fairly confident about the coverage of this conversion patch.
    If there is a breakage, it's likely to be something in one of the arch
    headers which should be easily discoverable easily on most builds of
    the specific arch.

    Signed-off-by: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

23 Feb, 2010

1 commit


05 Nov, 2009

4 commits


18 Sep, 2009

5 commits