From nobody Mon Oct 20 18:34:21 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 4cr3xB0ZRnz6Ctwy; Mon, 20 Oct 2025 18:34:22 +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 4cr3x96wGLz44hT; Mon, 20 Oct 2025 18:34:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1760985262; 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=Kh25teKZPTxBCudyx7fG6hdRSiPX57hx1f5gIC8dW1k=; b=v2+UWiXbSE6hZoKQQteTRu4jU4wwGYVGzWGKVKvDU8BeeP+urqnR8nGDm33a5mVrww9Qi4 8hUUV+zyN9d7fmFVhekHTiNkXDPPasBoHQg77FaOic/EW/4s1L3tG2ZRku2GBBAWhYcc8k Kq0xUkIxv8Mo0mKIMedPz2wuEn/nY1GQaSDcVr4uJDyaC5bdVejz9nEW7HMzzb7a2DTEzF 8Kd5FfGHmvgvwz60+A8+X5zjowX5kqaD2WOOZ6Agwk09nDcLfzzu1KiM+6Ndma3vh/U3S9 ZADb2fHlPh9Z+sKGiQCbF1LjMOh5Wf0rn81YBU/isoGe6Huy83uqtCHrsz5tRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1760985262; 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=Kh25teKZPTxBCudyx7fG6hdRSiPX57hx1f5gIC8dW1k=; b=UMxZeofbRkQXfkSi8VtqapfND86jEpS/bv573qlo8WVyG6MX/H0lmNlcNIJURT+6z5A9kF 6bqJa3bnpZkfKlOF1YRmWFEhAxiHZvrBHz3wwmko2Y9i5HBJ2xh5++iD79wY2XT87EwHXn 5VEGGd5j0pC+o+5FCJN8gorjyhC+xux+jGd8PJyy8IMXIpGXDHl97NEDaNb/VtOcJGPYGz Lldqogf7QCePJJpPy5k1YoPufjLxqIvk4vJKbVJLQVxCM70y8YSsPY8rxBQ9PsGBJ1n9qr cGbc2K2CE9XKmw7clmBNC5VB0F4bnijZuAcPi/8yCXRXU5oIVC3GsgN8t9/AGw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1760985262; a=rsa-sha256; cv=none; b=hp6ac5aZ6/F3kPWTxPPBLWf5pOEQB2Fhdzj+2C6PGcZqqfgGmhOWY/r+IoA79gQM/p5OG6 akfHOSB77E2YIdNWoYQgGavKEoRoX6UBCc1eDGKjuhoXWAs4Q6xeEfvFkq6xx07ioDIVFk rVl+WBHxyDo5WrNVM6r/WJcK+9tQbR8yXJUBXdC02LuXHdLmI49lcBLESqD2jzGEjaC4U2 jZFtBgZgGLm0gguvC7L2ul6G6aKKq0emrrKqahXCPacYKtwKhsCul3viQ5HPROjghblwv1 onONO9xmMPPTQ+iGenqFpcMCdbyT/WVIM0CCZYTXhzTy6gc9OM2lnQ2sOMFkYw== 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 4cr3x96WkDz8Wc; Mon, 20 Oct 2025 18:34:21 +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 59KIYLd2007465; Mon, 20 Oct 2025 18:34:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 59KIYLF2007462; Mon, 20 Oct 2025 18:34:21 GMT (envelope-from git) Date: Mon, 20 Oct 2025 18:34:21 GMT Message-Id: <202510201834.59KIYLF2007462@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 3bd015a1a918 - stable/15 - 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: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 3bd015a1a918d060dbef556ddfa6e236f5212330 Auto-Submitted: auto-generated The branch stable/15 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=3bd015a1a918d060dbef556ddfa6e236f5212330 commit 3bd015a1a918d060dbef556ddfa6e236f5212330 Author: Bjoern A. Zeeb AuthorDate: 2025-09-25 12:49:07 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-10-20 18:33:08 +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. 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) --- 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