PCI/MSI/pSeries: Fix wrong error code reporting

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
PCI/MSI/pSeries: Fix racy quota check

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
PCI/MSI/s390: Fix single MSI only check

Multiple MSIs have never been supported on s390 architecture,
but the platform code fails to report single MSI only.

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
PCI/MSI/s390: Remove superfluous check of MSI type

arch_setup_msi_irqs() hook can only be called from the generic
MSI code which ensures correct MSI type parameter.

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
PCI/MSI: Factor out pci_get_msi_cap() interface

This update is needed to facilitate a forthcoming re-design
MSI/MSI-X interrupts enabling pattern.

Device drivers will use this interface to obtain maximum number
of MSI interrupts the device supports and use that value in the
following call to pci_enable_msi_block() interface.

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
PCI/MSI: Get rid of pci_enable_msi_block_auto() interface

As result of introduction of pci_get_msi_cap() interface
pci_enable_msi_block_auto() function became superflous.

To enable maximum possible number of MSIs drivers will
first obtain that number from pci_get_msi_cap() function
and then call pci_enable_msi_block() interface.

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
PCI/MSI: Convert pci_msix_table_size() to a public interface

Make pci_msix_table_size() return error code if the device
does not support MSI-X. This update is needed to create a
consistent MSI-X counterpart for recently introduced MSI
interface pci_get_msi_cap().

Device drivers can use this interface to obtain maximum number
of MSI-X interrupts the device supports and use that value in
the following call to pci_enable_msix() interface.

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
PCI/MSI: Introduce pcim_enable_msi*/msix*() interfaces

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
megaraid: Make use of pcim_enable_msix() interface

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
ipr: Do not call pci_disable_msi/msix() if pci_enable_msi/msix() failed

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
ipr: Make use of pcim_enable_msi/msix() interfaces

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
ixgbe: Make use of pcim_enable_msix_range() interface

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
ixgbevf: Make use of pcim_enable_msix_range() interface

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
ntb: Fix missed call to pci_enable_msix()

Current MSI-X enablement code assumes MSI-Xs were successfully
allocated in case less than requested vectors were available.
That assumption is wrong, since MSI-Xs should be enabled with
a repeated call to pci_enable_msix(). This update fixes this.

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
ntb: Make use of pcim_enable_msix/msix_exact() interfaces

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
vmxnet3: Return -EINVAL if number of requested MSI-Xs is not enough

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
vmxnet3: Fixup a weird loop exit

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
vmxnet3: Return -ENOSPC when not enough MSI-X vectors available

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
vmxnet3: Limit number of rx queues to 1 if per-queue MSI-Xs failed

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
vmxnet3: Make use of pcim_enable_msix_range() interface

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>