dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Mukesh Ojha" <mukesh.ojha@oss.qualcomm.com>
Cc: dri-devel@lists.freedesktop.org, media-ci@linuxtv.org
Subject: Re: [PATCH v2 8/9] soc: qcom: mdt_loader: remove qcom_mdt_load()
Date: Sat, 14 Nov 2026 18:54:58 +0000	[thread overview]
Message-ID: <sashiko-outbox-214919@kernel.org> (raw)
In-Reply-To: <20261113185009.157893-9-mukesh.ojha@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] soc: qcom: mdt_loader: undocumented mapping change in
  qcom_mdt_load_no_init()
--

commit 1090e40402733b5aabfbf149a8510b247a28a308
Author: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>

soc: qcom: mdt_loader: remove qcom_mdt_load()

This commit removes the unused qcom_mdt_load() helper and moves memory
region mapping from qcom_mdt_pas_load() into qcom_mdt_load_no_init() when
mem_region is NULL.

> diff --git a/drivers/soc/qcom/mdt_loader.c b/drivers/soc/qcom/mdt_loader.c
> index aafa83466b92b..436d8bc4847a3 100644
> --- a/drivers/soc/qcom/mdt_loader.c
> +++ b/drivers/soc/qcom/mdt_loader.c
> @@ -326,7 +326,8 @@ static bool qcom_mdt_bins_are_split(const struct firmware *fw)
>   * @dev:	device handle to associate resources with
>   * @fw:		firmware object for the mdt file
>   * @fw_name:	name of the firmware, for construction of segment file names
> - * @mem_region:	allocated memory region to load firmware into
> + * @mem_region:	virtual address of the memory region to load firmware into,
> + *		or NULL to have the region mapped internally with ioremap_wc()
>   * @mem_phys:	physical address of allocated memory region
>   * @mem_size:	size of the allocated memory region
>   * @reloc_base:	adjusted physical address after relocation
> @@ -341,6 +342,7 @@ int qcom_mdt_load_no_init(struct device *dev, const struct firmware *fw,
>  	const struct elf32_phdr *phdrs;
>  	const struct elf32_phdr *phdr;
>  	const struct elf32_hdr *ehdr;
> +	void __iomem *mapped = NULL;
>  	phys_addr_t mem_reloc;
>  	phys_addr_t min_addr = PHYS_ADDR_MAX;
>  	ssize_t offset;
> @@ -350,12 +352,22 @@ int qcom_mdt_load_no_init(struct device *dev, const struct firmware *fw,
>  	int ret = 0;
>  	int i;
>  
> -	if (!fw || !mem_region || !mem_phys || !mem_size)
> +	if (!fw || !mem_phys || !mem_size)
>  		return -EINVAL;
>  
>  	if (!mdt_header_valid(fw))
>  		return -EINVAL;
>  
> +	if (!mem_region) {
> +		mapped = ioremap_wc(mem_phys, mem_size);
> +		if (!mapped) {
> +			dev_err(dev, "unable to map memory region: %pa+%zx\n",
> +				&mem_phys, mem_size);
> +			return -ENOMEM;
> +		}
> +		mem_region = (__force void *)mapped;
> +	}
> +
>  	is_split = qcom_mdt_bins_are_split(fw);
>  	ehdr = (struct elf32_hdr *)fw->data;
>  	phdrs = (struct elf32_phdr *)(fw->data + ehdr->e_phoff);
> @@ -434,39 +446,13 @@ int qcom_mdt_load_no_init(struct device *dev, const struct firmware *fw,
>  	if (reloc_base)
>  		*reloc_base = mem_reloc;
>  
> +	if (mapped)
> +		iounmap(mapped);
> +
>  	return ret;
>  }
>  EXPORT_SYMBOL_GPL(qcom_mdt_load_no_init);
[ ... ]
> @@ -486,21 +472,14 @@ EXPORT_SYMBOL_GPL(qcom_mdt_load);
>  int qcom_mdt_pas_load(struct qcom_pas_context *ctx, const struct firmware *fw,
>  		      const char *firmware, phys_addr_t *reloc_base)
>  {
> -	void __iomem *mem_region;
>  	int ret;
>  
>  	ret = __qcom_mdt_pas_init(ctx->dev, fw, firmware, ctx->pas_id, ctx->mem_phys, ctx);
>  	if (ret)
>  		return ret;
>  
> -	mem_region = qcom_pas_ctx_map(ctx);
> -	if (!mem_region)
> -		return -ENOMEM;
> -
> -	ret = qcom_mdt_load_no_init(ctx->dev, fw, firmware, (__force void *)mem_region,
> -				    ctx->mem_phys, ctx->mem_size, reloc_base);
> -	iounmap(mem_region);
> -	return ret;
> +	return qcom_mdt_load_no_init(ctx->dev, fw, firmware, NULL,
> +				     ctx->mem_phys, ctx->mem_size, reloc_base);
>  }
>  EXPORT_SYMBOL_GPL(qcom_mdt_pas_load);

[Severity: Medium]
Why move the ioremap_wc() mapping from qcom_mdt_pas_load() into
qcom_mdt_load_no_init() when this patch is only supposed to remove the
unused qcom_mdt_load()?

qcom_pas_ctx_map() in include/linux/firmware/qcom/qcom_pas.h already
encapsulates this exact ioremap_wc() and dev_err() sequence for PAS
callers:

include/linux/firmware/qcom/qcom_pas.h:qcom_pas_ctx_map() {
	void __iomem *ptr = ioremap_wc(ctx->mem_phys, ctx->mem_size);

	if (!ptr)
		dev_err(ctx->dev, "unable to map memory region: %pa+%zx\n",
			&ctx->mem_phys, ctx->mem_size);
	return ptr;
}

Open-coding it inside qcom_mdt_load_no_init() duplicates qcom_pas_ctx_map()
and drops the !mem_region -EINVAL check for non-PAS callers (such as
venus_load_fw(), adsp_load(), and q6v5_wcss_load()), so a caller that
passes a NULL mem_region after an unchecked mapping failure will silently
remap the region instead of failing with -EINVAL.  None of these changes to
qcom_mdt_load_no_init() and qcom_mdt_pas_load() are mentioned in the commit
message.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261113185009.157893-1-mukesh.ojha@oss.qualcomm.com?part=8

  reply	other threads:[~2026-11-14 18:55 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 18:50 [PATCH v2 0/9] Migrate PAS clients to qcom_mdt_pas_load() and qcom_pas_prepare_and_auth_reset() Mukesh Ojha
2026-11-13 18:50 ` [PATCH v2 1/9] firmware: qcom: pas: add qcom_pas_context_init() for pre-allocated context Mukesh Ojha
2026-11-13 19:03   ` Alex Elder
2026-11-13 18:50 ` [PATCH v2 2/9] remoteproc: qcom_wcnss: migrate to qcom_mdt_pas_load() and qcom_pas_prepare_and_auth_reset() Mukesh Ojha
2026-11-14  7:29   ` kernel test robot
2026-11-14 14:49   ` kernel test robot
2026-11-14 18:54   ` sashiko-bot
2026-11-13 18:50 ` [PATCH v2 3/9] drm/msm/adreno: migrate zap shader loading " Mukesh Ojha
2026-11-14 18:54   ` sashiko-bot
2026-11-13 18:50 ` [PATCH v2 4/9] media: iris: migrate firmware " Mukesh Ojha
2026-11-14 18:54   ` sashiko-bot
2026-11-13 18:50 ` [PATCH v2 5/9] media: venus: " Mukesh Ojha
2026-11-14 18:54   ` sashiko-bot
2026-11-13 18:50 ` [PATCH v2 6/9] net: ipa: " Mukesh Ojha
2026-11-13 19:03   ` Alex Elder
2026-11-14 18:54   ` sashiko-bot
2026-11-13 18:50 ` [PATCH v2 7/9] wifi: ath12k: " Mukesh Ojha
2026-11-13 21:54   ` Jeff Johnson
2026-11-14 18:54   ` sashiko-bot
2026-11-13 18:50 ` [PATCH v2 8/9] soc: qcom: mdt_loader: remove qcom_mdt_load() Mukesh Ojha
2026-11-14 18:54   ` sashiko-bot [this message]
2026-11-13 18:50 ` [PATCH v2 9/9] firmware: qcom: pas: remove qcom_pas_auth_and_reset() Mukesh Ojha

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=sashiko-outbox-214919@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=media-ci@linuxtv.org \
    --cc=mukesh.ojha@oss.qualcomm.com \
    --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