1. 24 8月, 2012 2 次提交
  2. 24 7月, 2012 1 次提交
  3. 16 7月, 2012 1 次提交
    • J
      PCI: hotplug: ensure a consistent return value in error case · 83d05710
      Julia Lawall 提交于
      Typically, the return value desired for the failure of a function with an
      integer return value is a negative integer.  In these cases, the return
      value is sometimes a negative integer and sometimes 0, due to a subsequent
      initialization of the return variable within the loop.
      
      A simplified version of the semantic match that finds this problem is:
      (http://coccinelle.lip6.fr/)
      
      //<smpl>
      @r exists@
      identifier ret;
      position p;
      constant C;
      expression e1,e3,e4;
      statement S;
      @@
      
      ret = -C
      ... when != ret = e3
          when any
      if@p (...) S
      ... when any
      if (\(ret != 0\|ret < 0\|ret > 0\) || ...) { ... return ...; }
      ... when != ret = e3
          when any
      *if@p (...)
      {
        ... when != ret = e4
        return ret;
      }
      //</smpl>
      
      [bhelgaas: squashed into one patch]
      Signed-off-by: NJulia Lawall <Julia.Lawall@lip6.fr>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      83d05710
  4. 13 7月, 2012 1 次提交
  5. 11 7月, 2012 2 次提交
  6. 21 6月, 2012 2 次提交
  7. 14 6月, 2012 14 次提交
  8. 28 2月, 2012 2 次提交
  9. 15 2月, 2012 8 次提交
    • D
      PCI hotplug: cpcihp: fix debug module parameter to be bool · 309c6651
      Danny Kukawka 提交于
      Fix debug variable from module parameter to be really bool to
      fix 'warning: return from incompatible pointer type'.
      Acked-by: NScott Murray <scott@spiteful.org>
      Signed-off-by: NDanny Kukawka <danny.kukawka@bisect.de>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      309c6651
    • Y
      PCI: pciehp: Disable/enable link during slot power off/on · 2debd928
      Yinghai Lu 提交于
      On a system with a repeater on the system board to support gen2 hotplug,
      we found that when an ExpressModule is removed from some slots,
      /var/log/messages will be full of "card present/not present" warnings.
      
      It turns out the root complex is continually trying to train the link to
      the repeater because the repeater has not been reset.
      
      This patch will disable the link at removal time to allow the repeater
      to be reset properly.  This also prevents a potential AER message at
      removal time.
      
      Also, when testing hotplug on a system under development, we found if we
      boot the system without an EM installed, and later hot-add an EM, it
      does not work with Linux, but another OS is ok.  The root cause is that
      BIOS left link disabled when slot was empty at boot time, and other OS
      is modifying the link disable bit in link ctrl during power on/off.
      
      So we should do the same thing to disable/enable link during power off/on.
      
      -v2: check link DLLA bit instead of 100ms waiting.
           Separate link disable/enable functions to another patch.
      Signed-off-by: NYinghai Lu <yinghai.lu@oracle.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      2debd928
    • Y
      PCI: pciehp: Add Disable/enable link functions · 7f822999
      Yinghai Lu 提交于
      Will use it during power off/on of slots
      Signed-off-by: NYinghai Lu <yinghai.lu@oracle.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      7f822999
    • Y
      PCI: pciehp: Add pcie_wait_link_not_active() · bffe4f72
      Yinghai Lu 提交于
      Will use it for link disable status checking.
      Signed-off-by: NYinghai Lu <yinghai.lu@oracle.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      bffe4f72
    • Y
      PCI: pciehp: make check_link_active more helpful · 4e2ce405
      Yinghai Lu 提交于
      A few changes:
        - remove the 'inline' and let the complier decide
        - return a bool to indicate whether the link was active
        - add a debug message to indicate link state when it beocmes active
      Signed-off-by: NYinghai Lu <yinghai@kernel.org>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      4e2ce405
    • Y
      PCI: pciehp: replace unconditional sleep with config space access check · 2f5d8e4f
      Yinghai Lu 提交于
      During reviewing
      |	PCI: pciehp: wait 1000 ms before Link Training check
      Linus said:
      >...
      > That's a *long* time, and it's irritating to the user. It makes the
      > user think "the machine is slow".
      >...
      > And quite frankly, an unconditional one-second delay here seems bad.
      >Two seconds was unacceptable, one second is just bad.
      
      Try to access the pci conf of a pci device that is supposed to show up
      in 1s.  If we can read back a valid vendor/device id, we can return
      early.
      
      Related discussion could be found:
      	https://lkml.org/lkml/2011/12/6/339
      
      -v2: seperate code to pci_bus_read_dev_vendor_id() from pci_scan_device()
          and reuse it from pciehp code. Suggested by Matthew Wilcox.
      -v3: According to Kenj, don't use array in stack, and don't wait too long
          for crs, also return fail status if not found.
          Also separate pci_bus_dev_read_vendor_id() change to another patch.
      Signed-off-by: NYinghai Lu <yinghai@kernel.org>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      2f5d8e4f
    • J
      PCI: drivers/pci/hotplug/ibmphp_ebda.c: add missing iounmap · 8f0cdddc
      Julia Lawall 提交于
      Add missing iounmap in error handling code, in a case where the function
      already preforms iounmap on some other execution path.
      
      A simplified version of the semantic match that finds this problem is as
      follows: (http://coccinelle.lip6.fr/)
      
      // <smpl>
      @@
      expression e;
      statement S,S1;
      int ret;
      @@
      e = \(ioremap\|ioremap_nocache\)(...)
      ... when != iounmap(e)
      if (<+...e...+>) S
      ... when any
          when != iounmap(e)
      *if (...)
         { ... when != iounmap(e)
           return ...; }
      ... when any
      iounmap(e);
      // </smpl>
      Signed-off-by: NJulia Lawall <Julia.Lawall@lip6.fr>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      8f0cdddc
    • 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
  10. 13 1月, 2012 1 次提交
  11. 07 1月, 2012 2 次提交
  12. 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
  13. 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
  14. 06 12月, 2011 2 次提交