1. 18 11月, 2016 2 次提交
    • L
      ACPI / hotplug / PCI: Make device_is_managed_by_native_pciehp() public · 437eb7bf
      Lukas Wunner 提交于
      We're about to add runtime PM of hotplug ports, but we need to restrict it
      to ports that are handled natively by the OS:  If they're handled by the
      firmware (which is the case for Thunderbolt on non-Macs), things would
      break if the OS put the ports into D3hot behind the firmware's back.
      
      To determine if a hotplug port is handled natively, one has to walk up from
      the port to the root bridge and check the cached _OSC Control Field for the
      value of the "PCI Express Native Hot Plug control" bit.  There's already a
      function to do that, device_is_managed_by_native_pciehp(), but it's private
      to drivers/pci/hotplug/acpiphp_glue.c and only compiled in if
      CONFIG_HOTPLUG_PCI_ACPI is enabled.
      
      Make it public and move it to drivers/pci/pci-acpi.c, so that it is
      available in the more general CONFIG_ACPI case.
      
      The function contains a check if the device in question is a hotplug port
      and returns false if it's not.  The caller we're going to add doesn't need
      this as it only calls the function if it actually *is* a hotplug port.
      Move the check out of the function into the single existing caller.
      
      Rename it to pciehp_is_native() and add some kerneldoc and polish.
      
      No functional change intended.
      Tested-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NLukas Wunner <lukas@wunner.de>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      437eb7bf
    • L
      ACPI / hotplug / PCI: Use cached copy of PCI_EXP_SLTCAP_HPC bit · 6ef13824
      Lukas Wunner 提交于
      We cache the PCI_EXP_SLTCAP_HPC bit in pci_dev->is_hotplug_bridge on device
      probe, so there's no need to read it again when adding the ACPI hotplug
      context.
      
      Here's the call chain to prove that no ordering issue is introduced:
      
      pci_scan_child_bus [drivers/pci/probe.c]
        pci_scan_slot
          pci_scan_single_device
            pci_scan_device
              pci_setup_device
                set_pcie_hotplug_bridge
                  [is_hotplug_bridge bit is set here]
        pci_scan_bridge
          pci_add_new_bus
            pci_alloc_child_bus
              pcibios_add_bus  [arch/(x86|arm64|ia64)/...]
                acpi_pci_add_bus [drivers/pci/pci-acpi.c]
                  acpiphp_enumerate_slots [drivers/pci/hotplug/acpiphp_glue.c]
                    acpiphp_add_context
                      device_is_managed_by_native_pciehp
                        [is_hotplug_bridge bit is queried here]
      
      No functional change intended.
      Tested-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NLukas Wunner <lukas@wunner.de>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      6ef13824
  2. 05 8月, 2016 1 次提交
  3. 04 8月, 2016 1 次提交
  4. 14 6月, 2016 1 次提交
  5. 24 1月, 2016 1 次提交
  6. 09 1月, 2016 1 次提交
  7. 23 5月, 2015 1 次提交
    • R
      ACPI / hotplug / PCI: Check ignore_hotplug for all downstream devices · d41be346
      Rafael J. Wysocki 提交于
      If the ignore_hotplug flag is set for a PCI device without an ACPI
      companion and a bus check notification is received for an ancestor bridge
      that is not the device's parent, ACPIPHP will ignore that flag.
      
      Namely, in that case acpiphp_check_bridge() is called for the target bridge
      and if all of the devices immediately below the bridge are still present,
      trim_stale_devices() will be called for each of them.  That function
      recursively walks the hierarchy downwards and removes device objects
      corresponding to devices that don't appear to be present any more.
      Unfortunately, it only checks ignore_hotplug for devices having ACPI
      companions, so it will remove the others (if they don't respond) regardless
      of the ignore_hotplug value.
      
      Fix the problem by making trim_stale_devices() take ignore_hotplug into
      consideration regardless of whether or not an ACPI companion is present for
      the device it has been called for.
      
      [bhelgaas: This may fix bug 61891, depending on whether the bridge above a
      device is removed along with the device]
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=61891Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      d41be346
  8. 13 9月, 2014 1 次提交
  9. 11 9月, 2014 1 次提交
    • B
      PCI: Add pci_ignore_hotplug() to ignore hotplug events for a device · b440bde7
      Bjorn Helgaas 提交于
      Powering off a hot-pluggable device, e.g., with pci_set_power_state(D3cold),
      normally generates a hot-remove event that unbinds the driver.
      
      Some drivers expect to remain bound to a device even while they power it
      off and back on again.  This can be dangerous, because if the device is
      removed or replaced while it is powered off, the driver doesn't know that
      anything changed.  But some drivers accept that risk.
      
      Add pci_ignore_hotplug() for use by drivers that know their device cannot
      be removed.  Using pci_ignore_hotplug() tells the PCI core that hot-plug
      events for the device should be ignored.
      
      The radeon and nouveau drivers use this to switch between a low-power,
      integrated GPU and a higher-power, higher-performance discrete GPU.  They
      power off the unused GPU, but they want to remain bound to it.
      
      This is a reimplementation of f244d8b6 ("ACPIPHP / radeon / nouveau:
      Fix VGA switcheroo problem related to hotplug") but extends it to work with
      both acpiphp and pciehp.
      
      This fixes a problem where systems with dual GPUs using the radeon drivers
      become unusable, freezing every few seconds (see bugzillas below).  The
      resume of the radeon device may also fail, e.g.,
      
      This fixes problems on dual GPU systems where the radeon driver becomes
      unusable because of problems while suspending the device, as in bug 79701:
      
          [drm] radeon: finishing device.
          radeon 0000:01:00.0: Userspace still has active objects !
          radeon 0000:01:00.0: ffff8800cb4ec288 ffff8800cb4ec000 16384 4294967297 force free
          ...
          WARNING: CPU: 0 PID: 67 at /home/apw/COD/linux/drivers/gpu/drm/radeon/radeon_gart.c:234 radeon_gart_unbind+0xd2/0xe0 [radeon]()
          trying to unbind memory from uninitialized GART !
      
      or while resuming it, as in bug 77261:
      
          radeon 0000:01:00.0: ring 0 stalled for more than 10158msec
          radeon 0000:01:00.0: GPU lockup ...
          radeon 0000:01:00.0: GPU pci config reset
          pciehp 0000:00:01.0:pcie04: Card not present on Slot(1-1)
          radeon 0000:01:00.0: GPU reset succeeded, trying to resume
          *ERROR* radeon: dpm resume failed
          radeon 0000:01:00.0: Wait for MC idle timedout !
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=77261
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=79701Reported-by: NShawn Starr <shawn.starr@rogers.com>
      Reported-by: NJose P. <lbdkmjdf@sharklasers.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: NAlex Deucher <alexander.deucher@amd.com>
      Acked-by: NRajat Jain <rajatxjain@gmail.com>
      Acked-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NDave Airlie <airlied@redhat.com>
      CC: stable@vger.kernel.org	# v3.15+
      b440bde7
  10. 21 7月, 2014 1 次提交
  11. 16 7月, 2014 2 次提交
  12. 12 6月, 2014 1 次提交
  13. 11 6月, 2014 1 次提交
  14. 28 5月, 2014 1 次提交
  15. 30 4月, 2014 1 次提交
    • B
      PCI: Remove unnecessary __ref annotations · 10874f5a
      Bjorn Helgaas 提交于
      Some PCI functions used to be marked __devinit.  When CONFIG_HOTPLUG was
      not set, these functions were discarded after boot.  A few callers of these
      __devinit functions were marked __ref to indicate that they could safely
      call the __devinit functions even though the callers were not __devinit.
      
      But CONFIG_HOTPLUG and __devinit are now gone, and the need for the __ref
      annotations is also gone, so remove them.  Relevant historical commits:
      
        54b956b9 Remove __dev* markings from init.h
        a8e4b9c1 PCI: add generic pci_hp_add_bridge()
        0ab2b57f PCI: fix section mismatch warning in pci_scan_child_bus
        451124a7 PCI: fix 4x section mismatch warnings
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      10874f5a
  16. 15 4月, 2014 1 次提交
  17. 05 3月, 2014 1 次提交
  18. 21 2月, 2014 5 次提交
  19. 16 2月, 2014 2 次提交
    • R
      ACPI / hotplug / PCI: Add ACPIPHP contexts to devices handled by PCIeHP · cc6254e0
      Rafael J. Wysocki 提交于
      Currently, ACPIPHP does not add hotplug context to devices that
      should be handled by the native PCI hotplug (PCIeHP) code.  The
      reason why was because PCIeHP didn't know about the devices'
      connections with ACPI and would not clean up things properly
      during an eject of an ACPI-backed device, for example.
      
      However, after recent changes that made the ACPI core create struct
      acpi_device objects for all namespace nodes regardless of the
      underlying devices' status and added PCI rescan-remove locking to
      both ACPIPHP and PCIeHP, that concern is not valid any more.
      Namely, after those changes PCIeHP need not care about the ACPI
      side of things any more and it should be serialized with respect to
      ACPIPHP and they won't be running concurrently with each other in
      any case.
      
      For this reason, make ACPIPHP to add its hotplug context to
      all devices with ACPI companions, even the ones that should be
      handled by PCIeHP in principle.  That may work around hotplug
      issues on some systems where PCIeHP is supposed to work, but it
      doesn't and the ACPI hotplug signaling works instead.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      cc6254e0
    • R
      ACPI / hotplug / PCI: Rename register_slot() to acpiphp_add_context() · 3799c5a0
      Rafael J. Wysocki 提交于
      The name of register_slot() doesn't really reflect what the function
      is does, so rename it to acpiphp_add_context() and add a proper
      kerneldoc comment to it.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      3799c5a0
  20. 15 2月, 2014 1 次提交
  21. 12 2月, 2014 1 次提交
    • M
      ACPI / hotplug / PCI: Relax the checking of _STA return values · 72820594
      Mika Westerberg 提交于
      The ACPI specification (ACPI 5.0A, Section 6.3.7) says:
      
       _STA may return bit 0 clear (not present) with bit 3 set (device is
       functional). This case is used to indicate a valid device for which
       no device driver should be loaded (for example, a bridge device.)
       Children of this device may be present and valid. OSPM should
       continue enumeration below a device whose _STA returns this bit
       combination.
      
      Evidently, some BIOSes follow that and return 0x0A from _STA, which
      causes problems to happen when they trigger bus check or device check
      notifications for those devices too.  Namely, ACPIPHP thinks that they
      are gone and may drop them, for example, if such a notification is
      triggered during a resume from system suspend.
      
      To fix that, modify ACPICA to regard devies as present and
      functioning if _STA returns both the ACPI_STA_DEVICE_ENABLED
      and ACPI_STA_DEVICE_FUNCTIONING bits set for them.
      Reported-and-tested-by: NPeter Wu <lekensteyn@gmail.com>
      Cc: 3.12+ <stable@vger.kernel.org> # 3.12+
      [rjw: Subject and changelog, minor code modifications]
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      72820594
  22. 10 2月, 2014 1 次提交
  23. 07 2月, 2014 4 次提交
    • R
      ACPI / hotplug / PCI: Rework acpiphp_check_host_bridge() · 1f7c164b
      Rafael J. Wysocki 提交于
      Since the only existing caller of acpiphp_check_host_bridge(),
      which is acpi_pci_root_scan_dependent(), already has a struct
      acpi_device pointer needed to obtain the ACPIPHP context, it
      doesn't make sense to execute acpi_bus_get_device() on its
      handle in acpiphp_handle_to_bridge() just in order to get that
      pointer back.
      
      For this reason, modify acpiphp_check_host_bridge() to take
      a struct acpi_device pointer as its argument and rearrange the
      code accordingly.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      1f7c164b
    • R
      ACPI / hotplug / PCI: Hotplug notifications from acpi_bus_notify() · 1a699476
      Rafael J. Wysocki 提交于
      Since acpi_bus_notify() is executed on all notifications for all
      devices anyway, make it execute acpi_device_hotplug() for all
      hotplug events instead of installing notify handlers pointing to
      the same function for all hotplug devices.
      
      This change reduces both the size and complexity of ACPI-based device
      hotplug code.  Moreover, since acpi_device_hotplug() only does
      significant things for devices that have either an ACPI scan handler,
      or a hotplug context with .eject() defined, and those devices
      had notify handlers pointing to acpi_hotplug_notify_cb() installed
      before anyway, this modification shouldn't change functionality.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      1a699476
    • R
      ACPI / hotplug / PCI: Simplify acpi_install_hotplug_notify_handler() · 5e6f236c
      Rafael J. Wysocki 提交于
      Since acpi_hotplug_notify_cb() does not use its data argument any
      more, the second argument of acpi_install_hotplug_notify_handler()
      can be dropped, so do that and update its callers accordingly.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      5e6f236c
    • R
      ACPI / hotplug / PCI: Consolidate ACPIPHP with ACPI core hotplug · 3c2cc7ff
      Rafael J. Wysocki 提交于
      The ACPI-based PCI hotplug (ACPIPHP) code currently attaches its
      hotplug context objects directly to ACPI namespace nodes representing
      hotplug devices.  However, after recent changes causing struct
      acpi_device to be created for every namespace node representing a
      device (regardless of its status), that is not necessary any more.
      Moreover, it's vulnerable to the theoretical issue that the ACPI
      handle passed in the context between handle_hotplug_event() and
      hotplug_event_work() may become invalid in the meantime (as a
      result of a concurrent table unload).
      
      In principle, this issue might be addressed by adding a non-empty
      release handler for ACPIPHP hotplug context objects analogous to
      acpi_scan_drop_device(), but that would duplicate the code in that
      function and in acpi_device_del_work_fn().  For this reason, it's
      better to modify ACPIPHP to attach its device hotplug contexts to
      struct device objects representing hotplug devices and make it
      use acpi_hotplug_notify_cb() as its notify handler.  At the same
      time, acpi_device_hotplug() can be modified to dispatch the new
      .hp.event() callback pointing to acpiphp_hotplug_event() from ACPI
      device objects associated with PCI devices or use the generic
      ACPI device hotplug code for device objects with matching scan
      handlers.
      
      This allows the existing code duplication between ACPIPHP and the
      ACPI core to be reduced too and makes further ACPI-based device
      hotplug consolidation possible.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      3c2cc7ff
  24. 06 2月, 2014 7 次提交