From mboxrd@z Thu Jan 1 00:00:00 1970 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 DC2573D45C3 for ; Wed, 13 May 2026 07:52:40 +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=1778658762; cv=none; b=Y4ePV4oe5reKbRYeVQw3ZWmeQOZqJbsn2JMZt0LTiNHfyHNgXeEWsKnkR24wOIkZa+SCUPp22EPW/2ey4HnNhpALKtzJaxolcvnwNWfTEv+Ol/6GORh1KrNkMGMQJzOUM2vkGm/WsMgSDPgFSfy+8n3LFyiwv+VoR6oLAn3PjtQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778658762; c=relaxed/simple; bh=MSXep/bDwIn3yHe4zPzKf5Aas/TTus+4HSlvtcwQFuA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=T+ig2ZMjWrzYLpOrLsG8Ret+GJ8IQzCeLD9nQs9YGzQn5qFiCyMpBonaqGAq/lofc0PiOFyuvjKaOYIFLWd7VS1QPEnYPdh08A8nZAZskTZrWmzRXr9rlAM+03fDNxWh0gB0vgu/Vp76EgFYN5j61cckxwwEXA5yBB6jVuZziss= 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=V68MnocZ; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=HW239AZ8; 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="V68MnocZ"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="HW239AZ8" 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 64D4p7Hm3595074 for ; Wed, 13 May 2026 07:52:40 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= ravoL5PG8TFBvvHW7mZTeCpdtXXYG3Ly4mpodLGV0u8=; b=V68MnocZ+qiBFkh8 5ElHxnLuoYyP/kCaYQrSfVhm/i1SMyKw+4KMf525HOudtW+kbjxZGydfCh3RmbEg 6Wjo4LLbn1aYFwN8tKXzpv2GLgwaDQAzvykOaYXh0JlkwgcvYKAUM5TLfAuwptq9 eJw62eC0BmZNbtHLhR+ydVtSNjrkG8eUP6xanCfPaWIPK+CYJftjijfE7v07J61R Npz9697/d9fy+EJU4jl9YV+iC2zDs2GcPCWQt5fP8ws2H9YMdrQaJa1KvrzKoFs0 HvbmYIQO8dUiydXpKTeFdPIymsMPsSaOUx5pIM1cD9V1dXGhMttyuZL1WL/Zb6ux 3uutGw== Received: from mail-dy1-f200.google.com (mail-dy1-f200.google.com [74.125.82.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4e463dkd8x-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 13 May 2026 07:52:40 +0000 (GMT) Received: by mail-dy1-f200.google.com with SMTP id 5a478bee46e88-2f525565b33so7681365eec.0 for ; Wed, 13 May 2026 00:52:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1778658759; x=1779263559; 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=ravoL5PG8TFBvvHW7mZTeCpdtXXYG3Ly4mpodLGV0u8=; b=HW239AZ8RRHKi//Q5WXu4bDre8EYaNm/ylprM/knn3IaOzcQzs++9nI/k4yvTYwLyz 7Vm2y8NwX8bI2Hl7EGsMfbZD5LHIjZITBSoGfiewzC0F/CA0L5NQAmsaAiy2u0u0G7C6 nozSRk0NjIMud6C6w6/W8ppYXG+fBuKkoMhpXa+nj1aYQ0WExY3Z9Aj3Dt//o7tpLJuK fTy5xewxmhGcJMvNL9gXZ0PhI7D1uuaNkgiNRJg/fNjJQWt/k1aX0Qa1qXYlHr0DkgMI P9mvefD0WCZ87r+jFVis92iYNNg9eQ1JFDDzW6swTWcJjacl47VwwTJ1yxuakzU0eUNs PGoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778658759; x=1779263559; 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=ravoL5PG8TFBvvHW7mZTeCpdtXXYG3Ly4mpodLGV0u8=; b=i+cU8MSw2T/y9Y1HXVyMbL45sDHQhqJWbR1S4quEMHBBr+vMk7hZIAYHrZOqteRj6v bt7X6M8Ce8wxM2gXnBNfFjIJo9VMVoQNi+QTHCZPuEQMuUr/IVf0Z0i+WalAqz/BBj0s ud4IBtyqR6zcEtyxUsO2ghdxKyuhHSCpQClzC2GrheLsLkTUEA3SplVtBxAGrdNeoSHI H/z1SgwM5j0daVJJ3K694TpQ9HnUj7AvFKFNQXLKDwodyrF6IUxN3HhAY0GXB+dT6e8J pjHr3L811KWJ0/9wQcOFXRIFP1QAVVvXTtEowU/hY5rZlLECKwG+Fz0Mw0Y64lbSMrcJ xb4g== X-Forwarded-Encrypted: i=1; AFNElJ+x/YXG/zjwoPAfeLknExgdTfomR15h96gy6ccm+IGvc9JlsGOO0FKfqshs+YxNgo+DTJKB3Pc3ifQzl1U=@vger.kernel.org X-Gm-Message-State: AOJu0YxHKh88zf1hXzQuP1EADi41TUxTaB5aQc434qbZaRyiNZFhI3ac rmXPP5IiUaYPHHnxi3WO2uwwkSVaoMStvxJXb+E68+nCLnn2mGuB12p+VU/N5l8Fm+OCMt8VE8b Jp+cOHk698IIA/4we7K5ncnAmyQ1MHhspkB0ffmmazdeQe6EduO9XLEJgB7ySs2p34FU= X-Gm-Gg: Acq92OF95SPFwsXQTScxeocJ7Qyyu8Yf+s9XOMd8z8yMRBrjtNmd+GSPniQcWL9IXT4 43PhgQZxLC+dngAxksuA7zdeWo2zdSrFOPiJ/D2Nyq/4lSnJeuolidWoW3Ap7yICBfnZx0xCp7i YtUNmkn8ebUC6HGNF8CTovsRAi7x+6hNSWyTyq+dH+C9rzgUKDkJQxvv450/cVn940MtAoqIyyo /2Fo3etJ3ZwTFxjpfeTzgbg2dqKKR6n11yxA0joFw1rbfXwCq8sewmXFj37p2sjxctBtqbvvpMb 3yVngfU5liZpE0f7IBH1YrxZtMH3rJO/xE6exuBZ21SuuHtjQ92ySRzKtdk+mMj0oJcKy3HJprp gnekHl+c7jUvVfzaHmAk9T8/sZOY2oenrQ50O2ilp79WGkyFgiun2b+jW9XuCAU+nIS2WFaL8Md 2G X-Received: by 2002:a05:7301:4001:b0:2f3:dbfa:1955 with SMTP id 5a478bee46e88-301569f3016mr800980eec.34.1778658759397; Wed, 13 May 2026 00:52:39 -0700 (PDT) X-Received: by 2002:a05:7301:4001:b0:2f3:dbfa:1955 with SMTP id 5a478bee46e88-301569f3016mr800968eec.34.1778658758815; Wed, 13 May 2026 00:52:38 -0700 (PDT) Received: from [10.110.35.32] (i-global254.qualcomm.com. [199.106.103.254]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2f88914523csm20850189eec.29.2026.05.13.00.52.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 13 May 2026 00:52:38 -0700 (PDT) Message-ID: <8f5362ca-5513-4d9a-8922-6603783c9ae7@oss.qualcomm.com> Date: Wed, 13 May 2026 15:52:34 +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: y0qI1RlJ9WxV3gvWpLhkInFpN9wYvfLj X-Proofpoint-ORIG-GUID: y0qI1RlJ9WxV3gvWpLhkInFpN9wYvfLj X-Authority-Analysis: v=2.4 cv=aLTAb79m c=1 sm=1 tr=0 ts=6a042dc8 cx=c_pps a=PfFC4Oe2JQzmKTvty2cRDw==:117 a=JYp8KDb2vCoCEuGobkYCKw==:17 a=IkcTkHD0fZMA:10 a=NGcC8JguVDcA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=Um2Pa8k9VHT-vaBCBUpS:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=c92rfblmAAAA:8 a=pGLkceISAAAA:8 a=KQFOj9_g3FkfKAVhRwgA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=6Ab_bkdmUrQuMsNx7PHu:22 a=GvGzcOZaWPEFPQC_NcjD:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNTEzMDA3OCBTYWx0ZWRfX+WjH2iQGcZW0 NNVlXkIvJeZH7g4zu/0oavEbsAiO3iCKY0Y7sWMAUrSC8u6Ce6q/WKMhCTl/zsJTyJXK581esMP rQJge+/GjkSwBiWthB8hnK+m/9QqBqmKbgR54XEgxHprWyMJJopzg+HkQlj85vL/bmhuhalB1du 7pxvQYU7MkBG/NCoZbTSNDSifmckaObCGAaDHSyx14FpsCIPYt5nNWEVBy0fcHSfGRxFkQQN7S9 O8of4uq2Thk4VUnQtcAwXZYU8VGI0l63hJqijFNsQgTRFxLyketpBYmfGDI16U+YYq9EdURSlri YjBeBlPUXRw8NiU2cORUuXaV3o4pUWp2JO2GaZhvd1XiPwpYKbO3+s7qcU2tNHVbzACdqcINo8t 6SKuENrixDnIIe0iXvFwFWdo7qcsmYEaamPQG1GsPWlQQwalYxMb1DxiTE76hyqX/oZiSPgQTfr DVecSYJRW8CdgOlSblw== 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-11_05,2026-05-08_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 spamscore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 phishscore=0 impostorscore=0 bulkscore=0 malwarescore=0 priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2605050000 definitions=main-2605130078 Hi  Luiz On 4/30/2026 12:14 AM, Luiz Augusto von Dentz wrote: > Hi Shuai, > > On Wed, Apr 29, 2026 at 11:17 AM 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. > Btw, the following also seem valid although not introduced by this change: > > https://sashiko.dev/#/patchset/20260429121207.1306526-1-shuai.zhang%40oss.qualcomm.com I will check this and submit a new patch if it is issue. > >>> bt_dev_err(hdev, "rampatch file version did not match with firmware"); >>> err = -EINVAL; >>> goto done; >>> -- >>> 2.34.1 >>> >> >> -- >> Luiz Augusto von Dentz Thanks, Shuai > >