1. 05 3月, 2018 2 次提交
  2. 28 2月, 2018 3 次提交
  3. 22 2月, 2018 1 次提交
  4. 27 1月, 2018 1 次提交
  5. 24 1月, 2018 1 次提交
    • J
      PCI: Add pci_enable_atomic_ops_to_root() · 430a2368
      Jay Cornwall 提交于
      The Atomic Operations feature (PCIe r4.0, sec 6.15) allows atomic
      transctions to be requested by, routed through and completed by PCIe
      components. Routing and completion do not require software support.
      Component support for each is detectable via the DEVCAP2 register.
      
      A Requester may use AtomicOps only if its PCI_EXP_DEVCTL2_ATOMIC_REQ is
      set. This should be set only if the Completer and all intermediate routing
      elements support AtomicOps.
      
      A concrete example is the AMD Fiji-class GPU (which is capable of making
      AtomicOp requests), below a PLX 8747 switch (advertising AtomicOp routing)
      with a Haswell host bridge (advertising AtomicOp completion support).
      
      Add pci_enable_atomic_ops_to_root() for per-device control over AtomicOp
      requests. This checks to be sure the Root Port supports completion of the
      desired AtomicOp sizes and the path to the Root Port supports routing the
      AtomicOps.
      Signed-off-by: NJay Cornwall <Jay.Cornwall@amd.com>
      Signed-off-by: NFelix Kuehling <Felix.Kuehling@amd.com>
      [bhelgaas: changelog, comments, whitespace]
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      430a2368
  6. 19 1月, 2018 1 次提交
  7. 14 12月, 2017 1 次提交
  8. 09 11月, 2017 1 次提交
  9. 06 11月, 2017 1 次提交
  10. 26 10月, 2017 1 次提交
    • B
      PCI: Document reset method return values · 832c418a
      Bjorn Helgaas 提交于
      The pci_reset_function() path may try several different reset methods:
      device-specific resets, PCIe Function Level Resets, PCI Advanced Features
      Function Level Reset, etc.
      
      Add a comment about what the return values from these methods mean.  If one
      of the methods fails, in some cases we want to continue and try the next
      one in the list, but sometimes we want to stop trying.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      832c418a
  11. 25 10月, 2017 1 次提交
  12. 12 10月, 2017 2 次提交
  13. 06 10月, 2017 1 次提交
  14. 15 9月, 2017 1 次提交
    • B
      Revert "PCI: Avoid race while enabling upstream bridges" · 0f50a49e
      Bjorn Helgaas 提交于
      This reverts commit 40f11adc.
      
      Jens found that iwlwifi firmware loading failed on a Lenovo X1 Carbon,
      gen4:
      
        iwlwifi 0000:04:00.0: Direct firmware load for iwlwifi-8000C-34.ucode failed with error -2
        iwlwifi 0000:04:00.0: Direct firmware load for iwlwifi-8000C-33.ucode failed with error -2
        iwlwifi 0000:04:00.0: Direct firmware load for iwlwifi-8000C-32.ucode failed with error -2
        iwlwifi 0000:04:00.0: loaded firmware version 31.532993.0 op_mode iwlmvm
        iwlwifi 0000:04:00.0: Detected Intel(R) Dual Band Wireless AC 8260, REV=0x208
        ...
        iwlwifi 0000:04:00.0: Failed to load firmware chunk!
        iwlwifi 0000:04:00.0: Could not load the [0] uCode section
        iwlwifi 0000:04:00.0: Failed to start INIT ucode: -110
        iwlwifi 0000:04:00.0: Failed to run INIT ucode: -110
      
      He bisected it to 40f11adc ("PCI: Avoid race while enabling upstream
      bridges").  Revert that commit to fix the regression.
      
      Link: http://lkml.kernel.org/r/4bcbcbc1-7c79-09f0-5071-bc2f53bf6574@kernel.dk
      Fixes: 40f11adc ("PCI: Avoid race while enabling upstream bridges")
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      CC: Srinath Mannam <srinath.mannam@broadcom.com>
      CC: Jens Axboe <axboe@kernel.dk>
      CC: Luca Coelho <luca@coelho.fi>
      CC: Johannes Berg <johannes@sipsolutions.net>
      CC: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
      0f50a49e
  15. 30 8月, 2017 1 次提交
    • S
      PCI: Wait up to 60 seconds for device to become ready after FLR · 821cdad5
      Sinan Kaya 提交于
      Sporadic reset issues have been observed with an Intel 750 NVMe drive while
      assigning the physical function to the guest machine.  The sequence of
      events observed is as follows:
      
        - perform a Function Level Reset (FLR)
        - sleep up to 1000ms total
        - read ~0 from PCI_COMMAND (CRS completion for config read)
        - warn that the device didn't return from FLR
        - touch the device before it's ready
        - device drops config writes when we restore register settings (there's
          no mechanism for software to learn about CRS completions for writes)
        - incomplete register restore leaves device in inconsistent state
        - device probe fails because device is in inconsistent state
      
      After reset, an endpoint may respond to config requests with Configuration
      Request Retry Status (CRS) to indicate that it is not ready to accept new
      requests. See PCIe r3.1, sec 2.3.1 and 6.6.2.
      
      Increase the timeout value from 1 second to 60 seconds to cover the period
      where device responds with CRS and also report polling progress.
      Signed-off-by: NSinan Kaya <okaya@codeaurora.org>
      [bhelgaas: include the mandatory 100ms in the delays we print]
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      821cdad5
  16. 25 8月, 2017 1 次提交
  17. 19 8月, 2017 2 次提交
    • S
      PCI: Avoid race while enabling upstream bridges · 40f11adc
      Srinath Mannam 提交于
      When we enable a device, we first enable any upstream bridges.  If a bridge
      has multiple downstream devices and we enable them simultaneously, the race
      to enable the upstream bridge may cause problems.  Consider this hierarchy:
      
        bridge A --+-- device B
                   +-- device C
      
      If drivers for B and C call pci_enable_device() simultaneously, both will
      attempt to enable A, which involves setting PCI_COMMAND_MASTER via
      pci_set_master() and PCI_COMMAND_MEMORY via pci_enable_resources().
      
      In the following sequence, B's update to set A's PCI_COMMAND_MEMORY is
      lost, and neither B nor C will work correctly:
      
            B                                C
        pci_set_master(A)
          cmd = read(A, PCI_COMMAND)
          cmd |= PCI_COMMAND_MASTER
                                         pci_set_master(A)
                                           cmd = read(A, PCI_COMMAND)
                                           cmd |= PCI_COMMAND_MASTER
          write(A, PCI_COMMAND, cmd)
        pci_enable_device(A)
          pci_enable_resources(A)
            cmd = read(A, PCI_COMMAND)
            cmd |= PCI_COMMAND_MEMORY
            write(A, PCI_COMMAND, cmd)
                                           write(A, PCI_COMMAND, cmd)
      
      Avoid this race by holding a new pci_bridge_mutex while enabling a bridge.
      This ensures that both PCI_COMMAND_MASTER and PCI_COMMAND_MEMORY will be
      updated before another thread can start enabling the bridge.
      
      Note that although pci_enable_bridge() is recursive, it enables any
      upstream bridges *before* acquiring the mutex.  When it acquires the mutex
      and calls pci_set_master() and pci_enable_device(), any upstream bridges
      have already been enabled so pci_enable_device() will not deadlock by
      calling pci_enable_bridge() again.
      Signed-off-by: NSrinath Mannam <srinath.mannam@broadcom.com>
      [bhelgaas: changelog, comment]
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      40f11adc
    • T
      PCI: Allow PCI express root ports to find themselves · b6f6d56c
      Thierry Reding 提交于
      If the pci_find_pcie_root_port() function is called on a root port
      itself, return the root port rather than NULL.
      
      This effectively reverts commit 0e405232 ("PCI: fix oops when
      try to find Root Port for a PCI device") which added an extra check
      that would now be redundant.
      
      Fixes: a99b646a ("PCI: Disable PCIe Relaxed Ordering if unsupported")
      Fixes: c56d4450 ("PCI: Turn off Request Attributes to avoid Chelsio T5 Completion erratum")
      Signed-off-by: NThierry Reding <treding@nvidia.com>
      Acked-by: NBjorn Helgaas <bhelgaas@google.com>
      Tested-by: NShawn Lin <shawn.lin@rock-chips.com>
      Tested-by: NMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b6f6d56c
  18. 16 8月, 2017 1 次提交
    • D
      PCI: fix oops when try to find Root Port for a PCI device · 0e405232
      dingtianhong 提交于
      Eric report a oops when booting the system after applying
      the commit a99b646a ("PCI: Disable PCIe Relaxed..."):
      
      [    4.241029] BUG: unable to handle kernel NULL pointer dereference at 0000000000000050
      [    4.247001] IP: pci_find_pcie_root_port+0x62/0x80
      [    4.253011] PGD 0
      [    4.253011] P4D 0
      [    4.253011]
      [    4.258013] Oops: 0000 [#1] SMP DEBUG_PAGEALLOC
      [    4.262015] Modules linked in:
      [    4.265005] CPU: 31 PID: 1 Comm: swapper/0 Not tainted 4.13.0-dbx-DEV #316
      [    4.271002] Hardware name: Intel RML,PCH/Iota_QC_19, BIOS 2.40.0 06/22/2016
      [    4.279002] task: ffffa2ee38cfa040 task.stack: ffffa51ec0004000
      [    4.285001] RIP: 0010:pci_find_pcie_root_port+0x62/0x80
      [    4.290012] RSP: 0000:ffffa51ec0007ab8 EFLAGS: 00010246
      [    4.295003] RAX: 0000000000000000 RBX: ffffa2ee36bae000 RCX: 0000000000000006
      [    4.303002] RDX: 000000000000081c RSI: ffffa2ee38cfa8c8 RDI: ffffa2ee36bae000
      [    4.310013] RBP: ffffa51ec0007b58 R08: 0000000000000001 R09: 0000000000000000
      [    4.317001] R10: 0000000000000000 R11: 0000000000000000 R12: ffffa51ec0007ad0
      [    4.324005] R13: ffffa2ee36bae098 R14: 0000000000000002 R15: ffffa2ee37204818
      [    4.331002] FS:  0000000000000000(0000) GS:ffffa2ee3fcc0000(0000) knlGS:0000000000000000
      [    4.339002] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [    4.345001] CR2: 0000000000000050 CR3: 000000401000f000 CR4: 00000000001406e0
      [    4.351002] Call Trace:
      [    4.354012]  ? pci_configure_device+0x19f/0x570
      [    4.359002]  ? pci_conf1_read+0xb8/0xf0
      [    4.363002]  ? raw_pci_read+0x23/0x40
      [    4.366011]  ? pci_read+0x2c/0x30
      [    4.370014]  ? pci_read_config_word+0x67/0x70
      [    4.374012]  pci_device_add+0x28/0x230
      [    4.378012]  ? pci_vpd_f0_read+0x50/0x80
      [    4.382014]  pci_scan_single_device+0x96/0xc0
      [    4.386012]  pci_scan_slot+0x79/0xf0
      [    4.389001]  pci_scan_child_bus+0x31/0x180
      [    4.394014]  acpi_pci_root_create+0x1c6/0x240
      [    4.398013]  pci_acpi_scan_root+0x15f/0x1b0
      [    4.402012]  acpi_pci_root_add+0x2e6/0x400
      [    4.406012]  ? acpi_evaluate_integer+0x37/0x60
      [    4.411002]  acpi_bus_attach+0xdf/0x200
      [    4.415002]  acpi_bus_attach+0x6a/0x200
      [    4.418014]  acpi_bus_attach+0x6a/0x200
      [    4.422013]  acpi_bus_scan+0x38/0x70
      [    4.426011]  acpi_scan_init+0x10c/0x271
      [    4.429001]  acpi_init+0x2fa/0x348
      [    4.433004]  ? acpi_sleep_proc_init+0x2d/0x2d
      [    4.437001]  do_one_initcall+0x43/0x169
      [    4.441001]  kernel_init_freeable+0x1d0/0x258
      [    4.445003]  ? rest_init+0xe0/0xe0
      [    4.449001]  kernel_init+0xe/0x150
      
      ====================== cut here =============================
      
      It looks like the pci_find_pcie_root_port() was trying to
      find the Root Port for the PCI device which is the Root
      Port already, it will return NULL and trigger the problem,
      so check the highest_pcie_bridge to fix thie problem.
      
      Fixes: a99b646a ("PCI: Disable PCIe Relaxed Ordering if unsupported")
      Fixes: c56d4450 ("PCI: Turn off Request Attributes to avoid Chelsio T5 Completion erratum")
      Reported-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NDing Tianhong <dingtianhong@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0e405232
  19. 04 8月, 2017 1 次提交
  20. 02 8月, 2017 1 次提交
    • M
      PCI: Add pci_reset_function_locked() · a477b9cd
      Marc Zyngier 提交于
      The implementation of PCI workarounds may require that the device is reset
      from its probe function.  This implies that the PCI device lock is already
      held, and makes calling pci_reset_function() impossible (since it will
      itself try to take that lock).
      
      Add pci_reset_function_locked(), which is the equivalent of
      pci_reset_function(), except that it requires the PCI device lock to be
      already held by the caller.
      Tested-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      [bhelgaas: folded in fix for conflict with 52354b9d ("PCI: Remove
      __pci_dev_reset() and pci_dev_reset()")]
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Cc: stable@vger.kernel.org	# 4.11: 52354b9d: PCI: Remove __pci_dev_reset() and pci_dev_reset()
      Cc: stable@vger.kernel.org	# 4.11
      a477b9cd
  21. 01 8月, 2017 1 次提交
  22. 13 7月, 2017 1 次提交
    • R
      PCI / PM: Restore PME Enable after config space restoration · 0ce3fcaf
      Rafael J. Wysocki 提交于
      Commit dc15e71e (PCI / PM: Restore PME Enable if skipping wakeup
      setup) introduced a mechanism by which the PME Enable bit can be
      restored by pci_enable_wake() if dev->wakeup_prepared is set in
      case it has been overwritten by PCI config space restoration.
      
      However, that commit overlooked the fact that on some systems (Dell
      XPS13 9360 in particular) the AML handling wakeup events checks PME
      Status and PME Enable and it won't trigger a Notify() for devices
      where those bits are not set while it is running.
      
      That happens during resume from suspend-to-idle when pci_restore_state()
      invoked by pci_pm_default_resume_early() clears PME Enable before the
      wakeup events are processed by AML, effectively causing those wakeup
      events to be ignored.
      
      Fix this issue by restoring the PME Enable configuration right after
      pci_restore_state() has been called instead of doing that in
      pci_enable_wake().
      
      Fixes: dc15e71e (PCI / PM: Restore PME Enable if skipping wakeup setup)
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NBjorn Helgaas <bhelgaas@google.com>
      0ce3fcaf
  23. 03 7月, 2017 2 次提交
  24. 01 7月, 2017 1 次提交
  25. 28 6月, 2017 2 次提交
  26. 17 6月, 2017 1 次提交
  27. 15 6月, 2017 2 次提交
  28. 31 5月, 2017 1 次提交
  29. 24 5月, 2017 1 次提交
  30. 18 5月, 2017 1 次提交
    • A
      PCI: Do not disregard parent resources starting at 0x0 · 31342330
      Ard Biesheuvel 提交于
      Commit f44116ae ("PCI: Remove pci_find_parent_resource() use for
      allocation") updated the logic that iterates over all bus resources and
      compares them to a given resource, in order to decide whether one is the
      parent of the latter.
      
      This change inadvertently causes pci_find_parent_resource() to disregard
      resources starting at address 0x0, resulting in an error such as the one
      below on ARM systems whose I/O window starts at 0x0.
      
        pci_bus 0000:00: root bus resource [mem 0x10000000-0x3efeffff window]
        pci_bus 0000:00: root bus resource [io  0x0000-0xffff window]
        pci_bus 0000:00: root bus resource [mem 0x8000000000-0xffffffffff window]
        pci_bus 0000:00: root bus resource [bus 00-0f]
        pci 0000:00:01.0: PCI bridge to [bus 01]
        pci 0000:00:02.0: PCI bridge to [bus 02]
        pci 0000:00:03.0: PCI bridge to [bus 03]
        pci 0000:00:03.0: can't claim BAR 13 [io  0x0000-0x0fff]: no compatible bridge window
        pci 0000:03:01.0: can't claim BAR 0 [io  0x0000-0x001f]: no compatible bridge window
      
      While this never happens on x86, it is perfectly legal in general for a PCI
      MMIO or IO window to start at address 0x0, and it was supported in the code
      before commit f44116ae.
      
      Drop the test for res->start != 0; resource_contains() already checks
      whether [start, end) completely covers the resource, and so it should be
      redundant.
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      31342330
  31. 25 4月, 2017 1 次提交
    • L
      PCI: Implement devm_pci_remap_cfgspace() · 490cb6dd
      Lorenzo Pieralisi 提交于
      The introduction of the pci_remap_cfgspace() interface allows PCI host
      controller drivers to map PCI config space through a dedicated kernel
      interface. Current PCI host controller drivers use the devm_ioremap_*()
      devres interfaces to map PCI configuration space regions so in order to
      update them to the new pci_remap_cfgspace() mapping interface a new set of
      devres interfaces should be implemented so that PCI host controller drivers
      can make use of them.
      
      Introduce two new functions in the PCI kernel layer and Devres
      documentation:
      
      - devm_pci_remap_cfgspace()
      - devm_pci_remap_cfg_resource()
      
      so that PCI host controller drivers can make use of them to map PCI
      configuration space regions.
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      490cb6dd
  32. 21 4月, 2017 1 次提交