1. 22 Feb, 2010 5 commits
  2. 04 Dec, 2009 1 commit
  3. 04 Nov, 2009 3 commits
  4. 27 Oct, 2009 1 commit
  5. 07 Oct, 2009 1 commit
    • Yinghai Lu's avatar
      PCI: get larger bridge ranges when space is available · 308cf8e1
      Yinghai Lu authored
      
      
      Found one system:
      [   71.120590] pci 0000:40:05.0: scanning behind bridge, config 4f4a40, pass 0
      [   71.138283] PCI: Scanning bus 0000:4a
      [   71.140341] pci 0000:4a:00.0: found [15b3:6278] class 000c06 header type 00
      [   71.157173] pci 0000:4a:00.0: reg 10 64bit mmio: [0x000000-0x0fffff]
      [   71.161697] pci 0000:4a:00.0: reg 18 64bit mmio pref: [0x000000-0x7fffff]
      [   71.179403] pci 0000:4a:00.0: reg 20 64bit mmio pref: [0x000000-0xfffffff]
      [   71.185366] pci 0000:4a:00.0: calling quirk_resource_alignment+0x0/0x1dd
      [   71.200846] pci 0000:4a:00.0: disabling ASPM on pre-1.1 PCIe device.  You can enable it with 'pcie_aspm=force'
      [   71.219623] PCI: Fixups for bus 0000:4a
      [   71.222194] pci 0000:40:05.0: bridge 32bit mmio: [0xcf000000-0xcf0fffff]
      [   71.238662] pci 0000:40:05.0: bridge 64bit mmio pref: [0xcd800000-0xcdffffff]
      [   71.255793] PCI: Bus scan for 0000:4a returning with max=4a
      
      Device needs a big pref mmio, but BIOS doesn't allocate mmio to it aside
      from a small MMIO range.  Later, the kernel will not allocate resources to
      that to the device:
      [   99.574030] pci 0000:4a:00.0: BAR 4: can't allocate mem resource [0xd0000000-0xcdffffff]
      [   99.580102] pci 0000:4a:00.0: BAR 2: got res [0xcd800000-0xcdffffff] bus [0xcd800000-0xcdffffff] flags 0x12120c
      [   99.602307] pci 0000:4a:00.0: BAR 2: moved to bus [0xcd800000-0xcdffffff] flags 0x12120c
      [   99.615991] pci 0000:4a:00.0: BAR 0: got res [0xcf000000-0xcf0fffff] bus [0xcf000000-0xcf0fffff] flags 0x120204
      [   99.634499] pci 0000:4a:00.0: BAR 0: moved to bus [0xcf000000-0xcf0fffff] flags 0x120204
      [   99.654318] pci 0000:40:05.0: PCI bridge, secondary bus 0000:4a
      [   99.658766] pci 0000:40:05.0:   IO window: disabled
      [   99.675478] pci 0000:40:05.0:   MEM window: 0xcf000000-0xcf0fffff
      [   99.681663] pci 0000:40:05.0:   PREFETCH window: 0x000000cd800000-0x000000cdffffff
      
      So try to get a big range in the pci bridge if there is no child using
      that range.  With the patch we get:
      [   99.104525] pci 0000:4a:00.0: BAR 4: got res [0xfc080000000-0xfc08fffffff] bus [0xfc080000000-0xfc08fffffff] flags 0x12120c
      [   99.123624] pci 0000:4a:00.0: BAR 4: moved to bus [0xfc080000000-0xfc08fffffff] flags 0x12120c
      [   99.131977] pci 0000:4a:00.0: BAR 2: got res [0xfc090000000-0xfc0907fffff] bus [0xfc090000000-0xfc0907fffff] flags 0x12120c
      [   99.149788] pci 0000:4a:00.0: BAR 2: moved to bus [0xfc090000000-0xfc0907fffff] flags 0x12120c
      [   99.169248] pci 0000:4a:00.0: BAR 0: got res [0xc0200000-0xc02fffff] bus [0xc0200000-0xc02fffff] flags 0x120204
      [   99.189508] pci 0000:4a:00.0: BAR 0: moved to bus [0xc0200000-0xc02fffff] flags 0x120204
      [   99.206402] pci 0000:40:05.0: PCI bridge, secondary bus 0000:4a
      [   99.210637] pci 0000:40:05.0:   IO window: disabled
      [   99.224856] pci 0000:40:05.0:   MEM window: 0xc0200000-0xc03fffff
      [   99.230019] pci 0000:40:05.0:   PREFETCH window: 0x000fc080000000-0x000fc097ffffff
      
      Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
      Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
      308cf8e1
  6. 09 Sep, 2009 1 commit
  7. 30 Aug, 2009 1 commit
    • Chris Wright's avatar
      PCI SR-IOV: correct broken resource alignment calculations · 6faf17f6
      Chris Wright authored
      
      
      An SR-IOV capable device includes an SR-IOV PCIe capability which
      describes the Virtual Function (VF) BAR requirements.  A typical SR-IOV
      device can support multiple VFs whose BARs must be in a contiguous region,
      effectively an array of VF BARs.  The BAR reports the size requirement
      for a single VF.  We calculate the full range needed by simply multiplying
      the VF BAR size with the number of possible VFs and create a resource
      spanning the full range.
      
      This all seems sane enough except it artificially inflates the alignment
      requirement for the VF BAR.  The VF BAR need only be aligned to the size
      of a single BAR not the contiguous range of VF BARs.  This can cause us
      to fail to allocate resources for the BAR despite the fact that we
      actually have enough space.
      
      This patch adds a thin PCI specific layer over the generic
      resource_alignment() function which is aware of the special nature of
      VF BARs and does sorting and allocation based on the smaller alignment
      requirement.
      
      I recognize that while resource_alignment is generic, it's basically a
      PCI helper.  An alternative to this patch is to add PCI VF BAR specific
      information to struct resource.  I opted for the extra layer rather than
      adding such PCI specific information to struct resource.  This does
      have the slight downside that we don't cache the BAR size and re-read
      for each alignment query (happens a small handful of times during boot
      for each VF BAR).
      
      Signed-off-by: default avatarChris Wright <chrisw@sous-sol.org>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Matthew Wilcox <matthew@wil.cx>
      Cc: Yu Zhao <yu.zhao@intel.com>
      Cc: stable@kernel.org
      Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
      6faf17f6
  8. 11 Jun, 2009 2 commits
  9. 22 Apr, 2009 1 commit
  10. 06 Apr, 2009 1 commit
    • Yuji Shimada's avatar
      PCI: Setup disabled bridges even if buses are added · 296ccb08
      Yuji Shimada authored
      
      
      This patch sets up disabled bridges even if buses have already been
      added.
      
      pci_assign_unassigned_resources is called after buses are added.
      pci_assign_unassigned_resources calls pci_bus_assign_resources.
      pci_bus_assign_resources calls pci_setup_bridge to configure BARs of
      bridges.
      
      Currently pci_setup_bridge returns immediately if the bus have already
      been added. So pci_assign_unassigned_resources can't configure BARs of
      bridges that were added in a disabled state; this patch fixes the issue.
      
      On logical hot-add, we need to prevent the kernel from re-initializing
      bridges that have already been initialized. To achieve this,
      pci_setup_bridge returns immediately if the bridge have already been
      enabled.
      
      We don't need to check whether the specified bus is a root bus or not.
      pci_setup_bridge is not called on a root bus, because a root bus does
      not have a bridge.
      
      The patch adds a new helper function, pci_is_enabled. I made the
      function name similar to pci_is_managed. The codes which use
      enable_cnt directly are changed to use pci_is_enabled.
      
      Acked-by: default avatarAlex Chiang <achiang@hp.com>
      Signed-off-by: default avatarYuji Shimada <shimada-yxb@necst.nec.co.jp>
      Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
      296ccb08
  11. 20 Mar, 2009 1 commit
  12. 19 Mar, 2009 1 commit
  13. 07 Jan, 2009 2 commits
  14. 20 Oct, 2008 2 commits
  15. 14 Sep, 2008 1 commit
  16. 09 Sep, 2008 1 commit
  17. 04 Sep, 2008 1 commit
    • Linus Torvalds's avatar
      PCI: fix pbus_size_mem() resource alignment for CardBus controllers · 5f17cfce
      Linus Torvalds authored
      Commit 88452565 ("PCI: clean up resource
      alignment management") changed the resource handling to mark how a
      resource was aligned on a per-resource basis.
      
      Thus, instead of looking at the resource number to determine whether it
      was a bridge resource or a regular resource (they have different
      alignment rules), we should just ask the resource for its alignment
      directly.
      
      The reason this broke only cardbus resources was that for the other
      types of resources, the old way of deciding alignment actually still
      happened to work.  But CardBus bridge resources had been changed by
      commit 934b7024
      
       ("Fix cardbus resource
      allocation") to look more like regular resources than PCI bridge
      resources from an alignment handling standpoint.
      
      Reported-and-tested-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      5f17cfce
  18. 25 Jun, 2008 1 commit
    • Bjorn Helgaas's avatar
      PCI: use dev_printk when possible · 80ccba11
      Bjorn Helgaas authored
      
      
      Convert printks to use dev_printk().
      
      I converted pr_debug() to dev_dbg().  Both use KERN_DEBUG and are enabled
      only when DEBUG is defined.
      
      I converted printk(KERN_DEBUG) to dev_printk(KERN_DEBUG), not to dev_dbg(),
      because dev_dbg() is only enabled when DEBUG is defined.
      
      I converted DBG(KERN_INFO) (only in setup-bus.c) to dev_info().  The DBG()
      name makes it sound like debug, but it's been enabled forever, so dev_info()
      preserves the previous behavior.
      
      I tried to make the resource assignment formats more consistent, e.g.,
        "BAR %d: got res [%#llx-%#llx] bus [%#llx-%#llx] flags %#lx\n"
      instead of sometimes using "start-end" and sometimes using "size@start".
      I'm not attached to one or the other; I'd just like them consistent.
      
      Signed-off-by: default avatarBjorn Helgaas <bjorn.helgaas@hp.com>
      Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
      80ccba11
  19. 23 Jun, 2008 1 commit
  20. 22 Apr, 2008 1 commit
    • Linus Torvalds's avatar
      Fix cardbus resource allocation · 934b7024
      Linus Torvalds authored
      Commit 88452565
      
       ("PCI: clean up resource
      alignment management") didn't set the alignment information for the
      cardbus window resources, causing their subsequent allocations to fail
      miserably with a message like
      
        yenta_cardbus 0000:15:00.0: device not available because of BAR 7 [100:1ff] collisions
        yenta_cardbus: probe of 0000:15:00.0 failed with error -16
      
      or similar.
      
      This fixes it and clarifies the code a bit too (we used to have to use
      the insane PCI bridge alignment logic that put the alignment in the
      "start" field, this makes it use the slightly easier-to-understand
      size-based alignment, and allows us to set the resource start to zero
      until it gets allocated).
      
      Reported-and-tested-by: default avatarJeff Chua <jeff.chua.linux@gmail.com>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      934b7024
  21. 20 Apr, 2008 3 commits
    • Adrian Bunk's avatar
      PCI: pci_setup_bridge() mustn't be __devinit · a391f197
      Adrian Bunk authored
      
      
      WARNING: drivers/pci/built-in.o(.text+0x28ee9): Section mismatch in reference from the function pci_bus_assign_resources() to the function .devinit.text:pci_setup_bridge()
      
      Signed-off-by: default avatarAdrian Bunk <bunk@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      a391f197
    • Adrian Bunk's avatar
      PCI: pci_bus_size_cardbus() mustn't be __devinit · 5468ae61
      Adrian Bunk authored
      
      
      WARNING: drivers/pci/built-in.o(.text+0x28e1f): Section mismatch in reference from the function pci_bus_size_bridges() to the function .devinit.text:pci_bus_size_cardbus()
      
      Signed-off-by: default avatarAdrian Bunk <bunk@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      5468ae61
    • Ivan Kokshaysky's avatar
      PCI: clean up resource alignment management · 88452565
      Ivan Kokshaysky authored
      
      
      Done per Linus' request and suggestions. Linus has explained that
      better than I'll be able to explain:
      
      On Thu, Mar 27, 2008 at 10:12:10AM -0700, Linus Torvalds wrote:
      > Actually, before we go any further, there might be a less intrusive
      > alternative: add just a couple of flags to the resource flags field (we
      > still have something like 8 unused bits on 32-bit), and use those to
      > implement a generic "resource_alignment()" routine.
      >
      > Two flags would do it:
      >
      >  - IORESOURCE_SIZEALIGN: size indicates alignment (regular PCI device
      >    resources)
      >
      >  - IORESOURCE_STARTALIGN: start field is alignment (PCI bus resources
      >    during probing)
      >
      > and then the case of both flags zero (or both bits set) would actually be
      > "invalid", and we would also clear the IORESOURCE_STARTALIGN flag when we
      > actually allocate the resource (so that we don't use the "start" field as
      > alignment incorrectly when it no longer indicates alignment).
      >
      > That wouldn't be totally generic, but it would have the nice property of
      > automatically at least add sanity checking for that whole "res->start has
      > the odd meaning of 'alignment' during probing" and remove the need for a
      > new field, and it would allow us to have a generic "resource_alignment()"
      > routine that just gets a resource pointer.
      
      Besides, I removed IORESOURCE_BUS_HAS_VGA flag which was unused for ages.
      
      Signed-off-by: default avatarIvan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Gary Hade <garyhade@us.ibm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      88452565
  22. 26 Mar, 2008 1 commit
  23. 21 Feb, 2008 1 commit
  24. 02 Feb, 2008 1 commit
    • Sam Ravnborg's avatar
      PCI: fix 4x section mismatch warnings · 451124a7
      Sam Ravnborg authored
      
      
      The following warnings were issued during build of
      drivers/pci with an allyesconfig build:
      WARNING: o-x86_64/drivers/pci/built-in.o(.text+0xdaf): Section mismatch in reference from the function pci_add_new_bus() to the function .devinit.text:pci_alloc_child_bus()
      WARNING: o-x86_64/drivers/pci/built-in.o(.text+0x15e2): Section mismatch in reference from the function pci_scan_single_device() to the function .devinit.text:pci_scan_device()
      WARNING: o-x86_64/drivers/pci/built-in.o(.text+0x1b0c5): Section mismatch in reference from the function pci_bus_assign_resources() to the function .devinit.text:pci_setup_bridge()
      WARNING: o-x86_64/drivers/pci/built-in.o(.text+0x1b32d): Section mismatch in reference from the function pci_bus_size_bridges() to the function .devinit.text:pci_bus_size_cardbus()
      
      Investigating each case closer it looked like all
      referred functions are only used in the init phase
      or during hotplug.
      So to avoid wasting too much memory in the non-hotplug
      case the simpler fix was to allow the fuctions to
      use code/data from the __devinit sections.
      This was done in all four case by adding the __ref
      annotation.
      
      Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Cc: Adrian Bunk <bunk@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      451124a7
  25. 01 Feb, 2008 1 commit
  26. 12 Oct, 2007 1 commit
    • Gary Hade's avatar
      PCI: remove transparent bridge sizing · 8fa5913d
      Gary Hade authored
      
      
      Remove transparent bridge sizing.
      
      Due to code in pci_read_bridge_bases() [drivers/pci/probe.c] the child
      bus of a transparent bridge already has access to the parent bus
      resources so transparent bridge sizing appears unnecessary.  The bridge
      sizing includes alignment and granularity adjustments that can cause
      significantly more memory to be reserved from the parant bus than
      required by devices on the child bus and allotted by _CRS.
      
      Signed-off-by: default avatarGary Hade <gary.hade@us.ibm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      8fa5913d
  27. 11 Jul, 2007 1 commit
  28. 02 May, 2007 1 commit
    • Sam Ravnborg's avatar
      pci: do not mark exported functions as __devinit · 96bde06a
      Sam Ravnborg authored
      
      
      Functions marked __devinit will be removed after kernel init.  But being
      exported they are potentially called by a module much later.
      
      So the safer choice seems to be to keep the function even in the non
      CONFIG_HOTPLUG case.
      
      This silence the follwoing section mismatch warnings:
      WARNING: drivers/built-in.o - Section mismatch: reference to .init.text:pci_bus_add_device from __ksymtab_gpl between '__ksymtab_pci_bus_add_device' (at offset 0x20) and '__ksymtab_pci_walk_bus'
      WARNING: drivers/built-in.o - Section mismatch: reference to .init.text:pci_create_bus from __ksymtab_gpl between '__ksymtab_pci_create_bus' (at offset 0x40) and '__ksymtab_pci_stop_bus_device'
      WARNING: drivers/built-in.o - Section mismatch: reference to .init.text:pci_bus_max_busnr from __ksymtab_gpl between '__ksymtab_pci_bus_max_busnr' (at offset 0xc0) and '__ksymtab_pci_assign_resource_fixed'
      WARNING: drivers/built-in.o - Section mismatch: reference to .init.text:pci_claim_resource from __ksymtab_gpl between '__ksymtab_pci_claim_resource' (at offset 0xe0) and '__ksymtab_pcie_port_bus_type'
      WARNING: drivers/built-in.o - Section mismatch: reference to .init.text:pci_bus_add_devices from __ksymtab between '__ksymtab_pci_bus_add_devices' (at offset 0x70) and '__ksymtab_pci_bus_alloc_resource'
      WARNING: drivers/built-in.o - Section mismatch: reference to .init.text:pci_scan_bus_parented from __ksymtab between '__ksymtab_pci_scan_bus_parented' (at offset 0x90) and '__ksymtab_pci_root_buses'
      WARNING: drivers/built-in.o - Section mismatch: reference to .init.text:pci_bus_assign_resources from __ksymtab between '__ksymtab_pci_bus_assign_resources' (at offset 0x4d0) and '__ksymtab_pci_bus_size_bridges'
      WARNING: drivers/built-in.o - Section mismatch: reference to .init.text:pci_bus_size_bridges from __ksymtab between '__ksymtab_pci_bus_size_bridges' (at offset 0x4e0) and '__ksymtab_pci_setup_cardbus'
      
      Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      96bde06a
  29. 16 Feb, 2007 1 commit