Limit AHCI to only one MSI if more is not needed.

My AMD Ryzen system has 4 AHCI controllers, each supporting 16 MSI vectors.
Since two of the controllers have only one SATA port, limit to single MSI
saves system 30 interrupt vectors for free.

It may be possible to also limit number of MSI vectors to 4 and 8 for the
other two controllers, but according to the AHCI specification after that
controllers may revert to only one vector, that would be a bigger loss to
risk.

MFC after:	2 weeks
This commit is contained in:
Alexander Motin 2020-06-05 02:21:46 +00:00
parent 52488b5148
commit abab2155ed
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=361816

View File

@ -470,6 +470,7 @@ ahci_pci_attach(device_t dev)
uint8_t revid = pci_get_revid(dev);
int msi_count, msix_count;
uint8_t table_bar = 0, pba_bar = 0;
uint32_t caps, pi;
msi_count = pci_msi_count(dev);
msix_count = pci_msix_count(dev);
@ -604,9 +605,12 @@ ahci_pci_attach(device_t dev)
/* Setup MSI register parameters */
/* Process hints. */
caps = ATA_INL(ctlr->r_mem, AHCI_CAP);
pi = ATA_INL(ctlr->r_mem, AHCI_PI);
if (ctlr->quirks & AHCI_Q_NOMSI)
ctlr->msi = 0;
else if (ctlr->quirks & AHCI_Q_1MSI)
else if ((ctlr->quirks & AHCI_Q_1MSI) ||
((caps & (AHCI_CAP_NPMASK | AHCI_CAP_CCCS)) == 0 && pi == 1))
ctlr->msi = 1;
else
ctlr->msi = 2;