From nobody Sat Apr 26 19:21:48 2025 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 4ZlKMc2l08z5tf8l; Sat, 26 Apr 2025 19:21:48 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ZlKMc0x97z3G4L; Sat, 26 Apr 2025 19:21:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1745695308; 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=3pjc4do7Sqds9T9hBtGx/5klrH/T1GuMCsBCi/Vp/2M=; b=tEhza/GoYGkjERX0WBm8YP6yLMQZkCMlg/3ir1dOYOdh0ajBuwGLACsMAFQ7zLYrP1J29d LZ9lejUMxFt4AepV+xMCfmrJAlNr1vyxqky2QvsV7Qz/ynEAXlx0nt0lThafF/KQ81QJEY 3aqwVKPSmz154efEvYmTHvBV51BdkkRzcoO86fgY6mA9lAKXNw6zaXIpQxflUSAHwhfvuf udifZhztEH4D+CF7BMKik4kVmiTbVmKgp3gaOfn38Apl/V9dP1XV2l3O3nLqZ7o7277g2v uUTqANdwfexjwH6SDnD+sMYwRSuSf3VkFMeDeGYkwIL6CfYFP5nEGtUX4U9Bag== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1745695308; a=rsa-sha256; cv=none; b=FvVXS9ZHkGIoAc9eVL1jWh0nDChwVYKyc3bDzJk4M41dqUyzJh9/mjkTCjvlznDHF+weY6 F+EeTTqxUXh+5PJNZtKmL9fX5P2DTCelklQvjVjct1ZDpm2r1H7hUjCz/0dYcZTVYf6FZW SqdOjqweioFablYHs9FvkteN7MI6LqLGPM70Kctz5epDh8p+5Ao+laFvKD9chO8XXL6mx1 R+TBf3jaGfQhj9Sea8k73CDqaAhBabokvgCv8CRHIB0Y0v9HVjGC6XKiDxPnoPDezWO57i xAwI2ke19kHW4oeMPUYhnNFlS2JSv1JeC6s1vdS8j0T4FbZyBR/eWk5qD3Qlbw== 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=1745695308; 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=3pjc4do7Sqds9T9hBtGx/5klrH/T1GuMCsBCi/Vp/2M=; b=paT0CPZlw/VvupLaP83dBqHqxE9qyjLo+QM2hvpdhUIHiOfyoq87K9X6IVv0nANgMb6YB/ EAoRpSWtGx4HKaJvCqCRy4Sg6xO2USmvAvZz3XpCOv3Nwc/cSNZO/S5x3KVtqBRJ0hajmk wmn8M4Az8yOg5L4J77rqq31YyF7M0/a5uBINteGRsZtAXgKxnp1zCey1qayyjEEMYN+jI8 QPluiOe8IiZHYJbsZBKFKXAWQeJbgCE2Uw3HE9cL2LiVYBRpjKW7sX+iaYYQrjnf1ziubk l4BCy5ug3gUsa+yMrlBC28MovNJMHQZwEgLKfki7qSuKM/oxyx+ZPo4DX34XVg== 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 4ZlKMc0THWzZTj; Sat, 26 Apr 2025 19:21:48 +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 53QJLmie009595; Sat, 26 Apr 2025 19:21:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 53QJLmhm009592; Sat, 26 Apr 2025 19:21:48 GMT (envelope-from git) Date: Sat, 26 Apr 2025 19:21:48 GMT Message-Id: <202504261921.53QJLmhm009592@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: b0bbefc465ee - stable/14 - pci: Add hw.pci.intx_reroute sysctl/tunable 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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: b0bbefc465ee00deec8fb753fc0e4d0ecb7e4aff Auto-Submitted: auto-generated The branch stable/14 has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=b0bbefc465ee00deec8fb753fc0e4d0ecb7e4aff commit b0bbefc465ee00deec8fb753fc0e4d0ecb7e4aff Author: Colin Percival AuthorDate: 2025-04-15 19:30:30 +0000 Commit: Colin Percival CommitDate: 2025-04-26 19:21:03 +0000 pci: Add hw.pci.intx_reroute sysctl/tunable INTRng can leak resources when INTx interrupts are re-routed, which is typically harmless but can be fatal when devices are (repeatedly) hot plugged into PCI buses on INTRng systems. Re-routing INTx interrupts is nonetheless still necessary on some systems, and identifying whether the re-routing should be enabled or disabled seems to be nontrivial. Add a hw.pci.intx_reroute sysctl/tunable so systems which don't want legacy PCI interrupt re-routing can turn it off. This is probably not the best fix but it's something which can be safely included in FreeBSD 14.3. Co-Authored-by: jhb Reviewed by: bz, jhb MFC after: 3 days Sponsored by: Amazon Differential Revision: https://reviews.freebsd.org/D49849 (cherry picked from commit 2187ec93ada1c7399f2f3537920f6277bec4a0ef) --- sys/dev/pci/pci.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index 102027123976..dde50afd9319 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -431,6 +431,10 @@ SYSCTL_BOOL(_hw_pci, OID_AUTO, enable_mps_tune, CTLFLAG_RWTUN, &pci_enable_mps_tune, 1, "Enable tuning of MPS(maximum payload size)." ); +static bool pci_intx_reroute = true; +SYSCTL_BOOL(_hw_pci, OID_AUTO, intx_reroute, CTLFLAG_RWTUN, + &pci_intx_reroute, 0, "Re-route INTx interrupts when scanning devices"); + static int pci_has_quirk(uint32_t devid, int quirk) { @@ -4097,7 +4101,8 @@ pci_add_resources(device_t bus, device_t dev, int force, uint32_t prefetchmask) if (q->devid == devid && q->type == PCI_QUIRK_MAP_REG) pci_add_map(bus, dev, q->arg1, rl, force, 0); - if (cfg->intpin > 0 && PCI_INTERRUPT_VALID(cfg->intline)) { + if (cfg->intpin > 0 && PCI_INTERRUPT_VALID(cfg->intline) && + pci_intx_reroute) { #ifdef __PCI_REROUTE_INTERRUPT /* * Try to re-route interrupts. Sometimes the BIOS or