1. 10 9月, 2009 7 次提交
  2. 30 6月, 2009 4 次提交
    • H
      PCI MSI: Fix restoration of MSI/MSI-X mask states in suspend/resume · 12abb8ba
      Hidetoshi Seto 提交于
      There are 2 problems on mask states in suspend/resume.
      
      [1]:
      It is better to restore the mask states of MSI/MSI-X to initial states
      (MSI is unmasked, MSI-X is masked) when we release the device.
      The pci_msi_shutdown() does the restoration of mask states for MSI,
      while the msi_free_irqs() does it for MSI-X.  In other words, in the
      "disable" path both of MSI and MSI-X are handled, but in the "shutdown"
      path only MSI is handled.
      
      MSI:
         pci_disable_msi()
            => pci_msi_shutdown()
               [ mask states for MSI restored ]
               => msi_set_enable(dev, pos, 0);
            => msi_free_irqs()
      
      MSI-X:
         pci_disable_msix()
            => pci_msix_shutdown()
               => msix_set_enable(dev, 0);
            => msix_free_all_irqs
               => msi_free_irqs()
                  [ mask states for MSI-X restored ]
      
      This patch moves the masking for MSI-X from msi_free_irqs() to
      pci_msix_shutdown().
      
      This change has some positive side effects:
       - It prevents OS from touching mask states before reading preserved
         bits in the register, which can be happen if msi_free_irqs() is
         called from error path in msix_capability_init().
       - It also prevents touching the register after turning off MSI-X in
         "disable" path, which can be a problem on some devices.
      
      [2]:
      We have cache of the mask state in msi_desc, which is automatically
      updated when msi/msix_mask_irq() is called.  This cached states are
      used for the resume.
      
      But since what need to be restored in the resume is the states before
      the shutdown on the suspend, calling msi/msix_mask_irq() from
      pci_msi/msix_shutdown() is not appropriate.
      
      This patch introduces __msi/msix_mask_irq() that do mask as same
      as msi/msix_mask_irq() but does not update cached state, for use
      in pci_msi/msix_shutdown().
      
      [updated: get rid of msi/msix_mask_irq_nocache() (proposed by Matthew Wilcox)]
      Reviewed-by: NMatthew Wilcox <willy@linux.intel.com>
      Signed-off-by: NHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      12abb8ba
    • H
      PCI MSI: Unmask MSI if setup failed · 7ba1930d
      Hidetoshi Seto 提交于
      The initial state of mask register of MSI is unmasked.  We set it
      masked before calling arch_setup_msi_irqs().  If arch_setup_msi_irq()
      fails, it is better to restore the state of the mask register.
      Reviewed-by: NMatthew Wilcox <willy@linux.intel.com>
      Signed-off-by: NHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      7ba1930d
    • H
      PCI MSI: shorten PCI_MSIX_ENTRY_* symbol names · 2c21fd4b
      Hidetoshi Seto 提交于
      These names are too long!  Drop _OFFSET to save some bytes/lines.
      Reviewed-by: NMatthew Wilcox <willy@linux.intel.com>
      Signed-off-by: NHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      2c21fd4b
    • H
      PCI MSI: Return if alloc_msi_entry for MSI-X failed · 0d073489
      Hidetoshi Seto 提交于
      In current code it continues setup even if alloc_msi_entry() for MSI-X
      is failed due to lack of memory.  It means arch_setup_msi_irqs() might
      be called with msi_desc entries less than its argument nvec.
      
      At least x86's arch_setup_msi_irqs() uses list_for_each_entry() for
      dev->msi_list that suspected to have entries same numbers as nvec, and
      it doesn't check the number of allocated vectors and passed arg nvec.
      Therefore it will result in success of pci_enable_msix(), with less
      vectors allocated than requested.
      
      This patch fixes the error route to return -ENOMEM, instead of continuing
      the setup (proposed by Matthew Wilcox).
      
      Note that there is no iounmap in msi_free_irqs() if no msi_disc is
      allocated.
      Reviewed-by: NMatthew Wilcox <matthew@wil.cx>
      Signed-off-by: NHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      0d073489
  3. 20 6月, 2009 2 次提交
  4. 19 6月, 2009 1 次提交
  5. 17 6月, 2009 1 次提交
  6. 12 6月, 2009 2 次提交
  7. 12 5月, 2009 1 次提交
  8. 21 3月, 2009 5 次提交
  9. 20 3月, 2009 3 次提交
    • M
      PCI/MSI: Allow arch code to return the number of MSI-X available · b5fbf533
      Michael Ellerman 提交于
      There is code in msix_capability_init() which, when the requested number
      of MSI-X couldn't be allocated, calculates how many MSI-X /could/ be
      allocated and returns that to the driver. That allows the driver to then
      make a second request, with a number of MSIs that should succeed.
      
      The current code requires the arch code to setup as many msi_descs as it
      can, and then return to the generic code. On some platforms the arch
      code may already know how many MSI-X it can allocate, before it sets up
      any of the msi_descs.
      
      So change the logic such that if the arch code returns a positive error
      code, that is taken to be the number of MSI-X that could be allocated.
      If the error code is negative we still calculate the number available
      using the old method.
      
      Because it's a little subtle, make sure the error return code from
      arch_setup_msi_irq() is always negative. That way only implementations
      of arch_setup_msi_irqs() need to be careful about returning a positive
      error code.
      Signed-off-by: NMichael Ellerman <michael@ellerman.id.au>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      b5fbf533
    • M
      PCI/MSI: Use #ifdefs instead of weak functions · 11df1f05
      Michael Ellerman 提交于
      Weak functions aren't all they're cracked up to be. They lead to
      incorrect binaries with some toolchains, they require us to have empty
      functions we otherwise wouldn't, and the unused code is not elided
      (as of gcc 4.3.2 anyway).
      
      So replace the weak MSI arch hooks with the #define foo foo idiom. We no
      longer need empty versions of arch_setup/teardown_msi_irq().
      
      This is less source (by 1 line!), and results in smaller binaries too:
      
         text	   data	    bss	    dec	    hex	filename
      9354300	1693916	 678424	11726640 b2ef30	build/powerpc/vmlinux-before
      9354052	1693852	 678424	11726328 b2edf8	build/powerpc/vmlinux-after
      
      Also smaller on x86_64 and arm (iop13xx).
      Signed-off-by: NMichael Ellerman <michael@ellerman.id.au>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      11df1f05
    • R
      PCI/MSI: Introduce pci_msix_table_size() · a52e2e35
      Rafael J. Wysocki 提交于
      Introduce new function pci_msix_table_size() returning the size of
      the MSI-X table of given PCI device or 0 if the device doesn't
      support MSI-X.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Reviewed-by: NHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      a52e2e35
  10. 14 2月, 2009 1 次提交
  11. 28 1月, 2009 1 次提交
  12. 17 1月, 2009 1 次提交
  13. 08 1月, 2009 1 次提交
  14. 08 12月, 2008 1 次提交
  15. 23 10月, 2008 1 次提交
  16. 21 10月, 2008 1 次提交
  17. 07 8月, 2008 1 次提交
  18. 29 7月, 2008 1 次提交
  19. 26 6月, 2008 1 次提交
    • B
      PCI: use dev_printk when possible · 80ccba11
      Bjorn Helgaas 提交于
      Convert printks to use dev_printk().
      
      I converted pr_debug() to dev_dbg().  Both use KERN_DEBUG and are enabled
      only when DEBUG is defined.
      
      I converted printk(KERN_DEBUG) to dev_printk(KERN_DEBUG), not to dev_dbg(),
      because dev_dbg() is only enabled when DEBUG is defined.
      
      I converted DBG(KERN_INFO) (only in setup-bus.c) to dev_info().  The DBG()
      name makes it sound like debug, but it's been enabled forever, so dev_info()
      preserves the previous behavior.
      
      I tried to make the resource assignment formats more consistent, e.g.,
        "BAR %d: got res [%#llx-%#llx] bus [%#llx-%#llx] flags %#lx\n"
      instead of sometimes using "start-end" and sometimes using "size@start".
      I'm not attached to one or the other; I'd just like them consistent.
      Signed-off-by: NBjorn Helgaas <bjorn.helgaas@hp.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      80ccba11
  20. 11 6月, 2008 1 次提交
  21. 30 4月, 2008 2 次提交
    • Y
      pci/irq: let pci_device_shutdown to call pci_msi_shutdown v2 · d52877c7
      Yinghai Lu 提交于
      [PATCH 2/2] pci/irq: let pci_device_shutdown to call pci_msi_shutdown v2
      
      this change
      
      | commit 23a274c8
      | Author: Prakash, Sathya <sathya.prakash@lsi.com>
      | Date:   Fri Mar 7 15:53:21 2008 +0530
      |
      |     [SCSI] mpt fusion: Enable MSI by default for SAS controllers
      |
      |     This patch modifies the driver to enable MSI by default for all SAS chips.
      |
      |     Signed-off-by: Sathya Prakash <sathya.prakash@lsi.com>
      |     Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
      |
      Causes the kexec of a RHEL 5.1 kernel to fail.
      
      root casue: the rhel 5.1 kernel still uses INTx emulation.  and
      mptscsih_shutdown doesn't call pci_disable_msi to reenable INTx on kexec path
      
      So call pci_msi_shutdown in the shutdown path to do the same thing to msix
      Signed-off-by: NYinghai Lu <yhlu.kernel@gmail.com>
      Signed-off-by: NJesse Barnes <jbarnes@hobbes.lan>
      d52877c7
    • Y
      pci/irq: restore mask_bits in msi shutdown -v3 · 8e149e09
      Yinghai Lu 提交于
      [PATCH 1/2] pci/irq: restore mask_bits in msi shutdown -v3
      
      Yinghai found that kexec'ing a RHEL 5.1 kernel with 2.6.25-rc3+ kernels
      prevents his NIC from working.  He bisected to
      
      | commit 89d694b9
      | Author: Thomas Gleixner <tglx@linutronix.de>
      | Date:   Mon Feb 18 18:25:17 2008 +0100
      |
      |   genirq: do not leave interupts enabled on free_irq
      |
      |   The default_disable() function was changed in commit:
      |
      |    76d21601
      |    genirq: do not mask interrupts by default
      |
      
      For MSI, default_shutdown will call mask_bit for msi device.  All mask bits
      will left disabled after free_irq.  Then in the kexec case, the next kernel
      can only use msi_enable bit, so all device's MSI can not be used.
      
      So lets to restore the mask bit to its pci reset defined value (enabled) when
      we disable the kernels use of msi to be a little friendlier to kexec'd kernels.
      
      Extend msi_set_mask_bit to msi_set_mask_bits to take mask, so we can fully
      restore that to 0x00 instead of 0xfe.
      Signed-off-by: NYinghai Lu <yhlu.kernel@gmail.com>
      Signed-off-by: NJesse Barnes <jbarnes@hobbes.lan>
      8e149e09
  22. 02 2月, 2008 1 次提交
    • A
      PCI: drivers/pci/msi.c: move arch hooks to the top · 6a9e7f20
      Adrian Bunk 提交于
      This patch fixes the following problem present with older gcc versions:
      
      <--  snip  -->
      
      ...
        CC      drivers/pci/msi.o
      /home/bunk/linux/kernel-2.6/git/linux-2.6/drivers/pci/msi.c:692: warning: weak declaration of `arch_msi_check_device' after first use results in unspecified behavior
      /home/bunk/linux/kernel-2.6/git/linux-2.6/drivers/pci/msi.c:704: warning: weak declaration of `arch_setup_msi_irqs' after first use results in unspecified behavior
      /home/bunk/linux/kernel-2.6/git/linux-2.6/drivers/pci/msi.c:724: warning: weak declaration of `arch_teardown_msi_irqs' after first use results in unspecified behavior
      ...
      
      <--  snip  -->
      Signed-off-by: NAdrian Bunk <bunk@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      6a9e7f20