1. May 25, 2022
    • Bjorn Helgaas's avatar
      Merge branch 'remotes/lorenzo/pci/imx6' · b8dc3446
      Bjorn Helgaas authored
      - Fix PERST# start-up sequence (Francesco Dolcini)
      
      * remotes/lorenzo/pci/imx6:
        PCI: imx6: Fix PERST# start-up sequence
      b8dc3446
    • Bjorn Helgaas's avatar
      Merge branch 'remotes/lorenzo/pci/dwc' · 39348d2e
      Bjorn Helgaas authored
      - Return error instead of success if DMA mapping of MSI area fails (Jiantao
        Zhang)
      
      - Drop tegra194 MSI register save/restore, which is unnecessary since the
        DWC core does it (Jisheng Zhang)
      
      - Factor out qcom enable/disable resources code (Dmitry Baryshkov)
      
      - Remove "snps,dw-pcie" from rockchip-dwc DT "compatible" property because
        it's not fully compatible with rockchip (Peter Geis)
      
      - Reset rockchip-dwc controller at probe (Peter Geis)
      
      - Add rockchip-dwc INTx support (Peter Geis)
      
      * remotes/lorenzo/pci/dwc:
        PCI: rockchip-dwc: Add legacy interrupt support
        PCI: rockchip-dwc: Reset core at driver probe
        dt-bindings: PCI: Remove fallback from Rockchip DesignWare binding
        PCI: qcom-ep: Move enable/disable resources code to common functions
        PCI: tegra194: Remove unnecessary MSI enable reg save and restore
        PCI: dwc: Fix setting error return on MSI DMA mapping failure
      39348d2e
    • Bjorn Helgaas's avatar
      Merge branch 'remotes/lorenzo/pci/cadence' · 086ab943
      Bjorn Helgaas authored
      - Fix bitmap size when searching for free outbound region (Dan Carpenter)
      
      - Do device-specific setup to allow PTM Responder to be enabled (Christian
        Gmeiner)
      
      - Don't advertise FLR in Device Capabilities register because the
        controller incorrectly resets Margining Lane Status and Margining Lane
        Control on FLR (Parshuram Thombare)
      
      * remotes/lorenzo/pci/cadence:
        PCI: cadence: Clear FLR in device capabilities register
        PCI: cadence: Allow PTM Responder to be enabled
        PCI: cadence: Fix find_first_zero_bit() limit
      086ab943
    • Bjorn Helgaas's avatar
      Merge branch 'pci/virtualization' · 8d8b2669
      Bjorn Helgaas authored
      - Avoid pci_dev_lock() AB/BA deadlock with sriov_numvfs_store() (Yicong
        Yang, Jay Zhou)
      
      * pci/virtualization:
        PCI: Avoid pci_dev_lock() AB/BA deadlock with sriov_numvfs_store()
      8d8b2669
    • Bjorn Helgaas's avatar
      Merge branch 'pci/resource' · f1bde278
      Bjorn Helgaas authored
      - Clip only host bridge windows for E820 regions and log what is clipped
        (Bjorn Helgaas)
      
      - Add kernel cmdline options to use/ignore E820 reserved regions (Hans de
        Goede)
      
      - Disable E820 reserved region clipping for IdeaPads, Yoga, Yoga Slip, Acer
        Spin 5, Clevo Barebone systems where clipping leaves no usable address
        space for touchpads, Thunderbolt devices, etc (Hans de Goede)
      
      - Disable E820 reserved region clipping by default starting in 2023 (Hans
        de Goede)
      
      * pci/resource:
        x86/PCI: Disable E820 reserved region clipping starting in 2023
        x86/PCI: Disable E820 reserved region clipping via quirks
        x86/PCI: Add kernel cmdline options to use/ignore E820 reserved regions
        x86/PCI: Clip only host bridge windows for E820 regions
        x86: Log resource clipping for E820 regions
        x86/PCI: Eliminate remove_e820_regions() common subexpressions
      f1bde278
    • Bjorn Helgaas's avatar
      Merge branch 'pci/pm' · 6b5e9bdc
      Bjorn Helgaas authored
      - Define pci_restore_standard_config() only for CONFIG_PM_SLEEP, since it's
        not used otherwise (Krzysztof Kozlowski)
      
      - Power up all devices during runtime resume (Rafael J. Wysocki)
      
      - Resume subordinate bus in bus type callbacks (Rafael J. Wysocki)
      
      - Drop pci_dev runtime_d3cold flag since no uses remain (Rafael J. Wysocki)
      
      - Move power-up to D0 code to pci_power_up() and rename
        pci_raw_set_power_state() to pci_set_low_power_state() (Rafael J.
        Wysocki)
      
      - Set current_state to D3cold if the device is not accessible (Rafael J.
        Wysocki)
      
      - Do not call pci_update_current_state() from pci_power_up() (Rafael J.
        Wysocki)
      
      - Write 0 to PMCSR in pci_power_up() in all cases (Rafael J. Wysocki)
      
      - Split part of pci_power_up() off to pci_set_full_power_state() (Rafael J.
        Wysocki)
      
      - Do not restore BARs if device is not in D0 (Rafael J. Wysocki)
      
      * pci/pm:
        PCI/PM: Replace pci_set_power_state() in pci_pm_thaw_noirq()
        PCI/PM: Rearrange pci_set_power_state()
        PCI/PM: Clean up pci_set_low_power_state()
        PCI/PM: Do not restore BARs if device is not in D0
        PCI/PM: Split pci_power_up()
        PCI/PM: Write 0 to PMCSR in pci_power_up() in all cases
        PCI/PM: Do not call pci_update_current_state() from pci_power_up()
        PCI/PM: Unfold pci_platform_power_transition() in pci_power_up()
        PCI/PM: Set current_state to D3cold if the device is not accessible
        PCI/PM: Relocate pci_set_low_power_state()
        PCI/PM: Split pci_raw_set_power_state()
        PCI/PM: Rearrange pci_update_current_state()
        PCI/PM: Drop the runtime_d3cold device flag
        PCI/PM: Resume subordinate bus in bus type callbacks
        PCI/PM: Power up all devices during runtime resume
        PCI/PM: Define pci_restore_standard_config() only for CONFIG_PM_SLEEP
      6b5e9bdc
    • Bjorn Helgaas's avatar
      Merge branch 'pci/p2pdma' · 4f5bc91c
      Bjorn Helgaas authored
      - Update pci_p2pdma_whitelist[] checking so we accept Skylake-E Root Ports
        even if they're not at devfn 00.0 (Shlomo Pongratz)
      
      * pci/p2pdma:
        PCI/P2PDMA: Whitelist Intel Skylake-E Root Ports at any devfn
      4f5bc91c
    • Bjorn Helgaas's avatar
      Merge branch 'pci/misc' · e840e475
      Bjorn Helgaas authored
      - Change pci_set_dma_mask() documentation references to dma_set_mask()
        (Alex Williamson)
      
      * pci/misc:
        PCI/doc: Update obsolete pci_set_dma_mask() references
      e840e475
    • Bjorn Helgaas's avatar
      Merge branch 'pci/hotplug' · 85ae3970
      Bjorn Helgaas authored
      - Allow D3 only if Root Port can signal and wake from D3 so we don't miss
        hotplug events on AMD Yellow Carp (Mario Limonciello)
      
      - Clean up hotplug include files to enable future powerpc cleanup
        (Christophe Leroy)
      
      * pci/hotplug:
        PCI: hotplug: Clean up include files
        PCI/ACPI: Allow D3 only if Root Port can signal and wake from D3
      85ae3970
    • Bjorn Helgaas's avatar
      Merge branch 'pci/error' · 55fd033b
      Bjorn Helgaas authored
      - Clear AER "multiple errors" bits to avoid race that left them set forever
        (Kuppuswamy Sathyanarayanan)
      
      * pci/error:
        PCI/AER: Clear MULTI_ERR_COR/UNCOR_RCV bits
      55fd033b
    • Bjorn Helgaas's avatar
      Merge branch 'pci/aspm' · ae0d0d18
      Bjorn Helgaas authored
      - Quirk Intel DG2 ASPM L1 acceptable latency to be unlimited.  The device
        advertises that it can only tolerate 1us, which means L1 is rarely if
        ever used (Mika Westerberg)
      
      * pci/aspm:
        PCI/ASPM: Make Intel DG2 L1 acceptable latency unlimited
      ae0d0d18
  2. May 20, 2022
    • Hans de Goede's avatar
      x86/PCI: Disable E820 reserved region clipping starting in 2023 · 0ae084d5
      Hans de Goede authored
      Some firmware includes unusable space (host bridge registers, hidden PCI
      device BARs, etc) in PCI host bridge _CRS.  As far as we know, there's
      nothing in the ACPI, UEFI, or PCI Firmware spec that requires the OS to
      remove E820 reserved regions from _CRS, so this seems like a firmware
      defect.
      
      As a workaround, 4dc2287c ("x86: avoid E820 regions when allocating
      address space") has clipped out the unusable space in the past.  This is
      required for machines like the following:
      
        - Dell Precision T3500 (the original motivator for 4dc2287c); see
          https://bugzilla.kernel.org/show_bug.cgi?id=16228
      
        - Asus C523NA (Coral) Chromebook; see
          https://lore.kernel.org/all/4e9fca2f-0af1-3684-6c97-4c35befd5019@redhat.com/
      
        - Lenovo ThinkPad X1 Gen 2; see:
          https://bugzilla.redhat.com/show_bug.cgi?id=2029207
      
      But other firmware supplies E820 reserved regions that cover entire _CRS
      windows, and clipping throws away the entire window, leaving none for
      hot-added or uninitialized devices.  This clipping breaks a whole range of
      Lenovo IdeaPads, Yogas, Yoga Slims, and notebooks, as well as Acer Spin 5
      and Clevo X170KM-G Barebone machines.
      
      E820 reserved entries that cover a memory-mapped PCI host bridge, including
      its registers and memory/IO windows, are probably *not* a firmware defect.
      Per ACPI v5.4, sec 15.2, the E820 memory map may include:
      
        Address ranges defined for baseboard memory-mapped I/O devices, such as
        APICs, are returned as reserved.
      
      Disable the E820 clipping by default for all post-2022 machines.  We
      already have quirks to disable clipping for pre-2023 machines, and we'll
      likely need quirks to *enable* clipping for post-2022 machines that
      incorrectly include unusable space in _CRS, including Chromebooks and
      Lenovo ThinkPads.
      
      Here's the rationale for doing this.  If we do nothing, and continue
      clipping by default:
      
        - Future systems like the Lenovo IdeaPads, Yogas, etc, Acer Spin, and
          Clevo Barebones will require new quirks to disable clipping.
      
        - The problem here is E820 entries that cover entire _CRS windows that
          should not be clipped out.
      
        - I think these E820 entries are legal per spec, and it would be hard to
          get BIOS vendors to change them.
      
        - We will discover new systems that need clipping disabled piecemeal as
          they are released.
      
        - Future systems like Lenovo X1 Carbon and the Chromebooks (probably
          anything using coreboot) will just work, even though their _CRS is
          incorrect, so we will not notice new ones that rely on the clipping.
      
        - BIOS updates will not require new quirks unless they change the DMI
          model string.
      
      If we add the date check in this commit that disables clipping, e.g., "no
      clipping when date >= 2023":
      
        - Future systems like Lenovo *IIL*, Acer Spin, and Clevo Barebones will
          just work without new quirks.
      
        - Future systems like Lenovo X1 Carbon and the Chromebooks will require
          new quirks to *enable* clipping.
      
        - The problem here is that _CRS contains regions that are not usable by
          PCI devices, and we rely on the E820 kludge to clip them out.
      
        - I think this use of E820 is clearly a firmware bug, so we have a
          fighting chance of getting it changed eventually.
      
        - BIOS updates after the cutoff date *will* require quirks, but only for
          systems like Lenovo X1 Carbon and Chromebooks that we already think
          have broken firmware.
      
      It seems to me like it's better to add quirks for firmware that we think is
      broken than for firmware that seems unusual but correct.
      
      [bhelgaas: comment and commit log]
      Link: https://lore.kernel.org/linux-pci/20220518220754.GA7911@bhelgaas/
      Link: https://lore.kernel.org/r/20220519152150.6135-4-hdegoede@redhat.com
      
      
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Acked-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Cc: Benoit Grégoire <benoitg@coeus.ca>
      Cc: Hui Wang <hui.wang@canonical.com>
      0ae084d5
    • Hans de Goede's avatar
      x86/PCI: Disable E820 reserved region clipping via quirks · d341838d
      Hans de Goede authored
      To avoid unusable space that some firmware includes in PCI host bridge
      _CRS, Linux currently excludes E820 reserved regions from _CRS windows; see
      4dc2287c ("x86: avoid E820 regions when allocating address space").
      
      However, some systems supply E820 reserved regions that cover the entire
      memory window from _CRS, so clipping them out leaves no space for hot-added
      or uninitialized PCI devices.
      
      For example, from a Lenovo IdeaPad 3 15IIL 81WE:
      
        BIOS-e820: [mem 0x4bc50000-0xcfffffff] reserved
        pci_bus 0000:00: root bus resource [mem 0x65400000-0xbfffffff window]
        pci 0000:00:15.0: BAR 0: [mem 0x00000000-0x00000fff 64bit]
        pci 0000:00:15.0: BAR 0: no space for [mem size 0x00001000 64bit]
      
      Add quirks to disable the E820 clipping for machines known to do this.
      
      A single DMI_PRODUCT_VERSION "IIL" quirk matches all the below:
      
        Lenovo IdeaPad 3 14IIL05
        Lenovo IdeaPad 3 15IIL05
        Lenovo IdeaPad 3 17IIL05
        Lenovo IdeaPad 5 14IIL05
        Lenovo IdeaPad 5 15IIL05
        Lenovo IdeaPad Slim 7 14IIL05
        Lenovo IdeaPad Slim 7 15IIL05
        Lenovo IdeaPad S145-15IIL
        Lenovo IdeaPad S340-14IIL
        Lenovo IdeaPad S340-15IIL
        Lenovo IdeaPad C340-15IIL
        Lenovo BS145-15IIL
        Lenovo V14-IIL
        Lenovo V15-IIL
        Lenovo V17-IIL
        Lenovo Yoga C940-14IIL
        Lenovo Yoga S740-14IIL
        Lenovo Yoga Slim 7 14IIL05
        Lenovo Yoga Slim 7 15IIL05
      
      in addition to the following that don't actually need it because they have
      no E820 reserved regions that overlap _CRS windows:
      
        Lenovo IdeaPad Flex 5 14IIL05
        Lenovo IdeaPad Flex 5 15IIL05
        Lenovo ThinkBook 14-IIL
        Lenovo ThinkBook 15-IIL
        Lenovo Yoga S940-14IIL
      
      Other quirks match these:
      
        Acer Spin 5 (SP513-54N)
      
        Clevo X170KM-G Barebone
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=206459 Lenovo Yoga C940-14IIL
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=214259 Clevo X170KM Barebone
      Link: https://bugzilla.redhat.com/show_bug.cgi?id=1868899 Lenovo IdeaPad 3 15IIL05
      Link: https://bugzilla.redhat.com/show_bug.cgi?id=1871793 Lenovo IdeaPad 5 14IIL05
      Link: https://bugs.launchpad.net/bugs/1878279 Lenovo IdeaPad 5 14IIL05
      Link: https://bugs.launchpad.net/bugs/1880172 Lenovo IdeaPad 3 14IIL05
      Link: https://bugs.launchpad.net/bugs/1884232 Acer Spin SP513-54N
      Link: https://bugs.launchpad.net/bugs/1921649 Lenovo IdeaPad S145
      Link: https://bugs.launchpad.net/bugs/1931715 Lenovo IdeaPad S145
      Link: https://bugs.launchpad.net/bugs/1932069 Lenovo BS145-15IIL
      Link: https://lore.kernel.org/r/20220519152150.6135-3-hdegoede@redhat.com
      
      
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Acked-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Cc: Benoit Grégoire <benoitg@coeus.ca>
      Cc: Hui Wang <hui.wang@canonical.com>
      d341838d
    • Hans de Goede's avatar
      x86/PCI: Add kernel cmdline options to use/ignore E820 reserved regions · fa6dae5d
      Hans de Goede authored
      Some firmware supplies PCI host bridge _CRS that includes address space
      unusable by PCI devices, e.g., space occupied by host bridge registers or
      used by hidden PCI devices.
      
      To avoid this unusable space, Linux currently excludes E820 reserved
      regions from _CRS windows; see 4dc2287c ("x86: avoid E820 regions when
      allocating address space").
      
      However, this use of E820 reserved regions to clip things out of _CRS is
      not supported by ACPI, UEFI, or PCI Firmware specs, and some systems have
      E820 reserved regions that cover the entire memory window from _CRS.
      4dc2287c clips the entire window, leaving no space for hot-added or
      uninitialized PCI devices.
      
      For example, from a Lenovo IdeaPad 3 15IIL 81WE:
      
        BIOS-e820: [mem 0x4bc50000-0xcfffffff] reserved
        pci_bus 0000:00: root bus resource [mem 0x65400000-0xbfffffff window]
        pci 0000:00:15.0: BAR 0: [mem 0x00000000-0x00000fff 64bit]
        pci 0000:00:15.0: BAR 0: no space for [mem size 0x00001000 64bit]
      
      Future patches will add quirks to enable/disable E820 clipping
      automatically.
      
      Add a "pci=no_e820" kernel command line option to disable clipping with
      E820 reserved regions.  Also add a matching "pci=use_e820" option to enable
      clipping with E820 reserved regions if that has been disabled by default by
      further patches in this patch-set.
      
      Both options taint the kernel because they are intended for debugging and
      workaround purposes until a quirk can set them automatically.
      
      [bhelgaas: commit log, add printk]
      Link: https://bugzilla.redhat.com/show_bug.cgi?id=1868899 Lenovo IdeaPad 3
      Link: https://lore.kernel.org/r/20220519152150.6135-2-hdegoede@redhat.com
      
      
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Acked-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Cc: Benoit Grégoire <benoitg@coeus.ca>
      Cc: Hui Wang <hui.wang@canonical.com>
      fa6dae5d
  3. May 18, 2022
    • Kuppuswamy Sathyanarayanan's avatar
      PCI/AER: Clear MULTI_ERR_COR/UNCOR_RCV bits · 203926da
      Kuppuswamy Sathyanarayanan authored
      When a Root Port or Root Complex Event Collector receives an error Message
      e.g., ERR_COR, it sets PCI_ERR_ROOT_COR_RCV in the Root Error Status
      register and logs the Requester ID in the Error Source Identification
      register.  If it receives a second ERR_COR Message before software clears
      PCI_ERR_ROOT_COR_RCV, hardware sets PCI_ERR_ROOT_MULTI_COR_RCV and the
      Requester ID is lost.
      
      In the following scenario, PCI_ERR_ROOT_MULTI_COR_RCV was never cleared:
      
        - hardware receives ERR_COR message
        - hardware sets PCI_ERR_ROOT_COR_RCV
        - aer_irq() entered
        - aer_irq(): status = pci_read_config_dword(PCI_ERR_ROOT_STATUS)
        - aer_irq(): now status == PCI_ERR_ROOT_COR_RCV
        - hardware receives second ERR_COR message
        - hardware sets PCI_ERR_ROOT_MULTI_COR_RCV
        - aer_irq(): pci_write_config_dword(PCI_ERR_ROOT_STATUS, status)
        - PCI_ERR_ROOT_COR_RCV is cleared; PCI_ERR_ROOT_MULTI_COR_RCV is set
        - aer_irq() entered again
        - aer_irq(): status = pci_read_config_dword(PCI_ERR_ROOT_STATUS)
        - aer_irq(): now status == PCI_ERR_ROOT_MULTI_COR_RCV
        - aer_irq() exits because PCI_ERR_ROOT_COR_RCV not set
        - PCI_ERR_ROOT_MULTI_COR_RCV is still set
      
      The same problem occurred with ERR_NONFATAL/ERR_FATAL Messages and
      PCI_ERR_ROOT_UNCOR_RCV and PCI_ERR_ROOT_MULTI_UNCOR_RCV.
      
      Fix the problem by queueing an AER event and clearing the Root Error Status
      bits when any of these bits are set:
      
        PCI_ERR_ROOT_COR_RCV
        PCI_ERR_ROOT_UNCOR_RCV
        PCI_ERR_ROOT_MULTI_COR_RCV
        PCI_ERR_ROOT_MULTI_UNCOR_RCV
      
      See the bugzilla link for details from Eric about how to reproduce this
      problem.
      
      [bhelgaas: commit log, move repro details to bugzilla]
      Fixes: e167bfca ("PCI: aerdrv: remove magical ROOT_ERR_STATUS_MASKS")
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=215992
      Link: https://lore.kernel.org/r/20220418150237.1021519-1-sathyanarayanan.kuppuswamy@linux.intel.com
      
      
      Reported-by: default avatarEric Badger <ebadger@purestorage.com>
      Signed-off-by: default avatarKuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: default avatarAshok Raj <ashok.raj@intel.com>
      203926da
  4. May 13, 2022
  5. May 12, 2022
  6. May 11, 2022
  7. May 06, 2022
  8. Apr 22, 2022