1. 15 9月, 2016 2 次提交
    • B
      PCI/AER: Remove aerdriver.forceload kernel parameter · 7ece1417
      Bjorn Helgaas 提交于
      Per the PCI Firmware spec, r3.0, sec 4.5.1, on ACPI systems, the OS must
      not use AER unless _OSC is present and _OSC grants AER control to the OS.
      The aerdriver.forceload kernel parameter was a way to enable Linux AER
      support on ACPI systems that lack _OSC or fail to grant control the the OS.
      
      Enabling Linux AER support when the firmware doesn't want us to is a recipe
      for problems, e.g., the firmware might be handling AER itself.
      
      Remove the aerdriver.forceload kernel parameter and related supporting
      code.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      7ece1417
    • B
      PCI/AER: Remove aerdriver.nosourceid kernel parameter · 9ff25e6b
      Bjorn Helgaas 提交于
      The aerdriver.nosourceid kernel parameter was intended for working around
      broken chipsets don't supply the source ID for AER events.  We recently
      added PCI_BUS_FLAGS_NO_AERSID, which can be set by quirks for the same
      purpose.
      
      Remove the aerdriver.nosourceid kernel parameter.  For anything other than
      debugging, asking users to find and use kernel parameters is a poor user
      experience.  Instead, we should add PCI_BUS_FLAGS_NO_AERSID quirks for any
      hardware that needs it.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      9ff25e6b
  2. 07 9月, 2016 1 次提交
  3. 26 7月, 2016 2 次提交
  4. 22 6月, 2016 2 次提交
  5. 14 6月, 2016 2 次提交
  6. 11 6月, 2016 1 次提交
  7. 05 5月, 2016 1 次提交
  8. 03 5月, 2016 3 次提交
  9. 09 4月, 2016 2 次提交
  10. 15 3月, 2016 1 次提交
  11. 09 3月, 2016 4 次提交
  12. 06 2月, 2016 2 次提交
    • B
      PCI/PME: Restructure pcie_pme_suspend() to prevent compiler warning · 41ccebae
      Bjorn Helgaas 提交于
      Previously we had this:
      
        if (wakeup)
          ret = enable_irq_wake(...);
        if (!wakeup || ret)
          ...
      
      "ret" is only evaluated when "wakeup" is true, and it is always initialized
      in that case, but gcc isn't smart enough to figure that out and warns:
      
        drivers/pci/pcie/pme.c:414:14: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
      
      Restructure the code slightly to make it easier for gcc (and maybe for
      humans as well).
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com
      41ccebae
    • B
      PCI/PME: Remove redundant port lookup · 4e48fe41
      Bjorn Helgaas 提交于
      We've already looked up srv->port a few lines earlier, and there's no need
      to do it again.  Remove the redundant lookup.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com
      4e48fe41
  13. 05 2月, 2016 3 次提交
  14. 26 1月, 2016 1 次提交
    • S
      PCI/AER: Flush workqueue on device remove to avoid use-after-free · 4ae2182b
      Sebastian Andrzej Siewior 提交于
      A Root Port's AER structure (rpc) contains a queue of events.  aer_irq()
      enqueues AER status information and schedules aer_isr() to dequeue and
      process it.  When we remove a device, aer_remove() waits for the queue to
      be empty, then frees the rpc struct.
      
      But aer_isr() references the rpc struct after dequeueing and possibly
      emptying the queue, which can cause a use-after-free error as in the
      following scenario with two threads, aer_isr() on the left and a
      concurrent aer_remove() on the right:
      
        Thread A                      Thread B
        --------                      --------
        aer_irq():
          rpc->prod_idx++
                                      aer_remove():
                                        wait_event(rpc->prod_idx == rpc->cons_idx)
                                        # now blocked until queue becomes empty
        aer_isr():                      # ...
          rpc->cons_idx++               # unblocked because queue is now empty
          ...                           kfree(rpc)
          mutex_unlock(&rpc->rpc_mutex)
      
      To prevent this problem, use flush_work() to wait until the last scheduled
      instance of aer_isr() has completed before freeing the rpc struct in
      aer_remove().
      
      I reproduced this use-after-free by flashing a device FPGA and
      re-enumerating the bus to find the new device.  With SLUB debug, this
      crashes with 0x6b bytes (POISON_FREE, the use-after-free magic number) in
      GPR25:
      
        pcieport 0000:00:00.0: AER: Multiple Corrected error received: id=0000
        Unable to handle kernel paging request for data at address 0x27ef9e3e
        Workqueue: events aer_isr
        GPR24: dd6aa000 6b6b6b6b 605f8378 605f8360 d99b12c0 604fc674 606b1704 d99b12c0
        NIP [602f5328] pci_walk_bus+0xd4/0x104
      
      [bhelgaas: changelog, stable tag]
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      CC: stable@vger.kernel.org
      4ae2182b
  15. 16 1月, 2016 1 次提交
  16. 11 12月, 2015 1 次提交
    • B
      PCI: Check for PCI_HEADER_TYPE_BRIDGE equality, not bitmask · 93de6901
      Bjorn Helgaas 提交于
      Bit 7 of the "Header Type" register indicates a multi-function device when
      set.  Bits 0-6 contain encoded values, where 0x1 indicates a PCI-PCI
      bridge.  It is incorrect to test this as though it were a mask.
      
      For example, while the PCI 3.0 spec only defines values 0x0, 0x1, and 0x2,
      it's conceivable that a future spec could define 0x3 to mean something
      else; then tests for "(hdr_type & 0x7f) & PCI_HEADER_TYPE_BRIDGE" would
      incorrectly succeed for this new 0x3 header type.
      
      Test bits 0-6 of the Header Type for equality with PCI_HEADER_TYPE_BRIDGE.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      93de6901
  17. 04 12月, 2015 1 次提交
    • A
      PCI/ASPM: Make sysfs link_state_store() consistent with link_state_show() · 57d86a04
      Andy Lutomirski 提交于
      If CONFIG_PCIEASPM_DEBUG is set, then PCI devices have a link_state
      attribute.  Reading that attribute shows the state as a bit mask: 1
      means L0S upstream, 2 means L0S downstream, and 4 means L1.
      
      Oddly, writing to link_state is inconsistent and gets translated, leading
      to mysterious results in which the value you store isn't comparable the
      value you load back out.
      
      Fix it by making link_state_store() match link_state_show().
      
      [bhelgaas: Check "aspm_disabled" *before* validating input.  When
      "aspm_disabled" is set, this changes the error for invalid input from
      -EINVAL to -EPERM.]
      Signed-off-by: NAndy Lutomirski <luto@kernel.org>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      57d86a04
  18. 17 9月, 2015 1 次提交
  19. 15 7月, 2015 1 次提交
  20. 11 6月, 2015 1 次提交
  21. 30 5月, 2015 1 次提交
  22. 27 5月, 2015 1 次提交
    • Y
      PCI/ASPM: Use dev->has_secondary_link to find downstream links · c8fc9339
      Yijing Wang 提交于
      We allocate pcie_link_state for the component at the upstream end of a
      Link.  Previously we did this by allocating pcie_link_state for Root Ports
      and Downstream Ports.  This works fine for the typical topology:
      
        00:1c.0 Root Port       [bridge to bus 02]
        02:00.0 Upstream Port   [bridge to bus 03]
        03:00.0 Downstream Port [bridge to bus 04]
        04:00.0 Endpoint or Switch Port
      
      However, it is possible to have a Root Port connected to a Downstream Port
      instead of an Upstream Port, as in Robert White's ATCA system:
      
        00:1c.0 Root Port       [bridge to bus 02]
        02:00.0 Downstream Port [bridge to bus 03]
        03:01.0 Downstream Port [bridge to bus 04]
        04:00.0 Endpoint or Switch Port
      
      In this topology, we wrongly allocated pcie_link_state for the 02:00.0
      Downstream Port, which is actually the *downstream* end of a link.  This
      led to the following NULL pointer dereference when we tried to connect this
      link into the tree of links starting at the 00:1c.0 Root Port:
      
        BUG: unable to handle kernel NULL pointer dereference at 0000000000000088
        IP: [<ffffffff81550324>] pcie_aspm_init_link_state+0x744/0x850
        Hardware name: Kontron B3001/B3001, BIOS 4.6.3 08/07/2012
        Call Trace:
         [<ffffffff8153b865>] pci_scan_slot+0xd5/0x120
         [<ffffffff8153ca1d>] pci_scan_child_bus+0x2d/0xd0
         ...
      
      Instead of relying on the component type to identify the upstream end of a
      link, use the "dev->has_secondary_link" field.
      
      This means it's now possible for an Upstream Port to have a link on its
      secondary side, so alloc_pcie_link_state() needs to connect links
      originating from both Upstream and Downstream Ports into the tree.
      
      [bhelgaas: changelog, add comment]
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=94361
      Link: http://lkml.kernel.org/r/54EB81B2.4050904@pobox.comReported-by: NRobert White <rwhite@pobox.com>
      Signed-off-by: NYijing Wang <wangyijing@huawei.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      c8fc9339
  23. 21 5月, 2015 2 次提交
  24. 10 4月, 2015 1 次提交
  25. 07 3月, 2015 1 次提交
    • R
      PCI/AER: Avoid info leak in __print_tlp_header() · a1b7f2f6
      Rasmus Villemoes 提交于
      Commit fab4c256 ("PCI/AER: Add a TLP header print helper") introduced
      the helper function __print_tlp_header(), but contrary to the intention,
      the behaviour did change: Since we're taking the address of the parameter
      t, the first 4 or 8 bytes printed will be the value of the pointer t
      itself, and the remaining 12 or 8 bytes will be who-knows-what (something
      from the stack).
      
      We want to show the values of the four members of the struct
      aer_header_log_regs; that can be done without ugly and error-prone casts.
      On little-endian this should produce the same output as originally
      intended, and since no-one has complained about getting garbage output so
      far, I think big-endian should be ok too.
      
      Fixes: fab4c256 ("PCI/AER: Add a TLP header print helper")
      Signed-off-by: NRasmus Villemoes <linux@rasmusvillemoes.dk>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: NBorislav Petkov <bp@suse.de>
      CC: stable@vger.kernel.org	# v3.14+
      a1b7f2f6
  26. 10 1月, 2015 1 次提交