developer | c2cfe0f | 2023-09-22 04:11:09 +0800 | [diff] [blame] | 1 | From 655b23a24e07980cecd4f09e8779dfc9f69bff51 Mon Sep 17 00:00:00 2001 |
| 2 | From: "sujuan.chen" <sujuan.chen@mediatek.com> |
| 3 | Date: Thu, 20 Jul 2023 10:25:50 +0800 |
| 4 | Subject: [PATCH 2012/2012] wifi: mt76: mt7996: add dma mask limitation |
| 5 | |
| 6 | Signed-off-by: sujuan.chen <sujuan.chen@mediatek.com> |
| 7 | --- |
| 8 | dma.c | 4 ++-- |
| 9 | mt7996/mmio.c | 10 +--------- |
| 10 | mt7996/pci.c | 2 +- |
| 11 | 3 files changed, 4 insertions(+), 12 deletions(-) |
| 12 | |
| 13 | diff --git a/dma.c b/dma.c |
| 14 | index 7e3d0393b..81412deb1 100644 |
| 15 | --- a/dma.c |
| 16 | +++ b/dma.c |
| 17 | @@ -495,7 +495,7 @@ mt76_dma_get_buf(struct mt76_dev *dev, struct mt76_queue *q, int idx, |
| 18 | } else { |
| 19 | struct mt76_queue_buf qbuf; |
| 20 | |
| 21 | - buf = page_frag_alloc(&q->rx_page, q->buf_size, GFP_ATOMIC); |
| 22 | + buf = page_frag_alloc(&q->rx_page, q->buf_size, GFP_ATOMIC | GFP_DMA32); |
| 23 | if (!buf) |
| 24 | return NULL; |
| 25 | |
| 26 | @@ -714,7 +714,7 @@ mt76_dma_rx_fill(struct mt76_dev *dev, struct mt76_queue *q) |
| 27 | if (mt76_queue_is_rro_ind(q)) |
| 28 | goto done; |
| 29 | |
| 30 | - buf = page_frag_alloc(&q->rx_page, q->buf_size, GFP_ATOMIC); |
| 31 | + buf = page_frag_alloc(&q->rx_page, q->buf_size, GFP_ATOMIC | GFP_DMA32); |
| 32 | if (!buf) |
| 33 | break; |
| 34 | |
| 35 | diff --git a/mt7996/mmio.c b/mt7996/mmio.c |
| 36 | index 940f94998..7a1d81447 100644 |
| 37 | --- a/mt7996/mmio.c |
| 38 | +++ b/mt7996/mmio.c |
| 39 | @@ -286,7 +286,7 @@ static u32 mt7996_mmio_wed_init_rx_buf(struct mtk_wed_device *wed, int size) |
| 40 | void *ptr; |
| 41 | |
| 42 | ptr = page_frag_alloc(&wed->rx_buf_ring.rx_page, length, |
| 43 | - GFP_KERNEL); |
| 44 | + GFP_ATOMIC | GFP_DMA32); |
| 45 | if (!ptr) { |
| 46 | mt76_put_rxwi(&dev->mt76, r); |
| 47 | goto unmap; |
| 48 | @@ -501,14 +501,6 @@ int mt7996_mmio_wed_init(struct mt7996_dev *dev, void *pdev_ptr, |
| 49 | |
| 50 | dev->mt76.token_size = MT7996_SW_TOKEN_SIZE; |
| 51 | |
| 52 | - ret = dma_set_mask(wed->dev, DMA_BIT_MASK(32)); |
| 53 | - if (ret) |
| 54 | - return ret; |
| 55 | - |
| 56 | - ret = dma_set_coherent_mask(wed->dev, DMA_BIT_MASK(32)); |
| 57 | - if (ret) |
| 58 | - return ret; |
| 59 | - |
| 60 | return 1; |
| 61 | #else |
| 62 | return 0; |
| 63 | diff --git a/mt7996/pci.c b/mt7996/pci.c |
| 64 | index 9a134fcab..993e53817 100644 |
| 65 | --- a/mt7996/pci.c |
| 66 | +++ b/mt7996/pci.c |
| 67 | @@ -107,7 +107,7 @@ static int mt7996_pci_probe(struct pci_dev *pdev, |
| 68 | |
| 69 | pci_set_master(pdev); |
| 70 | |
| 71 | - ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); |
| 72 | + ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); |
| 73 | if (ret) |
| 74 | return ret; |
| 75 | |
| 76 | -- |
| 77 | 2.39.2 |
| 78 | |