From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Return-Path: From: Dennis Chen To: Subject: [PATCH] PCI:MSI Return -ENOSPC when requested vectors is not enough Date: Thu, 1 Dec 2016 10:15:04 +0800 Message-ID: <1480558504-18691-1-git-send-email-dennis.chen@arm.com> MIME-Version: 1.0 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-ide@vger.kernel.org, Lorenzo Pieralisi , Steve Capper , Marc Zyngier , Tom Long Nguyen , Bjorn Helgaas , Greg Kroah-Hartman , Tejun Heo , Dennis Chen , nd@arm.com, Christoph Hellwig , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+bjorn=helgaas.com@lists.infradead.org List-ID: 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 Cc: Tejun Heo Cc: Christoph Hellwig Cc: Tom Long Nguyen Cc: Bjorn Helgaas Cc: Greg Kroah-Hartman Cc: Marc Zyngier Cc: Lorenzo Pieralisi Cc: Steve Capper 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