1. 14 10月, 2021 7 次提交
  2. 05 3月, 2020 3 次提交
    • Y
      Revert "PCI: fix kabi change in struct pci_bus" · 6432d8c9
      Yang Yingliang 提交于
      hulk inclusion
      category: bugfix
      bugzilla: 30939
      CVE: NA
      
      ---------------------------
      
      The kabi can be broken before official release.
      
      This reverts commit 8664b79edac95322379eee025763ba0840d458d1.
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      Reviewed-By: NXie XiuQi <xiexiuqi@huawei.com>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      6432d8c9
    • X
      PCI: fix kabi change in struct pci_bus · 822a5290
      Xiongfeng Wang 提交于
      hulk inclusion
      category: bugfix
      bugzilla: NA
      CVE: NA
      
      ---------------------------
      
      Fix kabi change in struct pci_bus since the following patch.
      12de28f380a9 ("PCI: add a member in 'struct pci_bus' to record the
      original 'pci_ops'")
      Signed-off-by: NXiongfeng Wang <wangxiongfeng2@huawei.com>
      Reviewed-by: NHanjun Guo <guohanjun@huawei.com>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      822a5290
    • X
      PCI: add a member in 'struct pci_bus' to record the original 'pci_ops' · 03377a8a
      Xiongfeng Wang 提交于
      hulk inclusion
      category: bugfix
      bugzilla: NA
      CVE: NA
      
      -------------------------------------------------
      
      When I test 'aer-inject' with the following procedures:
      1. inject a fatal error into a upstream PCI bridge
      2. remove the upstream bridge by sysfs
      3. rescan the PCI tree by 'echo 1 > /sys/bus/pci/rescan'
      4. execute command 'rmmod aer-inject'
      5. remove the upstream bridge by sysfs again
      
      I came across the following Oops.
      
      [  799.713238] Internal error: Oops: 96000007 [#1] SMP
      [  799.718099] Process bash (pid: 10683, stack limit = 0x00000000125a3b1b)
      [  799.724686] CPU: 108 PID: 10683 Comm: bash Kdump: loaded Not tainted 4.19.36 #2
      [  799.731962] Hardware name: Huawei TaiShan 2280 V2/BC82AMDD, BIOS 1.05 09/18/2019
      [  799.739325] pstate: 40400009 (nZcv daif +PAN -UAO)
      [  799.744104] pc : pci_remove_bus+0xc0/0x1c0
      [  799.748182] lr : pci_remove_bus+0x94/0x1c0
      [  799.752260] sp : ffffa02e335df940
      [  799.755560] x29: ffffa02e335df940 x28: ffff2000088216a8
      [  799.760849] x27: 1ffff405c66bbfbc x26: ffff20000a9518c0
      [  799.766139] x25: ffffa02dea6ec418 x24: 1ffff405bd4dd883
      [  799.771427] x23: ffffa02e72576628 x22: 1ffff405ce4aecc0
      [  799.776715] x21: ffffa02e72576608 x20: ffff200002e75080
      [  799.782003] x19: ffffa02e72576600 x18: 0000000000000000
      [  799.787291] x17: 0000000000000000 x16: 0000000000000000
      [  799.792578] x15: 0000000000000001 x14: dfff200000000000
      [  799.797866] x13: ffff20000a6dfaf0 x12: 0000000000000000
      [  799.803154] x11: 1fffe4000159b217 x10: ffff04000159b217
      [  799.808442] x9 : dfff200000000000 x8 : ffff20000acd90bf
      [  799.813730] x7 : 0000000000000000 x6 : 0000000000000000
      [  799.819017] x5 : 0000000000000001 x4 : 0000000000000000
      [  799.824306] x3 : 1ffff405dbe62603 x2 : 1fffe400005cea11
      [  799.829593] x1 : dfff200000000000 x0 : ffff200002e75088
      [  799.834882] Call trace:
      [  799.837323]  pci_remove_bus+0xc0/0x1c0
      [  799.841056]  pci_remove_bus_device+0xd0/0x2f0
      [  799.845392]  pci_stop_and_remove_bus_device_locked+0x2c/0x40
      [  799.851028]  remove_store+0x1b8/0x1d0
      [  799.854679]  dev_attr_store+0x60/0x80
      [  799.858330]  sysfs_kf_write+0x104/0x170
      [  799.862149]  kernfs_fop_write+0x23c/0x430
      [  799.866143]  __vfs_write+0xec/0x4e0
      [  799.869615]  vfs_write+0x12c/0x3d0
      [  799.873001]  ksys_write+0xd0/0x190
      [  799.876389]  __arm64_sys_write+0x70/0xa0
      [  799.880298]  el0_svc_common+0xfc/0x278
      [  799.884030]  el0_svc_handler+0x50/0xc0
      [  799.887764]  el0_svc+0x8/0xc
      [  799.890634] Code: d2c40001 f2fbffe1 91002280 d343fc02 (38e16841)
      [  799.896700] kernel fault(0x1) notification starting on CPU 108
      
      It is because when we alloc a new bus in rescanning process, the
      'pci_ops' of the newly allocced 'pci_bus' is inherited from its parent
      pci bus. Whereas, the 'pci_ops' of the parent bus may be changed to
      'aer_inj_pci_ops' in 'aer_inject()'. When we unload the module
      'aer_inject', we only restore the 'pci_ops' for the pci bus of the
      error-injected device and the root port in 'aer_inject_exit'. After we
      have unloaded the module, the 'pci_ops' of the newly allocced pci bus is
      still 'aer_inj_pci_ops'. When we access it, an Oops happened.
      
      This patch add a member 'backup_ops' in 'struct pci_bus' to record the
      original 'ops'. When we alloc a child pci bus, we assign the
      'backup_ops' of the parent bus to the 'ops' of the child bus.
      
      Maybe the best way is to not modify the 'pci_ops' in 'struct pci_bus',
      but this will refactor the 'aer_inject' framework a lot. I haven't found
      a better way to handle it.
      Signed-off-by: NXiongfeng Wang <wangxiongfeng2@huawei.com>
      Reviewed-by: NHanjun Guo <guohanjun@huawei.com>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      03377a8a
  3. 27 12月, 2019 7 次提交
    • R
      PCI: PM: Avoid possible suspend-to-idle issue · ab8c67da
      Rafael J. Wysocki 提交于
      mainline inclusion
      from mainline-5.2-rc3
      commit d491f2b7
      category: bugfix
      bugzilla: 17100
      CVE: NA
      
      -------------------------------------------------
      
      If a PCI driver leaves the device handled by it in D0 and calls
      pci_save_state() on the device in its ->suspend() or ->suspend_late()
      callback, it can expect the device to stay in D0 over the whole
      s2idle cycle.  However, that may not be the case if there is a
      spurious wakeup while the system is suspended, because in that case
      pci_pm_suspend_noirq() will run again after pci_pm_resume_noirq()
      which calls pci_restore_state(), via pci_pm_default_resume_early(),
      so state_saved is cleared and the second iteration of
      pci_pm_suspend_noirq() will invoke pci_prepare_to_sleep() which
      may change the power state of the device.
      
      To avoid that, add a new internal flag, skip_bus_pm, that will be set
      by pci_pm_suspend_noirq() when it runs for the first time during the
      given system suspend-resume cycle if the state of the device has
      been saved already and the device is still in D0.  Setting that flag
      will cause the next iterations of pci_pm_suspend_noirq() to set
      state_saved for pci_pm_resume_noirq(), so that it always restores the
      device state from the originally saved data, and avoid calling
      pci_prepare_to_sleep() for the device.
      
      Fixes: 33e4f80e ("ACPI / PM: Ignore spurious SCI wakeups from suspend-to-idle")
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NKeith Busch <keith.busch@intel.com>
      Reviewed-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NXiongfeng Wang <wangxiongfeng2@huawei.com>
      Reviewed-by: NHanjun Guo <guohanjun@huawei.com>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      ab8c67da
    • B
      PCI/ACPI: Evaluate PCI Boot Configuration _DSM · 596d3de1
      Benjamin Herrenschmidt 提交于
      mainline inclusion
      from mainline-5.3-rc3
      commit a78cf96
      category: feature
      bugzilla: 23453
      CVE: NA
      
      -------------------------------------------
      
      Evaluate _DSM Function #5, the "PCI Boot Configuration" function.  If the
      result is 0, the OS should preserve any resource assignments made by the
      firmware.
      
      Link: https://lore.kernel.org/r/20190615002359.29577-2-benh@kernel.crashing.orgSigned-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      [bhelgaas: commit log]
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: NXiongfeng Wang <wangxiongfeng2@huawei.com>
      Reviewed-by: NHanjun Guo <guohanjun@huawei.com>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      596d3de1
    • X
      pciehp: make 'slot_being_removed_rescanned' per root port · 834faefb
      Xiongfeng Wang 提交于
      hulk inclusion
      category: bugfix
      bugzilla: 20881
      CVE: NA
      ---------------------------
      
      We use a global variable 'slot_being_removed_rescaned' to mark whether a
      slot is being removed or rescaned. This will cause a slot hotplug
      operation is delayed if another slot is being remove or rescaned. But
      if these two slots are under different root ports, they should not
      influence each other. This patch make the flag
      'slot_being_removed_rescanned' per root port so that one slot hotplug
      operation doesn't influence slots below another root port.
      
      We record the root port in struct pci_dev when the pci device is
      initialized and added into the system instead of using
      'pcie_find_root_port()' to find the root port when we need it. Because
      iterating the pci tree needs the protection of
      'pci_lock_rescan_remove()'. This will make the problem more complexed
      because the lock is very coarse-grained. We don't need to worry about
      'use-after-free' because child pci devices are always removed before the
      root port device is removed.
      
      Fixes: 764cafd9875e ("pciehp: fix a race between pciehp and removing
      operations by sysfs")
      Signed-off-by: NXiongfeng Wang <wangxiongfeng2@huawei.com>
      Reviewed-by: NHanjun Guo <guohanjun@huawei.com>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      834faefb
    • S
      PCI: Work around Pericom PCIe-to-PCI bridge Retrain Link erratum · 4af551d9
      Stefan Mätje 提交于
      commit 4ec73791 upstream.
      
      Due to an erratum in some Pericom PCIe-to-PCI bridges in reverse mode
      (conventional PCI on primary side, PCIe on downstream side), the Retrain
      Link bit needs to be cleared manually to allow the link training to
      complete successfully.
      
      If it is not cleared manually, the link training is continuously restarted
      and no devices below the PCI-to-PCIe bridge can be accessed.  That means
      drivers for devices below the bridge will be loaded but won't work and may
      even crash because the driver is only reading 0xffff.
      
      See the Pericom Errata Sheet PI7C9X111SLB_errata_rev1.2_102711.pdf for
      details.  Devices known as affected so far are: PI7C9X110, PI7C9X111SL,
      PI7C9X130.
      
      Add a new flag, clear_retrain_link, in struct pci_dev.  Quirks for affected
      devices set this bit.
      
      Note that pcie_retrain_link() lives in aspm.c because that's currently the
      only place we use it, but this erratum is not specific to ASPM, and we may
      retrain links for other reasons in the future.
      Signed-off-by: NStefan Mätje <stefan.maetje@esd.eu>
      [bhelgaas: apply regardless of CONFIG_PCIEASPM]
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      CC: stable@vger.kernel.org
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      4af551d9
    • X
      pciehp: fix a race between pciehp and removing operations by sysfs · 762c10db
      Xiongfeng Wang 提交于
      hulk inclusion
      category: bugfix
      bugzilla: NA
      CVE: NA
      
      -------------------------------------------------
      
      When I run a stress test about pcie hotplug and removing operations by
      sysfs, I got a hange task, and the following call trace is printed.
      
       INFO: task irq/746-pciehp:41551 blocked for more than 120 seconds.
             Tainted: P        W  OE     4.19.25-
       "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
       irq/746-pciehp  D    0 41551      2 0x00000228
       Call trace:
        __switch_to+0x94/0xe8
        __schedule+0x270/0x8b0
        schedule+0x2c/0x88
        schedule_preempt_disabled+0x14/0x20
        __mutex_lock.isra.1+0x1fc/0x540
        __mutex_lock_slowpath+0x24/0x30
        mutex_lock+0x80/0xa8
        pci_lock_rescan_remove+0x20/0x28
        pciehp_configure_device+0x30/0x140
        pciehp_handle_presence_or_link_change+0x35c/0x4b0
        pciehp_ist+0x1cc/0x1d0
        irq_thread_fn+0x30/0x80
        irq_thread+0x128/0x200
        kthread+0x134/0x138
        ret_from_fork+0x10/0x18
       INFO: task bash:6424 blocked for more than 120 seconds.
             Tainted: P        W  OE     4.19.25-
       "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
       bash            D    0  6424   2231 0x00000200
       Call trace:
        __switch_to+0x94/0xe8
        __schedule+0x270/0x8b0
        schedule+0x2c/0x88
        schedule_timeout+0x224/0x448
        wait_for_common+0x198/0x2a0
        wait_for_completion+0x28/0x38
        kthread_stop+0x60/0x190
        __free_irq+0x1c0/0x348
        free_irq+0x40/0x88
        pcie_shutdown_notification+0x54/0x80
        pciehp_remove+0x30/0x50
        pcie_port_remove_service+0x3c/0x58
        device_release_driver_internal+0x1b4/0x250
        device_release_driver+0x28/0x38
        bus_remove_device+0xd4/0x160
        device_del+0x128/0x348
        device_unregister+0x24/0x78
        remove_iter+0x48/0x58
        device_for_each_child+0x6c/0xb8
        pcie_port_device_remove+0x2c/0x48
        pcie_portdrv_remove+0x5c/0x68
        pci_device_remove+0x48/0xd8
        device_release_driver_internal+0x1b4/0x250
        device_release_driver+0x28/0x38
        pci_stop_bus_device+0x84/0xb8
        pci_stop_and_remove_bus_device_locked+0x24/0x40
        remove_store+0xa4/0xb8
        dev_attr_store+0x44/0x60
        sysfs_kf_write+0x58/0x80
        kernfs_fop_write+0xe8/0x1f0
        __vfs_write+0x60/0x190
        vfs_write+0xac/0x1c0
        ksys_write+0x6c/0xd8
        __arm64_sys_write+0x24/0x30
        el0_svc_common+0xa0/0x180
        el0_svc_handler+0x38/0x78
        el0_svc+0x8/0xc
      
      When we remove a slot by sysfs.
      'pci_stop_and_remove_bus_device_locked()' will be called. This function
      will get the global mutex lock 'pci_rescan_remove_lock', and remove the
      slot. If the irq thread 'pciehp_ist' is still running, we will wait
      until it exits.
      
      If a pciehp interrupt happens immediately after we remove the slot by
      sysfs, but before we free the pciehp irq in
      'pci_stop_and_remove_bus_device_locked()'. 'pciehp_ist' will hung
      because the global mutex lock 'pci_rescan_remove_lock' is held by the
      sysfs operation. But the sysfs operation is waiting for the pciehp irq
      thread 'pciehp_ist' ends. Then a hung task occurs.
      
      So this two kinds of operation, removing through attention buttion and
      removing through /sys/devices/pci***/remove, should not be excuted at
      the same time. This patch add a global variable to mark that one of these
      operations is under processing. When this variable is set,  if another
      operation is requested, it will be rejected.
      Signed-off-by: NXiongfeng Wang <wangxiongfeng2@huawei.com>
      Reviewed-by: NHanjun Guo <guohanjun@huawei.com>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      762c10db
    • T
      kabi: reserve space for pci subsystem related structure · 90edd900
      Tan Xiaojun 提交于
      hulk inclusion
      category: feature
      bugzilla: 13276
      CVE: NA
      
      -------------------------------
      
      Reserve space for the structure in pci subsystem.
      Signed-off-by: NTan Xiaojun <tanxiaojun@huawei.com>
      Reviewed-by: NXie XiuQi <xiexiuqi@huawei.com>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      90edd900
    • B
      PCI: Probe bridge window attributes once at enumeration-time · 532c3c62
      Bjorn Helgaas 提交于
      mainline inclusion
      from mainline-5.1
      commit: <not-yet-available>
      category: bugfix
      bugzilla: 5473
      CVE: NA
      
      ----------------------------------------
      
      pci_bridge_check_ranges() determines whether a bridge supports the optional
      I/O and prefetchable memory windows and sets the flag bits in the bridge
      resources.  This could be done once during enumeration except that the
      resource allocation code completely clears the flag bits, e.g., in the
      pci_assign_unassigned_bridge_resources() path.
      
      The problem was that in some cases pci_bridge_check_ranges() *changes* the
      window registers to determine whether they're writable, and this may break
      concurrent accesses to devices behind the bridge.
      
      Add a new pci_read_bridge_windows() to determine whether a bridge supports
      the optional windows, call it once during enumeration, remember the
      results, and change pci_bridge_check_ranges() to set the flag bits based on
      those remembered results.
      
      Link: https://lore.kernel.org/linux-pci/1506151482-113560-1-git-send-email-wangzhou1@hisilicon.com
      Link: https://lists.gnu.org/archive/html/qemu-devel/2018-12/msg02082.htmlReported-by: Nxuyandong <xuyandong2@huawei.com>
      Cc: Sagi Grimberg <sagi@grimberg.me>
      Cc: Ofer Hayut <ofer@lightbitslabs.com>
      Cc: Roy Shterman <roys@lightbitslabs.com>
      Cc: Keith Busch <keith.busch@intel.com>
      Cc: Zhou Wang <wangzhou1@hisilicon.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      Reviewed-by: NXiongfeng Wang <wangxiongfeng2@huawei.com>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      532c3c62
  4. 12 9月, 2018 1 次提交
  5. 23 8月, 2018 1 次提交
  6. 15 8月, 2018 1 次提交
    • A
      PCI: Add PCI_DEVICE_DATA() macro to fully describe device ID entry · b72ae8ca
      Andy Shevchenko 提交于
      There are a lot of examples in the kernel where PCI_VDEVICE() is used and
      still looks not so convenient due to additional driver_data field attached.
      
      Introduce PCI_DEVICE_DATA() macro to fully describe device ID entry in
      shortest possible form. For example,
      
        before:
      
          { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MRFLD),
            (kernel_ulong_t) &dwc3_pci_mrfld_properties, },
      
        after:
      
          { PCI_DEVICE_DATA(INTEL, MRFLD, &dwc3_pci_mrfld_properties) },
      
      Drivers can be converted later on in independent way.
      
      While here, remove the unused macro with the same name from Ralink wireless
      driver.
      Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: Kalle Valo <kvalo@codeaurora.org>	# for rt2x00
      b72ae8ca
  7. 10 8月, 2018 2 次提交
  8. 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
  9. 20 7月, 2018 6 次提交
  10. 19 7月, 2018 1 次提交
    • S
      PCI: OF: Fix I/O space page leak · a5fb9fb0
      Sergei Shtylyov 提交于
      When testing the R-Car PCIe driver on the Condor board, if the PCIe PHY
      driver was left disabled, the kernel crashed with this BUG:
      
        kernel BUG at lib/ioremap.c:72!
        Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
        Modules linked in:
        CPU: 0 PID: 39 Comm: kworker/0:1 Not tainted 4.17.0-dirty #1092
        Hardware name: Renesas Condor board based on r8a77980 (DT)
        Workqueue: events deferred_probe_work_func
        pstate: 80000005 (Nzcv daif -PAN -UAO)
        pc : ioremap_page_range+0x370/0x3c8
        lr : ioremap_page_range+0x40/0x3c8
        sp : ffff000008da39e0
        x29: ffff000008da39e0 x28: 00e8000000000f07
        x27: ffff7dfffee00000 x26: 0140000000000000
        x25: ffff7dfffef00000 x24: 00000000000fe100
        x23: ffff80007b906000 x22: ffff000008ab8000
        x21: ffff000008bb1d58 x20: ffff7dfffef00000
        x19: ffff800009c30fb8 x18: 0000000000000001
        x17: 00000000000152d0 x16: 00000000014012d0
        x15: 0000000000000000 x14: 0720072007200720
        x13: 0720072007200720 x12: 0720072007200720
        x11: 0720072007300730 x10: 00000000000000ae
        x9 : 0000000000000000 x8 : ffff7dffff000000
        x7 : 0000000000000000 x6 : 0000000000000100
        x5 : 0000000000000000 x4 : 000000007b906000
        x3 : ffff80007c61a880 x2 : ffff7dfffeefffff
        x1 : 0000000040000000 x0 : 00e80000fe100f07
        Process kworker/0:1 (pid: 39, stack limit = 0x        (ptrval))
        Call trace:
         ioremap_page_range+0x370/0x3c8
         pci_remap_iospace+0x7c/0xac
         pci_parse_request_of_pci_ranges+0x13c/0x190
         rcar_pcie_probe+0x4c/0xb04
         platform_drv_probe+0x50/0xbc
         driver_probe_device+0x21c/0x308
         __device_attach_driver+0x98/0xc8
         bus_for_each_drv+0x54/0x94
         __device_attach+0xc4/0x12c
         device_initial_probe+0x10/0x18
         bus_probe_device+0x90/0x98
         deferred_probe_work_func+0xb0/0x150
         process_one_work+0x12c/0x29c
         worker_thread+0x200/0x3fc
         kthread+0x108/0x134
         ret_from_fork+0x10/0x18
        Code: f9004ba2 54000080 aa0003fb 17ffff48 (d4210000)
      
      It turned out that pci_remap_iospace() wasn't undone when the driver's
      probe failed, and since devm_phy_optional_get() returned -EPROBE_DEFER,
      the probe was retried, finally causing the BUG due to trying to remap
      already remapped pages.
      
      Introduce the devm_pci_remap_iospace() managed API and replace the
      pci_remap_iospace() call with it to fix the bug.
      
      Fixes: dbf9826d ("PCI: generic: Convert to DT resource parsing API")
      Signed-off-by: NSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
      [lorenzo.pieralisi@arm.com: split commit/updated the commit log]
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NLinus Walleij <linus.walleij@linaro.org>
      a5fb9fb0
  11. 06 7月, 2018 1 次提交
  12. 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
  13. 30 6月, 2018 1 次提交
  14. 27 6月, 2018 1 次提交
    • B
      PCI: shpchp: Separate existence of SHPC and permission to use it · b03799b0
      Bjorn Helgaas 提交于
      The shpchp driver registers for all PCI bridge devices.  Its probe method
      should fail if either (1) the bridge doesn't have an SHPC or (2) the OS
      isn't allowed to use it (the platform firmware may be operating the SHPC
      itself).
      
      Separate these two tests into:
      
        - A new shpc_capable() that looks for the SHPC hardware and is applicable
          on all systems (ACPI and non-ACPI), and
      
        - A simplified acpi_get_hp_hw_control_from_firmware() that we call only
          when we already know an SHPC exists and there may be ACPI methods to
          either request permission to use it (_OSC) or transfer control to the
          OS (OSHP).
      
      acpi_get_hp_hw_control_from_firmware() is implemented when CONFIG_ACPI=y,
      but does nothing if the current platform doesn't support ACPI.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      b03799b0
  15. 02 6月, 2018 3 次提交
  16. 26 5月, 2018 1 次提交
    • B
      PCI: Remove unused pcie_get_minimum_link() · e5b1db01
      Bjorn Helgaas 提交于
      In some cases pcie_get_minimum_link() returned misleading information
      because it found the slowest link and the narrowest link without
      considering the total bandwidth of the link.
      
      For example, consider a path with these two links:
      
        - 16.0 GT/s  x1 link  (16.0 * 10^9 * 128 / 130) *  1 / 8 = 1969 MB/s
        -  2.5 GT/s x16 link  ( 2.5 * 10^9 *   8 /  10) * 16 / 8 = 4000 MB/s
      
      The available bandwidth of the path is limited by the 16 GT/s link to about
      1969 MB/s, but pcie_get_minimum_link() returned 2.5 GT/s x1, which
      corresponds to only 250 MB/s.
      
      Callers should use pcie_print_link_status() instead, or
      pcie_bandwidth_available() if they need more detailed information.
      
      Remove pcie_get_minimum_link() since there are no callers left.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      e5b1db01
  17. 18 5月, 2018 1 次提交
  18. 16 5月, 2018 1 次提交