1. Jan 13, 2022
    • Bjorn Helgaas's avatar
      Merge branch 'remotes/lorenzo/pci/aardvark' · 800cee8b
      Bjorn Helgaas authored
      - Add bridge emulation definitions for PCIe DEVCAP2, DEVCTL2, DEVSTA2,
        LNKCAP2, LNKCTL2, LNKSTA2, SLTCAP2, SLTCTL2, SLTSTA2 (Pali Rohár)
      
      - Add aardvark support for DEVCAP2, DEVCTL2, LNKCAP2 and LNKCTL2 registers
        (Pali Rohár)
      
      - Clear all MSIs at setup to avoid spurious interrupts (Pali Rohár)
      
      - Disable bus mastering when unbinding host controller driver (Pali Rohár)
      
      - Mask all interrupts when unbinding host controller driver (Pali Rohár)
      
      - Fix memory leak in host controller unbind (Pali Rohár)
      
      - Assert PERST# when unbinding host controller driver (Pali Rohár)
      
      - Disable link training when unbinding host controller driver (Pali Rohár)
      
      - Disable common PHY when unbinding host controller driver (Pali Rohár)
      
      - Fix resource type checking to check only IORESOURCE_MEM, not
        IORESOURCE_MEM_64, which is a flavor of IORESOURCE_MEM (Pali Rohár)
      
      * remotes/lorenzo/pci/aardvark:
        PCI: aardvark: Fix checking for MEM resource type
        PCI: aardvark: Disable common PHY when unbinding driver
        PCI: aardvark: Disable link training when unbinding driver
        PCI: aardvark: Assert PERST# when unbinding driver
        PCI: aardvark: Fix memory leak in driver unbind
        PCI: aardvark: Mask all interrupts when unbinding driver
        PCI: aardvark: Disable bus mastering when unbinding driver
        PCI: aardvark: Comment actions in driver remove method
        PCI: aardvark: Clear all MSIs at setup
        PCI: aardvark: Add support for DEVCAP2, DEVCTL2, LNKCAP2 and LNKCTL2 registers on emulated bridge
        PCI: pci-bridge-emul: Add definitions for missing capabilities registers
        PCI: pci-bridge-emul: Add description for class_revision field
      800cee8b
    • Bjorn Helgaas's avatar
      Merge branch 'pci/virtualization' · d03f92c4
      Bjorn Helgaas authored
      - Add function 1 DMA alias quirk for Marvell 88SE9125 SATA controller so it
        can work with an IOMMU (Yifeng Li)
      
      * pci/virtualization:
        PCI: Add function 1 DMA alias quirk for Marvell 88SE9125 SATA controller
      d03f92c4
    • Bjorn Helgaas's avatar
      Merge branch 'pci/switchtec' · 54f98a8b
      Bjorn Helgaas authored
      - Add Gen4 automotive device IDs (Kelvin Cao)
      
      - Declare state_names[] as static so it's not allocated and initialized for
        every call (Kelvin Cao)
      
      * pci/switchtec:
        PCI/switchtec: Declare local state_names[] as static
        PCI/switchtec: Add Gen4 automotive device IDs
      54f98a8b
    • Bjorn Helgaas's avatar
      Merge branch 'pci/resource' · 05642e2f
      Bjorn Helgaas authored
      - Always write Intel I210 ROM BAR on update to work around device defect
        (Bjorn Helgaas)
      
      * pci/resource:
        PCI: Work around Intel I210 ROM BAR overlap defect
      05642e2f
    • Bjorn Helgaas's avatar
      Merge branch 'pci/p2pdma' · c6ff0f8d
      Bjorn Helgaas authored
      - Add Logan Gunthorpe as P2PDMA maintainer (Bjorn Helgaas)
      
      - Optimize by using percpu_ref_tryget_live_rcu() inside RCU critical
        section (Christophe JAILLET)
      
      * pci/p2pdma:
        PCI/P2PDMA: Use percpu_ref_tryget_live_rcu() inside RCU critical section
        MAINTAINERS: Add Logan Gunthorpe as P2PDMA maintainer
      c6ff0f8d
    • Bjorn Helgaas's avatar
      Merge branch 'pci/legacy-pm-removal' · 446cc1c5
      Bjorn Helgaas authored
      - Convert amd64-agp, sis-agp, via-agp from legacy PCI power management to
        generic power management (Vaibhav Gupta)
      
      * pci/legacy-pm-removal:
        via-agp: convert to generic power management
        sis-agp: convert to generic power management
        amd64-agp: convert to generic power management
      446cc1c5
    • Bjorn Helgaas's avatar
      Merge branch 'pci/hotplug' · 7475f931
      Bjorn Helgaas authored
      - Fix infinite loop in pciehp IRQ handler on power fault (Lukas Wunner)
      
      - Removed commented-out ibmphp functions (Vihas Mak)
      
      - Fix pciehp lockdep errors on Thunderbolt undock (Hans de Goede)
      
      * pci/hotplug:
        PCI: pciehp: Use down_read/write_nested(reset_lock) to fix lockdep errors
        PCI: ibmphp: Remove commented-out functions
        PCI: pciehp: Fix infinite loop in IRQ handler upon power fault
      7475f931
    • Bjorn Helgaas's avatar
      Merge branch 'pci/enumeration' · fb6c4513
      Bjorn Helgaas authored
      - Use pci_find_vsec_capability() instead of open-coding it (Andy
        Shevchenko)
      
      - Convert pci_dev_present() stub from macro to static inline to avoid
        'unused variable' errors (Hans de Goede)
      
      - Convert sysfs slot attributes from default_attrs to default_groups (Greg
        Kroah-Hartman)
      
      - Use DWORD accesses for LTR, L1 SS to avoid BayHub OZ711LV2 erratum (Rajat
        Jain)
      
      - Remove unnecessary initialization of static variables (Longji Guo)
      
      * pci/enumeration:
        x86/PCI: Remove initialization of static variables to false
        PCI: Use DWORD accesses for LTR, L1 SS to avoid erratum
        PCI/sysfs: Use default_groups in kobj_type for slot attrs
        PCI: Convert pci_dev_present() stub to static inline
        PCI: Use pci_find_vsec_capability() when looking for TBT devices
      fb6c4513
    • Bjorn Helgaas's avatar
      Merge branch 'pci/aspm' · 7498e41f
      Bjorn Helgaas authored
      - Calculate link L0s and L1 exit latencies when needed instead of caching
        them (Saheed O. Bolarinwa)
      
      - Calculate device L0s and L1 acceptable exit latencies when needed instead
        of caching them (Saheed O. Bolarinwa)
      
      - Remove struct aspm_latency since it's no longer needed (Saheed O.
        Bolarinwa)
      
      * pci/aspm:
        PCI/ASPM: Remove struct aspm_latency
        PCI/ASPM: Stop caching device L0s, L1 acceptable exit latencies
        PCI/ASPM: Stop caching link L0s, L1 exit latencies
        PCI/ASPM: Move pci_function_0() upward
      7498e41f
  2. Jan 12, 2022
    • Hans de Goede's avatar
      PCI: pciehp: Use down_read/write_nested(reset_lock) to fix lockdep errors · 085a9f43
      Hans de Goede authored
      Use down_read_nested() and down_write_nested() when taking the
      ctrl->reset_lock rw-sem, passing the number of PCIe hotplug controllers in
      the path to the PCI root bus as lock subclass parameter.
      
      This fixes the following false-positive lockdep report when unplugging a
      Lenovo X1C8 from a Lenovo 2nd gen TB3 dock:
      
        pcieport 0000:06:01.0: pciehp: Slot(1): Link Down
        pcieport 0000:06:01.0: pciehp: Slot(1): Card not present
        ============================================
        WARNING: possible recursive locking detected
        5.16.0-rc2+ #621 Not tainted
        --------------------------------------------
        irq/124-pciehp/86 is trying to acquire lock:
        ffff8e5ac4299ef8 (&ctrl->reset_lock){.+.+}-{3:3}, at: pciehp_check_presence+0x23/0x80
      
        but task is already holding lock:
        ffff8e5ac4298af8 (&ctrl->reset_lock){.+.+}-{3:3}, at: pciehp_ist+0xf3/0x180
      
         other info that might help us debug this:
         Possible unsafe locking scenario:
      
      	 CPU0
      	 ----
          lock(&ctrl->reset_lock);
          lock(&ctrl->reset_lock);
      
         *** DEADLOCK ***
      
         May be due to missing lock nesting notation
      
        3 locks held by irq/124-pciehp/86:
         #0: ffff8e5ac4298af8 (&ctrl->reset_lock){.+.+}-{3:3}, at: pciehp_ist+0xf3/0x180
         #1: ffffffffa3b024e8 (pci_rescan_remove_lock){+.+.}-{3:3}, at: pciehp_unconfigure_device+0x31/0x110
         #2: ffff8e5ac1ee2248 (&dev->mutex){....}-{3:3}, at: device_release_driver+0x1c/0x40
      
        stack backtrace:
        CPU: 4 PID: 86 Comm: irq/124-pciehp Not tainted 5.16.0-rc2+ #621
        Hardware name: LENOVO 20U90SIT19/20U90SIT19, BIOS N2WET30W (1.20 ) 08/26/2021
        Call Trace:
         <TASK>
         dump_stack_lvl+0x59/0x73
         __lock_acquire.cold+0xc5/0x2c6
         lock_acquire+0xb5/0x2b0
         down_read+0x3e/0x50
         pciehp_check_presence+0x23/0x80
         pciehp_runtime_resume+0x5c/0xa0
         device_for_each_child+0x45/0x70
         pcie_port_device_runtime_resume+0x20/0x30
         pci_pm_runtime_resume+0xa7/0xc0
         __rpm_callback+0x41/0x110
         rpm_callback+0x59/0x70
         rpm_resume+0x512/0x7b0
         __pm_runtime_resume+0x4a/0x90
         __device_release_driver+0x28/0x240
         device_release_driver+0x26/0x40
         pci_stop_bus_device+0x68/0x90
         pci_stop_bus_device+0x2c/0x90
         pci_stop_and_remove_bus_device+0xe/0x20
         pciehp_unconfigure_device+0x6c/0x110
         pciehp_disable_slot+0x5b/0xe0
         pciehp_handle_presence_or_link_change+0xc3/0x2f0
         pciehp_ist+0x179/0x180
      
      This lockdep warning is triggered because with Thunderbolt, hotplug ports
      are nested. When removing multiple devices in a daisy-chain, each hotplug
      port's reset_lock may be acquired recursively. It's never the same lock, so
      the lockdep splat is a false positive.
      
      Because locks at the same hierarchy level are never acquired recursively, a
      per-level lockdep class is sufficient to fix the lockdep warning.
      
      The choice to use one lockdep subclass per pcie-hotplug controller in the
      path to the root-bus was made to conserve class keys because their number
      is limited and the complexity grows quadratically with number of keys
      according to Documentation/locking/lockdep-design.rst.
      
      Link: https://lore.kernel.org/linux-pci/20190402021933.GA2966@mit.edu/
      Link: https://lore.kernel.org/linux-pci/de684a28-9038-8fc6-27ca-3f6f2f6400d7@redhat.com/
      Link: https://lore.kernel.org/r/20211217141709.379663-1-hdegoede@redhat.com
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=208855
      
      
      Reported-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: default avatarLukas Wunner <lukas@wunner.de>
      Cc: stable@vger.kernel.org
      085a9f43
    • Longji Guo's avatar
      x86/PCI: Remove initialization of static variables to false · 346865f0
      Longji Guo authored
      Remove the initialization of pci_ignore_seg to false which is pointless.
      
      Link: https://lore.kernel.org/r/20211203080758.962-1-guolongji@uniontech.com
      
      
      Signed-off-by: default avatarLongji Guo <guolongji@uniontech.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      346865f0
    • Rajat Jain's avatar
      PCI: Use DWORD accesses for LTR, L1 SS to avoid erratum · 4353594e
      Rajat Jain authored
      Some devices have an erratum such that they only support DWORD accesses to
      some registers.  E.g., this Bayhub O2 device ([VID:DID] = [0x1217:0x8621])
      only supports DWORD accesses to LTR latency registers and L1 PM substates
      control registers:
      
        https://github.com/rajatxjain/public_shared/blob/main/OZ711LV2_appnote.pdf
      
      The L1 PM substate control registers are DWORD sized, and hence their
      access in the kernel is already DWORD sized, so we don't need to do
      anything for them.
      
      However, the LTR registers being WORD sized, are in need of a solution.
      Convert the WORD sized accesses to these registers into DWORD sized
      accesses while saving and restoring them.
      
      Link: https://lore.kernel.org/r/20211222012105.3438916-1-rajatja@google.com
      
      
      Signed-off-by: default avatarRajat Jain <rajatja@google.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      4353594e
  3. Jan 11, 2022
  4. Dec 30, 2021
  5. Dec 18, 2021
  6. Dec 16, 2021
  7. Dec 15, 2021
    • Vaibhav Gupta's avatar
      via-agp: convert to generic power management · 0aeddbd0
      Vaibhav Gupta authored
      Convert via-agp from legacy PCI power management to the generic power
      management framework.
      
      Previously, via-agp used legacy PCI power management, and agp_via_suspend()
      and agp_via_resume() were responsible for both device-specific things and
      generic PCI things:
      
        agp_via_suspend
          pci_save_state(pdev)                <-- generic PCI
          pci_set_power_state(pdev, pci_choose_state(pdev, state)) <-- generic PCI
      
        agp_via_resume
          pci_set_power_state(pdev, PCI_D0)   <-- generic PCI
          pci_restore_state(pdev)             <-- generic PCI
          via_configure_agp3()                <-- device-specific
          via_configure()                     <-- device-specific
      
      With generic power management, the PCI bus PM methods do the generic PCI
      things, and the driver needs only the device-specific part, i.e.,
      
        suspend_devices_and_enter
          dpm_suspend_start(PMSG_SUSPEND)
            pci_pm_suspend                    # PCI bus .suspend() method
              agp_via_suspend                 <-- not needed at all; removed
          suspend_enter
            dpm_suspend_noirq(PMSG_SUSPEND)
              pci_pm_suspend_noirq            # PCI bus .suspend_noirq() method
                pci_save_state                <-- generic PCI
                pci_prepare_to_sleep          <-- generic PCI
                  pci_set_power_state
          ...
          dpm_resume_end(PMSG_RESUME)
            pci_pm_resume                     # PCI bus .resume() method
              pci_restore_standard_config
                pci_set_power_state(PCI_D0)   <-- generic PCI
                pci_restore_state             <-- generic PCI
              agp_via_resume                  # dev->driver->pm->resume
                via_configure_agp3()          <-- device-specific
                via_configure()               <-- device-specific
      
      [bhelgaas: commit log]
      Link: https://lore.kernel.org/r/20211208193305.147072-4-helgaas@kernel.org
      
      
      Signed-off-by: default avatarVaibhav Gupta <vaibhavgupta40@gmail.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Acked-by: default avatarDave Airlie <airlied@redhat.com>
      0aeddbd0
    • Vaibhav Gupta's avatar
      sis-agp: convert to generic power management · 6d1adc3d
      Vaibhav Gupta authored
      Convert sis-agp from legacy PCI power management to the generic power
      management framework.
      
      Previously, sis-agp used legacy PCI power management, and agp_sis_suspend()
      and agp_sis_resume() were responsible for both device-specific things and
      generic PCI things:
      
        agp_sis_suspend
          pci_save_state(pdev)                <-- generic PCI
          pci_set_power_state(pdev, pci_choose_state(pdev, state)) <-- generic PCI
      
        agp_sis_resume
          pci_set_power_state(pdev, PCI_D0)   <-- generic PCI
          pci_restore_state(pdev)             <-- generic PCI
          sis_driver.configure()              <-- device-specific
      
      With generic power management, the PCI bus PM methods do the generic PCI
      things, and the driver needs only the device-specific part, i.e.,
      
        suspend_devices_and_enter
          dpm_suspend_start(PMSG_SUSPEND)
            pci_pm_suspend                    # PCI bus .suspend() method
              agp_sis_suspend                 <-- not needed at all; removed
          suspend_enter
            dpm_suspend_noirq(PMSG_SUSPEND)
              pci_pm_suspend_noirq            # PCI bus .suspend_noirq() method
                pci_save_state                <-- generic PCI
                pci_prepare_to_sleep          <-- generic PCI
                  pci_set_power_state
          ...
          dpm_resume_end(PMSG_RESUME)
            pci_pm_resume                     # PCI bus .resume() method
              pci_restore_standard_config
                pci_set_power_state(PCI_D0)   <-- generic PCI
                pci_restore_state             <-- generic PCI
              agp_sis_resume                  # dev->driver->pm->resume
                sis_driver.configure()        <-- device-specific
      
      [bhelgaas: commit log]
      Link: https://lore.kernel.org/r/20211208193305.147072-3-helgaas@kernel.org
      
      
      Signed-off-by: default avatarVaibhav Gupta <vaibhavgupta40@gmail.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Acked-by: default avatarDave Airlie <airlied@redhat.com>
      6d1adc3d
    • Vaibhav Gupta's avatar
      amd64-agp: convert to generic power management · ec4e4a6f
      Vaibhav Gupta authored
      Convert amd64-agp from legacy PCI power management to the generic power
      management framework.
      
      Previously, amd64-agp used legacy PCI power management, and
      agp_amd64_suspend() and agp_amd64_resume() were responsible for both
      device-specific things and generic PCI things:
      
        agp_amd64_suspend
          pci_save_state(pdev)                <-- generic PCI
          pci_set_power_state(pdev, pci_choose_state(pdev, state)) <-- generic PCI
      
        agp_amd64_resume
          pci_set_power_state(pdev, PCI_D0)   <-- generic PCI
          pci_restore_state(pdev)             <-- generic PCI
          nforce3_agp_init()                  <-- device-specific
          amd_8151_configure()                <-- device-specific
      
      With generic power management, the PCI bus PM methods do the generic PCI
      things, and the driver needs only the device-specific part, i.e.,
      
        suspend_devices_and_enter
          dpm_suspend_start(PMSG_SUSPEND)
            pci_pm_suspend                    # PCI bus .suspend() method
              agp_amd64_suspend               <-- not needed at all; removed
          suspend_enter
            dpm_suspend_noirq(PMSG_SUSPEND)
              pci_pm_suspend_noirq            # PCI bus .suspend_noirq() method
                pci_save_state                <-- generic PCI
                pci_prepare_to_sleep          <-- generic PCI
                  pci_set_power_state
          ...
          dpm_resume_end(PMSG_RESUME)
            pci_pm_resume                     # PCI bus .resume() method
              pci_restore_standard_config
                pci_set_power_state(PCI_D0)   <-- generic PCI
                pci_restore_state             <-- generic PCI
              agp_amd64_resume                # dev->driver->pm->resume
                nforce3_agp_init()            <-- device-specific
                amd_8151_configure()          <-- device-specific
      
      [bhelgaas: commit log]
      Link: https://lore.kernel.org/r/20211208193305.147072-2-helgaas@kernel.org
      
      
      Signed-off-by: default avatarVaibhav Gupta <vaibhavgupta40@gmail.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Acked-by: default avatarDave Airlie <airlied@redhat.com>
      ec4e4a6f
  8. Dec 10, 2021
  9. Dec 06, 2021
  10. Dec 02, 2021
  11. Nov 20, 2021