From mboxrd@z Thu Jan 1 00:00:00 1970 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 DEF35372ED5 for ; Wed, 20 May 2026 06:26:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779258389; cv=none; b=cnaPzWfvBaU53eY+HQEGyGa2smJuTqkjJcpSzUxpvLNSDefT4Dagmou907ksPZ6yVWmg00Tpvd/TcpX/Jui5iVllk78bBkhNiJeRSuiChMCmxWRNXCN0cReNMJf9Az+zRIpZE2ptRokZ+yn0tXg1OfZGYDHJIdpyJK/rxxJdhFU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779258389; c=relaxed/simple; bh=BQZGGR+Kj9Md3bS6Uq4HRXhbnJ4m++574iu+PGya68I=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=UepvRd7JMsgzJObeuW5jZfmYNj0BLv2sdh+n9zTkqKJb3MBylk6K3+2w0KG7bAz/fh/7WQg9eLyO/R2oCmDkmH/g01iDBAvi0m4qDhaS6oyy3i2hr2shjNhJAb2V+uYnf/M+dR1mAqdE10pgCSS3qvNQpRoNLOtfKJnVLAJc+yI= 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=dunzMV3u; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=UtRH9BRJ; 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="dunzMV3u"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="UtRH9BRJ" 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 64JM028t1739499 for ; Wed, 20 May 2026 06:26: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= bW7F36999oGFMbvn1eYTcV73jKHwj2KE5q8L3kwSVD4=; b=dunzMV3uXGkn7Q8I K1yv966/P0r1yGQzaCI+eju4wxVDl2VU5NcvnPjb3CtDSqtS6g2o3OXGr4HUEnWU O0Ml8v000I3Fv50EOnmDjeHT9lCIT3+pbnocaNbmmneGuJXQ+FR02FAB53WV0ORw hIBnawbFy11Nw97lqy/qVzLxz2XQMwEDSybh/rY7Zk9g7DF3FHq9Rxl0TjhxOCEf hlszaPAZqWm4OsuLfO5sJuID5S1qOAhMqHdcE5jYin67F76vPfQoqv7JpDgRRVWS RcQqFhTD0vYGs+OvTW0P49PBmat2c06aHFbT/kxBPRGXbIjAR6Q+OsXyoR3nGi4/ 5hhMdg== 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 4e8t3qb85c-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 20 May 2026 06:26:26 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-2bd00a65673so32818025ad.1 for ; Tue, 19 May 2026 23:26:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1779258386; x=1779863186; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=bW7F36999oGFMbvn1eYTcV73jKHwj2KE5q8L3kwSVD4=; b=UtRH9BRJ3aa8tHrpkttAhcsI0s7fNEPU2OHT8MFtlyASK6/+oqPZQILeqAdVmkq+7c Ee0tmOXUwgTaeT/6v5Go5aHdOX09ek4qbabrL7O5UUVBAXqY2aGh5h27PLZPmBTPhQrO yxowWVchT36E1kfWaXp8op1uVSaggstXt9KScf6h3d+EIP+xMAckE1N2hLnGb2YU7NcC 2ZcE+66XbTwktN8MnFjHgWASMqfkS9oF5U4Csr2ciT1Yi145nOjMc289Ze+U04Etyaop zPxpjzc4ZmTg4MMcq6MPpsRgrHhdfawkYVnYx37g/WSNsU58VvgVXJ0YqWmbQLPYFp8b Z0ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779258386; x=1779863186; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=bW7F36999oGFMbvn1eYTcV73jKHwj2KE5q8L3kwSVD4=; b=qm0EOhzNKlgiti1WF4wAPuU6LKURFb0eN+BZ0wW/YJoZDJE/euANvDtNKzJE37NAKs JSZ9cH4yhHNcCfUFYKkfs4x+N9myqqc+vyZJpqxC2DTLP+MxgT2NAtlMGcHoGhlJW+pB MCi4JlL7xp6ffMBroWiqzdoEEsfksrQMC9aVn6fGkkBuvDw62eVT2yJY2M301JVvzOuz qxP27VhC/NBv99Y/6zFe6kgkQWYDPj0ggQaBmkcuEy0C8F1YF2HQhvfzU1oNDrosFaAx V8EwTK3JddajW9OLbNupOgiw1OX0UFOSU2Bd9q8Tf89vXUM+5evI4NtHELJlETERxBkv THSw== X-Forwarded-Encrypted: i=1; AFNElJ8c6/ssgSesUYeWGmFxarlhAY+5AUFjO3Us+qMMh1pb6j3aui+44f/OjlL9Pn7P7L6Q8ed01Et7RWTtRTE=@vger.kernel.org X-Gm-Message-State: AOJu0Yygf8Zkh9u/JLnCkJM1LxwN2cpNK+L0+85ukEMGpJ0W2YGa32ef pJU+RXlxsvludmTt3JuqQAL48Et5/ipRu/YOnOwud2+prsT9qB1K6qU4dewnBWVUfaZ6jFcK10O dl94QW+ldmu7UUnjK2VplLbhz2raDe+fUaxZ/+fW2vq6TNFloeV5FEmxvPquu733lVP8= X-Gm-Gg: Acq92OF6d59qG62qinmsmmx6OzJK3f/Rl7YWPAw2xmgp0ybmNqvlJrjL3Wd/mJw+oms bS1Wckk7mTZq9QJsWumR4oA/Go7/wt/ibi5gkGWKckVDLk2cuAhsK/Zlu5T4dl5DXTv1gYTTzYw WAKZb3G6yLquSj/r9LQVjxtfp4uU3hca9TrDEb95cWOiVru7WxFHulxjp6Q57wMZKlouULSqqNx 847+Io+miKfsd5QKcxuaCBZTTAaC49QuDuK34nu24KXA2zMypXhhj2CgtLJnQC4RLjqtaQTp6NM mQLcDYUhXxb6hKqrhmUq6ecOYxrSk2SUNWeGxWLx6qzn6T9/1qoPhM1DKgsw7DNiIomc++qVAqO LiWAa6IJdTNzqdTp1Iyv6frl1IAG1uodJ5o6FE0WmqEsNzDUN4m5yyi5RaB4= X-Received: by 2002:a17:903:46c4:b0:2ba:6601:8e3d with SMTP id d9443c01a7336-2bd526f69f8mr226306865ad.9.1779258385718; Tue, 19 May 2026 23:26:25 -0700 (PDT) X-Received: by 2002:a17:903:46c4:b0:2ba:6601:8e3d with SMTP id d9443c01a7336-2bd526f69f8mr226306635ad.9.1779258385245; Tue, 19 May 2026 23:26:25 -0700 (PDT) Received: from [10.239.97.158] ([114.94.8.21]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2bd5cfe4973sm210884795ad.41.2026.05.19.23.26.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 19 May 2026 23:26:24 -0700 (PDT) Message-ID: Date: Wed, 20 May 2026 14:26:20 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] Bluetooth: btusb: Allow firmware re-download when version matches To: Luiz Augusto von Dentz Cc: Marcel Holtmann , linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, cheng.jiang@oss.qualcomm.com, quic_chezhou@quicinc.com, wei.deng@oss.qualcomm.com, jinwang.li@oss.qualcomm.com, mengshi.wu@oss.qualcomm.com References: <20260429121207.1306526-1-shuai.zhang@oss.qualcomm.com> Content-Language: en-US From: Shuai Zhang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Proofpoint-GUID: tXNx330muzDkWJRDPaw9jvOzm8YdyNZh X-Authority-Analysis: v=2.4 cv=LcMMLDfi c=1 sm=1 tr=0 ts=6a0d5412 cx=c_pps a=cmESyDAEBpBGqyK7t0alAg==:117 a=Uz3yg00KUFJ2y2WijEJ4bw==:17 a=IkcTkHD0fZMA:10 a=NGcC8JguVDcA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=qqokX6KkybRntjKqjosA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=1OuFwYUASf3TG4hYMiVC:22 X-Proofpoint-ORIG-GUID: tXNx330muzDkWJRDPaw9jvOzm8YdyNZh X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNTIwMDA1OCBTYWx0ZWRfX+UbibB2fHXSA GvKBvYrZPJmAPMu3iJ+jMu966Wl3+KDG3U9sPBU5/KLKJCUxqDX7vpGgHRiehMdZxbbZBcu5ksq 46bCeHGekb+GLZ0eHTDf/bkqHG/9NvCypPd1REhtRyLJDWgnHZuRFtXuOR+QJXE0b25LT5DVBgg pTSk3RX1dWOINtK0nJoErt9CwJqZQtaEp59ix1NfKkx9Qf0rG1VQaGI0AOlaGOuqRc7ywuXF/TW ci2Vnyx9FGddKugJzlWmhyoHM9Mxe+7ID4D7p2dZBfTKAGs11Rk6XuUUUJFJZRfeu469bGAGG2P m803kUkWUQRz1csrgIpum7ypb4R8EzsqxCcEaBINJNbK7oejS5h2U5sFXuBPks4ET8VnhzG/g6z PhvxUGjQe7+hjlPhoBB4WPa/mn7JPIGEHjCzPWJZDyY/7y2i60ctPX7rmzASViB2UdnImP2LmKj SRaGQVP+rnvUNLgiP5A== 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-05-20_01,2026-05-18_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 spamscore=0 priorityscore=1501 clxscore=1015 bulkscore=0 adultscore=0 malwarescore=0 lowpriorityscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2605130000 definitions=main-2605200058 Hi Luiz On 4/29/2026 11:17 PM, Luiz Augusto von Dentz wrote: > Hi Shuai, > > On Wed, Apr 29, 2026 at 8:12 AM Shuai Zhang > wrote: >> The Bluetooth host decides whether to download firmware by reading the >> controller firmware download completion flag and firmware version >> information. >> >> If a USB error occurs during the firmware download process (for example >> due to a USB disconnect), the download is aborted immediately. An >> incomplete firmware transfer does not cause the controller to set the >> download completion flag, but the firmware version information may be >> updated at an early stage of the download process. > Hold on, if the download has been aborted then the version should be > reverted, or rather just update once the firmware loading is complete, > so this indicates there is a bug somewhere that needs fixing, not > worked around. > >> In this case, after USB reconnection, the host attempts to re-download >> the firmware because the download completion flag is not set. However, >> since the controller reports the same firmware version as the target >> firmware, the download is skipped. This ultimately results in the >> firmware not being properly updated on the controller. >> >> This change removes the restriction that skips firmware download when >> the versions are equal. It covers scenarios where the USB connection >> can be disconnected at any time and ensures that firmware download can >> be retriggered after USB reconnection, allowing the Bluetooth firmware >> to be correctly and completely updated. >> >> Signed-off-by: Shuai Zhang >> --- >> Changes v2: >> - Update code comments and commit message to reflect the correct logic. >> - Align the commit title with upstream conventions. >> - Link v1 >> https://lore.kernel.org/all/20260108074353.1027877-1-shuai.zhang@oss.qualcomm.com/ >> --- >> drivers/bluetooth/btusb.c | 8 +++++++- >> 1 file changed, 7 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c >> index 572091e60..70abbabea 100644 >> --- a/drivers/bluetooth/btusb.c >> +++ b/drivers/bluetooth/btusb.c >> @@ -3550,7 +3550,13 @@ static int btusb_setup_qca_load_rampatch(struct hci_dev *hdev, >> "firmware rome 0x%x build 0x%x", >> rver_rom, rver_patch, ver_rom, ver_patch); >> >> - if (rver_rom != ver_rom || rver_patch <= ver_patch) { >> + /* Allow rampatch when the patch version equals the firmware version. >> + * A firmware download may be aborted by a transient USB error (e.g. >> + * disconnect) after the controller updates version info but before >> + * completion. >> + * Allowing equal versions enables re-flashing during recovery. >> + */ >> + if (rver_rom != ver_rom || rver_patch < ver_patch) { > As I said above, this sounds more like a workaround. That said, I > wonder why it would print an error if the version matches, it sounds > to be that if the version matches it should just skip and consider it > has been loaded already in case the actual problem is fixed by setting > the new version only when loading has been completed. > >> bt_dev_err(hdev, "rampatch file version did not match with firmware"); >> err = -EINVAL; >> goto done; >> -- >> 2.34.1 Just checking if there are any updates on this Thanks, Shuai >