From: Baochen Qiang <quic_bqiang@quicinc.com>
To: Johan Hovold <johan+linaro@kernel.org>,
Jeff Johnson <jjohnson@kernel.org>
Cc: Stephan Gerhold <stephan.gerhold@linaro.org>,
<ath12k@lists.infradead.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] wifi: ath12k: extend dma mask to 36 bits
Date: Mon, 24 Mar 2025 11:06:16 +0800 [thread overview]
Message-ID: <bc3601ae-5639-4ee4-bbcb-4e39b542bfbe@quicinc.com> (raw)
In-Reply-To: <20250321162331.19507-1-johan+linaro@kernel.org>
On 3/22/2025 12:23 AM, Johan Hovold wrote:
> 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.
why bounce buffer is used at EL1? is it because IOMMU is not working at EL1?
or even because IOMMU is not present on Elite machines?
>
> 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.
could you help elaborate how it could be extended?
>
> 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.
why is it not necessary to check error?
>
> Tested-on: WCN7850 hw2.0 WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
>
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
> ---
> drivers/net/wireless/ath/ath12k/mhi.c | 2 +-
> drivers/net/wireless/ath/ath12k/pci.c | 12 ++++--------
> drivers/net/wireless/ath/ath12k/pci.h | 1 +
> 3 files changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath12k/mhi.c b/drivers/net/wireless/ath/ath12k/mhi.c
> index 2f6d14382ed7..9c929c4ad8a8 100644
> --- a/drivers/net/wireless/ath/ath12k/mhi.c
> +++ b/drivers/net/wireless/ath/ath12k/mhi.c
> @@ -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;
> diff --git a/drivers/net/wireless/ath/ath12k/pci.c b/drivers/net/wireless/ath/ath12k/pci.c
> index 06cff3849ab8..e77c50fc48ca 100644
> --- a/drivers/net/wireless/ath/ath12k/pci.c
> +++ b/drivers/net/wireless/ath/ath12k/pci.c
> @@ -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
>
> @@ -874,13 +874,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);
>
> diff --git a/drivers/net/wireless/ath/ath12k/pci.h b/drivers/net/wireless/ath/ath12k/pci.h
> index 31584a7ad80e..9e89b64b3545 100644
> --- a/drivers/net/wireless/ath/ath12k/pci.h
> +++ b/drivers/net/wireless/ath/ath12k/pci.h
> @@ -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)
next prev parent reply other threads:[~2025-03-24 3:06 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-21 16:23 [PATCH] wifi: ath12k: extend dma mask to 36 bits Johan Hovold
2025-03-24 3:06 ` Baochen Qiang [this message]
2025-03-24 7:40 ` Johan Hovold
2025-03-24 8:05 ` Baochen Qiang
2025-03-24 8:20 ` Johan Hovold
2025-03-24 8:29 ` Baochen Qiang
2025-03-24 8:33 ` Baochen Qiang
2025-03-24 9:18 ` Johan Hovold
2025-03-25 7:04 ` Raj Kumar Bhagat
2025-03-26 4:29 ` Vasanthakumar Thiagarajan
2025-03-26 15:11 ` Jeff Johnson
2025-03-26 15:16 ` Johan Hovold
2025-03-26 15:41 ` Jeff Johnson
2025-03-27 22:58 ` Jeff Johnson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bc3601ae-5639-4ee4-bbcb-4e39b542bfbe@quicinc.com \
--to=quic_bqiang@quicinc.com \
--cc=ath12k@lists.infradead.org \
--cc=jjohnson@kernel.org \
--cc=johan+linaro@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stephan.gerhold@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox