1. 21 11月, 2019 1 次提交
  2. 07 9月, 2019 1 次提交
  3. 29 8月, 2019 3 次提交
    • K
      PCI/ACPI: Remove unnecessary struct hotplug_program_ops · 4a2dbedd
      Krzysztof Wilczynski 提交于
      Move the ACPI-specific structs hpx_type0, hpx_type1, hpx_type2 and
      hpx_type3 to drivers/pci/pci-acpi.c as they are not used anywhere else.
      Then remove the struct hotplug_program_ops that has been shared between
      drivers/pci/probe.c and drivers/pci/pci-acpi.c from drivers/pci/pci.h as it
      is no longer needed.
      
      The struct hotplug_program_ops was added by 87fcf12e ("PCI/ACPI: Remove
      the need for 'struct hotplug_params'") and replaced previously used struct
      hotplug_params enabling the support for the _HPX Type 3 Setting Record that
      was added by f873c51a ("PCI/ACPI: Implement _HPX Type 3 Setting
      Record").
      
      The new struct allowed for the static functions such program_hpx_type0(),
      program_hpx_type1(), etc., from the drivers/pci/probe.c to be called from
      the function pci_acpi_program_hp_params() in the drivers/pci/pci-acpi.c.
      
      Previously a programming of _HPX Type 0 was as follows:
      
        drivers/pci/probe.c:
      
          program_hpx_type0()
          ...
          pci_configure_device()
            hp_ops = {
              .program_type0 = program_hpx_type0,
              ...
            }
            pci_acpi_program_hp_params(&hp_ops)
      
        drivers/pci/pci-acpi.c:
      
          pci_acpi_program_hp_params(&hp_ops)
            acpi_run_hpx(hp_ops)
              decode_type0_hpx_record()
                hp_ops->program_type0     # program_hpx_type0() called via hp_ops
      
      After the ACPI-specific functions, structs, enums, etc., have been moved to
      drivers/pci/pci-acpi.c there is no need for the hotplug_program_ops as all
      of the _HPX Type 0, 1, 2 and 3 are directly accessible.
      
      Link: https://lore.kernel.org/r/20190827094951.10613-4-kw@linux.comSigned-off-by: NKrzysztof Wilczynski <kw@linux.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      4a2dbedd
    • K
      PCI/ACPI: Move _HPP & _HPX functions to pci-acpi.c · 8c3aac6e
      Krzysztof Wilczynski 提交于
      Move program_hpx_type0(), program_hpx_type1(), etc., and enums
      hpx_type3_dev_type, hpx_type3_fn_type and hpx_type3_cfg_loc to
      drivers/pci/pci-acpi.c as these functions and enums are ACPI-specific.
      
      Move structs hpx_type0, hpx_type1, hpx_type2 and hpx_type3 to
      drivers/pci/pci.h as these are shared between drivers/pci/pci-acpi.c and
      drivers/pci/probe.c.
      
      Link: https://lore.kernel.org/r/20190827094951.10613-3-kw@linux.comSigned-off-by: NKrzysztof Wilczynski <kw@linux.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      8c3aac6e
    • K
      PCI/ACPI: Rename _HPX structs from hpp_* to hpx_* · e2797ad3
      Krzysztof Wilczynski 提交于
      The names of the hpp_type0, hpp_type1 and hpp_type2 structs suggest that
      they're related to _HPP, when in fact they're related to _HPX.
      
      The struct hpp_type0 denotes an _HPX Type 0 setting record that supersedes
      the _HPP setting record, and it has been used interchangeably for _HPP as
      per the ACPI specification (see version 6.3, section 6.2.9.1) which states
      that it should be applied to PCI, PCI-X and PCI Express devices, with
      settings being ignored if they are not applicable.
      
      Rename them to hpx_type0, hpx_type1 and hpx_type2 to reflect their relation
      to _HPX rather than _HPP.
      
      Link: https://lore.kernel.org/r/20190827094951.10613-2-kw@linux.comSigned-off-by: NKrzysztof Wilczynski <kw@linux.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      e2797ad3
  4. 30 7月, 2019 1 次提交
  5. 03 7月, 2019 2 次提交
  6. 24 6月, 2019 1 次提交
    • S
      bus_find_device: Unify the match callback with class_find_device · 418e3ea1
      Suzuki K Poulose 提交于
      There is an arbitrary difference between the prototypes of
      bus_find_device() and class_find_device() preventing their callers
      from passing the same pair of data and match() arguments to both of
      them, which is the const qualifier used in the prototype of
      class_find_device().  If that qualifier is also used in the
      bus_find_device() prototype, it will be possible to pass the same
      match() callback function to both bus_find_device() and
      class_find_device(), which will allow some optimizations to be made in
      order to avoid code duplication going forward.  Also with that, constify
      the "data" parameter as it is passed as a const to the match function.
      
      For this reason, change the prototype of bus_find_device() to match
      the prototype of class_find_device() and adjust its callers to use the
      const qualifier in accordance with the new prototype of it.
      
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andrew Lunn <andrew@lunn.ch>
      Cc: Andreas Noever <andreas.noever@gmail.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Corey Minyard <minyard@acm.org>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: David Kershner <david.kershner@unisys.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Felipe Balbi <balbi@kernel.org>
      Cc: Frank Rowand <frowand.list@gmail.com>
      Cc: Grygorii Strashko <grygorii.strashko@ti.com>
      Cc: Harald Freudenberger <freude@linux.ibm.com>
      Cc: Hartmut Knaack <knaack.h@gmx.de>
      Cc: Heiko Stuebner <heiko@sntech.de>
      Cc: Jason Gunthorpe <jgg@ziepe.ca>
      Cc: Jonathan Cameron <jic23@kernel.org>
      Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
      Cc: Len Brown <lenb@kernel.org>
      Cc: Mark Brown <broonie@kernel.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michael Jamet <michael.jamet@intel.com>
      Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
      Cc: Peter Oberparleiter <oberpar@linux.ibm.com>
      Cc: Sebastian Ott <sebott@linux.ibm.com>
      Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Cc: Yehezkel Bernat <YehezkelShB@gmail.com>
      Cc: rafael@kernel.org
      Acked-by: NCorey Minyard <minyard@acm.org>
      Acked-by: NDavid Kershner <david.kershner@unisys.com>
      Acked-by: NMark Brown <broonie@kernel.org>
      Acked-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Acked-by: Wolfram Sang <wsa@the-dreams.de> # for the I2C parts
      Acked-by: NRob Herring <robh@kernel.org>
      Signed-off-by: NSuzuki K Poulose <suzuki.poulose@arm.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      418e3ea1
  7. 14 6月, 2019 1 次提交
  8. 09 5月, 2019 1 次提交
  9. 07 5月, 2019 1 次提交
  10. 24 4月, 2019 2 次提交
  11. 18 4月, 2019 1 次提交
  12. 06 4月, 2019 1 次提交
  13. 26 3月, 2019 1 次提交
  14. 09 2月, 2019 1 次提交
    • B
      PCI/ASPM: Use LTR if already enabled by platform · 10ecc818
      Bjorn Helgaas 提交于
      RussianNeuroMancer reported that the Intel 7265 wifi on a Dell Venue 11 Pro
      7140 table stopped working after wakeup from suspend and bisected the
      problem to 9ab105de ("PCI/ASPM: Disable ASPM L1.2 Substate if we don't
      have LTR").  David Ward reported the same problem on a Dell Latitude 7350.
      
      After af8bb9f8 ("PCI/ACPI: Request LTR control from platform before
      using it"), we don't enable LTR unless the platform has granted LTR control
      to us.  In addition, we don't notice if the platform had already enabled
      LTR itself.
      
      After 9ab105de ("PCI/ASPM: Disable ASPM L1.2 Substate if we don't have
      LTR"), we avoid using LTR if we don't think the path to the device has LTR
      enabled.
      
      The combination means that if the platform itself enables LTR but declines
      to give the OS control over LTR, we unnecessarily avoided using ASPM L1.2.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=201469
      Fixes: 9ab105de ("PCI/ASPM: Disable ASPM L1.2 Substate if we don't have LTR")
      Fixes: af8bb9f8 ("PCI/ACPI: Request LTR control from platform before using it")
      Reported-by: NRussianNeuroMancer <russianneuromancer@ya.ru>
      Reported-by: NDavid Ward <david.ward@ll.mit.edu>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      CC: stable@vger.kernel.org	# v4.18+
      10ecc818
  15. 02 2月, 2019 1 次提交
    • B
      PCI: Enable SERR# forwarding for all bridges · b4f6dcb9
      Bharat Kumar Gogada 提交于
      As per Figure 6-3 in PCIe r4.0, sec 6.2.6, ERR_ messages will be forwarded
      from the secondary interface to the primary interface, if the SERR# Enable
      bit in the Bridge Control register is set.
      
      It seems clear that an ACPI hotplug parameter method (_HPP or _HPX) that
      tells us to "enable SERR in the command register" (ACPI v6.2, sec 6.2.8,
      6.2.9.1) refers to PCI_COMMAND_SERR, which enables reporting of errors by
      the function itself.
      
      For bridges, we also interpreted that to mean we should enable
      PCI_BRIDGE_CTL_SERR, which enables *forwarding* of errors by the bridge.
      But we didn't enable PCI_BRIDGE_CTL_SERR anywhere else, which means we
      never enabled it for non-ACPI systems or ACPI systems that didn't supply
      hotplug parameters.
      
      That means errors reported below bridges were often never forwarded up to a
      Root Port where they could be signaled via AER.
      
      Enable PCI_BRIDGE_CTL_SERR for all bridges so we can get better error
      reporting for downstream devices.
      Signed-off-by: NBharat Kumar Gogada <bharat.kumar.gogada@xilinx.com>
      [bhelgaas: changelog]
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      b4f6dcb9
  16. 31 1月, 2019 2 次提交
  17. 23 1月, 2019 1 次提交
  18. 05 12月, 2018 1 次提交
  19. 12 10月, 2018 1 次提交
  20. 11 10月, 2018 2 次提交
  21. 03 10月, 2018 1 次提交
  22. 18 9月, 2018 1 次提交
  23. 12 9月, 2018 1 次提交
  24. 14 8月, 2018 2 次提交
    • M
      PCI: Match Root Port's MPS to endpoint's MPSS as necessary · 9f0e8935
      Myron Stowe 提交于
      In commit 27d868b5 ("PCI: Set MPS to match upstream bridge"), we made
      sure every device's MPS setting matches its upstream bridge, making it more
      likely that a hot-added device will work in a system with an optimized MPS
      configuration.
      
      Recently I've started encountering systems where the endpoint device's MPSS
      capability is less than its Root Port's current MPS value, thus the
      endpoint is not capable of matching its upstream bridge's MPS setting (see:
      bugzilla via "Link:" below).  This leaves the system vulnerable - the
      upstream Root Port could respond with larger TLPs than the device can
      handle, and the device will consider them to be 'Malformed'.
      
      One could use the "pci=pcie_bus_safe" kernel parameter to work around the
      issue, but that forces a user to supply a kernel parameter to get the
      system to function reliably and may end up limiting MPS settings of other
      unrelated, sub-topologies which could benefit from maintaining their larger
      values.
      
      Augment Keith's approach to include tuning down a Root Port's MPS setting
      when its hot-added endpoint device is not capable of matching it.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=200527Signed-off-by: NMyron Stowe <myron.stowe@redhat.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: NJon Mason <jdmason@kudzu.us>
      Cc: Keith Busch <keith.busch@intel.com>
      Cc: Sinan Kaya <okaya@kernel.org>
      Cc: Dongdong Liu <liudongdong3@huawei.com>
      9f0e8935
    • M
      PCI: Skip MPS logic for Virtual Functions (VFs) · 3dbe97ef
      Myron Stowe 提交于
      PCIe r4.0, sec 9.3.5.4, "Device Control Register", shows both
      Max_Payload_Size (MPS) and Max_Read_request_Size (MRRS) to be 'RsvdP' for
      VFs.  Just prior to the table it states:
      
        "PF and VF functionality is defined in Section 7.5.3.4 except where
         noted in Table 9-16.  For VF fields marked 'RsvdP', the PF setting
         applies to the VF."
      
      All of which implies that with respect to Max_Payload_Size Supported
      (MPSS), MPS, and MRRS values, we should not be paying any attention to the
      VF's fields, but rather only to the PF's.  Only looking at the PF's fields
      also logically makes sense as it's the sole physical interface to the PCIe
      bus.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=200527
      Fixes: 27d868b5 ("PCI: Set MPS to match upstream bridge")
      Signed-off-by: NMyron Stowe <myron.stowe@redhat.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Cc: stable@vger.kernel.org # 4.3+
      Cc: Keith Busch <keith.busch@intel.com>
      Cc: Sinan Kaya <okaya@kernel.org>
      Cc: Dongdong Liu <liudongdong3@huawei.com>
      Cc: Jon Mason <jdmason@kudzu.us>
      3dbe97ef
  25. 11 8月, 2018 1 次提交
    • A
      PCI: Check for PCIe Link downtraining · 2d1ce5ec
      Alexandru Gagniuc 提交于
      When both ends of a PCIe Link are capable of a higher bandwidth than is
      currently in use, the Link is said to be "downtrained".  A downtrained Link
      may indicate hardware or configuration problems in the system, but it's
      hard to identify such Links from userspace.
      
      Refactor pcie_print_link_status() so it continues to always print PCIe
      bandwidth information, as several NIC drivers desire.
      
      Add a new internal __pcie_print_link_status() to emit a message only when a
      device's bandwidth is constrained by the fabric and call it from the PCI
      core for all devices, which identifies all downtrained Links.  It also
      emits messages for a few cases that are technically not downtrained, such
      as a x4 device in an open-ended x1 slot.
      Signed-off-by: NAlexandru Gagniuc <mr.nuke.me@gmail.com>
      [bhelgaas: changelog, move __pcie_print_link_status() declaration to
      drivers/pci/, rename pcie_check_upstream_link() to
      pcie_report_downtraining()]
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      2d1ce5ec
  26. 07 8月, 2018 1 次提交
  27. 01 8月, 2018 1 次提交
    • H
      PCI: Fix is_added/is_busmaster race condition · 44bda4b7
      Hari Vyas 提交于
      When a PCI device is detected, pdev->is_added is set to 1 and proc and
      sysfs entries are created.
      
      When the device is removed, pdev->is_added is checked for one and then
      device is detached with clearing of proc and sys entries and at end,
      pdev->is_added is set to 0.
      
      is_added and is_busmaster are bit fields in pci_dev structure sharing same
      memory location.
      
      A strange issue was observed with multiple removal and rescan of a PCIe
      NVMe device using sysfs commands where is_added flag was observed as zero
      instead of one while removing device and proc,sys entries are not cleared.
      This causes issue in later device addition with warning message
      "proc_dir_entry" already registered.
      
      Debugging revealed a race condition between the PCI core setting the
      is_added bit in pci_bus_add_device() and the NVMe driver reset work-queue
      setting the is_busmaster bit in pci_set_master().  As these fields are not
      handled atomically, that clears the is_added bit.
      
      Move the is_added bit to a separate private flag variable and use atomic
      functions to set and retrieve the device addition state.  This avoids the
      race because is_added no longer shares a memory location with is_busmaster.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=200283Signed-off-by: NHari Vyas <hari.vyas@broadcom.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NLukas Wunner <lukas@wunner.de>
      Acked-by: NMichael Ellerman <mpe@ellerman.id.au>
      44bda4b7
  28. 20 7月, 2018 1 次提交
  29. 13 7月, 2018 1 次提交
    • J
      PCI: Workaround IDT switch ACS Source Validation erratum · aa667c64
      James Puthukattukaran 提交于
      Some IDT switches incorrectly flag an ACS Source Validation error on
      completions for config read requests even though PCIe r4.0, sec 6.12.1.1,
      says that completions are never affected by ACS Source Validation.  Here's
      the text of IDT 89H32H8G3-YC, erratum #36:
      
        Item #36 - Downstream port applies ACS Source Validation to Completions
        Section 6.12.1.1 of the PCI Express Base Specification 3.1 states that
        completions are never affected by ACS Source Validation.  However,
        completions received by a downstream port of the PCIe switch from a
        device that has not yet captured a PCIe bus number are incorrectly
        dropped by ACS Source Validation by the switch downstream port.
      
        Workaround: Issue a CfgWr1 to the downstream device before issuing the
        first CfgRd1 to the device.  This allows the downstream device to capture
        its bus number; ACS Source Validation no longer stops completions from
        being forwarded by the downstream port.  It has been observed that
        Microsoft Windows implements this workaround already; however, some
        versions of Linux and other operating systems may not.
      
      When doing the first config read to probe for a device, if the device is
      behind an IDT switch with this erratum:
      
        1. Disable ACS Source Validation if enabled
        2. Wait for device to become ready to accept config accesses (by using
           the Config Request Retry Status mechanism)
        3. Do a config write to the endpoint
        4. Enable ACS Source Validation (if it was enabled to begin with)
      
      The workaround suggested by IDT is basically only step 3, but we don't know
      when the device is ready to accept config requests.  That means we need to
      do config reads until we receive a non-Config Request Retry Status, which
      means we need to disable ACS SV temporarily.
      Signed-off-by: NJames Puthukattukaran <james.puthukattukaran@oracle.com>
      [bhelgaas: changelog, clean up whitespace, fold in unused variable fix
      from Anders Roxell <anders.roxell@linaro.org>]
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NAlex Williamson <alex.williamson@redhat.com>
      aa667c64
  30. 01 7月, 2018 1 次提交
    • S
      PCI: Enable PASID only if entire path supports End-End TLP prefixes · 7ce3f912
      Sinan Kaya 提交于
      A PCIe endpoint carries the process address space identifier (PASID) in
      the TLP prefix as part of the memory read/write transaction. The address
      information in the TLP is relevant only for a given PASID context.
      
      An IOMMU takes PASID value and the address information from the
      TLP to look up the physical address in the system.
      
      PASID is an End-End TLP Prefix (PCIe r4.0, sec 6.20).  Sec 2.2.10.2 says
      
        It is an error to receive a TLP with an End-End TLP Prefix by a
        Receiver that does not support End-End TLP Prefixes. A TLP in
        violation of this rule is handled as a Malformed TLP. This is a
        reported error associated with the Receiving Port (see Section 6.2).
      
      Prevent error condition by proactively requiring End-End TLP prefix to be
      supported on the entire data path between the endpoint and the root port
      before enabling PASID.
      Signed-off-by: NSinan Kaya <okaya@codeaurora.org>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      7ce3f912
  31. 30 6月, 2018 1 次提交
  32. 05 6月, 2018 2 次提交