[PATCH] wifi: ath11k: enable 36 bit mask for stream DMA
Kalle Valo
kvalo at kernel.org
Thu Jan 25 08:37:45 PST 2024
Jeff Johnson <quic_jjohnson at quicinc.com> writes:
> On 1/22/2024 5:52 PM, Baochen Qiang wrote:
>
>> Currently 32 bit DMA mask is used, telling kernel to get us an DMA
>> address under 4GB when mapping a buffer. This results in a very high
>> CPU overhead in the case where IOMMU is disabled and more than 4GB
>> system memory is installed. The reason is, with more than 4GB memory
>> installed, kernel is likely to allocate a buffer whose physical
>> address is above 4GB. While with IOMMU disabled, kernel has to involve
>> SWIOTLB to map/unmap that buffer, which consumes lots of CPU cycles.
>>
>> We did hit an issue caused by the reason mentioned above: in a system
>> that disables IOMMU and gets 8GB memory installed, a total of 40.5%
>> CPU usage is observed in throughput test. CPU profiling shows nearly
>> 60% of CPU cycles are consumed by SWIOTLB.
>>
>> By enabling 36 bit DMA mask, we can bypass SWIOTLB for any buffer
>> whose physical address is below 64GB. There are two types of DMA mask
>> within struct device, named dma_mask and coherent_dma_mask. Here we
>> only enable 36 bit for dma_mask, because firmware crashes if
>> coherent_dma_mask is also enabled, due to some unknown hardware
>> limitations. This is acceptable because coherent_dma_mask is used for
>> mapping a consistent DMA buffer, which generally does not happen in
>> a hot path.
>>
>> With this change, the total CPU usage mentioned in above issue drops
>> to 18.9%.
>>
>> Tested-on: WCN6855 hw2.1 PCI
>> WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.23
>> Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
>> Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
>>
>> Signed-off-by: Baochen Qiang <quic_bqiang at quicinc.com>
>> ---
>> drivers/net/wireless/ath/ath11k/mhi.c | 2 +-
>> drivers/net/wireless/ath/ath11k/pci.c | 16 +++++++++++++---
>> drivers/net/wireless/ath/ath11k/pci.h | 1 +
>> 3 files changed, 15 insertions(+), 4 deletions(-)
> My Qualcomm Innovation Center copyright checker reports:
>
> drivers/net/wireless/ath/ath11k/mhi.c copyright missing 2024
> drivers/net/wireless/ath/ath11k/pci.c copyright missing 2024
> drivers/net/wireless/ath/ath11k/pci.h copyright missing 2024
>
> Kalle can fix this in the pending tree
Yup, added those.
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
More information about the ath11k
mailing list