1. 02 9月, 2020 1 次提交
  2. 01 8月, 2018 2 次提交
    • L
      PCI: pciehp: Clear spurious events earlier on resume · 79037824
      Lukas Wunner 提交于
      Thunderbolt hotplug ports that were occupied before system sleep resume
      with their downstream link in "off" state.  Only after the Thunderbolt
      controller has reestablished the PCIe tunnels does the link go up.
      As a result, a spurious Presence Detect Changed and/or Data Link Layer
      State Changed event occurs.
      
      The events are not immediately acted upon because tunnel reestablishment
      happens in the ->resume_noirq phase, when interrupts are still disabled.
      Also, notification of events may initially be disabled in the Slot
      Control register when coming out of system sleep and is reenabled in the
      ->resume_noirq phase through:
      
        pci_pm_resume_noirq()
          pci_pm_default_resume_early()
            pci_restore_state()
              pci_restore_pcie_state()
      
      It is not guaranteed that the events are acted upon at all:  PCIe r4.0,
      sec 6.7.3.4 says that "a port may optionally send an MSI when there are
      hot-plug events that occur while interrupt generation is disabled, and
      interrupt generation is subsequently enabled."  Note the "optionally".
      
      If an MSI is sent, pciehp will gratuitously turn the slot off and back
      on once the ->resume_early phase has commenced.
      
      If an MSI is not sent, the extant, unacknowledged events in the Slot
      Status register will prevent future notification of presence or link
      changes.
      
      Commit 13c65840 ("PCI: pciehp: Clear Presence Detect and Data Link
      Layer Status Changed on resume") fixed the latter by clearing the events
      in the ->resume phase.  Move this to the ->resume_noirq phase to also
      fix the gratuitous disable/enablement of the slot.
      
      The commit further restored the Slot Control register in the ->resume
      phase, but that's dispensable because as shown above it's already been
      done in the ->resume_noirq phase.
      Signed-off-by: NLukas Wunner <lukas@wunner.de>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
      79037824
    • L
      PCI: portdrv: Deduplicate PM callback iterator · 6ccb127b
      Lukas Wunner 提交于
      Replace suspend_iter() and resume_iter() with a single function pm_iter()
      to allow addition of port service callbacks for further power management
      phases without having to add another iterator each time.
      
      No functional change intended.
      Signed-off-by: NLukas Wunner <lukas@wunner.de>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      6ccb127b
  3. 03 6月, 2018 1 次提交
  4. 02 6月, 2018 1 次提交
  5. 18 5月, 2018 1 次提交
  6. 31 3月, 2018 7 次提交
    • M
      PCI/DPC: Do not enable DPC if AER control is not allowed by the BIOS · 4e5fad42
      Mika Westerberg 提交于
      Commit eed85ff4 ("PCI/DPC: Enable DPC only if AER is available") made
      DPC control dependent whether AER is enabled in the OS.  However, it does
      not take into account situations where BIOS has not given OS control of
      AER:
      
        acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI]
        acpi PNP0A08:00: _OSC: platform does not support [AER]
        acpi PNP0A08:00: _OSC: OS now controls [PCIeHotplug PME PCIeCapability]
      
      I think here it is better not to enable DPC even if the capability is
      available because then it would be against what "Determination of DPC
      Control" note in PCIe 4.0 sec 6.1.10 recommends.
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NBjorn Helgaas <helgaas@kernel.org>
      4e5fad42
    • F
      PCI/AER: Use cached AER Capability offset · f0553ba0
      Frederick Lawler 提交于
      Replace pci_find_ext_capability(..., PCI_EXT_CAP_ID_ERR) calls with
      pci_dev->aer_cap.
      
      pci_dev->aer_cap is initialized in pci_init_capabilities(), which happens
      before any of these users of the AER Capability.
      Signed-off-by: NFrederick Lawler <fred@fredlawl.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      f0553ba0
    • B
      PCI/portdrv: Rename and reverse sense of pcie_ports_auto · d850882b
      Bjorn Helgaas 提交于
      The platform may restrict the OS's use of PCIe services, e.g., via the ACPI
      _OSC method.  The user may use "pcie_ports=native" to force the port driver
      to use PCIe services even if the platform asked us not to.
      
      The "pcie_ports=native" parameter determines the setting of
      pcie_ports_auto.  Rename this to pcie_ports_native and reverse the
      sense to simplify the code.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      d850882b
    • B
      PCI/portdrv: Remove "pcie_hp=nomsi" kernel parameter · 1e447c57
      Bjorn Helgaas 提交于
      7570a333 ("PCI: Add pcie_hp=nomsi to disable MSI/MSI-X for pciehp
      driver") added the "pcie_hp=nomsi" kernel parameter to work around this
      error on shutdown:
      
        irq 16: nobody cared (try booting with the "irqpoll" option)
        Pid: 1081, comm: reboot Not tainted 3.2.0 #1
        ...
        Disabling IRQ #16
      
      This happened on an unspecified system (possibly involving the Integrated
      Device Technology, Inc. Device 807f bridge) where "an un-wanted interrupt
      is generated when PCI driver switches from MSI/MSI-X to INTx while shutting
      down the device."
      
      The implication was that the device was buggy, but it is normal for a
      device to use INTx after MSI/MSI-X have been disabled.  The only problem
      was that the driver was still attached and it wasn't prepared for INTx
      interrupts.  Prarit Bhargava fixed this issue with fda78d7a ("PCI/MSI:
      Stop disabling MSI/MSI-X in pci_device_shutdown()").
      
      There is no automated way to set this parameter, so it's not very useful
      for distributions or end users.  It's really only useful for debugging, and
      we have "pci=nomsi" for that purpose.
      
      Revert 7570a333 to remove the "pcie_hp=nomsi" parameter.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      CC: MUNEDA Takahiro <muneda.takahiro@jp.fujitsu.com>
      CC: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
      CC: Prarit Bhargava <prarit@redhat.com>
      1e447c57
    • B
      PCI/portdrv: Simplify PCIe feature permission checking · 02bfeb48
      Bjorn Helgaas 提交于
      Some PCIe features (AER, DPC, hotplug, PME) can be managed by either the
      platform firmware or the OS, so the host bridge driver may have to request
      permission from the platform before using them.  On ACPI systems, this is
      done by negotiate_os_control() in acpi_pci_root_add().
      
      The PCIe port driver later uses pcie_port_platform_notify() and
      pcie_port_acpi_setup() to figure out whether it can use these features.
      But all we need is a single bit for each service, so these interfaces are
      needlessly complicated.
      
      Simplify this by adding bits in the struct pci_host_bridge to show when the
      OS has permission to use each feature:
      
        + unsigned int native_aer:1;       /* OS may use PCIe AER */
        + unsigned int native_hotplug:1;   /* OS may use PCIe hotplug */
        + unsigned int native_pme:1;       /* OS may use PCIe PME */
      
      These are set when we create a host bridge, and the host bridge driver can
      clear the bits corresponding to any feature the platform doesn't want us to
      use.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      02bfeb48
    • B
      PCI/portdrv: Remove unused PCIE_PORT_SERVICE_VC · 168f3ae5
      Bjorn Helgaas 提交于
      No driver registers for PCIE_PORT_SERVICE_VC, so remove it.
      
      This removes the VC "service" files from /sys/bus/pci_express/devices,
      e.g., 0000:07:00.0:pcie108, 0000:08:04.0:pcie208 (all the files that
      contained "8" as the last digit of the "pcieXXX" part).  The port driver
      created these files for PCIe port devices that have a VC Capability.
      
      Since this reduces PCIE_PORT_DEVICE_MAXSERVICES and moves DPC down into the
      spot where VC used to be, the DPC sysfs files will now be named "pcieXX8".
      I don't think there's anything useful userspace can do with those files, so
      I hope nobody cares about these filenames.
      
      There is no VC driver that calls pcie_port_service_register(), so there
      never was a /sys/bus/pci_express/drivers/vc directory.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      168f3ae5
    • B
      PCI/portdrv: Disable port driver in compat mode · 79a01119
      Bjorn Helgaas 提交于
      The "pcie_ports=compat" kernel parameter sets pcie_ports_disabled, which is
      intended to disable the PCIe port driver.  But even when it was disabled,
      we registered pcie_portdriver so we could work around a BIOS PME issue (see
      fe31e697 ("PCI/PCIe: Clear Root PME Status bits early during system
      resume")).
      
      Registering the driver meant that the pcie_portdrv_probe() path called
      pci_enable_device(), pci_save_state(), pm_runtime_set_autosuspend_delay(),
      pm_runtime_use_autosuspend(), etc., even when the driver was disabled.
      
      We've since moved the BIOS PME workaround from the port driver to the core,
      so stop registering the PCIe port driver in compat mode.
      
      This means "pcie_ports=compat" will now be basically the same as turning
      off CONFIG_PCIEPORTBUS completely.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      79a01119
  7. 20 3月, 2018 1 次提交
  8. 10 3月, 2018 1 次提交
  9. 23 2月, 2018 1 次提交
  10. 27 1月, 2018 1 次提交
    • K
      PCI/DPC: Enable DPC only if AER is available · eed85ff4
      Keith Busch 提交于
      The "Determination of DPC Control" implementation note in PCIe r4.0, sec
      6.1.10, recommends the operating system always link DPC control to the
      control of AER, as the two functionalities are strongly connected.
      
      To avoid conflicts over whether platform firmware or the OS controls DPC,
      enable DPC only if AER is enabled in the OS, and the device's error
      handling does not have firmware-first AER handling.
      Signed-off-by: NKeith Busch <keith.busch@intel.com>
      Signed-off-by: NBjorn Helgaas <helgaas@kernel.org>
      eed85ff4
  11. 02 11月, 2017 1 次提交
    • G
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman 提交于
      Many source files in the tree are missing licensing information, which
      makes it harder for compliance tools to determine the correct license.
      
      By default all files without license information are under the default
      license of the kernel, which is GPL version 2.
      
      Update the files which contain no license information with the 'GPL-2.0'
      SPDX license identifier.  The SPDX identifier is a legally binding
      shorthand, which can be used instead of the full boiler plate text.
      
      This patch is based on work done by Thomas Gleixner and Kate Stewart and
      Philippe Ombredanne.
      
      How this work was done:
      
      Patches were generated and checked against linux-4.14-rc6 for a subset of
      the use cases:
       - file had no licensing information it it.
       - file was a */uapi/* one with no licensing information in it,
       - file was a */uapi/* one with existing licensing information,
      
      Further patches will be generated in subsequent months to fix up cases
      where non-standard license headers were used, and references to license
      had to be inferred by heuristics based on keywords.
      
      The analysis to determine which SPDX License Identifier to be applied to
      a file was done in a spreadsheet of side by side results from of the
      output of two independent scanners (ScanCode & Windriver) producing SPDX
      tag:value files created by Philippe Ombredanne.  Philippe prepared the
      base worksheet, and did an initial spot review of a few 1000 files.
      
      The 4.13 kernel was the starting point of the analysis with 60,537 files
      assessed.  Kate Stewart did a file by file comparison of the scanner
      results in the spreadsheet to determine which SPDX license identifier(s)
      to be applied to the file. She confirmed any determination that was not
      immediately clear with lawyers working with the Linux Foundation.
      
      Criteria used to select files for SPDX license identifier tagging was:
       - Files considered eligible had to be source code files.
       - Make and config files were included as candidates if they contained >5
         lines of source
       - File already had some variant of a license header in it (even if <5
         lines).
      
      All documentation files were explicitly excluded.
      
      The following heuristics were used to determine which SPDX license
      identifiers to apply.
      
       - when both scanners couldn't find any license traces, file was
         considered to have no license information in it, and the top level
         COPYING file license applied.
      
         For non */uapi/* files that summary was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0                                              11139
      
         and resulted in the first patch in this series.
      
         If that file was a */uapi/* path one, it was "GPL-2.0 WITH
         Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0 WITH Linux-syscall-note                        930
      
         and resulted in the second patch in this series.
      
       - if a file had some form of licensing information in it, and was one
         of the */uapi/* ones, it was denoted with the Linux-syscall-note if
         any GPL family license was found in the file or had no licensing in
         it (per prior point).  Results summary:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|------
         GPL-2.0 WITH Linux-syscall-note                       270
         GPL-2.0+ WITH Linux-syscall-note                      169
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
         LGPL-2.1+ WITH Linux-syscall-note                      15
         GPL-1.0+ WITH Linux-syscall-note                       14
         ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
         LGPL-2.0+ WITH Linux-syscall-note                       4
         LGPL-2.1 WITH Linux-syscall-note                        3
         ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
         ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1
      
         and that resulted in the third patch in this series.
      
       - when the two scanners agreed on the detected license(s), that became
         the concluded license(s).
      
       - when there was disagreement between the two scanners (one detected a
         license but the other didn't, or they both detected different
         licenses) a manual inspection of the file occurred.
      
       - In most cases a manual inspection of the information in the file
         resulted in a clear resolution of the license that should apply (and
         which scanner probably needed to revisit its heuristics).
      
       - When it was not immediately clear, the license identifier was
         confirmed with lawyers working with the Linux Foundation.
      
       - If there was any question as to the appropriate license identifier,
         the file was flagged for further research and to be revisited later
         in time.
      
      In total, over 70 hours of logged manual review was done on the
      spreadsheet to determine the SPDX license identifiers to apply to the
      source files by Kate, Philippe, Thomas and, in some cases, confirmation
      by lawyers working with the Linux Foundation.
      
      Kate also obtained a third independent scan of the 4.13 code base from
      FOSSology, and compared selected files where the other two scanners
      disagreed against that SPDX file, to see if there was new insights.  The
      Windriver scanner is based on an older version of FOSSology in part, so
      they are related.
      
      Thomas did random spot checks in about 500 files from the spreadsheets
      for the uapi headers and agreed with SPDX license identifier in the
      files he inspected. For the non-uapi files Thomas did random spot checks
      in about 15000 files.
      
      In initial set of patches against 4.14-rc6, 3 files were found to have
      copy/paste license identifier errors, and have been fixed to reflect the
      correct identifier.
      
      Additionally Philippe spent 10 hours this week doing a detailed manual
      inspection and review of the 12,461 patched files from the initial patch
      version early this week with:
       - a full scancode scan run, collecting the matched texts, detected
         license ids and scores
       - reviewing anything where there was a license detected (about 500+
         files) to ensure that the applied SPDX license was correct
       - reviewing anything where there was no detection but the patch license
         was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
         SPDX license was correct
      
      This produced a worksheet with 20 files needing minor correction.  This
      worksheet was then exported into 3 different .csv files for the
      different types of files to be modified.
      
      These .csv files were then reviewed by Greg.  Thomas wrote a script to
      parse the csv files and add the proper SPDX tag to the file, in the
      format that the file expected.  This script was further refined by Greg
      based on the output to detect more types of files automatically and to
      distinguish between header and source .c files (which need different
      comment types.)  Finally Greg ran the script using the .csv files to
      generate the patches.
      Reviewed-by: NKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: NPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2441318
  12. 22 10月, 2017 1 次提交
    • B
      PCI/portdrv: Compute MSI/MSI-X IRQ vectors after final allocation · a579ba49
      Bjorn Helgaas 提交于
      When setting up portdrv MSI/MSI-X interrupts, we previously allocated the
      maximum possible number of vectors, read the Interrupt Message Numbers for
      each service, saved the IRQ for each, freed the vectors, and finally used
      the largest Message Number to reallocate only as many vectors as we need.
      
      The problem is that freeing the vectors invalidates their IRQs, so the
      saved IRQ numbers may now be invalid, which can result in errors like
      this:
      
        pcie_pme: probe of 0000:00:00.0:pcie001 failed with error -22
        pciehp 0000:00:00.0:pcie004: Cannot get irq 20 for the hotplug controller
        aer: probe of 0000:00:00.0:pcie002 failed with error -22
        dpc 0000:00:00.0:pcie010: request IRQ22 failed: -22
      
      Change the setup so we save the Interrupt Message Numbers (not the IRQs)
      before we free the original setup, then use the Message Numbers to compute
      the IRQs (via pci_irq_vector()) *after* we reallocate the vectors.
      
      This should always be safe for MSI-X because the Message Numbers are fixed.
      For MSI, the hardware is allowed to change Message Numbers when we update
      the MSI Multiple Message Enable field when reallocating the vectors, but
      since we allocate enough vectors to accommodate the largest Message Number
      we found, that's unlikely.  See PCIe r3.1, sec 7.8.2, 7.10.10, 7.31.2.
      
      Fixes: 3674cc49 ("PCI/portdrv: Use pci_irq_alloc_vectors()")
      Based-on-patch-by: NDongdong Liu <liudongdong3@huawei.com>
      Tested-by: Dongdong Liu <liudongdong3@huawei.com>  # HiSilicon hip08
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      a579ba49
  13. 21 10月, 2017 1 次提交
  14. 20 10月, 2017 2 次提交
  15. 17 6月, 2017 2 次提交
  16. 11 2月, 2017 1 次提交
  17. 13 12月, 2016 1 次提交
  18. 14 6月, 2016 1 次提交
    • M
      PCI: Add runtime PM support for PCIe ports · 006d44e4
      Mika Westerberg 提交于
      Add back runtime PM support for PCIe ports that was removed by
      fe9a743a ("PCI/PM: Drop unused runtime PM support code for PCIe
      ports").
      
      We cannot enable it automatically for all ports since there have been
      problems previously [1].  In summary suspended PCIe ports were not able
      to deal with ACPI-based hotplug reliably.  One reason why this might happen
      is the fact that when a PCIe port is powered down, config space access to
      the devices behind the port is not possible.  If the BIOS hotplug SMI
      handler assumes the port is always in D0 it will not be able to find the
      hotplugged devices.  To be on the safe side only enable runtime PM if the
      port does not claim to support hotplug.
      
      For PCIe ports not using hotplug, we enable and allow runtime PM
      automatically.  Since 'bridge_d3' can be changed any time we check this in
      driver ->runtime_idle() and ->runtime_suspend() and only allow runtime
      suspend if the flag is still set.  Use autosuspend with default of 100ms
      idle time to prevent the port from repeatedly suspending and resuming on
      continuous configuration space access of devices behind the port.
      
      The actual power transition to D3 and back is handled in the PCI core.
      
      Idea to automatically unblock (allow) runtime PM for PCIe ports came from
      Dave Airlie.
      
      [1] https://bugzilla.kernel.org/show_bug.cgi?id=53811
      
      This includes a fix for lockdep issue reported by Valdis Kletnieks.
      Tested-by: NLukas Wunner <lukas@wunner.de>
      Signed-off-by: NLukas Wunner <lukas@wunner.de>
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      006d44e4
  19. 05 5月, 2016 1 次提交
  20. 03 5月, 2016 2 次提交
  21. 09 4月, 2016 1 次提交
  22. 15 7月, 2015 1 次提交
  23. 25 4月, 2014 1 次提交
  24. 15 4月, 2014 1 次提交
  25. 04 1月, 2014 1 次提交
    • A
      PCI/MSI: Add pci_msix_vec_count() · ff1aa430
      Alexander Gordeev 提交于
      This creates an MSI-X counterpart for pci_msi_vec_count().  Device drivers
      can use this function to obtain maximum number of MSI-X interrupts the
      device supports and use that number in a subsequent call to
      pci_enable_msix().
      
      pci_msix_vec_count() supersedes pci_msix_table_size() and returns a
      negative errno if device does not support MSI-X interrupts.  After this
      update, callers must always check the returned value.
      
      The only user of pci_msix_table_size() was the PCI-Express port driver,
      which is also updated by this change.
      Signed-off-by: NAlexander Gordeev <agordeev@redhat.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NTejun Heo <tj@kernel.org>
      ff1aa430
  26. 20 12月, 2013 3 次提交
  27. 13 12月, 2013 1 次提交
  28. 15 11月, 2013 1 次提交