From: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
To: Alexandru Gagniuc <mr.nuke.me@gmail.com>,
jjohnson@kernel.org, ath11k@lists.infradead.org,
"Rob Herring (Arm)" <robh@kernel.org>
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org,
Jeff Johnson <jeff.johnson@oss.qualcomm.com>
Subject: Re: [PATCH] wifi: ath11k: fix qmi memory allocation logic for CALDB region
Date: Mon, 8 Dec 2025 15:38:32 +0530 [thread overview]
Message-ID: <01a05a49-ae5f-a3ec-7685-02a5f7cb9652@oss.qualcomm.com> (raw)
In-Reply-To: <20251206175829.2573256-1-mr.nuke.me@gmail.com>
On 12/6/2025 11:28 PM, Alexandru Gagniuc wrote:
> Memory region assignment in ath11k_qmi_assign_target_mem_chunk()
> assumes that:
> 1. firmware will make a HOST_DDR_REGION_TYPE request, and
> 2. this request is processed before CALDB_MEM_REGION_TYPE
>
> In this case CALDB_MEM_REGION_TYPE, can safely be assigned immediately
> after the host region.
>
> However, if the HOST_DDR_REGION_TYPE request is not made, or the
AFAICT, this is highly unlikely as HOST_DDR_REGION_TYPE will always be before
CALDB_MEM_REGION_TYPE.
> reserved-memory node is not present, then res.start and res.end are 0,
> and host_ddr_sz remains uninitialized. The physical address should
> fall back to ATH11K_QMI_CALDB_ADDRESS. That doesn't happen:
>
> resource_size(&res) returns 1 for an empty resource, and thus the if
> clause never takes the fallback path. ab->qmi.target_mem[idx].paddr
> is assigned the uninitialized value of host_ddr_sz + 0 (res.start).
>
> Use "if (res.end > res.start)" for the predicate, which correctly
> falls back to ATH11K_QMI_CALDB_ADDRESS.
>
> Fixes: 900730dc4705 ("wifi: ath: Use of_reserved_mem_region_to_resource() for "memory-region"")
>
> Cc: stable@vger.kernel.org # v6.18
> Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
> ---
> drivers/net/wireless/ath/ath11k/qmi.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c
> index aea56c38bf8f3..6cc26d1c1e2a4 100644
> --- a/drivers/net/wireless/ath/ath11k/qmi.c
> +++ b/drivers/net/wireless/ath/ath11k/qmi.c
> @@ -2054,7 +2054,7 @@ static int ath11k_qmi_assign_target_mem_chunk(struct ath11k_base *ab)
> return ret;
> }
>
> - if (res.end - res.start + 1 < ab->qmi.target_mem[i].size) {
> + if (resource_size(&res) < ab->qmi.target_mem[i].size) {
> ath11k_dbg(ab, ATH11K_DBG_QMI,
> "fail to assign memory of sz\n");
> return -EINVAL;
> @@ -2086,7 +2086,7 @@ static int ath11k_qmi_assign_target_mem_chunk(struct ath11k_base *ab)
> }
>
> if (ath11k_core_coldboot_cal_support(ab)) {
> - if (resource_size(&res)) {
> + if (res.end > res.start) {
> ab->qmi.target_mem[idx].paddr =
> res.start + host_ddr_sz;
> ab->qmi.target_mem[idx].iaddr =
The rest looks good.
Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
next prev parent reply other threads:[~2025-12-08 10:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-06 17:58 Alexandru Gagniuc
2025-12-08 10:08 ` Vasanthakumar Thiagarajan [this message]
2025-12-08 10:25 ` Vasanthakumar Thiagarajan
2025-12-09 5:02 ` Vasanthakumar Thiagarajan
2025-12-08 10:23 ` Baochen Qiang
2025-12-24 21:47 ` Alex G.
2025-12-25 10:05 ` Baochen Qiang
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=01a05a49-ae5f-a3ec-7685-02a5f7cb9652@oss.qualcomm.com \
--to=vasanthakumar.thiagarajan@oss.qualcomm.com \
--cc=ath11k@lists.infradead.org \
--cc=jeff.johnson@oss.qualcomm.com \
--cc=jjohnson@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=mr.nuke.me@gmail.com \
--cc=robh@kernel.org \
--cc=stable@vger.kernel.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
all inboxes | Powered by JetHome®