2024-05-24 02:16:18

by Baochen Qiang

[permalink] [raw]
Subject: [PATCH] wifi: ath11k: fix wrong definition of CE ring's base address

Base address of CE ring is defined as u32, currently this works
because coherent DMA mask configured as 32 bit:

#define ATH11K_PCI_COHERENT_DMA_MASK 32

However this mask could be changed once firmware bugs are fixed
to fully support 36 bit DMA addressing. So to protect against any
future changes to the DMA mask, change the type of the fields that
are dependent upon it.

This is found during code review. Compile tested only.

Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
Signed-off-by: Baochen Qiang <[email protected]>
---
drivers/net/wireless/ath/ath11k/ce.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/ce.h b/drivers/net/wireless/ath/ath11k/ce.h
index 69946fc70077..bcde2fcf02cf 100644
--- a/drivers/net/wireless/ath/ath11k/ce.h
+++ b/drivers/net/wireless/ath/ath11k/ce.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-3-Clause-Clear */
/*
* Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022, 2024 Qualcomm Innovation Center, Inc. All rights reserved.
*/

#ifndef ATH11K_CE_H
@@ -146,7 +146,7 @@ struct ath11k_ce_ring {
/* Host address space */
void *base_addr_owner_space_unaligned;
/* CE address space */
- u32 base_addr_ce_space_unaligned;
+ dma_addr_t base_addr_ce_space_unaligned;

/* Actual start of descriptors.
* Aligned to descriptor-size boundary.
@@ -156,7 +156,7 @@ struct ath11k_ce_ring {
void *base_addr_owner_space;

/* CE address space */
- u32 base_addr_ce_space;
+ dma_addr_t base_addr_ce_space;

/* HAL ring id */
u32 hal_ring_id;

base-commit: fae0804439b5833308ab7d8563c643edb0fa174c
--
2.25.1



2024-05-24 15:46:02

by Jeff Johnson

[permalink] [raw]
Subject: Re: [PATCH] wifi: ath11k: fix wrong definition of CE ring's base address

On 5/23/2024 7:15 PM, Baochen Qiang wrote:
> Base address of CE ring is defined as u32, currently this works
> because coherent DMA mask configured as 32 bit:
>
> #define ATH11K_PCI_COHERENT_DMA_MASK 32
>
> However this mask could be changed once firmware bugs are fixed
> to fully support 36 bit DMA addressing. So to protect against any
> future changes to the DMA mask, change the type of the fields that
> are dependent upon it.
>
> This is found during code review. Compile tested only.
>
> Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
> Signed-off-by: Baochen Qiang <[email protected]>
Acked-by: Jeff Johnson <[email protected]>


2024-05-28 17:47:43

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH] wifi: ath11k: fix wrong definition of CE ring's base address

Baochen Qiang <[email protected]> wrote:

> Base address of CE ring is defined as u32, currently this works
> because coherent DMA mask configured as 32 bit:
>
> #define ATH11K_PCI_COHERENT_DMA_MASK 32
>
> However this mask could be changed once firmware bugs are fixed
> to fully support 36 bit DMA addressing. So to protect against any
> future changes to the DMA mask, change the type of the fields that
> are dependent upon it.
>
> This is found during code review. Compile tested only.
>
> Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
> Signed-off-by: Baochen Qiang <[email protected]>
> Acked-by: Jeff Johnson <[email protected]>
> Signed-off-by: Kalle Valo <[email protected]>

Patch applied to ath-next branch of ath.git, thanks.

5714e25f1d18 wifi: ath11k: fix wrong definition of CE ring's base address

--
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches