1. 02 Jul, 2017 8 commits
    • Bjorn Helgaas's avatar
      Merge branch 'pci/switchtec' into next · c781f85b
      Bjorn Helgaas authored
      * pci/switchtec:
        switchtec: Add device IDs for additional Switchtec products
        switchtec: Add "running" status flag to fw partition info ioctl
      c781f85b
    • Bjorn Helgaas's avatar
      Merge branch 'pci/resource' into next · 8cd93850
      Bjorn Helgaas authored
      * pci/resource:
        PCI: Work around poweroff & suspend-to-RAM issue on Macbook Pro 11
        PCI: Do not disregard parent resources starting at 0x0
      
      Conflicts:
      arch/x86/pci/fixup.c
      8cd93850
    • Bjorn Helgaas's avatar
      Merge branch 'pci/portdrv' into next · 74da4a01
      Bjorn Helgaas authored
      * pci/portdrv:
        PCI/portdrv: Allocate MSI/MSI-X vector for Downstream Port Containment
        PCI/portdrv: Support multiple interrupts for MSI as well as MSI-X
      74da4a01
    • Bjorn Helgaas's avatar
      Merge branch 'pci/pm' into next · 2cf816a9
      Bjorn Helgaas authored
      * pci/pm:
        PCI/PM: Avoid using device_may_wakeup() for runtime PM
        x86/PCI: Avoid AMD SB7xx EHCI USB wakeup defect
        PCI/PM: Restore the status of PCI devices across hibernation
        drm/radeon: make MacBook Pro d3_delay quirk more generic
        drm/amdgpu: remove unnecessary save/restore of pdev->d3_delay
        PCI/PM: Add needs_resume flag to avoid suspend complete optimization
        PCI: imx6: Fix config read timeout handling
        switchtec: Fix minor bug with partition ID register
        switchtec: Use new cdev_device_add() helper function
        PCI: endpoint: Make PCI_ENDPOINT depend on HAS_DMA
      2cf816a9
    • Bjorn Helgaas's avatar
      Merge branch 'pci/msi' into next · 6a1c1d55
      Bjorn Helgaas authored
      * pci/msi:
        PCI/MSI: Ignore affinity if pre/post vector count is more than min_vecs
      6a1c1d55
    • Bjorn Helgaas's avatar
      Merge branch 'pci/misc' into next · 91bbec65
      Bjorn Helgaas authored
      * pci/misc:
        x86/PCI: Simplify Dell DMI B1 quirk
        PCI: Add domain number check to find_smbios_instance_string()
        x86/PCI: Fix whitespace in set_bios_x() printk
        PCI: Correct PCI_STD_RESOURCE_END usage
        efi/fb: Correct PCI_STD_RESOURCE_END usage
        MIPS: PCI: Remove unused busn_offset
        MIPS: Loongson: Remove unused PCI_BAR_COUNT definition
      91bbec65
    • Bjorn Helgaas's avatar
      Merge branch 'pci/enumeration' into next · f9bfeccd
      Bjorn Helgaas authored
      * pci/enumeration:
        PCI: Enable ECRC only if device supports it
        PCI: Add sysfs max_link_speed/width, current_link_speed/width, etc
        PCI: Test INTx masking during enumeration, not at run-time
      f9bfeccd
    • Bjorn Helgaas's avatar
      Merge branch 'pci/dpc' into next · 397ee434
      Bjorn Helgaas authored
      * pci/dpc:
        PCI/DPC: Fix control register setting
        PCI/DPC: Skip DPC event if device is not present
      397ee434
  2. 30 Jun, 2017 5 commits
    • Rafael J. Wysocki's avatar
      PCI/PM: Avoid using device_may_wakeup() for runtime PM · 666ff6f8
      Rafael J. Wysocki authored
      pci_target_state() calls device_may_wakeup() which checks whether or not
      the device may wake up the system from sleep states, but pci_target_state()
      is used for runtime PM too.
      
      Since runtime PM is expected to always enable remote wakeup if possible,
      modify pci_target_state() to take additional argument indicating whether or
      not it should look for a state from which the device can signal wakeup and
      pass either the return value of device_can_wakeup(), or "false" (if the
      device itself is not wakeup-capable) to it from the code related to runtime
      PM.
      
      While at it, fix the comment in pci_dev_run_wake() which is not about sleep
      states.
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      666ff6f8
    • Kai-Heng Feng's avatar
      x86/PCI: Avoid AMD SB7xx EHCI USB wakeup defect · 0bf3730b
      Kai-Heng Feng authored
      On an AMD Carrizo laptop, when EHCI runtime PM is enabled, EHCI ports do
      not assert PME# for device plug/unplug events while in D3.
      
      As Alan Stern points out [1], the PME signal is not enabled when controller
      is in D3, therefore it's not being woken up when new devices get plugged
      in.
      
      Testing shows PME signal works when the EHCI power state is D2.
      
      Clear the PCI_PM_CAP_PME_D3 and PCI_PM_CAP_PME_D3cold bits in
      dev->pme_support to indicate the device will not assert PME# from those
      states.
      
      [1] http://lkml.kernel.org/r/Pine.LNX.4.44L0.1706121010010.2092-100000@iolanthe.rowland.org
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=196091
      Link: https://support.amd.com/TechDocs/46837.pdf (Section 23)
      Link: https://support.amd.com/TechDocs/42413.pdf (Appendix A2)
      Signed-off-by: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
      [bhelgaas: changelog, add parens in quirk]
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      0bf3730b
    • Chen Yu's avatar
      PCI/PM: Restore the status of PCI devices across hibernation · e60514bd
      Chen Yu authored
      Currently we saw a lot of "No irq handler" errors during hibernation, which
      caused the system hang finally:
      
        ata4.00: qc timeout (cmd 0xec)
        ata4.00: failed to IDENTIFY (I/O error, err_mask=0x4)
        ata4.00: revalidation failed (errno=-5)
        ata4: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
        do_IRQ: 31.151 No irq handler for vector
      
      According to above logs, there is an interrupt triggered and it is
      dispatched to CPU31 with a vector number 151, but there is no handler for
      it, thus this IRQ will not get acked and will cause an IRQ flood which
      kills the system.  To be more specific, the 31.151 is an interrupt from the
      AHCI host controller.
      
      After some investigation, the reason why this issue is triggered is because
      the thaw_noirq() function does not restore the MSI/MSI-X settings across
      hibernation.
      
      The scenario is illustrated below:
      
        1. Before hibernation, IRQ 34 is the handler for the AHCI device, which
           is bound to CPU31.
      
        2. Hibernation starts, the AHCI device is put into low power state.
      
        3. All the nonboot CPUs are put offline, so IRQ 34 has to be migrated to
           the last alive one - CPU0.
      
        4. After the snapshot has been created, all the nonboot CPUs are brought
           up again; IRQ 34 remains bound to CPU0.
      
        5. AHCI devices are put into D0.
      
        6. The snapshot is written to the disk.
      
      The issue is triggered in step 6.  The AHCI interrupt should be delivered
      to CPU0, however it is delivered to the original CPU31 instead, which
      causes the "No irq handler" issue.
      
      Ying Huang has provided a clue that, in step 3 it is possible that writing
      to the register might not take effect as the PCI devices have been
      suspended.
      
      In step 3, the IRQ 34 affinity should be modified from CPU31 to CPU0, but
      in fact it is not.  In __pci_write_msi_msg(), if the device is already in
      low power state, the low level MSI message entry will not be updated but
      cached.  During the device restore process after a normal suspend/resume,
      pci_restore_msi_state() writes the cached MSI back to the hardware.
      
      But this is not the case for hibernation.  pci_restore_msi_state() is not
      currently called in pci_pm_thaw_noirq(), although pci_save_state() has
      saved the necessary PCI cached information in pci_pm_freeze_noirq().
      
      Restore the PCI status for the device during hibernation.  Otherwise the
      status might be lost across hibernation (for example, settings for MSI,
      MSI-X, ATS, ACS, IOV, etc.), which might cause problems during hibernation.
      Suggested-by: default avatarYing Huang <ying.huang@intel.com>
      Suggested-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarChen Yu <yu.c.chen@intel.com>
      [bhelgaas: changelog]
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Cc: stable@vger.kernel.org
      Cc: Len Brown <len.brown@intel.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Rui Zhang <rui.zhang@intel.com>
      Cc: Ying Huang <ying.huang@intel.com>
      e60514bd
    • Bjorn Helgaas's avatar
      drm/radeon: make MacBook Pro d3_delay quirk more generic · 5938628c
      Bjorn Helgaas authored
      The PCI Power Management Spec, r1.2, sec 5.6.1, requires a 10 millisecond
      delay when powering on a device, i.e., transitioning from state D3hot to
      D0.
      
      Apparently some devices require more time, and d1f9809e ("drm/radeon:
      add quirk for d3 delay during switcheroo poweron for apple macbooks") added
      an additional delay for the Radeon device in a MacBook Pro.  4807c5a8
      ("drm/radeon: add a PX quirk list") made the affected device more explicit.
      
      Add a generic PCI quirk to increase the d3_delay.  This means we will use
      the additional delay for *all* wakeups from D3, not just those initiated by
      radeon_switcheroo_set_state().
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: default avatarAndreas Boll <andreas.boll.dev@gmail.com>
      Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      CC: Maarten Lankhorst <maarten.lankhorst@canonical.com>
      5938628c
    • Bjorn Helgaas's avatar
      drm/amdgpu: remove unnecessary save/restore of pdev->d3_delay · ee76380c
      Bjorn Helgaas authored
      Remove unnecessary save/restore of pdev->d3_delay.
      
      The only assignments to pdev->d3_delay are in radeon_switcheroo_set_state()
      and some quirks, none of which should be relevant in the
      amdgpu_switcheroo_set_state() path.
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: default avatarAndreas Boll <andreas.boll.dev@gmail.com>
      Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      ee76380c
  3. 28 Jun, 2017 2 commits
    • Bjorn Helgaas's avatar
      PCI: Work around poweroff & suspend-to-RAM issue on Macbook Pro 11 · 13cfc732
      Bjorn Helgaas authored
      Neither soft poweroff (transition to ACPI power state S5) nor
      suspend-to-RAM (transition to state S3) works on the Macbook Pro 11,4 and
      11,5.
      
      The problem is related to the [mem 0x7fa00000-0x7fbfffff] space.  When we
      use that space, e.g., by assigning it to the 00:1c.0 Root Port, the ACPI
      Power Management 1 Control Register (PM1_CNT) at [io 0x1804] doesn't work
      anymore.
      
      Linux does a soft poweroff (transition to S5) by writing to PM1_CNT.  The
      theory about why this doesn't work is:
      
        - The write to PM1_CNT causes an SMI
        - The BIOS SMI handler depends on something in
          [mem 0x7fa00000-0x7fbfffff]
        - When Linux assigns [mem 0x7fa00000-0x7fbfffff] to the 00:1c.0 Port, it
          covers up whatever the SMI handler uses, so the SMI handler no longer
          works correctly
      
      Reserve the [mem 0x7fa00000-0x7fbfffff] space so we don't assign it to
      anything.
      
      This is voodoo programming, since we don't know what the real conflict is,
      but we've failed to find the root cause.
      
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=103211
      Tested-by: thejoe@gmail.com
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Cc: stable@vger.kernel.org
      Cc: Rafael J. Wysocki <rafael@kernel.org>
      Cc: Lukas Wunner <lukas@wunner.de>
      Cc: Chen Yu <yu.c.chen@intel.com>
      13cfc732
    • Bjorn Helgaas's avatar
      PCI: Enable ECRC only if device supports it · 675734ba
      Bjorn Helgaas authored
      John reported that an Intel QuickAssist crypto accelerator didn't work in a
      Dell PowerEdge R730.  The problem seems to be that we enabled ECRC when the
      device doesn't support it:
      
        85:00.0 Co-processor [0b40]: Intel Corporation DH895XCC Series QAT [8086:0435]
          Capabilities: [100 v1] Advanced Error Reporting
            AERCap: First Error Pointer: 00, GenCap- CGenEn+ ChkCap- ChkEn+
      
      1302fcf0 ("PCI: Configure *all* devices, not just hot-added ones")
      exposed the problem because it applies settings from the _HPX method to all
      devices, not just hot-added ones.  The R730 supplies an _HPX method that
      allows the kernel to enable ECRC.
      
      Only enable ECRC if the device advertises support for it.
      
      Link: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1571798
      Fixes: 1302fcf0 ("PCI: Configure *all* devices, not just hot-added ones")
      Reported-by: default avatarJohn Mazzie <john_mazzie@dell.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      675734ba
  4. 27 Jun, 2017 2 commits
  5. 19 Jun, 2017 1 commit
  6. 17 Jun, 2017 1 commit
  7. 16 Jun, 2017 2 commits
  8. 15 Jun, 2017 1 commit
  9. 13 Jun, 2017 4 commits
  10. 23 May, 2017 1 commit
  11. 22 May, 2017 7 commits
  12. 18 May, 2017 2 commits
  13. 17 May, 2017 1 commit
    • Ard Biesheuvel's avatar
      PCI: Do not disregard parent resources starting at 0x0 · 31342330
      Ard Biesheuvel authored
      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: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      31342330
  14. 13 May, 2017 3 commits