From nobody Mon Apr 6 15:00:37 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 A0F681DDC2B for ; Thu, 19 Mar 2026 06:31:55 +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=1773901918; cv=none; b=Ns9c2JFfvgpfe32whH1A163wv+HGgomvvp47+7YP2uNb1H+id/ejPjUTFq1nWpUz7NZYDdMkpL3gEZT2BVsJ8XMF56O47UpI9N5Wcs+G729n0OXK45Xf+ob6x/HYo2eyOiopTip2k8Tk2YHAyfhgsOe29dMblNEImrKag0fxVtU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773901918; c=relaxed/simple; bh=1D00kesAnJ6aiS/h94SYG7huQNLbnZVj76ipx20EKSA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RcgnH2Hq+JJYrTG6v8WU/gaYASqFge5EG3Lt2dgMbIcHCoDgIjJWk+yYuObyOUTilDLT2tA8z99uiLNOoz11pAr3atyDL464yAWOuuvUzp5en4kkOUqCEY8gCBImPfl4qHD8KW6/RAwMhs1gD3zOm2fWjrb51FpzoI8hBIC+AUE= 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=dx9J0dDy; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=kAJqzBCP; 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="dx9J0dDy"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="kAJqzBCP" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62J5Xcgd573835 for ; Thu, 19 Mar 2026 06:31:55 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=dx9J0dDyM3NgScqU CZiP3NcsDntTdBkr8B/g48Niq7LLwImNGfPcSdStzzC3a1nCrpqEBQNPGm+kONMY TA7Wpdckl4wyNOgRg6EBhz0FkYikY2DAA9d7UW9QC4PyvjNIzYUy4oK/G1CP84o+ RmTtUOEZwW/L6+FWUJQ8IC2Du5ghhXwiPsNCpM4sWCAvr1i/2BvX7dlNn8Jl35ff Xfk8rPpcEjtkjyIedKLfT9+xnq6irnr93ub2LHbKqBwm1RzU5vp967qL6dkvthP7 sqF05q5MlzIt/xXa2lXN7VoyistEvIVojVRd35k5XX2Ls7GBgVODUODxcdh0dOFG yNwRfQ== 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 4d00ega2g8-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 19 Mar 2026 06:31:54 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-2b06c242a34so32076455ad.0 for ; Wed, 18 Mar 2026 23:31:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773901914; x=1774506714; 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=kAJqzBCPM9XvxL1KTbuVsiARatWG32n5yjogtDZktgJqGzNfBVx6HcsQSg/F9rdNas /xC6E/pydSuSXVoi1tgDv/1V6c9eFKagJp5jIdbRFmRJrrAzIZ7JtVrFAvETzzw26Jg+ plZbPmqzuMqsNac4gw/INLFJ2SoZDC4L2Ylh8KEYTbfFBXUoyD2qhSx/byM9UlQfqoat jVQ033YMAIhQtH6oKSlTBNAvS54q/R7wqqGbDP75ZkmOVsv0uinc6ySXjz1C/UK8Glln 01TedhWEyDpPVKZ8N4x+mXYbB75iTfWGAWYKAdOuUWJJ8FL/hJi7d8T7UIZifh2vml3e ml9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773901914; x=1774506714; 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=Vy+RfYuY9+6c/N40VPyERbYR2sos+n9RF8Z5i7yIO6HQbFQEkf9isvpohskWLJexQq 42LsjFjW1bfAWwa0AhgJR1TJyIZeexoDO9Kz8xYdGWVUhsr5fMz7FdqyVQ/5CAAsNy0g 7vd6k7Zvx0shQvMzm3mB/nFurwnmNhWuc8M9adkAfnq129agXmwHrefDgBbqNjsHAD6v VQtpRoJcCabfU1XkQzVbJunTHvFBsxSFY5z9RQ1zGxQDZ4BG9FdUm3fBUaZZ2H1Bsygh j84nKoTmWi8hDfgsS8KgZ7K8S2zH6QgZzq4v6HCu5jBYL7wwLC2qpCQeJ2qsq4G7hihF Y1JQ== X-Forwarded-Encrypted: i=1; AJvYcCVq0prxXxz7lMLtHhntr+3J0W+CUCBvFg9BHS/sR19x8QG3fUxxJSliiOUj4xJKx8ubY6UjGRG5EO/MLa0=@vger.kernel.org X-Gm-Message-State: AOJu0YyCBb+//PzzY+4SY3Og6kWkQjieZdiwEJ63tMmdSHIdh+i8Vbji cmPpdWigu3NdTMIEYRGj9AWvJV4Qwtts96tKBEh6MRbm/p2VZXOuOLowlIuDClSweNilFPjtXbj IqIuXL1SzfXZrOwFPRI5zoi39d00RnVYvMqEagIMVq9KBliaYQTzF0nbaeS4E5INdEZM= X-Gm-Gg: ATEYQzx5NmCyssM9YoQcqrrbT/ttqmZOLqDYpCvmu3LX/RHR7PdxIKJ42gUhZPIdvAx xxnAmY2Rl+I5BNF22EKMNmPqpbEMTsAn41U2skUeNLcZp80dm8zknn+pExipUPjICO8zfIXwE5M 2DJcgfHsw8LcsPbzmNwNjW9WUJbBpWJp4T+x41YXW+PnCtJFlOl4QTUxRy3qvmcGuYIO8hHCmgn g3wp17P8srbjT4MP0zR1vDgF2jGaVqhsVia3EP8rMSiQLG/Lq3ZEBkH3u2eZ0IDVN30aFViXExW rMavhOkasVrpeKqNUFrZpmw8/IYXBUhSXSZ4LZJe/aRUkqyLoBpOZv1xlCKT0maTfiYiWIyNuMu IMne+l1KEpbL4CBLWjQHIZS+QO7QOz/JfoWZ2EUc4Ya051OF7Mes= X-Received: by 2002:a17:903:2f0c:b0:2ae:c916:511 with SMTP id d9443c01a7336-2b06e3d35edmr64249535ad.24.1773901913166; Wed, 18 Mar 2026 23:31:53 -0700 (PDT) X-Received: by 2002:a17:903:2f0c:b0:2ae:c916:511 with SMTP id d9443c01a7336-2b06e3d35edmr64248315ad.24.1773901911162; Wed, 18 Mar 2026 23:31:51 -0700 (PDT) Received: from hu-batta-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b06e603937sm48572485ad.57.2026.03.18.23.31.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2026 23:31:50 -0700 (PDT) From: Kishore Batta Date: Thu, 19 Mar 2026 12:01:41 +0530 Subject: [PATCH v4 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: <20260319-sahara_protocol_new_v2-v4-1-47ad79308762@oss.qualcomm.com> References: <20260319-sahara_protocol_new_v2-v4-0-47ad79308762@oss.qualcomm.com> In-Reply-To: <20260319-sahara_protocol_new_v2-v4-0-47ad79308762@oss.qualcomm.com> To: Jonathan Corbet , Shuah Khan , Jeff Hugo , Carl Vanderlip , Oded Gabbay , Manivannan Sadhasivam , andersson@kernel.org Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, mhi@lists.linux.dev, Kishore Batta X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1773901902; l=70694; i=kishore.batta@oss.qualcomm.com; s=20260206; h=from:subject:message-id; bh=1D00kesAnJ6aiS/h94SYG7huQNLbnZVj76ipx20EKSA=; b=bks2BuKI8Wr7HMn7hfFRG6yQgVPjoR9lfx+npb9dTET3MSpiHCciPmWMOLFb4yKzn/FxDAy+8 wcgrV0OsAR7B/fp0+nkTVlySSY8XJ4NZctMCJEPwaJuRmsh9E1pB9M5 X-Developer-Key: i=kishore.batta@oss.qualcomm.com; a=ed25519; pk=vJo8RvTf+HZpRLK2oOIljmbn9l3zFkibCGh+blaqZCw= X-Authority-Analysis: v=2.4 cv=MMNtWcZl c=1 sm=1 tr=0 ts=69bb985a 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=YMgV9FUhrdKAYTUUvYB2:22 a=EUspDBNiAAAA:8 a=MMUwo3wwYuTaqRZ-dQsA:9 a=t_MdwZQk9VBQcGG5:21 a=QEXdDO2ut3YA:10 a=GvdueXVYPmCkWapjIL-Q:22 X-Proofpoint-ORIG-GUID: iLxfKAtXiyk4Qui6Vfmv1lm-WJJMBYgw X-Proofpoint-GUID: iLxfKAtXiyk4Qui6Vfmv1lm-WJJMBYgw X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzE5MDA0OSBTYWx0ZWRfX4mxWGIt5XcNk lMST+uFMaPEQ8RZfsMIwIk9nuXWr9uzFRrdfSsc85mBXP0D2/RKBDQ2dBf3P/UejBBgdTiB3tbf uMj8H+v1PV+ki+jWv7+SiCcqt5c4EI5NeUUc7l5d3vJVLdviODIq4RQ84pftQGHEWeNYcyOx6GQ oOu7GGr+eBljiQ8Uyb1FJ1oZk4wgptEugsoI9cwOHYby7GoHNM6j4fSSKoLFAppQu7prFbY8aTV IrncF/JY4IFoR3xczbeDxCWmXYsA5wBoF5ASxNh97P3LyL1mVuqB55hMJqyuD2ShQiYwkZSt7Zk ci/9Y1sY1Dr9/9zF4rH5oAujG7xc1W111powHTd9Frb27vfqRdek6GPV+v5HwvlMT36pxTzdhe1 P9kNbhWolHoilIMZt6/Yi1iWGmzEuBJcGcoOWwcIWAmTX9AU72FGUjRXIk9VouV2eYUPR9i3vXd l64G+TgO52NvLK5iuag== 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-19_01,2026-03-17_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 bulkscore=0 clxscore=1015 impostorscore=0 lowpriorityscore=0 malwarescore=0 adultscore=0 phishscore=0 priorityscore=1501 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001 definitions=main-2603190049 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 Mon Apr 6 15:00:37 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 4CE272882C5 for ; Thu, 19 Mar 2026 06:31:58 +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=1773901919; cv=none; b=gZoNUkZswCh4CAKTzEef6evsxORnPEwv9OCl6ypOfUSE3RU/BW10fc/Qcs1dLbvELJL3jRN7F1KIOFmy3GiMMjv572S3XFb+O6RIVG5SFo5KkbYp1BbIy7dYkAmSpkp7JlzrbKbZtJnbCiTGMDfrpjOCQ0haIfWmxfaZiRVp9O4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773901919; c=relaxed/simple; bh=9tH2JRuQd/Ntg0H7RVSyFLnl0a6EFmaIQsmT7afSET0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hes925xff/SNi8CzZpoZ3s40/sWwV5og0Zww8slV/Tdqc94yom8qAnhJF0JroKVW0HgHVOwiTxVJLxxYGWUjWv1+Y54h7N8Ay81dd1VrDsEVScjdSR9Sb0V1DP0mdp0Dfzo6Rwu9JtP3/g9CrMDwrHIHpgCgl6EHEwTmo0yIDJk= 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=HviWnwVj; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=HtWUErwn; 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="HviWnwVj"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="HtWUErwn" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62J5XdjV573870 for ; Thu, 19 Mar 2026 06:31:57 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=HviWnwVjN+4miLXg WEqDIq8wMzPV3HzvNEcYIQEWEcXP5qTrPUMtBHkTiyarFe5/aLdfzc/mMqFwxvtk bMEBJpsQHUVHhvolh1gag9WtmGVO9gduAbUOK29nMki8+foFatMZ33NH8TyuCWGD P0kJqMx8TtRcaNK+K9OPdudsaWoZao6RnFHNCTcYr9/A76tT3l3CW2fstOiyV+RX OS5o27d8owJNGzxbcI+rv2hFAFK++kqWUUU6uL+ov0petfJkH3tZlFae3PM7zV8q tMya79RbgwOquJ2UVgRVO8eHi1tPfE2l8fhIRlzr1adMnLzPsSvhCWiUpK9/oAH2 Fv0epw== 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 4d00ega2gg-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 19 Mar 2026 06:31:57 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-2b064f043adso5997075ad.0 for ; Wed, 18 Mar 2026 23:31:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773901916; x=1774506716; 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=HtWUErwnk5G4UF9ulT5dHNWkRjh5zOEA0mpLLsfHqy+zZckEUn4V/GT77XEI14i2Nt dgu4kV5rwrqBmg4CfBuBmyCQ8O284njxTwP2t3g8xMudvo/gviX3w/dEavjlOjCgy0sS zskiPxS3cAVBLgwAyVLckXpgq2ejke4qRro+tFm2pQMWp8/2pmtj0jOsYHklg2tDne1C GRwsj1vOkLuoqOZ+HpPZnlba9fjnBfic5vXz0jGcVUbj3a+Pb0wcTWKTziT5+oiXeBwC xoSb26ZP0KsDbkjBvTVoBgaZz1W8y1PJEMmCOx9qMJxru3QpWqmn2Kg6zpM3pifX8tmx XOCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773901916; x=1774506716; 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=qPVueX3ETndGsrQoAdpLvwlN5j6va0J8y2as6pI4c++irbyz386agDfUEQ8yFBuiWf ELcrsiqdphrAGuTBx8GPFJZOCxkNOHmJnmRIETvQ/0HfDNXUSB6PjYI1nLKoZD0bBNbT QuLwSDJ3pxg27+z+rJcRl/bXN1nxNCwvm0zWPTYoUHEDzRPNPsRIbKzrkbEQobFiMHNZ j7VnjFoMOta4A5I3OtyCtRriYS5/J8e5ed9OpgM6rTwkNt/cqzTHiC3nhS7W1UZ72Vdp ZVlCa30g+YEdWl1GWR47fH0qXyXbOM+TWfxIH0sGYUEfwYNIENE+sPJ9rViD98Jv67FS QDDg== X-Forwarded-Encrypted: i=1; AJvYcCUb07kBbzBgsNSmuRqeubGcTQuKRsm4tYBM8jKrtwwUA8W8TFqp2r2EdVwiapsXuiUy062sgoGnz+Cbyhc=@vger.kernel.org X-Gm-Message-State: AOJu0Yxg6eidjyG/fEMT5J9PQaVOvkbQdTk6B+iFmOIi2TG5srK/tc5c eSXUiIsxMxy39cBLRMCi1btUaXnQD2I2T8xF+/qpCMHbPTObivPBJ6+ECsrSpydmUH02dvNdYCC lMrIBhktoGNkPuSL1Q4BGIL8kccDkyQkOGq6rgPr/m/RZ6osB3K8ExnCAfigKkub2JC0= X-Gm-Gg: ATEYQzwUjBth7KF/UPsfZXOH8qUMGw270uJ0QrLQQt0sd+GKT9kl9Srw1TId6IYE7HR eEVupSt4RUzHfxKjka67H/dM1WLR6dthRMIa+tWOOf5WHYE4fGbR4lagkH4VyA2R5KV5ZbwmOId vh4yo/ZHtzgG9up+zR7O6pLAXW7LKtlXgChYKoXyrVWJR660yfpDxPRbhTA8LQ0NjXz1hCB/fPq LF6Za+Cx+FPiHd1BU7uxVRP6aFcDqRFEdwWFoaq8WnlwAbjwHA0imQBKZMKtZmz3CI8lmBObylA TpQP7msQqHS3MVzA0C4iqG8L5WCwZ6TDyfEnmQ8fR83yjT2mHId5lypKvB2/LG5bxMYF7qonsqT BXGp+tpmm6L6XgogV8z3Bb3RiCbdvsVSE2DrH6YQm857u7V9Uxa0= X-Received: by 2002:a17:903:1a67:b0:2b0:5a4c:726a with SMTP id d9443c01a7336-2b06e41afc9mr57930025ad.43.1773901916049; Wed, 18 Mar 2026 23:31:56 -0700 (PDT) X-Received: by 2002:a17:903:1a67:b0:2b0:5a4c:726a with SMTP id d9443c01a7336-2b06e41afc9mr57929645ad.43.1773901915508; Wed, 18 Mar 2026 23:31:55 -0700 (PDT) Received: from hu-batta-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b06e603937sm48572485ad.57.2026.03.18.23.31.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2026 23:31:55 -0700 (PDT) From: Kishore Batta Date: Thu, 19 Mar 2026 12:01:42 +0530 Subject: [PATCH v4 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: <20260319-sahara_protocol_new_v2-v4-2-47ad79308762@oss.qualcomm.com> References: <20260319-sahara_protocol_new_v2-v4-0-47ad79308762@oss.qualcomm.com> In-Reply-To: <20260319-sahara_protocol_new_v2-v4-0-47ad79308762@oss.qualcomm.com> To: Jonathan Corbet , Shuah Khan , Jeff Hugo , Carl Vanderlip , Oded Gabbay , Manivannan Sadhasivam , andersson@kernel.org Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, mhi@lists.linux.dev, Kishore Batta X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1773901902; l=7115; i=kishore.batta@oss.qualcomm.com; s=20260206; h=from:subject:message-id; bh=9tH2JRuQd/Ntg0H7RVSyFLnl0a6EFmaIQsmT7afSET0=; b=6q/DYzaxgzAsKW6ELr/JOhWo50oh5Rnj4wO+vwDmS0IpVLFCLr5domUKlxH8fnAs2r8vwr1Oo hF/k8fjzdMNAz1MY8ssF70N98PwgfPpONfm0KrK1Tx76sZYm612mscl X-Developer-Key: i=kishore.batta@oss.qualcomm.com; a=ed25519; pk=vJo8RvTf+HZpRLK2oOIljmbn9l3zFkibCGh+blaqZCw= X-Authority-Analysis: v=2.4 cv=MMNtWcZl c=1 sm=1 tr=0 ts=69bb985d 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=YMgV9FUhrdKAYTUUvYB2:22 a=EUspDBNiAAAA:8 a=YoiwXk0N_qN2JQiW-xcA:9 a=QEXdDO2ut3YA:10 a=GvdueXVYPmCkWapjIL-Q:22 X-Proofpoint-ORIG-GUID: k63Y6ekA8XdZGG_CADu_Na2iDWq9R7RR X-Proofpoint-GUID: k63Y6ekA8XdZGG_CADu_Na2iDWq9R7RR X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzE5MDA0OSBTYWx0ZWRfX2D0YPJjBksGT fLHt5GS3hjzXAb7buUJD2qbIQOhRfhYd9e/ethKXJty9Jzn3tvJHaNS2EGD0VJ0Oifyif1FYQmc o9+o2Ib4C4uv8vlObN3hbVx8bWtNUFIWoRCw7Om+l1/J3EVSAgVxxDVpzp+wBdHmeOD4QuY2WM1 5kzMFmmGp/74xPpdTFBTLkjg6NGxbVVmj75tHeuix0+XcjPcdabcnk08ly4bxmCQb7MCcM9qNeC L2WdiIPsPVj/ruMsm7DkVqhQpK2dAilqrW5ETibKQHfp1ia8MGnNw0fIUTz9nN3zBQWW2idRaYk VcrHNKQWS+JckrNxM+cVm4sNzK6XiqfxD1gSzuKJEPE8B0YlpfXBpcqfERK95iS1m582uuKHmty 1qmyOqX4Mff1JXvTfqGn/9zuDGaCrzzC80YwsVfRnwpUAAxVMle4lvHOwGGGaciH23lgNl70mQc KidBIFFMvLKZREouJnQ== 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-19_01,2026-03-17_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 bulkscore=0 clxscore=1015 impostorscore=0 lowpriorityscore=0 malwarescore=0 adultscore=0 phishscore=0 priorityscore=1501 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001 definitions=main-2603190049 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 Mon Apr 6 15:00:37 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 80A6634F487 for ; Thu, 19 Mar 2026 06:32:02 +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=1773901923; cv=none; b=sGKtLS8zOLO/ZgfiDFs0H4n+wmaFERdfdzJv64ZYjFIHurWL+xhL4790KH7WcAeLAIOeZ6SlnwFDL3/vEdMDQAXj4Qym2JeFkelDZzrbEGxZyBsLu+Jc7LxAGKLB0oM55oGuLFLjIyXXzXxftlfjZWmfbv2IoMNi2NIIlzj04c8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773901923; c=relaxed/simple; bh=IdXz01mR4Rs8f0RYsO8zVitGxgHIzvaHiQFtik+wHJE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Oxg+yf89Mk7mCtFlLsDzhEDw2WxPpmX6HNUeQVtrQPEgFZAfxVBUTFpG+ZmcdXFJ+9Baqn2rITT67YNuLxyJO46KWPVyEWS4qy1KGdXe4QV6FqUNdxhBM99/OplGdU0UPtFfj1lCxVYflLuhya3ezplTodhpLACw1pSWjaI6mQM= 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=fkZp3sUq; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=GG9n/3Hb; 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="fkZp3sUq"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="GG9n/3Hb" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62J5XsXC1802716 for ; Thu, 19 Mar 2026 06:32:01 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=fkZp3sUqKr59AwKU 3uQq48p13b4vR6gBonGwvBmVjwn5n/YYbgRKQGX/vBwXiktFUhq81HbCwNCW7GQx AdJs03ZGTM2ggM9Ddue2sEYze0QrekcBpIPDuNn7Ltkon6+8QlbiKXCY6n1yinIk 7Q/ecDZD66cnqUXbXDBqF2m83V4D9ky0+88t9zU4Zx66m1bl/YWl7wQMlgRyhDjA FrnWi+RtiXSskMjCJU8GZbxZRXIz/m/QouIEaYH4gHB2p7aIax9sfstropJL1srf i3/C0sB0dbhVo+s6P9F0xG9R3rMmVg6qeZgTKbfAyH6a10Tm31j/HtI990NGnQy4 +/BQNw== 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 4cyscb3w44-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 19 Mar 2026 06:32:01 +0000 (GMT) Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-2b069bfa817so10005575ad.3 for ; Wed, 18 Mar 2026 23:32:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773901920; x=1774506720; 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=GG9n/3HbU+/9x0AEEUlPb/GyN94eeDjCOwtsToX1UML203CBde4VwyEwIqljF9veIT dUjUkqcoKHAeCNfTJUrfjaEDq3BmTsraWJw3gd4OmrRVPjO1dtDhyNzj+rIQLvg2Y4T3 VfJWdP7ZgDDTFtpZrPTBIX1kIaQ586UYep1OPtOw7NxVu4Ylrv6iPJr7KuD3CPLIoERs apLFUcX9uf0rmQkMbHzsswWTDNG6pugiL6QJU73OVD0W52kuJaVxCh4SFEbkyyUyPUVV 0W5T8tkP617NdA6vwun4vNEQLNa/QdgXXQsoto/kh9Jrju0bS4O+6LmllBecf3aTGcGr vP0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773901920; x=1774506720; 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=DgYmbYuRof7Le4G335KzFD198fmyNWVBaWLLsATtlAU02ktHs1RTY0ngAaywzO8SMy vm7khSe4r0zaFsZJQtpvwdG2gBuqLgOLSUb66FzcQV1kaRKcilI5v+Cj3HeHlO41ZG1Z G6VifJ4AoL20S7II2Y60HQvWvQN07AoEhaBH9YNGkQVJoKz9kwwgvJ2+EBLFAjbjyOPH 4Q8xW8Ezu6e1I6RUlR+OmO1ZFvarfRxo8ezPShYT6zeks+KmTOIxCFaobC3ewa4ipsNC jGSPmHlkXqlbRhUkyTn8s7Hdpkj82vDe7jip78jHwuR/fDYgHCaTXc4TlOus//3PwYdS 1CeA== X-Forwarded-Encrypted: i=1; AJvYcCVa9umd1he7g+2z3UkgzTDWSOM+Yn5F2kmFvDofjpd473K0Fugpp+n1HoXh7/izaMNp91E9q9Qvsa1bvfY=@vger.kernel.org X-Gm-Message-State: AOJu0YwsWvoDpL8pZ8znVlTdVd0mH2CyEXKZ1b9XLSEb7EzpeF9rM72L OIDAoXMWz/Yq5uhyzb4VUjX6Yi0fkKHdB2u+gMzSNl6LDkPgkktaldlJCzSac3tFLM0lIrUiEdU us8bqQoQaWYFG/JXxgmu0BbDQnjLA4Fiu7dhUzNlP4c9BLimX9bOryRx9PQ6YS3Y+ZPs= X-Gm-Gg: ATEYQzxTWLHeQeWwtz2VmDH5kGG/GvuTLf+wcFL7im3ENCWKjBFWY74HWUQxhpQ0syb OnuF7g8ne301Lhjd9ufGKaeJn0Gy01363vyH7MzL5lqwXZa8ruXy9PI9tBl3ybL3Bg3brIHOp2u wIKjBeYpsg4lIglA2dpupEori+OF4n43hg5yXGUACEQQbmvtGHqUBg7l+7jNEsrW0q15XCFteUd DxVPC3EmxSWN2eUZm/JgMyHXhpZiLVR47f1KyXJuJFhwtu5CTGI9Qz2qgqkFxDg3fM09icqQUyt suVHT8d1QPjbfVEbcyZ6aQCy2EprPqaro+Ji74H/rvFXTqmgyOogOHBYKNXw3ZOu+5vp7YA3V8z FeQpZaooOiV9Yo0glSAj1Ye5r+LIXpjER3Hy+h6z4waumnjqzgAQ= X-Received: by 2002:a17:903:3810:b0:2ae:a429:fc42 with SMTP id d9443c01a7336-2b06e400620mr66595325ad.40.1773901920343; Wed, 18 Mar 2026 23:32:00 -0700 (PDT) X-Received: by 2002:a17:903:3810:b0:2ae:a429:fc42 with SMTP id d9443c01a7336-2b06e400620mr66594985ad.40.1773901919866; Wed, 18 Mar 2026 23:31:59 -0700 (PDT) Received: from hu-batta-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b06e603937sm48572485ad.57.2026.03.18.23.31.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2026 23:31:59 -0700 (PDT) From: Kishore Batta Date: Thu, 19 Mar 2026 12:01:43 +0530 Subject: [PATCH v4 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: <20260319-sahara_protocol_new_v2-v4-3-47ad79308762@oss.qualcomm.com> References: <20260319-sahara_protocol_new_v2-v4-0-47ad79308762@oss.qualcomm.com> In-Reply-To: <20260319-sahara_protocol_new_v2-v4-0-47ad79308762@oss.qualcomm.com> To: Jonathan Corbet , Shuah Khan , Jeff Hugo , Carl Vanderlip , Oded Gabbay , Manivannan Sadhasivam , andersson@kernel.org Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, mhi@lists.linux.dev, Kishore Batta X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1773901902; l=1219; i=kishore.batta@oss.qualcomm.com; s=20260206; h=from:subject:message-id; bh=IdXz01mR4Rs8f0RYsO8zVitGxgHIzvaHiQFtik+wHJE=; b=e9fMzcaKKjCxCsbrxlVdE5UJdojNscTn2zbL9SlQlbqh9xy1a1pnb+eD2q55B5TwUBYiq1GVm 7P07BMMwHXWBaY4PRv2kbaKxxJwiZycQYlSC1IZL7WAdxVcWpfcgiJ/ X-Developer-Key: i=kishore.batta@oss.qualcomm.com; a=ed25519; pk=vJo8RvTf+HZpRLK2oOIljmbn9l3zFkibCGh+blaqZCw= X-Proofpoint-ORIG-GUID: ymLGV6P7flC_j77LHF-jZJUCB-VPklii X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzE5MDA0OSBTYWx0ZWRfXyUlDqlZOsoBM hGLplRFe4I0GOe7dawtFD7y7BOVFXp9PQDZO0QugwLIhPx5yfyTqw3AE1Bq0zYNkJwK4W3+wCGn d9tLC2cCkifpcgVbDRUq/OIZ4kUv/+oaG/6b/A+UUoDfkS0JINR7NORyYY8MAHWoH0zuFGlz3VP kWGOt/MsnJqhTQdSXX/Zb074OOJYCtmajW/qFZAwUL3Sc7JrNZXXao58FoxU5BUr4XjNLcPDguC t7l9lXwEupXSmJSopAPD9kCBofu2UjbZxjUjU+S71eEPEiA2CUcJUVQlVMmI3VZIiBx2ECjYwc5 Qhb0z8BbUDMSzQ7QOk0X/rAVz4g9PqAvcaPwUB1KKocRhcJp8n6hOF3+KJ9Vaf3QRUZU71gXeM3 jmIBMe8k04T9olgMf0CVNEQj7oX9yf2C4V72T6dom23y9jtSf8BrKEBty5/3/D0vwVuF7YdgM/a +RMyPWGIEOq4Jl7gP1Q== X-Proofpoint-GUID: ymLGV6P7flC_j77LHF-jZJUCB-VPklii X-Authority-Analysis: v=2.4 cv=PtCergM3 c=1 sm=1 tr=0 ts=69bb9861 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=3WHJM1ZQz_JShphwDgj5:22 a=EUspDBNiAAAA:8 a=O3MGeqbvIhhX5qxHWLUA:9 a=QEXdDO2ut3YA:10 a=uG9DUKGECoFWVXl0Dc02: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-19_01,2026-03-17_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 clxscore=1015 priorityscore=1501 bulkscore=0 lowpriorityscore=0 malwarescore=0 spamscore=0 adultscore=0 suspectscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001 definitions=main-2603190049 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 Mon Apr 6 15:00:37 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 9C2C53451CF for ; Thu, 19 Mar 2026 06:32:06 +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=1773901928; cv=none; b=sJFr2QT0vWl3MH9MspAh833UpsIoOGkJ2+CY5iyEVTD9/n2/+5NRDVXc5mvZS4vd/kjQ/g7KzS8T2BOJItaPKwGj/1pO6mxpCuqmbH5xo9dGSw9Tjb/513+hWHGe5jWWj1xioMP2AgGxGiGRrxpxZvVud4IcT0KkAbfej5o/Q48= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773901928; c=relaxed/simple; bh=D9kJlDoQ6LGAQMXZQh6rystru1KGUPI8NHA/TRw7+VQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Y4hYyFnVkdnToqaYc93F4IKLCG71eJLOUS1Fbswl9qMvCvjTe1ZZn5TmdXMIzj5Bm03+VNp6BfpF8uc4PWGeBte/L9PuJoAcrFwf6NqNdvRj/oHMXlLdfyK8lm7h380XDa3PwmCHdihQiFBfrbFtK0y516uR6WUphVVy1RiHfis= 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=Whn166aW; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=cq2Hg05M; 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="Whn166aW"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="cq2Hg05M" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62J5Xb4I1702019 for ; Thu, 19 Mar 2026 06:32:06 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=Whn166aWF+XL6yG7 FGBOscb6eQy7j9Si80EhSoVjfzaM0FEkgX2cWAxkFlVNumEzhyPzOM9CmzWdG1qA MZQQI3LX3k7bg9IChdDCQsLasLxF2SAcluNgscqujtiG4IxilP9rK0D11/49d8DL ty21gWcNCSyy+9ULXhqcCZKLtXUj22qbjv+ag9nO1PJOjF/notp8RB1I6Jr9FqO6 cvRjn7Ex3O4eiegBLvHEkL4HhMZ6bxxYMIuZi6XeL7dvhczmWEwLGX5SWZHZw/Px uthjzhpknujr7XrPFNiCdVRPrBSlIMs7ySDYLOtD2q3kpdEYSwPE2dzw+XFhxCGR DvBxRw== 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 4cyyhgabk8-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 19 Mar 2026 06:32:05 +0000 (GMT) Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-2b0601ff3d9so8407085ad.2 for ; Wed, 18 Mar 2026 23:32:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773901925; x=1774506725; 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=cq2Hg05MKPH9MpCEJLuNPezx+7qHAsqd1LVTSgwTuUFYz9YPDoHze5GBC5GTomOjei uW56tuD7iGxmISqz1Mb6bYHoUoOSUVAGfaQIAGwRrwTmCG0oPy2f7DQJ5Y8URvwb4KYU kpXDVvpWxc7aLGjgD6CZIQgL+dsWnWvyTZ0u3HZFE6OgpKHQHKf5ddo8aUYKSnVPM5IS Z/ubzcChZh3mubPerruWWbgXR/y1gF+7tnRImdi0T2OwsoGrk4sWjOOk0p4oEh2xupZC c2BTt5RIl9aBS8vpdFhanLd6mjX/FhKViIWkNcAPh8IfSb3z4iicgarXkPPh9sQOeAJK r06Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773901925; x=1774506725; 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=E9p7JV26KPzSdZzT2ltB5shbc36MX0YZGGYr4UozBuEIpTI1YpC7HtlhEN8LFCf7qf I1cOu6eX1HRcPtYETBepxtzGFrIAGzEdmX1XgsXCEhiRMN33BxEeDsFC9pEBPRJz9Xdg 0Lup91ZE12gxr2raBE9h4cEm2+UrXzJFyZGRpuZ4qjUqb7Bm4vKr4+f6zhECXDIhRslg xiPH4wWAgLiGI1A6MT1FMNi7aSyE+9ZwmnsHnDBEUIl/fyl29ZpJ5KdYspy5YjOq7nB7 cBwPpGn9sbJEWQ210mPrdiQBHFAe9OTdbAgfMx4WgR6K6VZC1vA/48H3R4SkDmjjbGSx uCsw== X-Forwarded-Encrypted: i=1; AJvYcCW7M4OSlxe+6gZnTbWNZdDHL2wThSZoFcIAW3+onyWJnFszHqX7TnmfpwAQ2EB61dnxUW1Zn+s5+w413yw=@vger.kernel.org X-Gm-Message-State: AOJu0Yx77a2AtJdIDty0LzekGqLps3xBwg2XedlkEbb77cIWrQMu90L9 4fCA6vBYnXLyvee+IXVvkKcU8Jo/SKI2G7zT9BGLRbguIcLpL9l6GKP6bOy+QYGUiQZVD6Jv+ZE Cz1iTxkKIaI2H13/pVQBqYn7Yv7aghVnA5s04EvmJaHPkMxWLQS6hIlS07hFcRjz53jM= X-Gm-Gg: ATEYQzxs6tge8rEs4mf367VMShWvj+SJBfU1++oDvcqTT7F0iYh6E3F0SFQ0ag7lI0F weWnTFgVS87RzNSDhI4RJ9VaEKw166qLbnCmuLtcr9lI/zxzr9JLFAgZ3k8JsKvx1GY5eFK0AkN CWhHu/4EUHyjlRPgYUfo13VUw6auV+k8xhESI+tcmEuSVbdZjbf+zNBT2uYqDZD+Uk1kh9sbhmb i4qOrD2JZrR6dQmA7+TKrIMpVrVYqhrFM4Dse7TkicHM2LHYh6YG7cygtPMg9TuJiiu29cDtGWQ NHWN7yZKpC92wrKpetQxdfy/4Aq3wUkm7DonwAzLZ2Bp4HOVfGDOnjhfnwSW5Z/4dvvczntQX1M eZ2uP33KyVEhP20SI6S1e9ta+kf0MxlBYmvAwCIy3Ixb/192Vp+E= X-Received: by 2002:a17:902:f547:b0:2b0:7177:d5e5 with SMTP id d9443c01a7336-2b07177dc04mr45425285ad.43.1773901924746; Wed, 18 Mar 2026 23:32:04 -0700 (PDT) X-Received: by 2002:a17:902:f547:b0:2b0:7177:d5e5 with SMTP id d9443c01a7336-2b07177dc04mr45425075ad.43.1773901924217; Wed, 18 Mar 2026 23:32:04 -0700 (PDT) Received: from hu-batta-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b06e603937sm48572485ad.57.2026.03.18.23.32.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2026 23:32:03 -0700 (PDT) From: Kishore Batta Date: Thu, 19 Mar 2026 12:01:44 +0530 Subject: [PATCH v4 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: <20260319-sahara_protocol_new_v2-v4-4-47ad79308762@oss.qualcomm.com> References: <20260319-sahara_protocol_new_v2-v4-0-47ad79308762@oss.qualcomm.com> In-Reply-To: <20260319-sahara_protocol_new_v2-v4-0-47ad79308762@oss.qualcomm.com> To: Jonathan Corbet , Shuah Khan , Jeff Hugo , Carl Vanderlip , Oded Gabbay , Manivannan Sadhasivam , andersson@kernel.org Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, mhi@lists.linux.dev, Kishore Batta X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1773901902; l=3898; i=kishore.batta@oss.qualcomm.com; s=20260206; h=from:subject:message-id; bh=D9kJlDoQ6LGAQMXZQh6rystru1KGUPI8NHA/TRw7+VQ=; b=vr6s4lpUaWr2T9TkXlD+KdE+YQxiqHW3dkYcMsoUITH9JLmrkM1V1VinIAHZ1bzHa8OPBMlFX aLXDFnx7Qz7DIK4WvzLkJn0afD+UwqZPiaiR3bpdRalFoHWK91wWibP X-Developer-Key: i=kishore.batta@oss.qualcomm.com; a=ed25519; pk=vJo8RvTf+HZpRLK2oOIljmbn9l3zFkibCGh+blaqZCw= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzE5MDA0OSBTYWx0ZWRfX54K/cFamFWkE wR0MS7M5Ea07RcYt+okKyY0S56uh4KQDCL4L1sn63c0RBJynFFfEtbBYsbpMzxU0b4buemV16vd O7X+5eyC1n2WiH+GPvvKD1QIwCAR17e1HbubqrKpvDhpWriiG/sQKllr30VoCMBnuAryRmoguZ/ CPgtTaH6rXDMvGRGPO0Vw4WG4IxE00URjuXPDV7S1BZZhUqGVetVGOmhoAS1C0AELJ2J8IkGnAE BIKj8/DuRVPuUqLB2xBcbjNwidealMZ7K0qvjFwcllWnZa6DmqJLNHsg2WxSfRCGmFh+qC1hQ2t rLlQSmCBRJuJkBW4uu0oN8yRO+kMlZL93i9CbVsuCX3XVtChL1s7flQ+Vz4uNI2TKbNCeDTVrag joaQXnrvsTDUEU4NKZG5B8oHr2DiwzcCEK/GEqSO8GOEuf1qafE16wadvSyc3OchLi4pcxYM2Sa HKuDNJQT28EpDV7DVEA== X-Proofpoint-ORIG-GUID: 3GoDkODMMZcVn10F0JAf4pknWaTIhkIV X-Authority-Analysis: v=2.4 cv=IbSKmGqa c=1 sm=1 tr=0 ts=69bb9865 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=yOCtJkima9RkubShWh1s:22 a=EUspDBNiAAAA:8 a=hNMuCp7LqqrRSepR2eAA:9 a=0bXxn9q0MV6snEgNplNhOjQmxlI=:19 a=QEXdDO2ut3YA:10 a=324X-CrmTo6CU4MGRt3R:22 X-Proofpoint-GUID: 3GoDkODMMZcVn10F0JAf4pknWaTIhkIV 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-19_01,2026-03-17_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 suspectscore=0 lowpriorityscore=0 spamscore=0 impostorscore=0 clxscore=1015 adultscore=0 malwarescore=0 phishscore=0 priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001 definitions=main-2603190049 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 Mon Apr 6 15:00:37 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 6107632FA30 for ; Thu, 19 Mar 2026 06:32:10 +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=1773901931; cv=none; b=AZExiQjl9zbi+DnOF3uBdtpsTT9NC89cpgzJbDhq7iHJ3J7aZj+M54H2poF8xTahMaBeaQkCWuMm3FsbjCtT5cb/rBtpImcngAmOjyeckTB7YJkA7l1TpbsxehuqEIv/MAou8mGYkFcaltL9THSooaRxbkputP3VErTie8lGE3s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773901931; c=relaxed/simple; bh=9iJZxHKj6ceRf6SQQXFuF0UcjhRsGt64qimhRUDtN+M=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=nXHZpKvXmhMPedUy6Lf03znGztBfBVv23Zt3eT+xIVZXo4RE3vhxrxw4yHN7stJbBG9dAtHGn1hfEE8Zn533oQr+0X6M+zWCKyECJHPtPKIlD+Q4ShyS7OZYXmCoyTEgFcvY09/hEQEByeouAtTCc5oYIsNYXKkL4FPZ6Ce7Nd4= 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=GiVy1Vmx; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=kPHl5Woc; 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="GiVy1Vmx"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="kPHl5Woc" 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 62J5XJOu3573649 for ; Thu, 19 Mar 2026 06:32:10 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=GiVy1VmxXUBWGMVw rhBiReMM+VZlAF5Etd/nwMhrISpyo4tFZD26N2zTt4WQltNJOYewDgkfCQyjYiF7 Dj6yC/Z6vNnG7c19WCxdYeb0ydErGZgWfT7gFZ49NrGIi/+BhF8RB9yljIzMmgl5 8Hg0N/mUpIY85mlUM1/bjndxLwsHDEflDIELwmqB9eKSpzazjuyQ2GN+f9nflL2l XCxP+xzxwZfwPd5SBI6SwlEQCS+w1atfye01pJpCe1xwmkTh2DCaU7QxmjIR/Shk DA/VwLsZiEWBOk9gyN1UySyCxS+JK3zEzFCn5P+TZSPpCc3qPAtKuVr/lpik7Bqp QYM9Pw== 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 4d083r8ne6-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 19 Mar 2026 06:32:09 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-2ae3badc00dso6694335ad.3 for ; Wed, 18 Mar 2026 23:32:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773901929; x=1774506729; 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=kPHl5Woc89wBPJkmFT8SFtWZhiF3pRMTFGypEfSjqyJQ6Mmqay3gX9FBpwM9rsqN4v Yop+vPbhc/jf9ELo4gaa0Jj8yz45gGfSfy7NLjGNbCPpR64YZHR7lQeXamxJrXiO7O+C pUdHezF61bDGzudkYaml30eu4+ugEOLlBBe4NKTb0rkje9r0uXcNm8bu9C5nmzSY1HyC 5um47qFJZzCowOe2vrgc0h6eLlua/Z87JF4IzKXBZKe9y2N1bSou6SbOKGOmHYM/Sgen Z8YyTMO29S5DjwJpJjdDWNogQUpxtv2F/TC+R7HiC1hWH6ZWpaOAy3VbE2zt6GmWYOeS WtMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773901929; x=1774506729; 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=swKl4tALAmpk3++VG8ctmGVn3uPDOfC8vv7IvSWB2ANad0Wb8OZwBsm5tSXo3fTbM/ FuQ+tnyR/Iv2yQQLEij9s42tStuDjNtAD2ZiBtbDsLfSG1etn7b3ZG9Izp69/QzACMjb j6UtMDhyG3W/naY/GeX8lxVMg/ID5z0u1ss/unDD35GcPc6Gg+JASeDJN+Q+3WMCazsF +Ueu2uK6PO/ZiEIXrkozlr3H0esEIwlZMnMRrhMojvFI8VwOsIcwgN+ogSZXJ4fBeJ3x Rfh/B+la0Y3eWAfdkmBm76OZFE+HsQOGiRaBZCZlErdeDh3sfg0oxEy2/bIvuhVwalvw Z+9A== X-Forwarded-Encrypted: i=1; AJvYcCVMpRuU6rYhmBHI7dHixPkdgN+GLvfbRR086UwBqTM6ElsSpZfbptyy/De6/dDXjEkA7WDTSa37uaigHBk=@vger.kernel.org X-Gm-Message-State: AOJu0YywE+YzL6sV9OBNbDQc1k9UXg8pdU9dj9hX3EuHtHDmmO/1bEIg QtM7LJAjEJJ0koIhWEBlIYE2ALGQqmGIah2rPLP+fpvg5QvfpjEpui3XE2hhJU/HbgMCVnVZPuq PWpRrE7K9w8VN0+ly9jshVLOsx29GUK8eddHrCrPZgMuQNIIZohc0aUYYfRFnYcu6pes= X-Gm-Gg: ATEYQzzh8/lqwUOCkAF5sjCNdPHiVpqRvSlK44nZlXoYgMm0DJ7On7XpJuriRtzlUOD RtGMeC/zlJk/cjh+D5SUB/oaVt4KR6Hm+PEpxjADudI1F4JvH53C0JF3doK8Eg2K+oz63YL6YtA CWkazCRMNQbxo6uIWYRJzEr9XfnMvviIfSmJ51bPECu7e9ldAhiRkRw6Hb7an84GUv9hb8SFycR ckbvh8GSSR1f0jBOYOIEMc7ogv3RHd+7J+d0X2PbfQemp2vHcW0U1/UbnYVoiTrzqT3bFS5zuOG dIy6HIyyFMJ3jHRGYb3s7/+77fa6gDv4PVFljAOAbwt0+X70/6WXwfgsWuwt0vWYNpnL42yrIIN /3J+Xqq+GnE9RQbDathkPf00EtWUYM8K3REQpM5TA8MSkbmL4er8= X-Received: by 2002:a17:902:f705:b0:2b0:5d60:7f3f with SMTP id d9443c01a7336-2b06e35b4demr63812545ad.16.1773901929103; Wed, 18 Mar 2026 23:32:09 -0700 (PDT) X-Received: by 2002:a17:902:f705:b0:2b0:5d60:7f3f with SMTP id d9443c01a7336-2b06e35b4demr63812295ad.16.1773901928598; Wed, 18 Mar 2026 23:32:08 -0700 (PDT) Received: from hu-batta-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b06e603937sm48572485ad.57.2026.03.18.23.32.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2026 23:32:08 -0700 (PDT) From: Kishore Batta Date: Thu, 19 Mar 2026 12:01:45 +0530 Subject: [PATCH v4 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: <20260319-sahara_protocol_new_v2-v4-5-47ad79308762@oss.qualcomm.com> References: <20260319-sahara_protocol_new_v2-v4-0-47ad79308762@oss.qualcomm.com> In-Reply-To: <20260319-sahara_protocol_new_v2-v4-0-47ad79308762@oss.qualcomm.com> To: Jonathan Corbet , Shuah Khan , Jeff Hugo , Carl Vanderlip , Oded Gabbay , Manivannan Sadhasivam , andersson@kernel.org Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, mhi@lists.linux.dev, Kishore Batta X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1773901902; l=5038; i=kishore.batta@oss.qualcomm.com; s=20260206; h=from:subject:message-id; bh=9iJZxHKj6ceRf6SQQXFuF0UcjhRsGt64qimhRUDtN+M=; b=/wsjS4Mb50XnI6cIGT6SBvW/dCirIKCjrFdPrSRkNy9DwEoc48RM2a7D6ERQqxMoFRMNyY6GT nS7kxdbRRAfB1mI2EAuRyKzKX0ZxgWz0uvulhmpiwIc51noTnTYm9+I X-Developer-Key: i=kishore.batta@oss.qualcomm.com; a=ed25519; pk=vJo8RvTf+HZpRLK2oOIljmbn9l3zFkibCGh+blaqZCw= X-Proofpoint-GUID: A7XanqOEMNVpNvFVUwIWhyRAxMtEXLew X-Proofpoint-ORIG-GUID: A7XanqOEMNVpNvFVUwIWhyRAxMtEXLew X-Authority-Analysis: v=2.4 cv=ApTjHe9P c=1 sm=1 tr=0 ts=69bb9869 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=g53SEPjKJ_zQRiRrflAA:9 a=0bXxn9q0MV6snEgNplNhOjQmxlI=:19 a=QEXdDO2ut3YA:10 a=1OuFwYUASf3TG4hYMiVC:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzE5MDA0OSBTYWx0ZWRfXzEhRTGidFyTO kmhapnOP888FpehO70uarB4QZ2dxhDH2hsr4/gWItZXbPwzLAnqHwqW9HeflH8rbWNWAJ4Rbyis kmUNDiKa7DpbiW35mxNeaKN+UrL4/p2w4MRlSMfB7eANT9DvYW5A6SPqZWCucnFnJvxCmj5/Nrb Mpj/6fUrUYMC/rQj7IrucudiPcJKFR7h/TUqrBf4w1RoenbL5afLRzYSYRbYVtvzC2u+ueqSkOL lAbYwX5XIWdOTy7f2sx5UQ8qjhJhbTKj751XOsaeSzfe3AQB8KnaPHjrJuRooihtWySnQfb6dJu b01QgZ4+0qkkPy4mCe3GwHGiySR24HD2X0afVSP/nS+mDgAuqN6hsSfj4YhFT/PiKwlxYMTPASe L9FwXDGf3HmU8DJ7tRl3IkUTeBmJN80VbvF6rPvXzZAnsPTo8r2bnFsg+rseiHwLwWJ1LqmR5Ko CUxV9uZGga4oDJXk+pg== 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-19_01,2026-03-17_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 lowpriorityscore=0 adultscore=0 malwarescore=0 suspectscore=0 clxscore=1015 impostorscore=0 priorityscore=1501 spamscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001 definitions=main-2603190049 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 Mon Apr 6 15:00:37 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 592F732ED54 for ; Thu, 19 Mar 2026 06:32:15 +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=1773901936; cv=none; b=XBRDakbCWuqPbIY5trL927km+5Mynvcreg7cuL1C0FiYaenp6BZsvPqI+S6lMSt0GKCOsWTNDMGJ4r039nqZfR2Alp7BZ0yMP4PbmOivwiCSkn5Gn0DIF890MNbe6/XngutIvT44xvm/ZdvPHnopjWl02iiB/OBgItqirkgIEl0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773901936; c=relaxed/simple; bh=Ap7TaXFPFmY7vxQioEQxXOj5gqr4VqCldx5s0gGK/Jw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oQoWBFtGnV719cuapl5V/AHCa7xzc8MJj7F+QeGqrzdDL9ePXaQxDk8YGeM0V+pcErpwFKu4vEjZNcRk//jx7sano0aM4QXrds/lHQVMxtduk/iaw8W3CotWouoS7N2D4109yz+Np4UG4Ne76boFTQ2FJiyDmIpWmMZhvO0E6Ww= 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=d92Vgpa8; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=Od/2QhmS; 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="d92Vgpa8"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Od/2QhmS" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62J5Xkhd3172495 for ; Thu, 19 Mar 2026 06:32:14 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=d92Vgpa8NFRAuX3N +nVgU9lUwaxEKaSZTk8Ip21p7jgIRnlFt2pj+YV/dKyykHtdo44AtPfZlX56lW9U 5lqSlEvCYqHloW2Ap+4rvIyGCCm4+zPBWNAFrIyXgCj4MjGZWQ3jLz7Oe8fe/hjw EOrAsa1/+1KdJMcPREs7jpW1vHobAUthvsLKwEXYFmpUQ4KIimafgaAIrf1YBace lNtth1WqAR20221Qv+DLLHhXVepNYmI+4Bj6cLOkGvzubuLWem/ITj4o0L8nEQmb WsvY4/cf1rNx7Uwr7i4AkUoR+knYHPM4/HiXyRTFjle8QrzyMnTyB6VHL3YcqSrU 8AHjQw== 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 4d00f9j1us-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 19 Mar 2026 06:32:14 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-2b061bf1a2dso5159965ad.1 for ; Wed, 18 Mar 2026 23:32:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773901933; x=1774506733; 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=Od/2QhmSkwe1x9bzDKAtJGAWo4w3hZtB7/PgPlTxW8sIvH9CUTveuJnWT5g2PDVXj3 ReK2aqvreUNEpb0Krw2rR3tbGyWke350lXRQUh6N9gT2mmJ0c8uzyzmY/xgxb5haFAUL oBHbKE333hB/cnhlOUV8pDiyPfZBDDv93MSkoTPnLI/V3z5ySBPfZzkc5vcryWdSH4RM 3aiqeQj2IYa0SBf5DUHy9ytEgk0W0H7d+jAYfOtY/UJwSKek2vUqP4XC+aqll136IYE2 XpH+fCjE2xQYRhXCeFxgmentl2bAQa87kltLB+rtjC+rIan92BeExLK/31JMwOlqOEMf wViQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773901933; x=1774506733; 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=JRKNYrU7qTaDp0j/5PpybRe5IUL/ChhJ6KZRcmtzGtmf7qzD1WEL50UJoh83B5Iyjb nXDFxH2g4/cpHzVovELaIoOn4+jIThtXg/6PXLiEexp02zWgz8O7qpcp73KbOTbAwkRR TkqqryC1LaFNofIcr46CCPmU6rip3eMo/9iAdLOEaozsvFvIqNv+c2laXeWHmhRBw4+y hY+q1Kzw4nJLohHQCsnW4pLAFD33ERHc1Fm0wYM1DVfp1F+IDT87tsmmVm9WeOyPaPIO 0M8Nm04tOHh5Yyf6deHMeEaMiuAKHWpQXbKst6wBEyLQigzNXKzQY1hEST1NtxJU7jUp lSjQ== X-Forwarded-Encrypted: i=1; AJvYcCX9JnGIM7k6melJkpsupVSvR+vLGnlhdk3QvyeGsC2Mdq9pUmR9rGbObP6xZA+0CoarUabHTYZxDSXsjWQ=@vger.kernel.org X-Gm-Message-State: AOJu0YwLW2cm+FOkHV/Q6q+jSXq2ihZmc/7Zm0THm1a8AHStAF1g6OS9 XIVMv/LxPplC/U3DslChLY+h1qKvz5sYWA5btTZxeg65vF3xV+Ap6d+BfpOxIbmS2mTIvPlnJ7o G6iy0MVZ0oaOaNR9CQOmAQLKvWQ5wye960S3f/jxH9V5xhllT52TC1ivvdmHNBcs5vYM= X-Gm-Gg: ATEYQzxMJC8FkSJwqv5V2sa6Xyrq2irlcko56VnX+2/sBxOLJuBxjw4ROQaAEm+Ux1L F9LKiez8uB2T8eBdthyxBnDYrkr0mI7k3tEw7UlzgulCcf4+ocIHtzedJ9SggznGv4UzAjUcpEA 3Ro4THWc5iMZV6cfTgx2wjlFTWau940WtbUGeyFjBPviD2KOa1HXVaJhcGGUuyUkFYW5AqgsWYc oUBaZ8LbtwD22GZRsB7TcBbC/tk1SbQgycsXd8kDMtsJirS3PCvngbdZYpBHvtjRMV5urmSyMf5 /wCIElJ5L74PXKtnusTl4N42FUpFmuqpVL3sxNdVuv/9/Y2VZNZu1LCRuLK/f83HbhyL5gj/CIa N1+rba5Dfa1i4WM6soM8Qd2nOj1nr8hRhiR3KYpf5R0mI4PZOcXA= X-Received: by 2002:a17:903:1a67:b0:2b0:48ca:a641 with SMTP id d9443c01a7336-2b06e3c3abdmr57658525ad.25.1773901933445; Wed, 18 Mar 2026 23:32:13 -0700 (PDT) X-Received: by 2002:a17:903:1a67:b0:2b0:48ca:a641 with SMTP id d9443c01a7336-2b06e3c3abdmr57658205ad.25.1773901932969; Wed, 18 Mar 2026 23:32:12 -0700 (PDT) Received: from hu-batta-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b06e603937sm48572485ad.57.2026.03.18.23.32.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2026 23:32:12 -0700 (PDT) From: Kishore Batta Date: Thu, 19 Mar 2026 12:01:46 +0530 Subject: [PATCH v4 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: <20260319-sahara_protocol_new_v2-v4-6-47ad79308762@oss.qualcomm.com> References: <20260319-sahara_protocol_new_v2-v4-0-47ad79308762@oss.qualcomm.com> In-Reply-To: <20260319-sahara_protocol_new_v2-v4-0-47ad79308762@oss.qualcomm.com> To: Jonathan Corbet , Shuah Khan , Jeff Hugo , Carl Vanderlip , Oded Gabbay , Manivannan Sadhasivam , andersson@kernel.org Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, mhi@lists.linux.dev, Kishore Batta X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1773901902; l=3154; i=kishore.batta@oss.qualcomm.com; s=20260206; h=from:subject:message-id; bh=Ap7TaXFPFmY7vxQioEQxXOj5gqr4VqCldx5s0gGK/Jw=; b=P/EiG/Ox8r4P5G4oR1MFzhur+NXMa2Gi7t1dDjAqXLD1FDiqn++C0jyKd+T01VGQHN0sFZPMr aMqQNJJLI4PDL60h+ifxRx6Hyyb0ReTpHexQOU9CjbMdJbAk1/mz+bD X-Developer-Key: i=kishore.batta@oss.qualcomm.com; a=ed25519; pk=vJo8RvTf+HZpRLK2oOIljmbn9l3zFkibCGh+blaqZCw= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzE5MDA0OSBTYWx0ZWRfX/GdFckFBM9ap BMdzq3ll853b33V7FhclORL9REdgcfFlaZ5++jlDY1bLiAK+LPPFopLqn4p+/NAzSb9wbagpf0x eD1L9fH7CFddk+qGW30KNpb1o3gvms68jR1zQAzSQ3ec/xz7Nrprc+z8cL8DFXlPZtF9tggMpf/ CKqEQh6FfXIwrjmITI2JP7HbyWzjuV/s9hSuQwOvx7LKdPX+tq0gL2uFg4pFovz1YZqmR/b5bzp wF1YMmEN0t5XSkrwTxNiHZz/RIYNJaDbK+SRpg4dgT6o37oLpEbX+S8KLL062ywyxI6ZG7uhYd4 gm2Czx5NBIXnzbFFkrW+99oPXUEM4+EZNXOgzXPaYmzRB+jzhXi1sRGo8epZyX2giKj2RkMqvAk FUueOpzTGM/NyUCCqYupc0FtMTsJL+NbBbcFj8rY7yed5AWkBQu2cEV6BXYSrqtbUAp7i2xz+QI T+6TKRAyDkQvRc++UEQ== X-Proofpoint-GUID: EC31skB24w4nRMgT-qKtw4yo59grDFX6 X-Proofpoint-ORIG-GUID: EC31skB24w4nRMgT-qKtw4yo59grDFX6 X-Authority-Analysis: v=2.4 cv=MJttWcZl c=1 sm=1 tr=0 ts=69bb986e 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=gowsoOTTUOVcmtlkKump:22 a=EUspDBNiAAAA:8 a=ygoVp7MZ-9MK0Bp9ExEA:9 a=QEXdDO2ut3YA:10 a=GvdueXVYPmCkWapjIL-Q:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-19_01,2026-03-17_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 phishscore=0 spamscore=0 lowpriorityscore=0 priorityscore=1501 suspectscore=0 bulkscore=0 malwarescore=0 impostorscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001 definitions=main-2603190049 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 Mon Apr 6 15:00:37 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 680693542E1 for ; Thu, 19 Mar 2026 06:32:19 +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=1773901941; cv=none; b=CowRlbQ++Zb2v5I1xNuB+xpd1YrUYZoqx/mupnzr1jmAaXrVW4hIHEB2ApMSyxaODbUXa71HfwZuAtNPHNRtRh0Kq67nCJyYvu60BJkWFZWOYLKhhn2UQp9xJ5smceE6xxz35TlwL3EvHAe3NB/x3c47pNmzgDGcZmLBEbKlUl4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773901941; c=relaxed/simple; bh=P1IzXcVjmKfRaow4rEqobZUMjX/s+CE8w3S3MJsIlfk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=N0BfpRp8O75F4BlbjkrA+6EI/cichYN+sQ1v8uq3L2vxNBBoUAnTvpBPyQG7bWj4t/Neni4qBnbliVVy4xPSRzym4+o4/mE6kVsroENHZYJLWArDRaJNfwFV/4tp1yVb6IIc0XG6Wm+o0/8ZwcJaA8l93ppj52+bguzphKXAr/0= 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=ebcPUkaW; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=Ux7fiOEY; 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="ebcPUkaW"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Ux7fiOEY" Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62J5Xia82348635 for ; Thu, 19 Mar 2026 06:32:19 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=ebcPUkaW9oJu8yva 0yfSTPPAgxp/thYUY/nTBkttzRAKiZ4RXwFsDqG4aYFYJsoEukWedCLP0MsVfnei UlgcCYcVStIGnJKk8ashT+wSYlSGgiPJe063d0Rcjvc4RtNEZolQbMwmj3HtibYi Ns7C1uKipKzCglVwmv4GnMLiCSlRbBJc10ntlJtardQS1EFUXdaUk2uUxROdfmZ7 Oz2/0tqNUUlr4o7Xii8RyDPAV+t/5TEBsSxGXjeDuoVRLKkdZsFnVZnRoXcakUgt mEe5HIoH9cNbVNhLHrk6QCssPYOrIuWSqO16Ll1bcbBzbSM9VzdZJ5jfPQp1Y6cu 1wZxMw== 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 4d0957rfea-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 19 Mar 2026 06:32:18 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-2aec07e8aafso4708465ad.1 for ; Wed, 18 Mar 2026 23:32:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773901938; x=1774506738; 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=Ux7fiOEYF7B6UKpGs3mYLOGOvR0Z7+MCyv8ayKjBI1/5qQNjXQBke0gqV4KQKN14l4 q13skKL39qawZKbalfN/ZCruTJwLiOij6Rab5j66e56B47PahosnyVOR9i6j0A9PImEs 469e/64s70rkfX6dljGw9U9ap4CUXAVA2/uMZPajpsBeDRK24x411o4nO0APiZZ2P1kQ DQOHguBt+4uGlvVyToj1fD0JCnxgmmcXAVKIuS/fh8omTIQxKjRDE2YNgiP+J9MD9bFY QJGnWERu8xsEZGd4bND1iwRxsO0NoOpcVPxtxqmDFHquvO+cWBYclTQGWs7902kRlyfT DsYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773901938; x=1774506738; 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=Y/ygKN1SxDYKSw7/5Qg/g26TqRFcRKBLQRiqmBaKpoAnooV2e1wn+e97KcazhL3JMm 2798RqGG+ocCRnqphK9M2DVwaZu88C2pkQKaQn8pyJ/AM5sQzvnmSUoPBiSxLoYLwmSe iEQ7a0NwyHFba3DAmXJpa1pncNVb9gMcqi0AxupzUM4epXQVw3LfapXcSj5aqoS4q8oy CZ4TOG3bwr+YOf6ck+WxNRSlryxARqwfLHtfmMm6YZIFo1FzQ1xRRFxITBA4TMmXAZix hcO4+fyDNEqCcLs0CcSgTo5Km1UywdOqelYo2H6L+nKgg1bWKsZhhmiOa5GgVJyns4Un l4Gg== X-Forwarded-Encrypted: i=1; AJvYcCXUscs9oACt2B4eN+/3VIkFYW8TddsmxW3PJzGgF9+ONDaTuSzWcd2Wr0DjKb2rn0KK0sws3FkKbN/yp0E=@vger.kernel.org X-Gm-Message-State: AOJu0YygzX3z6GDcZo3gpXHrpqbagxGSiIBMSPJiPZtK+F4A5TMtUYkT FplkUvBTIYX5tVLTwxSI3GZC5oPBhuXrXoAs7dwUX2ockUFlF+bxv1wrhit10kdjmVAPIpLUp5R VrFUJXRHLTjgelYvirBSXXbCT/w7oKXG7dSYYsH9UT/Wvwz+DkDb8cPGhQaq0L8wVTXQ= X-Gm-Gg: ATEYQzzKyCoOHHc8zE1rzH8zxN6UnoR0HW1l/5g66xgUTHvlJTmiDPZ/dUiyIpYrSFB 5d9Fxju3SIMR2tTa+1JN50X5NKirN7XKAZN7l9RR5hKHa7AqyyBAKvJ9DOsgmyC5/Ri5033pezr nuVNoRXAWoowWXe+2xkqkvENFba8S8o3eFv6PrCdCJynfCZAwwdohc2WnA+RyAf3pcY27zXd9Sy 8vR//Gv2KlXGaJ0yr4JNbx2MFILzCSGYt0xqgHIZUnLD1y5FIYScbQ8DDyZ1m1nrbsQsZRTQvkE bU59KVl2guNDcm0VCNXNFLtOaNtjxvBAEsElvIXLHq095S9ZzR/ksZDG3rpNL+lfWdse4j2HAwr hWHLp5uT8ISrKWZ3MSiglafgXdZfMmo5NRYWN19xkOFYXkSpVuSw= X-Received: by 2002:a17:902:da8e:b0:2b0:694d:f5db with SMTP id d9443c01a7336-2b06e45c620mr59693355ad.52.1773901937951; Wed, 18 Mar 2026 23:32:17 -0700 (PDT) X-Received: by 2002:a17:902:da8e:b0:2b0:694d:f5db with SMTP id d9443c01a7336-2b06e45c620mr59692945ad.52.1773901937400; Wed, 18 Mar 2026 23:32:17 -0700 (PDT) Received: from hu-batta-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b06e603937sm48572485ad.57.2026.03.18.23.32.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2026 23:32:17 -0700 (PDT) From: Kishore Batta Date: Thu, 19 Mar 2026 12:01:47 +0530 Subject: [PATCH v4 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: <20260319-sahara_protocol_new_v2-v4-7-47ad79308762@oss.qualcomm.com> References: <20260319-sahara_protocol_new_v2-v4-0-47ad79308762@oss.qualcomm.com> In-Reply-To: <20260319-sahara_protocol_new_v2-v4-0-47ad79308762@oss.qualcomm.com> To: Jonathan Corbet , Shuah Khan , Jeff Hugo , Carl Vanderlip , Oded Gabbay , Manivannan Sadhasivam , andersson@kernel.org Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, mhi@lists.linux.dev, Kishore Batta X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1773901902; l=14768; i=kishore.batta@oss.qualcomm.com; s=20260206; h=from:subject:message-id; bh=P1IzXcVjmKfRaow4rEqobZUMjX/s+CE8w3S3MJsIlfk=; b=zEC/kYGnB124qB+qHzLb8dKZywS62/Cl00jR0RZRUisp+8C8Si1G/MwO7qNaAqgn3Pgw9a9TN mynQKR6ZiriCL5/2I2vEGiHkIf0/xeQuy9Lq3u6PAzU+ZXnyuvbXPL0 X-Developer-Key: i=kishore.batta@oss.qualcomm.com; a=ed25519; pk=vJo8RvTf+HZpRLK2oOIljmbn9l3zFkibCGh+blaqZCw= X-Proofpoint-ORIG-GUID: ThUTTkRRJDnEzYs9DhtagvE0e_A8Ia2S X-Proofpoint-GUID: ThUTTkRRJDnEzYs9DhtagvE0e_A8Ia2S X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzE5MDA0OSBTYWx0ZWRfXxjFsW1Zz7Z6z FAg4ppeHGmzqUsTUM1R1UJ1AefMjZ+rHOX1W4KYBA2K7pvGE8LySVyH8OE27F1fTCHemfi1+dI2 Kv9HRkZ0ToAP7ogzz7ywY5BmNJjjNmv31t21X3clYs9FWEmEmFUXR0lUdgNxkTCmkEz2p6076ZV +QGWViSSiph2gJ4wUm+9/VwFKmIINnPxwiL+oB1WairffYsJt2g16+pljntviFuUia25ldtoVmi sObvpF72IJHi/CJkUKuAoDHiSc6iyH+Z1YCX+Cio2K9CHD3FRVD7D/gAAfiH7N7OWtob2woMMj1 f2Bz5trzjDRexbzTjo1ACmR2Q2Y1ClktlYL//roWqRU9+Z5GOSTFQUP9CrCbuZmzVZbfCEo9aLI I9Hf7caK3iZMrypRRgqdmz7qMgmPwFn8FR4+s4dXMAvsARUUAG69la3RcptGWmS0gxAKoo9D38i nN1Hn+G3Qo+EfJhQMcw== X-Authority-Analysis: v=2.4 cv=RZedyltv c=1 sm=1 tr=0 ts=69bb9872 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=Um2Pa8k9VHT-vaBCBUpS: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-19_01,2026-03-17_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 priorityscore=1501 impostorscore=0 suspectscore=0 adultscore=0 spamscore=0 malwarescore=0 clxscore=1015 lowpriorityscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001 definitions=main-2603190049 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 Mon Apr 6 15:00:37 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 BB69C346FA9 for ; Thu, 19 Mar 2026 06:32:23 +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=1773901945; cv=none; b=cdQBpwQwF1Wm9EZ2poN6xlwMr4i77tOlmbJCj0hBhVd5mhKeoKl3PLPcq4aRA+5Niz4Fq/nUZaOlr9ia1wf+hC2+vByw23mObdyJ8I+FvaYSeXeJN/cvjcJam96mRVlWVNqiLlgrjqNQD9ozy67B1BNCaIR7aQDBcgHjWlMR/7E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773901945; c=relaxed/simple; bh=zLHdxvYlh3SgJM3zwdFzuQdChe4Q/8MyqXYe5cHG93o=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SuvSw+7Mwi8BHS6Focb9ne+/Hkugvj00aqLQsjzasRbLpuFFqzF60kEIWyms29MLWMD/vA8G9cXHGx65PvhmVfyC2ruHvo1uL3jkA8h3slKqwazUv5wWfmowGh6ZHumADWRgMhG+7+Xq87fLyzKR9/sQBfieLEqZcAgnkv9+hPc= 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=YsLNHs4E; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=ADrZ42HO; 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="YsLNHs4E"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="ADrZ42HO" 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 62J5XUgu3574169 for ; Thu, 19 Mar 2026 06:32: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= iiXrCv65t5Cfe7JS9CAoM+yCgarvykPh0XYvrPKdD3o=; b=YsLNHs4ESlAlVBun SQlyjD5zscJyYzZ7SvkeNmzOkYaKxSikbLg1ELzJJZTBiU+CnRu0Dx9bOa+N2KnG nCil+AlRj/yvaGwbkgjj6glQdR3T1c4k462uSVSibHHPGdCdcfmabwlZDOOYxMO7 39pj0Y8ztpK4W/badPXfvDZxs2VxverZt2Mw4BmjpoztOT4e0GyUK+bsQl5QwmtM KwDA+Yl6es15EM1RIIkpRVffWm+vHCLZS6HzUpx/Er8VHY5Toq/KgqDVsnl+ZYDo G9fVCXHqEVcK7L+RjRr/lD9sG72Ov3sMYc4KH9xPW6m068gobAecuggJq98q07TV Whm45w== 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 4d083r8nf3-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 19 Mar 2026 06:32:23 +0000 (GMT) Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-2b064f043adso6001175ad.0 for ; Wed, 18 Mar 2026 23:32:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773901942; x=1774506742; 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=ADrZ42HOJabjta4ZEQgi4Fu7uy02LXKrd0n8kJHF30hoUObXNHcn3oqwhDReNZsq01 i5M3EYEmsrFh265xI37g9yRmX41rD4ikxWxDDC7irJB6RlFHUSbhQScv8o+btIDJBamE NqHwIppceUdyHWhKUWqmwd4DBDyS/NFjGpybhYDqyAWY2Q/UTGPn2yRoWkNed3YjGbtU w+ilV1H475mVVl+MkrWAYWUoVm3miaHZkDAYdKOwxWLFsTSXJyp7X05uV61SMIfr3vvb 5iIGIcMppQkNR5ymDryByy3mRnMp5CkwdV7obiYbH/LxIpxOCFpH65hhGMemW/KF6SA0 6Mpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773901942; x=1774506742; 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=SmKKFZZlCcA1wMnSUap9ycqzkDxnhb9ZpqLdJ1V+0cblzRFk5nooiSQ93nOPssl+Wy pm0TlLAh/tW0o44MSyFFBqqRshUkJvPSPh9XK1tymvjZR2EUhXKLjJGEXzhq7YSBLQRx kNrAe6UgV4IZyciLz6PDEpkAZHn9GMehhw3qrYofD0acetw56RTl1TDaardTDU04Jb3z 8Nj0GZ2phJyOT5aV+3z61ijDs2zeIu7K5A76It0JXgj3pQ8psCvo6KcWhTx/Mam7MWqm sz+IQ9BK4LqaZNZ7NkKxrtHMHbAnJbQ8/HNLKtB1S1LbunBoOJ1b2yjBmRi/1mvQOqbT 7Z3w== X-Forwarded-Encrypted: i=1; AJvYcCWkGtrqJ3qML0748K/bBZVkAYaXKpIuI8otd2In7UoDDDkc8+yV1tPE+CGbs7gQ7TiwhBIjb+45M9wdhA8=@vger.kernel.org X-Gm-Message-State: AOJu0YwLElr3Mp1vbKc9WDPpaNtMwMzJgApzW9GCntIGsZl941gu7L6z lD17O1y2DvcJUDyi7EXpcoalxj2lD5cw2bSrVqkrSw65mJ0+4UI6xtVXuityubgk1R5+SNIJZOz fBBVLKtWJuyXa4PhL4eamZJCuzzqoF/iFJ1kgNrk5ZV5KutKi3ONuQTE3TMaQg3P9uxc= X-Gm-Gg: ATEYQzycE3HMq4QWvj6CXiHfcuvY0y/4B44+WWkzZwHffvz9tBZDwcUVdlyqzilGb3J EN8X34INoKBHC86EarlTTKVUBn1vgphyF1/V04r6Ht3Sc0PH+hTobN0VFuwnRgLOpgXL2NO0U2C xR/4uIrUIXJ+qAyxXKhktjVubV1NYuA0fwQEhkvTnB/IHj9dS5r4OAuw/7OHD4+oa15GH0wATtM ckB2X/2+sjR1kwm3y0FD0vs4e8lLFRx4EIQH4mxIyeAQgnrmpb2LqlFT0XBfmKu5ur+dFshGxxJ a2GcVQxl5QHAA1Z3tkbo8Ep2W+rcCcs6hoXv9ncE+DdSL994q6U/5O5dNApAaOVfm7BlSpNkvJv l7Yk/DJago8/U6NU2V7WZDo0jTBJG5JanYLWRgq/S4BN+2O9AcHU= X-Received: by 2002:a17:903:1a67:b0:2b0:5a4c:726a with SMTP id d9443c01a7336-2b06e41afc9mr57939965ad.43.1773901942219; Wed, 18 Mar 2026 23:32:22 -0700 (PDT) X-Received: by 2002:a17:903:1a67:b0:2b0:5a4c:726a with SMTP id d9443c01a7336-2b06e41afc9mr57939835ad.43.1773901941736; Wed, 18 Mar 2026 23:32:21 -0700 (PDT) Received: from hu-batta-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b06e603937sm48572485ad.57.2026.03.18.23.32.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2026 23:32:21 -0700 (PDT) From: Kishore Batta Date: Thu, 19 Mar 2026 12:01:48 +0530 Subject: [PATCH v4 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: <20260319-sahara_protocol_new_v2-v4-8-47ad79308762@oss.qualcomm.com> References: <20260319-sahara_protocol_new_v2-v4-0-47ad79308762@oss.qualcomm.com> In-Reply-To: <20260319-sahara_protocol_new_v2-v4-0-47ad79308762@oss.qualcomm.com> To: Jonathan Corbet , Shuah Khan , Jeff Hugo , Carl Vanderlip , Oded Gabbay , Manivannan Sadhasivam , andersson@kernel.org Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, mhi@lists.linux.dev, Kishore Batta X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1773901902; l=3311; i=kishore.batta@oss.qualcomm.com; s=20260206; h=from:subject:message-id; bh=zLHdxvYlh3SgJM3zwdFzuQdChe4Q/8MyqXYe5cHG93o=; b=E912BIRgk2tIUK4/M4i8++DPEcAM8x+0kS4yuwICPrM81yr9VdRFAzP87se9p2qP1rqiZUxb4 9ZzAK2xR+g5DkO5ycJfNGU8vhWZhLd/M+V0j9MwRw2DwL6pPFoJCvz0 X-Developer-Key: i=kishore.batta@oss.qualcomm.com; a=ed25519; pk=vJo8RvTf+HZpRLK2oOIljmbn9l3zFkibCGh+blaqZCw= X-Proofpoint-GUID: UF-3ix-_kMyWrSvrt3Y6v-v-8uHbtxxc X-Proofpoint-ORIG-GUID: UF-3ix-_kMyWrSvrt3Y6v-v-8uHbtxxc X-Authority-Analysis: v=2.4 cv=ApTjHe9P c=1 sm=1 tr=0 ts=69bb9877 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=_K5XuSEh1TEqbUxoQ0s3:22 a=EUspDBNiAAAA:8 a=9mPLix8uEUeM4unapbcA:9 a=QEXdDO2ut3YA:10 a=324X-CrmTo6CU4MGRt3R:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzE5MDA0OSBTYWx0ZWRfXzJG6zeMVBlP2 rNtoZkjrPHqocZc4ECNYf5hxgoyn/UJWZaPtW4bAxsj8oNun1u3CSIHXSYFeE0587a6Za30cMHq 1pkxGzQ40d83nyJrlDc0tWgOFwzd2U71ScvkcxWaDwKkv2kVUxHlLi0mrwnCEJUvoZwa6lcnmvT gxNtxiBW5yGiV/hU6gn5YEW+qXkbEBZ8h1LO8hdhdpt5PvvrMb8K5gbuMqZpN2g599k8+fe/qsQ NNdZa69wDX4WOCOzskb+UY1WaNWT5WtEhxAFacf1Gyp8iPF/vj5DLbYv6iv1QV2iBapLYfeJHp+ 7XulJDRsFcCCHHel2YZ8ehATYWbQeBWboHwQPUCSsdiddH3JZ6Q/Zw9IhP5fxAdHh1NLanvczXc VMRnwTTmGMbSlovl7fh26neyn0DUKqIPZfVuaCPILVw0aYSnOIRilehOVnrbMANU4o8Fy7G8xs/ RbTqvqbQXLzSSktgxLg== 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-19_01,2026-03-17_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 lowpriorityscore=0 adultscore=0 malwarescore=0 suspectscore=0 clxscore=1015 impostorscore=0 priorityscore=1501 spamscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001 definitions=main-2603190049 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 Mon Apr 6 15:00:37 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 7213334FF50 for ; Thu, 19 Mar 2026 06:32:28 +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=1773901949; cv=none; b=TWrbmxw9Ug7FSGwNVS+vjzAXImUNOVu1+pEp2K/hPLCL3kyR/1H6X1SYDHLKEBfetS/npkh90V/Roh6gJ1IBuXeKny2f/LczJCK7D+nCdYjv2RHoVDcuKbdEXYM4pbujf6U2nRIUW+HAtrfPq0GxmGcp6tntKFPoOJMYRiI2VSE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773901949; c=relaxed/simple; bh=PYlMjATY4SM1+jaLjbUMOn336QEIJpGFcRpjUcyzz/4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hI4YSmlOq5iSNRYu0Sw0uTc93e0A3kDBoRETRZYYukeFAlIIGGsZleVfPoX9+Mh8atpgv5/pT4NJXoT9ZkVTw2B+ctIhhay/vB9MHx1SG2f9/d6rCOE2qgU2ybB1mTBWetzUIt3vm3kFQdpsijLl+OMfmrPs5Qz4lvclgYFgAgQ= 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=XjdYOj6Z; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=Yd1X+UjW; 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="XjdYOj6Z"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Yd1X+UjW" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62J5XX4O3171760 for ; Thu, 19 Mar 2026 06:32:27 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=XjdYOj6ZySs+ffOQ nIXhwt5OeOeWVukqAGGFaWFnkYi1qnr565OZs+NKGzUFqDEEMmFMAPrgo4nld+DW Ip9FlKU2r1dwY1+JHnFUeDSH1RF9RnqLCKQfLnhYNSfW7F79oYWtJ5S/GvurHkRQ Br9J39bODzuBspngARD1uc53SXDHWMGl7sEGOeX7vRsccZs9uYSQva52f6XysenQ Of6izH1A8FoqhEg1sFg39oPMc9xKwg4JVW6eU5OWbqGpP7AMcMGgculpSra5MXcY 3JRWd30EVQF3SI4d/t9bsIwgr830exrO5qD65OmraYUqzUgeO1N1rC8L915SIl4G RwUmsQ== 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 4d00f9j1vf-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 19 Mar 2026 06:32:27 +0000 (GMT) Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-2b079b4a8c3so40050045ad.3 for ; Wed, 18 Mar 2026 23:32:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773901947; x=1774506747; 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=Yd1X+UjWDCQQ1M/9vHZILF496RwahZ+CUlNByFOqf8V3sJV0SGVtZUQ9x6l4MYHu/i rcVJ36NudEMkx3m6MySEFSq2nskqHlSE06XfPDVwMSq0qRLEDP98VFBMHKj31UarFdA7 1YOu5QNDg/ndrhYS30WgWkBtOIrs8J2YAvx8CQsYYImVhnMslXtt9Sg2a7Rqf5M/Mgjx rIorjUOXnDwI2KNpA7jtFQ7pfXwlzemd1AGHB9Gi/ZrXOrbMRryw5QB4vIZOPkNYK0qK SMMHO5PJf8ZLOM8/L6fGBpwuuuBsYzzhdvC9zuAvxB73b9s3Zls8pUexlmLTigAbq8dj iZsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773901947; x=1774506747; 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=kn4OyxMhJxEHh4jsN4zoufMd5VUGbKoMDiR2xPIof/Y1Rsvuzy2Vzpa/sH6AMeLxxu TlS8OiZwr4kATHgKrGsNkKd5Zen1qyM/Te49TFLOuGWLG2xn95Ej9hfp1JVPwlZ7/kUl /+9JyRpqYdL/jajbZTuL4ONWBzhD64Osjdb04yXzAd3+K6ksmKROyFh7cJDo+RC6Z4VU HHAU0BFDDjIA+bTrMbMNV8ZIJCNhydYnP7bdmTWe6qPpn0lCR27nV8voP0VG1w4DAgIs bimsQHIUbKoad+AXDbO34aLUXvTYuvjjnp5IDLigCrAJ2NOMnLf/q7KQtvnIL3nCh8A/ xAtA== X-Forwarded-Encrypted: i=1; AJvYcCVU8l2y1+II9ttTGZ0Q+5oySMgWeqEWXYbqCc54GOrvCniSd01H0yaQNnS41GM+01swxBqSSKxxun+lENQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yyp0J6innkJNciIdE6kh9UU3WngfA82FKdmnviDjKftjdHIz6yM AXqnWDiur0l/NFhjD3ZVFB7fs0SuwAn5HXPaWs9oJ1BCkf9Qz2gLH6a0zYudDFEWJxnc21ifLxF G4gdVIUgEtEn9ARgsjvgeUJfJuLB6eYFU3cP914CD8vtO+B6OtoYms3zDEk2xePub/J8= X-Gm-Gg: ATEYQzwm/PioAnGJwGCxJYqHnF824u/SKsEV9aB74pfp8vzkr2mLWZSNy3BwzBhs3as a4IqC6m+uNIgXclu6WG/r/7EBm5NvKJBPJOfSENhD2AtR6tlzlES7T9U8Kck/aaoOz9mUCpnCcM f3xthyS2qkC+UGYucpO78Ncti6UIbFRi6yUnjegB9VgFSa7zTGrlNxRJBoOHtQJk/7WJNHy5UpQ XCHyLtVU/S7dqbA5b98ujAV8rt9ubllo3vX95Gi2f0xG8rLEOVJvxEh4bA9gH4SCtl97lf4+B+C 7luGsafNWkYYZFLC/DPGDDamJjjLsW5uKhuRs0YhoSgaVGn4JfJWhB7FFdr1R4qs6wIfZXL2MK8 V3I2EUMD9hT1G41PKPMwOz6ONylybH0+c1Mi5Cw3qZfCHjGxajWA= X-Received: by 2002:a17:903:2a8b:b0:2ae:5776:45f8 with SMTP id d9443c01a7336-2b06e3236d0mr66217285ad.3.1773901946584; Wed, 18 Mar 2026 23:32:26 -0700 (PDT) X-Received: by 2002:a17:903:2a8b:b0:2ae:5776:45f8 with SMTP id d9443c01a7336-2b06e3236d0mr66216985ad.3.1773901946126; Wed, 18 Mar 2026 23:32:26 -0700 (PDT) Received: from hu-batta-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b06e603937sm48572485ad.57.2026.03.18.23.32.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2026 23:32:25 -0700 (PDT) From: Kishore Batta Date: Thu, 19 Mar 2026 12:01:49 +0530 Subject: [PATCH v4 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: <20260319-sahara_protocol_new_v2-v4-9-47ad79308762@oss.qualcomm.com> References: <20260319-sahara_protocol_new_v2-v4-0-47ad79308762@oss.qualcomm.com> In-Reply-To: <20260319-sahara_protocol_new_v2-v4-0-47ad79308762@oss.qualcomm.com> To: Jonathan Corbet , Shuah Khan , Jeff Hugo , Carl Vanderlip , Oded Gabbay , Manivannan Sadhasivam , andersson@kernel.org Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, mhi@lists.linux.dev, Kishore Batta X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1773901902; l=1903; i=kishore.batta@oss.qualcomm.com; s=20260206; h=from:subject:message-id; bh=PYlMjATY4SM1+jaLjbUMOn336QEIJpGFcRpjUcyzz/4=; b=oDJdabj+nevZsLKRAXC74rtzAHVO/YwH4bO6LZREstgcBsTlP0qNzP0ID0HAYGXuCGebsRFDN Qk9A9oeSuz4B1G+ilAYFW3ypjpCNAaWqO0Yl/9a3wvCY/fV+jBI0yuO X-Developer-Key: i=kishore.batta@oss.qualcomm.com; a=ed25519; pk=vJo8RvTf+HZpRLK2oOIljmbn9l3zFkibCGh+blaqZCw= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzE5MDA0OSBTYWx0ZWRfX8hKwPJ9OGn9b VIZdDM3JD6p/LhD/iYaDg0Xx05cPURcVXCS3L7JmsB5fmUCZTNA2451+UgBhGFqLiX+gYmwTnwO RiO5HoB/0UsxKlwhyOqCM/jjQhWkvkx6OG64j/sHlocGGwGSJ1BCkDDjAbNiQVbEuV8jZBaVWsk LOCZkgkSSjSBiPgpUxs13guBj6DTFH1KRi91v0jpIagUdrySZmHqNLT281ywVVzuPxp9Xv6/Qbo RaOs7PVC+DlrBOJvYGxSAsd+KV++TmOsgIeEsu36RUhTixOzUPl57k7GxydfCRv/Yk2LNpHFR74 uEo4ulz+D7bTM9e7uI5WwANDCQzFKjUcBCf7Wpbw+crC+a3ToJBJmvXQHpHP3laVCEXRBDE9sfH QIw5kUY41/EZ6u3W012I93auiKHQ//uNipCEGQFnfvwp5q2UgFqNvCnGJ2SUOirJTyJcnQMsbMq FLybqCwwIrtKLbw/lSg== X-Proofpoint-GUID: VmG06Iqm-YoNZKgC5zJ3pHnNtJpKPQyM X-Proofpoint-ORIG-GUID: VmG06Iqm-YoNZKgC5zJ3pHnNtJpKPQyM X-Authority-Analysis: v=2.4 cv=MJttWcZl c=1 sm=1 tr=0 ts=69bb987b 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=gowsoOTTUOVcmtlkKump:22 a=EUspDBNiAAAA:8 a=dkV1H7vRkoxx0F9zaYgA:9 a=QEXdDO2ut3YA:10 a=uG9DUKGECoFWVXl0Dc02: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-19_01,2026-03-17_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 phishscore=0 spamscore=0 lowpriorityscore=0 priorityscore=1501 suspectscore=0 bulkscore=0 malwarescore=0 impostorscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001 definitions=main-2603190049 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