From nobody Sat Oct 4 18:30:36 2025 X-Original-To: dev-commits-src-main@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 4cfDcD672Fz69XXY; Sat, 04 Oct 2025 18:30:36 +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 4cfDcD5cBnz3hjR; Sat, 04 Oct 2025 18:30:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759602636; 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=GIvqY99Sjde+PPEY0xgAjiI6m4C9ZS4y/QDCMzlEMUw=; b=FWEGm6HQBVmsTSia9aAT8tD6iw+xaSGuZ0DPOKUoL6UGlUE/RFnetXA0TWqBDqZ9rmx0vF d7UDkbe2pv5C20OYXBnZcl2FeYghH+hFCqPSX1h84URHM/R/hHjQx14nYaVwp5Zo/NtePe nSEDLSJaG+eQO9bKnRs1xoQYP71NR8p59AsEOvcypm77/zVuIGDtUeKvJZxC5mZSKAwex3 V9hsjusDwq8f2B0H5si9/iBkGSz8taFflOuwaLSUuBJc8H8X4KIO/X/cDezXJVT1JN3gNr L3D4mvFB6KGKuYzSgUT1dRgAYwjSYBDueLJMumMuoHOxG2Ywurp1t3s+xtTpWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759602636; 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=GIvqY99Sjde+PPEY0xgAjiI6m4C9ZS4y/QDCMzlEMUw=; b=Hi0r3goE6FbsZZOAJGiJgIGIKlJM89NfOlAFMXtW2Kmj6wXAf5LixtJrq5dllybfJiD51Z /sAAIvMscrlHy+7Yso57WYR1w/gs5b/e/a97WwHvTU61GtrG9AWRmdx25vaIp8ntRKmNgT NS1bfyWlLFqosZT0Uzu4HKulvEe3Z3zKudE/7SuD1rHcp/7bUsZP5tREYC+2EpfDHTLGgF pWgrqhp+ELX7ky852sjYSgrcQQnqvWbtj3ni/HKIuK6fYo2RIhT5foJSvKq1p4bRxtJDuF lliJ3ui/4C/KhDb8BW4YK8uAuFOHEE2ytDRKjSvoChJvukKvmenv7vL1Hcgapw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1759602636; a=rsa-sha256; cv=none; b=iAieUM5kPQ+NrBYE1zGRQoPXfgUZ4dpRZqSV1+iUtTiugNQfhjnuieeQqFjGMQnfxSlbBv sdbsOsvKJBIuQp/otYC/T9uWcFe+C8bsI0jcZa+5WG5skS9QwDeJVLCOrfvpEUt69ALx1f Yn3BKkpLIKjhkCXT96bwZAFvTLW2TAoHBsu/QR/HSTBGZJCLdXSlvzULxtmdJ9b7lZDVqI uTFlX//eUXJRxCf7asnpDxK8c6kx5izANlyoU+vk+sfEmCEmwCKgzfCMwrCinrMaisQxiC yeAVf9O4cqNe1GfB5/o9VKWTORx+R7mDP298p1yOPTwQF1WimVIPH8AbdbbWHA== 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 4cfDcD5Bg0ztFr; Sat, 04 Oct 2025 18:30:36 +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 594IUaxE057399; Sat, 4 Oct 2025 18:30:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 594IUaXY057396; Sat, 4 Oct 2025 18:30:36 GMT (envelope-from git) Date: Sat, 4 Oct 2025 18:30:36 GMT Message-Id: <202510041830.594IUaXY057396@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 4c0e53aced22 - main - pci: add quirk to disable Function-Level Reset (FLR) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4c0e53aced2251eb5ac7eca44e13a6b947be8582 Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=4c0e53aced2251eb5ac7eca44e13a6b947be8582 commit 4c0e53aced2251eb5ac7eca44e13a6b947be8582 Author: Bjoern A. Zeeb AuthorDate: 2025-09-25 12:49:07 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-10-04 18:28:39 +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. Event: EuroBSDCon Devsummit 2025 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 MFC after: 3 days Reviewed by: imp, emaste Differential Revision: https://reviews.freebsd.org/D52728 --- 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