From: Jeff Hugo <jeff.hugo@oss.qualcomm.com>
To: Kishore Batta <kishore.batta@oss.qualcomm.com>,
Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>,
Carl Vanderlip <carl.vanderlip@oss.qualcomm.com>,
Oded Gabbay <ogabbay@kernel.org>,
Manivannan Sadhasivam <mani@kernel.org>,
andersson@kernel.org
Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org,
mhi@lists.linux.dev
Subject: Re: [PATCH v4 6/9] bus: mhi: Load DDR training data using per-device serial number
Date: Thu, 9 Apr 2026 15:23:12 -0600 [thread overview]
Message-ID: <2865b4a9-9044-4593-b32d-39b581298edd@oss.qualcomm.com> (raw)
In-Reply-To: <20260319-sahara_protocol_new_v2-v4-6-47ad79308762@oss.qualcomm.com>
On 3/19/2026 12:31 AM, Kishore Batta wrote:
> Devices may provide device-specific DDR training data that can be reused
> across boot to avoid retraining and reduce boot time. The Sahara driver
> currently always falls back to the default DDR training image, even when
> per-device training data is available.
>
> Extend the firmware loading logic to first attempt loading a per-device
> DDR training image using the device serial number. If the serial-specific
> image is not present, fallback to the existing default image, preserving
> current behavior.
>
> This change enables DDR training data reuse when available while keeping
> the existing training flow unchanged for devices without saved data.
>
> Signed-off-by: Kishore Batta <kishore.batta@oss.qualcomm.com>
> ---
> drivers/bus/mhi/sahara/sahara.c | 47 ++++++++++++++++++++++++++++++++---------
> 1 file changed, 37 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/bus/mhi/sahara/sahara.c b/drivers/bus/mhi/sahara/sahara.c
> index 4ea14c57774f51a778289d7409372a6ab21fea60..0a0f578aaa47ab2c4ca0765666b392fb9936ddd5 100644
> --- a/drivers/bus/mhi/sahara/sahara.c
> +++ b/drivers/bus/mhi/sahara/sahara.c
> @@ -61,6 +61,8 @@
> #define SAHARA_MEM_DEBUG64_LENGTH 0x18
> #define SAHARA_MEM_READ64_LENGTH 0x18
>
> +#define SAHARA_DDR_TRAINING_IMG_ID 34
> +
> struct sahara_packet {
> __le32 cmd;
> __le32 length;
> @@ -365,16 +367,41 @@ static int sahara_find_image(struct sahara_context *context, u32 image_id)
> return 0;
> }
>
> - /*
> - * This image might be optional. The device may continue without it.
> - * Only the device knows. Suppress error messages that could suggest an
> - * a problem when we were actually able to continue.
> - */
> - ret = sahara_request_fw(context, context->image_table[image_id]);
> - if (ret) {
> - dev_dbg(&context->mhi_dev->dev, "request for image id %d / file %s failed %d\n",
> - image_id, context->image_table[image_id], ret);
> - return ret;
> + /* DDR training special case: Try per-serial number file first */
> + if (image_id == SAHARA_DDR_TRAINING_IMG_ID && context->fw_folder) {
> + u32 serial_num = context->mhi_dev->mhi_cntrl->serial_number;
> +
> + fw_path = kasprintf(GFP_KERNEL,
> + "qcom/%s/mdmddr_0x%x.mbn",
> + context->fw_folder, serial_num);
> + if (!fw_path)
> + return -ENOMEM;
> +
> + ret = sahara_request_fw(context, fw_path);
> + kfree(fw_path);
> +
> + if (ret) {
> + ret = sahara_request_fw(context, context->image_table[image_id]);
> + if (ret) {
> + dev_dbg(&context->mhi_dev->dev,
> + "request for image id %d / file %s failed %d\n",
> + image_id, context->image_table[image_id], ret);
> + }
> + return ret;
> + }
This is entirely redundant with the else in the next line. I don't
understand why id 34 could be reserved for training data, but also be a
valid image if the training data was not found.
Just have the if that looks for the training data, and an if that if
there is no found image, do a normal lookup.
> + } else {
> + /*
> + * This image might be optional. The device may continue without it.
> + * Only the device knows. Suppress error messages that could suggest an
> + * a problem when we were actually able to continue.
> + */
> + ret = sahara_request_fw(context, context->image_table[image_id]);
> + if (ret) {
> + dev_dbg(&context->mhi_dev->dev,
> + "request for image id %d / file %s failed %d\n",
> + image_id, context->image_table[image_id], ret);
> + return ret;
> + }
> }
>
> context->active_image_id = image_id;
>
next prev parent reply other threads:[~2026-04-09 21:23 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-19 6:31 [PATCH v4 0/9] Qualcomm Sahara protocol enhancements Kishore Batta
2026-03-19 6:31 ` [PATCH v4 1/9] Add documentation for Sahara protocol Kishore Batta
2026-04-09 19:47 ` Jeff Hugo
2026-04-13 9:03 ` Kishore Batta
2026-03-19 6:31 ` [PATCH v4 2/9] bus: mhi: Move sahara protocol driver under drivers/bus/mhi Kishore Batta
2026-04-09 20:20 ` Jeff Hugo
2026-04-13 9:03 ` Kishore Batta
2026-04-13 11:04 ` Manivannan Sadhasivam
2026-04-14 9:45 ` Kishore Batta
2026-04-13 11:20 ` Manivannan Sadhasivam
2026-04-14 9:48 ` Kishore Batta
2026-03-19 6:31 ` [PATCH v4 3/9] bus: mhi: Match devices exposing the protocol on the SAHARA channel Kishore Batta
2026-04-09 20:23 ` Jeff Hugo
2026-04-13 9:03 ` Kishore Batta
2026-03-19 6:31 ` [PATCH v4 4/9] bus: mhi: Centralize firmware image table selection at probe time Kishore Batta
2026-04-09 20:52 ` Jeff Hugo
2026-04-13 9:04 ` Kishore Batta
2026-04-13 11:26 ` Manivannan Sadhasivam
2026-04-14 9:49 ` Kishore Batta
2026-03-19 6:31 ` [PATCH v4 5/9] bus: mhi: Add QDU100 variant and image_id firmware fallback Kishore Batta
2026-04-09 21:14 ` Jeff Hugo
2026-04-13 11:34 ` Manivannan Sadhasivam
2026-04-14 9:51 ` Kishore Batta
2026-03-19 6:31 ` [PATCH v4 6/9] bus: mhi: Load DDR training data using per-device serial number Kishore Batta
2026-04-09 21:23 ` Jeff Hugo [this message]
2026-03-19 6:31 ` [PATCH v4 7/9] bus: mhi: Capture DDR training data using command mode Kishore Batta
2026-03-22 17:39 ` kernel test robot
2026-04-09 21:27 ` Jeff Hugo
2026-04-13 9:05 ` Kishore Batta
2026-03-19 6:31 ` [PATCH v4 8/9] bus: mhi: Expose DDR training data via controller sysfs Kishore Batta
2026-04-13 11:58 ` Manivannan Sadhasivam
2026-04-14 9:56 ` Kishore Batta
2026-03-19 6:31 ` [PATCH v4 9/9] Documentation: ABI: Add sysfs ABI documentation for DDR training data Kishore Batta
2026-04-09 21:30 ` Jeff Hugo
2026-04-13 9:05 ` Kishore Batta
2026-04-13 11:59 ` Manivannan Sadhasivam
2026-04-14 9:57 ` Kishore Batta
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=2865b4a9-9044-4593-b32d-39b581298edd@oss.qualcomm.com \
--to=jeff.hugo@oss.qualcomm.com \
--cc=andersson@kernel.org \
--cc=carl.vanderlip@oss.qualcomm.com \
--cc=corbet@lwn.net \
--cc=dri-devel@lists.freedesktop.org \
--cc=kishore.batta@oss.qualcomm.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mani@kernel.org \
--cc=mhi@lists.linux.dev \
--cc=ogabbay@kernel.org \
--cc=skhan@linuxfoundation.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