From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 37942FCC9D4 for ; Tue, 10 Mar 2026 07:22:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8C90810E65A; Tue, 10 Mar 2026 07:22:39 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=qualcomm.com header.i=@qualcomm.com header.b="hiqGaWm4"; dkim=pass (2048-bit key; unprotected) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="b041q6xv"; dkim-atps=neutral Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8842710E65A for ; Tue, 10 Mar 2026 07:22:38 +0000 (UTC) Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62A2EQwE2460625 for ; Tue, 10 Mar 2026 07:22:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= AWRwk+1b+0EakwPo+UxNIgaxtaiGjN34TJYH+DHiZ08=; b=hiqGaWm4wM/zo3m5 4B8q15B09kHMejvtUdfuy/Z/8rTnEEbOVRPm3wXG8sFkfoyywcMrkcDXsrCCYUTd srUqqhQr2B/OrjxtmsRaIFuKM489ITCnlsx9ekFFTAxcdmfvf3Pio+B/iSDZXk+K CK94vRV/HLxIB/4wWU207FlyqJ+q9q3g0B3yiNWXpWOrBQTTcu7u7kOpx9sAPK2p bdzR6/EuD16zZ0pP14CsrnVnoROMYZD7/DUPVS+C+nQjpYZzf48GLLuOj5UVCQE1 TgVfISsfx6H7nSUPH1W+Qx0gp6/iAvgDRMQgSxHtKzTtJ/PwbRIC3SfbAXVi/ytT DnTTdg== Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4csyv1b3e5-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 10 Mar 2026 07:22:37 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-2ae6961bff0so355337935ad.2 for ; Tue, 10 Mar 2026 00:22:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773127357; x=1773732157; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=AWRwk+1b+0EakwPo+UxNIgaxtaiGjN34TJYH+DHiZ08=; b=b041q6xve6yFV5T+GqKTGFM4/STu78v69uZD/RB5qBz+OgmOLpGYE/cwm20hWvvaYA +SBrXmDMMNRZNa/6WOBg9GGnwbJIrgZV8yorEid1WLLGaI17tzsNE1xxP60sp4Tf9yru fbQuHZ4kaZCB4KiKyUelv2FHzBQ0Cg434rCqmUjA8eSIkdfhyEwgGXk0Sk22W21i/1m2 qHnrJZZ63nVvXz20PvTqx7tUCIRQyOk60lpMkhyZZN2EJlpDIDxWo1H5orLV/07y246a VB9GAbYGVfsxrd/uKiSot+XSniqzolE7C/g+BiOPoRazR/VLOuQkG10kgBHu3BeZ1zlN yDyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773127357; x=1773732157; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=AWRwk+1b+0EakwPo+UxNIgaxtaiGjN34TJYH+DHiZ08=; b=AJfkmCUNTRsdg3Eb8mCGDvUHgWfcqrJJv7noKPcmsGKRQ2bVOuHQmr4FymqD5x3RY/ 9t22qNur9JlOPVRbsgiW6+hvyJAg07IY3wEABpEsRzSLMk1lwOhLgpauV50wfxX0dGme wc2fQajRDBGCyli/G7IyhKGc5tXxuHwzkoJtUUwGEoAz4lfK/2e/aDR4k7T5J1RlU3/t SSMjqqYEEdFWFWefkmei/YsvSuKtPyPGg5tCQwPtHJ9PJuY184mZ4ivgtDSMutNNt0mz bAC8NoKCgSFQHc33YlWfuRcjo7dmDqBnVS/QYVvDJkxd3HRS8L4eZotpztX5KOQrYFaT gK+w== X-Forwarded-Encrypted: i=1; AJvYcCX24kQGSCL25rBWNPmrLgRlmCS0V0xZbb1C/MezxuJsG3xWluseCuym+2ypgQLeB21ZNJRUmTsAEJ4=@lists.freedesktop.org X-Gm-Message-State: AOJu0Yw25qqoSQB7JogJNiCadDShY6aYSoSrAxyXuhnFjKaZ/5465y2k 9YUzMpqFtSuWAgElARLPd6n+5gCqrSPYVN+rtvJwp3A49w9qXdOWPyE2AhJpQs3ol9JwZDY73yk LBCDuIGlh6BJJUOo8Fm7iB2Pk6kwU7WoNZIsJFv0aHd6PmLVZ2s/v7A/oeE2Wve/0hh3L84c= X-Gm-Gg: ATEYQzw2o+pBTI+jjeKj9XcaqrjzDasFlkrA0JZPxpR2MUg6thcevo/RFP/FhSxesq2 pxqJjxxqYHM3XLUFdG8u4c1U7e6o8PP3054vELtAa+S2cAqcAhqqDyDaaMoGuoq5KsQrAiRyrP4 +y0wKmQrnkY0AQAMPIB0Kj7zod8JNLZim/w/xvmIMX1usC19Y5cv1jeRIhH90qs+5RgtVl7ZB72 u6jBIm2pgLXlvJVsQ8w48TgZRtIxE2EzHrq6xwwVS43/vVIpkcXHtRS6aL+CgQ2SxcPrDVuHxO+ jmz85TXcio3Uf80YSBg1avGxWmZZlZvG9tEKaEvtvdXXrmd3m6ywzUt+kCM6nN6j4UBcQ+DtQ1W iRmqKjgWN4tKr6KR145udqWkieKw55LOTU/kjd2bD1ijZrw7my8k= X-Received: by 2002:a17:903:3510:b0:2ae:57e2:9b32 with SMTP id d9443c01a7336-2ae823679c9mr142880565ad.8.1773127357222; Tue, 10 Mar 2026 00:22:37 -0700 (PDT) X-Received: by 2002:a17:903:3510:b0:2ae:57e2:9b32 with SMTP id d9443c01a7336-2ae823679c9mr142880315ad.8.1773127356698; Tue, 10 Mar 2026 00:22:36 -0700 (PDT) Received: from hu-batta-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2ae840b2e9dsm185200325ad.85.2026.03.10.00.22.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Mar 2026 00:22:36 -0700 (PDT) From: Kishore Batta Date: Tue, 10 Mar 2026 12:52:03 +0530 Subject: [PATCH v3 6/9] bus: mhi: Load DDR training data using per-device serial number MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260310-sahara_protocol_new_v2-v3-6-994ea4b0d5ad@oss.qualcomm.com> References: <20260310-sahara_protocol_new_v2-v3-0-994ea4b0d5ad@oss.qualcomm.com> In-Reply-To: <20260310-sahara_protocol_new_v2-v3-0-994ea4b0d5ad@oss.qualcomm.com> To: Jonathan Corbet , Shuah Khan , Jeff Hugo , Carl Vanderlip , Oded Gabbay , Manivannan Sadhasivam 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, Kishore Batta X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1773127328; l=3154; i=kishore.batta@oss.qualcomm.com; s=20260206; h=from:subject:message-id; bh=Ap7TaXFPFmY7vxQioEQxXOj5gqr4VqCldx5s0gGK/Jw=; b=jGY5fnLsLQTR3pxOzCMF05KRfsJnnBISbNlEOkTYIaDuFNBt328cRi62kblnpXDbp/jYHl6h3 Qjm9GgWdCf6DGz76s0BGNvrnj7HqC45wHyAkcYNbIM5RGCOe+hQ0tPX X-Developer-Key: i=kishore.batta@oss.qualcomm.com; a=ed25519; pk=vJo8RvTf+HZpRLK2oOIljmbn9l3zFkibCGh+blaqZCw= X-Proofpoint-GUID: W0U6t2ZZslnXyTddk2dxo-SVcXrUsLYy X-Proofpoint-ORIG-GUID: W0U6t2ZZslnXyTddk2dxo-SVcXrUsLYy X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzEwMDA2MSBTYWx0ZWRfX/D5qrP6LTNQm +58mzrPCHDEs/FDvqUwj02RCy9IpXwBuxbHUkeTkf1q72qLM12yKa517pLJBjDGnFrQOz70uKl1 kjHz2dAlPwTJBfVbP0CeBZrpfXjORAYGw9mjIV4PZeH9y5IU5F7ysmlclB3SqidWFyuj5MssItg 9JA8ifPrTAxhoC/LDtr2vWvN0w5aoED0aT3Z8FFqomv8G7I3D69if3uh9nLzPKLZ8A7GBipJSdf Rsz7MUbQlIwA5w1yGan41lCf5UXEBdcyKlCB5cXjJSkZ6URIvm7KlM3U3H5GOrtFeZ4ncPT1ROs FAFNvao8Mjrk+7zFCrPV+vvE+AAXZNZUqWZiS2jEDK1C/Gp+YRltOms16/Z2DaA5tMCViBR3psv oriPydsIBABfwJfnHGQ0rb7AHaiiT11qMyT5x5escKeiOcXDGhmClbD3C9d5r0sP4CDVPWWoBIy D60BFg8Q4uTaY66GXyg== X-Authority-Analysis: v=2.4 cv=Cuays34D c=1 sm=1 tr=0 ts=69afc6bd cx=c_pps a=MTSHoo12Qbhz2p7MsH1ifg==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=EUspDBNiAAAA:8 a=ygoVp7MZ-9MK0Bp9ExEA:9 a=QEXdDO2ut3YA:10 a=GvdueXVYPmCkWapjIL-Q:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-10_01,2026-03-09_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 clxscore=1015 spamscore=0 adultscore=0 priorityscore=1501 phishscore=0 suspectscore=0 lowpriorityscore=0 bulkscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603100061 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 --- 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; + } + } 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; -- 2.34.1