git: 03acc85e3f2a - stable/13 - pci: Disable Electromechanical Interlock.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 18 Oct 2022 01:02:43 UTC
The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=03acc85e3f2aa5478ae6aa74dd5be7ed05d87a98 commit 03acc85e3f2aa5478ae6aa74dd5be7ed05d87a98 Author: Alexander Motin <mav@FreeBSD.org> AuthorDate: 2022-10-04 14:34:15 +0000 Commit: Alexander Motin <mav@FreeBSD.org> CommitDate: 2022-10-18 01:02:36 +0000 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 (cherry picked from commit a58536b91ae3931d222c3e4f1a949ff4a4927fb2) --- share/man/man4/pci.4 | 4 +++- sys/dev/pci/pci_pci.c | 8 +++++++- 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 0945606bbc50..b735da657a6c 100644 --- a/sys/dev/pci/pci_pci.c +++ b/sys/dev/pci/pci_pci.c @@ -1096,6 +1096,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) @@ -1135,7 +1140,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)