1. 24 3月, 2019 1 次提交
  2. 23 2月, 2019 1 次提交
    • L
      PCI: Fix __initdata issue with "pci=disable_acs_redir" parameter · bc5d9726
      Logan Gunthorpe 提交于
      commit d2fd6e81912a665993b24dcdc1c1384a42a54f7e upstream.
      
      The disable_acs_redir parameter stores a pointer to the string passed to
      pci_setup().  However, the string passed to PCI setup is actually a
      temporary copy allocated in static __initdata memory.  After init, once the
      memory is freed, it is no longer valid to reference this pointer.
      
      This bug was noticed in v5.0-rc1 after a change in commit c5eb1190074c
      ("PCI / PM: Allow runtime PM without callback functions") caused
      pci_disable_acs_redir() to be called during shutdown which manifested
      as an unable to handle kernel paging request at:
      
        RIP: 0010:pci_enable_acs+0x3f/0x1e0
        Call Trace:
           pci_restore_state.part.44+0x159/0x3c0
           pci_restore_standard_config+0x33/0x40
           pci_pm_runtime_resume+0x2b/0xd0
           ? pci_restore_standard_config+0x40/0x40
           __rpm_callback+0xbc/0x1b0
           rpm_callback+0x1f/0x70
           ? pci_restore_standard_config+0x40/0x40
            rpm_resume+0x4f9/0x710
           ? pci_conf1_read+0xb6/0xf0
           ? pci_conf1_write+0xb2/0xe0
           __pm_runtime_resume+0x47/0x70
           pci_device_shutdown+0x1e/0x60
           device_shutdown+0x14a/0x1f0
           kernel_restart+0xe/0x50
           __do_sys_reboot+0x1ee/0x210
           ? __fput+0x144/0x1d0
           do_writev+0x5e/0xf0
           ? do_writev+0x5e/0xf0
           do_syscall_64+0x48/0xf0
           entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
      It was also likely possible to trigger this bug when hotplugging PCI
      devices.
      
      To fix this, instead of storing a pointer, we use kstrdup() to copy the
      disable_acs_redir_param to its own buffer which will never be freed.
      
      Fixes: aaca43fd ("PCI: Add "pci=disable_acs_redir=" parameter for peer-to-peer support")
      Tested-by: NJarkko Nikula <jarkko.nikula@linux.intel.com>
      Signed-off-by: NLogan Gunthorpe <logang@deltatee.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NJarkko Nikula <jarkko.nikula@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bc5d9726
  3. 13 2月, 2019 2 次提交
  4. 17 1月, 2019 3 次提交
  5. 13 1月, 2019 1 次提交
    • J
      PCI / PM: Allow runtime PM without callback functions · b541ebbe
      Jarkko Nikula 提交于
      commit c5eb1190074cfb14c5d9cac692f1912eecf1a5e4 upstream.
      
      a9c8088c ("i2c: i801: Don't restore config registers on runtime PM")
      nullified the runtime PM suspend/resume callback pointers while keeping the
      runtime PM enabled.
      
      This caused the SMBus PCI device to stay in D0 with
      /sys/devices/.../power/runtime_status showing "error" when the runtime PM
      framework attempted to autosuspend the device.  This is due to PCI bus
      runtime PM, which checks for driver runtime PM callbacks and returns
      -ENOSYS if they are not set.
      
      Since i2c-i801.c doesn't need to do anything device-specific for runtime
      PM, Jean Delvare proposed this be fixed in the PCI core rather than adding
      dummy runtime PM callback functions in the PCI drivers.
      
      Change pci_pm_runtime_suspend()/pci_pm_runtime_resume() so they allow
      changing the PCI device power state during runtime PM transitions even if
      the driver supplies no runtime PM callbacks.
      
      This fixes the runtime PM regression on i2c-i801.c.
      
      It is not obvious why the code previously required the runtime PM
      callbacks.  The test has been there since the code was introduced by
      6cbf8214 ("PCI PM: Run-time callbacks for PCI bus type").
      
      On the other hand, a similar change was done to generic runtime PM
      callbacks in 05aa55dd ("PM / Runtime: Lenient generic runtime pm
      callbacks").
      
      Fixes: a9c8088c ("i2c: i801: Don't restore config registers on runtime PM")
      Reported-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NJarkko Nikula <jarkko.nikula@linux.intel.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NJean Delvare <jdelvare@suse.de>
      Reviewed-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Cc: stable@vger.kernel.org	# v4.18+
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b541ebbe
  6. 17 12月, 2018 1 次提交
    • T
      PCI: imx6: Fix link training status detection in link up check · 2a031cab
      Trent Piepho 提交于
      [ Upstream commit 68bc10bf992180f269816ff3d22eb30383138577 ]
      
      This bug was introduced in the interaction for two commits on either
      branch of the merge commit 562df5c8 ("Merge branch
      'pci/host-designware' into next").
      
      Commit 4d107d3b ("PCI: imx6: Move link up check into
      imx6_pcie_wait_for_link()"), changed imx6_pcie_wait_for_link() to poll
      the link status register directly, checking for link up and not
      training, and made imx6_pcie_link_up() only check the link up bit (once,
      not a polling loop).
      
      While commit 886bc5ce ("PCI: designware: Add generic
      dw_pcie_wait_for_link()"), replaced the loop in
      imx6_pcie_wait_for_link() with a call to a new dwc core function, which
      polled imx6_pcie_link_up(), which still checked both link up and not
      training in a loop.
      
      When these two commits were merged, the version of
      imx6_pcie_wait_for_link() from 886bc5ce was kept, which eliminated
      the link training check placed there by 4d107d3b. However, the
      version of imx6_pcie_link_up() from 4d107d3b was kept, which
      eliminated the link training check that had been there and was moved to
      imx6_pcie_wait_for_link().
      
      The result was the link training check got lost for the imx6 driver.
      
      Eliminate imx6_pcie_link_up() so that the default handler,
      dw_pcie_link_up(), is used instead. The default handler has the correct
      code, which checks for link up and also that it still is not training,
      fixing the regression.
      
      Fixes: 562df5c8 ("Merge branch 'pci/host-designware' into next")
      Signed-off-by: NTrent Piepho <tpiepho@impinj.com>
      [lorenzo.pieralisi@arm.com: rewrote the commit log]
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Reviewed-by: NLucas Stach <l.stach@pengutronix.de>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Joao Pinto <Joao.Pinto@synopsys.com>
      Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Cc: Richard Zhu <hongxing.zhu@nxp.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      2a031cab
  7. 06 12月, 2018 3 次提交
  8. 14 11月, 2018 8 次提交
    • B
      PCI: Add Device IDs for Intel GPU "spurious interrupt" quirk · 33d19d93
      Bin Meng 提交于
      commit d0c9606b31a21028fb5b753c8ad79626292accfd upstream.
      
      Add Device IDs to the Intel GPU "spurious interrupt" quirk table.
      
      For these devices, unplugging the VGA cable and plugging it in again causes
      spurious interrupts from the IGD.  Linux eventually disables the interrupt,
      but of course that disables any other devices sharing the interrupt.
      
      The theory is that this is a VGA BIOS defect: it should have disabled the
      IGD interrupt but failed to do so.
      
      See f67fd55f ("PCI: Add quirk for still enabled interrupts on Intel
      Sandy Bridge GPUs") and 7c82126a ("PCI: Add new ID for Intel GPU
      "spurious interrupt" quirk") for some history.
      
      [bhelgaas: See link below for discussion about how to fix this more
      generically instead of adding device IDs for every new Intel GPU.  I hope
      this is the last patch to add device IDs.]
      
      Link: https://lore.kernel.org/linux-pci/1537974841-29928-1-git-send-email-bmeng.cn@gmail.comSigned-off-by: NBin Meng <bmeng.cn@gmail.com>
      [bhelgaas: changelog]
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Cc: stable@vger.kernel.org	# v3.4+
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      33d19d93
    • L
      PCI/ASPM: Fix link_state teardown on device removal · 1e37e70d
      Lukas Wunner 提交于
      commit aeae4f3e5c38d47bdaef50446dc0ec857307df68 upstream.
      
      Upon removal of the last device on a bus, the link_state of the bridge
      leading to that bus is sought to be torn down by having pci_stop_dev()
      call pcie_aspm_exit_link_state().
      
      When ASPM was originally introduced by commit 7d715a6c ("PCI: add
      PCI Express ASPM support"), it determined whether the device being
      removed is the last one by calling list_empty() on the bridge's
      subordinate devices list.  That didn't work because the device is only
      removed from the list slightly later in pci_destroy_dev().
      
      Commit 3419c75e ("PCI: properly clean up ASPM link state on device
      remove") attempted to fix it by calling list_is_last(), but that's not
      correct either because it checks whether the device is at the *end* of
      the list, not whether it's the last one *left* in the list.  If the user
      removes the device which happens to be at the end of the list via sysfs
      but other devices are preceding the device in the list, the link_state
      is torn down prematurely.
      
      The real fix is to move the invocation of pcie_aspm_exit_link_state() to
      pci_destroy_dev() and reinstate the call to list_empty().  Remove a
      duplicate check for dev->bus->self because pcie_aspm_exit_link_state()
      already contains an identical check.
      
      Fixes: 7d715a6c ("PCI: add PCI Express ASPM support")
      Signed-off-by: NLukas Wunner <lukas@wunner.de>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Cc: Shaohua Li <shaohua.li@intel.com>
      Cc: stable@vger.kernel.org # v2.6.26
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1e37e70d
    • V
      PCI: dwc: pci-dra7xx: Enable errata i870 for both EP and RC mode · 653f6e54
      Vignesh R 提交于
      [ Upstream commit 726d75a6d243bf6730da3216f3592503f6f0f588 ]
      
      Errata i870 is applicable in both EP and RC mode. Therefore rename
      function dra7xx_pcie_ep_unaligned_memaccess(), that implements errata
      workaround, to dra7xx_pcie_unaligned_memaccess() and call it for both RC
      and EP. Make sure driver probe does not fail in case the workaround is not
      applied for RC mode in order to maintain DT backward compatibility.
      Reported-by: NChris Welch <Chris.Welch@viavisolutions.com>
      Signed-off-by: NVignesh R <vigneshr@ti.com>
      [lorenzo.pieralisi@arm.com: reworded the log]
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Acked-by: NKishon Vijay Abraham I <kishon@ti.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      653f6e54
    • T
      PCI/MSI: Warn and return error if driver enables MSI/MSI-X twice · f17c1795
      Tonghao Zhang 提交于
      [ Upstream commit 4c1ef72e9b71a19fb405ebfcd37c0a5e16fa44ca ]
      
      It is a serious driver defect to enable MSI or MSI-X more than once.  Doing
      so may panic the kernel as in the stack trace below:
      
        Call Trace:
          sysfs_add_one+0xa5/0xd0
          create_dir+0x7c/0xe0
          sysfs_create_subdir+0x1c/0x20
          internal_create_group+0x6d/0x290
          sysfs_create_groups+0x4a/0xa0
          populate_msi_sysfs+0x1cd/0x210
          pci_enable_msix+0x31c/0x3e0
          igbuio_pci_open+0x72/0x300 [igb_uio]
          uio_open+0xcc/0x120 [uio]
          chrdev_open+0xa1/0x1e0
          [...]
          do_sys_open+0xf3/0x1f0
          SyS_open+0x1e/0x20
          system_call_fastpath+0x16/0x1b
          ---[ end trace 11042e2848880209 ]---
          Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: ffffffffa056b4fa
      
      We want to keep the WARN_ON() and stack trace so the driver can be fixed,
      but we can avoid the kernel panic by returning an error.  We may still get
      warnings like this:
      
        Call Trace:
          pci_enable_msix+0x3c9/0x3e0
          igbuio_pci_open+0x72/0x300 [igb_uio]
          uio_open+0xcc/0x120 [uio]
          chrdev_open+0xa1/0x1e0
          [...]
          do_sys_open+0xf3/0x1f0
          SyS_open+0x1e/0x20
          system_call_fastpath+0x16/0x1b
          ------------[ cut here ]------------
          WARNING: at fs/sysfs/dir.c:526 sysfs_add_one+0xa5/0xd0()
          sysfs: cannot create duplicate filename '/devices/pci0000:00/0000:00:03.0/0000:01:00.1/msi_irqs'
      Signed-off-by: NTonghao Zhang <xiangxia.m.yue@gmail.com>
      [bhelgaas: changelog, fix patch whitespace, remove !!]
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f17c1795
    • A
      PCI: cadence: Correct probe behaviour when failing to get PHY · f7087a37
      Alan Douglas 提交于
      [ Upstream commit aa77e55d48124d0d78456eabf872fffb5decdbe1 ]
      
      Test the correct value to see whether the PHY get failed.
      
      Use devm_phy_get() instead of devm_phy_optional_get(), since it is
      only called if phy name is given in devicetree and so should exist.
      If failure when getting or linking PHY, put any PHYs which were
      already got and unlink them.
      
      Fixes: dfb80534 ("PCI: cadence: Add generic PHY support to host and EP drivers")
      Reported-by: NColin King <colin.king@canonical.com>
      Signed-off-by: NAlan Douglas <adouglas@cadence.com>
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f7087a37
    • M
      PCI / ACPI: Enable wake automatically for power managed bridges · 1997aecd
      Mika Westerberg 提交于
      [ Upstream commit 6299cf9ec3985cac70bede8a855b5087b81a6640 ]
      
      We enable power management automatically for bridges where
      pci_bridge_d3_possible() returns true. However, these bridges may have
      ACPI methods such as _DSW that need to be called before D3 entry. For
      example in Lenovo Thinkpad X1 Carbon 6th _DSW method is used to prepare
      D3cold for the PCIe root port hosting Thunderbolt chain. Because wake is
      not enabled _DSW method is never called and the port does not enter
      D3cold properly consuming more power than necessary.
      
      Users can work this around by writing "enabled" to "wakeup" sysfs file
      under the device in question but that is not something an ordinary user
      is expected to do.
      
      Since we already automatically enable power management for PCIe ports
      with ->bridge_d3 set extend that to enable wake for them as well,
      assuming the port has any ACPI wakeup related objects implemented in the
      namespace (adev->wakeup.flags.valid is true). This ensures the necessary
      ACPI methods get called at appropriate times and allows the root port in
      Thinkpad X1 Carbon 6th to go into D3cold.
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1997aecd
    • A
      PCI: cadence: Use AXI region 0 to signal interrupts from EP · 7c190bb8
      Alan Douglas 提交于
      [ Upstream commit 0652d4b6b56f73c81abbdbc7e26f772cb2dfe370 ]
      
      The IRQ physical address is allocated from region 0, rather than
      the highest region. Update the driver to reserve this region in
      the bitmap and to use region 0 for all types of interrupt.
      
      This corrects a problem which prevents the interrupt being
      signalled correctly if using the first address in the AXI region,
      since an offset of zero will always be mapped to region 0.
      
      Fixes: 37dddf14 ("PCI: cadence: Add EndPoint Controller driver for Cadence PCIe controller")
      Signed-off-by: NAlan Douglas <adouglas@cadence.com>
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7c190bb8
    • H
      PCI: mediatek: Fix mtk_pcie_find_port() endpoint/port matching logic · 1a5908dd
      Honghui Zhang 提交于
      [ Upstream commit 074d6f32689ce05a084b6fa3db38445745bf11cc ]
      
      The Mediatek's host controller has two slots, each with its own control
      registers. The host driver needs to identify what slot is connected to
      what port in order to access the device's configuration space.
      
      Current code retrieving slot connected to a given endpoint device.
      
      Assuming each slot is connected to one endpoint device as below:
      
                      host bridge
        bus 0 --> __________|_______
                 |                  |
                 |                  |
               slot 0             slot 1
        bus 1 -->|        bus 2 --> |
                 |                  |
               EP 0               EP 1
      
      During PCI enumeration, system software will scan all the PCI devices on
      every bus starting from devfn 0. Using PCI_SLOT(devfn) for matching an
      endpoint to its slot is erroneous in that the devfn does not contain the
      hierarchical bus numbering in it. In order to match an endpoint with its
      slot (and related port), the PCI tree must be walked up to the root bus
      (where the root ports are situated) and then the PCI_SLOT(devfn)
      matching logic can be correctly applied for matching.
      
      This patch fixes the mtk_pcie_find_port() slot matching logic by adding
      appropriate PCI tree walking code to retrieve the slot/port a given
      endpoint is connected to.
      Signed-off-by: NHonghui Zhang <honghui.zhang@mediatek.com>
      [lorenzo.pieralisi@arm.com: rewrote the commit log]
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Acked-by: NRyder Lee <ryder.lee@mediatek.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1a5908dd
  9. 06 10月, 2018 1 次提交
    • K
      treewide: Replace more open-coded allocation size multiplications · 329e0989
      Kees Cook 提交于
      As done treewide earlier, this catches several more open-coded
      allocation size calculations that were added to the kernel during the
      merge window. This performs the following mechanical transformations
      using Coccinelle:
      
      	kvmalloc(a * b, ...) -> kvmalloc_array(a, b, ...)
      	kvzalloc(a * b, ...) -> kvcalloc(a, b, ...)
      	devm_kzalloc(..., a * b, ...) -> devm_kcalloc(..., a, b, ...)
      Signed-off-by: NKees Cook <keescook@chromium.org>
      329e0989
  10. 02 10月, 2018 1 次提交
  11. 28 9月, 2018 1 次提交
    • D
      PCI: Reprogram bridge prefetch registers on resume · 08387454
      Daniel Drake 提交于
      On 38+ Intel-based ASUS products, the NVIDIA GPU becomes unusable after S3
      suspend/resume.  The affected products include multiple generations of
      NVIDIA GPUs and Intel SoCs.  After resume, nouveau logs many errors such
      as:
      
        fifo: fault 00 [READ] at 0000005555555000 engine 00 [GR] client 04
              [HUB/FE] reason 4a [] on channel -1 [007fa91000 unknown]
        DRM: failed to idle channel 0 [DRM]
      
      Similarly, the NVIDIA proprietary driver also fails after resume (black
      screen, 100% CPU usage in Xorg process).  We shipped a sample to NVIDIA for
      diagnosis, and their response indicated that it's a problem with the parent
      PCI bridge (on the Intel SoC), not the GPU.
      
      Runtime suspend/resume works fine, only S3 suspend is affected.
      
      We found a workaround: on resume, rewrite the Intel PCI bridge
      'Prefetchable Base Upper 32 Bits' register (PCI_PREF_BASE_UPPER32).  In the
      cases that I checked, this register has value 0 and we just have to rewrite
      that value.
      
      Linux already saves and restores PCI config space during suspend/resume,
      but this register was being skipped because upon resume, it already has
      value 0 (the correct, pre-suspend value).
      
      Intel appear to have previously acknowledged this behaviour and the
      requirement to rewrite this register:
      https://bugzilla.kernel.org/show_bug.cgi?id=116851#c23
      
      Based on that, rewrite the prefetch register values even when that appears
      unnecessary.
      
      We have confirmed this solution on all the affected models we have in-hands
      (X542UQ, UX533FD, X530UN, V272UN).
      
      Additionally, this solves an issue where r8169 MSI-X interrupts were broken
      after S3 suspend/resume on ASUS X441UAR.  This issue was recently worked
      around in commit 7bb05b85 ("r8169: don't use MSI-X on RTL8106e").  It
      also fixes the same issue on RTL6186evl/8111evl on an Aimfor-tech laptop
      that we had not yet patched.  I suspect it will also fix the issue that was
      worked around in commit 7c53a722 ("r8169: don't use MSI-X on
      RTL8168g").
      
      Thomas Martitz reports that this change also solves an issue where the AMD
      Radeon Polaris 10 GPU on the HP Zbook 14u G5 is unresponsive after S3
      suspend/resume.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=201069Signed-off-by: NDaniel Drake <drake@endlessm.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-By: NPeter Wu <peter@lekensteyn.nl>
      CC: stable@vger.kernel.org
      08387454
  12. 27 9月, 2018 1 次提交
    • M
      ACPI / hotplug / PCI: Don't scan for non-hotplug bridges if slot is not bridge · f188b99f
      Mika Westerberg 提交于
      HP 6730b laptop has an ethernet NIC connected to one of the PCIe root
      ports.  The root ports themselves are native PCIe hotplug capable.  Now,
      during boot after PCI devices are scanned the BIOS triggers ACPI bus check
      directly to the NIC:
      
        ACPI: \_SB_.PCI0.RP06.NIC_: Bus check in hotplug_event()
      
      It is not clear why it is sending bus check but regardless the ACPI hotplug
      notify handler calls enable_slot() directly (instead of going through
      acpiphp_check_bridge() as there is no bridge), which ends up handling
      special case for non-hotplug bridges with native PCIe hotplug.  This
      results a crash of some kind but the reporter only sees black screen so it
      is hard to figure out the exact spot and what actually happens.  Based on
      a few fix proposals it was tracked to crash somewhere inside
      pci_assign_unassigned_bridge_resources().
      
      In any case we should not really be in that special branch at all because
      the ACPI notify happened to a slot that is not a PCI bridge (it is just a
      regular PCI device).
      
      Fix this so that we only go to that special branch if we are calling
      enable_slot() for a bridge (e.g., the ACPI notification was for the
      bridge).
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=201127
      Fixes: 84c8b58e ("ACPI / hotplug / PCI: Don't scan bridges managed by native hotplug")
      Reported-by: NPeter Anemone <peter.anemone@gmail.com>
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      CC: stable@vger.kernel.org	# v4.18+
      f188b99f
  13. 22 9月, 2018 1 次提交
  14. 21 9月, 2018 1 次提交
  15. 17 9月, 2018 1 次提交
    • S
      PCI: hv: support reporting serial number as slot information · a15f2c08
      Stephen Hemminger 提交于
      The Hyper-V host API for PCI provides a unique "serial number" which
      can be used as basis for sysfs PCI slot table. This can be useful
      for cases where userspace wants to find the PCI device based on
      serial number.
      
      When an SR-IOV NIC is added, the host sends an attach message
      with serial number. The kernel doesn't use the serial number, but
      it is useful when doing the same thing in a userspace driver such
      as the DPDK. By having /sys/bus/pci/slots/N it provides a direct
      way to find the matching PCI device.
      
      There maybe some cases where serial number is not unique such
      as when using GPU's. But the PCI slot infrastructure will handle
      that.
      
      This has a side effect which may also be useful. The common udev
      network device naming policy uses the slot information (rather
      than PCI address).
      Signed-off-by: NStephen Hemminger <sthemmin@microsoft.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a15f2c08
  16. 12 9月, 2018 3 次提交
  17. 11 9月, 2018 3 次提交
  18. 23 8月, 2018 1 次提交
  19. 17 8月, 2018 1 次提交
    • R
      PCI / ACPI / PM: Resume all bridges on suspend-to-RAM · 9d64b539
      Rafael J. Wysocki 提交于
      Commit 26112ddc (PCI / ACPI / PM: Resume bridges w/o drivers on
      suspend-to-RAM) attempted to fix a functional regression resulting
      from commit c62ec461 (PM / core: Fix direct_complete handling
      for devices with no callbacks) by resuming PCI bridges without
      drivers (that is, "parallel PCI" ones) during system-wide suspend if
      the target system state is not ACPI S0 (working state).
      
      That turns out insufficient, however, as it is reported that, at
      least in one case, the platform firmware gets confused if a PCIe
      root port is suspended before entering the ACPI S3 sleep state.
      That issue was exposed by commit 77b3729ca03 (PCI / PM: Use
      SMART_SUSPEND and LEAVE_SUSPENDED flags for PCIe ports) that allowed
      PCIe ports to stay in runtime suspend during system-wide suspend
      (which is OK for suspend-to-idle, but turns out to be problematic
      otherwise).
      
      For this reason, drop the driver check from acpi_pci_need_resume()
      and resume all bridges (including PCIe ports with drivers) during
      system-wide suspend if the target system state is not ACPI S0.
      
      [If the target system state is ACPI S0, it means suspend-to-idle
       and the platform firmware is not going to be invoked to actually
       suspend the system, so there is no need to resume the bridges in
       that case.]
      
      Fixes: 77b3729ca03 (PCI / PM: Use SMART_SUSPEND and LEAVE_SUSPENDED flags for PCIe ports)
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=200675Reported-by: Nteika kazura <teika@gmx.com>
      Tested-by: Nteika kazura <teika@gmx.com>
      Reviewed-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Acked-by: NBjorn Helgaas <bhelgaas@google.com>
      Cc: 4.16+ <stable@vger.kernel.org> # 4.16+: 26112ddc (PCI / ACPI / PM: Resume bridges ...)
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      9d64b539
  20. 16 8月, 2018 1 次提交
  21. 15 8月, 2018 3 次提交
    • J
      PCI: Limit config space size for Netronome NFP5000 · 2538fb89
      Jakub Kicinski 提交于
      Like the NFP4000 and NFP6000, the NFP5000 as an erratum where reading/
      writing to PCI config space addresses above 0x600 can cause the NFP to
      generate PCIe completion timeouts.
      
      Limit the NFP5000's PF's config space size to 0x600 bytes as is already
      done for the NFP4000 and NFP6000.
      
      The NFP5000's VF is 0x6003 (PCI_DEVICE_ID_NETRONOME_NFP6000_VF), the same
      device ID as the NFP6000's VF.  Thus, its config space is already limited
      by the existing use of quirk_nfp6000().
      Signed-off-by: NJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NTony Egan <tony.egan@netronome.com>
      2538fb89
    • H
      PCI/MSI: Set IRQCHIP_ONESHOT_SAFE for PCI-MSI irqchips · 923aa4c3
      Heiner Kallweit 提交于
      If flag IRQCHIP_ONESHOT_SAFE isn't set for an irqchip and we have a
      threaded interrupt with no primary handler, flag IRQF_ONESHOT needs to be
      set for the interrupt, causing some overhead in the threaded interrupt
      handler.  For more detailed explanation also check following comment in
      __setup_irq():
      
        The interrupt was requested with handler = NULL, so we use the default
        primary handler for it. But it does not have the oneshot flag set.  In
        combination with level interrupts this is deadly, because the default
        primary handler just wakes the thread, then the irq lines is reenabled,
        but the device still has the level irq asserted.  Rinse and repeat....
      
        While this works for edge type interrupts, we play it safe and reject
        unconditionally because we can't say for sure which type this interrupt
        really has.  The type flags are unreliable as the underlying chip
        implementation can override them.
      
      Another comment in __setup_irq() gives a hint already that this
      overhead can be avoided for PCI-MSI:
      
        Some irq chips like MSI based interrupts are per se one shot safe.  Check
        the chip flags, so we can avoid the unmask dance at the end of the
        threaded handler for those.
      
      Following this let's mark all PCI-MSI irqchips as oneshot-safe.
      
      See also discussion here:
      https://lkml.kernel.org/r/alpine.DEB.2.21.1808032136490.1658@nanos.tec.linutronix.deSigned-off-by: NHeiner Kallweit <hkallweit1@gmail.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      923aa4c3
    • B
      PCI/VPD: Check for VPD access completion before checking for timeout · 6eaf2781
      Bert Kenward 提交于
      Previously we checked the timeout before checking the VPD access completion
      bit.  On a very heavily loaded system this can cause VPD access to timeout.
      Check the completion bit before checking the timeout.
      Signed-off-by: NBert Kenward <bkenward@solarflare.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      6eaf2781
  22. 14 8月, 2018 1 次提交
    • 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