linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dennis Chen <dennis.chen@arm.com>
To: <linux-pci@vger.kernel.org>
Cc: linux-ide@vger.kernel.org,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Steve Capper <steve.capper@arm.com>,
	Marc Zyngier <marc.zyngier@arm.com>,
	Tom Long Nguyen <tom.l.nguyen@intel.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Tejun Heo <tj@kernel.org>, Dennis Chen <dennis.chen@arm.com>,
	nd@arm.com, Christoph Hellwig <hch@lst.de>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH] PCI:MSI Return -ENOSPC when requested vectors is not enough
Date: Thu, 1 Dec 2016 10:15:04 +0800	[thread overview]
Message-ID: <1480558504-18691-1-git-send-email-dennis.chen@arm.com> (raw)

The __pci_enable_msi_range() should return -ENOSPC instead of -EINVAL
when the device doesn't have enough vectors as required, just as the 
MSI-X vector allocator does in __pci_enable_msix_range(). Otherwise, 
some drivers depending on that return value will probably fallback to
the legacy interrupt directly, for example, in commit 17a51f12cfbd2814
("ahci: only try to use multi-MSI mode if there is more than 1 port"), the
ahci driver will fallback to single MSI mode only when the return value
is -ENOSPC in case of required vectors is not enough, else the driver will
use legacy interrupt which has been observed on a x86 box with 6-port SATA
controller.

With this patch, when a MSI-capable device doesn't have enough MSI
vectors as requested, it will fallback to single MSI mode while not
legacy interrupt.

Signed-off-by: Dennis Chen <dennis.chen@arm.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Tom Long Nguyen <tom.l.nguyen@intel.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Steve Capper <steve.capper@arm.com>
Cc: linux-ide@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
---
 drivers/pci/msi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index ad70507..da37113 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -1084,7 +1084,7 @@ static int __pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec,
 	if (nvec < 0)
 		return nvec;
 	if (nvec < minvec)
-		return -EINVAL;
+		return -ENOSPC;
 
 	if (nvec > maxvec)
 		nvec = maxvec;
-- 
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

             reply	other threads:[~2016-12-01  2:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-01  2:15 Dennis Chen [this message]
2016-12-01  8:52 ` [PATCH] PCI:MSI Return -ENOSPC when requested vectors is not enough Christoph Hellwig
2016-12-02  6:04   ` Dennis Chen
2017-01-11 18:18 ` Bjorn Helgaas
2017-01-12 13:42   ` Christoph Hellwig
2017-02-10 22:16 ` Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1480558504-18691-1-git-send-email-dennis.chen@arm.com \
    --to=dennis.chen@arm.com \
    --cc=bhelgaas@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hch@lst.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=marc.zyngier@arm.com \
    --cc=nd@arm.com \
    --cc=steve.capper@arm.com \
    --cc=tj@kernel.org \
    --cc=tom.l.nguyen@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).