1. 25 2月, 2012 1 次提交
    • Y
      PCI: prepare pci=realloc for multiple options · b55438fd
      Yinghai Lu 提交于
      Let the user could enable and disable with pci=realloc=on or pci=realloc=off
      
      Also
      1. move variable and functions near the place they are used.
      2. change macro to function
      3. change related functions and variable to static and _init
      4. update parameter description accordingly.
      
      This will let us add a config option to control default behavior, and
      still allow the user to turn off automatic reallocation if it fails on
      their platform until a permanent solution is found.
      
      -v2: still honor pci=realloc, and treat it as pci=realloc=on
           also use enum instead of ...
      -v3: update kernel-paramenters.txt according to Jesse.
      Signed-off-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      b55438fd
  2. 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
  3. 15 2月, 2012 2 次提交
  4. 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
  5. 07 1月, 2012 6 次提交
  6. 19 12月, 2011 1 次提交
  7. 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
  8. 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
  9. 28 10月, 2011 1 次提交
  10. 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
  11. 05 10月, 2011 1 次提交
  12. 10 9月, 2011 1 次提交
  13. 21 8月, 2011 1 次提交
  14. 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
  15. 23 7月, 2011 1 次提交
  16. 22 7月, 2011 1 次提交
  17. 09 7月, 2011 1 次提交
  18. 14 6月, 2011 1 次提交
  19. 02 6月, 2011 1 次提交
  20. 22 5月, 2011 2 次提交
  21. 12 5月, 2011 3 次提交
  22. 11 5月, 2011 1 次提交
  23. 04 5月, 2011 1 次提交
    • D
      vgaarb: use bridges to control VGA routing where possible. · 3448a19d
      Dave Airlie 提交于
      So in a lot of modern systems, a GPU will always be below a parent bridge that won't share with any other GPUs. This means VGA arbitration on those GPUs can be controlled by using the bridge routing instead of io/mem decodes.
      
      The problem is locating which GPUs share which upstream bridges. This patch attempts to identify all the GPUs which can be controlled via bridges, and ones that can't. This patch endeavours to work out the bridge sharing semantics.
      
      When disabling GPUs via a bridge, it doesn't do irq callbacks or touch the io/mem decodes for the gpu.
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      3448a19d
  24. 22 3月, 2011 1 次提交
    • N
      PCI: PCIe links may not get configured for ASPM under POWERSAVE mode · 1a680b7c
      Naga Chumbalkar 提交于
      v3 -> v2: Moved ASPM enabling logic to pci_set_power_state()
      v2 -> v1: Preserved the logic in pci_raw_set_power_state()
      	: Added ASPM enabling logic after scanning Root Bridge
      	: http://marc.info/?l=linux-pci&m=130046996216391&w=2
      v1	: http://marc.info/?l=linux-pci&m=130013164703283&w=2
      
      The assumption made in commit 41cd766b
      (PCI: Don't enable aspm before drivers have had a chance to veto it) that
      pci_enable_device() will result in re-configuring ASPM when aspm_policy is
      POWERSAVE is no longer valid.  This is due to commit
      97c145f7 (PCI: read current power state
      at enable time) which resets dev->current_state to D0. Due to this the
      call to pcie_aspm_pm_state_change() is never made. Note the equality check
      (below) that returns early:
      ./drivers/pci/pci.c: pci_raw_set_pci_power_state()
      546         /* Check if we're already there */
      547         if (dev->current_state == state)
      548                 return 0;
      
      Therefore OSPM never configures the PCIe links for ASPM to turn them "on".
      
      Fix it by configuring ASPM from the pci_enable_device() code path. This
      also allows a driver such as the e1000e networking driver a chance to
      disable ASPM (L0s, L1), if need be, prior to enabling the device. A
      driver may perform this action if the device is known to mis-behave
      wrt ASPM.
      Signed-off-by: NNaga Chumbalkar <nagananda.chumbalkar@hp.com>
      Acked-by: NRafael J. Wysocki <rjw@sisk.pl>
      Cc: Matthew Garrett <mjg59@srcf.ucam.org>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      1a680b7c
  25. 15 1月, 2011 2 次提交
  26. 24 12月, 2010 1 次提交
  27. 12 11月, 2010 1 次提交
  28. 18 10月, 2010 1 次提交
  29. 16 10月, 2010 1 次提交