1. 18 6月, 2014 2 次提交
    • B
      PCI: pciehp: Compute timeout from hotplug command start time · 40b96083
      Bjorn Helgaas 提交于
      If we issue a hotplug command, go do something else, then come back and
      wait for the command to complete, we don't have to wait the whole timeout
      period, because some of it elapsed while we were doing something else.
      
      Keep track of the time we issued the command, and wait only until the
      timeout period from that point has elapsed.
      
      For controllers with errata like Intel CF118, we previously timed out
      before issuing the second hotplug command:
      
        At time T1 (during boot):
          - Write DLLSCE, ABPE, PDCE, etc. to Slot Control
        At time T2 (hotplug event):
          - Wait for command completion (CC) in Slot Status
          - Timeout at T2 + 1 second because CC is never set in Slot Status
          - Write PCC, PIC, etc. to Slot Control
      
      With this change, we wait until T1 + 1 second instead of T2 + 1 second.
      If the hotplug event is more than 1 second after the boot-time
      initialization, we won't wait for the timeout at all.
      
      We still emit a "Timeout on hotplug command" message if it timed out; we
      should see this on the first hotplug event on every controller with this
      erratum, as well as on real errors on controllers without the erratum.
      
      Link: http://www.intel.com/content/www/us/en/processors/xeon/xeon-e7-v2-spec-update.html
      Tested-by: Rajat Jain <rajatxjain@gmail.com>	(IDT 807a controller)
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      40b96083
    • B
      PCI: pciehp: Wait for hotplug command completion lazily · 3461a068
      Bjorn Helgaas 提交于
      Previously we issued a hotplug command and waited for it to complete.  But
      there's no need to wait until we're ready to issue the *next* command.  The
      next command will probably be much later, so the first one may have already
      completed and we may not have to actually wait at all.
      
      Because of hardware errata, some controllers generate command completion
      events for some commands but not others.  In the case of Intel CF118 (see
      spec update reference), the controller indicates command completion only
      for Slot Control writes that change the value of the following bits:
      
        Power Controller Control
        Power Indicator Control
        Attention Indicator Control
        Electromechanical Interlock Control
      
      Changes to other bits, e.g., the interrupt enable bits, do not cause the
      Command Completed bit to be set.  Controllers from AMD and Nvidia are
      reported to have similar errata.
      
      These errata cause timeouts when pcie_enable_notification() enables
      interrupts.  Previously that timeout occurred at boot-time.  With this
      change, the timeout occurs later, when we change the state of the slot
      power, indicators, or interlock.  This speeds up boot but causes a timeout
      at the first hotplug event on the slot.  Subsequent events don't timeout
      because only the first (boot-time) hotplug command updates Slot Control
      without touching the power/indicator/interlock controls.
      
      Link: http://www.intel.com/content/www/us/en/processors/xeon/xeon-e7-v2-spec-update.html
      Tested-by: Rajat Jain <rajatxjain@gmail.com>	(IDT 807a controller)
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      3461a068
  2. 17 6月, 2014 2 次提交
  3. 12 6月, 2014 1 次提交
  4. 11 6月, 2014 3 次提交
  5. 28 5月, 2014 6 次提交
  6. 16 5月, 2014 1 次提交
  7. 30 4月, 2014 1 次提交
    • B
      PCI: Remove unnecessary __ref annotations · 10874f5a
      Bjorn Helgaas 提交于
      Some PCI functions used to be marked __devinit.  When CONFIG_HOTPLUG was
      not set, these functions were discarded after boot.  A few callers of these
      __devinit functions were marked __ref to indicate that they could safely
      call the __devinit functions even though the callers were not __devinit.
      
      But CONFIG_HOTPLUG and __devinit are now gone, and the need for the __ref
      annotations is also gone, so remove them.  Relevant historical commits:
      
        54b956b9 Remove __dev* markings from init.h
        a8e4b9c1 PCI: add generic pci_hp_add_bridge()
        0ab2b57f PCI: fix section mismatch warning in pci_scan_child_bus
        451124a7 PCI: fix 4x section mismatch warnings
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      10874f5a
  8. 26 4月, 2014 1 次提交
    • L
      PCI: rphahp: Fix endianess issues · 761ce533
      Laurent Dufour 提交于
      Numerical values stored in the device tree are encoded in Big Endian and
      should be byte swapped when running in Little Endian.
      
      The RPA hotplug module should convert those values as well.
      
      Note that in rpaphp_get_drc_props(), the comparison between indexes[i+1]
      and *index is done using the BE values (whatever is the current endianess).
      This doesn't matter since we are checking for equality here.  This way only
      the returned value is byte swapped.
      
      RPA also made RTAS calls which implies BE values to be used.  According to
      the patch done in RTAS (http://patchwork.ozlabs.org/patch/336865), no
      additional conversion is required in RPA.
      Signed-off-by: NLaurent Dufour <ldufour@linux.vnet.ibm.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      761ce533
  9. 25 4月, 2014 1 次提交
  10. 15 4月, 2014 3 次提交
  11. 05 3月, 2014 1 次提交
  12. 21 2月, 2014 5 次提交
  13. 20 2月, 2014 2 次提交
  14. 16 2月, 2014 2 次提交
    • R
      ACPI / hotplug / PCI: Add ACPIPHP contexts to devices handled by PCIeHP · cc6254e0
      Rafael J. Wysocki 提交于
      Currently, ACPIPHP does not add hotplug context to devices that
      should be handled by the native PCI hotplug (PCIeHP) code.  The
      reason why was because PCIeHP didn't know about the devices'
      connections with ACPI and would not clean up things properly
      during an eject of an ACPI-backed device, for example.
      
      However, after recent changes that made the ACPI core create struct
      acpi_device objects for all namespace nodes regardless of the
      underlying devices' status and added PCI rescan-remove locking to
      both ACPIPHP and PCIeHP, that concern is not valid any more.
      Namely, after those changes PCIeHP need not care about the ACPI
      side of things any more and it should be serialized with respect to
      ACPIPHP and they won't be running concurrently with each other in
      any case.
      
      For this reason, make ACPIPHP to add its hotplug context to
      all devices with ACPI companions, even the ones that should be
      handled by PCIeHP in principle.  That may work around hotplug
      issues on some systems where PCIeHP is supposed to work, but it
      doesn't and the ACPI hotplug signaling works instead.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      cc6254e0
    • R
      ACPI / hotplug / PCI: Rename register_slot() to acpiphp_add_context() · 3799c5a0
      Rafael J. Wysocki 提交于
      The name of register_slot() doesn't really reflect what the function
      is does, so rename it to acpiphp_add_context() and add a proper
      kerneldoc comment to it.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      3799c5a0
  15. 15 2月, 2014 2 次提交
  16. 13 2月, 2014 1 次提交
  17. 12 2月, 2014 6 次提交
    • M
      ACPI / hotplug / PCI: Relax the checking of _STA return values · 72820594
      Mika Westerberg 提交于
      The ACPI specification (ACPI 5.0A, Section 6.3.7) says:
      
       _STA may return bit 0 clear (not present) with bit 3 set (device is
       functional). This case is used to indicate a valid device for which
       no device driver should be loaded (for example, a bridge device.)
       Children of this device may be present and valid. OSPM should
       continue enumeration below a device whose _STA returns this bit
       combination.
      
      Evidently, some BIOSes follow that and return 0x0A from _STA, which
      causes problems to happen when they trigger bus check or device check
      notifications for those devices too.  Namely, ACPIPHP thinks that they
      are gone and may drop them, for example, if such a notification is
      triggered during a resume from system suspend.
      
      To fix that, modify ACPICA to regard devies as present and
      functioning if _STA returns both the ACPI_STA_DEVICE_ENABLED
      and ACPI_STA_DEVICE_FUNCTIONING bits set for them.
      Reported-and-tested-by: NPeter Wu <lekensteyn@gmail.com>
      Cc: 3.12+ <stable@vger.kernel.org> # 3.12+
      [rjw: Subject and changelog, minor code modifications]
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      72820594
    • R
      PCI: pciehp: Add hotplug_lock to serialize hotplug events · 50b52fde
      Rajat Jain 提交于
      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: NRajat Jain <rajatxjain@gmail.com>
      Signed-off-by: NRajat Jain <rajatjain@juniper.net>
      Signed-off-by: NGuenter Roeck <groeck@juniper.net>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      50b52fde
    • R
      PCI: pciehp: Ensure very fast hotplug events are also processed · c4f2f5e4
      Rajat Jain 提交于
      Today, this is how all the hotplug and unplug events work:
      
      Hotplug / Removal needs to be done
        => Set slot->state (protected by slot->lock) to either
          POWERON_STATE (for enabling) or POWEROFF_STATE (for disabling).
        => Submit the work item for pciehp_power_thread() to slot->wq.
      
      Problem:
        There is a problem if the hotplug events can happen fast enough that
        they do not give SW enough time to add or remove the new devices.
      
        => Assume: Event for unplug comes (e.g. surprise removal). But
           before the pciehp_power_thread() work item was executed, the
           card was replaced by another card, causing surprise hotplug event.
      
        => What goes wrong:
          => The hot-removal event sets slot->state to POWEROFF_STATE, and
             schedules the pciehp_power_thread().
          => The hot-add event sets slot->state to POWERON_STATE, and
             schedules the pciehp_power_thread().
          => Now the pciehp_power_thread() is scheduled twice, and on both
             occasions it will find POWERON_STATE and will try to add the
             devices on the slot, and will fail complaining that the devices
             already exist.
      
        => Why this is a problem: If the device was replaced between the hot
           removal and hot-add, then we should unload the old driver and
           reload the new one. This does not happen today. The kernel or the
           driver is not even aware that the device was replaced.
      
           The problem is that the pciehp_power_thread() only looks at the
           slot->state which would only contain the *latest* state - not
           the actual event (add / remove) that was the intent of the IRQ
           handler who submitted the work.
      
      What this patch does:
      
        => Hotplug events pass on an actual request (for addition or removal)
           to pciehp_power_thread() which is local to that work item
           submission.
      
        => pciehp_power_thread() does not need to look at slote->state and
           hence no locks needed in that.
      
        => Essentially this results in all the hotplug and unplug events
           "replayed" by pciehp_power_thread().
      Signed-off-by: NRajat Jain <rajatxjain@gmail.com>
      Signed-off-by: NRajat Jain <rajatjain@juniper.net>
      Signed-off-by: NGuenter Roeck <groeck@juniper.net>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      c4f2f5e4
    • R
      PCI: pciehp: Disable link notification across slot reset · 06a8d89a
      Rajat Jain 提交于
      Disable the link notification (in addition to presence detect
      notifications) across the slot reset since the reset could flap the link,
      and we don't want to treat it as hot unplug followed by a hotplug.
      Signed-off-by: NRajat Jain <rajatxjain@gmail.com>
      Signed-off-by: NRajat Jain <rajatjain@juniper.net>
      Signed-off-by: NGuenter Roeck <groeck@juniper.net>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      06a8d89a
    • R
      PCI: pciehp: Don't check adapter or latch status while disabling · 02e93a8a
      Rajat Jain 提交于
      It does not make much sense to refuse to disable a slot if an adapter is
      not present or the latch is open. If an adapter is not present, it provides
      an even better reason to disable the device slot.
      
      This is specially a problem for link state hot-plug, because some ports use
      in band mechanism for presence detection. Thus when link goes down,
      presence detect also goes down. We _want_ that the removal should take
      place in such case.
      
      Thus remove the checks for adapter and latch in pciehp_disable_slot()
      Signed-off-by: NRajat Jain <rajatxjain@gmail.com>
      Signed-off-by: NRajat Jain <rajatjain@juniper.net>
      Signed-off-by: NGuenter Roeck <groeck@juniper.net>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      02e93a8a
    • R
      PCI: pciehp: Don't disable the link permanently during removal · b1811d24
      Rajat Jain 提交于
      We need future link up events for hot-add, thus don't disable the link
      permanently during device removal. Also, remove the static functions that
      are now left unused.
      
      This reverts part of 2debd928 ("PCI: pciehp: Disable/enable link during
      slot power off/on").  This was discussed at the URL below, where it was
      revealed that it was done for a bug in a PCIe repeater chip on that
      particular platform.
      
      Link: https://lkml.kernel.org/r/CAErSpo72KZ-a2OSQLWoK71GCgwBt676XZdGt4tEYm-6UYnLmPw@mail.gmail.comSigned-off-by: NRajat Jain <rajatxjain@gmail.com>
      Signed-off-by: NRajat Jain <rajatjain@juniper.net>
      Signed-off-by: NGuenter Roeck <groeck@juniper.net>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      b1811d24