1. 10 5月, 2018 1 次提交
    • R
      PCI / PM: Check device_may_wakeup() in pci_enable_wake() · cfcadfaa
      Rafael J. Wysocki 提交于
      Commit 0847684c (PCI / PM: Simplify device wakeup settings code)
      went too far and dropped the device_may_wakeup() check from
      pci_enable_wake() which causes wakeup to be enabled during system
      suspend, hibernation or shutdown for some PCI devices that are not
      allowed by user space to wake up the system from sleep (or power off).
      
      As a result of this, excessive power is drawn by some of the affected
      systems while in sleep states or off.
      
      Restore the device_may_wakeup() check in pci_enable_wake(), but make
      sure that the PCI bus type's runtime suspend callback will not call
      device_may_wakeup() which is about system wakeup from sleep and not
      about device wakeup from runtime suspend.
      
      Fixes: 0847684c (PCI / PM: Simplify device wakeup settings code)
      Reported-by: NJoseph Salisbury <joseph.salisbury@canonical.com>
      Cc: 4.13+ <stable@vger.kernel.org> # 4.13+
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NBjorn Helgaas <bhelgaas@google.com>
      cfcadfaa
  2. 09 5月, 2018 1 次提交
    • K
      PCI / PM: Always check PME wakeup capability for runtime wakeup support · 8feaec33
      Kai Heng Feng 提交于
      USB controller ASM1042 stops working after commit de3ef1eb (PM /
      core: Drop run_wake flag from struct dev_pm_info).
      
      The device in question is not power managed by platform firmware,
      furthermore, it only supports PME# from D3cold:
      Capabilities: [78] Power Management version 3
             Flags: PMEClk- DSI- D1- D2- AuxCurrent=55mA PME(D0-,D1-,D2-,D3hot-,D3cold+)
             Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
      
      Before commit de3ef1eb, the device never gets runtime suspended.
      After that commit, the device gets runtime suspended to D3hot, which can
      not generate any PME#.
      
      usb_hcd_pci_probe() unconditionally calls device_wakeup_enable(), hence
      device_can_wakeup() in pci_dev_run_wake() always returns true.
      
      So pci_dev_run_wake() needs to check PME wakeup capability as its first
      condition.
      
      In addition, change wakeup flag passed to pci_target_state() from false
      to true, because we want to find the deepest state different from D3cold
      that the device can still generate PME#. In this case, it's D0 for the
      device in question.
      
      Fixes: de3ef1eb (PM / core: Drop run_wake flag from struct dev_pm_info)
      Signed-off-by: NKai-Heng Feng <kai.heng.feng@canonical.com>
      Cc: 4.13+ <stable@vger.kernel.org> # 4.13+
      Acked-by: NBjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      8feaec33
  3. 23 4月, 2018 1 次提交
    • M
      PCI / PM: Do not clear state_saved in pci_pm_freeze() when smart suspend is set · ae860a19
      Mika Westerberg 提交于
      If a driver uses DPM_FLAG_SMART_SUSPEND and the device is already
      runtime suspended when hibernate is started PCI core skips runtime
      resuming the device but still clears pci_dev->state_saved. After the
      hibernation image is written pci_pm_thaw_noirq() makes sure subsequent
      thaw phases for the device are also skipped leaving it runtime suspended
      with pci_dev->state_saved == false.
      
      When the device is eventually runtime resumed pci_pm_runtime_resume()
      restores config space by calling pci_restore_standard_config(), however
      because pci_dev->state_saved == false pci_restore_state() never actually
      restores the config space leaving the device in a state that is not what
      the driver might expect.
      
      For example here is what happens for intel-lpss I2C devices once the
      hibernation snapshot is taken:
      
        intel-lpss 0000:00:15.0: power state changed by ACPI to D0
        intel-lpss 0000:00:1e.0: power state changed by ACPI to D3cold
        video LNXVIDEO:00: Restoring backlight state
        PM: hibernation exit
        i2c_designware i2c_designware.1: Unknown Synopsys component type: 0xffffffff
        i2c_designware i2c_designware.0: Unknown Synopsys component type: 0xffffffff
        i2c_designware i2c_designware.1: timeout in disabling adapter
        i2c_designware i2c_designware.0: timeout in disabling adapter
      
      Since PCI config space is not restored the device is still in D3hot
      making MMIO register reads return 0xffffffff.
      
      Fix this by clearing pci_dev->state_saved only if we actually end up
      runtime resuming the device.
      
      Fixes: c4b65157 (PCI / PM: Take SMART_SUSPEND driver flag into account)
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Cc: 4.15+ <stable@vger.kernel.org> # 4.15+
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      ae860a19
  4. 21 4月, 2018 1 次提交
  5. 17 4月, 2018 1 次提交
  6. 16 4月, 2018 4 次提交
  7. 11 4月, 2018 2 次提交
    • D
      PCI: Remove messages about reassigning resources · adf58458
      Desnes A. Nunes do Rosario 提交于
      When reassigning device resources to increase their alignment, e.g.,
      because of a "pci=resource_alignment=" kernel parameter or because the
      platform aligns resources to its page size, we previously emitted messages
      like this:
      
        pci 0000:00:00.0: Disabling memory decoding and releasing memory resources
        pci 0000:00:00.0: disabling bridge mem windows
      
      These messages don't convey any useful information, so remove them.
      
      Fixes: 38274637 ("powerpc/powernv: Override pcibios_default_alignment() to force PCI devices to be page aligned")
      Signed-off-by: NDesnes A. Nunes do Rosario <desnesn@linux.vnet.ibm.com>
      [bhelgaas: changelog]
      Signed-off-by: NBjorn Helgaas <helgaas@kernel.org>
      adf58458
    • S
      PCI: Mark Broadcom HT1100 and HT2000 Root Port Extended Tags as broken · 1b30dfd3
      Sinan Kaya 提交于
      Per PCIe r3.1, sec 2.2.6.2 and 7.8.4, a Requester may not use 8-bit Tags
      unless its Extended Tag Field Enable is set, but all Receivers/Completers
      must handle 8-bit Tags correctly regardless of their Extended Tag Field
      Enable.
      
      Some devices do not handle 8-bit Tags as Completers, so add a quirk for
      them.  If we find such a device, we disable Extended Tags for the entire
      hierarchy to make peer-to-peer DMA possible.
      
      The Broadcom HT1100/HT2000/HT2100 seems to have issues with handling 8-bit
      tags.  Mark it as broken.
      
      This fixes Xorg hangs and unresponsive keyboards with errors like this:
      
        radeon 0000:06:00.0: GPU lockup (current fence id 0x000000000000000e last fence id 0x0000000000000
        [drm:r600_ring_test [radeon]] *ERROR* radeon: ring 0 test failed (scratch(0x8504)=0xCAFEDEAD)
        [drm:r600_resume [radeon]] *ERROR* r600 startup failed on resume
      
      Fixes: 60db3a4d ("PCI: Enable PCIe Extended Tags if supported")
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=196197Signed-off-by: NSinan Kaya <okaya@codeaurora.org>
      Signed-off-by: NBjorn Helgaas <helgaas@kernel.org>
      CC: stable@vger.kernel.org	# v4.11: 62ce94a7 PCI: Mark Broadcom HT2100 Root Port Extended Tags as broken
      CC: stable@vger.kernel.org	# v4.11
      1b30dfd3
  8. 04 4月, 2018 3 次提交
  9. 03 4月, 2018 13 次提交
  10. 01 4月, 2018 2 次提交
  11. 31 3月, 2018 11 次提交
    • M
      PCI/DPC: Do not enable DPC if AER control is not allowed by the BIOS · 4e5fad42
      Mika Westerberg 提交于
      Commit eed85ff4 ("PCI/DPC: Enable DPC only if AER is available") made
      DPC control dependent whether AER is enabled in the OS.  However, it does
      not take into account situations where BIOS has not given OS control of
      AER:
      
        acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI]
        acpi PNP0A08:00: _OSC: platform does not support [AER]
        acpi PNP0A08:00: _OSC: OS now controls [PCIeHotplug PME PCIeCapability]
      
      I think here it is better not to enable DPC even if the capability is
      available because then it would be against what "Determination of DPC
      Control" note in PCIe 4.0 sec 6.1.10 recommends.
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NBjorn Helgaas <helgaas@kernel.org>
      4e5fad42
    • F
      PCI/AER: Use cached AER Capability offset · f0553ba0
      Frederick Lawler 提交于
      Replace pci_find_ext_capability(..., PCI_EXT_CAP_ID_ERR) calls with
      pci_dev->aer_cap.
      
      pci_dev->aer_cap is initialized in pci_init_capabilities(), which happens
      before any of these users of the AER Capability.
      Signed-off-by: NFrederick Lawler <fred@fredlawl.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      f0553ba0
    • B
      PCI/portdrv: Rename and reverse sense of pcie_ports_auto · d850882b
      Bjorn Helgaas 提交于
      The platform may restrict the OS's use of PCIe services, e.g., via the ACPI
      _OSC method.  The user may use "pcie_ports=native" to force the port driver
      to use PCIe services even if the platform asked us not to.
      
      The "pcie_ports=native" parameter determines the setting of
      pcie_ports_auto.  Rename this to pcie_ports_native and reverse the
      sense to simplify the code.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      d850882b
    • B
      PCI/portdrv: Encapsulate pcie_ports_auto inside the port driver · 842b447f
      Bjorn Helgaas 提交于
      "pcie_ports_auto" is only used inside the PCIe port driver itself, so
      move it from include/linux/pci.h to portdrv.h so it's not visible to the
      whole kernel.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      842b447f
    • B
      PCI/portdrv: Remove unnecessary "pcie_ports=auto" parameter · 4c0fd764
      Bjorn Helgaas 提交于
      The "pcie_ports=auto" parameter set pcie_ports_disabled and pcie_ports_auto
      to their compiled-in defaults, so specifying the parameter is the same as
      not using it at all.
      
      Remove the "pcie_ports=auto" parameter and update the documentation.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      4c0fd764
    • B
      PCI/portdrv: Remove "pcie_hp=nomsi" kernel parameter · 1e447c57
      Bjorn Helgaas 提交于
      7570a333 ("PCI: Add pcie_hp=nomsi to disable MSI/MSI-X for pciehp
      driver") added the "pcie_hp=nomsi" kernel parameter to work around this
      error on shutdown:
      
        irq 16: nobody cared (try booting with the "irqpoll" option)
        Pid: 1081, comm: reboot Not tainted 3.2.0 #1
        ...
        Disabling IRQ #16
      
      This happened on an unspecified system (possibly involving the Integrated
      Device Technology, Inc. Device 807f bridge) where "an un-wanted interrupt
      is generated when PCI driver switches from MSI/MSI-X to INTx while shutting
      down the device."
      
      The implication was that the device was buggy, but it is normal for a
      device to use INTx after MSI/MSI-X have been disabled.  The only problem
      was that the driver was still attached and it wasn't prepared for INTx
      interrupts.  Prarit Bhargava fixed this issue with fda78d7a ("PCI/MSI:
      Stop disabling MSI/MSI-X in pci_device_shutdown()").
      
      There is no automated way to set this parameter, so it's not very useful
      for distributions or end users.  It's really only useful for debugging, and
      we have "pci=nomsi" for that purpose.
      
      Revert 7570a333 to remove the "pcie_hp=nomsi" parameter.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      CC: MUNEDA Takahiro <muneda.takahiro@jp.fujitsu.com>
      CC: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
      CC: Prarit Bhargava <prarit@redhat.com>
      1e447c57
    • B
      PCI/portdrv: Remove unnecessary include of <linux/pci-aspm.h> · 1b64cb87
      Bjorn Helgaas 提交于
      portdrv_pci.c doesn't use anything from <linux/pci-aspm.h>.  Remove the
      include of it.  No functional change intended.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      1b64cb87
    • B
      PCI/portdrv: Simplify PCIe feature permission checking · 02bfeb48
      Bjorn Helgaas 提交于
      Some PCIe features (AER, DPC, hotplug, PME) can be managed by either the
      platform firmware or the OS, so the host bridge driver may have to request
      permission from the platform before using them.  On ACPI systems, this is
      done by negotiate_os_control() in acpi_pci_root_add().
      
      The PCIe port driver later uses pcie_port_platform_notify() and
      pcie_port_acpi_setup() to figure out whether it can use these features.
      But all we need is a single bit for each service, so these interfaces are
      needlessly complicated.
      
      Simplify this by adding bits in the struct pci_host_bridge to show when the
      OS has permission to use each feature:
      
        + unsigned int native_aer:1;       /* OS may use PCIe AER */
        + unsigned int native_hotplug:1;   /* OS may use PCIe hotplug */
        + unsigned int native_pme:1;       /* OS may use PCIe PME */
      
      These are set when we create a host bridge, and the host bridge driver can
      clear the bits corresponding to any feature the platform doesn't want us to
      use.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      02bfeb48
    • B
      PCI/portdrv: Remove unused PCIE_PORT_SERVICE_VC · 168f3ae5
      Bjorn Helgaas 提交于
      No driver registers for PCIE_PORT_SERVICE_VC, so remove it.
      
      This removes the VC "service" files from /sys/bus/pci_express/devices,
      e.g., 0000:07:00.0:pcie108, 0000:08:04.0:pcie208 (all the files that
      contained "8" as the last digit of the "pcieXXX" part).  The port driver
      created these files for PCIe port devices that have a VC Capability.
      
      Since this reduces PCIE_PORT_DEVICE_MAXSERVICES and moves DPC down into the
      spot where VC used to be, the DPC sysfs files will now be named "pcieXX8".
      I don't think there's anything useful userspace can do with those files, so
      I hope nobody cares about these filenames.
      
      There is no VC driver that calls pcie_port_service_register(), so there
      never was a /sys/bus/pci_express/drivers/vc directory.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      168f3ae5
    • B
      PCI/portdrv: Remove pcie_port_bus_type link order dependency · c6c889d9
      Bjorn Helgaas 提交于
      The pcie_port_bus_type must be registered before drivers that depend on it
      can be registered.  Those drivers include:
      
        pcied_init()                # PCIe native hotplug driver
        aer_service_init()          # AER driver
        dpc_service_init()          # DPC driver
        pcie_pme_service_init()     # PME driver
      
      Previously we registered pcie_port_bus_type from pcie_portdrv_init(), a
      device_initcall.  The callers of pcie_port_service_register() (above) are
      also device_initcalls.  This is fragile because the device_initcall
      ordering depends on link order, which is not explicit.
      
      Register pcie_port_bus_type from pci_driver_init() along with pci_bus_type.
      This removes the link order dependency between portdrv and the pciehp, AER,
      DPC, and PCIe PME drivers.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      c6c889d9
    • B
      PCI/portdrv: Disable port driver in compat mode · 79a01119
      Bjorn Helgaas 提交于
      The "pcie_ports=compat" kernel parameter sets pcie_ports_disabled, which is
      intended to disable the PCIe port driver.  But even when it was disabled,
      we registered pcie_portdriver so we could work around a BIOS PME issue (see
      fe31e697 ("PCI/PCIe: Clear Root PME Status bits early during system
      resume")).
      
      Registering the driver meant that the pcie_portdrv_probe() path called
      pci_enable_device(), pci_save_state(), pm_runtime_set_autosuspend_delay(),
      pm_runtime_use_autosuspend(), etc., even when the driver was disabled.
      
      We've since moved the BIOS PME workaround from the port driver to the core,
      so stop registering the PCIe port driver in compat mode.
      
      This means "pcie_ports=compat" will now be basically the same as turning
      off CONFIG_PCIEPORTBUS completely.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      79a01119