mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-05-09 08:43:46 +00:00
ahci: only try to use multi-MSI mode if there is more than 1 port
We should only try to allocate multiple MSI or MSI-X vectors if the device
actually has multiple ports. Otherwise pci_alloc_irq_vectors will return
a single vector due to n_ports = 1, in which case we shouldn't set the
AHCI_HFLAG_MULTI_MSI flag.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Fixes: 0b9e2988
("ahci: use pci_alloc_irq_vectors")
Reported-by: Emmanuel Benisty <benisty.e@gmail.com>
Tested-by: Emmanuel Benisty <benisty.e@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
This commit is contained in:
parent
1001354ca3
commit
17a51f12cf
1 changed files with 17 additions and 14 deletions
|
@ -1418,6 +1418,7 @@ static int ahci_init_msi(struct pci_dev *pdev, unsigned int n_ports,
|
||||||
* Message mode could be enforced. In this case assume that advantage
|
* Message mode could be enforced. In this case assume that advantage
|
||||||
* of multipe MSIs is negated and use single MSI mode instead.
|
* of multipe MSIs is negated and use single MSI mode instead.
|
||||||
*/
|
*/
|
||||||
|
if (n_ports > 1) {
|
||||||
nvec = pci_alloc_irq_vectors(pdev, n_ports, INT_MAX,
|
nvec = pci_alloc_irq_vectors(pdev, n_ports, INT_MAX,
|
||||||
PCI_IRQ_MSIX | PCI_IRQ_MSI);
|
PCI_IRQ_MSIX | PCI_IRQ_MSI);
|
||||||
if (nvec > 0) {
|
if (nvec > 0) {
|
||||||
|
@ -1428,12 +1429,14 @@ static int ahci_init_msi(struct pci_dev *pdev, unsigned int n_ports,
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fallback to single MSI mode if the controller enforced MRSM
|
* Fallback to single MSI mode if the controller
|
||||||
* mode.
|
* enforced MRSM mode.
|
||||||
*/
|
*/
|
||||||
printk(KERN_INFO "ahci: MRSM is on, fallback to single MSI\n");
|
printk(KERN_INFO
|
||||||
|
"ahci: MRSM is on, fallback to single MSI\n");
|
||||||
pci_free_irq_vectors(pdev);
|
pci_free_irq_vectors(pdev);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* -ENOSPC indicated we don't have enough vectors. Don't bother trying
|
* -ENOSPC indicated we don't have enough vectors. Don't bother trying
|
||||||
|
|
Loading…
Add table
Reference in a new issue