1. 16 8月, 2013 1 次提交
  2. 15 8月, 2013 1 次提交
    • A
      PCI: Add pci_reset_slot() and pci_reset_bus() · 090a3c53
      Alex Williamson 提交于
      Sometimes pci_reset_function() is not sufficient.  We have cases where
      devices do not support any kind of reset, but there might be multiple
      functions on the bus preventing pci_reset_function() from doing a
      secondary bus reset.  We also have cases where a device will advertise
      that it supports a PM reset, but really does nothing on D3hot->D0
      (graphics cards are notorious for this).  These devices often also
      have more than one function, so even blacklisting PM reset for them
      wouldn't allow a secondary bus reset through pci_reset_function().
      
      If a driver supports multiple devices it should have the ability to
      induce a bus reset when it needs to.  This patch provides that ability
      through pci_reset_slot() and pci_reset_bus().  It's the caller's
      responsibility when using these interfaces to understand that all of
      the devices in or below the slot (or on or below the bus) will be
      reset and therefore should be under control of the caller.  PCI state
      of all the affected devices is saved and restored around these resets,
      but internal state of all of the affected devices is reset (which
      should be the intention).
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      090a3c53
  3. 10 8月, 2013 1 次提交
  4. 27 6月, 2013 1 次提交
  5. 05 6月, 2013 1 次提交
  6. 28 5月, 2013 2 次提交
  7. 25 4月, 2013 1 次提交
  8. 23 4月, 2013 2 次提交
  9. 18 4月, 2013 1 次提交
  10. 13 4月, 2013 1 次提交
    • 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
  11. 10 4月, 2013 1 次提交
    • B
      PCI: Remove __weak annotation from pcibios_get_phb_of_node decl · 10629d71
      Bjorn Helgaas 提交于
      The __weak annotation on the pcibios_get_phb_of_node() declaration
      causes *every* definition to be marked "weak."  The linker then
      selects one based on link order, which may be the wrong one.
      
      Gabor found that on MIPS, the linker selected the generic implementation
      from drivers/pci even though arch/mips supplied a definition without the
      __weak annotation:
      
      $ mipsel-openwrt-linux-readelf -s arch/mips/pci/built-in.o \
          drivers/pci/built-in.o vmlinux.o | grep pcibios_get_phb_of_node
            86: 0000046c    12 FUNC    WEAK   DEFAULT    2 pcibios_get_phb_of_node
          1430: 00012e2c   104 FUNC    WEAK   DEFAULT    2 pcibios_get_phb_of_node
         31898: 0017e4ec   104 FUNC    WEAK   DEFAULT    2 pcibios_get_phb_of_node
      
      This removes the __weak annotation from the pcibios_get_phb_of_node()
      declaration so arch-specific non-weak implementations work reliably.
      Suggested-by: NGabor Juhos <juhosg@openwrt.org>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      10629d71
  12. 27 3月, 2013 2 次提交
  13. 31 1月, 2013 2 次提交
  14. 26 1月, 2013 1 次提交
    • Y
      PCI: Skip attaching driver in device_add() · 58d9a38f
      Yinghai Lu 提交于
      We want to add PCI devices to the device tree as early as possible but
      delay attaching drivers.
      
      device_add() adds a device to the device hierarchy and (via
      device_attach()) attaches a matching driver and calls its .probe() method.
      We want to separate adding the device to the hierarchy from attaching the
      driver.
      
      This patch does that by adding "match_driver" in struct pci_dev.  When
      false, we return failure from pci_bus_match(), which makes device_attach()
      believe there's no matching driver.
      
      Later, we set "match_driver = true" and call device_attach() again, which
      now attaches the driver and calls its .probe() method.
      
      [bhelgaas: changelog, explicitly init dev->match_driver,
      fold device_attach() call into pci_bus_add_device()]
      Signed-off-by: NYinghai Lu <yinghai@kernel.org>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      58d9a38f
  15. 25 1月, 2013 1 次提交
  16. 14 1月, 2013 1 次提交
    • R
      ACPI / PCI: Set root bridge ACPI handle in advance · 6c0cc950
      Rafael J. Wysocki 提交于
      The ACPI handles of PCI root bridges need to be known to
      acpi_bind_one(), so that it can create the appropriate
      "firmware_node" and "physical_node" files for them, but currently
      the way it gets to know those handles is not exactly straightforward
      (to put it lightly).
      
      This is how it works, roughly:
      
        1. acpi_bus_scan() finds the handle of a PCI root bridge,
           creates a struct acpi_device object for it and passes that
           object to acpi_pci_root_add().
      
        2. acpi_pci_root_add() creates a struct acpi_pci_root object,
           populates its "device" field with its argument's address
           (device->handle is the ACPI handle found in step 1).
      
        3. The struct acpi_pci_root object created in step 2 is passed
           to pci_acpi_scan_root() and used to get resources that are
           passed to pci_create_root_bus().
      
        4. pci_create_root_bus() creates a struct pci_host_bridge object
           and passes its "dev" member to device_register().
      
        5. platform_notify(), which for systems with ACPI is set to
           acpi_platform_notify(), is called.
      
      So far, so good.  Now it starts to be "interesting".
      
        6. acpi_find_bridge_device() is used to find the ACPI handle of
           the given device (which is the PCI root bridge) and executes
           acpi_pci_find_root_bridge(), among other things, for the
           given device object.
      
        7. acpi_pci_find_root_bridge() uses the name (sic!) of the given
           device object to extract the segment and bus numbers of the PCI
           root bridge and passes them to acpi_get_pci_rootbridge_handle().
      
        8. acpi_get_pci_rootbridge_handle() browses the list of ACPI PCI
           root bridges and finds the one that matches the given segment
           and bus numbers.  Its handle is then used to initialize the
           ACPI handle of the PCI root bridge's device object by
           acpi_bind_one().  However, this is *exactly* the ACPI handle we
           started with in step 1.
      
      Needless to say, this is quite embarassing, but it may be avoided
      thanks to commit f3fd0c8a (ACPI: Allow ACPI handles of devices to be
      initialized in advance), which makes it possible to initialize the
      ACPI handle of a device before passing it to device_register().
      
      Accordingly, add a new __weak routine, pcibios_root_bridge_prepare(),
      defaulting to an empty implementation that can be replaced by the
      interested architecutres (x86 and ia64 at the moment) with functions
      that will set the root bridge's ACPI handle before its dev member is
      passed to device_register().  Make both x86 and ia64 provide such
      implementations of pcibios_root_bridge_prepare() and remove
      acpi_pci_find_root_bridge() and acpi_get_pci_rootbridge_handle() that
      aren't necessary any more.
      
      Included is a fix for breakage on systems with non-ACPI PCI host
      bridges from Bjorn Helgaas.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      6c0cc950
  17. 08 1月, 2013 1 次提交
  18. 11 12月, 2012 1 次提交
  19. 06 12月, 2012 2 次提交
  20. 29 11月, 2012 2 次提交
  21. 27 11月, 2012 1 次提交
    • V
      PCI/AER: Report success only when every device has AER-aware driver · 918b4053
      Vijay Mohan Pandarathil 提交于
      When an error is detected on a PCIe device which does not have an
      AER-aware driver, prevent AER infrastructure from reporting
      successful error recovery.
      
      This is because the report_error_detected() function that gets
      called in the first phase of recovery process allows forward
      progress even when the driver for the device does not have AER
      capabilities. It seems that all callbacks (in pci_error_handlers
      structure) registered by drivers that gets called during error
      recovery are not mandatory. So the intention of the infrastructure
      design seems to be to allow forward progress even when a specific
      callback has not been registered by a driver. However, if error
      handler structure itself has not been registered, it doesn't make
      sense to allow forward progress.
      
      As a result of the current design, in the case of a single device
      having an AER-unaware driver or in the case of any function in a
      multi-function card having an AER-unaware driver, a successful
      recovery is reported.
      
      Typical scenario this happens is when a PCI device is detached
      from a KVM host and the pci-stub driver on the host claims the
      device. The pci-stub driver does not have error handling capabilities
      but the AER infrastructure still reports that the device recovered
      successfully.
      
      The changes proposed here leaves the device(s)in an unrecovered state
      if the driver for the device or for any device in the subtree
      does not have error handler structure registered. This reflects
      the true state of the device and prevents any partial recovery (or no
      recovery at all) reported as successful.
      
      [bhelgaas: changelog]
      Signed-off-by: NVijay Mohan Pandarathil <vijaymohan.pandarathil@hp.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NLinas Vepstas <linasvepstas@gmail.com>
      Reviewed-by: NMyron Stowe <myron.stowe@redhat.com>
      918b4053
  22. 15 11月, 2012 1 次提交
  23. 10 11月, 2012 2 次提交
    • D
      PCI: Provide method to reduce the number of total VFs supported · bff73156
      Donald Dutile 提交于
      Some implementations of SRIOV provide a capability structure
      value of TotalVFs that is greater than what the software can support.
      Provide a method to reduce the capability structure reported value
      to the value the driver can support.
      This ensures sysfs reports the current capability of the system,
      hardware and software.
      Example for its use: igb & ixgbe -- report 8 & 64 as TotalVFs,
      but drivers only support 7 & 63 maximum.
      Signed-off-by: NDonald Dutile <ddutile@redhat.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      bff73156
    • D
      PCI: SRIOV control and status via sysfs · 1789382a
      Donald Dutile 提交于
      Provide files under sysfs to determine the maximum number of VFs
      an SR-IOV-capable PCIe device supports, and methods to enable and
      disable the VFs on a per-device basis.
      
      Currently, VF enablement by SR-IOV-capable PCIe devices is done
      via driver-specific module parameters.  If not setup in modprobe files,
      it requires admin to unload & reload PF drivers with number of desired
      VFs to enable.  Additionally, the enablement is system wide: all
      devices controlled by the same driver have the same number of VFs
      enabled.  Although the latter is probably desired, there are PCI
      configurations setup by system BIOS that may not enable that to occur.
      
      Two files are created for the PF of PCIe devices with SR-IOV support:
      
          sriov_totalvfs	Contains the maximum number of VFs the device
      			could support as reported by the TotalVFs register
      			in the SR-IOV extended capability.
      
          sriov_numvfs	Contains the number of VFs currently enabled on
      			this device as reported by the NumVFs register in
      			the SR-IOV extended capability.
      
      			Writing zero to this file disables all VFs.
      
      			Writing a positive number to this file enables that
      			number of VFs.
      
      These files are readable for all SR-IOV PF devices.  Writes to the
      sriov_numvfs file are effective only if a driver that supports the
      sriov_configure() method is attached.
      Signed-off-by: NDonald Dutile <ddutile@redhat.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      1789382a
  24. 08 11月, 2012 1 次提交
  25. 04 11月, 2012 1 次提交
  26. 31 10月, 2012 1 次提交
  27. 13 10月, 2012 1 次提交
  28. 12 9月, 2012 1 次提交
  29. 11 9月, 2012 1 次提交
  30. 08 9月, 2012 1 次提交
  31. 23 8月, 2012 3 次提交
    • J
      PCI: Add accessors for PCI Express Capability · 8c0d3a02
      Jiang Liu 提交于
      The PCI Express Capability (PCIe spec r3.0, sec 7.8) comes in two
      versions, v1 and v2.  In v1 Capability structures (PCIe spec r1.0 and
      r1.1), some fields are optional, so the structure size depends on the
      device type.
      
      This patch adds functions to access this capability so drivers don't
      have to be aware of the differences between v1 and v2.  Note that these
      new functions apply only to the "PCI Express Capability," not to any of
      the other "PCI Express Extended Capabilities" (AER, VC, ACS, MFVC, etc.)
      
      Function pcie_capability_read_word/dword() reads the PCIe Capabilities
      register and returns the value in the reference parameter "val".  If
      the PCIe Capabilities register is not implemented on the PCIe device,
      "val" is set to 0.
      
      Function pcie_capability_write_word/dword() writes the value to the
      specified PCIe Capability register.
      
      Function pcie_capability_clear_and_set_word/dword() sets and/or clears bits
      of a PCIe Capability register.
      
      [bhelgaas: changelog, drop "pci_" prefixes, don't export
      pcie_capability_reg_implemented()]
      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>
      8c0d3a02
    • Y
      PCI: Remove unused field pcie_type from struct pci_dev · b2ef39be
      Yijing Wang 提交于
      With introduction of pci_pcie_type(), pci_dev->pcie_type field becomes
      redundant, so remove it.
      Signed-off-by: NYijing Wang <wangyijing@huawei.com>
      Signed-off-by: NJiang Liu <jiang.liu@huawei.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      b2ef39be
    • B
      PCI: Add pci_find_next_ext_capability() · 44a9a36f
      Bjorn Helgaas 提交于
      Some extended capabilities, e.g., the vendor-specific capability, can
      occur several times.  The existing pci_find_ext_capability() only finds
      the first occurrence.  This adds pci_find_next_ext_capability(), which
      can iterate through all of them.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      44a9a36f