From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796380584; b=Z1oNunqZmV/SC0Zc9xdNVoHdx/mQQzPwpEcbtRXmY4pL/EMKS58b7800g4mLVycyLTcf CBLyu2WfA/6LbPqazpdRUlVJ9rf2tWmaklZYRo/X4kD9hhMj8Mj6sMbDmdmSLd4EOOwTa 9XQvaeFuh+eVVcWoMFuVV6+MeRSXdRwcf4UWzHOYI2JC0D5PQAUvO3A7qXo3+bF7fFOy/ uD9/m/7IjN0qOExkaGLwf7QeVlU7CWrKjYppM4oufjekQvB39TkmCAW6eRZE85oxheLLa ptj6Qs4fMMJzWGzJiVNCtcCSeEEutILjNpcRCWUh2epH08Am1DeY/nhM5M9dEcoFiqg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796380584; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=5Gir4ygxqNMuMWkNGmte6JUcWHOkt/rF4KQTkLy87nI=; b=d6oWFQXzddvBtjj7Xt3FoEyD6iMgC2vjk07zS44yXGeS94TsLNG8rvrHcg0uWpKDpaCK ckVzLlnS0wGJuBmvBfkI9xXsxeIwAxC9sekjzz5ltF9shxPHqYJDlws1jvGTsXzij9QZh tLScsMRSJQDk9njEsTBVwy47f7kwvixwQv3qKKQi8enCGLm6NeC99jGbHnXttSdm52Wut sRgejRlvy6L2pCNuHH6usJpLeVnoCygJgTj0XP5UB/FvO+GHvI+6DBfHGX7/sPpN9t9+D hE2Uhf+IDRkiRiDq3rRkPY9TDGIm5adhXpcVIYgcgaGUQRscJj7ZQqqfMHNrYFGy9Og== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=NeL5ArAz; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3EE4A606A68E; Fri, 4 Dec 2026 10:36:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=NeL5ArAz Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6DA21F00933; Fri, 4 Dec 2026 10:36:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796380584; bh=5Gir4ygxqNMuMWkNGmte6JUcWHOkt/rF4KQTkLy87nI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=NeL5ArAzasLCejlK6cGGBojyaunVl5lazFGHoJ2mfzoQlBHzIBk6N4R46VuNuw3lY 3CY8UJ3F43xhgfN45oJeKcjVBaVZluptRCmInJcGNZEXyupK6kBEIxRekKpAfik07M UtMry9FZ1o8Oo0JQaPfDeFbT52ll6KzPJhqkdxH0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Rui Salvaterra , Pavan Chebbi , Simon Horman , Paolo Abeni , Sasha Levin Subject: [PATCH 7.3 310/742] tg3: Dont fail probe if 31-bit coherent DMA mask is unsupported Date: Fri, 4 Dec 2026 19:02:54 +0900 Message-ID: <20261204100643.265754518@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Pavan Chebbi [ Upstream commit 686b8dbcedf8773dc505f9f315a0551c0bca70a3 ] Commit 614f4d166eee ("tg3: Set coherent DMA mask bits to 31 for BCM57766 chipsets") lowered the coherent DMA mask to 31 bits as a workaround for a spurious address overflow error in the hardware. The result of dma_set_coherent_mask() is fatal to probe, so on platforms that cannot satisfy such a mask the device fails to probe: tg3 0000:01:00.0: Unable to obtain 64 bit DMA for consistent allocations tg3 0000:01:00.0: probe with driver tg3 failed with error -5 This was reported on a Mac mini (Macmini6,2, BCM57766) running a kernel built without CONFIG_ZONE_DMA and with IOMMU passthrough as the default. Without CONFIG_ZONE_DMA, dma_direct_supported() only accepts a mask narrower than 32 bits if it covers the highest physical memory address, so with direct mapping a 31-bit coherent mask is rejected whenever memory extends above 2GB. Treat the 31-bit mask as best effort. If it is refused, warn and fall back to the mask used before 614f4d166eee, so that the device still probes. Platforms that accept the mask are unaffected. Where it is refused, 614f4d166eee never protected the device, it only stopped it from probing, so this restores the behaviour of kernels before that commit. Warn when a status block lands at an address matching the pattern described in 614f4d166eee, so that a resulting TX timeout can be identified. Fixes: 614f4d166eee ("tg3: Set coherent DMA mask bits to 31 for BCM57766 chipsets") Reported-by: Rui Salvaterra Link: https://lore.kernel.org/netdev/CALjTZvYKHWrD5m+RXimjxODvpFPw7Cq_EOEuzRi1PZT9_JxF+g@mail.gmail.com/ Signed-off-by: Pavan Chebbi Reviewed-by: Simon Horman Link: https://patch.msgid.link/20261118105408.1076095-2-pavan.chebbi@broadcom.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- drivers/net/ethernet/broadcom/tg3.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index fd1c95f1111c5..25a74ac8b80f1 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c @@ -8867,6 +8867,13 @@ static int tg3_alloc_consistent(struct tg3 *tp) if (!tnapi->hw_status) goto err_out; + if (tg3_asic_rev(tp) == ASIC_REV_57766 && + (lower_32_bits(tnapi->status_mapping) & 0xffff0000) == + 0xffff0000) + dev_warn(&tp->pdev->dev, + "Status block at DMA address %pad may cause TX timeouts on this device\n", + &tnapi->status_mapping); + sblk = tnapi->hw_status; if (tg3_flag(tp, ENABLE_RSS)) { @@ -17688,6 +17695,7 @@ static int tg3_init_one(struct pci_dev *pdev, u64 dma_mask, persist_dma_mask; netdev_features_t features = 0; u8 addr[ETH_ALEN] __aligned(2); + u64 test_dma_mask = 0; err = pci_enable_device(pdev); if (err) { @@ -17827,15 +17835,22 @@ static int tg3_init_one(struct pci_dev *pdev, persist_dma_mask = dma_mask = DMA_BIT_MASK(64); if (tg3_asic_rev(tp) == ASIC_REV_57766) - persist_dma_mask = DMA_BIT_MASK(31); + test_dma_mask = DMA_BIT_MASK(31); /* Configure DMA attributes. */ if (dma_mask > DMA_BIT_MASK(32)) { err = dma_set_mask(&pdev->dev, dma_mask); if (!err) { features |= NETIF_F_HIGHDMA; - err = dma_set_coherent_mask(&pdev->dev, - persist_dma_mask); + if (!test_dma_mask || + dma_set_coherent_mask(&pdev->dev, + test_dma_mask)) { + if (test_dma_mask) + dev_warn(&pdev->dev, + "Unable to set 31 bit coherent DMA mask, workaround not applied\n"); + err = dma_set_coherent_mask(&pdev->dev, + persist_dma_mask); + } if (err < 0) { dev_err(&pdev->dev, "Unable to obtain 64 bit " "DMA for consistent allocations\n"); -- 2.53.0