An error occurred fetching the project authors.
  1. 23 May, 2014 6 commits
    • Bjorn Helgaas's avatar
      PCI: Don't add disabled subtractive decode bus resources · d739a099
      Bjorn Helgaas authored
      For a subtractive decode bridge, we previously added and printed all
      resources of the primary bus, even if they were not valid.  In the example
      below, the bridge 00:1c.3 has no windows enabled, so there are no valid
      resources on bus 02.  But since 02:00.0 is subtractive decode bridge, we
      add and print all those invalid resources, which don't really make sense:
      
        pci 0000:00:1c.3: PCI bridge to [bus 02-03]
        pci 0000:02:00.0: PCI bridge to [bus 03] (subtractive decode)
        pci 0000:02:00.0:   bridge window [??? 0x00000000 flags 0x0] (subtractive decode)
      
      Add and print the subtractively-decoded resources only if they are valid.
      
      There's an example in the dmesg log attached to the bugzilla below (but
      this patch doesn't fix the bug reported there).
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=73141Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      d739a099
    • Bjorn Helgaas's avatar
      PCI: Don't print anything while decoding is disabled · 26370fc6
      Bjorn Helgaas authored
      If the console is a PCI device, and we try to print to it while its
      decoding is disabled, the system will hang.  This particular printk hasn't
      caused a problem yet, but it could, so this fixes it.
      
      See also 0ff9514b ("PCI: Don't print anything while decoding is
      disabled").
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      26370fc6
    • Bjorn Helgaas's avatar
      PCI: Don't set BAR to zero if dma_addr_t is too small · 31e9dd25
      Bjorn Helgaas authored
      If a BAR is above 4GB and our dma_addr_t is too small, don't clear the BAR
      to zero: that doesn't disable the BAR, and it makes it more likely that the
      BAR will conflict with things if we turn on the memory enable bit (as we
      will at "out:" if the device was already enabled at the handoff).
      
      We should also print the BAR info and its original size so we can follow
      the process when we try to assign space to it.
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      31e9dd25
    • Bjorn Helgaas's avatar
      PCI: Don't convert BAR address to resource if dma_addr_t is too small · 72dc5601
      Bjorn Helgaas authored
      If dma_addr_t is too small to represent the BAR value,
      pcibios_bus_to_resource() will fail, so just remember the BAR size directly
      in the resource.  The resource is already marked UNSET, so we know the
      address isn't valid anyway.
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      72dc5601
    • Bjorn Helgaas's avatar
      PCI: Reject BAR above 4GB if dma_addr_t is too small · d1a313e4
      Bjorn Helgaas authored
      We can only handle BARs above 4GB if dma_addr_t (not resource_size_t) is 64
      bits wide.  If we have a 64-bit resource_size_t and a 32-bit dma_addr_t,
      we can't deal with BARs above 4GB.
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      d1a313e4
    • Bjorn Helgaas's avatar
      PCI: Fail safely if we can't handle BARs larger than 4GB · 23b13bc7
      Bjorn Helgaas authored
      We can only handle BARs larger than 4GB if both dma_addr_t and
      resource_size_t are 64 bits wide.  If dma_addr_t is 32 bits, we can't
      represent all the bus addresses, and if resource_size_t is 32 bits, we
      can't represent all the CPU addresses.
      
      Previously we cleared res->flags (at "fail:") for resources that were too
      large.  That means we think the BAR doesn't exist at all, which in turn
      means that we could enable the device even though we can't keep track of
      where the BAR is and we can't make sure it doesn't overlap something else.
      
      This preserves the type flags (MEM/IO) so we can keep from enabling the
      device.
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      23b13bc7
  2. 19 Mar, 2014 1 commit
  3. 27 Feb, 2014 1 commit
    • Bjorn Helgaas's avatar
      PCI: Mark 64-bit resource as IORESOURCE_UNSET if we only support 32-bit · c83bd900
      Bjorn Helgaas authored
      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: default avatarBjorn Helgaas <bhelgaas@google.com>
      c83bd900
  4. 11 Feb, 2014 7 commits
  5. 10 Feb, 2014 1 commit
  6. 01 Feb, 2014 1 commit
    • Rafael J. Wysocki's avatar
      Revert "PCI: Remove from bus_list and release resources in pci_release_dev()" · 04480094
      Rafael J. Wysocki authored
      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: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      04480094
  7. 14 Jan, 2014 1 commit
    • Rafael J. Wysocki's avatar
      PCI: Add global pci_lock_rescan_remove() · 9d16947b
      Rafael J. Wysocki authored
      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: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      9d16947b
  8. 13 Jan, 2014 2 commits
  9. 21 Dec, 2013 1 commit
    • Yinghai Lu's avatar
      PCI: Convert pcibios_resource_to_bus() to take a pci_bus, not a pci_dev · fc279850
      Yinghai Lu authored
      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: default avatarYinghai Lu <yinghai@kernel.org>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      fc279850
  10. 18 Dec, 2013 2 commits
  11. 14 Nov, 2013 1 commit
  12. 25 Sep, 2013 1 commit
  13. 23 Sep, 2013 1 commit
  14. 26 Aug, 2013 2 commits
  15. 23 Aug, 2013 1 commit
  16. 22 Aug, 2013 4 commits
    • Yijing Wang's avatar
      PCI: Don't restrict MPS for slots below Root Ports · d4aa68f6
      Yijing Wang authored
      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: default avatarYijing Wang <wangyijing@huawei.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Cc: Jon Mason <jdmason@kudzu.us>
      d4aa68f6
    • Bjorn Helgaas's avatar
      PCI: Simplify MPS test for Downstream Port · c2996948
      Bjorn Helgaas authored
      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: default avatarBjorn Helgaas <bhelgaas@google.com>
      c2996948
    • Bjorn Helgaas's avatar
      PCI: Simplify pcie_bus_configure_settings() interface · a58674ff
      Bjorn Helgaas authored
      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: default avatarBjorn Helgaas <bhelgaas@google.com>
      a58674ff
    • Bjorn Helgaas's avatar
      PCI: Drop "PCI-E" prefix from Max Payload Size message · 2c25e34c
      Bjorn Helgaas authored
      The conventional spelling is "PCIe", but I think even that is superfluous,
      so remove the whole thing.
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      2c25e34c
  17. 12 Aug, 2013 1 commit
  18. 31 Jul, 2013 1 commit
  19. 25 Jul, 2013 2 commits
  20. 26 Jun, 2013 1 commit
  21. 14 Jun, 2013 1 commit
  22. 07 Jun, 2013 1 commit