Skip to contentSkip to conversation

wifi: brcmfmac: handle missing D3 ACK on BCM4377 T2 Macs

PATCH Superseded Andre Eikmeyer 4 participants 5 messages Sep 18 – Oct 4 Broadcom BRCM80211 IEEE802.11 wireless drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wifi: brcmfmac: handle missing D3 ACK on BCM4377 T2 Macs

BCM4377 on the affected T2 Macs does not acknowledge HOST_D3_INFORM. The current PCIe suspend callback treats this as fatal and aborts system suspend.

On the affected PCI and DMI combinations, mask the mailbox interrupt, preserve the bus-down state, and let generic PCI/ACPI suspend proceed. On resume the existing recovery path tears down and probes the device again instead of relying on a D0 mailbox transaction.

Tested-on: MacBookAir9,1, MacBookPro15,4, MacBookPro16,3

---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +42 -0
index 55f4d7b..57bbac1 100644
@@ -9,6 +9,7 @@
 #include <linux/pci.h>
 #include <linux/vmalloc.h>
 #include <linux/delay.h>
+#include <linux/dmi.h>
 #include <linux/interrupt.h>
 #include <linux/bcma/bcma.h>
 #include <linux/sched.h>
@@ -49,6 +50,40 @@ enum brcmf_pcie_state {
 	BRCMFMAC_PCIE_STATE_UP
 };
 
+/*
+ * BCM4377 on these T2 Macs never acknowledges HOST_D3_INFORM. The platform
+ * can nevertheless enter and leave system suspend if the PCIe mailbox
+ * interrupt is masked and resume takes the existing cold-reprobe path.
+ */
+static const struct dmi_system_id brcmf_pcie_no_d3_ack_quirk[] = {
+	{
+		.matches = {
+			DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "MacBookAir9,1"),
+		},
+	},
+	{
+		.matches = {
+			DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "MacBookPro15,4"),
+		},
+	},
+	{
+		.matches = {
+			DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,3"),
+		},
+	},
+	{}
+};
+
+static bool brcmf_pcie_quirk_no_d3_ack(struct pci_dev *pdev)
+{
+	return pdev->vendor == PCI_VENDOR_ID_BROADCOM &&
+	       pdev->device == BRCM_PCIE_4377_DEVICE_ID &&
+	       dmi_check_system(brcmf_pcie_no_d3_ack_quirk);
+}
+
 BRCMF_FW_DEF(43602, "brcmfmac43602-pcie");
 BRCMF_FW_DEF(4350, "brcmfmac4350-pcie");
 BRCMF_FW_DEF(4350C, "brcmfmac4350c2-pcie");
@@ -2652,11 +2687,18 @@ static int brcmf_pcie_pm_enter_D3(struct device *dev)
 	wait_event_timeout(devinfo->mbdata_resp_wait, devinfo->mbdata_completed,
 			   BRCMF_PCIE_MBDATA_TIMEOUT);
 	if (!devinfo->mbdata_completed) {
+		if (brcmf_pcie_quirk_no_d3_ack(devinfo->pdev)) {
+			dev_info(dev, "D3 ACK missing; masking PCIe mailbox interrupt\n");
+			brcmf_pcie_intr_disable(devinfo);
+			goto done;
+		}
+
 		brcmf_err(bus, "Timeout on response for entering D3 substate\n");
 		brcmf_bus_change_state(bus, BRCMF_BUS_UP);
 		return -EIO;
 	}
 
+done:
 	devinfo->state = BRCMFMAC_PCIE_STATE_DOWN;
 
 	return 0;
Signature · 1 line
2.55.0
#1 lore raw
Quoted 48 lines · Andre Eikmeyer

BCM4377 on the affected T2 Macs does not acknowledge HOST_D3_INFORM. The current PCIe suspend callback treats this as fatal and aborts system suspend.

On the affected PCI and DMI combinations, mask the mailbox interrupt, preserve the bus-down state, and let generic PCI/ACPI suspend proceed. On resume the existing recovery path tears down and probes the device again instead of relying on a D0 mailbox transaction.

Tested-on: MacBookAir9,1, MacBookPro15,4, MacBookPro16,3

---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +18 -0
index 55f4d7b..57bbac1 100644
@@ -9,6 +9,7 @@
 #include <linux/pci.h>
 #include <linux/vmalloc.h>
 #include <linux/delay.h>
+#include <linux/dmi.h>
 #include <linux/interrupt.h>
 #include <linux/bcma/bcma.h>
 #include <linux/sched.h>
@@ -49,6 +50,40 @@ enum brcmf_pcie_state {
 	BRCMFMAC_PCIE_STATE_UP
 };
 
+/*
+ * BCM4377 on these T2 Macs never acknowledges HOST_D3_INFORM. The platform
+ * can nevertheless enter and leave system suspend if the PCIe mailbox
+ * interrupt is masked and resume takes the existing cold-reprobe path.
+ */
+static const struct dmi_system_id brcmf_pcie_no_d3_ack_quirk[] = {
+	{
+		.matches = {
+			DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "MacBookAir9,1"),
+		},
+	},
+	{
+		.matches = {
+			DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "MacBookPro15,4"),
+		},

drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c enum brcmf_pcie_state { · line 79

Quoted 10 lines
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +10 -0
+	},
+	{
+		.matches = {
+			DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,3"),
+		},
+	},
+	{}
+};
+

The BCM4377 is Apple exclusive and present only on these three Macs. No other Mac, or PC of some other brand uses this. So the DMI check isn't needed.

#2 lore raw
In reply to Andre Eikmeyer
kernel test robot noticed the following build warnings:

Hi Andre,

kernel test robot noticed the following build warnings:

[auto build test WARNING on wireless-next/main]
[also build test WARNING on wireless/main linus/master v7.3-rc4 next-20260922] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Andre-Eikmeyer/wifi-brcmfmac-handle-missing-D3-ACK-on-BCM4377-T2-Macs/20260918-233014
base:   https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git main
patch link:    https://lore.kernel.org/r/20260918213014.1890677-1-dev%40deq.rocks
patch subject: [PATCH] wifi: brcmfmac: handle missing D3 ACK on BCM4377 T2 Macs
config: parisc-allyesconfig (https://download.01.org/0day-ci/archive/20260923/[email protected]/config)
compiler: hppa-linux-gcc (GCC) 16.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260923/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

>> drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c:80:13: warning: 'brcmf_pcie_quirk_no_d3_ack' defined but not used [-Wunused-function]

80 | static bool brcmf_pcie_quirk_no_d3_ack(struct pci_dev *pdev)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~

vim +/brcmf_pcie_quirk_no_d3_ack +80 drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c

    79	
  > 80	static bool brcmf_pcie_quirk_no_d3_ack(struct pci_dev *pdev)
    81	{
    82		return pdev->vendor == PCI_VENDOR_ID_BROADCOM &&
    83		       pdev->device == BRCM_PCIE_4377_DEVICE_ID &&
    84		       dmi_check_system(brcmf_pcie_no_d3_ack_quirk);
    85	}
    86	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

#3 lore raw

PATCH v2 1/1 wifi: brcmfmac: handle missing D3 ACK on BCM4377 T2 Macs

In reply to Andre Eikmeyer

BCM4377 on the affected T2 Macs does not acknowledge HOST_D3_INFORM. The current PCIe suspend callback treats this as fatal and aborts system suspend.

When this happens on BCM4377, mask the mailbox interrupt, preserve the bus-down state, and let generic PCI/ACPI suspend proceed. On resume the existing recovery path tears down and probes the device again instead of relying on a D0 mailbox transaction.

Tested-on: MacBookAir9,1, MacBookPro15,4, MacBookPro16,3

---
Changes in v2:
- Drop the redundant DMI allowlist; BCM4377 is Apple-exclusive and only appears in the three affected MacBook models.
- Keep the device check inside CONFIG_PM, fixing the CONFIG_PM=n unused function warning reported by the kernel test robot.

 drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +7 -0
index 55f4d7b97..e2e050395 100644
@@ -2652,11 +2652,18 @@ static int brcmf_pcie_pm_enter_D3(struct device *dev)
 	wait_event_timeout(devinfo->mbdata_resp_wait, devinfo->mbdata_completed,
 			   BRCMF_PCIE_MBDATA_TIMEOUT);
 	if (!devinfo->mbdata_completed) {
+		if (devinfo->pdev->device == BRCM_PCIE_4377_DEVICE_ID) {
+			dev_info(dev, "D3 ACK missing; masking PCIe mailbox interrupt\n");
+			brcmf_pcie_intr_disable(devinfo);
+			goto done;
+		}
+
 		brcmf_err(bus, "Timeout on response for entering D3 substate\n");
 		brcmf_bus_change_state(bus, BRCMF_BUS_UP);
 		return -EIO;
 	}
 
+done:
 	devinfo->state = BRCMFMAC_PCIE_STATE_DOWN;
 
 	return 0;

base-commit: 1631d79ae57dce2c5f88ad278307028638a8b4d9

Signature · 1 line
2.55.0
maintainer
#4 lore raw
Quoted 9 lines · Andre Eikmeyer

BCM4377 on the affected T2 Macs does not acknowledge HOST_D3_INFORM. The current PCIe suspend callback treats this as fatal and aborts system suspend.

When this happens on BCM4377, mask the mailbox interrupt, preserve the bus-down state, and let generic PCI/ACPI suspend proceed. On resume the existing recovery path tears down and probes the device again instead of relying on a D0 mailbox transaction.

Quoted 5 lines

Tested-on: MacBookAir9,1, MacBookPro15,4, MacBookPro16,3

---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 7 +++++++
 1 file changed, 7 insertions(+)

Thanks for the patch. However, an earlier patch from Sebastian Reichel already addresses this issue generically: "[wireless-next,v2] wifi: brcmfmac:
Improve D3 substate entering timeout handling" [1].

That patch makes the D3 ACK timeout non-fatal whenever Wake-on-WLAN is not enabled, which covers BCM4377 as well and avoids the need for chip-specific workarounds. I have accepted Sebastian's patch, so this one is superseded.

[1] https://lore.kernel.org/linux-wireless/20260915-brcmfmac-bcm43752-suspend-fix-v2-1-1bd84914998b@collabora.com/

Regards,
Arend