1. 28 2月, 2014 1 次提交
    • B
      PCI: Mark 64-bit resource as IORESOURCE_UNSET if we only support 32-bit · c83bd900
      Bjorn Helgaas 提交于
      If we don't support 64-bit addresses, i.e., CONFIG_PHYS_ADDR_T_64BIT is not
      set, we can't deal with BARs above 4GB.  In this case we already pretend
      the BAR contained zero; this patch also sets IORESOURCE_UNSET so we can try
      to reallocate it later.
      
      I don't think this is exactly correct: what we care about here are *bus*
      addresses, not CPU addresses, so the tests of sizeof(resource_size_t)
      probably should be on sizeof(dma_addr_t) instead.  But this is what's been
      in -next, so we'll fix that later.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      c83bd900
  2. 02 2月, 2014 1 次提交
    • R
      Revert "PCI: Remove from bus_list and release resources in pci_release_dev()" · 04480094
      Rafael J. Wysocki 提交于
      Revert commit ef83b078 "PCI: Remove from bus_list and release
      resources in pci_release_dev()" that made some nasty race conditions
      become possible.  For example, if a Thunderbolt link is unplugged
      and then replugged immediately, the pci_release_dev() resulting from
      the hot-remove code path may be racing with the hot-add code path
      which after that commit causes various kinds of breakage to happen
      (up to and including a hard crash of the whole system).
      
      Moreover, the problem that commit ef83b078 attempted to address
      cannot happen any more after commit 8a4c5c32 "PCI: Check parent
      kobject in pci_destroy_dev()", because pci_destroy_dev() will now
      return immediately if it has already been executed for the given
      device.
      
      Note, however, that the invocation of msi_remove_pci_irq_vectors()
      removed by commit ef83b078 from pci_free_resources() along with
      the other changes made by it is not added back because of subsequent
      code changes depending on that modification.
      
      Fixes: ef83b078 (PCI: Remove from bus_list and release resources in pci_release_dev())
      Reported-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      04480094
  3. 14 1月, 2014 3 次提交
    • R
      PCI: Add global pci_lock_rescan_remove() · 9d16947b
      Rafael J. Wysocki 提交于
      There are multiple PCI device addition and removal code paths that may be
      run concurrently with the generic PCI bus rescan and device removal that
      can be triggered via sysfs.  If that happens, it may lead to multiple
      different, potentially dangerous race conditions.
      
      The most straightforward way to address those problems is to run
      the code in question under the same lock that is used by the
      generic rescan/remove code in pci-sysfs.c.  To prepare for those
      changes, move the definition of the global PCI remove/rescan lock
      to probe.c and provide global wrappers, pci_lock_rescan_remove()
      and pci_unlock_rescan_remove(), allowing drivers to manipulate
      that lock.  Also provide pci_stop_and_remove_bus_device_locked()
      for the callers of pci_stop_and_remove_bus_device() who only need
      to hold the rescan/remove lock around it.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      9d16947b
    • S
      PCI: Make local functions static · 0b950f0f
      Stephen Hemminger 提交于
      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: NStephen Hemminger <stephen@networkplumber.org>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      0b950f0f
    • S
      PCI: Remove unused alloc_pci_dev() · e2760c54
      Stephen Hemminger 提交于
      My philosophy is unused code is dead code.  And dead code is subject to bit
      rot and is a likely source of bugs.  Use it or lose it.
      
      This removes this unused and deprecated interface:
      
          alloc_pci_dev()
      
      [bhelgaas: split to separate patch]
      Signed-off-by: NStephen Hemminger <stephen@networkplumber.org>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      e2760c54
  4. 22 12月, 2013 1 次提交
    • Y
      PCI: Convert pcibios_resource_to_bus() to take a pci_bus, not a pci_dev · fc279850
      Yinghai Lu 提交于
      These interfaces:
      
        pcibios_resource_to_bus(struct pci_dev *dev, *bus_region, *resource)
        pcibios_bus_to_resource(struct pci_dev *dev, *resource, *bus_region)
      
      took a pci_dev, but they really depend only on the pci_bus.  And we want to
      use them in resource allocation paths where we have the bus but not a
      device, so this patch converts them to take the pci_bus instead of the
      pci_dev:
      
        pcibios_resource_to_bus(struct pci_bus *bus, *bus_region, *resource)
        pcibios_bus_to_resource(struct pci_bus *bus, *resource, *bus_region)
      
      In fact, with standard PCI-PCI bridges, they only depend on the host
      bridge, because that's the only place address translation occurs, but
      we aren't going that far yet.
      
      [bhelgaas: changelog]
      Signed-off-by: NYinghai Lu <yinghai@kernel.org>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      fc279850
  5. 19 12月, 2013 2 次提交
  6. 15 11月, 2013 1 次提交
  7. 26 9月, 2013 1 次提交
  8. 24 9月, 2013 1 次提交
  9. 27 8月, 2013 2 次提交
  10. 23 8月, 2013 5 次提交
    • Z
      PCI: Disable decoding for BAR sizing only when it was actually enabled · 808e34e2
      Zoltan Kiss 提交于
      We disable BARs while sizing them so we don't cause conflicts with other
      devices (see 253d2e54 and bbffe435).  But if device decoding is already
      disabled before we size the BAR, we don't need to disable it again.
      
      [bhelgaas: changelog, add PCI_COMMAND_DECODING_ENABLE for readability]
      Signed-off-by: NZoltan Kiss <zoltan.kiss@citrix.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      808e34e2
    • Y
      PCI: Don't restrict MPS for slots below Root Ports · d4aa68f6
      Yijing Wang 提交于
      When booting with "pci=pcie_bus_safe", we previously limited the
      fabric MPS to 128 when we found:
      
        (1) A hotplug-capable Downstream Port ("dev->is_hotplug_bridge &&
            pci_pcie_type(dev) != PCI_EXP_TYPE_ROOT_PORT"), or
      
        (2) A hotplug-capable Root Port with a slot that was either empty or
            contained a multi-function device ("dev->is_hotplug_bridge &&
            !list_is_singular(&dev->bus->devices)")
      
      Part (1) is valid, but part (2) is not.
      
      After a hot-add in the slot below a Root Port, we can reconfigure all
      MPS values in the fabric below the Root Port because the new device is
      the only thing below the Root Port and there are no active drivers.
      Therefore, there's no reason to limit the MPS for Root Ports, no
      matter what's in the slot.
      
      Test info:
      
          -+-[0000:40]-+-07.0-[0000:46]--+-00.0  Intel 82576 NIC
                                         \-00.1  Intel 82576 NIC
      
          0000:40:07.0 Root Port bridge to [bus 46] (MPS supported=256)
          0000:46:00.0 Endpoint                     (MPS supported=512)
          0000:46:00.1 Endpoint                     (MPS supported=512)
      
          # echo 0 > /sys/bus/pci/slots/7/power
          # echo 1 > /sys/bus/pci/slots/7/power
          pcieport 0000:40:07.0: PCI-E Max Payload Size set to 256/ 256 (was 256)
          pci 0000:46:00.0:      PCI-E Max Payload Size set to 256/ 512 (was 128)
          pci 0000:46:00.1:      PCI-E Max Payload Size set to 256/ 512 (was 128)
      
      Before this change, we set MPS to 128 for the Root Port and both NICs
      because the slot contained a multi-function device and
      
          dev->is_hotplug_bridge && !list_is_singular(&dev->bus->devices)
      
      was true.  After this change, we set it to 256.
      
      [bhelgaas: changelog, comments, split out upstream bridge check]
      Signed-off-by: NYijing Wang <wangyijing@huawei.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Cc: Jon Mason <jdmason@kudzu.us>
      d4aa68f6
    • B
      PCI: Simplify MPS test for Downstream Port · c2996948
      Bjorn Helgaas 提交于
      PCIe hotplug bridges are always either Root Ports or Downstream Ports.  No
      other device type can have a PCIe link leading downstream to a slot.
      
      Root Ports don't have an upstream bridge, so "dev->is_hotplug_bridge &&
      dev->bus->self" is true if and only if "dev" is a Downstream Port.  That
      means we can simplify this by looking at the type of "dev" itself, without
      looking upstream at all.
      
      No functional change.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      c2996948
    • B
      PCI: Simplify pcie_bus_configure_settings() interface · a58674ff
      Bjorn Helgaas 提交于
      Based on a patch by Jon Mason (see URL below).
      
      All users of pcie_bus_configure_settings() pass arguments of the form
      "bus, bus->self->pcie_mpss".  The "mpss" argument is redundant since we
      can easily look it up internally.  In addition, all callers check
      "bus->self" for NULL, which we can also do internally.
      
      This patch simplifies the interface and the callers.  No functional change.
      
      Reference: http://lkml.kernel.org/r/1317048850-30728-2-git-send-email-mason@myri.comSigned-off-by: NBjorn Helgaas <bhelgaas@google.com>
      a58674ff
    • B
      PCI: Drop "PCI-E" prefix from Max Payload Size message · 2c25e34c
      Bjorn Helgaas 提交于
      The conventional spelling is "PCIe", but I think even that is superfluous,
      so remove the whole thing.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      2c25e34c
  11. 12 8月, 2013 1 次提交
  12. 31 7月, 2013 1 次提交
  13. 26 7月, 2013 2 次提交
  14. 27 6月, 2013 1 次提交
  15. 15 6月, 2013 1 次提交
  16. 08 6月, 2013 2 次提交
  17. 06 6月, 2013 1 次提交
    • G
      PCI: Convert alloc_pci_dev(void) to pci_alloc_dev(bus) · 8b1fce04
      Gu Zheng 提交于
      Use the new pci_alloc_dev(bus) to replace the existing using of
      alloc_pci_dev(void).
      
      [bhelgaas: drop pci_bus ref later in pci_release_dev()]
      Signed-off-by: NGu Zheng <guz.fnst@cn.fujitsu.com>
      Signed-off-by: NJiang Liu <jiang.liu@huawei.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Neela Syam Kolli <megaraidlinux@lsi.com>
      Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      8b1fce04
  18. 05 6月, 2013 1 次提交
  19. 28 5月, 2013 1 次提交
  20. 26 5月, 2013 3 次提交
  21. 08 5月, 2013 1 次提交
  22. 18 4月, 2013 1 次提交
  23. 13 4月, 2013 2 次提交
    • J
      PCI: Add pcibios hooks for adding and removing PCI buses · 10a95747
      Jiang Liu 提交于
      On ACPI-based platforms, the pci_slot driver creates PCI slot devices
      according to information from ACPI tables by registering an ACPI PCI
      subdriver.  The ACPI PCI subdriver will only be called when creating/
      destroying PCI root buses, and it won't be called when hot-plugging
      P2P bridges.  It may cause stale PCI slot devices after hot-removing
      a P2P bridge if that bridge has associated PCI slots.  And the acpiphp
      driver has the same issue too.
      
      This patch introduces two hook points into the PCI core, which will
      be invoked when creating/destroying PCI buses for PCI host and P2P
      bridges.  They could be used to setup/destroy platform dependent stuff
      in a unified way, both at boot time and for PCI hotplug operations.
      Signed-off-by: NJiang Liu <jiang.liu@huawei.com>
      Signed-off-by: NYijing Wang <wangyijing@huawei.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NYinghai Lu <yinghai@kernel.org>
      Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
      Cc: Toshi Kani <toshi.kani@hp.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Fenghua Yu <fenghua.yu@intel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Myron Stowe <myron.stowe@redhat.com>
      10a95747
    • J
      PCI: Clean up usages of pci_bus->is_added · 981cf9ea
      Jiang Liu 提交于
      Now pci_bus->is_added is only used to guard invoking of
      pcibios_fixup_bus() in pci_scan_child_bus(), so just set
      it directly after the fixups and remove the other test
      and set in pci_bus_add_devices().
      
      [bhelgaas: changelog]
      Signed-off-by: NJiang Liu <jiang.liu@huawei.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NYinghai Lu <yinghai@kernel.org>
      981cf9ea
  24. 26 1月, 2013 4 次提交