提交 57fbf52c 编写于 作者: M Michael S. Tsirkin 提交者: Jesse Barnes

PCI MSI: let drivers retry when not enough vectors

pci_enable_msix currently returns -EINVAL if you ask
for more vectors than supported by the device, which would
typically cause fallback to regular interrupts.

It's better to return the table size, making the driver retry
MSI-X with less vectors.
Reviewed-by: NMatthew Wilcox <willy@linux.intel.com>
Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
上级 8e822df7
...@@ -691,8 +691,8 @@ int pci_msix_table_size(struct pci_dev *dev) ...@@ -691,8 +691,8 @@ int pci_msix_table_size(struct pci_dev *dev)
* indicates the successful configuration of MSI-X capability structure * indicates the successful configuration of MSI-X capability structure
* with new allocated MSI-X irqs. A return of < 0 indicates a failure. * with new allocated MSI-X irqs. A return of < 0 indicates a failure.
* Or a return of > 0 indicates that driver request is exceeding the number * Or a return of > 0 indicates that driver request is exceeding the number
* of irqs available. Driver should use the returned value to re-send * of irqs or MSI-X vectors available. Driver should use the returned value to
* its request. * re-send its request.
**/ **/
int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec) int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec)
{ {
...@@ -708,7 +708,7 @@ int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec) ...@@ -708,7 +708,7 @@ int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec)
nr_entries = pci_msix_table_size(dev); nr_entries = pci_msix_table_size(dev);
if (nvec > nr_entries) if (nvec > nr_entries)
return -EINVAL; return nr_entries;
/* Check for any invalid entries */ /* Check for any invalid entries */
for (i = 0; i < nvec; i++) { for (i = 0; i < nvec; i++) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册