1. 30 7月, 2015 2 次提交
  2. 13 6月, 2015 1 次提交
  3. 30 5月, 2015 2 次提交
  4. 22 5月, 2015 1 次提交
    • Y
      PCI: Add dev->has_secondary_link to track downstream PCIe links · d0751b98
      Yijing Wang 提交于
      A PCIe Port is an interface to a Link.  A Root Port is a PCI-PCI bridge in
      a Root Complex and has a Link on its secondary (downstream) side.  For
      other Ports, the Link may be on either the upstream (closer to the Root
      Complex) or downstream side of the Port.
      
      The usual topology has a Root Port connected to an Upstream Port.  We
      previously assumed this was the only possible topology, and that a
      Downstream Port's Link was always on its downstream side, like this:
      
                        +---------------------+
        +------+        |          Downstream |
        | Root |        | Upstream       Port +--Link--
        | Port +--Link--+ Port                |
        +------+        |          Downstream |
                        |                Port +--Link--
                        +---------------------+
      
      But systems do exist (see URL below) where the Root Port is connected to a
      Downstream Port.  In this case, a Downstream Port's Link may be on either
      the upstream or downstream side:
      
                        +---------------------+
        +------+        |            Upstream |
        | Root |        | Downstream     Port +--Link--
        | Port +--Link--+ Port                |
        +------+        |          Downstream |
                        |                Port +--Link--
                        +---------------------+
      
      We can't use the Port type to determine which side the Link is on, so add a
      bit in struct pci_dev to keep track.
      
      A Root Port's Link is always on the Port's secondary side.  A component
      (Endpoint or Port) on the other end of the Link obviously has the Link on
      its upstream side.  If that component is a Port, it is part of a Switch or
      a Bridge.  A Bridge has a PCI or PCI-X bus on its secondary side, not a
      Link.  The internal bus of a Switch connects the Port to another Port whose
      Link is on the downstream side.
      
      [bhelgaas: changelog, comment, cache "type", use if/else]
      Link: http://lkml.kernel.org/r/54EB81B2.4050904@pobox.com
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=94361Suggested-by: NBjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: NYijing Wang <wangyijing@huawei.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      d0751b98
  5. 07 5月, 2015 1 次提交
    • M
      PCI/MSI: Disable MSI at enumeration even if kernel doesn't support MSI · 1851617c
      Michael S. Tsirkin 提交于
      If we enable MSI, then kexec a new kernel, the new kernel may receive MSIs
      it is not prepared for.  Commit d5dea7d9 ("PCI: msi: Disable msi
      interrupts when we initialize a pci device") prevents this, but only if the
      new kernel is built with CONFIG_PCI_MSI=y.
      
      Move the "disable MSI" functionality from drivers/pci/msi.c to a new
      pci_msi_setup_pci_dev() in drivers/pci/probe.c so we can disable MSIs when
      we enumerate devices even if the kernel doesn't include full MSI support.
      
      [bhelgaas: changelog, disable MSIs in pci_setup_device(), put
      pci_msi_setup_pci_dev() at its final destination]
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      1851617c
  6. 09 4月, 2015 1 次提交
  7. 19 3月, 2015 1 次提交
    • Y
      PCI: Assign resources before drivers claim devices (pci_scan_root_bus()) · b97ea289
      Yijing Wang 提交于
      Previously, pci_scan_root_bus() created a root PCI bus, enumerated the
      devices on it, and called pci_bus_add_devices(), which made the devices
      available for drivers to claim them.
      
      Most callers assigned resources to devices after pci_scan_root_bus()
      returns, which may be after drivers have claimed the devices.  This is
      incorrect; the PCI core should not change device resources while a driver
      is managing the device.
      
      Remove pci_bus_add_devices() from pci_scan_root_bus() and do it after any
      resource assignment in the callers.
      
      Note that ARM's pci_common_init_dev() already called pci_bus_add_devices()
      after pci_scan_root_bus(), so we only need to remove the first call:
      
        pci_common_init_dev
          pcibios_init_hw
            pci_scan_root_bus
              pci_bus_add_devices        # first call
          pci_bus_assign_resources
          pci_bus_add_devices            # second call
      
      [bhelgaas: changelog, drop "root_bus" var in alpha common_init_pci(),
      return failure earlier in mn10300, add "return" in x86 pcibios_scan_root(),
      return early if xtensa platform_pcibios_fixup() fails]
      Signed-off-by: NYijing Wang <wangyijing@huawei.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      CC: Richard Henderson <rth@twiddle.net>
      CC: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      CC: Matt Turner <mattst88@gmail.com>
      CC: David Howells <dhowells@redhat.com>
      CC: Tony Luck <tony.luck@intel.com>
      CC: Michal Simek <monstr@monstr.eu>
      CC: Ralf Baechle <ralf@linux-mips.org>
      CC: Koichi Yasutake <yasutake.koichi@jp.panasonic.com>
      CC: Sebastian Ott <sebott@linux.vnet.ibm.com>
      CC: "David S. Miller" <davem@davemloft.net>
      CC: Chris Metcalf <cmetcalf@ezchip.com>
      CC: Chris Zankel <chris@zankel.net>
      CC: Max Filippov <jcmvbkbc@gmail.com>
      CC: Thomas Gleixner <tglx@linutronix.de>
      b97ea289
  8. 13 3月, 2015 2 次提交
    • Y
      PCI: Assign resources before drivers claim devices (pci_scan_bus()) · c90570d9
      Yijing Wang 提交于
      Previously, pci_scan_bus() created a root PCI bus, enumerated the devices
      on it, and called pci_bus_add_devices(), which made the devices available
      for drivers to claim them.
      
      Most callers assigned resources to devices after pci_scan_bus() returns,
      which may be after drivers have claimed the devices.  This is incorrect;
      the PCI core should not change device resources while a driver is managing
      the device.
      
      Remove pci_bus_add_devices() from pci_scan_bus() and do it after any
      resource assignment in the callers.
      
      [bhelgaas: changelog, check for failure in mcf_pci_init()]
      Signed-off-by: NYijing Wang <wangyijing@huawei.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      CC: "David S. Miller" <davem@davemloft.net>
      CC: Geert Uytterhoeven <geert@linux-m68k.org>
      CC: Guan Xuetao <gxt@mprc.pku.edu.cn>
      CC: Richard Henderson <rth@twiddle.net>
      CC: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      CC: Matt Turner <mattst88@gmail.com>
      c90570d9
    • M
      PCI: Update DMA configuration from DT · de335bb4
      Murali Karicheri 提交于
      If there is a DT node available for the root bridge's parent device, use
      the DMA configuration from that device node.  For example, Keystone PCI
      devices would require dma_pfn_offset to be set correctly in the device
      structure of the PCI device in order to have the correct DMA mask.  The DT
      node will have dma-ranges defined for this.  Also support using the DT
      property dma-coherent to allow coherent DMA operation by the PCI device.
      
      Use the new helper function of_pci_dma_configure() to update the device DMA
      configuration.  This fixes DMA on systems where DMA addresses are a
      constant offset from CPU physical addresses.
      
      Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> (AMD Seattle)
      Signed-off-by: NMurali Karicheri <m-karicheri2@ti.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NCatalin Marinas <catalin.marinas@arm.com>
      Acked-by: NWill Deacon <will.deacon@arm.com>
      CC: Joerg Roedel <joro@8bytes.org>
      CC: Grant Likely <grant.likely@linaro.org>
      CC: Rob Herring <robh+dt@kernel.org>
      CC: Russell King <linux@arm.linux.org.uk>
      CC: Arnd Bergmann <arnd@arndb.de>
      de335bb4
  9. 05 2月, 2015 1 次提交
  10. 20 11月, 2014 2 次提交
    • M
      PCI: Add informational printk for invalid BARs · 7e79c5f8
      Myron Stowe 提交于
      As a consequence of restoring the detection of invalid BARs, add a new
      informational printk like the following when such occurrences are
      encountered.
      
        pci ssss:bb:dd.f: [Firmware Bug]: reg 0xXX: invalid BAR (can't size)
      Reported-by: NWilliam Unruh <unruh@physics.ubc.ca>
      Reported-by: NMartin Lucina <martin@lucina.net>
      Signed-off-by: NMyron Stowe <myron.stowe@redhat.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      CC: Matthew Wilcox <willy@linux.intel.com>
      7e79c5f8
    • Y
      PCI: Support 64-bit bridge windows if we have 64-bit dma_addr_t · 7fc986d8
      Yinghai Lu 提交于
      Aaron reported that a 32-bit x86 kernel with Physical Address Extension
      (PAE) support complains about bridge prefetchable memory windows above 4GB:
      
        pci_bus 0000:00: root bus resource [mem 0x380000000000-0x383fffffffff]
        ...
        pci 0000:03:00.0: reg 0x10: [mem 0x383fffc00000-0x383fffdfffff 64bit pref]
        pci 0000:03:00.0: reg 0x20: [mem 0x383fffe04000-0x383fffe07fff 64bit pref]
        pci 0000:03:00.1: reg 0x10: [mem 0x383fffa00000-0x383fffbfffff 64bit pref]
        pci 0000:03:00.1: reg 0x20: [mem 0x383fffe00000-0x383fffe03fff 64bit pref]
        pci 0000:00:02.2: PCI bridge to [bus 03-04]
        pci 0000:00:02.2:   bridge window [io  0x1000-0x1fff]
        pci 0000:00:02.2:   bridge window [mem 0x91900000-0x91cfffff]
        pci 0000:00:02.2: can't handle 64-bit address space for bridge
      
      In this kernel, unsigned long is 32 bits and dma_addr_t is 64 bits.
      Previously we used "unsigned long" to hold the bridge window address.  But
      this is a bus address, so we should use dma_addr_t instead.
      
      Use dma_addr_t to hold the bridge window base and limit.
      
      The question of whether the CPU can actually *address* the window is
      separate and depends on what the physical address space of the CPU is and
      whether the host bridge does any address translation.
      
      [bhelgaas: fix "shift count > width of type", changelog, stable tag]
      Fixes: d56dbf5b ("PCI: Allocate 64-bit BARs above 4G when possible")
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=88131Reported-by: NAaron Ma <mapengyu@gmail.com>
      Tested-by: NAaron Ma <mapengyu@gmail.com>
      Signed-off-by: NYinghai Lu <yinghai@kernel.org>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      CC: stable@vger.kernel.org	# v3.14+
      7fc986d8
  11. 14 11月, 2014 1 次提交
  12. 11 11月, 2014 3 次提交
  13. 01 10月, 2014 1 次提交
    • C
      PCI: Add generic domain handling · 670ba0c8
      Catalin Marinas 提交于
      The handling of PCI domains (or PCI segments in ACPI speak) is usually a
      straightforward affair but its implementation is currently left to the
      architectural code, with pci_domain_nr(b) querying the value of the domain
      associated with bus b.
      
      This patch introduces CONFIG_PCI_DOMAINS_GENERIC as an option that can be
      selected if an architecture wants a simple implementation where the value
      of the domain associated with a bus is stored in struct pci_bus.
      
      The architectures that select CONFIG_PCI_DOMAINS_GENERIC will then have to
      implement pci_bus_assign_domain_nr() as a way of setting the domain number
      associated with a root bus.  All child buses except the root bus will
      inherit the domain_nr value from their parent.
      Signed-off-by: NCatalin Marinas <Catalin.Marinas@arm.com>
      [Renamed pci_set_domain_nr() to pci_bus_assign_domain_nr()]
      Signed-off-by: NLiviu Dudau <Liviu.Dudau@arm.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      CC: Arnd Bergmann <arnd@arndb.de>
      670ba0c8
  14. 20 9月, 2014 2 次提交
    • B
      Revert "PCI: Make sure bus number resources stay within their parents bounds" · 12d87069
      Bjorn Helgaas 提交于
      This reverts commit 1820ffdc ("PCI: Make sure bus number resources stay
      within their parents bounds") because it breaks some systems with LSI Logic
      FC949ES Fibre Channel Adapters, apparently by exposing a defect in those
      adapters.
      
      Dirk tested a Tyan VX50 (B4985) with this device that worked like this
      prior to 1820ffdc:
      
          bus: [bus 00-7f] on node 0 link 1
          ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-07])
          pci 0000:00:0e.0: PCI bridge to [bus 0a]
          pci_bus 0000:0a: busn_res: can not insert [bus 0a] under [bus 00-07] (conflicts with (null) [bus 00-07])
          pci 0000:0a:00.0: [1000:0646] type 00 class 0x0c0400 (FC adapter)
      
      Note that the root bridge [bus 00-07] aperture is wrong; this is a BIOS
      defect in the PCI0 _CRS method.  But prior to 1820ffdc, we didn't
      enforce that aperture, and the FC adapter worked fine at 0a:00.0.
      
      After 1820ffdc, we notice that 00:0e.0's aperture is not contained in
      the root bridge's aperture, so we reconfigure it so it *is* contained:
      
          pci 0000:00:0e.0: bridge configuration invalid ([bus 0a-0a]), reconfiguring
          pci 0000:00:0e.0: PCI bridge to [bus 06-07]
      
      This effectively moves the FC device from 0a:00.0 to 07:00.0, which should
      be legal.  But when we enumerate bus 06, the FC device doesn't respond, so
      we don't find anything.  This is probably a defect in the FC device.
      
      Possible fixes (due to Yinghai):
      
          1) Add a quirk to fix the _CRS information based on what amd_bus.c read
             from the hardware
      
          2) Reset the FC device after we change its bus number
      
          3) Revert 1820ffdc
      
      Fix 1 would be relatively easy, but it does sweep the LSI FC issue under
      the rug.  We might want to reconfigure bus numbers in the future for some
      other reason, e.g., hotplug, and then we could trip over this again.
      
      For that reason, I like fix 2, but we don't know whether it actually works,
      and we don't have a patch for it yet.
      
      This revert is fix 3, which also sweeps the LSI FC issue under the rug.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=84281Reported-by: NDirk Gouders <dirk@gouders.net>
      Tested-by: NDirk Gouders <dirk@gouders.net>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      CC: stable@vger.kernel.org	# v3.15+
      CC: Yinghai Lu <yinghai@kernel.org>
      12d87069
    • B
      Revert "PCI: Don't scan random busses in pci_scan_bridge()" · 7a0b33d4
      Bjorn Helgaas 提交于
      This reverts commit fc1b2531 ("PCI: Don't scan random busses in
      pci_scan_bridge()") because it breaks CardBus on some machines.
      
      David tested a Dell Latitude D505 that worked like this prior to
      fc1b2531:
      
          pci 0000:00:1e.0: PCI bridge to [bus 01]
          pci 0000:01:01.0: CardBus bridge to [bus 02-05]
      
      Note that the 01:01.0 CardBus bridge has a bus number aperture of
      [bus 02-05], but those buses are all outside the 00:1e.0 PCI bridge bus
      number aperture, so accesses to buses 02-05 never reach CardBus.  This is
      later patched up by yenta_fixup_parent_bridge(), which changes the
      subordinate bus number of the 00:1e.0 PCI bridge:
      
          pci_bus 0000:01: Raising subordinate bus# of parent bus (#1) from #1 to #5
      
      With fc1b2531, pci_scan_bridge() fails immediately when it notices that
      we can't allocate a valid secondary bus number for the CardBus bridge, and
      CardBus doesn't work at all:
      
          pci 0000:01:01.0: can't allocate child bus 01 from [bus 01]
      
      I'd prefer to fix this by integrating the yenta_fixup_parent_bridge() logic
      into pci_scan_bridge() so we fix the bus number apertures up front.  But
      I don't think we can do that before v3.17, so I'm going to revert this to
      avoid the problem while we're working on the long-term fix.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=83441
      Link: http://lkml.kernel.org/r/1409303414-5196-1-git-send-email-david.henningsson@canonical.comReported-by: NDavid Henningsson <david.henningsson@canonical.com>
      Tested-by: NDavid Henningsson <david.henningsson@canonical.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      CC: stable@vger.kernel.org	# v3.15+
      7a0b33d4
  15. 13 9月, 2014 8 次提交
    • B
      PCI: Configure *all* devices, not just hot-added ones · 1302fcf0
      Bjorn Helgaas 提交于
      There's not really a good way to determine whether firmware has already
      configured a device with _HPP/_HPX settings.  On legacy systems, the BIOS
      has probably configured everything, but on UEFI systems it is not required
      to do so.
      
      Per the PCI Firmware Specification, rev 3.1, sec 3.5, if PCI_COMMAND_IO or
      PCI_COMMAND_MEMORY is set, we can assume firmware has set the corresponding
      BARs and maybe we can assume it has configured the rest of the device.  And
      if a bridge has PCI_COMMAND_PARITY or PCI_COMMAND_SERR set, we can assume
      firmware has configured the bridge.  But we can't tell much about devices
      without BARs.
      
      I think it should be safe to apply _HPP and _HPX settings anyway, even if
      firmware has already configured the device, so configure everything we
      find.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      1302fcf0
    • B
      PCI: Preserve MPS and MRRS when applying _HPX settings · 302328c0
      Bjorn Helgaas 提交于
      Linux manages MPS and MRRS settings to keep them consistent across the PCIe
      fabric.  BIOS doesn't participate in this Linux management, so ignore that
      part of any _HPX settings it supplies.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      302328c0
    • B
      PCI: Apply _HPP settings to all hot-added PCI devices · ca0647e0
      Bjorn Helgaas 提交于
      We currently apply _HPP settings only to:
      
          - non-bridge devices, and
          - PCI-to-PCI bridges
      
      i.e., we do not apply them to PCI-to-ISA bridges and the like.  It has been
      that way since _HPP support was added by 40abb96c ("pciehp: Fix
      programming hotplug parameters"), but I don't think there's any reason to
      exclude these other bridges.
      
      Apply _HPP settings to hot-added PCI devices of any type.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      ca0647e0
    • B
      PCI: Preserve BIOS PCI_COMMAND_SERR and PCI_COMMAND_PARITY settings · eab3a0ee
      Bjorn Helgaas 提交于
      Do not clear PCI_COMMAND_SERR or PCI_COMMAND_PARITY based on _HPP.  The
      spec (ACPI rev 5.0, sec 6.2.7) says that when "Enable SERR" is set to 1,
      we should enable SERR in the command register.  It says nothing about
      *disabling* SERR or PERR; in fact, the example in 6.2.7.1 says we should
      leave PERR alone unless "Enable PERR" is 1.
      
      For hot-added devices, this probably doesn't matter because they power up
      with these bits cleared.  But in addition to hot-plugged devices, the spec
      allows the platform to use _HPP for "configuration of PCI devices not
      configured by the BIOS at system boot," and it may make a difference for
      devices present at boot.
      
      This change means that if BIOS enables SERR or PERR on a device, and it
      supplies _HPP or _HPX with the SERR or PERR bits *cleared*, we will now
      leave SERR or PERR reporting enabled on that device instead of disabling it
      as we previously did.
      
      See also 40abb96c ("pciehp: Fix programming hotplug parameters"), where
      this code was first added.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      eab3a0ee
    • B
      PCI: Apply _HPP settings to PCIe devices as well as PCI and PCI-X · c6285fc5
      Bjorn Helgaas 提交于
      The ACPI _HPP method was defined before PCIe existed, so its documentation
      only mentions PCI.  The _HPX Type 0 setting record is essentially identical
      to _HPP, but the spec (ACPI rev 5.0, sec 6.2.8.1) says it should be applied
      to PCI, PCI-X, and PCIe devices, with settings being ignored if they are
      not applicable.
      
      Some platforms with both conventional PCI and PCIe devices provide only
      _HPP (not _HPX), so treat _HPP the same way as an _HPX Type 0 record and
      apply it to PCIe devices as well as PCI and PCI-X.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      c6285fc5
    • B
      PCI: Remove unused pci_configure_slot() · fbfa398b
      Bjorn Helgaas 提交于
      All pci_configure_slot() uses have been removed, so remove the definition
      as well.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      fbfa398b
    • B
      PCI: Add pci_configure_device() during enumeration · 6cd33649
      Bjorn Helgaas 提交于
      Some platforms can tell the OS how to configure PCI devices, e.g., how to
      set cache line size, error reporting enables, etc.  ACPI defines _HPP and
      _HPX methods for this purpose.
      
      This configuration was previously done by some of the hotplug drivers using
      pci_configure_slot().  But not all hotplug drivers did this, and per the
      spec (ACPI rev 5.0, sec 6.2.7), we can also do it for "devices not
      configured by the BIOS at system boot."
      
      Move this configuration into the PCI core by adding pci_configure_device()
      and calling it from pci_device_add(), so we do this for all devices as we
      enumerate them.
      
      This is based on pci_configure_slot(), which is used by hotplug drivers.
      I omitted:
      
        - pcie_bus_configure_settings() because it configures MPS and MRRS, which
          requires global knowledge of the fabric and must be done later, and
      
        - configuration of subordinate devices; that will happen when we call
          pci_device_add() for those devices.
      
      Because pci_configure_slot() was only done by hotplug drivers, this initial
      version of pci_configure_device() only configures hot-added devices,
      ignoring anything added during boot.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      6cd33649
    • B
      PCI: Move pci_configure_slot() to drivers/pci/probe.c · 589fcc23
      Bjorn Helgaas 提交于
      Move pci_configure_slot() and related functions from
      drivers/pci/hotplug/pcihp_slot to drivers/pci/probe.c.
      
      This is to prepare for doing device configuration during the normal
      enumeration process instead of just after hot-add.
      
      No functional change.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      589fcc23
  16. 09 9月, 2014 2 次提交
    • R
      PCI: Enable CRS Software Visibility for root port if it is supported · f3dbd802
      Rajat Jain 提交于
      Per PCIe r3.0, sec 2.3.2, an endpoint may respond to a Configuration
      Request with a Completion with Configuration Request Retry Status (CRS).
      This terminates the Configuration Request.
      
      When the CRS Software Visibility feature is disabled (as it is by default),
      a Root Complex must handle a CRS Completion by re-issuing the Configuration
      Request.  This is invisible to software.  From the CPU's point of view, an
      endpoint that always responds with CRS causes a hang because the Root
      Complex never supplies data to complete the CPU read.
      
      When CRS Software Visibility is enabled, a Root Complex that receives a CRS
      Completion for a read of the Vendor ID must return data of 0x0001.  The
      Vendor ID of 0x0001 indicates to software that the endpoint is not ready.
      
      We now have more devices that require CRS Software Visibility.  For
      example, a PLX 8713 NT bridge may respond with CRS until it has been
      configured via I2C, and the I2C configuration is completely independent of
      PCI enumeration.
      
      Enable CRS Software Visibility if it is supported.  This allows a system
      with such a device to work (though the PCI core times out waiting for it to
      become ready, and we have to rescan the bus after it is ready).
      
      This essentially reverts ad7edfe0 ("[PCI] Do not enable CRS Software
      Visibility by default").  The failures that led to ad7edfe0 should be
      addressed by 89665a6a ("PCI: Check only the Vendor ID to identify
      Configuration Request Retry").
      
      [bhelgaas: changelog]
      Link: http://lkml.kernel.org/r/20071029061532.5d10dfc6@snowcone
      Link: http://lkml.kernel.org/r/alpine.LFD.0.9999.0712271023090.21557@woody.linux-foundation.orgSigned-off-by: NRajat Jain <rajatxjain@gmail.com>
      Signed-off-by: NRajat Jain <rajatjain@juniper.net>
      Signed-off-by: NGuenter Roeck <groeck@juniper.net>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      f3dbd802
    • R
      PCI: Check only the Vendor ID to identify Configuration Request Retry · 89665a6a
      Rajat Jain 提交于
      Per PCIe r3.0, sec 2.3.2, if a Root Complex
      
        - has Configuration Request Retry Status Software Visibility enabled,
        - issues a Configuration Read of both bytes of the Vendor ID, and
        - receives a Completion with Configuration Request Retry Status (CRS),
      
      it must complete the request to the host by fabricating data of 0x0001 for
      the Vendor ID and 0xff for any additional bytes in the request.
      
      Linux issues a single config read for the four bytes containing the Vendor
      ID and the Device ID.  Previously we checked all four bytes for 0xffff0001
      to identify CRS.
      
      However, it is only the Vendor ID that really indicates CRS, because it's
      sufficient to read only those two bytes.  Checking the Device ID verifies
      spec compliance but doesn't add any information.
      
      Some Root Complexes appear to indicate CRS by returning 0x0001 for the
      Vendor ID along with the actual the Device ID.  Previously we interpreted
      that as a valid Vendor/Device ID pair, although 0x0001 is reserved and
      cannot be a valid Vendor ID.
      
      [bhelgaas: changelog]
      Link: http://lkml.kernel.org/r/4729FC36.3040000@gmail.comSigned-off-by: NRajat Jain <rajatxjain@gmail.com>
      Signed-off-by: NRajat Jain <rajatjain@juniper.net>
      Signed-off-by: NGuenter Roeck <groeck@juniper.net>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      89665a6a
  17. 11 6月, 2014 3 次提交
  18. 29 5月, 2014 1 次提交
    • A
      PCI: Introduce new device binding path using pci_dev.driver_override · 782a985d
      Alex Williamson 提交于
      The driver_override field allows us to specify the driver for a device
      rather than relying on the driver to provide a positive match of the
      device.  This shortcuts the existing process of looking up the vendor and
      device ID, adding them to the driver new_id, binding the device, then
      removing the ID, but it also provides a couple advantages.
      
      First, the above existing process allows the driver to bind to any device
      matching the new_id for the window where it's enabled.  This is often not
      desired, such as the case of trying to bind a single device to a meta
      driver like pci-stub or vfio-pci.  Using driver_override we can do this
      deterministically using:
      
        echo pci-stub > /sys/bus/pci/devices/0000:03:00.0/driver_override
        echo 0000:03:00.0 > /sys/bus/pci/devices/0000:03:00.0/driver/unbind
        echo 0000:03:00.0 > /sys/bus/pci/drivers_probe
      
      Previously we could not invoke drivers_probe after adding a device to
      new_id for a driver as we get non-deterministic behavior whether the driver
      we intend or the standard driver will claim the device.  Now it becomes a
      deterministic process, only the driver matching driver_override will probe
      the device.
      
      To return the device to the standard driver, we simply clear the
      driver_override and reprobe the device:
      
        echo > /sys/bus/pci/devices/0000:03:00.0/driver_override
        echo 0000:03:00.0 > /sys/bus/pci/devices/0000:03:00.0/driver/unbind
        echo 0000:03:00.0 > /sys/bus/pci/drivers_probe
      
      Another advantage to this approach is that we can specify a driver override
      to force a specific binding or prevent any binding.  For instance when an
      IOMMU group is exposed to userspace through VFIO we require that all
      devices within that group are owned by VFIO.  However, devices can be
      hot-added into an IOMMU group, in which case we want to prevent the device
      from binding to any driver (override driver = "none") or perhaps have it
      automatically bind to vfio-pci.  With driver_override it's a simple matter
      for this field to be set internally when the device is first discovered to
      prevent driver matches.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Reviewed-by: NAlexander Graf <agraf@suse.de>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      782a985d
  19. 28 5月, 2014 2 次提交
    • A
      PCI: Test for std config alias when testing extended config space · 78916b00
      Alex Williamson 提交于
      When a PCI-to-PCIe bridge is stacked on a PCIe-to-PCI bridge, we can have
      PCIe endpoints masked by a conventional PCI bus.  This makes the extended
      config space of the PCIe endpoint inaccessible.  The PCIe-to-PCI bridge is
      supposed to handle any type 1 configuration transactions where the extended
      config offset bits are non-zero as an Unsupported Request rather than
      forward it to the secondary interface.  As noted here, there are a couple
      known offenders to this rule.  These bridges drop the extended offset bits,
      resulting in the conventional config space being aliased many times across
      the extended config space.  For Intel NICs, this alias often seems to
      expose a bogus SR-IOV cap.
      
      Stacking bridges may seem like an uncommon scenario, but note that any
      conventional PCI slot in a modern PC is already the secondary interface of
      an onboard PCIe-to-PCI bridge.  The user need only add a PCI-to-PCIe
      adapter and PCIe device to encounter this problem.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      78916b00
    • Y
      PCI: Use pci_is_bridge() to simplify code · 6788a51f
      Yijing Wang 提交于
      Use pci_is_bridge() to simplify code.  No functional change.
      
      Requires: 326c1cda PCI: Rename pci_is_bridge() to pci_has_subordinate()
      Requires: 1c86438c PCI: Add new pci_is_bridge() interface
      Signed-off-by: NYijing Wang <wangyijing@huawei.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      6788a51f
  20. 24 5月, 2014 3 次提交
    • B
      PCI: Don't add disabled subtractive decode bus resources · d739a099
      Bjorn Helgaas 提交于
      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: NBjorn Helgaas <bhelgaas@google.com>
      d739a099
    • B
      PCI: Don't print anything while decoding is disabled · 26370fc6
      Bjorn Helgaas 提交于
      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: NBjorn Helgaas <bhelgaas@google.com>
      26370fc6
    • B
      PCI: Don't set BAR to zero if dma_addr_t is too small · 31e9dd25
      Bjorn Helgaas 提交于
      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: NBjorn Helgaas <bhelgaas@google.com>
      31e9dd25