From nobody Tue Oct 18 01:02:43 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 4MrwZX01F1z4fG12; Tue, 18 Oct 2022 01:02:44 +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 4MrwZW5PxZz3Hyr; Tue, 18 Oct 2022 01:02:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1666054963; 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=I0pxTX3rfagfc4xH675k2FeuFCbmEavrphd9osL9zcQ=; b=vxyoHp6B8yU4a2hbtQaXUY17kQS6GtYRTnWfbkBG+MGk2A7lcSCv+i1sxBCjWb8FulWX/R cziZp1lY7f418xfLiOuPtTvJQ7UxX37xzFhA1D1tD0v/0lf9wMFqno+zkITCNGcUr6jprq Obk35E1bGfllhkyb4lcegHWZ1LRwh5Tv3UVLmn32E4YA6bNkbQhQF2JGb5u+lzEhQoapes rjoAZStbnHbow3AfkSHOxubv498oSnJWCcmEQ0dZnh+vXu5Vl8s5ekG/DgfMUoEks3U/+v nJHvnwNbFSLtsjhGFXGUhQAcCxp5OF+K8lzOQOSeYmPr3ZrpIVmGhY7Y8f66NQ== 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 4MrwZW4CzYz11X4; Tue, 18 Oct 2022 01:02:43 +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 29I12hdD024698; Tue, 18 Oct 2022 01:02:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 29I12hj7024697; Tue, 18 Oct 2022 01:02:43 GMT (envelope-from git) Date: Tue, 18 Oct 2022 01:02:43 GMT Message-Id: <202210180102.29I12hj7024697@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 03acc85e3f2a - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 03acc85e3f2aa5478ae6aa74dd5be7ed05d87a98 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1666054963; 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=I0pxTX3rfagfc4xH675k2FeuFCbmEavrphd9osL9zcQ=; b=vM37dw9AfDzoJkgjwDZZobwoP4JiCZpx34+kaAfvwD6FKB26V94RpT1Z6BaQv01oxTBLi3 vUF3Fcexqaflok12jNkihzUxWludeC1yE6YwZx/kagQa6EGZRQFnf7+gCD4ICXrXza/iar 2fkGLGUmaAHe4IgLAdSx6IFU8aUym6s1nfpeI/6bqoHzcn3804nRpS/9kW75fOrrGzbiSl 7RFKtEQh44pR0/XghEfgFk1aCT04A5emqh1NZ62X+LdvZAqIiulpG7W+C+VNl+66cyh49Z WWs3Yp4tnjHHcrCT4XKnVGU5RyDVHPrMVk6tOgmEG+ZSDhDKa9a/ycyuEXyxPg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1666054963; a=rsa-sha256; cv=none; b=E8eHejN01BL6hIwu1OGu6cqcgXtP1KxxKiIFLRtGk7WZtNOLE+RpNVxZle8lMlL6I3n0m9 94YC1NMsjiUYCgzQLN6ESc/yF3pVLYkbeYGOnUV+RgnDuZIwYmmcSBUTe5YshPMBmeLEUw R35/vdYrUtXG4ZciVfOseQVVf5IdErVP/dv/LazEjHUhbWfX5ZwaVlp8j6vWu0LPHA85x1 GDGqXAQ4pOk5VJV00f7+pkxiOG/XMqBwizjkjNp6LRpu6Af5HoLWN0wp8A9uzpdU/EBkbL qdrtOoG3XhnfOTIe9ZjK6A7kPAcWDZIa4mjPynS3zwCTosxfXFkOFFE6U1+MXQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=03acc85e3f2aa5478ae6aa74dd5be7ed05d87a98 commit 03acc85e3f2aa5478ae6aa74dd5be7ed05d87a98 Author: Alexander Motin AuthorDate: 2022-10-04 14:34:15 +0000 Commit: Alexander Motin 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)