All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 1/4] b44: Add DMA_ATTR_NO_WARN to dma_map_single attempts
@ 2019-12-08  8:35 George Spelvin
  0 siblings, 0 replies; only message in thread
From: George Spelvin @ 2019-12-08  8:35 UTC (permalink / raw)
  To: michael.chan, netdev; +Cc: hauke, lkml

The b44 family of fast ethernet chips have a hardware bug limiting
DMA to the low 30 bits of address space.  The driver implements its
own bouncing through ZONE_DMA if buffers are outside this range,
but not before the DMA layer tries the SWIOTLB driver for help.

The latter is designed only for helping devices with a 32-bit DMA
restriction, is not even initialized on machines with < 4GB of RAM,
and proceeds to spam the log with:

b44 0000:02:00.0: swiotlb buffer is full (sz: 66 bytes), total 0 (slots), used 0 (slots)
b44 0000:02:00.0: swiotlb buffer is full (sz: 72 bytes), total 0 (slots), used 0 (slots)
b44 0000:02:00.0: swiotlb buffer is full (sz: 401 bytes), total 0 (slots), used 0 (slots)
swiotlb_tbl_map_single: 7 callbacks suppressed
b44 0000:02:00.0: swiotlb buffer is full (sz: 90 bytes), total 0 (slots), used 0 (slots)
b44 0000:02:00.0: swiotlb buffer is full (sz: 74 bytes), total 0 (slots), used 0 (slots)
b44 0000:02:00.0: swiotlb buffer is full (sz: 74 bytes), total 0 (slots), used 0 (slots)
b44 0000:02:00.0: swiotlb buffer is full (sz: 74 bytes), total 0 (slots), used 0 (slots)
b44 0000:02:00.0: swiotlb buffer is full (sz: 66 bytes), total 0 (slots), used 0 (slots)
b44 0000:02:00.0: swiotlb buffer is full (sz: 426 bytes), total 0 (slots), used 0 (slots)

DMA_ATTR_NO_WARN on the first (non-ZONE_DMA) attempt turns off this
repeated complaint.

There still is a remaining bug: kernel/dma/direct.c:report_addr() throws
a WARN_ON_ONCE the first time this happens.  I'm less certain how to fix
that, but it's less annoying.

Signed-off-by: George Spelvin <lkml@sdf.org>
---
 drivers/net/ethernet/broadcom/b44.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

This is the only substantive patch in the series.  The other three are
relatively minor issues that I ran into while studying the surrounding
code.  (Although #3/4 actually fixes a resource leak.)

diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c
index 97ab0dd25552..394671230c1c 100644
--- a/drivers/net/ethernet/broadcom/b44.c
+++ b/drivers/net/ethernet/broadcom/b44.c
@@ -674,9 +674,9 @@ static int b44_alloc_rx_skb(struct b44 *bp, int src_idx, u32 dest_idx_unmasked)
 	if (skb == NULL)
 		return -ENOMEM;
 
-	mapping = dma_map_single(bp->sdev->dma_dev, skb->data,
-				 RX_PKT_BUF_SZ,
-				 DMA_FROM_DEVICE);
+	mapping = dma_map_single_attrs(bp->sdev->dma_dev, skb->data,
+				       RX_PKT_BUF_SZ, DMA_FROM_DEVICE,
+				       DMA_ATTR_NO_WARN);
 
 	/* Hardware bug work-around, the chip is unable to do PCI DMA
 	   to/from anything above 1GB :-( */
@@ -988,7 +988,8 @@ static netdev_tx_t b44_start_xmit(struct sk_buff *skb, struct net_device *dev)
 		goto err_out;
 	}
 
-	mapping = dma_map_single(bp->sdev->dma_dev, skb->data, len, DMA_TO_DEVICE);
+	mapping = dma_map_single_attrs(bp->sdev->dma_dev, skb->data, len,
+				       DMA_TO_DEVICE, DMA_ATTR_NO_WARN);
 	if (dma_mapping_error(bp->sdev->dma_dev, mapping) || mapping + len > DMA_BIT_MASK(30)) {
 		struct sk_buff *bounce_skb;
 
-- 
2.24.0

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-12-08  8:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-08  8:35 [RFC PATCH 1/4] b44: Add DMA_ATTR_NO_WARN to dma_map_single attempts George Spelvin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.