]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: ath12k: extend dma mask to 36 bits
authorJohan Hovold <johan+linaro@kernel.org>
Fri, 21 Mar 2025 16:23:31 +0000 (17:23 +0100)
committerJeff Johnson <jeff.johnson@oss.qualcomm.com>
Thu, 27 Mar 2025 22:55:42 +0000 (15:55 -0700)
Extend the DMA mask to 36 bits to avoid using bounce buffers on machines
without an iommu (under OS control) similar to what was done for ath11k
in commit dbd73acb22d8 ("wifi: ath11k: enable 36 bit mask for stream
DMA").

This specifically avoids using bounce buffers on Qualcomm Snapdragon X
Elite machines like the Lenovo ThinkPad T14s when running at EL1.

Note that the mask could possibly be extended further but unresolved DMA
issues with 64 GiB X Elite machines currently prevents that from being
tested.

Also note that the driver is limited to 32 bits for coherent
allocations and that there is no need to check for errors when setting
masks larger than 32 bits.

Tested-on: WCN7850 hw2.0 WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1

Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Tested-by: Raj Kumar Bhagat <quic_rajkbhag@quicinc.com>
Reviewed-by: Baochen Qiang <quic_bqiang@quicinc.com>
Tested-by: Baochen Qiang <quic_bqiang@quicinc.com>
Link: https://patch.msgid.link/20250321162331.19507-1-johan+linaro@kernel.org
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
drivers/net/wireless/ath/ath12k/mhi.c
drivers/net/wireless/ath/ath12k/pci.c
drivers/net/wireless/ath/ath12k/pci.h

index 2f6d14382ed70c7aeecd83c2329f23022412c7ec..9c929c4ad8a8544ddd757ab7c34586224e0da764 100644 (file)
@@ -379,7 +379,7 @@ int ath12k_mhi_register(struct ath12k_pci *ab_pci)
                mhi_ctrl->irq_flags = IRQF_SHARED | IRQF_NOBALANCING;
 
        mhi_ctrl->iova_start = 0;
-       mhi_ctrl->iova_stop = 0xffffffff;
+       mhi_ctrl->iova_stop = ab_pci->dma_mask;
        mhi_ctrl->sbl_size = SZ_512K;
        mhi_ctrl->seg_len = SZ_512K;
        mhi_ctrl->fbc_download = true;
index e62b172c7f9fb003d1eb8e718c33ad0b4f08977d..7f1bb150f326b317157f6721d990d61a27f38d6a 100644 (file)
@@ -17,7 +17,7 @@
 #include "debug.h"
 
 #define ATH12K_PCI_BAR_NUM             0
-#define ATH12K_PCI_DMA_MASK            32
+#define ATH12K_PCI_DMA_MASK            36
 
 #define ATH12K_PCI_IRQ_CE0_OFFSET              3
 
@@ -877,13 +877,9 @@ static int ath12k_pci_claim(struct ath12k_pci *ab_pci, struct pci_dev *pdev)
                goto disable_device;
        }
 
-       ret = dma_set_mask_and_coherent(&pdev->dev,
-                                       DMA_BIT_MASK(ATH12K_PCI_DMA_MASK));
-       if (ret) {
-               ath12k_err(ab, "failed to set pci dma mask to %d: %d\n",
-                          ATH12K_PCI_DMA_MASK, ret);
-               goto release_region;
-       }
+       ab_pci->dma_mask = DMA_BIT_MASK(ATH12K_PCI_DMA_MASK);
+       dma_set_mask(&pdev->dev, ab_pci->dma_mask);
+       dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
 
        pci_set_master(pdev);
 
index 521fa72333bb51637f881e31a609809f4aa88939..0b4c459d6d8eabb0773162e6bb3ca666c0a8f15a 100644 (file)
@@ -116,6 +116,7 @@ struct ath12k_pci {
        unsigned long irq_flags;
        const struct ath12k_pci_ops *pci_ops;
        u32 qmi_instance;
+       u64 dma_mask;
 };
 
 static inline struct ath12k_pci *ath12k_pci_priv(struct ath12k_base *ab)