1. 25 1月, 2013 1 次提交
  2. 01 12月, 2012 1 次提交
    • J
      s390/pci: PCI adapter interrupts for MSI/MSI-X · 9a4da8a5
      Jan Glauber 提交于
      Support PCI adapter interrupts using the Single-IRQ-mode. Single-IRQ-mode
      disables an adapter IRQ automatically after delivering it until the SIC
      instruction enables it again. This is used to reduce the number of IRQs
      for streaming workloads.
      
      Up to 64 MSI handlers can be registered per PCI function.
      A hash table is used to map interrupt numbers to MSI descriptors.
      The interrupt vector is scanned using the flogr instruction.
      Only MSI/MSI-X interrupts are supported, no legacy INTs.
      Signed-off-by: NJan Glauber <jang@linux.vnet.ibm.com>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      9a4da8a5
  3. 07 1月, 2012 4 次提交
    • K
      x86/PCI: Expand the x86_msi_ops to have a restore MSIs. · 76ccc297
      Konrad Rzeszutek Wilk 提交于
      The MSI restore function will become a function pointer in an
      x86_msi_ops struct. It defaults to the implementation in the
      io_apic.c and msi.c. We piggyback on the indirection mechanism
      introduced by "x86: Introduce x86_msi_ops".
      
      Cc: x86@kernel.org
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: linux-pci@vger.kernel.org
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      76ccc297
    • N
      PCI: msi: fix imbalanced refcount of msi irq sysfs objects · 424eb391
      Neil Horman 提交于
      This warning was recently reported to me:
      
      ------------[ cut here ]------------
      WARNING: at lib/kobject.c:595 kobject_put+0x50/0x60()
      Hardware name: VMware Virtual Platform
      kobject: '(null)' (ffff880027b0df40): is not initialized, yet kobject_put() is
      being called.
      Modules linked in: vmxnet3(+) vmw_balloon i2c_piix4 i2c_core shpchp raid10
      vmw_pvscsi
      Pid: 630, comm: modprobe Tainted: G        W   3.1.6-1.fc16.x86_64 #1
      Call Trace:
       [<ffffffff8106b73f>] warn_slowpath_common+0x7f/0xc0
       [<ffffffff8106b836>] warn_slowpath_fmt+0x46/0x50
       [<ffffffff810da293>] ? free_desc+0x63/0x70
       [<ffffffff812a9aa0>] kobject_put+0x50/0x60
       [<ffffffff812e4c25>] free_msi_irqs+0xd5/0x120
       [<ffffffff812e524c>] pci_enable_msi_block+0x24c/0x2c0
       [<ffffffffa017c273>] vmxnet3_alloc_intr_resources+0x173/0x240 [vmxnet3]
       [<ffffffffa0182e94>] vmxnet3_probe_device+0x615/0x834 [vmxnet3]
       [<ffffffff812d141c>] local_pci_probe+0x5c/0xd0
       [<ffffffff812d2cb9>] pci_device_probe+0x109/0x130
       [<ffffffff8138ba2c>] driver_probe_device+0x9c/0x2b0
       [<ffffffff8138bceb>] __driver_attach+0xab/0xb0
       [<ffffffff8138bc40>] ? driver_probe_device+0x2b0/0x2b0
       [<ffffffff8138bc40>] ? driver_probe_device+0x2b0/0x2b0
       [<ffffffff8138a8ac>] bus_for_each_dev+0x5c/0x90
       [<ffffffff8138b63e>] driver_attach+0x1e/0x20
       [<ffffffff8138b240>] bus_add_driver+0x1b0/0x2a0
       [<ffffffffa0188000>] ? 0xffffffffa0187fff
       [<ffffffff8138c246>] driver_register+0x76/0x140
       [<ffffffff815ca414>] ? printk+0x51/0x53
       [<ffffffffa0188000>] ? 0xffffffffa0187fff
       [<ffffffff812d2996>] __pci_register_driver+0x56/0xd0
       [<ffffffffa018803a>] vmxnet3_init_module+0x3a/0x3c [vmxnet3]
       [<ffffffff81002042>] do_one_initcall+0x42/0x180
       [<ffffffff810aad71>] sys_init_module+0x91/0x200
       [<ffffffff815dccc2>] system_call_fastpath+0x16/0x1b
      ---[ end trace 44593438a59a9558 ]---
      Using INTx interrupt, #Rx queues: 1.
      
      It occurs when populate_msi_sysfs fails, which in turn causes free_msi_irqs to
      be called.  Because populate_msi_sysfs fails, we never registered any of the
      msi irq sysfs objects, but free_msi_irqs still calls kobject_del and kobject_put
      on each of them, which gets flagged in the above stack trace.
      
      The fix is pretty straightforward.  We can key of the parent pointer in the
      kobject.  It is only set if the kobject_init_and_add succededs in
      populate_msi_sysfs.  If anything fails there, each kobject has its parent reset
      to NULL
      Signed-off-by: NNeil Horman <nhorman@tuxdriver.com>
      CC: Bjorn Helgaas <bhelgaas@google.com>
      CC: Greg Kroah-Hartman <gregkh@suse.de>
      CC: linux-pci@vger.kernel.org
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      424eb391
    • E
      PCI: msi: Disable msi interrupts when we initialize a pci device · d5dea7d9
      Eric W. Biederman 提交于
      I traced a nasty kexec on panic boot failure to the fact that we had
      screaming msi interrupts and we were not disabling the msi messages at
      kernel startup.  The booting kernel had not enabled those interupts so
      was not prepared to handle them.
      
      I can see no reason why we would ever want to leave the msi interrupts
      enabled at boot if something else has enabled those interrupts.  The pci
      spec specifies that msi interrupts should be off by default.  Drivers
      are expected to enable the msi interrupts if they want to use them.  Our
      interrupt handling code reprograms the interrupt handlers at boot and
      will not be be able to do anything useful with an unexpected interrupt.
      
      This patch applies cleanly all of the way back to 2.6.32 where I noticed
      the problem.
      
      Cc: stable@kernel.org
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      d5dea7d9
    • N
      PCI/sysfs: add per pci device msi[x] irq listing (v5) · da8d1c8b
      Neil Horman 提交于
      This patch adds a per-pci-device subdirectory in sysfs called:
      /sys/bus/pci/devices/<device>/msi_irqs
      
      This sub-directory exports the set of msi vectors allocated by a given
      pci device, by creating a numbered sub-directory for each vector beneath
      msi_irqs.  For each vector various attributes can be exported.
      Currently the only attribute is called mode, which tracks the
      operational mode of that vector (msi vs. msix)
      Acked-by: NGreg Kroah-Hartman <gregkh@suse.de>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      da8d1c8b
  4. 06 12月, 2011 2 次提交
    • E
      PCI: msi: Disable msi interrupts when we initialize a pci device · a776c491
      Eric W. Biederman 提交于
      I traced a nasty kexec on panic boot failure to the fact that we had
      screaming msi interrupts and we were not disabling the msi messages at
      kernel startup.  The booting kernel had not enabled those interupts so
      was not prepared to handle them.
      
      I can see no reason why we would ever want to leave the msi interrupts
      enabled at boot if something else has enabled those interrupts.  The pci
      spec specifies that msi interrupts should be off by default.  Drivers
      are expected to enable the msi interrupts if they want to use them.  Our
      interrupt handling code reprograms the interrupt handlers at boot and
      will not be be able to do anything useful with an unexpected interrupt.
      
      This patch applies cleanly all of the way back to 2.6.32 where I noticed
      the problem.
      
      Cc: stable@kernel.org
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      a776c491
    • N
      PCI/sysfs: add per pci device msi[x] irq listing (v5) · b50cac55
      Neil Horman 提交于
      This patch adds a per-pci-device subdirectory in sysfs called:
      /sys/bus/pci/devices/<device>/msi_irqs
      
      This sub-directory exports the set of msi vectors allocated by a given
      pci device, by creating a numbered sub-directory for each vector beneath
      msi_irqs.  For each vector various attributes can be exported.
      Currently the only attribute is called mode, which tracks the
      operational mode of that vector (msi vs. msix)
      Acked-by: NGreg Kroah-Hartman <gregkh@suse.de>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      b50cac55
  5. 01 11月, 2011 1 次提交
  6. 29 3月, 2011 1 次提交
  7. 24 12月, 2010 1 次提交
  8. 18 10月, 2010 1 次提交
  9. 12 10月, 2010 2 次提交
  10. 31 7月, 2010 3 次提交
  11. 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
  12. 10 9月, 2009 8 次提交
  13. 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
  14. 20 6月, 2009 2 次提交
  15. 19 6月, 2009 1 次提交
  16. 17 6月, 2009 1 次提交
  17. 12 6月, 2009 2 次提交
  18. 12 5月, 2009 1 次提交
  19. 21 3月, 2009 3 次提交