Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "George Moussalem" <george.moussalem@outlook.com>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH ath-next 05/16] wifi: ath11k: Add ability to set BDF and M3 dump memory addresses
Date: Wed, 23 Sep 2026 12:18:51 +0000	[thread overview]
Message-ID: <20260923121852.65A811F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260923-ipq5018-qcn6122-mpd-v1-5-86729521a75c@outlook.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] wifi: ath11k: CALDB memory mapping corrupted by shared 'res' variable clobbering
- [High] wifi: ath11k: BDF and HOST_DDR memory regions overlap at the same physical address
--

commit 12078c78e9f034dda1106d3aea7be9725dcdf38d
Author: George Moussalem <george.moussalem@outlook.com>

wifi: ath11k: Add ability to set BDF and M3 dump memory addresses

This commit adds the ability to look up reserved memory regions from the device
tree and use those addresses for the BDF and M3 dump instead of relying on
hardcoded hardware parameter values.

> diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c
> index bd81e8d3d5f7d..771ef9b5304f2 100644
> --- a/drivers/net/wireless/ath/ath11k/qmi.c
> +++ b/drivers/net/wireless/ath/ath11k/qmi.c
[ ... ]
> @@ -2073,7 +2112,11 @@ static int ath11k_qmi_assign_target_mem_chunk(struct ath11k_base *ab)
>  			idx++;
>  			break;
>  		case BDF_MEM_REGION_TYPE:
> -			ab->qmi.target_mem[idx].paddr = ab->hw_params.bdf_addr;
> +			ret = ath11k_qmi_reserved_memory_to_resource(ab, BDF_MEM_REGION_TYPE, &res);

[Severity: High]
Does overwriting the shared 'res' variable here (and later in the
M3_DUMP_REGION_TYPE case) corrupt the mapping for CALDB_MEM_REGION_TYPE?

If the firmware requests M3_DUMP_REGION_TYPE or BDF_MEM_REGION_TYPE before
CALDB_MEM_REGION_TYPE, 'res' will be overwritten. When CALDB_MEM_REGION_TYPE
is subsequently processed in ath11k_qmi_assign_target_mem_chunk(), it
calculates its physical address using the shared 'res' variable:

    ab->qmi.target_mem[idx].paddr = res.start + host_ddr_sz;

This would incorrectly use the clobbered region's base address (such as the
m3-dump address) instead of the HOST_DDR base address, mapping CALDB to an
invalid physical address.

> +			if (!ret && !(ab->qmi.target_mem[i].size > resource_size(&res)))
> +				ab->qmi.target_mem[idx].paddr = res.start;

[Severity: High]
Does this cause the BDF memory region to overlap exactly with the HOST_DDR
memory region?

Both HOST_DDR_REGION_TYPE and BDF_MEM_REGION_TYPE are mapped to the "q6-region"
memory space. By assigning res.start directly without any offset, the BDF
memory region would start at the exact same physical address as the HOST_DDR
chunk.

Previous hardware applied a hardcoded offset for the BDF address to separate
it from the HOST_DDR base, which is intended for firmware code and data.

> +			else
> +				ab->qmi.target_mem[idx].paddr = ab->hw_params.bdf_addr;
>  			ab->qmi.target_mem[idx].iaddr = NULL;
>  			ab->qmi.target_mem[idx].size = ab->qmi.target_mem[i].size;
>  			ab->qmi.target_mem[idx].type = ab->qmi.target_mem[i].type;
[ ... ]
> @@ -2107,6 +2150,16 @@ static int ath11k_qmi_assign_target_mem_chunk(struct ath11k_base *ab)
>  			ab->qmi.target_mem[idx].type = ab->qmi.target_mem[i].type;
>  			idx++;
>  			break;
> +		case M3_DUMP_REGION_TYPE:
> +			ret = ath11k_qmi_reserved_memory_to_resource(ab, M3_DUMP_REGION_TYPE, &res);

[Severity: High]
Could this also clobber the shared 'res' variable in the same way as the
BDF_MEM_REGION_TYPE case, causing the identical memory corruption issue for
CALDB_MEM_REGION_TYPE?

> +			if (!ret && !(ab->qmi.target_mem[i].size > resource_size(&res))) {
> +				ab->qmi.target_mem[idx].paddr = res.start;
> +				ab->qmi.target_mem[idx].iaddr = NULL;
> +				ab->qmi.target_mem[idx].size = ab->qmi.target_mem[i].size;
> +				ab->qmi.target_mem[idx].type = ab->qmi.target_mem[i].type;
> +				idx++;
> +			}
> +			break;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260923-ipq5018-qcn6122-mpd-v1-0-86729521a75c@outlook.com?part=5

  reply	other threads:[~2026-09-23 12:18 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-23 12:05 [PATCH ath-next 00/16] wifi: ath11k: add MultiPD support for AHB platforms George Moussalem via B4 Relay
2026-09-23 12:05 ` [PATCH ath-next 01/16] dt-bindings: net: wireless: ath11k: Sort compatible names alphabetically George Moussalem via B4 Relay
2026-09-28 10:45   ` Krzysztof Kozlowski
2026-09-23 12:05 ` [PATCH ath-next 02/16] dt-bindings: net: wireless: ath11k: Add bindings for IPQ5018 George Moussalem via B4 Relay
2026-09-23 12:14   ` sashiko-bot
2026-09-28 10:45   ` Krzysztof Kozlowski
2026-09-29 10:03     ` George Moussalem
2026-09-23 12:05 ` [PATCH ath-next 03/16] wifi: ath11k: Register root PD rproc notifier George Moussalem via B4 Relay
2026-09-23 12:17   ` sashiko-bot
2026-09-23 12:05 ` [PATCH ath-next 04/16] wifi: ath11k: Add support for loading m3 mbn firmware George Moussalem via B4 Relay
2026-09-23 12:15   ` sashiko-bot
2026-09-23 12:05 ` [PATCH ath-next 05/16] wifi: ath11k: Add ability to set BDF and M3 dump memory addresses George Moussalem via B4 Relay
2026-09-23 12:18   ` sashiko-bot [this message]
2026-09-23 12:05 ` [PATCH ath-next 06/16] firmware: qcom: scm: Add support for setting internal WiFi power mode George Moussalem via B4 Relay
2026-09-23 12:05 ` [PATCH ath-next 07/16] wifi: ath11k: Register userPD interrupts and SMEM entries George Moussalem via B4 Relay
2026-09-23 12:19   ` sashiko-bot
2026-09-23 12:05 ` [PATCH ath-next 08/16] wifi: ath11k: Power up userPD George Moussalem via B4 Relay
2026-09-23 12:17   ` sashiko-bot
2026-09-23 12:05 ` [PATCH ath-next 09/16] wifi: ath11k: Power down userPD George Moussalem via B4 Relay
2026-09-23 12:15   ` sashiko-bot
2026-09-23 12:05 ` [PATCH ath-next 10/16] dt-bindings: net: wireless: ath11k: Add bindings for QCN6122 George Moussalem via B4 Relay
2026-09-23 12:17   ` sashiko-bot
2026-09-23 12:05 ` [PATCH ath-next 11/16] wifi: ath11k: add hw params " George Moussalem via B4 Relay
2026-09-23 12:05 ` [PATCH ath-next 12/16] wifi: ath11k: add hal regs " George Moussalem via B4 Relay
2026-09-23 12:05 ` [PATCH ath-next 13/16] wifi: ath11k: add hw ring mask " George Moussalem via B4 Relay
2026-09-23 12:29   ` sashiko-bot
2026-09-23 12:05 ` [PATCH ath-next 14/16] wifi: ath11k: update hif and pci ops " George Moussalem via B4 Relay
2026-09-23 12:05 ` [PATCH ath-next 15/16] wifi: ath11k: define userPDs " George Moussalem via B4 Relay
2026-09-23 12:28   ` sashiko-bot
2026-09-23 12:05 ` [PATCH ath-next 16/16] wifi: ath11k: add QCN6122 device support George Moussalem via B4 Relay
2026-09-23 12:25   ` sashiko-bot

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=20260923121852.65A811F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=george.moussalem@outlook.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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