]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
tg3: Set coherent DMA mask bits to 31 for BCM57766 chipsets
authorPavan Chebbi <pavan.chebbi@broadcom.com>
Tue, 19 Nov 2024 05:57:41 +0000 (21:57 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Dec 2024 09:59:37 +0000 (10:59 +0100)
[ Upstream commit 614f4d166eeeb9bd709b0ad29552f691c0f45776 ]

The hardware on Broadcom 1G chipsets have a known limitation
where they cannot handle DMA addresses that cross over 4GB.
When such an address is encountered, the hardware sets the
address overflow error bit in the DMA status register and
triggers a reset.

However, BCM57766 hardware is setting the overflow bit and
triggering a reset in some cases when there is no actual
underlying address overflow. The hardware team analyzed the
issue and concluded that it is happening when the status
block update has an address with higher (b16 to b31) bits
as 0xffff following a previous update that had lowest bits
as 0xffff.

To work around this bug in the BCM57766 hardware, set the
coherent dma mask from the current 64b to 31b. This will
ensure that upper bits of the status block DMA address are
always at most 0x7fff, thus avoiding the improper overflow
check described above. This work around is intended for only
status block and ring memories and has no effect on TX and
RX buffers as they do not require coherent memory.

Fixes: 72f2afb8a685 ("[TG3]: Add DMA address workaround")
Reported-by: Salam Noureddine <noureddine@arista.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Reviewed-by: Michal Kubiak <michal.kubiak@intel.com>
Link: https://patch.msgid.link/20241119055741.147144-1-pavan.chebbi@broadcom.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/broadcom/tg3.c

index af0186a527a36e2ad7a302f2e7992860ec2f62e4..d7419c65d9e38cf53ddfae1904e6471b94f9ca4e 100644 (file)
@@ -17866,6 +17866,9 @@ static int tg3_init_one(struct pci_dev *pdev,
        } else
                persist_dma_mask = dma_mask = DMA_BIT_MASK(64);
 
+       if (tg3_asic_rev(tp) == ASIC_REV_57766)
+               persist_dma_mask = DMA_BIT_MASK(31);
+
        /* Configure DMA attributes. */
        if (dma_mask > DMA_BIT_MASK(32)) {
                err = pci_set_dma_mask(pdev, dma_mask);