svn commit: r362355 - stable/12/sys/dev/ahci
Alexander Motin
mav at FreeBSD.org
Fri Jun 19 00:43:44 UTC 2020
Author: mav
Date: Fri Jun 19 00:43:44 2020
New Revision: 362355
URL: https://svnweb.freebsd.org/changeset/base/362355
Log:
MFC r361816: 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.
Modified:
stable/12/sys/dev/ahci/ahci_pci.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/sys/dev/ahci/ahci_pci.c
==============================================================================
--- stable/12/sys/dev/ahci/ahci_pci.c Fri Jun 19 00:26:30 2020 (r362354)
+++ stable/12/sys/dev/ahci/ahci_pci.c Fri Jun 19 00:43:44 2020 (r362355)
@@ -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;
More information about the svn-src-stable-12
mailing list