1. 13 8月, 2013 1 次提交
  2. 12 8月, 2013 3 次提交
  3. 08 8月, 2013 1 次提交
    • R
      ACPI: Try harder to resolve _ADR collisions for bridges · 60f75b8e
      Rafael J. Wysocki 提交于
      In theory, under a given ACPI namespace node there should be only
      one child device object with _ADR whose value matches a given bus
      address exactly.  In practice, however, there are systems in which
      multiple child device objects under a given parent have _ADR matching
      exactly the same address.  In those cases we use _STA to determine
      which of the multiple matching devices is enabled, since some systems
      are known to indicate which ACPI device object to associate with the
      given physical (usually PCI) device this way.
      
      Unfortunately, as it turns out, there are systems in which many
      device objects under the same parent have _ADR matching exactly the
      same bus address and none of them has _STA, in which case they all
      should be regarded as enabled according to the spec.  Still, if
      those device objects are supposed to represent bridges (e.g. this
      is the case for device objects corresponding to PCIe ports), we can
      try harder and skip the ones that have no child device objects in the
      ACPI namespace.  With luck, we can avoid using device objects that we
      are not expected to use this way.
      
      Although this only works for bridges whose children also have ACPI
      namespace representation, it is sufficient to address graphics
      adapter detection issues on some systems, so rework the code finding
      a matching device ACPI handle for a given bus address to implement
      this idea.
      
      Introduce a new function, acpi_find_child(), taking three arguments:
      the ACPI handle of the device's parent, a bus address suitable for
      the device's bus type and a bool indicating if the device is a
      bridge and make it work as outlined above.  Reimplement the function
      currently used for this purpose, acpi_get_child(), as a call to
      acpi_find_child() with the last argument set to 'false' and make
      the PCI subsystem use acpi_find_child() with the bridge information
      passed as the last argument to it.  [Lan Tianyu notices that it is
      not sufficient to use pci_is_bridge() for that, because the device's
      subordinate pointer hasn't been set yet at this point, so use
      hdr_type instead.]
      
      This change fixes a regression introduced inadvertently by commit
      33f767d7 (ACPI: Rework acpi_get_child() to be more efficient) which
      overlooked the fact that for acpi_walk_namespace() "post-order" means
      "after all children have been visited" rather than "on the way back",
      so for device objects without children and for namespace walks of
      depth 1, as in the acpi_get_child() case, the "post-order" callbacks
      ordering is actually the same as the ordering of "pre-order" ones.
      Since that commit changed the namespace walk in acpi_get_child() to
      terminate after finding the first matching object instead of going
      through all of them and returning the last one, it effectively
      changed the result returned by that function in some rare cases and
      that led to problems (the switch from a "pre-order" to a "post-order"
      callback was supposed to prevent that from happening, but it was
      ineffective).
      
      As it turns out, the systems where the change made by commit
      33f767d7 actually matters are those where there are multiple ACPI
      device objects representing the same PCIe port (which effectively
      is a bridge).  Moreover, only one of them, and the one we are
      expected to use, has child device objects in the ACPI namespace,
      so the regression can be addressed as described above.
      
      References: https://bugzilla.kernel.org/show_bug.cgi?id=60561Reported-by: NPeter Wu <lekensteyn@gmail.com>
      Tested-by: NVladimir Lalov <mail@vlalov.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NBjorn Helgaas <bhelgaas@google.com>
      Cc: 3.9+ <stable@vger.kernel.org> # 3.9+
      60f75b8e
  4. 02 8月, 2013 1 次提交
    • T
      PCI: mvebu: Disable prefetchable memory support in PCI-to-PCI bridge · 36dd1f3e
      Thomas Petazzoni 提交于
      The Marvell PCIe driver uses an emulated PCI-to-PCI bridge to be able
      to dynamically set up MBus address decoding windows for PCI I/O and
      memory regions depending on the PCI devices enumerated by Linux.
      
      However, this emulated PCI-to-PCI bridge logic makes the Linux PCI
      core believe that prefetchable memory regions are supported (because
      the registers are read/write), while in fact no adress decoding window
      is ever created for such regions. Since the Marvell MBus address
      decoding windows do not distinguish memory regions and prefetchable
      memory regions, this patch takes a simple approach: change the
      PCI-to-PCI bridge emulation to let the Linux PCI core know that we
      don't support prefetchable memory regions.
      
      To achieve this, we simply make the prefetchable memory base a
      read-only register that always returns 0. Reading/writing all the
      other prefetchable memory related registers has no effect.
      
      This problem was originally reported by Finn Hoffmann
      <finn@uni-bremen.de>, who couldn't get a RTL8111/8168B PCI NIC working
      on the NSA310 Kirkwood platform after updating to 3.11-rc. The problem
      was that the PCI-to-PCI bridge emulation was making the Linux PCI core
      believe that we support prefetchable memory, so the Linux PCI core was
      only filling the prefetchable memory base and limit registers, which
      does not lead to a MBus window being created. The below patch has been
      confirmed by Finn Hoffmann to fix his problem on Kirkwood, and has
      otherwise been successfully tested on the Armada XP GP platform with a
      e1000e PCIe NIC and a Marvell SATA PCIe card.
      Reported-by: NFinn Hoffmann <finn@uni-bremen.de>
      Signed-off-by: NThomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      36dd1f3e
  5. 26 7月, 2013 4 次提交
  6. 24 7月, 2013 1 次提交
  7. 04 7月, 2013 1 次提交
  8. 29 6月, 2013 2 次提交
  9. 27 6月, 2013 4 次提交
  10. 24 6月, 2013 1 次提交
    • R
      ACPI / dock / PCI: Synchronous handling of dock events for PCI devices · 21a31013
      Rafael J. Wysocki 提交于
      The interactions between the ACPI dock driver and the ACPI-based PCI
      hotplug (acpiphp) are currently problematic because of ordering
      issues during hot-remove operations.
      
      First of all, the current ACPI glue code expects that physical
      devices will always be deleted before deleting the companion ACPI
      device objects.  Otherwise, acpi_unbind_one() will fail with a
      warning message printed to the kernel log, for example:
      
      [  185.026073] usb usb5: Oops, 'acpi_handle' corrupt
      [  185.035150] pci 0000:1b:00.0: Oops, 'acpi_handle' corrupt
      [  185.035515] pci 0000:18:02.0: Oops, 'acpi_handle' corrupt
      [  180.013656]  port1: Oops, 'acpi_handle' corrupt
      
      This means, in particular, that struct pci_dev objects have to
      be deleted before the struct acpi_device objects they are "glued"
      with.
      
      Now, the following happens the during the undocking of an ACPI-based
      dock station:
       1) hotplug_dock_devices() invokes registered hotplug callbacks to
          destroy physical devices associated with the ACPI device objects
          depending on the dock station.  It calls dd->ops->handler() for
          each of those device objects.
       2) For PCI devices dd->ops->handler() points to
          handle_hotplug_event_func() that queues up a separate work item
          to execute _handle_hotplug_event_func() for the given device and
          returns immediately.  That work item will be executed later.
       3) hotplug_dock_devices() calls dock_remove_acpi_device() for each
          device depending on the dock station.  This runs acpi_bus_trim()
          for each of them, which causes the underlying ACPI device object
          to be destroyed, but the work items queued up by
          handle_hotplug_event_func() haven't been started yet.
       4) _handle_hotplug_event_func() queued up in step 2) are executed
          and cause the above failure to happen, because the PCI devices
          they handle do not have the companion ACPI device objects any
          more (those objects have been deleted in step 3).
      
      The possible breakage doesn't end here, though, because
      hotplug_dock_devices() may return before at least some of the
      _handle_hotplug_event_func() work items spawned by it have a
      chance to complete and then undock() will cause _DCK to be
      evaluated and that will cause the devices handled by the
      _handle_hotplug_event_func() to go away possibly while they are
      being accessed.
      
      This means that dd->ops->handler() for PCI devices should not point
      to handle_hotplug_event_func().  Instead, it should point to a
      function that will do the work of _handle_hotplug_event_func()
      synchronously.  For this reason, introduce such a function,
      hotplug_event_func(), and modity acpiphp_dock_ops to point to
      it as the handler.
      
      Unfortunately, however, this is not sufficient, because if the dock
      code were not changed further, hotplug_event_func() would now
      deadlock with hotplug_dock_devices() that called it, since it would
      run unregister_hotplug_dock_device() which in turn would attempt to
      acquire the dock station's hp_lock mutex already acquired by
      hotplug_dock_devices().
      
      To resolve that deadlock use the observation that
      unregister_hotplug_dock_device() won't need to acquire hp_lock
      if PCI bridges the devices on the dock station depend on are
      prevented from being removed prematurely while the first loop in
      hotplug_dock_devices() is in progress.
      
      To make that possible, introduce a mechanism by which the callers of
      register_hotplug_dock_device() can provide "init" and "release"
      routines that will be executed, respectively, during the addition
      and removal of the physical device object associated with the
      given ACPI device handle.  Make acpiphp use two new functions,
      acpiphp_dock_init() and acpiphp_dock_release(), that call
      get_bridge() and put_bridge(), respectively, on the acpiphp bridge
      holding the given device, for this purpose.
      
      In addition to that, remove the dock station's list of
      "hotplug devices" and make the dock code always walk the whole list
      of "dependent devices" instead in such a way that the loops in
      hotplug_dock_devices() and dock_event() (replacing the loops over
      "hotplug devices") will take references to the list entries that
      register_hotplug_dock_device() has been called for.  That prevents
      the "release" routines associated with those entries from being
      called while the given entry is being processed and for PCI
      devices this means that their bridges won't be removed (by a
      concurrent thread) while hotplug_event_func() handling them is
      being executed.
      
      This change is based on two earlier patches from Jiang Liu.
      
      References: https://bugzilla.kernel.org/show_bug.cgi?id=59501Reported-and-tested-by: NAlexander E. Patrakov <patrakov@gmail.com>
      Tracked-down-by: NJiang Liu <jiang.liu@huawei.com>
      Tested-by: NIllya Klymov <xanf@xanf.me>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Cc: 3.9+ <stable@vger.kernel.org>
      21a31013
  11. 23 6月, 2013 1 次提交
    • J
      PCI / ACPI: Use boot-time resource allocation rules during hotplug · d66ecb72
      Jiang Liu 提交于
      On x86 platforms, the kernel respects PCI resource assignments from
      the BIOS and only reassigns resources for unassigned BARs at boot
      time.  However, with the ACPI-based hotplug (acpiphp), it ignores the
      BIOS' PCI resource assignments completely and reassigns all resources
      by itself.  This causes differences in PCI resource allocation
      between boot time and runtime hotplug to occur, which is generally
      undesirable and sometimes actively breaks things.
      
      Namely, if there are enough resources, reassigning all PCI resources
      during runtime hotplug should work, but it may fail if the resources
      are constrained.  This may happen, for instance, when some PCI
      devices with huge MMIO BARs are involved in the runtime hotplug
      operations, because the current PCI MMIO alignment algorithm may
      waste huge chunks of MMIO address space in those cases.
      
      On the Alexander's Sony VAIO VPCZ23A4R the BIOS allocates limited
      MMIO resources for the dock station which contains a device
      (graphics adapter) with a 256MB MMIO BAR.  An attempt to reassign
      that during runtime hotplug causes the dock station MMIO window to be
      exhausted and acpiphp fails to allocate resources for the majority
      of devices on the dock station as a result.
      
      To prevent that from happening, modify acpiphp to follow the boot
      time resources allocation behavior so that the BIOS' resource
      assignments are respected during runtime hotplug too.
      
      [rjw: Changelog]
      References: https://bugzilla.kernel.org/show_bug.cgi?id=56531Reported-and-tested-by: NAlexander E. Patrakov <patrakov@gmail.com>
      Tested-by: NIllya Klymov <xanf@xanf.me>
      Signed-off-by: NJiang Liu <jiang.liu@huawei.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Cc: 3.9+ <stable@vger.kernel.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      d66ecb72
  12. 19 6月, 2013 1 次提交
  13. 15 6月, 2013 5 次提交
    • B
      PCI: Return early on allocation failures to unindent mainline code · 05013486
      Bjorn Helgaas 提交于
      On allocation failure, return early so the main body of the function
      doesn't have to be indented as the body of an "if" statement.  No
      functional change.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      05013486
    • J
      PCI: Simplify IOV implementation and fix reference count races · dc087f2f
      Jiang Liu 提交于
      Trivial changes to IOV:
      
        1) use new PCI interfaces to simplify IOV implementation
        2) fix some reference count related race windows
      
      [bhelgaas: fix virtfn_add() add bus/alloc dev error paths]
      Signed-off-by: NJiang Liu <jiang.liu@huawei.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Cc: Donald Dutile <ddutile@redhat.com>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Ram Pai <linuxram@us.ibm.com>
      dc087f2f
    • J
      PCI: Drop redundant setting of bus->is_added in virtfn_add_bus() · d35329d9
      Jiang Liu 提交于
      The flag pci_bus->is_added is used to guard invocation of
      pcibios_fixup_bus(pci_bus).  When virtfn_add_bus() is called, the
      pci_bus->is_added flag has already been set, so remove the redundant
      
      	bus->is_added = 1;
      Signed-off-by: NJiang Liu <jiang.liu@huawei.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Cc: Donald Dutile <ddutile@redhat.com>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Ram Pai <linuxram@us.ibm.com>
      d35329d9
    • R
      PCI / ACPI / PM: Use correct power state strings in messages · fc6504b3
      Rafael J. Wysocki 提交于
      Make acpi_pci_set_power_state() print the name of the ACPI device
      power state the device has been actually put into instead of printing
      the name of the requested PCI device power state, which need not be
      the same.
      
      [bhelgaas: use ACPI_STATE_D3_COLD (ACPI_STATE_D3 == ACPI_STATE_D3_COLD)]
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      fc6504b3
    • K
      xen/pcifront: Deal with toolstack missing 'XenbusStateClosing' state. · 098b1aea
      Konrad Rzeszutek Wilk 提交于
      There are two tool-stack that can instruct the Xen PCI frontend
      and backend to change states: 'xm' (Python code with a daemon),
      and 'xl' (C library - does not keep state changes).
      
      With the 'xm', the path to disconnect a single PCI device (xm pci-detach
      <guest> <BDF>) is:
      
      4(Connected)->7(Reconfiguring*)-> 8(Reconfigured)-> 4(Connected)->5(Closing*).
      
      The * is for states that the tool-stack sets. For 'xl', it is similar:
      
      4(Connected)->7(Reconfiguring*)-> 8(Reconfigured)-> 4(Connected)
      
      Both of them also tear down the XenBus structure, so the backend
      state ends up going in the 3(Initialised) and calls pcifront_xenbus_remove.
      
      When a PCI device is plugged back in (xm pci-attach <guest> <BDF>)
      both of them follow the same pattern:
      
      2(InitWait*), 3(Initialized*), 4(Connected*)->4(Connected).
      
      [xen-pcifront ignores the 2,3 state changes and only acts when
      4 (Connected) has been reached]
      
      Note that this is for a _single_ PCI device. If there were two
      PCI devices and only one was disconnected 'xm' would show the same
      state changes.
      
      The problem is that git commit 3d925320
      ("xen/pcifront: Use Xen-SWIOTLB when initting if required") introduced
      a mechanism to initialize the SWIOTLB when the Xen PCI front moves to
      Connected state. It also had some aggressive seatbelt code check that
      would warn the user if one tried to change to Connected state without
      hitting first the Closing state:
      
       pcifront pci-0: PCI frontend already installed!
      
      However, that code can be relaxed and we can continue on working
      even if the frontend is instructed to be the 'Connected' state with
      no devices and then gets tickled to be in 'Connected' state again.
      
      In other words, this 4(Connected)->5(Closing)->4(Connected) state
      was expected, while 4(Connected)->.... anything but 5(Closing)->4(Connected)
      was not. This patch removes that aggressive check and allows
      Xen pcifront to work with the 'xl' toolstack (for one or more
      PCI devices) and with 'xm' toolstack (for more than two PCI
      devices).
      Acked-by: NBjorn Helgaas <bhelgaas@google.com>
      Cc: linux-pci@vger.kernel.org
      Cc: stable@vger.kernel.org
      [v2: Added in the description about two PCI devices]
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      098b1aea
  14. 11 6月, 2013 1 次提交
  15. 08 6月, 2013 2 次提交
  16. 07 6月, 2013 5 次提交
  17. 06 6月, 2013 2 次提交
  18. 05 6月, 2013 1 次提交
  19. 04 6月, 2013 3 次提交