aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2022-10-04 14:34:15 +0000
committerAlexander Motin <mav@FreeBSD.org>2022-10-04 14:34:15 +0000
commita58536b91ae3931d222c3e4f1a949ff4a4927fb2 (patch)
tree18cb1684c73edfaa743bdd8fdce3bdcd98c990e6
parent1d41a055578704a28b34820e0aaf14a29f28f413 (diff)
downloadsrc-a58536b91ae3931d222c3e4f1a949ff4a4927fb2.tar.gz
src-a58536b91ae3931d222c3e4f1a949ff4a4927fb2.zip
pci: Disable Electromechanical Interlock.
Add sysctl/tunable to control Electromechanical Interlock support. Disable it by default since Linux does not do it either and it seems the number of systems having it broken is higher than having working. This fixes NVMe backplane operation on ASUS RS500A-E11-RS12U server with AMD EPYC 7402 CPU, where attempts to control reported interlock for some reason end up in PCIe link loss, while interlock status does not change (it is not really there). MFC after: 2 weeks
-rw-r--r--share/man/man4/pci.44
-rw-r--r--sys/dev/pci/pci_pci.c8
2 files changed, 10 insertions, 2 deletions
diff --git a/share/man/man4/pci.4 b/share/man/man4/pci.4
index 3c2c08afe466..f7535aa86d12 100644
--- a/share/man/man4/pci.4
+++ b/share/man/man4/pci.4
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd August 13, 2021
+.Dd October 4, 2022
.Dt PCI 4
.Os
.Sh NAME
@@ -572,6 +572,8 @@ MSI interrupts can be disabled by setting this tunable to 0.
Enable support for extended Message Signalled Interrupts
.Pq MSI-X .
MSI-X interrupts can be disabled by setting this tunable to 0.
+.It Va hw.pci.enable_pcie_ei Pq Defaults to 0
+Enable support for PCI-express Electromechanical Interlock.
.It Va hw.pci.enable_pcie_hp Pq Defaults to 1
Enable support for native PCI-express HotPlug.
.It Va hw.pci.honor_msi_blacklist Pq Defaults to 1
diff --git a/sys/dev/pci/pci_pci.c b/sys/dev/pci/pci_pci.c
index 886279ae9340..a2b0d1f556aa 100644
--- a/sys/dev/pci/pci_pci.c
+++ b/sys/dev/pci/pci_pci.c
@@ -1093,6 +1093,11 @@ pcib_hotplug_present(struct pcib_softc *sc)
return (-1);
}
+static int pci_enable_pcie_ei = 0;
+SYSCTL_INT(_hw_pci, OID_AUTO, enable_pcie_ei, CTLFLAG_RWTUN,
+ &pci_enable_pcie_ei, 0,
+ "Enable support for PCI-express Electromechanical Interlock.");
+
static void
pcib_pcie_hotplug_update(struct pcib_softc *sc, uint16_t val, uint16_t mask,
bool schedule_task)
@@ -1132,7 +1137,8 @@ pcib_pcie_hotplug_update(struct pcib_softc *sc, uint16_t val, uint16_t mask,
* process of detaching), disable the Electromechanical
* Interlock.
*/
- if (sc->pcie_slot_cap & PCIEM_SLOT_CAP_EIP) {
+ if ((sc->pcie_slot_cap & PCIEM_SLOT_CAP_EIP) &&
+ pci_enable_pcie_ei) {
mask |= PCIEM_SLOT_CTL_EIC;
ei_engaged = (sc->pcie_slot_sta & PCIEM_SLOT_STA_EIS) != 0;
if (card_inserted != ei_engaged)