mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mukesh Savaliya <mukesh.savaliya@oss.qualcomm.com>
To: Viken Dadhaniya <viken.dadhaniya@oss.qualcomm.com>,
	Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konradybcio@kernel.org>
Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH v2] soc: qcom: geni-se: Use HW PROG_RAM_DEPTH to validate firmware size
Date: Thu, 2 Jul 2026 11:19:23 +0530	[thread overview]
Message-ID: <46b85bf0-05e1-4df4-a72a-48957d01acb9@oss.qualcomm.com> (raw)
In-Reply-To: <20260701-qup-se-increase-ram-cnt-v2-1-0618a19f26c3@oss.qualcomm.com>



On 7/1/2026 9:51 AM, Viken Dadhaniya wrote:
> The hardcoded MAX_GENI_CFG_RAMn_CNT limit is not accurate for all SoCs:
SOCs ?
> some targets have less CFG RAM than the constant implies, while others
> like QCS615 need more entries than the old limit of 455 allowed, causing
> valid firmware to be rejected at load time.
> 
> Rather than hardcoding a constant, read PROG_RAM_DEPTH from SE_HW_PARAM_2
> at runtime to get the actual CFG RAM depth of the hardware instance and
> use that as the upper bound for firmware size validation.
> 
> Fixes: d4bf06592ad6 ("soc: qcom: geni-se: Add support to load QUP SE Firmware via Linux subsystem")
> Cc: stable@vger.kernel.org
> Signed-off-by: Viken Dadhaniya <viken.dadhaniya@oss.qualcomm.com>
> ---
> Changes in v2:
> - Replace hardcoded MAX_GENI_CFG_RAMn_CNT with runtime read of
>    PROG_RAM_DEPTH from SE_HW_PARAM_2 for per-SoC accuracy
> - Link to v1: https://patch.msgid.link/20260522-qup-se-increase-ram-cnt-v1-1-71854d0b2ef0@oss.qualcomm.com
> ---
>   drivers/soc/qcom/qcom-geni-se.c  | 23 +++++++++++++----------
>   include/linux/soc/qcom/geni-se.h |  4 ++++
>   2 files changed, 17 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/soc/qcom/qcom-geni-se.c b/drivers/soc/qcom/qcom-geni-se.c
> index cd1779b6a91a..87907f559bd4 100644
> --- a/drivers/soc/qcom/qcom-geni-se.c
> +++ b/drivers/soc/qcom/qcom-geni-se.c

[...]

>   
> @@ -1066,10 +1067,12 @@ static struct se_fw_hdr *geni_find_protocol_fw(struct device *dev, const struct
>   			sefw->fw_size_in_items = cpu_to_le16(fw_size);
>   		}
>   
> -		if (fw_size >= MAX_GENI_CFG_RAMn_CNT) {
> +		prog_ram_depth = FIELD_GET(PROG_RAM_DEPTH_MSK,
> +					   readl_relaxed(se->base + SE_HW_PARAM_2));
> +		if (fw_size >= prog_ram_depth) {
>   			dev_err(dev,
> -				"Firmware size (%u) exceeds max allowed RAMn count (%u)\n",
> -				fw_size, MAX_GENI_CFG_RAMn_CNT);
> +				"Firmware size (%u) exceeds HW PROG_RAM_DEPTH (%u)\n",
Actual programmable FW memory ? something which is readable instead of 
same macro.
> +				fw_size, prog_ram_depth);
>   			continue;
>   		}

[...]


      parent reply	other threads:[~2026-07-02  5:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-01  4:21 Viken Dadhaniya
2026-07-01 11:12 ` Konrad Dybcio
2026-07-02  5:49 ` Mukesh Savaliya [this message]

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=46b85bf0-05e1-4df4-a72a-48957d01acb9@oss.qualcomm.com \
    --to=mukesh.savaliya@oss.qualcomm.com \
    --cc=andersson@kernel.org \
    --cc=konradybcio@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=viken.dadhaniya@oss.qualcomm.com \
    /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

Powered by JetHome