From nobody Tue Oct 04 14:44:15 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MhgSw0wNvz4f1P5; Tue, 4 Oct 2022 14:44:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MhgSw00ypz3pMd; Tue, 4 Oct 2022 14:44:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664894656; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Z+6SNkHufEt9QvYadF4hs6Sco8nirp93n8iDmL/S1jg=; b=Fg3SadLtnqGOhLDJNweiBCpLasYMtM8hzZH3v38cb4P1eWov3g2pQ1lqOTA0xoXDKpjNMx Zn4YLQcHqCKasAOLWuTaQl1Nl/QPd16/G5+jCQ4oH4AiS0f1fx5TLwaSFLIw95+SBe9SDs 5ymsn8MuM9vbHwSkNB26Saj9LEmlRB+CA1GeOadAjpClHnzLvPnxr0R8FTHc4rGHDypCo2 /Bfm3gJ0sd6M06AkmRfPCUwZOdZJR7L86SpYC9l6aDSejRtK0k7GrBx5eaSA5J5oJBg+Vg FWpwe8x+t2E/gr6J7PXSVoEtPodsXS/GmaHy1Zsm2AvfRvoRXHxLHC+0aStajQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MhgSv5mV4zbd6; Tue, 4 Oct 2022 14:44:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 294EiF0J021814; Tue, 4 Oct 2022 14:44:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 294EiFlt021813; Tue, 4 Oct 2022 14:44:15 GMT (envelope-from git) Date: Tue, 4 Oct 2022 14:44:15 GMT Message-Id: <202210041444.294EiFlt021813@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: a58536b91ae3 - main - pci: Disable Electromechanical Interlock. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a58536b91ae3931d222c3e4f1a949ff4a4927fb2 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664894656; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Z+6SNkHufEt9QvYadF4hs6Sco8nirp93n8iDmL/S1jg=; b=CM1U9Is69yECgzLYehNgvb9H7M+h0zfb1Rr2G+QA8Gdg73YGQejQsc/vdpGPpKDDO44bIr ne2m7d2MI609DsnkEvRrV1YAvOwG1hAT4MEq4UjW5SezKUn4uoeMb/mP5o9tzO1IA8R8SX REO+7tE2bNNnrZaJLi17azQJHxQcDMbdHDXnaU372MCksY2DVMPr1rTJf9wwsOiulGmWaf JrxjA5TZHjSmJu1awM09aJo7WLPdPkfcVxb/Mpa7d6CcsClCPWVSXT1rlu5vQTu5ku2X8o /qh7nNDsPDlur2dcVZF78w7BSIN6gunugjp3Bh/ayQfU1hc5wi8NQLBzsp/bPA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1664894656; a=rsa-sha256; cv=none; b=GSJFUsVFTQw/rKDQY8+J29Ir9jhAIENJZ2SNv1F3GkbS7hIDsPvsfRL1YK0yzarFHP98h1 eO4lQyR/WInW5rvUfb/g/NVJNt69+5QkY0GjyJEp+2jgz1AfRg8gE/0ywZInt3d26KL5A1 ayAGGQdZ0+0aO95qsBlWwIoI8e5624ISu2N590f846JdTtMNf/tlyfZeZqhv2BlasbwoFU YRqMbnUsaVIq2PkDeRodOtbQ2ybPAHMsF/VW+3sOdxBvGgt347toLhaG9CJ+SCaW0ukMcX s7LMEQPhTtBvfgkj/cmsCPI1evJcQsSK02BSX2qpdsPzGmokoSjKC08bZDPivg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=a58536b91ae3931d222c3e4f1a949ff4a4927fb2 commit a58536b91ae3931d222c3e4f1a949ff4a4927fb2 Author: Alexander Motin AuthorDate: 2022-10-04 14:34:15 +0000 Commit: Alexander Motin CommitDate: 2022-10-04 14:34:15 +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 --- 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 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)