From nobody Wed Apr 16 03:18:58 2025 X-Original-To: dev-commits-src-branches@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 4ZcmTH1l7qz5str8; Wed, 16 Apr 2025 03:18:59 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ZcmTG5dZ5z3wfc; Wed, 16 Apr 2025 03:18:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1744773538; 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=i1eKPib/ofg1SYqSM4a3L68D1SHEo9kBombE1k4ElAM=; b=Ioq+EW+mxJaXjJQf287GtDySrOXWNzxAKQMpjEzA7tg4/P5VkPO1zkhQBVl/FKOap/rqz0 O/mJSlyQboTkJgP5qfOkpj6PYPsnrtDdMqh2VUyIGox3pss7HEYWltvaJEFHs0Bv9JH0GQ dmGfFkxFOCKpO99tlB6HJ0+WZDC1LYVYcFqHf/rzvg6fJZXQ9xYtwxXmK3MnrUBtCErs6G WIX63alBGXuMy3JbM8YVENOMvParxmyK/MDvWQIv8XMr8bCXj3STxceXgjb97gtziLU+4c LEWFfCVReFYyAWtvb3POFejzAOqEknFxDMwTkb9/KLKgDwFoWJOhDLkx/NzfZw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1744773538; a=rsa-sha256; cv=none; b=yo0S/JuZJIKjhrN6oSOsGt8phefnwv0+h46eYawBGe5loYz6Q5GSVwsrvJr9UT6PgFXvnY dy9sj34JY0PoGspklDLVfRWs0+wDojiaYEYT47ImODvXqM2vFpyq0aUAxwmc6TZQH8ltnM F+2Sb/t5SGzmgxKFY3PTfFNiGZZzIFm+wf6upmeKflH02jeqzpb799eAfyOGaX6GhlkDgi Ndyy8qcqo0FNv9ZKvgcD9C8A6I++dXwtZc9E4+jYZG1QJxHNGSVw/qLiBCSFH6H2UJlnKd mkmoAgkG6ARBNNqDFsjREgM1QTs5NYZIF8Lg1osgBX4asRMl+bfB+00FaHXf5g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1744773538; 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=i1eKPib/ofg1SYqSM4a3L68D1SHEo9kBombE1k4ElAM=; b=LdAzSzfaKKwJizFGIHlyjsXojQ4X9bf3SJtvH6+SEFZDbilzWhi0aNT+5nSCmZ+H6u8AtG O/k0AnqYADJSMAbO4iPkBXuVVT2XDgo7MTsxLnvXmm7PHXb83UxCMjOh1ZvQ4vuRs5OWZE JkSOWx/31mWODoGmF/wlVIGm8ytei+v+E0bYTT2ufX5iMxdgoeUPaQiej528XZ4IWLU130 pEBCB+qdIww+tqVwWM7tnBpuhBUjiZRvZX82Y295nL/CbDoViT847pPxFABLXB5RzY7ekF 6wKQ6ihCO0Uzh7RVk4Z3XHuq+/tFNVhdY2m6ymW2kTaiQXTsgSe2tLC9vXZVrw== 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 4ZcmTG59bdz11WR; Wed, 16 Apr 2025 03:18:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 53G3IwVL009133; Wed, 16 Apr 2025 03:18:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 53G3Iw0F009130; Wed, 16 Apr 2025 03:18:58 GMT (envelope-from git) Date: Wed, 16 Apr 2025 03:18:58 GMT Message-Id: <202504160318.53G3Iw0F009130@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Colin Percival Subject: git: 217fce137713 - stable/14 - pci: Make PCIe Eject timeout configurable List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 217fce137713ab7f44783c28681ebd4cfcd1465d Auto-Submitted: auto-generated The branch stable/14 has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=217fce137713ab7f44783c28681ebd4cfcd1465d commit 217fce137713ab7f44783c28681ebd4cfcd1465d Author: Colin Percival AuthorDate: 2025-03-31 04:08:44 +0000 Commit: Colin Percival CommitDate: 2025-04-16 03:15:00 +0000 pci: Make PCIe Eject timeout configurable PCIe mandates a 5 second delay between when the "Attention Button" is pressed and when the associated device is detached; this is to allow for the button to be pressed a second time to cancel the ejection. On some systems this 5 second delay may not be desireable; so introduce a hw.pci.pcie_hp_detach_timeout sysctl (which can also be set as a loader tunable) which specifies the timeout in milliseconds (default 5000). If set to zero, the device is detached immediately. Reviewed by: jhb MFC after: 2 weeks Sponsored by: Amazon Differential Revision: https://reviews.freebsd.org/D49585 (cherry picked from commit 9be42ee6c9c741052bdc49f13bc953bf88a24423) --- sys/dev/pci/pci_pci.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/sys/dev/pci/pci_pci.c b/sys/dev/pci/pci_pci.c index 06e8c2bc8433..a9567b3e2c4c 100644 --- a/sys/dev/pci/pci_pci.c +++ b/sys/dev/pci/pci_pci.c @@ -951,6 +951,11 @@ SYSCTL_INT(_hw_pci, OID_AUTO, enable_pcie_hp, CTLFLAG_RDTUN, &pci_enable_pcie_hp, 0, "Enable support for native PCI-express HotPlug."); +static sbintime_t pcie_hp_detach_timeout = 5 * SBT_1S; +SYSCTL_SBINTIME_MSEC(_hw_pci, OID_AUTO, pcie_hp_detach_timeout, CTLFLAG_RWTUN, + &pcie_hp_detach_timeout, + "Attention Button delay for PCI-express Eject."); + TASKQUEUE_DEFINE_THREAD(pci_hp); static void @@ -1221,11 +1226,17 @@ pcib_pcie_intr_hotplug(void *arg) &sc->pcie_ab_task, NULL); } else if (old_slot_sta & PCIEM_SLOT_STA_PDS) { /* Only initiate detach sequence if device present. */ - device_printf(dev, - "Attention Button Pressed: Detaching in 5 seconds\n"); - sc->flags |= PCIB_DETACH_PENDING; - taskqueue_enqueue_timeout(taskqueue_pci_hp, - &sc->pcie_ab_task, 5 * hz); + if (pcie_hp_detach_timeout != 0) { + device_printf(dev, + "Attention Button Pressed: Detaching in %ld ms\n", + (long)(pcie_hp_detach_timeout / SBT_1MS)); + sc->flags |= PCIB_DETACH_PENDING; + taskqueue_enqueue_timeout_sbt(taskqueue_pci_hp, + &sc->pcie_ab_task, pcie_hp_detach_timeout, + SBT_1S, 0); + } else { + sc->flags |= PCIB_DETACHING; + } } } if (sc->pcie_slot_sta & PCIEM_SLOT_STA_PFD)