1. 26 1月, 2013 2 次提交
  2. 19 1月, 2013 1 次提交
    • R
      ACPI / scan: Drop acpi_bus_add() and use acpi_bus_scan() instead · b8bd759a
      Rafael J. Wysocki 提交于
      The only difference between acpi_bus_scan() and acpi_bus_add() is the
      invocation of acpi_update_all_gpes() in the latter which in fact is
      unnecessary, because acpi_update_all_gpes() has already been called
      by acpi_scan_init() and the way it is implemented guarantees the next
      invocations of it to do nothing.
      
      For this reason, drop acpi_bus_add() and make all its callers use
      acpi_bus_scan() directly instead of it.  Additionally, rearrange the
      code in acpi_scan_init() slightly to improve the visibility of the
      acpi_update_all_gpes() call in there.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      b8bd759a
  3. 15 1月, 2013 1 次提交
  4. 03 1月, 2013 3 次提交
    • R
      ACPI: Make acpi_bus_scan() and acpi_bus_add() take only one argument · 0cd6ac52
      Rafael J. Wysocki 提交于
      The callers of acpi_bus_add() usually assume that if it has
      succeeded, then a struct acpi_device object has been attached to
      the handle passed as the first argument.  Unfortunately, however,
      this assumption is wrong, because acpi_bus_scan(), and acpi_bus_add()
      too as a result, may return a pointer to a different struct
      acpi_device object on success (it may be an object corresponding to
      one of the descendant ACPI nodes in the namespace scope below that
      handle).
      
      For this reason, the callers of acpi_bus_add() who care about
      whether or not a struct acpi_device object has been created for
      its first argument need to check that using acpi_bus_get_device()
      anyway, so the second argument of acpi_bus_add() is not really
      useful for them.  The same observation applies to acpi_bus_scan()
      executed directly from acpi_scan_init().
      
      Therefore modify the relevant callers of acpi_bus_add() to check the
      existence of the struct acpi_device in question with the help of
      acpi_bus_get_device() and drop the no longer necessary second
      argument of acpi_bus_add().  Accordingly, modify acpi_scan_init() to
      use acpi_bus_get_device() to get acpi_root and drop the no longer
      needed second argument of acpi_bus_scan().
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      0cd6ac52
    • R
      ACPI: Remove the arguments of acpi_bus_add() that are not used · 636458de
      Rafael J. Wysocki 提交于
      Notice that acpi_bus_add() uses only 2 of its 4 arguments and
      redefine its header to match the body.  Update all of its callers as
      necessary and observe that this leads to quite a number of removed
      lines of code (Linus will like that).
      
      Add a kerneldoc comment documenting acpi_bus_add() and wonder how
      its callers make wrong assumptions about the second argument (make
      note to self to take care of that later).
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      636458de
    • R
      ACPI: Remove acpi_start_single_object() and acpi_bus_start() · 02f57c67
      Rafael J. Wysocki 提交于
      The ACPI PCI root bridge driver was the only ACPI driver implementing
      the .start() callback, which isn't used by any ACPI drivers any more
      now.
      
      For this reason, acpi_start_single_object() has no purpose any more,
      so remove it and all references to it.  Also remove
      acpi_bus_start_device(), whose only purpose was to call
      acpi_start_single_object().
      
      Moreover, since after the removal of acpi_bus_start_device() the
      only purpose of acpi_bus_start() remains to call
      acpi_update_all_gpes(), move that into acpi_bus_add() and drop
      acpi_bus_start() too, remove its header from acpi_bus.h and
      update all of its former users accordingly.
      
      This change was previously proposed in a different from by
      Yinghai Lu.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      02f57c67
  5. 25 9月, 2012 2 次提交
    • J
      PCI: acpiphp: Handle PCIe ports without native hotplug capability · 5ba113f7
      Jiang Liu 提交于
      Commit 0d52f54e (PCI / ACPI: Make acpiphp
      ignore root bridges using PCIe native hotplug) added code that made the
      acpiphp driver completely ignore PCIe root complexes for which the kernel
      had been granted control of the native PCIe hotplug feature by the BIOS
      through _OSC. Later commit 619a5182
      "PCI hotplug: Always allow acpiphp to handle non-PCIe bridges" relaxed
      the constraints to allow acpiphp driver handle non-PCIe bridges under
      such a complex.  The constraint needs to be relaxed further to allow
      acpiphp driver to handle PCIe ports without native PCIe hotplug capability.
      
      Some MR-IOV switch chipsets, such PLX8696, support multiple virtual PCIe
      switches and may migrate downstream ports among virtual switches.  To
      migrate a downstream port from the source virtual switch to the target, the
      port needs to be hot-removed from the source and hot-added into the target.
      The pciehp driver can't be used here because there are no slots within the
      virtual PCIe switch.  So acpiphp driver is used to support downstream port
      migration.  A typical configuration is as below:
      
          [Root without native PCIe HP]
              [Upstream port of vswitch without native PCIe HP]
                  [Downstream port of vswitch with native PCIe HP]
                      [PCIe endpoint]
      
      Here acpiphp driver will be used to handle root ports and upstream port
      in the virtual switch, and pciehp driver will be used to handle downstream
      ports in the virtual switch.
      Signed-off-by: NJiang Liu <liuj97@gmail.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: NRafael J. Wysocki <rjw@sisk.pl>
      5ba113f7
    • T
      PCI/ACPI: Pass acpi_pci_root to acpi_pci_drivers' add/remove interface · 55bfe3c0
      Taku Izumi 提交于
      This patch changes .add/.remove interfaces of acpi_pci_driver.
      In the current implementation acpi_handle is passed as a parameter
      of .add/.remove interface.  However, the acpi_pci_root structure
      contains more useful information than just the acpi_handle.  This
      enables us to avoid some useless lookups in each acpi_pci_driver.
      
      Note: This changes interfaces used by acpi_pci_register_driver(), an
      exported symbol.  This patch updates all the in-kernel users, but any
      out-of-kernel acpi_pci_register_driver() users will need updates.
      
      [bhelgaas: changelog]
      Signed-off-by: NTaku Izumi <izumi.taku@jp.fujitsu.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      55bfe3c0
  6. 23 8月, 2012 2 次提交
  7. 18 8月, 2012 1 次提交
  8. 11 7月, 2012 1 次提交
  9. 21 6月, 2012 1 次提交
  10. 14 6月, 2012 3 次提交
  11. 28 2月, 2012 2 次提交
  12. 15 2月, 2012 1 次提交
    • A
      PCI: Can continually add funcs after adding func0 · f382a086
      Amos Kong 提交于
      Boot up a KVM guest, and hotplug multifunction
      devices(func1,func2,func0,func3) to guest.
      
      for i in 1 2 0 3;do
      qemu-img create /tmp/resize$i.qcow2 1G -f qcow2
      (qemu) drive_add 0x11.$i id=drv11$i,if=none,file=/tmp/resize$i.qcow2
      (qemu) device_add virtio-blk-pci,id=dev11$i,drive=drv11$i,addr=0x11.$i,multifunction=on
      done
      
      In linux kernel, when func0 of the slot is hot-added, the whole
      slot will be marked as 'enabled', then driver will ignore other new
      hotadded funcs.
      But in Win7 & WinXP, we can continaully add other funcs after adding
      func0, all funcs will be added in guest.
      
      drivers/pci/hotplug/acpiphp_glue.c:
      static int acpiphp_check_bridge(struct acpiphp_bridge *bridge)
      {
      ....
              for (slot = bridge->slots; slot; slot = slot->next) {
                      if (slot->flags & SLOT_ENABLED) {
                              acpiphp_disable_slot()
                      else
                              acpiphp_enable_slot()
      ....                              |
      }                                 v
                                  enable_device()
                                        |
                                        v
              //only don't enable slot if func0 is not added
      	list_for_each_entry(func, &slot->funcs, sibling) {
                     ...
              }
             slot->flags |= SLOT_ENABLED; //mark slot to 'enabled'
      
      This patch just make pci driver can continaully add funcs after adding
      func 0. Only mark slot to 'enabled' when all funcs are added.
      
      For pci multifunction hotplug, we can add functions one by one(func 0 is
      necessary), and all functions will be removed in one time.
      Signed-off-by: NAmos Kong <akong@redhat.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      f382a086
  13. 15 12月, 2011 1 次提交
    • A
      PCI: Set device power state to PCI_D0 for device without native PM support · b51306c6
      Ajaykumar Hotchandani 提交于
      During test of one IB card with guest VM, found that, msi is not
      initialized properly.
      
      It turns out __write_msi_msg will do nothing if device current_state is
      not PCI_D0.  And, that pci device does not have pm_cap in guest VM.
      
      There is an error in setting of power state to PCI_D0 in
      pci_enable_device(), but error is not returned for this.  Following is
      code flow:
      
      pci_enable_device() -->   __pci_enable_device_flags() -->
      do_pci_enable_device() -->   pci_set_power_state() -->
      __pci_start_power_transition()
      
      We have following condition inside __pci_start_power_transition():
               if (platform_pci_power_manageable(dev)) {
                       error = platform_pci_set_power_state(dev, state);
                       if (!error)
                               pci_update_current_state(dev, state);
               } else {
                       error = -ENODEV;
                       /* Fall back to PCI_D0 if native PM is not supported */
                       if (!dev->pm_cap)
                               dev->current_state = PCI_D0;
               }
      
      Here, from platform_pci_set_power_state(), acpi_pci_set_power_state() is
      getting called and that is failing with ENODEV because of following
      condition:
      
               if (!handle || ACPI_SUCCESS(acpi_get_handle(handle, "_EJ0",&tmp)))
                       return -ENODEV;
      
      Because of that, pci_update_current_state() is not getting called.
      
      With this patch, if device power state can not be set via
      platform_pci_set_power_state and that device does not have native pm
      support, then PCI device power state will be set to PCI_D0.
      
      -v2: This also reverts 47e9037a, as it's
           not needed after this change.
      Acked-by: N"Rafael J. Wysocki" <rjw@sisk.pl>
      Signed-off-by: Ajaykumar Hotchandani<ajaykumar.hotchandani@oracle.com>
      Signed-off-by: Yinghai Lu<yinghai.lu@oracle.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      b51306c6
  14. 14 12月, 2011 1 次提交
    • R
      PCI hotplug: Always allow acpiphp to handle non-PCIe bridges · 619a5182
      Rafael J. Wysocki 提交于
      Commit 0d52f54e (PCI / ACPI: Make
      acpiphp ignore root bridges using PCIe native hotplug) added code
      that made the acpiphp driver completely ignore PCIe root complexes
      for which the kernel had been granted control of the native PCIe
      hotplug feature by the BIOS through _OSC.  Unfortunately, however,
      this was a mistake, because on some systems there were PCI bridges
      supporting PCI (non-PCIe) hotplug under such root complexes and
      those bridges should have been handled by acpiphp.
      
      For this reason, revert the changes made by the commit mentioned
      above and make register_slot() in drivers/pci/hotplug/acpiphp_glue.c
      avoid registering hotplug slots for PCIe ports that belong to
      root complexes with native PCIe hotplug enabled (which means that
      the BIOS has granted the kernel control of this feature for the
      given root complex).  This is reported to address the original
      issue fixed by commit 0d52f54e and
      to work on the system where that commit broke things.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      619a5182
  15. 06 12月, 2011 1 次提交
    • R
      PCI/ACPI: Make acpiphp ignore root bridges using SHPC native hotplug · d90116ea
      Rafael J. Wysocki 提交于
      If the kernel has requested control of the SHPC native hotplug
      feature for a given root bridge, the acpiphp driver should not try
      to handle that root bridge and it should leave it to shpchp.
      Failing to do so causes problems to happen if shpchp is loaded
      and unloaded before loading acpiphp (ACPI-based hotplug won't work
      in that case anyway).
      
      To address this issue make find_root_bridges() ignore PCI root
      bridges with SHPC native hotplug enabled and make add_bridge()
      return error code if SHPC native hotplug is enabled for the given
      root bridge.  This causes acpiphp to refuse to load if SHPC native
      hotplug is enabled for all root bridges and to refuse binding to
      the root bridges with SHPC native hotplug enabled.
      Reviewed-by: NKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      d90116ea
  16. 01 11月, 2011 1 次提交
  17. 15 10月, 2011 1 次提交
    • P
      PCI hotplug: acpiphp: Prevent deadlock on PCI-to-PCI bridge remove · 6af8bef1
      Prarit Bhargava 提交于
      I originally submitted a patch to workaround this by pushing all Ejection
      Requests and Device Checks onto the kacpi_hotplug queue.
      
      http://marc.info/?l=linux-acpi&m=131678270930105&w=2
      
      The patch is still insufficient in that Bus Checks also need to be added.
      
      Rather than add all events, including non-PCI-hotplug events, to the
      hotplug queue, mjg suggested that a better approach would be to modify
      the acpiphp driver so only acpiphp events would be added to the
      kacpi_hotplug queue.
      
      It's a longer patch, but at least we maintain the benefit of having separate
      queues in ACPI.  This, of course, is still only a workaround the problem.
      As Bjorn and mjg pointed out, we have to refactor a lot of this code to do
      the right thing but at this point it is a better to have this code working.
      
      The acpi core places all events on the kacpi_notify queue.  When the acpiphp
      driver is loaded and a PCI card with a PCI-to-PCI bridge is removed the
      following call sequence occurs:
      
      cleanup_p2p_bridge()
      	    -> cleanup_bridge()
      		    -> acpi_remove_notify_handler()
      			    -> acpi_os_wait_events_complete()
      				    -> flush_workqueue(kacpi_notify_wq)
      
      which is the queue we are currently executing on and the process will hang.
      
      Move all hotplug acpiphp events onto the kacpi_hotplug workqueue.  In
      handle_hotplug_event_bridge() and handle_hotplug_event_func() we can simply
      push the rest of the work onto the kacpi_hotplug queue and then avoid the
      deadlock.
      Signed-off-by: NPrarit Bhargava <prarit@redhat.com>
      Cc: mjg@redhat.com
      Cc: bhelgaas@google.com
      Cc: linux-acpi@vger.kernel.org
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      6af8bef1
  18. 17 7月, 2011 1 次提交
  19. 12 5月, 2011 1 次提交
  20. 31 3月, 2011 1 次提交
  21. 05 3月, 2011 1 次提交
    • S
      PCI hotplug: acpiphp: set current_state to D0 in register_slot · 47e9037a
      Stefano Stabellini 提交于
      If a device doesn't support power management (pm_cap == 0) but it is
      acpi_pci_power_manageable() because there is a _PS0 method declared for
      it and _EJ0 is also declared for the slot then nobody is going to set
      current_state = PCI_D0 for this device.  This is what I think it is
      happening:
      
      pci_enable_device
          |
      __pci_enable_device_flags
      /* here we do not set current_state because !pm_cap */
          |
      do_pci_enable_device
          |
      pci_set_power_state
          |
      __pci_start_power_transition
          |
      pci_platform_power_transition
      /* platform_pci_power_manageable() calls acpi_pci_power_manageable that
       * returns true */
          |
      platform_pci_set_power_state
      /* acpi_pci_set_power_state gets called and does nothing because the
       * acpi device has _EJ0, see the comment "If the ACPI device has _EJ0,
       * ignore the device" */
      
      at this point if we refer to the commit message that introduced the
      comment above (10b3dcae), it is up to
      the hotplug driver to set the state to D0.
      However AFAICT the pci hotplug driver never does, in fact
      drivers/pci/hotplug/acpiphp_glue.c:register_slot sets the slot flags to
      (SLOT_ENABLED | SLOT_POWEREDON) but it does not set the pci device
      current state to PCI_D0.
      
      So my proposed fix is also to set current_state = PCI_D0 in
      register_slot.
      Comments are very welcome.
      Signed-off-by: NStefano Stabellini <stefano.stabellini@eu.citrix.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      47e9037a
  22. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  23. 15 3月, 2010 1 次提交
  24. 01 2月, 2010 1 次提交
  25. 25 11月, 2009 1 次提交
  26. 05 11月, 2009 2 次提交
  27. 15 9月, 2009 4 次提交
  28. 14 9月, 2009 1 次提交