From nobody Tue Oct 21 05:47:47 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 4crLtD01PLz6Dt63; Tue, 21 Oct 2025 05:47: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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4crLtC5Lshz3Zqv; Tue, 21 Oct 2025 05:47:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1761025667; 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=CcMJ9kmFZu4J7k54V/4erqPMklYOLXGWwRGz8Nl61BM=; b=XFZAsRqU9vh6a636aFKR0LEZa4pH4PnXto2EMdaXhorm2UiiO6BU9vt3GfxQhkT1TR4N6o 6fx2fuWx8C42xaWI3BnH83p+ngcww+Fj5XSZhFcyWBwPHY8Eo676YD9qDhKAsKJ/b9rudk hJTkC02A2NJ2RRqy3nqplS0kng+yQNKqrt4wFmPXyzDOjUBEf0DLMkg17Co/zx/EvRbPm4 KSv+gxehuvIXDeXo/yQGwDNHz6zzYrpBNiV//QF/Q/PHIEGkfn2uXxmYy/8BgcMl2lz1Js aT/PAG3ylIocOERIs/vNOKlJYayiguAibElf1RyP5qor7/6QT+6WyjWvfDaAdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1761025667; 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=CcMJ9kmFZu4J7k54V/4erqPMklYOLXGWwRGz8Nl61BM=; b=DnvO/HT9aFMXHadyEmGr+gZcmci9pFXcmg3lLnJf+0wMimYzcN4F0Fju79dNcpJ/gg1ujL 4tbS6UnNQ2rmbqEnX7fLVKnJcnNqzy9YuH+ojcNZF4M8X6pneHYlLPW9zusDLzo6ckLQyB n/CjxGPJUzqoRHDGtrG19DUnoFIUTpoleuFLswrcqkar7tYIPcyVbHZF2jIikNS12SZIK8 QnATBJzgfRWa0gxhrQrupvPJBrdkY3ux7vgpFqhe0RRS3Qz8GCT5OKrmn0rpvvVlnGWdUL aSNa04Cr4x5t5u6N4ZPo00u7RDNd8IkrqWKjeXbaTCjd4cx1Gj5zyNsOzdcjFg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1761025667; a=rsa-sha256; cv=none; b=lmku/RDsBTt4jb0A0/yplIAJdTIs6nw0xp0k0B9cA+W2m89rZQW0zCGMIgVH5uRfZcct6k qmoo7wEqhBTEv1XmeAEbv7U+4dnoroy8JKP87XOOqu67AE1PHcRUl9wdx46i+X0pi+FQif 5tUTFxEfOGM2lRuO3CYS3qaQYljnkBSxexEUKTVVTBovRG5k4Nddlz5tR7nPzxVHES8N7t eV6+PkkStYDXFJFpHPS04ThDZ3hhYiEiZxa16K1dS69EoT0AoinBjVrQM2jAoUXZmbhpaL OGs3mozWKMJWtDocPrpp0TF5TAd10SnQ8GKlElcYqaJa5CIW7QdfapoMcC92mw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4crLtC4vrpzmnj; Tue, 21 Oct 2025 05:47:47 +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 59L5llC6072167; Tue, 21 Oct 2025 05:47:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 59L5llEG072164; Tue, 21 Oct 2025 05:47:47 GMT (envelope-from git) Date: Tue, 21 Oct 2025 05:47:47 GMT Message-Id: <202510210547.59L5llEG072164@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: cafb77e9e0d4 - releng/15.0 - pci: add quirk to disable Function-Level Reset (FLR) 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/releng/15.0 X-Git-Reftype: branch X-Git-Commit: cafb77e9e0d495408666cd99d9d2f5eb8e768735 Auto-Submitted: auto-generated The branch releng/15.0 has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=cafb77e9e0d495408666cd99d9d2f5eb8e768735 commit cafb77e9e0d495408666cd99d9d2f5eb8e768735 Author: Bjoern A. Zeeb AuthorDate: 2025-09-25 12:49:07 +0000 Commit: Colin Percival CommitDate: 2025-10-21 05:45:11 +0000 pci: add quirk to disable Function-Level Reset (FLR) MediaTek mt76 WiFi cards are advertising FLR support but after issuing a FLR the chipset is gone. Add a quirk so we can disable FLR. The current reset code will automatically fall back to a power reset. This makes the card show up under bhyve where before it would just not be discovered at all. That should make wifibox work for it and will help development for a LinuxKPI based mt76 driver as found in framework laptops as no dedicated machine and constant reboots are needed anymore. We will likely need to add more PCI vendor/device IDs once we can test the other device IDs. Approved by: re (cperciva) After a lot of help from: jhb Really implemented by: jhb (I just typed and tested) GH issue: github.com/pgj/freebsd-wifibox/issues/73 Reviewed by: imp, emaste Differential Revision: https://reviews.freebsd.org/D52728 (cherry picked from commit 4c0e53aced2251eb5ac7eca44e13a6b947be8582) (cherry picked from commit 3bd015a1a918d060dbef556ddfa6e236f5212330) --- sys/dev/pci/pci.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index 9e43a4c1909f..cde98cb62cef 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -240,6 +240,7 @@ struct pci_quirk { #define PCI_QUIRK_DISABLE_MSIX 5 /* MSI-X doesn't work */ #define PCI_QUIRK_MSI_INTX_BUG 6 /* PCIM_CMD_INTxDIS disables MSI */ #define PCI_QUIRK_REALLOC_BAR 7 /* Can't allocate memory at the default address */ +#define PCI_QUIRK_DISABLE_FLR 8 /* Function-Level Reset (FLR) not working. */ int arg1; int arg2; }; @@ -319,6 +320,13 @@ static const struct pci_quirk pci_quirks[] = { * expected place. */ { 0x98741002, PCI_QUIRK_REALLOC_BAR, 0, 0 }, + + /* + * With some MediaTek mt76 WiFi FLR does not work despite advertised. + */ + { 0x061614c3, PCI_QUIRK_DISABLE_FLR, 0, 0 }, /* mt76 7922 */ + + /* end of table */ { 0 } }; @@ -6740,6 +6748,8 @@ pcie_flr(device_t dev, u_int max_delay, bool force) if (!(pci_read_config(dev, cap + PCIER_DEVICE_CAP, 4) & PCIEM_CAP_FLR)) return (false); + if (pci_has_quirk(pci_get_devid(dev), PCI_QUIRK_DISABLE_FLR)) + return (false); /* * Disable busmastering to prevent generation of new