From nobody Thu Apr 9 09:04:43 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF68330E84A for ; Tue, 10 Mar 2026 07:22:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773127343; cv=none; b=IKr318wPGF8fg7IJV2CjhJdFrh/l/eRAtXOrWvmQJY9m5xsqXFfyHxtbFOmAe3IzTbHiu+qpTQztjiPHRX5KCSK4LY6sZQUCCmImrt0190PJ8WrF0MPzMqRjM28V+Jz/yZChA6+CD+X3aTPtWD4UxDL7BAK0Fx+QqgBEMs5KbaY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773127343; c=relaxed/simple; bh=1D00kesAnJ6aiS/h94SYG7huQNLbnZVj76ipx20EKSA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mqELWd14f6BNsEu/vUY4DpqR70zWsXEl07EzDAP6YT7d8FvgHGLKqKdYZfTD8KVH3tpwSwkUg8gp8xkEy4+AgXRbX0VyTfY2+vYmfWRvXBpaSJM1QmMVLVDJzW3ujOc+JSCGdgwIumrIjMxwIqgS0s2Y0LsKFgoohYxheFx+QS0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=C0MDgry3; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=bdlITkkf; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="C0MDgry3"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="bdlITkkf" Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62A2EmQI1900340 for ; Tue, 10 Mar 2026 07:22:20 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= 2juIOgJkND7DShqV2RiQUTSq3Zx05rOAfNWgAcwjbTU=; b=C0MDgry3XRQGae7x +rmPfSdPmg1vRLDnzImXQqMZ/txDme56lZj8l9IDvSZAi25LB1L9hjmwLzezXgF5 6/TZAvZiUs43/EeJkclHI+YijRVIOVtLgKWkY7oYUyqRhWDtzCc/OV4zuGLNuoCD ZBrEv/XORwB4YrHb4pH0CX87I67rCjJwCkxX1Ia0Pfib2i0WaZOfYtA7PfI5ZeLD MdQQlFGfmBSlpZoREft4SYwIghPvsOkAe0k/O5mWqdFf1a/HnZNTz/kxORQpTYhO YhOF9bfFnqU7jmDN8VBwcoy3dn42FfCDYwALB5g2+l+R/kos+xmCWcAsZOPmrXhk VaYA2A== Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cstsac5u0-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 10 Mar 2026 07:22:19 +0000 (GMT) Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-2ae502a1dd9so112809925ad.3 for ; Tue, 10 Mar 2026 00:22:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773127339; x=1773732139; darn=vger.kernel.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=2juIOgJkND7DShqV2RiQUTSq3Zx05rOAfNWgAcwjbTU=; b=bdlITkkfnxSc5hEiH0tgel3KRJxoq7ysBsvQ/+5D4XfADrXdwKJPBClCNzO9woOebS UCUNYBksXtTTWSkrKh7sQYb0A7fg9LkaUdyBlo088fxAcT44EqhfkjtBPbSii0fLYaGa vatKxsagVa2Nl7cGlTsroAxg37vZIEK6H9wmLv9PuvQG0JgxZYleejuEpoee9wZuawHL lGVhNTlPj0RZJGWZWCZd8X/s5OSOodt3NYx8uY3vZHEHELuaSkOrz3Yp4Lr76Dmth49C 4JEwiCCPl2I7Xa7n5mLIpxFv/VrT2QrKFss0K38djkWXV0PIt8SpB7MaI8dcnNJNz3SB OX6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773127339; x=1773732139; 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=2juIOgJkND7DShqV2RiQUTSq3Zx05rOAfNWgAcwjbTU=; b=e8OetdcQmD4tZPtQwjaQPDp5scsmsNvAIOctxLJURmCMXBCHnCHm5RIRVRAAcPUiGE KDkovAvyyjWENc92Zu+RkCahOO8DyRIg7jk3dYP7qAJyvAknPnnYKTkfrCNMWeEAk5b3 dcWoLZCXbDrceLERgZPdUpjzQDFQ/Nl1T0u3AHODGo3p4K56IqewOuSE1KMrYBmIAZRI bYWtikneZqaU8Wcdj0LnZJFjoyT+rdaNnJ6gHR/0/37xemHW1a6R33njmF/Wr5BdHlnu gr5J6Otagz1yB8A+8meR7YuB18qVX1q8fzU+Ac+ADd0CFyid39NK2Z0wYjcUejGV1+Cz KaYQ== X-Forwarded-Encrypted: i=1; AJvYcCXyu3l6IWLQZgbjMrqSMOLQyt2UKKU6AnHQCnSoaPwDsYObM1w384D236dnHQAem6RkW0SYt3CHOYQEHt0=@vger.kernel.org X-Gm-Message-State: AOJu0YzDzRRp7NIWeX3xsip3J002OSf33a2kpZQD0eB5rWJWCpJrbY5v sipBBVtsy5kQ3a+LNPN6YCIr1kgp+nkZc+qx6hb/PLIba4vAXTM9gZF2k68pA4elKeea58FMSnG L++5cNuXYKRKffkd7PlPU9KNvQvMfz8bFgpD6W1rMYWZ10TWGXSTcUlJvhkD254j3RQQ= X-Gm-Gg: ATEYQzwLtSQx6wGaQjoQ9evgB9Rw9MFLqt7QbI2GJpYMGjQj2UYmiSid88pSoVgFFf7 P7Od5rCLbVGDtSXfo0fY+wKd9rew1fVW9Jn/XXRXScmPlCC5qz4/0x3IGIo+V02+OgM/BW7Uxo/ h30qsVrp+8cPEB+/CuCXMfnCZcSBrgUwavph+zxz5Do3VDrPaVMyUjK9HVQPSGFTEoSaDUV7n5H M3O/dRiiHr6OomPOAylFEdYvn9gbWRH5J8n4IJExMt93ME7HGQLnj/JTH7cal3vYmG6IJ+FNcNX CXfQqd9CA2mE9fAjnQEfPiF6k02PjpohZEmgC7r64mku7e9mjODcKY9xxfgwdoWpq6ZAeeAvEWr kMp7TyDpSMjyqEFabkMLbR6v/cgGeouJ1naUqBA6VlPLyED8PCXk= X-Received: by 2002:a17:903:380f:b0:2ae:80b8:df16 with SMTP id d9443c01a7336-2ae82526790mr147434005ad.49.1773127337975; Tue, 10 Mar 2026 00:22:17 -0700 (PDT) X-Received: by 2002:a17:903:380f:b0:2ae:80b8:df16 with SMTP id d9443c01a7336-2ae82526790mr147433505ad.49.1773127336891; Tue, 10 Mar 2026 00:22:16 -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.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Mar 2026 00:22:16 -0700 (PDT) From: Kishore Batta Date: Tue, 10 Mar 2026 12:51:58 +0530 Subject: [PATCH v3 1/9] Add documentation for Sahara protocol. Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260310-sahara_protocol_new_v2-v3-1-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=70694; i=kishore.batta@oss.qualcomm.com; s=20260206; h=from:subject:message-id; bh=1D00kesAnJ6aiS/h94SYG7huQNLbnZVj76ipx20EKSA=; b=9x0Db2e0wDiRBp8kSLZmpiqqc0zkXqQAVZKbhnQTTcPlvapXLM8VILy4A+k14aZC/6ScwGuUv 79Ne/VvIVRgB9SiW9ts4KEcFYAagq5kx/I9VBvVBWviz328NgLDuyHF X-Developer-Key: i=kishore.batta@oss.qualcomm.com; a=ed25519; pk=vJo8RvTf+HZpRLK2oOIljmbn9l3zFkibCGh+blaqZCw= X-Proofpoint-GUID: CboC_5xr3rZRQbn0ntjPlJZPK91kAgFM X-Authority-Analysis: v=2.4 cv=I+Vohdgg c=1 sm=1 tr=0 ts=69afc6ab cx=c_pps a=JL+w9abYAAE89/QcEU+0QA==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=ZpdpYltYx_vBUK5n70dp:22 a=EUspDBNiAAAA:8 a=MMUwo3wwYuTaqRZ-dQsA:9 a=t_MdwZQk9VBQcGG5:21 a=QEXdDO2ut3YA:10 a=324X-CrmTo6CU4MGRt3R:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzEwMDA2MSBTYWx0ZWRfX0g5M/UC2OUUS qZfzBTQ2Fmw1eY4dFN/TUObeQOGAw2xcBw9b+IXYe+I14qOU4UO+7VCVyaKmcfTt4XFNmB4QagD Qu+EMaUcx4CeNn1rIOcn6bw//rMaQapMley6okXA6OAlm3SVF8AhF2ylxll0U2oisfpOA1/uFKc flZRDGNvOZtjWPBrLc4rRd/RNR/OsatmqwPrTd7kIsW812yhKyv/PpJkVNXqy3NO6KzwID+8xqP 2ut71kLptfiM+1vjer9yjUosvcfwrdCJq5mrFpS5cCY06uR6+zFLok9/vBFirAiqUYaX+bCvglQ ZuK4Iu/uS0oMqruBE/7+S/MFSbdPoykR6A+V3is7w4UrBNv2s2N8wsZr8yde5hxEHj67XQ7BHj7 rTIGYkt9F3UC/1OhexP0lvlhMp9hE5edRxLudKXBrXEJDhsdjDRLLbUTLEU5fJr0swSRzJTOma0 /RXgEYf2s/fI7XIEneg== X-Proofpoint-ORIG-GUID: CboC_5xr3rZRQbn0ntjPlJZPK91kAgFM 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 phishscore=0 impostorscore=0 spamscore=0 malwarescore=0 suspectscore=0 bulkscore=0 lowpriorityscore=0 clxscore=1015 priorityscore=1501 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603100061 Introduce documentation for the Sahara protocol, describing its operational modes and their respective functions. The image transfer mode enables firmware transfer from host to device. The memory debug mode allows extraction of device memory contents to host. The command mode facilitates retrieval of DDR training data from the device and also to restore the training data back to device in subsequent boot of device to save boot time. Signed-off-by: Kishore Batta --- Documentation/sahara/index.rst | 14 + Documentation/sahara/sahara_protocol.rst | 1241 ++++++++++++++++++++++++++= ++++ 2 files changed, 1255 insertions(+) diff --git a/Documentation/sahara/index.rst b/Documentation/sahara/index.rst new file mode 100644 index 0000000000000000000000000000000000000000..073002c15a203344524e258b2aa= 0a6ce839e064b --- /dev/null +++ b/Documentation/sahara/index.rst @@ -0,0 +1,14 @@ +.. SPDX-License-Identifier: GPL-2.0-only + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +Qualcomm Sahara protocol +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +The Sahara protocol transfers data to and from memory and describes packet +structures, packet flows, and their usage. + +.. toctree:: + :maxdepth: 2 + :caption: Contents + + sahara_protocol diff --git a/Documentation/sahara/sahara_protocol.rst b/Documentation/sahar= a/sahara_protocol.rst new file mode 100644 index 0000000000000000000000000000000000000000..91204bb7d170be4fc4c85f142b8= f0b93d3c421a0 --- /dev/null +++ b/Documentation/sahara/sahara_protocol.rst @@ -0,0 +1,1241 @@ +.. SPDX-License-Identifier: GPL-2.0-only + + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D +Sahara protocol Specification +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D + +The Qualcomm Sahara protocol driver is primarily designed for transferring +software images from a host device to a target device using a simplified d= ata +transfer mechanism over a link. However, the sahara protocol does not supp= ort +any authentication/validation of the data sent between devices. Such a mec= hanism +is beyond the scope of the protocol. + +The Sahara protocol defines two types of packets - Command packet and Data +packet. + +Command packet +-------------- + These packets are sent between the host and the target to setup transfer= s of + data packets. The command packets contain a command ID and packet length. + Depending on the command, the packet may contain additional command spec= ific + field. + ++-------------+---------------+----------------+----------------+ +| Command ID | Packet length | Optional field | Optional field | ++-------------+---------------+----------------+----------------+ + +Data packet +----------- + The data packets contain RAW data as shown below. + ++---------------------------------------------------------+ +| RAW Data (arbitrary number of bytes) | ++---------------------------------------------------------+ + +Command packet optional fields +------------------------------ + ++---------+---------------+---------+-------------------------------------= ----+ +| ID val | Field | Sent by | Description = | ++---------+---------------+---------+-------------------------------------= ----+ +| 0x0 | - | - | Invalid = | ++---------+---------------+---------+-------------------------------------= ----+ +| 0x1 | Hello packet | Target | Initializes connection and protocol = | ++---------+---------------+---------+-------------------------------------= ----+ +| 0x2 | Hello response| Host | Acknowledges connection and protocol= | +| | | | sent by target. Also used to set mod= e of| +| | | | operation for target to execute. = | ++---------+---------------+---------+-------------------------------------= ----+ +| 0x3 | Read data | Target | Reads specified number of bytes from= | +| | | | host for a given image. = | ++---------+---------------+---------+-------------------------------------= ----+ +| 0x4 | End of image | Target | Indicates host that the single image= tx | +| | transfer | | is complete. Also used to indicate a= | +| | | | target failure during an image trans= fer | ++---------+---------------+---------+-------------------------------------= ----+ +| 0x5 | Done packet | Host | Sends acknowledgment from host that = a | +| | | | single image transfer is complete. = | ++---------+---------------+---------+-------------------------------------= ----+ +| 0x6 | Done response | Target | Provides the following information t= o | +| | | | host. = | +| | | | 1. Target is exiting protocol = | +| | | | 2. Whether the target expects to = | +| | | | re-enter protocol to transfer anothe= r | +| | | | image. = | ++---------+---------------+---------+-------------------------------------= ----+ +| 0x7 | Reset packet | Host | Instructs target to perform a reset.= | ++---------+---------------+---------+-------------------------------------= ----+ +| 0x8 | Reset response| Target | Indicates host that target is about = to | +| | | | reset. = | ++---------+---------------+---------+-------------------------------------= ----+ +| 0x9 | Memory debug | Target | Indicates host that target has enter= ed | +| | packet | | a debug mode where it is ready to = | +| | | | transfer its system memory contents = | ++---------+---------------+---------+-------------------------------------= ----+ +| 0xA | Memory read | Host | Reads specified number of bytes from= | +| | packet | | target's system memory, starting fro= m a | +| | | | specified address. = | ++---------+---------------+---------+-------------------------------------= ----+ +| 0xB | Command ready | Target | Indicates host that target is ready = to | +| | packet | | receive client commands. = | ++---------+---------------+---------+-------------------------------------= ----+ +| 0xC | Command switch| Host | Indicates target to switch modes. = | +| | mode packet | | 1. Image transfer pending mode. = | +| | | | 2. Image transfer complete mode. = | +| | | | 3. Memory debug mode. = | +| | | | 4. Command mode. = | ++---------+---------------+---------+-------------------------------------= ----+ +| 0xD | Command | Host | Indicates target to execute a given = | +| | execute packet| | client command. = | ++---------+---------------+---------+-------------------------------------= ----+ +| 0xE | Command | Target | Indicates host that target has execu= ted | +| | execute | | client command. Also used to indicat= e | +| | response | | status of executed command. = | +| | packet | | = | ++---------+---------------+---------+-------------------------------------= ----+ +| 0xF | Command | Host | Indicates target that host is ready = to | +| | execute | | receive data resulting from executin= g | +| | data | | previous client command. = | +| | packet | | = | ++---------+---------------+---------+-------------------------------------= ----+ +| 0x10 | 64 bit Memory | Target | Indicates host that target has enter= ed | +| | debug packet | | a debug mode where it is ready to = | +| | | | transfer its 64 bit system memory = | +| | | | contents. = | ++---------+---------------+---------+-------------------------------------= ----+ +| 0x11 | 64 bit Memory | Host | Reads specified number of bytes from= | +| | read packet | | target's system memory, starting fro= m a | +| | | | 64 bit specified address. = | ++---------+---------------+---------+-------------------------------------= ----+ +| 0x12 | 64 bit Read | Target | Reads specified number of bytes from= | +| | data | | host for a given 64 bit image. = | ++---------+---------------+---------+-------------------------------------= ----+ +| 0x13 | Reset sahara | Host | Resets Sahara state machine and ente= rs | +| | sate machine | | Sahara entry without target reset = | +| | packet | | = | ++---------+---------------+---------+-------------------------------------= ----+ +| 0x14 | Write data | Target | Writes specified number of bytes to = host| +| | packet | | for a given image = | ++---------+---------------+---------+-------------------------------------= ----+ +| Others | - | - | Invalid = | ++---------+---------------+---------+-------------------------------------= ----+ + + +Hello Packet +------------ + +The hello packet is the first packet that the target sends to the host. If= the +host receives any other packet, it sends a reset command to the target. Wh= en the +host receives a valid hello packet, it first verifies that the protocol ru= nning +on the target is compatible with the protocol running on the host. If the +protocol mismatch, the host sends a reset command to the target. The targe= t uses +the following format while sending a hello packet. + ++-----------+-------------+--------------------------------------+ +| Field | Length | Description | +| | (bytes) | | ++-----------+-------------+--------------------------------------+ +| Command | 4 | Command identifier code | ++-----------+-------------+--------------------------------------+ +| Length | 4 | Length of the packet(in bytes) | ++-----------+-------------+--------------------------------------+ +| Version | 4 | Version number of this protocol | ++-----------+-------------+--------------------------------------+ +| Version | 4 | Lowest Compatible version | +| Compatible| | | ++-----------+-------------+--------------------------------------+ +| Command | 4 | Maximum command packet length | +| packet | | (in bytes) the protocol supports. | +| length | | | ++-----------+-------------+--------------------------------------+ +| Mode | 4 | Expected mode of target operation | ++-----------+-------------+--------------------------------------+ +| Reserved | 4 | Reserved for future use. | ++-----------+-------------+--------------------------------------+ +| Reserved | 4 | Reserved for future use. | ++-----------+-------------+--------------------------------------+ +| Reserved | 4 | Reserved for future use. | ++-----------+-------------+--------------------------------------+ +| Reserved | 4 | Reserved for future use. | ++-----------+-------------+--------------------------------------+ +| Reserved | 4 | Reserved for future use. | ++-----------+-------------+--------------------------------------+ +| Reserved | 4 | Reserved for future use. | ++-----------+-------------+--------------------------------------+ + +The target also sends the following information: + 1. Maximum length of the command packet that it supports. The host uses = this + information to avoid sending more bytes than the target can support i= n the + receiving command buffer. + 2. Mode of operation it expects to enter, based on the boot up sequence.= The + supported modes of operation for the target are as follows: + ++-----------------------------+---------+---------------------------------= ---+ +| Mode | Mode ID | Description = | ++-----------------------------+---------+---------------------------------= ---+ +| SAHARA_MODE_IMAGE_TX_PENDING| 0x0 | Image transfer is in the pending= | +| | | mode. Transfer image from the ho= st.| +| | | After completion, the host shoul= d | +| | | expect another image transfer = | +| | | request. = | ++-----------------------------+---------+---------------------------------= ---+ +|SAHARA_MODE_IMAGE_TX_COMPLETE| 0x1 | Image transfer is in the complet= e | +| | | mode. Transfer image from the ho= st.| +| | | After completion, the host shoul= d | +| | | not expect another image transfe= r | +| | | request. = | ++-----------------------------+---------+---------------------------------= ---+ +| SAHARA_MODE_MEMORY_DBEUG | 0x2 | Memory debug mode. The host shou= ld | +| | | prepare to receive a memory dump= | +| | | from the target. = | ++-----------------------------+---------+---------------------------------= ---+ +| SAHARA_MODE_COMMAND | 0x3 | Command mode. The host executes = | +| | | operations on the target by send= ing| +| | | the appropriate client command t= o | +| | | the sahara client running on the= | +| | | target. The Sahar client interpr= ets| +| | | the client command and the respo= nse| +| | | is sent after execution of the = | +| | | given command. = | ++-----------------------------+---------+---------------------------------= ---+ + +Hello response packet +--------------------- + +After the host validates the protocol running on the target, it sends a re= sponse +to the target. The response contains the following information. +1. The protocol version that is running. +2. The minimum protocol version that it supports. +3. The mode of operation. + +The host sets the packet status field to success if no errors occur on the= host +side. After the target receives this packet, it can proceed with data tran= sfer +requests or memory debug. The host uses the following format while sending= a +hello response packet. + ++-----------+-------------+--------------------------------------+ +| Field | Length | Description | +| | (bytes) | | ++=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+ +| Command | 4 | Command identifier code | ++-----------+-------------+--------------------------------------+ +| Length | 4 | Length of the packet (in bytes) | ++-----------+-------------+--------------------------------------+ +| Version | 4 | Version number of this protocol | ++-----------+-------------+--------------------------------------+ +| Compatible| 4 | Lowest Compatible version | ++-----------+-------------+--------------------------------------+ +| Status | 4 | Success or error code | ++-----------+-------------+--------------------------------------+ +| Mode | 4 | Mode of operation for target to | +| | | execute | ++-----------+-------------+--------------------------------------+ +| Reserved | 4 | Reserved for future use | ++-----------+-------------+--------------------------------------+ +| Reserved | 4 | Reserved for future use | ++-----------+-------------+--------------------------------------+ +| Reserved | 4 | Reserved for future use | ++-----------+-------------+--------------------------------------+ +| Reserved | 4 | Reserved for future use | ++-----------+-------------+--------------------------------------+ +| Reserved | 4 | Reserved for future use | ++-----------+-------------+--------------------------------------+ +| Reserved | 4 | Reserved for future use | ++-----------+-------------+--------------------------------------+ + + +Read data packet / 64 bit read data packet +------------------------------------------ + +The read data packet serves as a generic data transfer packet when any ima= ge +data is to be transferred from the host to the target. This packet allows +flexibility in the way that the image is transferred from the host to the +target. As the target controls which data gets transferred, the target can +determine what parts of the image get transferred and in what order. The h= ost +need not be familiar about the structure of the image. It must open the fi= le and +start transferring the data to the target based on the parameters specifie= d in +the packet. + +This gives the target complete control over how the images are transferred= and +processed. To initiate an image transfer, the target fills the read data p= acket +with the image ID corresponding to the image that it wants to receive. The +target also sends the offset into the image file and the length of the dat= a(in +bytes) it wants to read from the image. After the host receives this packe= t, the +host responds with a data packet, which contains image data with the length +specified in the read data packet. The host uses the following format while +transferring the read data packet and 64-bit read data packet. + + +Read data packet format +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + ++-----------+-------------+--------------------------------------+ +| Field | Length | Description | +| | (bytes) | | ++-----------+-------------+--------------------------------------+ +| Command | 4 | Command identifier code | ++-----------+-------------+--------------------------------------+ +| Length | 4 | Length of the packet(in bytes) | ++-----------+-------------+--------------------------------------+ +| Image ID | 4 | ID of the image to be transferred. | ++-----------+-------------+--------------------------------------+ +| Data | 4 | Offset into the image file to start | +| offset | | transferring data. | ++-----------+-------------+--------------------------------------+ +| Data | 4 | Number of bytes target wants to | +| Length | | transfer from the image. | ++-----------+-------------+--------------------------------------+ + + +64-bit read data packet format +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D + ++-----------+-------------+--------------------------------------+ +| Field | Length | Description | +| | (bytes) | | ++-----------+-------------+--------------------------------------+ +| Command | 4 | Command identifier code | ++-----------+-------------+--------------------------------------+ +| Length | 4 | Length of the packet(in bytes) | ++-----------+-------------+--------------------------------------+ +| Image ID | 8 | ID of the image to be transferred. | ++-----------+-------------+--------------------------------------+ +| Data | 8 | Offset into the image file to start | +| offset | | transferring data. | ++-----------+-------------+--------------------------------------+ +| Data | 8 | Number of bytes target wants to | +| Length | | transfer from the image. | ++-----------+-------------+--------------------------------------+ + +If any of the preceding fields are invalid, or if any other error occurs o= n the +host, the host sends a data packet with length that does not match with wh= at the +target was expecting. The resulting error forces the target to send an end= of +image transfer packet with an error code in the status field and enables b= oth +the target and the host to enter an error handling state. + +End of Image transfer packet +---------------------------- + +If an image transfer is successfully completed, the target sends the host = an end +of image transfer packet with a success status. The target then waits for = the +host to send a done packet. If any error occurs during the transfer or +processing of the image data, the status is set to the corresponding error= code, +and the target waits for a different command packet. + +The host uses the following format while transferring end of image transfer +packet: + ++-----------+-------------+--------------------------------------+ +| Field | Length | Description | +| | (bytes) | | ++-----------+-------------+--------------------------------------+ +| Command | 4 | Command identifier code | ++-----------+-------------+--------------------------------------+ +| Length | 4 | Length of the packet(in bytes) | ++-----------+-------------+--------------------------------------+ +| Image ID | 4 | ID of the image that was being | +| | | transferred. | ++-----------+-------------+--------------------------------------+ +| Status | 4 | Success or error code | ++-----------+-------------+--------------------------------------+ + +Done packet +----------- + +If the host receives an end of image transfer packet with a success status= , the +host sends a done packet to indicate the target that it can exit the proto= col +and continue execution of code. The host uses the following format while s= ending +the done packet: + ++-----------+-------------+--------------------------------------+ +| Field | Length | Description | +| | (bytes) | | ++-----------+-------------+--------------------------------------+ +| Command | 4 | Command identifier code | ++-----------+-------------+--------------------------------------+ +| Length | 4 | Length of the packet(in bytes) | ++-----------+-------------+--------------------------------------+ + +To transfer another image from the host, the target must re-initiate the +protocol by starting with another hello packet. + +Done Response packet +-------------------- + +If the target receives a done packet, it responds with a done response pac= ket +containing the image transfer status. The target uses the following format= while +sending the done response packet: + ++-----------+-------------+--------------------------------------+ +| Field | Length | Description | +| | (bytes) | | ++-----------+-------------+--------------------------------------+ +| Command | 4 | Command identifier code | ++-----------+-------------+--------------------------------------+ +| Length | 4 | Length of the packet(in bytes) | ++-----------+-------------+--------------------------------------+ +| Image Tx | 4 | Indicates whether target is | +| Status | | expecting to receive another image | +| | | or not. | ++-----------+-------------+--------------------------------------+ + +If all the images are transferred, the target sends a complete status to e= nable +the host to exit the protocol. If all the images are not transferred, the = target +sends a pending status and waits for another hello packet to arrive. + +Reset Packet +------------ + +The host sends a reset packet to reset the target. The target services a r= eset +request only if its in a state where reset requests are valid. If the targ= et +receives an invalid reset request, the target sends an error in an end of = image +transfer packet. The format of reset packet is as follows: + ++-----------+-------------+--------------------------------------+ +| Field | Length | Description | +| | (bytes) | | ++-----------+-------------+--------------------------------------+ +| Command | 4 | Command identifier code | ++-----------+-------------+--------------------------------------+ +| Length | 4 | Length of the packet(in bytes) | ++-----------+-------------+--------------------------------------+ + + +Reset response packet +--------------------- + +If the target receives a valid reset request, it sends a reset response pa= cket +just before it resets. The purpose of this response is to acknowledge the = host +that the target received the reset request. The format of reset response p= acket +is as follows: + ++-----------+-------------+--------------------------------------+ +| Field | Length | Description | +| | (bytes) | | ++-----------+-------------+--------------------------------------+ +| Command | 4 | Command identifier code | ++-----------+-------------+--------------------------------------+ +| Length | 4 | Length of the packet(in bytes) | ++-----------+-------------+--------------------------------------+ + + +Memory debug packet +------------------- + +The target initiates a memory dump by sending the host a memory debug pack= et. +This packet contains the address and length of the memory debug table. The +memory debug table is a listing of memory locations that can be accessed a= nd +dumped to the host. The target uses the following format while sending the +memory debug packet: + ++-----------+-------------+--------------------------------------+ +| Field | Length | Description | +| | (bytes) | | ++-----------+-------------+--------------------------------------+ +| Command | 4 | Command identifier code | ++-----------+-------------+--------------------------------------+ +| Length | 4 | Length of the packet(in bytes) | ++-----------+-------------+--------------------------------------+ +| Memory | 4 | Target sets this field to the address| +| table | | in memory that stores the memory | +| Address | | debug table. | ++-----------+-------------+--------------------------------------+ +| Memory | 4 | Length in bytes of memory debug | +| table | | table. | +| Length | | | ++-----------+-------------+--------------------------------------+ + +Given the memory table address and length, the host issues a memory read to +retrieve the table. After the host receives the memory table information, = it can +decode each entry and issue memory read requests to dump each memory locat= ion. + +Memory read packet / 64-bit memory read packet +---------------------------------------------- + +The host issues memory read commands for each section of memory that it du= mps. +The host uses the following format while sending the memory read packet an= d 64 +bit memory read packet: + +Memory read packet format +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D + ++-----------+-------------+--------------------------------------+ +| Field | Length | Description | +| | (bytes) | | ++-----------+-------------+--------------------------------------+ +| Command | 4 | Command identifier code | ++-----------+-------------+--------------------------------------+ +| Length | 4 | Length of the packet(in bytes) | ++-----------+-------------+--------------------------------------+ +| Memory | 4 | Memory location to read. | +| Address | | | ++-----------+-------------+--------------------------------------+ +| Memory | 4 | Length in bytes of memory to read | +| Length | | | ++-----------+-------------+--------------------------------------+ + +64 bit memory read packet format +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D + ++-----------+-------------+--------------------------------------+ +| Field | Length | Description | +| | (bytes) | | ++-----------+-------------+--------------------------------------+ +| Command | 4 | Command identifier code | ++-----------+-------------+--------------------------------------+ +| Length | 4 | Length of the packet(in bytes) | ++-----------+-------------+--------------------------------------+ +| Memory | 8 | Memory location to read. | +| Address | | | ++-----------+-------------+--------------------------------------+ +| Memory | 8 | Length in bytes of memory to read | +| Length | | | ++-----------+-------------+--------------------------------------+ + +The accessible regions are defined in the memory debug table. For each mem= ory +read command received, the target verifies that the specified memory(addre= ss and +length) is accessible and responds with a raw data packet. The content and +length of the raw data packet is the memory dump starting from the memory +address and length specified in the memory read packet. The memory debug t= able +can also be read using a memory read command by setting the address and le= ngth +to the values specified in the memory debug packet. + +If any error occurs on the target, an end of image transfer packet is sent= with +the corresponding error code and the host recognizes whether it is actual = memory +data or an end of image transfer packet. The host issues a reset command on +completion of a successful memory dump. However, the protocol does not for= ce +this implementation. + +Command ready packet +-------------------- + +The target sends this packet to the host to indicate that the target is re= ady to +execute client commands. The target uses the following format while sendin= g the +command ready packet: + ++-----------+-------------+--------------------------------------+ +| Field | Length | Description | +| | (bytes) | | ++-----------+-------------+--------------------------------------+ +| Command | 4 | Command identifier code | ++-----------+-------------+--------------------------------------+ +| Length | 4 | Length of the packet(in bytes) | ++-----------+-------------+--------------------------------------+ + + +Command switch mode packet +-------------------------- + +The host sends the command switch mode packet to the target so that the ta= rget +can switch to another mode. The host uses the following format while sendi= ng the +command switch mode packet: + ++-----------+-------------+--------------------------------------+ +| Field | Length | Description | +| | (bytes) | | ++-----------+-------------+--------------------------------------+ +| Command | 4 | Command identifier code | ++-----------+-------------+--------------------------------------+ +| Length | 4 | Length of the packet(in bytes) | ++-----------+-------------+--------------------------------------+ +| Mode | 4 | Mode of operation for target | +| | | to execute. | ++-----------+-------------+--------------------------------------+ + +Command execute packet +---------------------- + +The host sends this packet to execute the given client command on the targ= et. If +the client command successfully executes, the target sends a command execu= te +response packet. If an error occurs, the target sends an end of image tran= sfer +packet with the corresponding error code. The host uses the following form= at +while sending command execute packet: + ++-----------+-------------+--------------------------------------+ +| Field | Length | Description | +| | (bytes) | | ++-----------+-------------+--------------------------------------+ +| Command | 4 | Command identifier code | ++-----------+-------------+--------------------------------------+ +| Length | 4 | Length of the packet(in bytes) | ++-----------+-------------+--------------------------------------+ +| Client | 4 | Client Command to be executed. | +| Command | | | ++-----------+-------------+--------------------------------------+ + + +Client commands +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + ++------------+-------------+--------------------------------------+ +| Client ID | Length | Description | ++------------+-------------+--------------------------------------+ +| 0x8 | 4 | Get Command ID list. | ++------------+-------------+--------------------------------------+ +| 0x9 | 4 | Get DDR training data. | ++------------+-------------+--------------------------------------+ + +Command execute Response packet +------------------------------- + +The target sends this packet if it successfully executes the client comman= d. The +target uses the following format while sending the command execute response +packet. + ++-----------+-------------+--------------------------------------+ +| Field | Length | Description | +| | (bytes) | | ++-----------+-------------+--------------------------------------+ +| Command | 4 | Command identifier code | ++-----------+-------------+--------------------------------------+ +| Length | 4 | Length of the packet(in bytes) | ++-----------+-------------+--------------------------------------+ +| Client | 4 | Client Command to be executed. | +| Command | | | ++-----------+-------------+--------------------------------------+ +| Response | 4 | Number of bytes for response data. | +| Length | | | ++-----------+-------------+--------------------------------------+ + +Command execute data packet +--------------------------- + +The host sends this packet if the response length received in the command +execute response packet is greater than 0. The host uses the following for= mat +while sending command execute data packet: + ++-----------+-------------+--------------------------------------+ +| Field | Length | Description | +| | (bytes) | | ++-----------+-------------+--------------------------------------+ +| Command | 4 | Command identifier code | ++-----------+-------------+--------------------------------------+ +| Length | 4 | Length of the packet(in bytes) | ++-----------+-------------+--------------------------------------+ +| Client | 4 | Client Command executed. | +| Command | | | ++-----------+-------------+--------------------------------------+ + +The packet indicates the target to send the response data in a raw data pa= cket. +The target sends the response data upon receiving this packet. + +64-bit memory debug packet +-------------------------- + +The target sends this packet to the host to initiate a memory dump. The pa= cket +contains 64-bit address and length of the memory table. The target uses the +following format while sending 64-bit memory debug packet: + ++-----------+-------------+--------------------------------------+ +| Field | Length | Description | +| | (bytes) | | ++-----------+-------------+--------------------------------------+ +| Command | 4 | Command identifier code | ++-----------+-------------+--------------------------------------+ +| Length | 4 | Length of the packet(in bytes) | ++-----------+-------------+--------------------------------------+ +| Memory | 8 | Target sets this field to the 64-bit | +| table | | address in memory that stores the | +| Address | | memory debug table. | ++-----------+-------------+--------------------------------------+ +| Memory | 8 | Length in bytes of memory debug | +| table | | table. | +| Length | | | ++-----------+-------------+--------------------------------------+ + +Reset Sahara state machine packet +--------------------------------- + +The host sends a reset sahara state machine packet whenever it wants to re= set +Sahara state machine. When the target receives a reset sahara state machine +request, it reinitializes sahara protocol and sends the hello packet to the +host. The sahara protocol is restarted without a target reset. The host us= es the +following format while sending the reset sahara state machine packet: + ++-----------+-------------+--------------------------------------+ +| Field | Length | Description | +| | (bytes) | | ++-----------+-------------+--------------------------------------+ +| Command | 4 | Command identifier code | ++-----------+-------------+--------------------------------------+ +| Length | 4 | Length of the packet(in bytes) | ++-----------+-------------+--------------------------------------+ + +Write data packet +----------------- + +Write data packet serves as a generic data transfer packet when any data is +transferred from the target to the host. This packet allows flexible data +transfer from the target to the host. + +As the target controls what data gets transferred, target can determine wh= at +parts of the data get transferred and in what order. The host does not nee= d to +know anything about the structure of the data. It only needs to open the f= ile +and start accepting the data to the host based on the parameters specified= in +the packet. + +To initiate a write data transfer, the target fills the write data packet = with +the image ID corresponding to the image data that it wants to send. The ta= rget +also sends the offset into the output file and the length of the data(in b= ytes) +it wants to write from the target. As soon as the host receives the packet= , the +host opens an output file and waits to receive the data packets. After the +packet is received, the content from the data pcket is written to the outp= ut +file, The format of the write data packet is as follows: + ++-----------+-------------+--------------------------------------+ +| Field | Length | Description | +| | (bytes) | | ++-----------+-------------+--------------------------------------+ +| Command | 4 | Command identifier code | ++-----------+-------------+--------------------------------------+ +| Length | 4 | Length of the packet(in bytes) | ++-----------+-------------+--------------------------------------+ +| Data | 8 | Offset into the image file to start | +| offset | | writing the data to host. | ++-----------+-------------+--------------------------------------+ +| Image ID | 4 | ID of the image to be transferred. | ++-----------+-------------+--------------------------------------+ +| Data | 4 | Number of bytes target wants to | +| Length | | transfer the data to the host. | ++-----------+-------------+--------------------------------------+ + + +Command packet flow between host and target +------------------------------------------- + +Packet flow is a process of exchange of information as packets between the= host +and the target in a specific way using command packets. The sahara protocol +allows packet processing for the following scenarios: + +1. Transferring an image from the host to the target. +2. Dumping memory from the target to the host. +3. Loading DDR calibration data on flashless target. + +Packet flow for Image transfer +------------------------------ + +The packet flow is performed between the host and target for a successful = image +transfer. + +.. code-block:: text + + Host Target + | HELLO | + | (mode =3D image transfer) | + |<--------------------------| + | | + | HELLO RESP | + | (mode =3D image transfer) | + |-------------------------->| + | | + | READ_DATA | + | (img ID, 0, offset, | + | size of image header) | + |<--------------------------| + | | + | RAW_DATA | + | (size of image header) | + |-------------------------->| + | | + | READ_DATA | + | (img ID, segment 0 offset,| + | size of segment 0) | + |<--------------------------| + | RAW_DATA | + | (size of segment 0) | + |-------------------------->| + | | + | READ_DATA | + | (img ID, segment 1 offset,| + | size of segment 1) | + |<--------------------------| + | | + | | + | RAW_DATA | + | (size of segment 1) | + |-------------------------->| + | ... | + | ... | + | ... | + | ... | + | | + | | + | READ_DATA | + | (img ID, segment N offset,| + | size of segment N) | + |<--------------------------| + | | + | | + | | + | RAW_DATA | + | (size of segment N) | + |-------------------------->| + | | + | | + | END_IMAGE_TX | + |<--------------------------| + | | + | | + | DONE | + |-------------------------->| + | | + | | + | DONE_RESP | + |<--------------------------| + | | + +The packet flow sequence for image transfer is as follows: + +1. A hello packet is sent from the target to the host to initiate the prot= ocol + with the mode set to either image transfer pending or image transfer + complete (depending on the target's boot sequence). + +2. The host sends a hello response packet with a success status and sets t= he + mode to the mode received in the hello packet. After it receives the he= llo + packet and validates the protocol version running on the target. + +3. After the target receives the hello response, the target initiates the + image transfer request by sending read data packets. Each read data pac= ket + specifies the image that the target wishes to receive and what part of = the + image is to be transferred. + +4. During normal operation, the target first requests image header informa= tion. + + a. The image header information specifies image size and location of the + image data that is to be transferred. + + b. The image header information (which is sent as a read data request) + allows the target to know the format of the image to be transferred. + The protocol does not require the host to know anything about the + image formats and allows the host to read and transfer data from the + image as requested by the target. + + c. If the image is a standalone binary image without any data segmentat= ion + (which means the data is entirely contiguous when stored as well as + transferred to the target system memory), then the target requests f= or + entire image data to be sent in one transfer. + + d. If the image data is segmented and requires scattering of the data + segments to noncontiguous system memory locations, the target issues + multiple read data requests to enable each data segment to be + transferred directly to the respective destination address. This + scattered information resides in the image header and is parsed by t= he + target before issuing the read data requests. + +5. After receiving a read data request, the host parses the image ID, data + offset, and data length to transfer data from the corresponding image f= ile. + The host sends the requested data without any packet header. + +6. The target directly transfers the data to the destination address witho= ut + any software processing or temporarily buffering of the data in system + memory by transferring the image header to the targert and setting the + receive buffer for the data as the destination address in system memory. + +7. After the target successfully receives all segments for an image, the + target sends an end of image transfer packet with the image ID of the + corresponding image, and a success status. The host stops reading and + closes the image file after receiving the success status. + +8. The host sends a done packet to allow the target to exit the protocol a= fter + it receives a successgul end of image transfer packet. + +9. After the target receives the done packet, the target sends a done resp= onse + packet to the host. This packet indicates if the target expects another + image to be transferred and if the host can continue to run the protoco= l. + +Packet flow for memory debug +---------------------------- + +The packet flow is performed between the host and the target for the succe= ssful +memory debug. + +.. code-block:: text + + Host Target + | HELLO | + | (mode =3D memory debug) | + |<--------------------------| + | | + | HELLO RESP | + | (mode =3D memory debug) | + |-------------------------->| + | | + | MEMORY_DEBUG | + | (location of mem table, | + | size of memory table) | + |<--------------------------| + | | + | MEMORY_READ | + | (Address from region 0 ,| + | size of region 0) | + |-------------------------->| + | RAW_DATA | + | (size of region 0) | + |<--------------------------| + | | + | MEMORY_READ | + | (Address from region 1 ,| + | size of region 1) | + |-------------------------->| + | RAW_DATA | + | (size of region 1) | + |<--------------------------| + | MEMORY_READ | + | (Address from region 2 ,| + | size of region 0) | + |-------------------------->| + | RAW_DATA | + | (size of region 2) | + |<--------------------------| + | ... | + | ... | + | ... | + | ... | + | | + | MEMORY_READ | + | (Address from region N ,| + | size of region N) | + |-------------------------->| + | RAW_DATA | + | (size of region N) | + |<--------------------------| + | | + | RESET | + |-------------------------->| + | | + | | + | RESET_RESP | + |<--------------------------| + | | + +The packet flow sequence for image transfer is as follows: + +1. A hello packet is sent from the target to the host to initiate the prot= ocol + with mode set to memory debug. + +2. The host sends a hello response packet with a success status and sets t= he + mode to memory debug after it receives the hello packet and validates t= he + protocol version running on the target. + +3. After the target receives the hello response, the target initiates the + memory dump by sending a memory debug packet with the location and size= of + the memory debug table. The memory debug table specifies accessible mem= ory + regions. + +4. The host then initiates a memory read packet to read the memory debug + table and receives the table in a raw data packet after it receives the + memory debug packet. + +5. The host then decodes the table and issues memory reads for each access= ible + region. The data for each region is sent in a raw data packet. + +6. Upon completion, the host issues a reset to the target. The target send= s a + reset response and resets the target. + +7. The host can alternatively send a command switch mode packet to allow t= he + target to switch modes and avoid a reset. + + +Packet flow to load DDR calibration data on target +-------------------------------------------------- + +The packet flow is performed between the host and the target to load DDR +calibration data on flashless target. This packet flow is initiated when t= he +device boots up for the first time and needs DDR calibration. This packet = flow +is also initiated in other scenarios, such as build update or any reason f= or +which DDR calibration data gets corrupted. + +First boot scenario or invalid calibration data in filesystem. +-------------------------------------------------------------- + +.. code-block:: text + + Host Target + | HELLO | + | (mode =3D image transfer) | + |<--------------------------| + | | + | HELLO RESP | + | (mode =3D image transfer) | + |-------------------------->| + | | + | READ_DATA | + | (img ID:34, 0, offset, | + | size of DDR training data)| + |<--------------------------| + | | + | RAW_DATA | + |(size of DDR training data)| + |-------------------------->| + | | + | | + | END_IMAGE_TX | + |<--------------------------| + | | + | | + | DONE | + |-------------------------->| + | | + | | + | DONE_RESP | + | (mode =3D IMAGE_TX_PENDING) | + |<--------------------------| + |1. First boot scenario. | + | DDR driver performs | + | calibration and returns | + | to SBL. | + |2. Next: Push DDR | + | Calibration data to host | + | | + | | + | HELLO | + | (mode =3D COMMAND mode) | + |<--------------------------| + | | + | HELLO RESP | + | (mode =3D COMMAND mode ) | + |-------------------------->| + | | + | CMD_READY | + |<--------------------------| + | | + | CMD_EXEC | + |(cmd id =3D 8, Get command | + | ID to be executed) | + |-------------------------->| + | | + | CMD_EXEC_RESP | + |(cmd id: 8, resp len =3D 4) | + |<--------------------------| + | | + | CMD_EXEC_GET_DATA | + | (ID =3D 0x8) | + |-------------------------->| + | | + | RAW_DATA | + | (0x00000009) | + |<--------------------------| + | | + | CMD_EXEC | + | (cmd id: 9, resp len > 0) | + |-------------------------->| + | | + | | + | CMD_EXEC_RESP | + |(cmd id: 9, resp len > 0) | + |<--------------------------| + | | + | CMD_EXEC_GET_DATA | + | (ID =3D 0x9) | + |-------------------------->| + | | + | RAW_DATA | + | (valid training data) | + |<--------------------------| + | | + |3. Host sends switch to | + |image tx mode to continue | + |booting. | + | | + | | + | CMD_SWITCH_MODE | + | (mode =3D IMAGE_TX_PENDING) | + |-------------------------->| + | | + | | + | HELLO | + | (mode =3D IMAGE_TX_PENDING) | + |<--------------------------| + | | + | HELLO RESP | + | (mode =3D IMAGE_TX_PENDING) | + |-------------------------->| + | | + |4. Boot/Load rest of the | + | images.... | + | | + | END_IMAGE_TX | + |<--------------------------| + | | + | | + | DONE | + |-------------------------->| + | | + | | + | DONE_RESP | + |(mode =3D IMAGE_TX_COMPLETE) | + |<--------------------------| + | | + +The packet flow sequence is as follows : + +1. The target sends the hello packet to the host to initiate the protocol + with the mode set to image transfer pending. + +2. The host sends a hello response packet with a success status and sets t= he + mode to image transfer pending after it receives the hello packet and + validates the protocol version running on the target. + +3. After the target receives the hello response, it initiates the data + transfer by requesting the size of DDR training/calibration data. + +4. The host sends back the DDR training/calibration data to the target. + +5. The target decodes the training data and does not find valid DDR + calibration data, target sends END_IMAGE_TX to interrupt the transfer. + +6. The host sends DONE after receives END_IMAGE_TX. + +7. The target sends DONE_RESP with mode =3D IMAGE_TX_PENDING because it has + not received all images. + +8. The target executes DDR training process to generate valid DDR calibrat= ion + data and prepares to push back to host. + +9. The target initiates protocol by sending a hello packet with COMMAND_MO= DE + to the host. + +10. The host sends a hello response packet with a success status and sets = the + mode to COMMAND_MODE. + +11. The target sends CMD_READY to the host. + +12. The host receives CMD_READY and starts to get command IDs to be execut= ed. + +13. The target sends CMD_ID =3D 9 to push DDR calibration data to host. + +14. The host executes CMD_ID =3D 9 to get DDR calibration data from the ta= rget. + +15. The target sends RAW_DATA with the payload which contains DDR calibrat= ion + data to host. + +16. The host saves training data in the kernel buffer and exposes to users= pace + via the sysfs entry. The host sends CMD_SWITCH_MODE with the mode set = to + IMAGE_TX_PENDING to continue booting. + +17. After the target receives the CMD_SWITCH_MODE command, it sends HELLO = to + the host with the mode set to IMAGE_TX_PENDING. The target and the host + repeat the packet flow for image transfer to get all booting-required + images. + +18. Upon successful transfer of all images, the target sends an END_IMAGE_= TX + packet with a success status to the host. + +19. The host sends DONE after it receives END_IMAGE_TX. + +20. The target sends DONE_RESP with the mode set to IMAGE_TX_COMPLETE beca= use + it has received all images. The process has been completed after the h= ost + receives DONE_RESP with the mode set to IMAGE_TX_COMPLETE. + +Subsequent boot scenario with valid DDR calibration data +-------------------------------------------------------- + +The below firgure shows the subsequent boot scenario with valid DDR calibr= ation +data process being loaded from host to target. + +.. code-block:: text + + Host Target + | HELLO | + | (mode =3D image transfer) | + |<--------------------------| + | | + | HELLO RESP | + | (mode =3D image transfer) | + |-------------------------->| + | | + | READ_DATA | + | (img ID:34, 0, offset, | + | size of DDR training data)| + |<--------------------------| + | | + | RAW_DATA | + |(size of DDR training data)| + |-------------------------->| + | | + | | + | END_IMAGE_TX | + |<--------------------------| + | | + | | + | DONE | + |-------------------------->| + | | + | | + | DONE_RESP | + | (mode =3D IMAGE_TX_PENDING) | + |<--------------------------| + | | + | Subsequent boot scenario | + | (valid calibration data) | + | DDR driver configures DDR | + | using valid calibration | + | data | + | | + | | + | HELLO | + | (mode =3D IMAGE_TX_PENDING) | + |<--------------------------| + | | + | HELLO RESP | + | (mode =3D IMAGE_TX_PENDING) | + |-------------------------->| + | | + | Boot/Load rest of the | + | images.... | + | | + | END_IMAGE_TX | + |<--------------------------| + | | + | | + | DONE | + |-------------------------->| + | | + | | + | DONE_RESP | + |(mode =3D IMAGE_TX_COMPLETE) | + |<--------------------------| + | | + +The packet flow is as follows : + +1. The target sends the hello packet to the host to initiate the protocol + with the mode set to image transfer pending. + +2. The host sends a hello response packet with a success status and sets t= he + mode to image transfer pending after it receives the hello packet and + validates the protocol version running on the target. + +3. After the target receives the hello response, it initiates the images + transfer by requesting the training/calibration data from the host. + +4. The host sends back the DDR training/calibration data to the target. + +5. The target decodes the DDR training/calibration data and finds valid DDR + calibration data. + +6. The host sends RAW_DATA with the size of the DDR calibration data to the + target. + +7. Upon successful transfer of DDR calibration data, the target sends an + END_IMAGE_TX packet with a success status. + +8. The host sends DONE after it receives END_IMAGE_TX. + +9. The target sends DONE_RESP with mode =3D IMAGE_TX_PENDING because it ha= s not + received all images. + +10. The target continues booting with valid DDR calibration data. + +11. The target and the host repeat the packet flow for image transfer to g= et + all booting-required images. + +12. After successful transfer of all images, the target sends an END_IMAGE= _TX + packet with a success status to the host. + +13. The host sends DONE after it receives END_IMAGE_TX. + +14. The target sends DONE_RESP with the mode set to IMAGE_TX_COMPLETE beca= use + it has received all images. The process has been completed after the h= ost + receives DONE_RESP with the mode set to IMAGE_TX_COMPLETE. --=20 2.34.1 From nobody Thu Apr 9 09:04:43 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E977B3806B3 for ; Tue, 10 Mar 2026 07:22:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773127345; cv=none; b=AX0Ux4aoTGTCOcg/mJ/p/F+05zO8HdqxsaikmwgDbE4PIJaxbGO2agcw/9soP2qLNaa9c9uMLtDOMCXc3e60dPvDaTnCMr2/5FtcfLGHGXiXa7rj9VaITOiKtTWYRZKrQEkXRgwG7Xzii7i8vBaepD6a6Rzqxo44RuW6VH9WfKA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773127345; c=relaxed/simple; bh=9tH2JRuQd/Ntg0H7RVSyFLnl0a6EFmaIQsmT7afSET0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=A+/suqUyv8ERX5yxxwBe0DYAKH4mg9lD1C0tfAJZimyjOC5PeCb8tQ1HIeFzXV0E0K39PLLqY1Pb4nvHMJ9CRByHwd5onRvILpOqMMPmbJM+yCvQAPkWN7agIfaoz2ONLeQmIj+RORd1r3VSdNzWEwrtMuFQ+i3V599bdQa0gKY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=Ooz8C04O; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=gfhb7NyT; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="Ooz8C04O"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="gfhb7NyT" Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62A2EZ7b1900104 for ; Tue, 10 Mar 2026 07:22:23 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= pD2aEY9dZogWGWfrJ0ewLTBoCN0zxUacyNzSIWJJ810=; b=Ooz8C04OwXZBUbNT 8TlSTp6Uq7FZi7DPTEg8Vj65YQQi6VTS7fNQac8c8egbo6eU3+WEQNz3gBxCZ1Ed hE88nc1OOh6qhWIkd3G1FA3qDPNDqlBjuDNQtomkovagphQo1Uj17dbHz1qkdFIo m+hSIydMVZrhIGomISweb4meh8z1rbEUpa8beX2y3q9nJqp5b89jVWYp3siE7bn2 Ans2xSkPcUHZMmhKjpU7Wkd0eyCPEkBko9rTYasIdOtnCagyp/fmskMQ9z4OUMt/ +fEaVIFKZxebFUO1fmWZ6qr6ZbO2sBaqYD23UvXahEfCUxdWXMhXKQMeCMsgta6D YuFkhg== Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cstsac5u6-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 10 Mar 2026 07:22:22 +0000 (GMT) Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-2ae467f128fso89654345ad.1 for ; Tue, 10 Mar 2026 00:22:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773127342; x=1773732142; darn=vger.kernel.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=pD2aEY9dZogWGWfrJ0ewLTBoCN0zxUacyNzSIWJJ810=; b=gfhb7NyTYvRvSOZjBSjM36Dw/Ef4DmK28vlHs8kVZx4Cu4h4j1UiQYYGavsruSAD7N uySbZJBAlpp1EmrJz/zf5FmYoY+Xp7nak3LU9VNQ18jakB7tjIfeuFpX+DgcQnhyOyYx UygBQCZZUiQ4XME35d8lw2eT3U3W+1Pxm2gyLRldimgkkAPUdo1yvrKe1zR6C9mTT7AZ mcSyKCYLD8GU6ooIhyXPZw2eEu9ok/ZhbmQkkYCTbwPqRmd+RsDFH/xaH87shJouJlIp LGraEE34F5Ox4qTI7XIxPVZhSUfB+1Nell7f4N5cmu0LkJNYsZQNIcnhVVe3KaEbz3N5 uA+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773127342; x=1773732142; 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=pD2aEY9dZogWGWfrJ0ewLTBoCN0zxUacyNzSIWJJ810=; b=CfpQS4RI2xCzfxNUeFp0KoM2I86x1UUgyadRo4vQBIcU2S1tPAtWj9kWNiCQJGk5Rn sx+euEue+VyahMb1PGIPNjAB+77cWAmIVP5FCUQ1jQ/36HN6rco0KOvrR3XIzCMEmdtn /PRU8ffDHR/mWUU2tDRUGpGksF/jxWDMOQVZ9A6vnguWnxUFybC31ayHp0lgL+VJn4m5 XSD5oy4vf4CjJMPoWYP19py6gBRcrmGyGzeHtOB077rV1SLAsYzCjg+Q0utxPzLEZLj1 DeD9387ycTDEUFJV4SntsxGycCanGqFQ9yOwgsI1nmY/2jjiChdW5+1qONBfoxAp+uMq PTcA== X-Forwarded-Encrypted: i=1; AJvYcCUkmM7NF3NCcYD380CWa2Pehus3LWpN8e6LSKD+hDFj51ioU25Z0oFSKv92+/MjOv9TT7xodvYChRDXTV8=@vger.kernel.org X-Gm-Message-State: AOJu0YxHlJqb2sRQSZZOt4i+QLS1RcucjXqjEDkIGcrh9bxl8OlnB6AI OUnBut9vlPetANwk1iaS3shLIQhC5mupcMkY+QJ0m/4LU2/n5FORBkFxtFVMxXcZz/84nRqKebr CratWKscdEUzjWk0isTqWCqZD3hlQ2Bh5wbwf6vgMejZ3neazcEHq58vl0cNZeY7cH88= X-Gm-Gg: ATEYQzzzfRviYp2gLOSk4SNLE8kafVI5cyxVrb4lY1775MuF2lUnq7TlA1bAbHucrLz v0gK8CBz4VBUggZgwR529TxXksKH6fF5zVUD+WrnSyWHhDfG4vSomJauKhIuj636mkVPLyKSg5u K7+x1zH9ORxXqA6+kNsGC+7MAD1QaMbuVWbGUjZ4ybA8SlB1boUTMuKF9RC0a/AG1vl6JkYoLW9 B/iATj6DKJD24UJAffLsPb4KfDYoO+Rpa8yhazFa5DG0OjUFAIr7/KIsAdfoODfLuhA3xN4Gm11 bvBMb6MDntuTGc9Br53RsRHCNdWVJtP3fsQ1qoxMq1fgGOWAQM+R1KG1sQ3IOYRhT7vhxl5YLQG 0N64OV7vVBC5sKm35xZ95sgtv4oIms6Lzr0+TiWlSW9HUnwxBz4M= X-Received: by 2002:a17:903:28c8:b0:2ae:5671:7071 with SMTP id d9443c01a7336-2ae8252cf0fmr84229545ad.43.1773127341536; Tue, 10 Mar 2026 00:22:21 -0700 (PDT) X-Received: by 2002:a17:903:28c8:b0:2ae:5671:7071 with SMTP id d9443c01a7336-2ae8252cf0fmr84229315ad.43.1773127340964; Tue, 10 Mar 2026 00:22:20 -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.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Mar 2026 00:22:20 -0700 (PDT) From: Kishore Batta Date: Tue, 10 Mar 2026 12:51:59 +0530 Subject: [PATCH v3 2/9] bus: mhi: Move sahara protocol driver under drivers/bus/mhi Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260310-sahara_protocol_new_v2-v3-2-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=7115; i=kishore.batta@oss.qualcomm.com; s=20260206; h=from:subject:message-id; bh=9tH2JRuQd/Ntg0H7RVSyFLnl0a6EFmaIQsmT7afSET0=; b=20vWjzKlRnk/9wE+EJycNzcoNARHdhA1CnPR7MKZJH4jM0oFANtPLttuFQ+0HwW06haVpKRr6 CzkUHIRR0+jA3h+trbSzk22o93onrQM34x4e7BPrasmyztsTO8bOcTK X-Developer-Key: i=kishore.batta@oss.qualcomm.com; a=ed25519; pk=vJo8RvTf+HZpRLK2oOIljmbn9l3zFkibCGh+blaqZCw= X-Proofpoint-GUID: nwioEdNRCp7-Mw7N73NCUn2ch7K0noxN X-Authority-Analysis: v=2.4 cv=I+Vohdgg c=1 sm=1 tr=0 ts=69afc6ae cx=c_pps a=IZJwPbhc+fLeJZngyXXI0A==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=ZpdpYltYx_vBUK5n70dp:22 a=EUspDBNiAAAA:8 a=YoiwXk0N_qN2JQiW-xcA:9 a=QEXdDO2ut3YA:10 a=uG9DUKGECoFWVXl0Dc02:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzEwMDA2MSBTYWx0ZWRfXykYjj9sB8eAp GFTq7+2PhE3D803Hb2vllxHvPOfF1HJeQXPtz++s8t7c70dutqiN00mKG2mWyuygFFAcLCMtbYO eBF5WsfL8thPcA8kzoLZGWTSyPSo3QHUbY8jGTsZ03rLZGT4dBOYGYg78N05U3jY+qAtrXR4w5u J1MOpAJoi5J2tVfKMTgSXIiEJe31rkrnin5HsbvUc2Tzpx1RWuBhMhiHK6a/+CCU8F+98Li7b0e oEbOYPvBzuI6637RPZt0Y1vpmP6goeJKaYueZF9tCq2K1EjsVR9fIqGfJC7jng8EpS6PPI6ambq 5SkR2A4QIiEZ36tkpLxriT6ANxHMEfR8myehJsWq6tmOi2uRw4FyYY7J4pbg2PyEXRJoHkQ8m2y bCSIjcHv4lzqQFWBawE8T6fE2cXEPEIzWhKo5h3N5Vx/Frtv207e9Yh6RAbQZQKvGVYW4blKC7j y4naJSLjUS8TH++lldA== X-Proofpoint-ORIG-GUID: nwioEdNRCp7-Mw7N73NCUn2ch7K0noxN 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 phishscore=0 impostorscore=0 spamscore=0 malwarescore=0 suspectscore=0 bulkscore=0 lowpriorityscore=0 clxscore=1015 priorityscore=1501 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603100061 The Sahara protocol driver is currently located under the QAIC accelerator subsystem even though protocol itself is transported over the MHI bus and is used by multiple Qualcomm flashless devices. Relocate the Sahara protocol driver to drivers/bus/mhi and register it as an independent MHI protocol driver. This avoids treating Sahara as QAIC specific and makes it available for reuse by other MHI based devices. As part of this move, introduce a dedicated Kconfig and Makefile under the MHI subsystem and expose the sahara interface via a common header. Signed-off-by: Kishore Batta --- drivers/accel/qaic/Kconfig | 1 + drivers/accel/qaic/Makefile | 3 +-- drivers/accel/qaic/qaic_drv.c | 11 ++--------- drivers/bus/mhi/Kconfig | 1 + drivers/bus/mhi/Makefile | 3 +++ drivers/bus/mhi/sahara/Kconfig | 18 ++++++++++++++++++ drivers/bus/mhi/sahara/Makefile | 2 ++ drivers/{accel/qaic =3D> bus/mhi/sahara}/sahara.c | 16 +++++++++++----- {drivers/accel/qaic =3D> include/linux}/sahara.h | 0 9 files changed, 39 insertions(+), 16 deletions(-) diff --git a/drivers/accel/qaic/Kconfig b/drivers/accel/qaic/Kconfig index 116e42d152ca885b8c59e33c7a87519a0abc6bb3..1e5f1f4fa93c12d8ca8fb37633f= 2f0bee9997499 100644 --- a/drivers/accel/qaic/Kconfig +++ b/drivers/accel/qaic/Kconfig @@ -8,6 +8,7 @@ config DRM_ACCEL_QAIC depends on DRM_ACCEL depends on PCI && HAS_IOMEM depends on MHI_BUS + select MHI_SAHARA select CRC32 select WANT_DEV_COREDUMP help diff --git a/drivers/accel/qaic/Makefile b/drivers/accel/qaic/Makefile index 71f727b74da3bb4478324689f02a7cea24a05c2d..e7b8458800072aa627f7f36c325= 7883aa56f4ce4 100644 --- a/drivers/accel/qaic/Makefile +++ b/drivers/accel/qaic/Makefile @@ -13,7 +13,6 @@ qaic-y :=3D \ qaic_ras.o \ qaic_ssr.o \ qaic_sysfs.o \ - qaic_timesync.o \ - sahara.o + qaic_timesync.o =20 qaic-$(CONFIG_DEBUG_FS) +=3D qaic_debugfs.o diff --git a/drivers/accel/qaic/qaic_drv.c b/drivers/accel/qaic/qaic_drv.c index 63fb8c7b4abcbe4f1b76c32106f4e8b9ea5e2c8e..76cc8086825e7949ed756d51fcb= 56a08f392d228 100644 --- a/drivers/accel/qaic/qaic_drv.c +++ b/drivers/accel/qaic/qaic_drv.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -32,7 +33,6 @@ #include "qaic_ras.h" #include "qaic_ssr.h" #include "qaic_timesync.h" -#include "sahara.h" =20 MODULE_IMPORT_NS("DMA_BUF"); =20 @@ -782,18 +782,12 @@ static int __init qaic_init(void) ret =3D pci_register_driver(&qaic_pci_driver); if (ret) { pr_debug("qaic: pci_register_driver failed %d\n", ret); - return ret; + goto free_pci; } =20 ret =3D mhi_driver_register(&qaic_mhi_driver); if (ret) { pr_debug("qaic: mhi_driver_register failed %d\n", ret); - goto free_pci; - } - - ret =3D sahara_register(); - if (ret) { - pr_debug("qaic: sahara_register failed %d\n", ret); goto free_mhi; } =20 @@ -847,7 +841,6 @@ static void __exit qaic_exit(void) qaic_ras_unregister(); qaic_bootlog_unregister(); qaic_timesync_deinit(); - sahara_unregister(); mhi_driver_unregister(&qaic_mhi_driver); pci_unregister_driver(&qaic_pci_driver); } diff --git a/drivers/bus/mhi/Kconfig b/drivers/bus/mhi/Kconfig index b39a11e6c624ba00349cca22d74bd876020590ab..4acedb886adccc6f76f69c241d5= 3106da59b491f 100644 --- a/drivers/bus/mhi/Kconfig +++ b/drivers/bus/mhi/Kconfig @@ -7,3 +7,4 @@ =20 source "drivers/bus/mhi/host/Kconfig" source "drivers/bus/mhi/ep/Kconfig" +source "drivers/bus/mhi/sahara/Kconfig" diff --git a/drivers/bus/mhi/Makefile b/drivers/bus/mhi/Makefile index 354204b0ef3ae4030469a24a659f32429d592aef..e4af535e1bb1bc9481fae60d7eb= 347700d2e874c 100644 --- a/drivers/bus/mhi/Makefile +++ b/drivers/bus/mhi/Makefile @@ -3,3 +3,6 @@ obj-$(CONFIG_MHI_BUS) +=3D host/ =20 # Endpoint MHI stack obj-$(CONFIG_MHI_BUS_EP) +=3D ep/ + +# Sahara MHI protocol +obj-$(CONFIG_MHI_SAHARA) +=3D sahara/ diff --git a/drivers/bus/mhi/sahara/Kconfig b/drivers/bus/mhi/sahara/Kconfig new file mode 100644 index 0000000000000000000000000000000000000000..3f1caf6acd979a4af68aaf0e250= aa54762e8cda5 --- /dev/null +++ b/drivers/bus/mhi/sahara/Kconfig @@ -0,0 +1,18 @@ +config MHI_SAHARA + tristate + depends on MHI_BUS + select FW_LOADER_COMPRESS + select FW_LOADER_COMPRESS_XZ + select FW_LOADER_COMPRESS_ZSTD + help + Enable support for the Sahara protocol transported over the MHI bus. + + The Sahara protocol is used to transfer firmware images, retrieve + memory dumps and exchange command mode DDR calibration data between + host and device. This driver is not tied to a specific SoC and may be + used by multiple MHI based devices. + + If unsure, say N. + + To compile this driver as a module, choose M here: the module will be + called mhi_sahara. diff --git a/drivers/bus/mhi/sahara/Makefile b/drivers/bus/mhi/sahara/Makef= ile new file mode 100644 index 0000000000000000000000000000000000000000..fc02a25935011cbd7138ea8f24b= 88cf5b032a4ce --- /dev/null +++ b/drivers/bus/mhi/sahara/Makefile @@ -0,0 +1,2 @@ +obj-$(CONFIG_MHI_SAHARA) +=3D mhi_sahara.o +mhi_sahara-y :=3D sahara.o diff --git a/drivers/accel/qaic/sahara.c b/drivers/bus/mhi/sahara/sahara.c similarity index 99% rename from drivers/accel/qaic/sahara.c rename to drivers/bus/mhi/sahara/sahara.c index fd3c3b2d1fd3bb698809e6ca669128e2dce06613..8ff7b6425ac5423ef8f32117151= dca10397686a8 100644 --- a/drivers/accel/qaic/sahara.c +++ b/drivers/bus/mhi/sahara/sahara.c @@ -1,6 +1,8 @@ -// SPDX-License-Identifier: GPL-2.0-only - -/* Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved= . */ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. + * + */ =20 #include #include @@ -9,12 +11,11 @@ #include #include #include +#include #include #include #include =20 -#include "sahara.h" - #define SAHARA_HELLO_CMD 0x1 /* Min protocol version 1.0 */ #define SAHARA_HELLO_RESP_CMD 0x2 /* Min protocol version 1.0 */ #define SAHARA_READ_DATA_CMD 0x3 /* Min protocol version 1.0 */ @@ -928,8 +929,13 @@ int sahara_register(void) { return mhi_driver_register(&sahara_mhi_driver); } +module_init(sahara_register); =20 void sahara_unregister(void) { mhi_driver_unregister(&sahara_mhi_driver); } +module_exit(sahara_unregister); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("Qualcomm Sahara MHI protocol driver"); diff --git a/drivers/accel/qaic/sahara.h b/include/linux/sahara.h similarity index 100% rename from drivers/accel/qaic/sahara.h rename to include/linux/sahara.h --=20 2.34.1 From nobody Thu Apr 9 09:04:43 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8362D3E8C41 for ; Tue, 10 Mar 2026 07:22:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773127348; cv=none; b=Et8Z9y/GR7qdbr8Pd0UEXlJDzD0xDr+ASy8TOEEyiCtBcjZxGO1Vng0acbGqSkMjLM2wPHL0uOg4M/wx3QovNt9qrS5vRq/wJVfec/iKyA4vrfOaI95rlOokqwMBBlDoJUL8wxWywYYDVswPME8YrW9ql1sgW9Yui8iZLv2kR/M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773127348; c=relaxed/simple; bh=IdXz01mR4Rs8f0RYsO8zVitGxgHIzvaHiQFtik+wHJE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Ksj+vtJWoEVuz6SVV6GL1LZANpG23Q6qBe9GLfbdGyLRUflOsokqWkVfomPUJmK/+8jkvQ50OlgeLrQBIv0GdqILzMgg7JeeenQ8NV7N/Ym82LllQN+f0bXZXzbeRM1c3zsIhUKBuczDAUnqy4uAp28LeDJ0kAg28KfFE53z68I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=bE00zKg8; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=f7VDCBsN; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="bE00zKg8"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="f7VDCBsN" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62A2EO8n2817430 for ; Tue, 10 Mar 2026 07:22:26 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= Ql/OBlsnmzWsbfZsETPUc9XH7il2mDmKIxDrs/rob/k=; b=bE00zKg82QpSEXAE sUs1tgKxj60OvCcicGr+h9SRIsymVM+bIeE+ZzpohQMX115+Teu1J3/TxLvSxX2R 4teFSl2ZGqEpXBWNOL5B2hjg82A9yKGx00y99kvWsm2tjrUuaqrbuMhDwSCtVSUA sNZdcbMNJzutUticdx99e8ejvLsdwHrdPQT0okl+TyxnVQ2kM8PLSoJD1xVP50Lb QGAq3DOTY/nscC/ihSxVkhWcOIAAWxZ/tv6wkQtROLT12iEIggf9kA0y3MobxHH3 NkhERxlQRyyXnnTcF9ku0QpHc/5P/LOE+BuvWj6s1AEkNx41NOscxDqSdctMJkMN OxCDHQ== 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 4csyr430dr-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 10 Mar 2026 07:22:26 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-2ae4e20a414so517540805ad.3 for ; Tue, 10 Mar 2026 00:22:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773127345; x=1773732145; darn=vger.kernel.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=Ql/OBlsnmzWsbfZsETPUc9XH7il2mDmKIxDrs/rob/k=; b=f7VDCBsNDmcZpX98KMCuFYjEYzqB7ObYsVBmmfxIn52Mgug6UaJDliMY06Gt/nZ6lw F3Z+mZgEPI5XkgoF42k5zBLzFP+1RxKTd6VgUN6b5SVDAFmPoGh5RrO8WWC53jD5+bAx u2JshhD7eFoeFuqV1ScU0wVVGgKYKb4uluwWxidynUD2SPLrJh6tbyL9zwmCrPn+JBuT pONzwBNgR+qwtXZf0FEjz4OfQ9YBzBujjaYj/7oDhh71/es+v2tRO1DHt/V2i886EEpS Bncxq94+s1fxZcorn4iO0AudVl0CkBTLVUj3360bukJH2zhFDV9ZlGzNu2c8aiXQC/HH veZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773127345; x=1773732145; 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=Ql/OBlsnmzWsbfZsETPUc9XH7il2mDmKIxDrs/rob/k=; b=qxwmWj696N0tzpoyXNiDcnhkR6YxZO8BR+T0rXxzniCd6VTFUl0oHZ91vRAYdzZqMG hI4+KVvjJG0t02Y2wgW/cDw37BFjPDugkS4vvoD1jrM5eqOjBzgA3sOLe6m39CWtuQAY Dr/6xjEXzMX/0onBoRuAbVke9ZmUrAtuZdTpOQv4D29JAQ4wp9W3lqHmXPQS8vz9bpu5 pV+ILyY1hp9eVULXbMaqXm7eGpiHl3Ocm4jjxi6iRRJDLH/0aUpdXLwQcDbDRTkuQkdl WwCbRPnDNApppyt/WB8Uo8bk7iNCii9XFKMV6ba+5RvJ81MgdyCUgRKXeAQpGsg0hkEm xfLw== X-Forwarded-Encrypted: i=1; AJvYcCX7nJoHIdKIPWBkI9AYI8aAgHTc4iEp6XfqxCICxPbfIsnvUviL1QSfqob3TgwO/VNNPFAmM/WuiKSOfJw=@vger.kernel.org X-Gm-Message-State: AOJu0Yw2e7BAzglABJveiJnguvtjTpyTXEaVKfkdRCRQj8PhnbFt+LC3 O5LFM2DhmwSm+ridASoDwT+pXGVfmAkLGvQRvBToVFWKx9DndeDmXp4jkfZhv3lxH03rrDNaCBe EUKVthcVH2esaXPJVNkejB5UVie9sg6fnNIhKbmpX9fGaxa6qnkFhp/iFPKZsLrHTbeRBzFt7xw I= X-Gm-Gg: ATEYQzxDUf7qZ9D8kFTrR360z50i/lY/Ce9CfSwCiBcRIsR8dJVhbKkxa/s2WUqPlWR vNEmEjHWga6WwE0SHV9V8FyayLTlzRcANzaL8pO0lyRxUxGfhavOdNY8JWDmSwSVlafdjAmf2Uf oL+EWvlPRxPtjT8JTxFIkvbh8K3gPm4UbdfawaQJdTlELvs73xtisG32LM+e0k1KAX8/LX3BjG/ eXR3E/O0vesL9KPeG/4VrZibPVty+vyrsSbIC7yCGkF4ApLo7o/4C1ieHff1960mKrH3izRjOoT RepbXzVi1grEISTxDHq5MsWfkCY61SMPlfGLKUdZgQt7QiS7Vr40R9FbA3f+qR3bvkAzg2RHawv S+yZho6VsaK0iueNBqnnR1d8FE0BJ5HzDopq82QcRvrv+9fsZGns= X-Received: by 2002:a17:902:e94f:b0:2ae:4b91:8407 with SMTP id d9443c01a7336-2ae8242d12bmr146751965ad.34.1773127345318; Tue, 10 Mar 2026 00:22:25 -0700 (PDT) X-Received: by 2002:a17:902:e94f:b0:2ae:4b91:8407 with SMTP id d9443c01a7336-2ae8242d12bmr146751725ad.34.1773127344908; Tue, 10 Mar 2026 00:22:24 -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.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Mar 2026 00:22:24 -0700 (PDT) From: Kishore Batta Date: Tue, 10 Mar 2026 12:52:00 +0530 Subject: [PATCH v3 3/9] bus: mhi: Match devices exposing the protocol on the SAHARA channel Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260310-sahara_protocol_new_v2-v3-3-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=1219; i=kishore.batta@oss.qualcomm.com; s=20260206; h=from:subject:message-id; bh=IdXz01mR4Rs8f0RYsO8zVitGxgHIzvaHiQFtik+wHJE=; b=JpWPX2Hky7cq3Nl6hLOjQzB7LEodbqyGjGzdh/B0/3SOpGWRzPC5Y7PbSt0UPu3GoyPubIzcS ufCXAQU53epBVWp4MW4wO6vSR7tsCwarDtfd8M7z7dvhGKxtoJf6jlW X-Developer-Key: i=kishore.batta@oss.qualcomm.com; a=ed25519; pk=vJo8RvTf+HZpRLK2oOIljmbn9l3zFkibCGh+blaqZCw= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzEwMDA2MSBTYWx0ZWRfX9EMkMFQr6/5F GLnpC166l0z2V/laeKa2rlHk11ihQTWfK4cQ0wD33nGM8mNK8u5V5yYVywasCmZHpZoZQPXaqXs bM2KFFzyv48aSMFHaBMjfjjsEGQFPodMerlwwOmuuZkHoXmvNFHZIr+5+nHWCvmLvZQRDhn5wCJ l9uo8hALGiYGtPSGFKEvJUqGVgHH6t+5vrix5q67mHbIbAd+tb/w5yb6QrcxGp45XptpRP8v/9u 9ZozC2ze+C6g6q8bLWgprq3rOpXRPdOKqW/EbZCgJnG0zCW+IyUUAKjKbC7HI9gI3Dbs0dIsoq1 KkGaDSVceoD8NRuAJHxi1aZw931zXMu7At04tSoBKYaRU5Nsvf1WB5hBXT3JDh3mtihw4dvtz9i 0ktQy38YMNGLS2fgiY7G9N/UFfZ/1OpWDIj7Hlq9kJUGSLtnqcoQ3gImEPy++NGMf0HyEJLeWeC BJ4qt8sEdG+dDNBL0PQ== X-Proofpoint-GUID: uz34wzR3CzHUk9dkoOBMPjzyRf29b-EY X-Proofpoint-ORIG-GUID: uz34wzR3CzHUk9dkoOBMPjzyRf29b-EY X-Authority-Analysis: v=2.4 cv=KNRXzVFo c=1 sm=1 tr=0 ts=69afc6b2 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=yx91gb_oNiZeI1HMLzn7:22 a=EUspDBNiAAAA:8 a=O3MGeqbvIhhX5qxHWLUA: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 adultscore=0 impostorscore=0 spamscore=0 bulkscore=0 priorityscore=1501 suspectscore=0 clxscore=1015 lowpriorityscore=0 malwarescore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603100061 Some Qualcomm devices expose the Sahara protocol on a generic SAHARA MHI channel rather than a QAIC specific channel name. As a result, the sahara driver does not currently bind to such devices and never probes. Extend the MHI device ID match table to also match the SAHARA channel name. This allows the Sahara protocol driver to bind to devices that expose the protocol directly on a standard sahara MHI channel. Signed-off-by: Kishore Batta --- drivers/bus/mhi/sahara/sahara.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/bus/mhi/sahara/sahara.c b/drivers/bus/mhi/sahara/sahar= a.c index 8ff7b6425ac5423ef8f32117151dca10397686a8..e3499977e7c6b53bc624a8eb00d= 0636f2ea63307 100644 --- a/drivers/bus/mhi/sahara/sahara.c +++ b/drivers/bus/mhi/sahara/sahara.c @@ -911,8 +911,10 @@ static void sahara_mhi_dl_xfer_cb(struct mhi_device *m= hi_dev, struct mhi_result =20 static const struct mhi_device_id sahara_mhi_match_table[] =3D { { .chan =3D "QAIC_SAHARA", }, + { .chan =3D "SAHARA"}, {}, }; +MODULE_DEVICE_TABLE(mhi, sahara_mhi_match_table); =20 static struct mhi_driver sahara_mhi_driver =3D { .id_table =3D sahara_mhi_match_table, --=20 2.34.1 From nobody Thu Apr 9 09:04:43 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A5DB3E5EFE for ; Tue, 10 Mar 2026 07:22:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773127352; cv=none; b=e/iDABOzDFbha4hnf0ZRevdKWgmNdPnOikDX/JqW+lBWnlhN28QugbGFAGysTnYUukAPgxoNapn2S1uSCPVqzb+5Ok3t+y6guCAWVJUSiondsLsZKGNXKHIwdQhAfgkCpnTpNTt/xE34IrIwEN4GC2WlL+5h4NOWJInx/G2fYZQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773127352; c=relaxed/simple; bh=D9kJlDoQ6LGAQMXZQh6rystru1KGUPI8NHA/TRw7+VQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bVz6HD2KksjXo9wxrMe1HicodQEQmprRGNgmkpa64p+UlsPGMoA302uurlo/SfsLNaSaqXk8qC4npgKGq69a/Jx1B07YwxExT9ePufdRf/tvIGl5BsweMMVCQEPrna1+D+PzQCnpFuPid+jtgtqI7Mem1SE+hgCSEpSthHfT0jY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=dWrtB+Yk; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=QKK2QAMR; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="dWrtB+Yk"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="QKK2QAMR" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62A5lZTL568942 for ; Tue, 10 Mar 2026 07:22:30 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= iImuO6SGxaLTCiAHgKuG3rSRhW0OgS17DvZFF+54V/Y=; b=dWrtB+YkkeoZVD5l dBFkknMK73pt1U9W74yJib2y3ulLziyenaDahhjvZ9t4ziBrpCDmWruMXWoHjkvA +wJ7JJFub+qHEbbjgs+a6kW/9y42jPK8PO7KHLjOm2cRsvBmb7gN7XaqgGN/TPZJ JEtkg4qNoW4BMt80YI7HtRC2+oQ0/WR7fylCDmlraX+U7JE/HY6IXXKvBkfvq+hE 83fPNy2XAtlEQfKRuK5PvtY0hYa8nI90pynbbVBLvY/KKWAhPSrTR+V37Ehaa++N ZSOTeMwl9aNU881G3Euk/MEd6o6xqIUSht/bMcjqiaEyvD8sWEt9jpcB3e/4PApe 9t2gCw== Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ctdf8ga9c-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 10 Mar 2026 07:22:30 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-2ae50463c39so87033125ad.1 for ; Tue, 10 Mar 2026 00:22:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773127349; x=1773732149; darn=vger.kernel.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=iImuO6SGxaLTCiAHgKuG3rSRhW0OgS17DvZFF+54V/Y=; b=QKK2QAMRJHF3Pb3CKrR1pPjYjo42G14IPTOlOK1qvKoH3etoZqRTJbr3j5Ezl2OKo7 ZOEwHXEYUnngMIsCzkZkfM5pMoxKQeHkpkSRJTTrrTH8xpLcMvJawXkTf7UbxW5CiwYv Ro1HPmaWAFV6yjc+fWJySprsbpV7Z5SJzOoXoM9TM+2SaHcF6h7VNg10TxQKgbzH4Ea6 8LTDJT3rY8dHbJiDxFro6iKHYO9HyAgtdy7tvrPy7R6AdlBp7zWydHe7VlvEpzhCghOV UHShwlzF3oxkYpWZQFFgOwOXKnjITlaMUepb+CirfMcEfRBQWOGUZDX7nK4/BfukFpz2 ZfFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773127349; x=1773732149; 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=iImuO6SGxaLTCiAHgKuG3rSRhW0OgS17DvZFF+54V/Y=; b=twEXHy1WK2bBb22wGtCKDiC8UpJlQMxlkW8zgcPvRWVCy5M0pIKt2jbzF2Q1qai7Gu 4UB9jWcYCSr/PBAuyOuejTUD5w7ItwNE6FRL4exeKQLMniaouo0zATvE8w9eDOw65mpc VqOHKtXR1ev+qjw8xs/FhP7jrjeqmZcK2klz7R+p6EbjOPM0Q4ayRZAH4KaDdz3u+EZG gH2rqiVMmJQeB9S7+NnJ/F09q9gLyVs/bD74WTxRu8lInTctfDCTQYt2pij/yA3orjaU TNhY/XxZfTc7WHikNJlOz/rfirYZdI0XG0wEhJhgzE/5Tv7DIk72N+i6IpK1Wc+kGu/P ySLg== X-Forwarded-Encrypted: i=1; AJvYcCUnoMAKr2VOBRI3ZZo9PbM9zBOu3ISo23OZBZgk2tbetp1kgxocV7+/dAjRILrSpyjPDB+OjvN0Ur4jmv8=@vger.kernel.org X-Gm-Message-State: AOJu0Yw+SFmN6J23ZduEbPijwzKgVP1PxsVaY6sFRTFPXBn63CWNmKHc Yu8fRvPba4HQwnI0pru8PQos2YDChHYrwadWvlPxzM0NYq0Cr+IOBEkHcnb5fEv8+ktyfeo0Dxt OboG60CYec2wjRGzK7FA9H6U85dmPC9221LwDWsTVZejxyseNdD+4uW2xVdIpe+WrNsw= X-Gm-Gg: ATEYQzz2dGu+Lh7XqcKU6tVrQ9OtKCBZgAGyOLTFDp0mwP0fdwvaH8H8gyVvJIMS/H1 xoj/7U2J3ivxIw0fS50Ca9NrmK2vsullBvvhlVZmYSc11bUtJAUdHqYgGRtasXq8ySRW2pnfyDs wzGxLcgtRaAOFTzWUewwruWgZ5rRO5X5lCHVwY9aKlFm0xVYI8WJX+oJtGlc6UK4pTO3U3n2pBP Fq8r1qcMB9l7IYEWCTjpBDxCXRJkLUFe+paXQyzJHxBOq2B/NsQW8c0lvNz+sr9qPrnJw9ZLeYy r5lPXILmii8Ey5YEYhuMnNS1gjqi6Oi7gu8Xoe6+F18L8X8UWEEqvOxqBBnb8B2okhVl2JMbSww Gf6PxGL0fI/g1l43ng/pzMbPajnv1ePD3VQp6S8o4IDie1N/zYjg= X-Received: by 2002:a17:902:e790:b0:2aa:d630:cd5d with SMTP id d9443c01a7336-2ae82505f47mr138797275ad.44.1773127349340; Tue, 10 Mar 2026 00:22:29 -0700 (PDT) X-Received: by 2002:a17:902:e790:b0:2aa:d630:cd5d with SMTP id d9443c01a7336-2ae82505f47mr138796965ad.44.1773127348780; Tue, 10 Mar 2026 00:22:28 -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.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Mar 2026 00:22:28 -0700 (PDT) From: Kishore Batta Date: Tue, 10 Mar 2026 12:52:01 +0530 Subject: [PATCH v3 4/9] bus: mhi: Centralize firmware image table selection at probe time Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260310-sahara_protocol_new_v2-v3-4-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=3898; i=kishore.batta@oss.qualcomm.com; s=20260206; h=from:subject:message-id; bh=D9kJlDoQ6LGAQMXZQh6rystru1KGUPI8NHA/TRw7+VQ=; b=CTZh2FV9FQiyZwGLQPHTzXB9kJsW6bpaNzbyq0P/Z7ViUQFDLg9+WJ+aT6EaDJ4D/XXTwoGOe oXks72SrrRJAHcr4haYbVSjBADZoIijZ2z4edmqXtFNpuZGaHlJRE6T X-Developer-Key: i=kishore.batta@oss.qualcomm.com; a=ed25519; pk=vJo8RvTf+HZpRLK2oOIljmbn9l3zFkibCGh+blaqZCw= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzEwMDA2MSBTYWx0ZWRfX6+SqS8ZFG1Dw NarFv2xndQMUOgscBNzTP5EKBEslFItX01SupHQnHJSm987z4CFkH2sLy1CpoRJxZKVggMnU3Bx s5JcZDKnL9F4fW6//VOBMNlTDKNvV65yju/Qg8P0Gt+HlfEOa2dNQuNlhuHuVWYGVNDwsSoGZ1/ V42vt8MKgGtBLQec7JIHjVH4/Cq7cg6PMjHPyNfcsqE+Y7dYPesawwiWzDkvPLeuKxSz9oGgZ7S OmxiUF+U3PASBpOp7Ocl9t/JAsIakQdSSPEuOW8T9Po+iRCpn3xGJmz9s/jhpx+iN8jGwi7hKzC mG+3Eatai0VVqV+vrZYMGw8H0AV6I7IJQgc3DPevdcfxX4udw/3Rw3dFrvcmauciccgAsHUAnL6 VgRn5fpFgo2ciFWrAT1pkHOynLRzDLmSxmpNScfGOu1c3LDTeXF8QjVSX0ftA0qjCdpBXgWwM2x coYjNRjr+axUBC5jWMg== X-Proofpoint-ORIG-GUID: 2NtekCSUwn6jdVOPgggnL4AovxFEumYy X-Proofpoint-GUID: 2NtekCSUwn6jdVOPgggnL4AovxFEumYy X-Authority-Analysis: v=2.4 cv=b+W/I9Gx c=1 sm=1 tr=0 ts=69afc6b6 cx=c_pps a=cmESyDAEBpBGqyK7t0alAg==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_glEPmIy2e8OvE2BGh3C:22 a=EUspDBNiAAAA:8 a=hNMuCp7LqqrRSepR2eAA:9 a=0bXxn9q0MV6snEgNplNhOjQmxlI=:19 a=QEXdDO2ut3YA:10 a=1OuFwYUASf3TG4hYMiVC: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 bulkscore=0 adultscore=0 suspectscore=0 phishscore=0 priorityscore=1501 clxscore=1015 impostorscore=0 malwarescore=0 lowpriorityscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603100061 The Sahara driver currently selects firmware image tables using scattered, device specific conditionals in the probe path, making the logic harder to follow and extend. Refactor firmware image table selection into a single, explicit probe-time mechanism by introducing a variant table that captures device matching, firmware image tables, firmware folder names, and streaming behavior in one place. This centralizes device specific decisions, simplifies the probe logic, and avoids ad-hoc conditionals while preserving the existing behavior for all supported AIC devices. Signed-off-by: Kishore Batta --- drivers/bus/mhi/sahara/sahara.c | 66 ++++++++++++++++++++++++++++++++++++-= ---- 1 file changed, 58 insertions(+), 8 deletions(-) diff --git a/drivers/bus/mhi/sahara/sahara.c b/drivers/bus/mhi/sahara/sahar= a.c index e3499977e7c6b53bc624a8eb00d0636f2ea63307..8f1c0d72066c0cf80c09d78bfc5= 1df2e482133b9 100644 --- a/drivers/bus/mhi/sahara/sahara.c +++ b/drivers/bus/mhi/sahara/sahara.c @@ -180,6 +180,16 @@ struct sahara_context { u32 read_data_length; bool is_mem_dump_mode; bool non_streaming; + const char *fw_folder; +}; + +struct sahara_variant { + const char *match; + bool match_is_chan; + const char * const *image_table; + size_t table_size; + const char *fw_folder; + bool non_streaming; }; =20 static const char * const aic100_image_table[] =3D { @@ -224,11 +234,50 @@ static const char * const aic200_image_table[] =3D { [78] =3D "qcom/aic200/pvs.bin", }; =20 +static const struct sahara_variant sahara_variants[] =3D { + { + .match =3D "AIC100", + .match_is_chan =3D false, + .image_table =3D aic100_image_table, + .table_size =3D ARRAY_SIZE(aic100_image_table), + .fw_folder =3D "aic100", + .non_streaming =3D true, + }, + { + .match =3D "AIC200", + .match_is_chan =3D false, + .image_table =3D aic200_image_table, + .table_size =3D ARRAY_SIZE(aic200_image_table), + .fw_folder =3D "aic200", + .non_streaming =3D false, + } +}; + static bool is_streaming(struct sahara_context *context) { return !context->non_streaming; } =20 +static const struct sahara_variant *sahara_select_variant(struct mhi_devic= e *mhi_dev, + const struct mhi_device_id *id) +{ + int i; + + for (i =3D 0; i < ARRAY_SIZE(sahara_variants); i++) { + const struct sahara_variant *v =3D &sahara_variants[i]; + + if (v->match_is_chan) { + if (id && id->chan && !strcmp(id->chan, v->match)) + return v; + } else { + if (mhi_dev->mhi_cntrl && mhi_dev->mhi_cntrl->name && + !strcmp(mhi_dev->mhi_cntrl->name, v->match)) + return v; + } + } + return NULL; +} + static int sahara_find_image(struct sahara_context *context, u32 image_id) { int ret; @@ -797,6 +846,7 @@ static void sahara_read_data_processing(struct work_str= uct *work) =20 static int sahara_mhi_probe(struct mhi_device *mhi_dev, const struct mhi_d= evice_id *id) { + const struct sahara_variant *variant; struct sahara_context *context; int ret; int i; @@ -809,14 +859,14 @@ static int sahara_mhi_probe(struct mhi_device *mhi_de= v, const struct mhi_device_ if (!context->rx) return -ENOMEM; =20 - if (!strcmp(mhi_dev->mhi_cntrl->name, "AIC200")) { - context->image_table =3D aic200_image_table; - context->table_size =3D ARRAY_SIZE(aic200_image_table); - } else { - context->image_table =3D aic100_image_table; - context->table_size =3D ARRAY_SIZE(aic100_image_table); - context->non_streaming =3D true; - } + variant =3D sahara_select_variant(mhi_dev, id); + if (!variant) + return -ENODEV; + + context->image_table =3D variant->image_table; + context->table_size =3D variant->table_size; + context->non_streaming =3D variant->non_streaming; + context->fw_folder =3D variant->fw_folder; =20 /* * There are two firmware implementations for READ_DATA handling. --=20 2.34.1 From nobody Thu Apr 9 09:04:43 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8F1993E5EF5 for ; Tue, 10 Mar 2026 07:22:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773127355; cv=none; b=f/PAvR4XeFHBSi/mlvc5iVc8TCotYzt7+p72aCSCBJjVKIna5RNxwK3Rdb4CPIt3UZlyvXPdm+NYIZsJsY6PmVeoxrsh9kZLTFJrleJWUutbR/81GOodAO/BUkQWJgqSJilGwvL35NrM+O+im+T2Oz7CzDVHlJGfBjVGjCPxY9I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773127355; c=relaxed/simple; bh=9iJZxHKj6ceRf6SQQXFuF0UcjhRsGt64qimhRUDtN+M=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dvC+LWwa3hEw52AdszntWX248cXft/Z2gy5jwvFOjVo1lLrLxDTREZdh4cg6vs7b/ZYmN+0kguacXhfQwJjPSelFZugl3GyavEY7iSzL4y71gJQiLBtJyrIGZlz7nYOXT32di53LPRiELOrNS30NjO+zvAHMNNcA6ehLIW0tJ4k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=D6/Hrakx; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=MOLS7+av; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="D6/Hrakx"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="MOLS7+av" Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62A2EBBV246495 for ; Tue, 10 Mar 2026 07:22:34 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= qq0/fBoVIDcZl7c9idmvD5vhhJIbEk2C9ivXkYLSvdo=; b=D6/HrakxRUbaY0yc AiUzk5o3nE8Re/VbNXda+Hj6Kat8Bq2Ld9G3m7IASBI/HexLvJPNRla49BIA0jl1 t4wgnGgAdaPuZatlUst1ra5G8RynhRmCzkKiVisIkaBAvKyEPm+1sIVFsi05xQj1 W6UR0sdvuSa2mQE0VEWPHnqzLzp9/jpyyzvBPWamCqnaIJgve0rzF0JRFgl/y97E p4/nwLZ1Xrs2DjpdYg9g9TlyWK4hgYLtEB5YmEGymI4KRm8S2d+R+2tNptUgmOvu Gof4OMd8nomh8nJL8ugN9t6ssRHCg/IGmdVBkgF8dUBi4RCntL3401zQGWNT5WBs 3EIxAg== Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ct88019yf-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 10 Mar 2026 07:22:33 +0000 (GMT) Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-2ae4e9577ceso448379465ad.1 for ; Tue, 10 Mar 2026 00:22:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773127353; x=1773732153; darn=vger.kernel.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=qq0/fBoVIDcZl7c9idmvD5vhhJIbEk2C9ivXkYLSvdo=; b=MOLS7+av9SHxQ4BhOHbWQmKjNmszAl+ZSO6CfcJal4bdeYvX1NiPopNjfucxXxERNs tYxmCWFtTenmadOwsbyFzLHYGP/+hToWuXCzPH0aMXHxRkGT2WBljijINvYHzMg/99GB OUXeRlHhpeK7YyNV/iVgcpdYrYYsc5ScCdBWKvAhhM+q01Pi5QCMXrtAkmMlotfISlXi v6WlIby6PheTipiqpNf++CgKDFoO95/NAaSQQlOPen7+FlMqlkKa2s0cgXloVG+0vI5B M3vrIAbUx/1W1f15OwAN2iCyK8i1DcR2HcOlqixz8t3eGkrJwVOV2SZGBXWC1ine3OMI Z0VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773127353; x=1773732153; 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=qq0/fBoVIDcZl7c9idmvD5vhhJIbEk2C9ivXkYLSvdo=; b=Gg2GNGaiE+bwtml7eXzcFUq0akJ26NyeREonOAcfK35lp8LsLDnxaeNfMfvi/yM2V2 w29iTO8pnsgdNZXfs+gSAPallmKLY8AsuYSoAzhHrbwsyWJmgB4RrRPhnPyEN6nwbRoj oVmovMAMJYMN0wDHd3yYvbO4XGXpE0bCdlm8yNZW6/43tQov1X74NE+K5yEnVt84WGML ZeD5CKOCaExqawAjnFxGumyqSwEcA6oXvp89QWiK0lP2Fd92023Z7MdtS8HMXdyWtbcQ RPGD2PWJcwbvk2rTpY1Jqzt5oxyKmE7lDMgbKuK7Jn/pauQy+Y/o79Rr6QnfQ5b44rEV uQow== X-Forwarded-Encrypted: i=1; AJvYcCUMvKvWX6oKZQRhluSImVTdtWxQcMNWzKWsqrcoNrKoLwKW6BOgHbOxzBv9P6o4VJCtNFm2Gfwx8kjptes=@vger.kernel.org X-Gm-Message-State: AOJu0YwEzaiYIdcwjzd7R2trfsVVXHORyo620/6YFlUvrb+VGOSinM+2 rVTHzwyePY0Grkwz9KSj3/RwzseCDp11hnU5wnqXF/g0Py9Lzzh5hNV3xR0sNDkOnL9czg7UCoW LVlPzl1eLD8HqwcCGdvm3GTLm80dcRPNScNuX/elyEY+PQ+yKvqDTrp4npRk9d1/RVPs= X-Gm-Gg: ATEYQzwETg7FsD/6Gt+2TxtBECgSXrFoJy03A313KHsWFmDDM6Dfzt8sXLOwsABDZVE o7BbTbRPVjt96l/2Q/ipiGv2lHZXXKVjisjcpTkZQ8YelgQ1UP59142gVnrEMklFwh0K24qW48w j2YTppSutKU/9i9CJrnFZkFu4jgytzhyv42dUMrexdW1EyDPuJl+AqE0g4paaYi7Q73c1Bcf/a2 tqLsgfaW8NdCn0jr3Ug+LxLEqaNglm7mAtIWZUF90gs9Z0xpAmwhfVJiIABU0nEzmK/dRNGag5e AvH7cNfSq9hPs/QG6YSPx1rdcwDTFQDnknp68ZF2U6p01FsHoCVLcYwIboSUB9eV3hkxsuTuhyx 0YskWZ2XmZxU95fey/0c1HhPIBlP55o7M/m/Li4BtUlpillUuPiw= X-Received: by 2002:a17:903:234a:b0:2a7:5751:5b30 with SMTP id d9443c01a7336-2ae82366c40mr129418095ad.12.1773127353258; Tue, 10 Mar 2026 00:22:33 -0700 (PDT) X-Received: by 2002:a17:903:234a:b0:2a7:5751:5b30 with SMTP id d9443c01a7336-2ae82366c40mr129417885ad.12.1773127352754; Tue, 10 Mar 2026 00:22:32 -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.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Mar 2026 00:22:32 -0700 (PDT) From: Kishore Batta Date: Tue, 10 Mar 2026 12:52:02 +0530 Subject: [PATCH v3 5/9] bus: mhi: Add QDU100 variant and image_id firmware fallback Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260310-sahara_protocol_new_v2-v3-5-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=5038; i=kishore.batta@oss.qualcomm.com; s=20260206; h=from:subject:message-id; bh=9iJZxHKj6ceRf6SQQXFuF0UcjhRsGt64qimhRUDtN+M=; b=HnrMHtkX8FIsJClYbn+h4QhrfuuSrzMST560LuFe5QBkSaiJ1edFD/28P0xY66nkAjHpU98kf ojhe/Omotw7B23lcSMYYNgqORG9DgEW2TZwFCOw/x/hKHwO6FM1VR1m X-Developer-Key: i=kishore.batta@oss.qualcomm.com; a=ed25519; pk=vJo8RvTf+HZpRLK2oOIljmbn9l3zFkibCGh+blaqZCw= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzEwMDA2MCBTYWx0ZWRfXwu1cDLki/t5K FMoY3EAdK/5V52JLZA2W+DUATXKD1o+T62vOGnRbGiBF45RxkxbaQPA+VJJRpLXwTsax9oQ/s0L AKHR97ypfI0ZBahw5EqCrukvTWaZRIQYnxnfANNjYK4qn7+xcZCq52VNuRHVDSjjqnoPCV0Gbl/ eQ7yg2n7P0SBgS1IoDnkAyHda3eecyXz+/VXjK1rMl+KUo0iA5z91DZiQmhdPm+sBiahwYeHwQ2 SpvvrXH0jaLCuc5TYwfQT02vfoCZyEYSDe5KdTZ0LT2nsxhGuUkr6CeBo0KYvx+k6E9+u6Xn2pW oLJOm/gFWKJpbAsCEnpwkHOtYkKJrdahpOuwNDM95sEni9Ng3b/gUOK323pN/a89hF2bFbWz/CN B96tL1xMnz1IRIfgpMNYi91+v6mBe5EayUhRj65PkGZBGNrNudWTgMJ1c5eDbS7sAtFPwNXJBUQ ruD8+1McPLcMT+mdMcQ== X-Proofpoint-GUID: 5M0KARi3jiu7Zg0hZOSHNUh7Om-xOfHC X-Authority-Analysis: v=2.4 cv=Jtf8bc4C c=1 sm=1 tr=0 ts=69afc6b9 cx=c_pps a=IZJwPbhc+fLeJZngyXXI0A==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_K5XuSEh1TEqbUxoQ0s3:22 a=EUspDBNiAAAA:8 a=g53SEPjKJ_zQRiRrflAA:9 a=0bXxn9q0MV6snEgNplNhOjQmxlI=:19 a=QEXdDO2ut3YA:10 a=uG9DUKGECoFWVXl0Dc02:22 X-Proofpoint-ORIG-GUID: 5M0KARi3jiu7Zg0hZOSHNUh7Om-xOfHC 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 suspectscore=0 adultscore=0 malwarescore=0 priorityscore=1501 phishscore=0 impostorscore=0 bulkscore=0 clxscore=1015 spamscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603100060 The Sahara driver currently selects a firmware image table based on the attached device, but it does not recognize QDU100 devices that expose the protocol on the SAHARA MHI channel. As a result, the host cannot associate QDU100 devices with the correct firmware namespace during image transfer. Extend the probe-time variant selection to match the SAHARA MHI channel and associate it with the QDU100 firmware folder. Add an image_id based firmware lookup fallback for cases where an image does not have an explicit table entry. This allows required images to be provisioned by the platform without requiring device specific client drivers or additional registration mechanisms. This change only affects devices matched on the SAHARA channel and does not change behavior for existing AIC100 and AIC200 devices. Signed-off-by: Kishore Batta --- drivers/bus/mhi/sahara/sahara.c | 77 +++++++++++++++++++++++++++++++++++++= +--- 1 file changed, 72 insertions(+), 5 deletions(-) diff --git a/drivers/bus/mhi/sahara/sahara.c b/drivers/bus/mhi/sahara/sahar= a.c index 8f1c0d72066c0cf80c09d78bfc51df2e482133b9..4ea14c57774f51a778289d74093= 72a6ab21fea60 100644 --- a/drivers/bus/mhi/sahara/sahara.c +++ b/drivers/bus/mhi/sahara/sahara.c @@ -234,6 +234,36 @@ static const char * const aic200_image_table[] =3D { [78] =3D "qcom/aic200/pvs.bin", }; =20 +static const char * const qdu100_image_table[] =3D { + [5] =3D "qcom/qdu100/uefi.elf", + [8] =3D "qcom/qdu100/qdsp6sw.mbn", + [16] =3D "qcom/qdu100/efs1.bin", + [17] =3D "qcom/qdu100/efs2.bin", + [20] =3D "qcom/qdu100/efs3.bin", + [23] =3D "qcom/qdu100/aop.mbn", + [25] =3D "qcom/qdu100/tz.mbn", + [29] =3D "qcom/qdu100/zeros_1sector.bin", + [33] =3D "qcom/qdu100/hypvm.mbn", + [34] =3D "qcom/qdu100/mdmddr.mbn", + [36] =3D "qcom/qdu100/multi_image_qti.mbn", + [37] =3D "qcom/qdu100/multi_image.mbn", + [38] =3D "qcom/qdu100/xbl_config.elf", + [39] =3D "qcom/qdu100/abl_userdebug.elf", + [40] =3D "qcom/qdu100/zeros_1sector.bin", + [41] =3D "qcom/qdu100/devcfg.mbn", + [42] =3D "qcom/qdu100/zeros_1sector.bin", + [45] =3D "qcom/qdu100/tools_l.elf", + [46] =3D "qcom/qdu100/Quantum.elf", + [47] =3D "qcom/qdu100/quest.elf", + [48] =3D "qcom/qdu100/xbl_ramdump.elf", + [49] =3D "qcom/qdu100/shrm.elf", + [50] =3D "qcom/qdu100/cpucp.elf", + [51] =3D "qcom/qdu100/aop_devcfg.mbn", + [52] =3D "qcom/qdu100/fw_csm_gsi_3.0.elf", + [53] =3D "qcom/qdu100/qdsp6sw_dtbs.elf", + [54] =3D "qcom/qdu100/qupv3fw.elf", +}; + static const struct sahara_variant sahara_variants[] =3D { { .match =3D "AIC100", @@ -250,6 +280,14 @@ static const struct sahara_variant sahara_variants[] = =3D { .table_size =3D ARRAY_SIZE(aic200_image_table), .fw_folder =3D "aic200", .non_streaming =3D false, + }, + { + .match =3D "SAHARA", + .match_is_chan =3D true, + .image_table =3D qdu100_image_table, + .table_size =3D ARRAY_SIZE(qdu100_image_table), + .fw_folder =3D "qdu100", + .non_streaming =3D false, } }; =20 @@ -278,8 +316,21 @@ static const struct sahara_variant *sahara_select_vari= ant(struct mhi_device *mhi return NULL; } =20 +static int sahara_request_fw(struct sahara_context *context, const char *p= ath) +{ + int ret; + + ret =3D firmware_request_nowarn(&context->firmware, path, + &context->mhi_dev->dev); + if (ret) + dev_dbg(&context->mhi_dev->dev, + "Request for file %s failed %d\n", path, ret); + return ret; +} + static int sahara_find_image(struct sahara_context *context, u32 image_id) { + char *fw_path; int ret; =20 if (image_id =3D=3D context->active_image_id) @@ -292,8 +343,26 @@ static int sahara_find_image(struct sahara_context *co= ntext, u32 image_id) } =20 if (image_id >=3D context->table_size || !context->image_table[image_id])= { - dev_err(&context->mhi_dev->dev, "request for unknown image: %d\n", image= _id); - return -EINVAL; + if (!context->fw_folder) { + dev_err(&context->mhi_dev->dev, + "Request for unknown image: %u (no fw folder)\n", image_id); + return -EINVAL; + } + + fw_path =3D kasprintf(GFP_KERNEL, "qcom/%s/image_%u.elf", + context->fw_folder, image_id); + if (!fw_path) + return -ENOMEM; + + ret =3D sahara_request_fw(context, fw_path); + kfree(fw_path); + if (ret) { + dev_err(&context->mhi_dev->dev, + "request for unknown image: %d\n", image_id); + return -EINVAL; + } + context->active_image_id =3D image_id; + return 0; } =20 /* @@ -301,9 +370,7 @@ static int sahara_find_image(struct sahara_context *con= text, u32 image_id) * Only the device knows. Suppress error messages that could suggest an * a problem when we were actually able to continue. */ - ret =3D firmware_request_nowarn(&context->firmware, - context->image_table[image_id], - &context->mhi_dev->dev); + ret =3D sahara_request_fw(context, context->image_table[image_id]); if (ret) { dev_dbg(&context->mhi_dev->dev, "request for image id %d / file %s faile= d %d\n", image_id, context->image_table[image_id], ret); --=20 2.34.1 From nobody Thu Apr 9 09:04:43 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BB2B83E5EFE for ; Tue, 10 Mar 2026 07:22:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773127360; cv=none; b=dHk6cvWPHVtFXftz9Vgq+3Hk6v8krb7a1ayW2p9SbXn0DJiz3ddnkJYRiND0it9v3EP2UzH9HaUYrrFvsfxaSZUHbQDLtFlULlbhkabZ5eINi/VaKrZkE0byr8LUBls0s7TbbMRjKnmnn1CWNV87H/o7lLySNB4q6Ja+zo+bXmU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773127360; c=relaxed/simple; bh=Ap7TaXFPFmY7vxQioEQxXOj5gqr4VqCldx5s0gGK/Jw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BJHH2Y6u3l9TVfTgwWzyFNIw0qCogiMZ1K9l560A/xU4hh9Wh3gSGf07GAwJ3m4yQIOSe8+7iZT+PhV/hNIhSwDSYvX1utjuIeH9AMvXQVzHVfkNjxDC1dyEb81yE2U/0HRHsaVe1r39qVg9z+05xQbpKtlkmXUUmKfzMnY1Yuk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=hiqGaWm4; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=c7I5nZ8l; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="hiqGaWm4"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="c7I5nZ8l" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62A2ES9e2363765 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-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ct032b22t-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-f199.google.com with SMTP id d9443c01a7336-2ae42659a39so555989295ad.1 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=vger.kernel.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=c7I5nZ8loE9i6ZQgMMxiSyhPh9Z7oBlJ4Rwc3okly7d03biW6g0r3U9QaNZO2z4r5h y6UhU9D78EOmFKPt9Le6KC6WiigmBKsltZDcfxP2b5byl0N35cIvgto60R206qR2znvi CCIX7LTqyig3wf76n0LpT3lnM809SjQRg2dD02o/cjnttXOrE1cLia5Je2J5z86XB8/y m9jIncjyZ4+wS1AeFRJt7wYKMuDjMiZLdf1vi2Jdtjurl+laXTcaFIqA9Oseja8pLvDV Z7cRDycBqMRXAMYZPed4cdIQWQ0M5GVzCjNnW0uf0Cfi/rywCXsHkGgru3Wi0o3Bb2oA HzYQ== 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=ZAjAEQjJOesyZzivNCbFQhFBN4mXheNELJQvWscMVrScrHWQUEt7sJefme4AuF6dqg o4ZT2fv5e/E6R8WKm5PDkwL14PmDnUxO8mIj7v0TPSU9sXCmN2FjL5HbGwrB19j5LEk1 nNDEhmb0AMRYdqK3TmxRJ/vz80hxbZVEhGR/giPWlRKMwyHg2wRS6YVxc42DBWf3lbiA EowTgXF/9ljWxYjpsLrtHQQtINIQSOiL//Toi6VqHCN6wVIh9oRLbsRYzcbHEQSGP5ee 4gYu10R3OqhIb1cORKKC9ws7X2k71MsAbFpYQhHq/RCHMU3Xq6mWpW80CZduCWQ/kHzG o/cw== X-Forwarded-Encrypted: i=1; AJvYcCVAnXyVQTKygkoXhHu8dW3K0HW0UPGjxILsUvubZb2M0A2yNSHLwBSb9/qNi9ABL7aXrcV3/3ci4P5ELLw=@vger.kernel.org X-Gm-Message-State: AOJu0YygUkALluCumCPwD6zqDoOK08eXMYkbgyzoU+8kLCeCfadkSNd6 8/thGJ/pR1HhBRizr2jTC06f4ZkGE8zPqaqG3LNiFFPgWY1oehVLCkveNx4JRbND2rG/S0ZCAfC fX0ap0SrL+PXABMZW/bIgyiV3KMe0W7YLRf+59Z11gfx7azp43KPoq+b2aPOCXOSL/24= X-Gm-Gg: ATEYQzwWmn77EyOJOJ7YeFvr733N/Z96zk7RQZv1pwIH/XPmjvr/dhixtwRi3GZhjPH 3hPt6kQm0Db0aayx83vv7zdXkB8xeZwAaASIN+bwLyPFbASRjO6whraRoiwwq8aKNpGHkZHSFRJ 7YtAf7oAH6E1x/HcoSHzfREYTG4wVeA2g6sIvkQ/tq4XwTMXwZwhRHvGFbuq7UhdI0JABIm7EHQ r7B0PctIpBX+TlMEvJ/uBYP8XTTRCdJComv/+tZBKhIFobR35jNpWnc52/QUw4kTtG1j1mN77EC dEJ8aUqb94huwUsAmsTT+f7n/PmAqD0EkhKEDiTeTsHMDkXSUZ+MgIeL8JLRhS1HCcHZfDj+HYW iI6kiX2XYqp5k+4KYnkIF1ByQrL3FpjC0SFVzq+tpKVzmuy8MyZI= X-Received: by 2002:a17:903:3510:b0:2ae:57e2:9b32 with SMTP id d9443c01a7336-2ae823679c9mr142880675ad.8.1773127357229; 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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-Spam-Details-Enc: AW1haW4tMjYwMzEwMDA2MSBTYWx0ZWRfX5WFJmS74S/NA jysmuqikzI3Kv3I6i95/S0u46kUWqiO3Yz3Y9cffge+6iheShMwIc7jJX4JkRIpS98ierHzGQ+c A9fNG7pEzag1id8/z3A+nMUGaDmN2cbUjzx3UtYIMc/pcUNcfeMiLNQigE/vR5X/+FdK4nhD1zx FhowTJUZvOx1IIMN46JZZiZLMLjcL4likpS2SzO/GHryvgTYbuvLAfiv/lRq4ZrquXyFpVlHZbY Y7RK05/aL8WoVt70B5VOrFUJEDUSiQZ1OxsHCREzKo9i9ZDLR0AjwuBJWgAsQDuEySrImmZ+DYM 2s695gV8QJm+ZG6bqrykSDwxUIkUH/sFXQqg/10ZXFyjRXNOogL+hDkye13qEnUe0QdMXuGDkoG LhYyWqpZC4MfKqGNbtpBD2ICnsvs7F3fb4BrC65HT16NY4bZIwXNCPUv7gbxhrvRuLi2AjP7OZy Iz4KhIdL+XC/Lhl7BtQ== X-Proofpoint-ORIG-GUID: v-YbuzArL8DV4tbb-oQ5oQJtFrwtIrxM X-Proofpoint-GUID: v-YbuzArL8DV4tbb-oQ5oQJtFrwtIrxM X-Authority-Analysis: v=2.4 cv=WtEm8Nfv c=1 sm=1 tr=0 ts=69afc6bd cx=c_pps a=JL+w9abYAAE89/QcEU+0QA==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=EUspDBNiAAAA:8 a=ygoVp7MZ-9MK0Bp9ExEA:9 a=QEXdDO2ut3YA:10 a=324X-CrmTo6CU4MGRt3R: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 clxscore=1015 impostorscore=0 spamscore=0 bulkscore=0 priorityscore=1501 lowpriorityscore=0 malwarescore=0 phishscore=0 adultscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603100061 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/sahar= a.c index 4ea14c57774f51a778289d7409372a6ab21fea60..0a0f578aaa47ab2c4ca0765666b= 392fb9936ddd5 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 =20 +#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 *c= ontext, u32 image_id) return 0; } =20 - /* - * 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 =3D sahara_request_fw(context, context->image_table[image_id]); - if (ret) { - dev_dbg(&context->mhi_dev->dev, "request for image id %d / file %s faile= d %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 =3D=3D SAHARA_DDR_TRAINING_IMG_ID && context->fw_folder) { + u32 serial_num =3D context->mhi_dev->mhi_cntrl->serial_number; + + fw_path =3D kasprintf(GFP_KERNEL, + "qcom/%s/mdmddr_0x%x.mbn", + context->fw_folder, serial_num); + if (!fw_path) + return -ENOMEM; + + ret =3D sahara_request_fw(context, fw_path); + kfree(fw_path); + + if (ret) { + ret =3D 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 =3D 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; + } } =20 context->active_image_id =3D image_id; --=20 2.34.1 From nobody Thu Apr 9 09:04:43 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 87D993E8C46 for ; Tue, 10 Mar 2026 07:22:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773127365; cv=none; b=LfMBYagIWm2g0ubSZiXuamF6R3Mz7yfxjLw5/qOAqd6sbvhqAfJS1sglL3Xaqd3ylk9PFJ3bCYbjnLxhgQJiYHWlmjYYMWYxdAP8gIZIJxkR5blu+w9iObNQKi02iXdxIdXfEIfWLL06H9XMY9soLlizgm9b14NFganC/tOYvXw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773127365; c=relaxed/simple; bh=P1IzXcVjmKfRaow4rEqobZUMjX/s+CE8w3S3MJsIlfk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fLprmUcYT5SvwFbtYK+IRK5ox8C2N29KiiU/UGPQA0MgH05/sXFaDADJoUulspLcJDTRHmXhOXk+jqff3VSCa5Zfjx+SR7VQDoy+KS5Rx6Wo1HJnxJUg8WBCwXwYks7lpyJBZ/A7BFGl5GLjlVgZ01E0ae5tAvpXQQ2ChGDlGX0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=AdYYoLpE; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=dYC7vMqx; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="AdYYoLpE"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="dYC7vMqx" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62A5lFLS568670 for ; Tue, 10 Mar 2026 07:22:42 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= SK5UC/KQfXR1hLzmHDReuvjdixzY1PbWgrbCpHiLeF0=; b=AdYYoLpEaO87vlnT G1bci/o9FUcaBCKnY+Nhm9aLjz3ufnJ2mQpyFGrTf4JP08ULENwxTkP4inhqSV2s v56poNpfZaxqdOM/XLrGR52ymm5zwCDmjMI6kaJ1fDH8n0GWbCEpbnESwPtuGQfm 3Ycl6erLa754REHAWsW0ncJAB955Mku2neUu0CigG00Zw8tuhb8YDXcGH5A7NYid 7wNkGkgwQ1Gi9kwikP3MiSKBuJIL23ZW3a5xxML9l5r9Qw/+w9k4wmJPAwcnrQVr N0Yzn0etegBhJreMCWkKDUQ6laPN2syKGVPxL4Z+J7IzmcjrnfZIc3I8hYNpXA2P o7YdQg== 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 4ctdf8gaa5-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 10 Mar 2026 07:22:42 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-2ae3badc00dso106572885ad.3 for ; Tue, 10 Mar 2026 00:22:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773127361; x=1773732161; darn=vger.kernel.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=SK5UC/KQfXR1hLzmHDReuvjdixzY1PbWgrbCpHiLeF0=; b=dYC7vMqx9J6JSP14uZJI86FF+wbdlySSYP9Md2OdCDV0ADwIEkRnD5OU+mSfQw6iYf S1OzfsOMmanafXTsuF8m2TvMW/0JTX7L1RyOg9pj8KtdOyEl5v/VH9QJiv5fOkO4RQM4 AaUZeQTx+sy83o9MMFHTR0PEUtXHh+AcH+Q74zdMJnmQ+cUlBDKCzlA72vBxmDttrepB pwc9WPk8iAeCjOu1ieC/6OzjbcR4EeAMljJA8WloZROhSiuxxm7dSP+6/U/p1uYhvF6E VTljA6ePz2Oyj1q8nUqXW9SE04oMsM1OeQumn+S4IgonQZUjQmExwRICh+YPXfEL3mek HF6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773127361; x=1773732161; 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=SK5UC/KQfXR1hLzmHDReuvjdixzY1PbWgrbCpHiLeF0=; b=IRf1APlXYJWaIq+dV6DjRn1Aw+cmVLC0M7FLrjOSFguqqUZ/TgsHmZ/PqV5ghdE6Z9 FtBHe5WdNClR0QCWAdG+KDWupgpki61yAmU+tUm8TrJSjJ1hmFgpG3CPY46qShYpeNuv U+6Kd5vW+5JFSpDbnHfQn5Q6GToivjw7f5abPr7/X19zj4dsZ9EJ6Hvcc+YhoVNrGOOy Gb2KbRHZ3rWqiLYalP7Pk9O3YfhHhv0AnFawiy3e45Nk5/vFlbIurhT+dOaiyt69iBdG +aszPEB7vr6Vd8m0lEkzj9UYwejACTq4ckB9971Ho0b1z/lWva9P4lc7y9exeZCmYybD mlVQ== X-Forwarded-Encrypted: i=1; AJvYcCVsk3v71OI3/12KlLopd8kgIPI03mvCng37dsj50Sl6M7kgxeDNGDQXILxe304sm7tBYcEpu0hOn2ybc7M=@vger.kernel.org X-Gm-Message-State: AOJu0YyPepSo/KeDDCnQhKkedb+FCiDU5OTxhs8Db2JIamXatQoSluS3 DPXCF/BE6NL5OISXCV4e4wGaz9CkqJOyLadmKaxfjAv5u6ZT79YEe+7FAglecnRCkU6XXuq1Gfd bkji0xu4yap6WKpM2cWzFDYhyzEHWwpEWABiB/7NFQjGCeMwiUg+8R/Bvr4RjXVccdYY= X-Gm-Gg: ATEYQzxwcs5qvK/TLVNx9mNF0zW/knlZcyjF+suqmFkCEjPCI4BcHJcqOyL19jlX5L5 1nwmkl3qVsKudoAFItQlBXKbk2TMU9R2qLO2Hr/lm1nqfD/PY3trd19szWsUNBqhsuwXm9B1ayF u0G4BHfmn/+amDqHQ7aGIhCXPDsAIalpN9i/fz+PkBlOH5E93lkdZ+ZXvoiYOH0TqcBzG053ZoW KEB32VwzUQxsoku79bAE6wsYipI5gXFzPa7rMQjFpV6buC49HoNUcu6DOHLQk0Zy/2zUxopmq9v zdXo+RXUANv+yUOME6qYSKy6EH+TF2xXSztSridBPDBQ5TFbGSLe3XaHwu4zPYVzqHsZ9amFk/y hOP0pCsw0XhUkopOix8jlQF0q1GLmjB7KMp/YFww//RIzEFMVjto= X-Received: by 2002:a17:902:e890:b0:2ae:5163:c2aa with SMTP id d9443c01a7336-2ae823a1852mr132415175ad.20.1773127361211; Tue, 10 Mar 2026 00:22:41 -0700 (PDT) X-Received: by 2002:a17:902:e890:b0:2ae:5163:c2aa with SMTP id d9443c01a7336-2ae823a1852mr132414985ad.20.1773127360712; Tue, 10 Mar 2026 00:22:40 -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.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Mar 2026 00:22:40 -0700 (PDT) From: Kishore Batta Date: Tue, 10 Mar 2026 12:52:04 +0530 Subject: [PATCH v3 7/9] bus: mhi: Capture DDR training data using command mode Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260310-sahara_protocol_new_v2-v3-7-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=14768; i=kishore.batta@oss.qualcomm.com; s=20260206; h=from:subject:message-id; bh=P1IzXcVjmKfRaow4rEqobZUMjX/s+CE8w3S3MJsIlfk=; b=trgfPbRYn+QD4CE/IxijzPKE6ZWQQgvq2wEEbFsvFmN6sZOW6RDIzQwRRQSWiyGq8tw7Wl+6A wu9SMnmnkeMBmblMYzEpfWPxqThoTKbiYPXkIWBv1n1Ikw5nSGJ5jG9 X-Developer-Key: i=kishore.batta@oss.qualcomm.com; a=ed25519; pk=vJo8RvTf+HZpRLK2oOIljmbn9l3zFkibCGh+blaqZCw= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzEwMDA2MSBTYWx0ZWRfX64TH4p8Kp5N7 WWN1pB3Sn9HhSST967BQmPXMqBQDv62BSjTO3pgLeVKA+l93QWGuSycDdNLyREj+LH/MZlX5J3i 9iuOxNg/H3GsXjzOu8TvGKLV/9SwgL3HXM7bdbF85Cg6tgSZga7Vs6MbleN2tPgO2obrVtuLeb1 hCj3ilIo8EKchLPNK4UTIbNCWTJ9Tfqbh2Hpf5vAWZSyc37XVDEE9/jJGu2FmVjMgtJ4zwuY+Ex V9LDb6ujEYRMR/rxz/BGpcNClq9A8NIjCXvK1f/ScN3V1/Us9tjia7iVbUQvQ7ez28iSp/2cDSK GutCPo46qRxH9QIeHb6S48O07yeKCZHtTTj1iPht5vKzHLQ0j7UCzOTp44xNuWJ1FIGGZlnpc4+ 8ITiQTWI1PpQ0/nESL5QzIG08xRH2gKLDzqQo+DLZUgXiYUNZqijX7IA9TKIPAjxwfBJGCopNkY W/oWLT5A0atv5c0TKag== X-Proofpoint-ORIG-GUID: FwenjpvgpRv8Kq1kOfHiMg6-Cc2LLrk_ X-Proofpoint-GUID: FwenjpvgpRv8Kq1kOfHiMg6-Cc2LLrk_ X-Authority-Analysis: v=2.4 cv=b+W/I9Gx c=1 sm=1 tr=0 ts=69afc6c2 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=_glEPmIy2e8OvE2BGh3C:22 a=EUspDBNiAAAA:8 a=_u4x-iUupSARUiuVX_kA: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 bulkscore=0 adultscore=0 suspectscore=0 phishscore=0 priorityscore=1501 clxscore=1015 impostorscore=0 malwarescore=0 lowpriorityscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603100061 During early boot, devices may perform DDR training and produce training data that can be reused on subsequent boots to reduce initialization time. The sahara protocol provides a command mode flow to transfer this training data to the host, but the driver currently does not handle command mode and drops the training payload. Add Sahara command mode support to retrieve DDR training data from the device. When the device enters command mode and sends CMD_READY, query the support command list and request DDR training data using EXECUTE and EXECUTE_DATA. Allocate receive buffers based on the reported response size and copy the raw payload directly from the MHI DL completion callback. Store the captured training data in controller-scoped memory using devres, so it remains available after sahara channel teardown. Also distinguish raw payload completion from control packets in the DL callback, avoiding misinterpretation of training data as protocol messages, and requeue the RX buffer after switching back to IMAGE_TX_PENDING to allow the boot flow to continue. Signed-off-by: Kishore Batta --- drivers/bus/mhi/sahara/sahara.c | 328 ++++++++++++++++++++++++++++++++++++= +++- 1 file changed, 320 insertions(+), 8 deletions(-) diff --git a/drivers/bus/mhi/sahara/sahara.c b/drivers/bus/mhi/sahara/sahar= a.c index 0a0f578aaa47ab2c4ca0765666b392fb9936ddd5..c88f1220199ac4373d355216787= 0c19a0d5f23b9 100644 --- a/drivers/bus/mhi/sahara/sahara.c +++ b/drivers/bus/mhi/sahara/sahara.c @@ -5,11 +5,14 @@ */ =20 #include +#include +#include #include #include #include #include #include +#include #include #include #include @@ -60,8 +63,16 @@ #define SAHARA_RESET_LENGTH 0x8 #define SAHARA_MEM_DEBUG64_LENGTH 0x18 #define SAHARA_MEM_READ64_LENGTH 0x18 - +#define SAHARA_COMMAND_READY_LENGTH 0x8 +#define SAHARA_COMMAND_EXEC_RESP_LENGTH 0x10 +#define SAHARA_COMMAND_EXECUTE_LENGTH 0xc +#define SAHARA_COMMAND_EXEC_DATA_LENGTH 0xc +#define SAHARA_SWITCH_MODE_LENGTH 0xc + +#define SAHARA_EXEC_CMD_GET_COMMAND_ID_LIST 0x8 +#define SAHARA_EXEC_CMD_GET_TRAINING_DATA 0x9 #define SAHARA_DDR_TRAINING_IMG_ID 34 +#define SAHARA_NUM_CMD_BUF SAHARA_NUM_TX_BUF =20 struct sahara_packet { __le32 cmd; @@ -97,6 +108,19 @@ struct sahara_packet { __le64 memory_address; __le64 memory_length; } memory_read64; + struct { + __le32 client_command; + } command_execute; + struct { + __le32 client_command; + __le32 response_length; + } command_execute_resp; + struct { + __le32 client_command; + } command_exec_data; + struct { + __le32 mode; + } mode_switch; }; }; =20 @@ -163,6 +187,7 @@ struct sahara_context { struct work_struct fw_work; struct work_struct dump_work; struct work_struct read_data_work; + struct work_struct cmd_work; struct mhi_device *mhi_dev; const char * const *image_table; u32 table_size; @@ -183,6 +208,24 @@ struct sahara_context { bool is_mem_dump_mode; bool non_streaming; const char *fw_folder; + bool is_cmd_mode; + bool receiving_trng_data; + size_t trng_size; + size_t trng_rcvd; + u32 trng_nbuf; + char *cmd_buff[SAHARA_NUM_CMD_BUF]; +}; + +/* + * Controller-scoped training data store (per MHI controller device). + * Stored as devres resource on mhi_dev->mhi_cntrl->mhi_dev->dev. + */ +struct sahara_ctrl_trng_data { + struct mutex lock; /* Protects data, size, copied and receiving */ + void *data; + size_t size; + size_t copied; + bool receiving; }; =20 struct sahara_variant { @@ -330,6 +373,48 @@ static int sahara_request_fw(struct sahara_context *co= ntext, const char *path) return ret; } =20 +static void sahara_ctrl_trng_release(struct device *dev, void *res) +{ + struct sahara_ctrl_trng_data *ct =3D res; + + mutex_lock(&ct->lock); + kfree(ct->data); + ct->data =3D NULL; + ct->size =3D 0; + ct->copied =3D 0; + ct->receiving =3D false; + mutex_unlock(&ct->lock); +} + +static int sahara_ctrl_trng_match(struct device *dev, void *res, void *mat= ch_data) +{ + /* Exactly one instance per controller */ + return 1; +} + +static struct sahara_ctrl_trng_data *sahara_ctrl_trng_get(struct device *d= ev) +{ + struct sahara_ctrl_trng_data *ct; + + ct =3D devres_find(dev, sahara_ctrl_trng_release, + sahara_ctrl_trng_match, NULL); + if (ct) + return ct; + + ct =3D devres_alloc(sahara_ctrl_trng_release, sizeof(*ct), GFP_KERNEL); + if (!ct) + return NULL; + + mutex_init(&ct->lock); + ct->data =3D NULL; + ct->size =3D 0; + ct->copied =3D 0; + ct->receiving =3D false; + + devres_add(dev, ct); + return ct; +} + static int sahara_find_image(struct sahara_context *context, u32 image_id) { char *fw_path; @@ -423,6 +508,11 @@ static void sahara_send_reset(struct sahara_context *c= ontext) context->is_mem_dump_mode =3D false; context->read_data_offset =3D 0; context->read_data_length =3D 0; + context->is_cmd_mode =3D false; + context->receiving_trng_data =3D false; + context->trng_size =3D 0; + context->trng_rcvd =3D 0; + context->trng_nbuf =3D 0; =20 context->tx[0]->cmd =3D cpu_to_le32(SAHARA_RESET_CMD); context->tx[0]->length =3D cpu_to_le32(SAHARA_RESET_LENGTH); @@ -458,7 +548,8 @@ static void sahara_hello(struct sahara_context *context) =20 if (le32_to_cpu(context->rx->hello.mode) !=3D SAHARA_MODE_IMAGE_TX_PENDIN= G && le32_to_cpu(context->rx->hello.mode) !=3D SAHARA_MODE_IMAGE_TX_COMPLE= TE && - le32_to_cpu(context->rx->hello.mode) !=3D SAHARA_MODE_MEMORY_DEBUG) { + le32_to_cpu(context->rx->hello.mode) !=3D SAHARA_MODE_MEMORY_DEBUG && + le32_to_cpu(context->rx->hello.mode) !=3D SAHARA_MODE_COMMAND) { dev_err(&context->mhi_dev->dev, "Unsupported hello packet - mode %d\n", le32_to_cpu(context->rx->hello.mode)); return; @@ -477,6 +568,153 @@ static void sahara_hello(struct sahara_context *conte= xt) dev_err(&context->mhi_dev->dev, "Unable to send hello response %d\n", re= t); } =20 +static void sahara_switch_mode_to_img_tx(struct sahara_context *context) +{ + int ret; + + context->tx[0]->cmd =3D cpu_to_le32(SAHARA_SWITCH_MODE_CMD); + context->tx[0]->length =3D cpu_to_le32(SAHARA_SWITCH_MODE_LENGTH); + context->tx[0]->mode_switch.mode =3D cpu_to_le32(SAHARA_MODE_IMAGE_TX_PEN= DING); + + ret =3D mhi_queue_buf(context->mhi_dev, DMA_TO_DEVICE, context->tx[0], + SAHARA_SWITCH_MODE_LENGTH, MHI_EOT); + + if (ret) + dev_err(&context->mhi_dev->dev, "Unable to send mode switch %d\n", ret); +} + +static void sahara_command_execute(struct sahara_context *context, u32 cli= ent_command) +{ + int ret; + + context->tx[0]->cmd =3D cpu_to_le32(SAHARA_EXECUTE_CMD); + context->tx[0]->length =3D cpu_to_le32(SAHARA_COMMAND_EXECUTE_LENGTH); + context->tx[0]->command_execute.client_command =3D cpu_to_le32(client_com= mand); + + ret =3D mhi_queue_buf(context->mhi_dev, DMA_TO_DEVICE, context->tx[0], + SAHARA_COMMAND_EXECUTE_LENGTH, MHI_EOT); + if (ret) + dev_err(&context->mhi_dev->dev, "Unable to send command execute %d\n", r= et); +} + +static void sahara_command_execute_data(struct sahara_context *context, u3= 2 client_command) +{ + int ret; + + context->tx[0]->cmd =3D cpu_to_le32(SAHARA_EXECUTE_DATA_CMD); + context->tx[0]->length =3D cpu_to_le32(SAHARA_COMMAND_EXEC_DATA_LENGTH); + context->tx[0]->command_exec_data.client_command =3D cpu_to_le32(client_c= ommand); + + ret =3D mhi_queue_buf(context->mhi_dev, DMA_TO_DEVICE, context->tx[0], + SAHARA_COMMAND_EXEC_DATA_LENGTH, MHI_EOT); + if (ret) + dev_err(&context->mhi_dev->dev, "Unable to send execute data %d\n", ret); +} + +static void sahara_command_ready(struct sahara_context *context) +{ + if (le32_to_cpu(context->rx->length) !=3D SAHARA_COMMAND_READY_LENGTH) { + dev_err(&context->mhi_dev->dev, + "Malformed command ready packet - length %u\n", + le32_to_cpu(context->rx->length)); + return; + } + + context->is_cmd_mode =3D true; + context->receiving_trng_data =3D false; + + sahara_command_execute(context, SAHARA_EXEC_CMD_GET_COMMAND_ID_LIST); +} + +static void sahara_command_execute_resp(struct sahara_context *context) +{ + struct device *dev =3D &context->mhi_dev->mhi_cntrl->mhi_dev->dev; + struct sahara_ctrl_trng_data *ct; + u32 client_cmd, resp_len; + int ret; + u64 remaining; + u32 i; + + if (le32_to_cpu(context->rx->length) !=3D SAHARA_COMMAND_EXEC_RESP_LENGTH= || + le32_to_cpu(context->rx->command_execute_resp.response_length) < 0) { + dev_err(&context->mhi_dev->dev, + "Malformed command execute resp packet - length %d\n", + le32_to_cpu(context->rx->length)); + return; + } + + client_cmd =3D le32_to_cpu(context->rx->command_execute_resp.client_comma= nd); + resp_len =3D le32_to_cpu(context->rx->command_execute_resp.response_lengt= h); + + sahara_command_execute_data(context, client_cmd); + + if (client_cmd =3D=3D SAHARA_EXEC_CMD_GET_COMMAND_ID_LIST) { + sahara_command_execute(context, SAHARA_EXEC_CMD_GET_TRAINING_DATA); + return; + } + + if (client_cmd !=3D SAHARA_EXEC_CMD_GET_TRAINING_DATA) + return; + + ct =3D sahara_ctrl_trng_get(dev); + if (!ct) { + context->is_cmd_mode =3D false; + sahara_switch_mode_to_img_tx(context); + return; + } + + mutex_lock(&ct->lock); + kfree(ct->data); + ct->data =3D kzalloc(resp_len, GFP_KERNEL); + ct->size =3D resp_len; + ct->copied =3D 0; + ct->receiving =3D true; + mutex_unlock(&ct->lock); + + if (!ct->data) { + context->is_cmd_mode =3D false; + sahara_switch_mode_to_img_tx(context); + return; + } + + context->trng_size =3D resp_len; + context->trng_rcvd =3D 0; + context->receiving_trng_data =3D true; + + remaining =3D resp_len; + for (i =3D 0; i < SAHARA_NUM_CMD_BUF && remaining; i++) { + size_t pkt =3D min_t(size_t, remaining, SAHARA_PACKET_MAX_SIZE); + + ret =3D mhi_queue_buf(context->mhi_dev, DMA_FROM_DEVICE, + context->cmd_buff[i], pkt, + (remaining <=3D pkt) ? MHI_EOT : MHI_CHAIN); + if (ret) + break; + + remaining -=3D pkt; + } + + context->trng_nbuf =3D i; +} + +static void sahara_command_processing(struct work_struct *work) +{ + struct sahara_context *context =3D container_of(work, struct sahara_conte= xt, cmd_work); + int ret; + + if (le32_to_cpu(context->rx->cmd) =3D=3D SAHARA_EXECUTE_RESP_CMD) + sahara_command_execute_resp(context); + + if (!context->receiving_trng_data) { + ret =3D mhi_queue_buf(context->mhi_dev, DMA_FROM_DEVICE, + context->rx, SAHARA_PACKET_MAX_SIZE, MHI_EOT); + + if (ret) + dev_err(&context->mhi_dev->dev, + "Unable to requeue rx buf %d\n", ret); + } +} + static int read_data_helper(struct sahara_context *context, int buf_index) { enum mhi_flags mhi_flag; @@ -703,6 +941,9 @@ static void sahara_processing(struct work_struct *work) case SAHARA_MEM_DEBUG64_CMD: sahara_memory_debug64(context); break; + case SAHARA_CMD_READY_CMD: + sahara_command_ready(context); + break; default: dev_err(&context->mhi_dev->dev, "Unknown command %d\n", le32_to_cpu(context->rx->cmd)); @@ -1003,6 +1244,20 @@ static int sahara_mhi_probe(struct mhi_device *mhi_d= ev, const struct mhi_device_ INIT_WORK(&context->fw_work, sahara_processing); INIT_WORK(&context->dump_work, sahara_dump_processing); INIT_WORK(&context->read_data_work, sahara_read_data_processing); + INIT_WORK(&context->cmd_work, sahara_command_processing); + + for (i =3D 0; i < SAHARA_NUM_CMD_BUF; i++) { + context->cmd_buff[i] =3D devm_kzalloc(&mhi_dev->dev, + SAHARA_PACKET_MAX_SIZE, GFP_KERNEL); + if (!context->cmd_buff[i]) + return -ENOMEM; + } + + context->is_cmd_mode =3D false; + context->receiving_trng_data =3D false; + context->trng_size =3D 0; + context->trng_rcvd =3D 0; + context->trng_nbuf =3D 0; =20 context->active_image_id =3D SAHARA_IMAGE_ID_NONE; dev_set_drvdata(&mhi_dev->dev, context); @@ -1026,6 +1281,7 @@ static void sahara_mhi_remove(struct mhi_device *mhi_= dev) =20 cancel_work_sync(&context->fw_work); cancel_work_sync(&context->dump_work); + cancel_work_sync(&context->cmd_work); vfree(context->mem_dump); sahara_release_image(context); mhi_unprepare_from_transfer(mhi_dev); @@ -1042,15 +1298,71 @@ static void sahara_mhi_ul_xfer_cb(struct mhi_device= *mhi_dev, struct mhi_result static void sahara_mhi_dl_xfer_cb(struct mhi_device *mhi_dev, struct mhi_r= esult *mhi_result) { struct sahara_context *context =3D dev_get_drvdata(&mhi_dev->dev); + struct sahara_ctrl_trng_data *ct; + struct device *dev; + size_t copy; + int ret; + u32 i; + + if (mhi_result->transaction_status) + return; + + /* + * Raw training payload completions arrive for cmd_buff[] buffers. + * Do not schedule cmd_work for those. + */ + if (context->is_cmd_mode && context->receiving_trng_data && + mhi_result->buf_addr !=3D context->rx) { + dev =3D &context->mhi_dev->mhi_cntrl->mhi_dev->dev; + ct =3D sahara_ctrl_trng_get(dev); + if (!ct) + return; =20 - if (!mhi_result->transaction_status) { - context->rx_size =3D mhi_result->bytes_xferd; - if (context->is_mem_dump_mode) - schedule_work(&context->dump_work); - else - schedule_work(&context->fw_work); + for (i =3D 0; i < context->trng_nbuf; i++) { + if (mhi_result->buf_addr =3D=3D context->cmd_buff[i]) { + mutex_lock(&ct->lock); + copy =3D min_t(size_t, mhi_result->bytes_xferd, + ct->size - ct->copied); + memcpy((u8 *)ct->data + ct->copied, + mhi_result->buf_addr, copy); + ct->copied +=3D copy; + mutex_unlock(&ct->lock); + + context->trng_rcvd +=3D copy; + + if (context->trng_rcvd >=3D context->trng_size) { + mutex_lock(&ct->lock); + ct->receiving =3D false; + mutex_unlock(&ct->lock); + + context->receiving_trng_data =3D false; + context->is_cmd_mode =3D false; + + sahara_switch_mode_to_img_tx(context); + ret =3D mhi_queue_buf(context->mhi_dev, + DMA_FROM_DEVICE, + context->rx, + SAHARA_PACKET_MAX_SIZE, + MHI_EOT); + if (ret) + dev_err(&context->mhi_dev->dev, + "Unable to requeue rx buf %d\n", ret); + } + return; + } + } + return; } =20 + /* Normal Rx completion */ + context->rx_size =3D mhi_result->bytes_xferd; + if (context->is_mem_dump_mode) + schedule_work(&context->dump_work); + else if (context->is_cmd_mode) + schedule_work(&context->cmd_work); + else + schedule_work(&context->fw_work); + } =20 static const struct mhi_device_id sahara_mhi_match_table[] =3D { --=20 2.34.1 From nobody Thu Apr 9 09:04:43 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 64B273E5EFE for ; Tue, 10 Mar 2026 07:22:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773127367; cv=none; b=Lw4hgDB9ick5Bbj8b5aKMZx7el2mUGxJnVEQiVDFXKGv0zdwF3BQKiA9tCN03B5cBBUVV+BpsHydVOeNtYtRur4v02fKx15okKwqA6FW1Gy19RZr1Bsc/aXYVt7nvGe1/0KC6+NqP7E1FmRUpmgFVOGF+8/AmkZ7pQqi8iu/CM0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773127367; c=relaxed/simple; bh=zLHdxvYlh3SgJM3zwdFzuQdChe4Q/8MyqXYe5cHG93o=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PMwOSKBx7SaXs/++6eRgpFjP/E5nbtvXA0YvAlAV+L5n/E0IB3QT2snn6NOTi0t7Z1c59bHO0ZvI3y2B+7V6xpC4dLHUoSOLG1QSlU6Ymj1P3fgL+FIkBSa7vpo2PBHL63idCkvva/XLGWxwWZ7Os2egBEGo/PNT/dy6UYDTTIE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=oYn2oJD7; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=W+7/hFm/; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="oYn2oJD7"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="W+7/hFm/" Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62A2EBii246496 for ; Tue, 10 Mar 2026 07:22:46 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= iiXrCv65t5Cfe7JS9CAoM+yCgarvykPh0XYvrPKdD3o=; b=oYn2oJD7ZYS6xKDv L4wJAW3KR170Qvd8MThH0/2fBJzXL3055SL3k7YpFmDUnHdsOxVtI4l2o8XLU3SE 4kO7QO6FhO3XrKNJBfNmVkprnYwOuOoyeRbVfVAXlLf9TIYrxjGFHn/JS7w8Db+h ogugjfX5CIH9HsQytnjPa/xHoZkmUn4WnJFaFCT6H0cRKcXvYTa4aKRsA8NVAqKb 7cpvBcPnBOQXifSV8Bnyej6olfF4ztc4vT+wszB39fTvwDyhgwV89LA3AR5XVAWg qtw36XPeAG82UftvrPS/YmU9GZrL36LlWzXYCjLmWy1UmPBhiMAPHvTxjL/c4hEF paaFMA== Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ct8801a08-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 10 Mar 2026 07:22:45 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-2ae669a8ff1so362522155ad.3 for ; Tue, 10 Mar 2026 00:22:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773127365; x=1773732165; darn=vger.kernel.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=iiXrCv65t5Cfe7JS9CAoM+yCgarvykPh0XYvrPKdD3o=; b=W+7/hFm/EQpv4+9Lh2/gcXUnTmOLqXQbspH9qCXSM7ZrNfyxaNL45DhE9fm1sCfcT8 pZGp3kLJ7eeyInBsnXn+GLPXDe9rp1du4x4Q7LRHKJRhF/2R56x+xn9ZYqQxwJ+kx3bc xGW/sLbG1dqpIwxcCwt7KmOn9iSkSMMWJ8SlvGehyF/OOPBZvmurmp1d4E+XCk4cogpM jbm8fwin9GLT4/oJc7rQDWhlnIGwI0lOQJwRGnyOTGaGdrYBDQ8VBp47EoZVKEqsG1LV aXAgfI7yKgpkgA+vafFgg3eJTlaB5yiYChoqW5/zrqh09MexNl6KXTnkFwbXssZnfK16 Y7Og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773127365; x=1773732165; 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=iiXrCv65t5Cfe7JS9CAoM+yCgarvykPh0XYvrPKdD3o=; b=uvM6N/utf1ySOtzCT8EF+RaPdlpWpLKOVpj0mB1OJ5bUprkv4cIZiL338dk4OVXs0y BS2OYoHQAHI3vrZ+/K5h1PLh1DaKk1WzTcyYD23co3+UeeZDkVnHgQmbiuttAGhEoO23 6ptgqryyERcL4jVuGV2W1iQx1p+oolfTSWsqCKv6OTDIM5iOZRsFkB5KlgGqVgAGVxsC 3jbUGWz7+4RGrqBeNmTmN7y/ElfWCSxXga9eiAneiZLsMXMxyuDLcTv3kOuvCAeYwWWI rQZUjbXWRHv4PXDYeqX3728MUudRzqJDsd9/yw8/M/oY8hBOwf40Avvpdlpa7unG3Z75 znYA== X-Forwarded-Encrypted: i=1; AJvYcCVWkp+DeXZ+JOJMsISRqra7JiyVcYEX3M9e0XOaWgwLhTXspyHFf/e2Ss14Wpk/x4j+WBniD5BrfyQ7Ris=@vger.kernel.org X-Gm-Message-State: AOJu0YwHk+1cQrgwF7GEqD+gCp+OjbQLf7vUfx6wgdDDoABGw2G3ZCUh 4QqW255SQW/3tX7995eaH2xt3/7zduAubTw+MbFSkjnJD5kZmHYrRanX3g2cJ8PQPVyQdotjJdV V2KNxBTdx2nB9s1xNMhWw4JjYmBbD4MtmaPrrAel2v2fY+9pmop8mgvjGR8Qdfc++w6E= X-Gm-Gg: ATEYQzxq69CMk91XFntcgRWQlaP2hywSVKz9ET+WpN3Tdl5BYRheID9XVXYmlkPVIQm lUQLPBFngMME5be4Wwq7GkdFBCtuLEv5S8wy2eW9yW838uzW6jBal0VNdhKJ1aL+xjAA8SxSIsg CJEvivaSXnxjKzk/aLYN3Su945DABWNcMVyyh2ttcW2Ca99o2Wt4yJAm0lBsUfq0oxNYOaSVGpM UcwHU4ds8GPMGY4248wv3gPg13oOFYVkGsZ785bID8zUuBwvnY51daEAVEaSnr+P+v9QWNKUAHD 9fosoqcNFcX9x1HcY5+jVhQut1H2vvmi2FAGpZlHQ0NvNNJX7k9RWwI96LtH6GyoU7mKPWf9aNm vobyqpj+4x0kIiXYNjIHWeyu6I20K2ZRnyIwUpCxPJXKcIY3C0LU= X-Received: by 2002:a17:903:2ac4:b0:2ae:673b:6a3 with SMTP id d9443c01a7336-2ae8249d4fcmr140850935ad.49.1773127365113; Tue, 10 Mar 2026 00:22:45 -0700 (PDT) X-Received: by 2002:a17:903:2ac4:b0:2ae:673b:6a3 with SMTP id d9443c01a7336-2ae8249d4fcmr140850645ad.49.1773127364647; Tue, 10 Mar 2026 00:22:44 -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.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Mar 2026 00:22:44 -0700 (PDT) From: Kishore Batta Date: Tue, 10 Mar 2026 12:52:05 +0530 Subject: [PATCH v3 8/9] bus: mhi: Expose DDR training data via controller sysfs Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260310-sahara_protocol_new_v2-v3-8-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=3311; i=kishore.batta@oss.qualcomm.com; s=20260206; h=from:subject:message-id; bh=zLHdxvYlh3SgJM3zwdFzuQdChe4Q/8MyqXYe5cHG93o=; b=pes+jy19Oahyjrj9tGIH89vFrAWYY4NOq1AgxQcEUjKQTpqGWSIU3tWU0VFnNvOBkuhrGWxoq VU6vI4W5RVXAVK+t9BMlRNCZDOBecfyTaszyNRJ9WUpQiU+8fxa1BuN X-Developer-Key: i=kishore.batta@oss.qualcomm.com; a=ed25519; pk=vJo8RvTf+HZpRLK2oOIljmbn9l3zFkibCGh+blaqZCw= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzEwMDA2MSBTYWx0ZWRfX1ZMrDRFJKuH+ RTo1d516FDh0NtG9VWN1ueKveCQx265SaWkMdiUrvleDXPSVyby72oIFj0XmqA68ZTKL89NeUEi 3h7RnGlntUCrlQGC2qUxem0SsJEZTPxcZuLwTZIJ2nzdgk2u9yoxTqjJN12qvX98DdtQ470TsqU FnF65SxbFhkXCMAqw95k3YLUKXN4r9wP1iKphAMzbgXidoqU1J+y/3KIVuBZUWxMkyzw3pE30gU DTxiNZaboIQVnA4oa6qiazXoSMm6cV6j6jkCcLCrywgAh2DjT+CX6E+anjHF6e6M/d7k/g1DkdN moDN91ixNeUwt4MmTR5q1dgVbeOvqOD7I9D291H6ZflcfrcNaVLnr8E53DmL+MiAnrfadQiCViG It4/AcFtbP5HgyU1/OugHefCEe5bYcwqwaXFlJxADuj1gztxk454iUJR1ZzfAQJvi7VqLJdGUl0 8SmyZk+lJBqV+DJ5BRw== X-Proofpoint-GUID: HUrjb5JrNvPctzh7K2XZxuCxu2o4TmaT X-Authority-Analysis: v=2.4 cv=Jtf8bc4C c=1 sm=1 tr=0 ts=69afc6c5 cx=c_pps a=cmESyDAEBpBGqyK7t0alAg==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_K5XuSEh1TEqbUxoQ0s3:22 a=EUspDBNiAAAA:8 a=9mPLix8uEUeM4unapbcA:9 a=QEXdDO2ut3YA:10 a=1OuFwYUASf3TG4hYMiVC:22 X-Proofpoint-ORIG-GUID: HUrjb5JrNvPctzh7K2XZxuCxu2o4TmaT 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 suspectscore=0 adultscore=0 malwarescore=0 priorityscore=1501 phishscore=0 impostorscore=0 bulkscore=0 clxscore=1015 spamscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603100061 DDR training data captured during Sahara command mode needs to be accessible to userspace so it can be persisted and reused on subsequent boots. Currently, the training data is stored internally in the driver but has no external visibility once the sahara channel is torn down. Expose the captured DDR training data via a read-only binary sysfs attribute on the MHI controller device. The sysfs file is created under the controller node, allowing userspace to read the training data even after the sahara channel device has been removed. The sysfs attribute reads directly from controller-scoped storage and relies on device managed resources for cleanup when the controller device is destroyed. No explicit sysfs removal is required, avoiding lifetime dependencies on the Sahara channel device. Signed-off-by: Kishore Batta --- drivers/bus/mhi/sahara/sahara.c | 69 +++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 69 insertions(+) diff --git a/drivers/bus/mhi/sahara/sahara.c b/drivers/bus/mhi/sahara/sahar= a.c index c88f1220199ac4373d3552167870c19a0d5f23b9..b7208738df10fc3c3895acd4687= 3412818dc1730 100644 --- a/drivers/bus/mhi/sahara/sahara.c +++ b/drivers/bus/mhi/sahara/sahara.c @@ -415,6 +415,73 @@ static struct sahara_ctrl_trng_data *sahara_ctrl_trng_= get(struct device *dev) return ct; } =20 +static ssize_t ddr_training_data_read(struct file *filp, struct kobject *k= obj, + const struct bin_attribute *attr, char *buf, + loff_t offset, size_t count) +{ + struct device *dev =3D kobj_to_dev(kobj); + struct sahara_ctrl_trng_data *ct; + size_t available; + + ct =3D sahara_ctrl_trng_get(dev); + if (!ct) + return -ENODEV; + + mutex_lock(&ct->lock); + + /* No data yet or offset past end */ + if (!ct->data || offset >=3D ct->size) { + mutex_unlock(&ct->lock); + return 0; + } + + available =3D ct->size - offset; + count =3D min(count, available); + memcpy(buf, (u8 *)ct->data + offset, count); + + mutex_unlock(&ct->lock); + + return count; +} + +static const struct bin_attribute ddr_training_data_attr =3D { + .attr =3D { + .name =3D "ddr_training_data", + .mode =3D 0444, + }, + .read =3D ddr_training_data_read, +}; + +static void sahara_sysfs_devres_release(struct device *dev, void *res) +{ + device_remove_bin_file(dev, &ddr_training_data_attr); +} + +static void sahara_sysfs_create(struct mhi_device *mhi_dev) +{ + struct device *dev =3D &mhi_dev->mhi_cntrl->mhi_dev->dev; + void *cookie; + int ret; + + if (devres_find(dev, sahara_sysfs_devres_release, NULL, NULL)) + return; + + ret =3D device_create_bin_file(dev, &ddr_training_data_attr); + if (ret) { + dev_warn(&mhi_dev->dev, + "Failed to create DDR training sysfs node (%d)\n", ret); + return; + } + + cookie =3D devres_alloc(sahara_sysfs_devres_release, 1, GFP_KERNEL); + if (!cookie) { + device_remove_bin_file(dev, &ddr_training_data_attr); + return; + } + + devres_add(dev, cookie); +} + static int sahara_find_image(struct sahara_context *context, u32 image_id) { char *fw_path; @@ -1272,6 +1339,8 @@ static int sahara_mhi_probe(struct mhi_device *mhi_de= v, const struct mhi_device_ return ret; } =20 + sahara_sysfs_create(mhi_dev); + return 0; } =20 --=20 2.34.1 From nobody Thu Apr 9 09:04:43 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 55E113E7179 for ; Tue, 10 Mar 2026 07:22:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773127371; cv=none; b=U8vWCVtBNnZ3Me7tOV/zFAtq5YULaloFMOK2ryuLT81scoXFFHH1qZ6qalB/TB9c5WxcfZNcgTCsNMiv/w5trD6IdGZZCab6tRzc0P7w3ce4iUQuLNyxPWxEagFfOnVHUKKwn2fs2lc52p8XnUrMBpIwESxzJdfj+mrjebLtE7g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773127371; c=relaxed/simple; bh=PYlMjATY4SM1+jaLjbUMOn336QEIJpGFcRpjUcyzz/4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jo8WH8To+1pTei3e6VdoWsP5Cii9eb1gaVUxVW1/Mt4GmjzV10FswbEZ37kDtie0eJY06stxLAlj4CzKQtA/jLFuKIYB5mnBH4kb3eXh4SXQJAnmpScySBKdWV0LZXwU5t9OZi62GliuhSIoyj6f7cXRn7opP7EL0ZU0EoOd+Dg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=OSQUoMBa; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=aoIVQuo/; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="OSQUoMBa"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="aoIVQuo/" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62A2EInl2362835 for ; Tue, 10 Mar 2026 07:22:49 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= AhZtQR443/E19GewAj1186Zwj+uyAl6zxJPtQ9r8Toc=; b=OSQUoMBakbHD4hGg hdEEZESxYnrKgEiNiGZF9XYy6J7UY0NiX8arF6UUes3B04tI4z439vt9YTljux8Z uhRy3tfLRjLA0tZOLflDX0Rc20zO8/pYDIqD59X01yk/zY51ov6dATB6WQREYciM WsntOdOthV9ni3EuJyVt4J56Tkn7jUVCnjq32UDMeJXRkvgkopgC/tmJ9IWVG+Wf tJpi5uGyx4GjJgYSMVF8BACx48dl4pqe7ZtCtdcfZltevIiy23eXyS0pNknN7M/M hkxcAWT93Cdo9L7FBQjBZrZRRwnN4Lg4xeLfcK7GmWysLZy21XJo8Y4n+G/pBhM3 aa6Shw== 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 4ct032b249-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 10 Mar 2026 07:22:49 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-2ae59e057f1so94545925ad.1 for ; Tue, 10 Mar 2026 00:22:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773127369; x=1773732169; darn=vger.kernel.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=AhZtQR443/E19GewAj1186Zwj+uyAl6zxJPtQ9r8Toc=; b=aoIVQuo/NVgwsjEXYNZkTsXj5mEe7CJbtj65DoJml4ZT/UmDmDVHQGkd2Z6x23PtH4 g3Lf2YXUeki41cjg3DT8+rR+kgPlR55IooDSNl+u0pMN6B/6at47SjgF0BKIslSBqgs8 hL06siIzWUpAPjCLsBRMur3hfXciYajBAU7a4PcfPzgHM4C/dTg9YxzawVlXNjxeCIMO XOR6NTeMBQWSrpA7YGl0I69hppkEBwNz5AJSMQLxVM6IVxxdTPxtsxpUElLOqNayk50j kKxHzQnX58hk6hCEPrr9bPe2s0G4ePVD37BWEfyON6pAzQYo582v+iLDC0Sa86R1Dnki 7iqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773127369; x=1773732169; 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=AhZtQR443/E19GewAj1186Zwj+uyAl6zxJPtQ9r8Toc=; b=clNyzaC6Xv1VgGjA9f+6/tlrfqUd3V9d+ncBg15ENtgXPvI6+YIY+ggVoQZTAios5S CsA2SM/si7i0uBW9l7CDhOc6Mb7cnnHtgDf+eg46eWpVcaB2F5ON1UqnaGINnKVWjf7L 0pgvUSRCGAmaAUp84Tr2DIeuy9LNKmE1tWxL/tr2PN0CkaYc2Z4x6hWcgjRuj93pEd4t NcgNJFzIvDJMi3cz1RlEK9/jNtU+ugt3IBzY+3HXFhK1r5yvqVJogO/64ds655TBYPtp fazejir9+khKQFvZEYnAI2QNg/q8kAU/sPHGCd+OSwyvCb7Vgji3N+PN1WSUycubfB0f xpLg== X-Forwarded-Encrypted: i=1; AJvYcCWPLJTWoDGyZocoqvBHsyk+kG8ci8Mq+b/k04eT5q7EYgtsOopYfSgQif10gk7dXGeo/0DTbt4Y/3rf+wY=@vger.kernel.org X-Gm-Message-State: AOJu0YyI9SXG+jYCGb0L9dbJQWjIwingYjk3DVnOqlI57gea8WqDUT3W XilT1sFBt5/traJGy97JvLpQrw1pryWwcE8rQyD6vrcfvVHs1gRBpNiFw6/nUJI1KnkselL735z 3pWYP511BpQ5A1+8y/IxBA8RDfpr0JqNGvLcCCx3qWugVr6XvUhdB5su6mLosZPaE0mE= X-Gm-Gg: ATEYQzwwpkXKK+oo+zWe6ioALroF67sErlStHIz7kGGl0YLMcY6C3HJrJSvh4deH35P u6vb9DnkZCXDa0WTKsNVn7MSeiMLeU0ttCS7XUjZsjCNZRWPMoJN2UEBwUBcQ+xBYi9Ewpuo8Yf jppusGtxxMd9wcCUEpSniiovJnYY/9AuNPq11DKMIxm42q/RYtN9X/JF/HpPWtq5HySVeb3ylhC uztLJ4sXX/Pl5ZXiCeNvDd2QoJqYAZ2M5Rie6i5hGa4UDvdErElJLt7Hlxn5iff9QmLDuheRF+H YlsEs7oFP76rzV9svPMetnp+wW3UYrsIUaVMvjBzMLwFFQQ2yHSX8PGom/o3DqfAXDLkuxuJ/UP h5vV1+0V0lMztySDwVtJUo9vNr1q0Ygi104J3mhq4xmktbMkAfXQ= X-Received: by 2002:a17:902:cf05:b0:2ae:829d:3c33 with SMTP id d9443c01a7336-2ae829d3f2emr149862965ad.8.1773127369017; Tue, 10 Mar 2026 00:22:49 -0700 (PDT) X-Received: by 2002:a17:902:cf05:b0:2ae:829d:3c33 with SMTP id d9443c01a7336-2ae829d3f2emr149862565ad.8.1773127368570; Tue, 10 Mar 2026 00:22:48 -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.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Mar 2026 00:22:48 -0700 (PDT) From: Kishore Batta Date: Tue, 10 Mar 2026 12:52:06 +0530 Subject: [PATCH v3 9/9] Documentation: ABI: Add sysfs ABI documentation for DDR training data Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260310-sahara_protocol_new_v2-v3-9-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=1903; i=kishore.batta@oss.qualcomm.com; s=20260206; h=from:subject:message-id; bh=PYlMjATY4SM1+jaLjbUMOn336QEIJpGFcRpjUcyzz/4=; b=A2ngy+Vh6mGbywAacQ1WhpnAXl4OfWSksXvxmtXi88x0yTGDf+9jd2T6SE6lkrsx9nv4dwTSR O/grnwx19PsAypGENZxaAsrKGNdaoKkokxmqVFwm6mmcVFtenk5b9bW X-Developer-Key: i=kishore.batta@oss.qualcomm.com; a=ed25519; pk=vJo8RvTf+HZpRLK2oOIljmbn9l3zFkibCGh+blaqZCw= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzEwMDA2MSBTYWx0ZWRfX8jXsnivYW0KV QDyVtAPIuG9+UBahPVS/1JnT0tp/flZQBr1SciFrO6KOe5JhOayi63ZRgMd92ygjQ/ZH4GXSpO5 x7VClXK0t1JReV8abwJG87oXiWMRyEpLDP578y2crj8CNKgMHSn+oQKXFe/OlM2GwJZUkg9IEYE eU17OX/XPoaV8IskPM6/BPl3QhiMhDMulFWQ90sSyIm00TLBH22Lbgu1DAkek/V19LSAGAmqLFS pOOIc5Ys2A2GHCiR540X8PSZ/O/HUTryyvUnhmQb4jL1NVJkyuTfCQmpRHQsN4Kmdla1+Gl74Of h7rnlkpx1FqnOzlZnxofQYF/Z8WK2u768wze7ZFFoZ+jwIQthSZNm7H7I93y4JF98FHVhT02rkX YJ9Im3OBkSwNdoL2zzfKYwdQba8oMfLwAJ0ZLKqIoHH6tQQ3T3rfY1/dUuYOLve+yEg8jxRWpUz yth+4TE2wvQg5c5rTrA== X-Proofpoint-ORIG-GUID: yxqGwDKJvkPHOAwcjhGHOAWDTDXDiA_h X-Proofpoint-GUID: yxqGwDKJvkPHOAwcjhGHOAWDTDXDiA_h X-Authority-Analysis: v=2.4 cv=WtEm8Nfv c=1 sm=1 tr=0 ts=69afc6c9 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=eoimf2acIAo5FJnRuUoq:22 a=EUspDBNiAAAA:8 a=dkV1H7vRkoxx0F9zaYgA: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 clxscore=1015 impostorscore=0 spamscore=0 bulkscore=0 priorityscore=1501 lowpriorityscore=0 malwarescore=0 phishscore=0 adultscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603100061 Add ABI documentation for the DDR training data sysfs attribute exposed by the sahara MHI driver. The documented sysfs node provides read-only access to the DDR training data captured during sahara command mode and exposed via the MHI controller device. This allows userspace to read the training data and manage it as needed outside the kernel. Signed-off-by: Kishore Batta --- .../ABI/testing/sysfs-bus-mhi-ddr_training_data | 19 +++++++++++++++= ++++ 1 file changed, 19 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-bus-mhi-ddr_training_data b/Do= cumentation/ABI/testing/sysfs-bus-mhi-ddr_training_data new file mode 100644 index 0000000000000000000000000000000000000000..810b487b5a5fdba133d81255f98= 79844e3938a10 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-bus-mhi-ddr_training_data @@ -0,0 +1,19 @@ +What: /sys/bus/mhi/devices//ddr_training_data + +Date: March 2026 + +Contact: Kishore Batta + +Description: Contains the DDR training data for the Qualcomm de= vice + connected. MHI driver populates different controll= er + nodes for each device. The DDR training data is ex= posed + to userspace to read and save the training data fi= le to + the filesystem. In the subsequent boot up of the d= evice, + the training data is restored from host to device + optimizing the boot up time of the device. + +Usage: Example for reading DDR training data: + cat /sys/bus/mhi/devices/mhi0/ddr_training_data + +Permissions: The file permissions are set to 0444 allowing read + access. --=20 2.34.1