Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp3773994rdb; Wed, 27 Dec 2023 22:08:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IHkgLn7ve8GydYyc+xZKoC5KW2la02TdIxk7zCoeJDEtOSs8Ycp9kjkm9TRnPjNexYESf1d X-Received: by 2002:a81:5403:0:b0:5de:8547:a6a5 with SMTP id i3-20020a815403000000b005de8547a6a5mr6962600ywb.70.1703743729312; Wed, 27 Dec 2023 22:08:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703743729; cv=none; d=google.com; s=arc-20160816; b=QVMdBSuVJdzH2/4rLyynkhHtqOETtT432njIv2HUdc8kq15UrgsUfiAqHnHsaeowGI UcC9HsJw5Pf/TAITeXxsgLEBawWC0t/gOAf1bAkHxtfC4lsBtMep4huPo1taPUb5Ej74 fc9Dm0vvYJePWH0V9r0+7+O627r/4mpUYRNBzi0JhMbPp8LNAsQBgrr/schvYbnAQqTp mPghgiGTCqieVh/v2DkVW3/5MdO55eDCPKeOoCMesIaFz2uZ5+WCzbUd0+5P3s+yIIlV +tw0dtSTbBsbWDe1ANp5xQExMIZheaf9cOmMDXreuVAnRDS8aq27CNlarDqgdO2zm1yI N1Ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=aosScdao50JvD+FkhnMchhWWCGONs68asFRqPHCBmPI=; fh=GqMan3lZeG0lTTCczkp3Lc8tVOYyl74Kder+iv5RMV8=; b=I/GXekxwjSF0oc2hXSvfPWWYFUviXZaALn0RySpmUa2tUrtrzO9ghUdPPOwdImootD Al+4IdPBZ2no26gD8uQSTXODG/peL89su6HF3Hb0Kkbfhrz/dVNNLBqkE33ZSg8XhWbR KGFsuQp0L/OKiO9t35FOuwBKUJ7KZyWFXx6HW4IYCacj9KOMRQC88jLS09T8eB9kL+h9 lRUV70f+ZV1/un5v3UmB9uzs8vQ6CSgCTIo6PzUw/FRy9CJTrGJsYG26YvrxPbJQJ12i UCgHqVJSy3xwT9gpUDpmshEcA1KKZ7DypU7r5Slnh6OjFuoxa7M8aysA/jC5XQtty1US 1N5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@trvn.ru header.s=mail header.b=ZTRdhT1y; spf=pass (google.com: domain of linux-bluetooth+bounces-780-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-780-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=trvn.ru Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id jf8-20020a0562142a4800b0068036845503si5568992qvb.580.2023.12.27.22.08.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Dec 2023 22:08:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-780-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@trvn.ru header.s=mail header.b=ZTRdhT1y; spf=pass (google.com: domain of linux-bluetooth+bounces-780-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-780-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=trvn.ru Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 0D8DA1C21B6F for ; Thu, 28 Dec 2023 06:08:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 262E43C00; Thu, 28 Dec 2023 06:08:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=trvn.ru header.i=@trvn.ru header.b="ZTRdhT1y" X-Original-To: linux-bluetooth@vger.kernel.org Received: from box.trvn.ru (box.trvn.ru [194.87.146.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 78AD01FDD; Thu, 28 Dec 2023 06:08:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=trvn.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=trvn.ru Received: from authenticated-user (box.trvn.ru [194.87.146.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by box.trvn.ru (Postfix) with ESMTPSA id 5E86E40564; Thu, 28 Dec 2023 11:08:29 +0500 (+05) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=trvn.ru; s=mail; t=1703743710; bh=nOX6jjTicKxqmOSERrqk583i64MzTIyy5OLB82ZzTv8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ZTRdhT1yd+lcRCUOlGTMlRLWUJP6aBO4M+m5XV3w8tint5euG4BSa94c+xsKq4+m/ hSPud5i0yagcLi3Bcmd9w/QEi+HYqz3yu+GyhBZQi/f4TCd3xVSoYjZTjob+IVxTm3 dLf/5BA6Wk+MKXn2WkKRQVmC9zfeZb7L2Ke3E+2bWfDzN+4WskCBxtVnPvv0Eai1uP Wi4vNJqj6uGhBWpAh4EDY2l1bxhi92kr4Hr5fyX7bjSBQ+uxjP2gmUCf5isnyRJz+R JwSu6yfUhYY9a1+27hT05cju82qtA7fDrvUGR9hcKAr1GZOKVNafGVLwHnUW5mrFzs 1pbHn8COU8Zuw== Date: Thu, 28 Dec 2023 11:08:26 +0500 From: Nikita Travkin To: Johan Hovold Cc: Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz , Bjorn Andersson , Konrad Dybcio , linux-bluetooth@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Balakrishna Godavarthi , Matthias Kaehlcke Subject: Re: [PATCH] Bluetooth: qca: fix device-address endianness Message-ID: References: <20231227180306.6319-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231227180306.6319-1-johan+linaro@kernel.org> On Wed, Dec 27, 2023 at 07:03:06PM +0100, Johan Hovold wrote: > The WCN6855 firmware on the Lenovo ThinkPad X13s expects the Bluetooth > device address in MSB order when setting it using the > EDL_WRITE_BD_ADDR_OPCODE command. > > Presumably, this is the case for all non-ROME devices which all use the > EDL_WRITE_BD_ADDR_OPCODE command for this (unlike the ROME devices which > use a different command and expect the address in LSB order). > > Reverse the little-endian address before setting it to make sure that > the address can be configured using tools like btmgmt or using the > 'local-bd-address' devicetree property. > > Note that this can potentially break systems with boot firmware which > has started relying on the broken behaviour and is incorrectly passing > the address via devicetree in MSB order. > > Fixes: 5c0a1001c8be ("Bluetooth: hci_qca: Add helper to set device address") > Cc: stable@vger.kernel.org # 5.1 > Cc: Balakrishna Godavarthi > Cc: Matthias Kaehlcke > Signed-off-by: Johan Hovold The same issue was present on sc7180 (qcom,wcn3991-bt) and this patch fixes it. Tested-by: Nikita Travkin # sc7180 Thanks! > --- > > Hi Qualcomm people, > > Could you please verify with your documentation that all non-ROME > devices expect the address provided in the EDL_WRITE_BD_ADDR_OPCODE > command in MSB order? > > I assume this is not something that anyone would change between firmware > revisions, but if that turns out to be the case, we'd need to reverse > the address based on firmware revision or similar. > > Johan > > > drivers/bluetooth/btqca.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c > index fdb0fae88d1c..29035daf21bc 100644 > --- a/drivers/bluetooth/btqca.c > +++ b/drivers/bluetooth/btqca.c > @@ -826,11 +826,15 @@ EXPORT_SYMBOL_GPL(qca_uart_setup); > > int qca_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr) > { > + bdaddr_t bdaddr_swapped; > struct sk_buff *skb; > int err; > > - skb = __hci_cmd_sync_ev(hdev, EDL_WRITE_BD_ADDR_OPCODE, 6, bdaddr, > - HCI_EV_VENDOR, HCI_INIT_TIMEOUT); > + baswap(&bdaddr_swapped, bdaddr); > + > + skb = __hci_cmd_sync_ev(hdev, EDL_WRITE_BD_ADDR_OPCODE, 6, > + &bdaddr_swapped, HCI_EV_VENDOR, > + HCI_INIT_TIMEOUT); > if (IS_ERR(skb)) { > err = PTR_ERR(skb); > bt_dev_err(hdev, "QCA Change address cmd failed (%d)", err); > -- > 2.41.0