You need to sign in or sign up before continuing.
  1. 14 6月, 2012 1 次提交
  2. 21 5月, 2012 1 次提交
  3. 01 5月, 2012 2 次提交
    • K
      PCI: move mutex locking out of pci_dev_reset function · 977f857c
      Konrad Rzeszutek Wilk 提交于
      The intent of git commit 6fbf9e7a
      "PCI: Introduce __pci_reset_function_locked to be used when holding
      device_lock." was to have a non-locking function that would call
      pci_dev_reset function.
      
      But it fell short of that by just probing and not actually reseting
      the device. To make that work we need a way to move the lock
      around device_lock to not be in pci_dev_reset (as the caller of
      __pci_reset_function_locked already holds said lock). We do this by
      renaming pci_dev_reset to __pci_dev_reset and bubbling said mutex out
      of __pci_dev_reset to pci_dev_reset (a wrapper around __pci_dev_reset).
      The __pci_reset_function_locked  can now call __pci_dev_reset without
      having to worry about the dead-lock.
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      977f857c
    • B
      PCI: work around Stratus ftServer broken PCIe hierarchy · 284f5f9d
      Bjorn Helgaas 提交于
      A PCIe downstream port is a P2P bridge.  Its secondary interface is
      a link that should lead only to device 0 (unless ARI is enabled)[1], so
      we don't probe for non-zero device numbers.
      
      Some Stratus ftServer systems have a PCIe downstream port (02:00.0) that
      leads to both an upstream port (03:00.0) and a downstream port (03:01.0),
      and 03:01.0 has important devices below it:
      
        [0000:02]-+-00.0-[03-3c]--+-00.0-[04-09]--...
                                  \-01.0-[0a-0d]--+-[USB]
                                                  +-[NIC]
                                                  +-...
      
      Previously, we didn't enumerate device 03:01.0, so USB and the network
      didn't work.  This patch adds a DMI quirk to scan all device numbers,
      not just 0, below a downstream port.
      
      Based on a patch by Prarit Bhargava.
      
      [1] PCIe spec r3.0, sec 7.3.1
      
      CC: Myron Stowe <mstowe@redhat.com>
      CC: Don Dutile <ddutile@redhat.com>
      CC: James Paradis <james.paradis@stratus.com>
      CC: Matthew Wilcox <matthew.r.wilcox@intel.com>
      CC: Jesse Barnes <jbarnes@virtuousgeek.org>
      CC: Prarit Bhargava <prarit@redhat.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      284f5f9d
  4. 17 4月, 2012 1 次提交
    • R
      PCI: Retry BARs restoration for Type 0 headers only · a6cb9ee7
      Rafael J. Wysocki 提交于
      Some shortcomings introduced into pci_restore_state() by commit
      26f41062 ("PCI: check for pci bar restore completion and retry")
      have been fixed by recent commit ebfc5b80 ("PCI: Fix regression in
      pci_restore_state(), v3"), but that commit treats all PCI devices as
      those with Type 0 configuration headers.
      
      That is not entirely correct, because Type 1 and Type 2 headers have
      different layouts.  In particular, the area occupied by BARs in Type 0
      config headers contains the secondary status register in Type 1 ones and
      it doesn't make sense to retry the restoration of that register even if
      the value read back from it after a write is not the same as the written
      one (it very well may be different).
      
      For this reason, make pci_restore_state() only retry the restoration
      of BARs for Type 0 config headers.  This effectively makes it behave
      as before commit 26f41062 for all header types except for Type 0.
      Tested-by: NMikko Vinni <mmvinni@yahoo.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a6cb9ee7
  5. 16 4月, 2012 1 次提交
    • R
      PCI: Fix regression in pci_restore_state(), v3 · ebfc5b80
      Rafael J. Wysocki 提交于
      Commit 26f41062 ("PCI: check for pci bar restore completion and
      retry") attempted to address problems with PCI BAR restoration on
      systems where FLR had not been completed before pci_restore_state() was
      called, but it did that in an utterly wrong way.
      
      First off, instead of retrying the writes for the BAR registers only, it
      did that for all of the PCI config space of the device, including the
      status register (whose value after the write quite obviously need not be
      the same as the written one).  Second, it added arbitrary delay to
      pci_restore_state() even for systems where the PCI config space
      restoration was successful at first attempt.  Finally, the mdelay(10) it
      added to every iteration of the writing loop was way too much of a delay
      for any reasonable device.
      
      All of this actually caused resume failures for some devices on Mikko's
      system.
      
      To fix the regression, make pci_restore_state() only retry the writes
      for BAR registers and only wait if the first read from the register
      doesn't return the written value.  Additionaly, make it wait for 1 ms,
      instead of 10 ms, after every failing attempt to write into config
      space.
      Reported-by: NMikko Vinni <mmvinni@yahoo.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      ebfc5b80
  6. 02 3月, 2012 1 次提交
    • R
      PCI / PCIe: Introduce command line option to disable ARI · 6748dcc2
      Rafael J. Wysocki 提交于
      There are PCIe devices on the market that report ARI support but
      then fail to initialize correctly when ARI is actually used.  This
      leads to situations in which kernels 2.6.34 and newer fail to handle
      systems where the previous kernels worked without any apparent
      problems.  Unfortunately, it is currently unknown how many such
      devices are there.
      
      For this reason, introduce a new kernel command line option,
      pci=noari, allowing users to disable PCIe ARI altogether if they
      see problems with PCIe device initialization.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      6748dcc2
  7. 25 2月, 2012 2 次提交
  8. 24 2月, 2012 2 次提交
    • Y
      PCI: move pci_find_saved_cap out of linux/pci.h · 34a4876e
      Yinghai Lu 提交于
      Only one user in driver/pci/pci.c, so we don't need to put it in global
      pci.h
      Reviewed-by: NBjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: NYinghai Lu <yinghai@kernel.org>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      34a4876e
    • Y
      PCI: fix memleak for pci dev removing during hotplug · f796841e
      Yinghai Lu 提交于
      unreferenced object 0xffff880276d17700 (size 64):
        comm "swapper/0", pid 1, jiffies 4294897182 (age 3976.028s)
        hex dump (first 32 bytes):
          00 00 00 00 00 00 00 00 18 f9 de 76 02 88 ff ff  ...........v....
          10 00 00 00 0e 00 00 00 0f 28 40 00 00 00 00 00  .........(@.....
        backtrace:
          [<ffffffff81c8aede>] kmemleak_alloc+0x26/0x43
          [<ffffffff811385f0>] __kmalloc+0x121/0x183
          [<ffffffff813cf821>] pci_add_cap_save_buffer+0x35/0x7c
          [<ffffffff813d12b7>] pci_allocate_cap_save_buffers+0x1d/0x65
          [<ffffffff813cdb52>] pci_device_add+0x92/0xf1
          [<ffffffff81c8afe6>] pci_scan_single_device+0x9f/0xa1
          [<ffffffff813cdbd2>] pci_scan_slot.part.20+0x21/0x106
          [<ffffffff813cdce2>] pci_scan_slot+0x2b/0x35
          [<ffffffff81c8dae4>] __pci_scan_child_bus+0x51/0x107
          [<ffffffff81c8d75b>] pci_scan_bridge+0x376/0x6ae
          [<ffffffff81c8db60>] __pci_scan_child_bus+0xcd/0x107
          [<ffffffff81c8dbab>] pci_scan_child_bus+0x11/0x2a
          [<ffffffff81cca58c>] pci_acpi_scan_root+0x18b/0x21c
          [<ffffffff81c916be>] acpi_pci_root_add+0x1e1/0x42a
          [<ffffffff81406210>] acpi_device_probe+0x50/0x190
          [<ffffffff814a0227>] really_probe+0x99/0x126
      
      Need to free saved_buffer for capabilities.
      Signed-off-by: NYinghai Lu <yinghai@kernel.org>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      f796841e
  9. 15 2月, 2012 2 次提交
  10. 24 1月, 2012 1 次提交
    • R
      kernel-doc: fix new warnings in pci · 6e9292c5
      Randy Dunlap 提交于
      Fix new kernel-doc warnings:
      
      Warning(drivers/pci/pci.c:2811): No description found for parameter 'dev'
      Warning(drivers/pci/pci.c:2811): Excess function parameter 'pdev' description in 'pci_intx_mask_supported'
      Warning(drivers/pci/pci.c:2894): No description found for parameter 'dev'
      Warning(drivers/pci/pci.c:2894): Excess function parameter 'pdev' description in 'pci_check_and_mask_intx'
      Warning(drivers/pci/pci.c:2908): No description found for parameter 'dev'
      Warning(drivers/pci/pci.c:2908): Excess function parameter 'pdev' description in 'pci_check_and_unmask_intx'
      Signed-off-by: NRandy Dunlap <rdunlap@xenotime.net>
      Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      6e9292c5
  11. 13 1月, 2012 1 次提交
    • K
      pci: Introduce __pci_reset_function_locked to be used when holding device_lock. · a96d627a
      Konrad Rzeszutek Wilk 提交于
      The use case of this is when a driver wants to call FLR when a device
      is attached to it using the SysFS "bind" or "unbind" functionality.
      
      The call chain when a user does "bind" looks as so:
      
       echo "0000:01.07.0" > /sys/bus/pci/drivers/XXXX/bind
      
      and ends up calling:
        driver_bind:
          device_lock(dev);  <=== TAKES LOCK
          XXXX_probe:
               .. pci_enable_device()
               ...__pci_reset_function(), which calls
                       pci_dev_reset(dev, 0):
                              if (!0) {
                                      device_lock(dev) <==== DEADLOCK
      
      The __pci_reset_function_locked function allows the the drivers
      'probe' function to call the "pci_reset_function" while still holding
      the driver mutex lock.
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      a96d627a
  12. 07 1月, 2012 6 次提交
  13. 19 12月, 2011 1 次提交
  14. 15 12月, 2011 1 次提交
    • A
      PCI: Set device power state to PCI_D0 for device without native PM support · b51306c6
      Ajaykumar Hotchandani 提交于
      During test of one IB card with guest VM, found that, msi is not
      initialized properly.
      
      It turns out __write_msi_msg will do nothing if device current_state is
      not PCI_D0.  And, that pci device does not have pm_cap in guest VM.
      
      There is an error in setting of power state to PCI_D0 in
      pci_enable_device(), but error is not returned for this.  Following is
      code flow:
      
      pci_enable_device() -->   __pci_enable_device_flags() -->
      do_pci_enable_device() -->   pci_set_power_state() -->
      __pci_start_power_transition()
      
      We have following condition inside __pci_start_power_transition():
               if (platform_pci_power_manageable(dev)) {
                       error = platform_pci_set_power_state(dev, state);
                       if (!error)
                               pci_update_current_state(dev, state);
               } else {
                       error = -ENODEV;
                       /* Fall back to PCI_D0 if native PM is not supported */
                       if (!dev->pm_cap)
                               dev->current_state = PCI_D0;
               }
      
      Here, from platform_pci_set_power_state(), acpi_pci_set_power_state() is
      getting called and that is failing with ENODEV because of following
      condition:
      
               if (!handle || ACPI_SUCCESS(acpi_get_handle(handle, "_EJ0",&tmp)))
                       return -ENODEV;
      
      Because of that, pci_update_current_state() is not getting called.
      
      With this patch, if device power state can not be set via
      platform_pci_set_power_state and that device does not have native pm
      support, then PCI device power state will be set to PCI_D0.
      
      -v2: This also reverts 47e9037a, as it's
           not needed after this change.
      Acked-by: N"Rafael J. Wysocki" <rjw@sisk.pl>
      Signed-off-by: Ajaykumar Hotchandani<ajaykumar.hotchandani@oracle.com>
      Signed-off-by: Yinghai Lu<yinghai.lu@oracle.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      b51306c6
  15. 06 12月, 2011 1 次提交
    • R
      PCI: defer enablement of SRIOV BARS · bbef98ab
      Ram Pai 提交于
      All the PCI BARs of a device are enabled when the device is enabled
      using pci_enable_device().  This unnecessarily enables SRIOV BARs of the
      device.
      
      On some platforms, which do not support SRIOV as yet, the
      pci_enable_device() fails to enable the device if its SRIOV BARs are not
      allocated resources correctly.
      
      The following patch fixes the above problem. The SRIOV BARs are now
      enabled when IOV capability of the device is enabled in sriov_enable().
      
      NOTE: Note, there is subtle change in the pci_enable_device() API.  Any
      driver that depends on SRIOV BARS to be enabled in pci_enable_device()
      can fail.
      
      The patch has been touch tested on power and x86 platform.
      Tested-by: NMichael Wang <wangyun@linux.vnet.ibm.com>
      Signed-off-by: NRam Pai <linuxram@us.ibm.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      bbef98ab
  16. 28 10月, 2011 1 次提交
  17. 15 10月, 2011 1 次提交
    • R
      PCI / PM: Extend PME polling to all PCI devices · 379021d5
      Rafael J. Wysocki 提交于
      The land of PCI power management is a land of sorrow and ugliness,
      especially in the area of signaling events by devices.  There are
      devices that set their PME Status bits, but don't really bother
      to send a PME message or assert PME#.  There are hardware vendors
      who don't connect PME# lines to the system core logic (they know
      who they are).  There are PCI Express Root Ports that don't bother
      to trigger interrupts when they receive PME messages from the devices
      below.  There are ACPI BIOSes that forget to provide _PRW methods for
      devices capable of signaling wakeup.  Finally, there are BIOSes that
      do provide _PRW methods for such devices, but then don't bother to
      call Notify() for those devices from the corresponding _Lxx/_Exx
      GPE-handling methods.  In all of these cases the kernel doesn't have
      a chance to receive a proper notification that it should wake up a
      device, so devices stay in low-power states forever.  Worse yet, in
      some cases they continuously send PME Messages that are silently
      ignored, because the kernel simply doesn't know that it should clear
      the device's PME Status bit.
      
      This problem was first observed for "parallel" (non-Express) PCI
      devices on add-on cards and Matthew Garrett addressed it by adding
      code that polls PME Status bits of such devices, if they are enabled
      to signal PME, to the kernel.  Recently, however, it has turned out
      that PCI Express devices are also affected by this issue and that it
      is not limited to add-on devices, so it seems necessary to extend
      the PME polling to all PCI devices, including PCI Express and planar
      ones.  Still, it would be wasteful to poll the PME Status bits of
      devices that are known to receive proper PME notifications, so make
      the kernel (1) poll the PME Status bits of all PCI and PCIe devices
      enabled to signal PME and (2) disable the PME Status polling for
      devices for which correct PME notifications are received.
      Tested-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      379021d5
  18. 05 10月, 2011 1 次提交
  19. 10 9月, 2011 1 次提交
  20. 21 8月, 2011 1 次提交
  21. 02 8月, 2011 1 次提交
    • J
      PCI: Set PCI-E Max Payload Size on fabric · b03e7495
      Jon Mason 提交于
      On a given PCI-E fabric, each device, bridge, and root port can have a
      different PCI-E maximum payload size.  There is a sizable performance
      boost for having the largest possible maximum payload size on each PCI-E
      device.  However, if improperly configured, fatal bus errors can occur.
      Thus, it is important to ensure that PCI-E payloads sends by a device
      are never larger than the MPS setting of all devices on the way to the
      destination.
      
      This can be achieved two ways:
      
      - A conservative approach is to use the smallest common denominator of
        the entire tree below a root complex for every device on that fabric.
      
      This means for example that having a 128 bytes MPS USB controller on one
      leg of a switch will dramatically reduce performances of a video card or
      10GE adapter on another leg of that same switch.
      
      It also means that any hierarchy supporting hotplug slots (including
      expresscard or thunderbolt I suppose, dbl check that) will have to be
      entirely clamped to 128 bytes since we cannot predict what will be
      plugged into those slots, and we cannot change the MPS on a "live"
      system.
      
      - A more optimal way is possible, if it falls within a couple of
        constraints:
      * The top-level host bridge will never generate packets larger than the
        smallest TLP (or if it can be controlled independently from its MPS at
        least)
      * The device will never generate packets larger than MPS (which can be
        configured via MRRS)
      * No support of direct PCI-E <-> PCI-E transfers between devices without
        some additional code to specifically deal with that case
      
      Then we can use an approach that basically ignores downstream requests
      and focuses exclusively on upstream requests. In that case, all we need
      to care about is that a device MPS is no larger than its parent MPS,
      which allows us to keep all switches/bridges to the max MPS supported by
      their parent and eventually the PHB.
      
      In this case, your USB controller would no longer "starve" your 10GE
      Ethernet and your hotplug slots won't affect your global MPS.
      Additionally, the hotplugged devices themselves can be configured to a
      larger MPS up to the value configured in the hotplug bridge.
      
      To choose between the two available options, two PCI kernel boot args
      have been added to the PCI calls.  "pcie_bus_safe" will provide the
      former behavior, while "pcie_bus_perf" will perform the latter behavior.
      By default, the latter behavior is used.
      
      NOTE: due to the location of the enablement, each arch will need to add
      calls to this function.  This patch only enables x86.
      
      This patch includes a number of changes recommended by Benjamin
      Herrenschmidt.
      
      Tested-by: Jordan_Hargrave@dell.com
      Signed-off-by: NJon Mason <mason@myri.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      b03e7495
  22. 23 7月, 2011 1 次提交
  23. 22 7月, 2011 1 次提交
  24. 09 7月, 2011 1 次提交
  25. 14 6月, 2011 1 次提交
  26. 02 6月, 2011 1 次提交
  27. 22 5月, 2011 2 次提交
  28. 12 5月, 2011 3 次提交