Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp206579rdb; Thu, 18 Jan 2024 00:40:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IFSoHFZFMhIPJvb/PUgYGBpLNcfbSKPESjLDeZvl/mc3dvbYTS+tcZ7QvS8X01PHjprmm4L X-Received: by 2002:a05:6a20:2d0f:b0:19a:ed16:b3cb with SMTP id g15-20020a056a202d0f00b0019aed16b3cbmr622783pzl.23.1705567248559; Thu, 18 Jan 2024 00:40:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705567248; cv=pass; d=google.com; s=arc-20160816; b=u25ZBx/3HZNXDrUYb3d72tJz54g2QZjSp4baasKAH/4cqYO0THvb6J1jeqrYqRsyKm KL+c/aIOoNgoJiWGCUaOeH9BZtq1uhhRP67yvE+ocXBWotUz3bAYs3nEjJHwulcU+5JY OdCmEAMz+jh9WzElbdvRuQlLvTlpYydYwzVAxhoRZlPdFdj25uqy4WEqASgwD+FtUaeW t3Tfy/a298t9EeGc+IT3zvOGMp2w3y8aqmUUfGsvgn3zdZ90GoQ5/rJB28MSO54PZiYD spAAluxo41HJGHJLSnjk4jZ2vOYCYwfhAYjBdKJl7IwC+l938lWHvGl2QhqtP7h0hGC+ moyQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=+SLauYKRoZ6+G3q7LkBObCwhFA2jK5znzoi84U/sZV0=; fh=d2O2j3/8i8eIS6nOgimeH0oNyllwbvJ9HM+FgxOb+TU=; b=alRGT4SAHSJqEjO4ymQugoRid9E5Jy/G3z+e5OWP1flRi6pkS9mQBbTxqZ6/CtM7rE OcCxFFZRfZlGHdactPz9uOxbuRRPrrXqvV65u7DEQ5lofDp+YdQukjMqAPUY9Rs1EYCL 7loToT8zAJo9LEAR1hEq/b+nvNbWlOS80mF1l0NI6rW8Odh+jVO6jkhvBCrwEMJYZlvs fBjBs/lFv31HYscmFbRu/X5cPgm5TJjFM27K0B1rdo/UR3+uwQt65vtK/sB5BEl2acLH re5GPxM9WyhVdmrdPOr3fXCyH/GKhxuRt1Otb6/cMaXeH2lN+8VRyn2J2opF0og2CWEC 2Xdg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="G/upmPKV"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-bluetooth+bounces-1182-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-1182-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id jg3-20020a17090326c300b001d46bc34e55si1049205plb.607.2024.01.18.00.40.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 00:40:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-1182-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="G/upmPKV"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-bluetooth+bounces-1182-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-1182-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 361B8287837 for ; Thu, 18 Jan 2024 08:40:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 34821125B0; Thu, 18 Jan 2024 08:40:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="G/upmPKV" X-Original-To: linux-bluetooth@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 884A511729; Thu, 18 Jan 2024 08:40:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705567229; cv=none; b=K/cUhqfnjdmHSPkwvb8/GFu93PO29Bu31GOsdQH+Hy+XgSv2V0NMMdnLfWa4f5clq8HNBg/tqd0PrqcuchnKUpYlw5SnOUy1upkgYSs94VHScOapljjBWh3vZF7eFbJayzjon9Nddpvciq89rGwmOqvcevgxKVGVSsE2xxYeLhI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705567229; c=relaxed/simple; bh=Nae8yxhkYkovkItw8eTsuNr+khFIydZsusz95L+/xEI=; h=Received:DKIM-Signature:Received:Date:From:To:Cc:Subject: Message-ID:References:MIME-Version:Content-Type: Content-Disposition:Content-Transfer-Encoding:In-Reply-To; b=dsZ29Ko4atyFO+6Gv8fZd7RjvSQf7g3zHJATRCSwH8TwdcJA7Jfg2YeKRRizQHzLRHMJXtLnRvLq2/+jqv8E9vconfBzTTOVxrARHT82mUCfEqZtirNYJ+uOge6IdApEXNlRELWkanL+xJYtbKQJ3GKMRR7vGqP4yOehMPT6XT0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=G/upmPKV; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14B9CC433C7; Thu, 18 Jan 2024 08:40:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705567229; bh=Nae8yxhkYkovkItw8eTsuNr+khFIydZsusz95L+/xEI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=G/upmPKVDD44TDRIpF4V6xyDI/dgH7sfI1UtNYg0/BhboT42VldbTAnwh8mOsyaC/ hE0bMJrMezddutwnFZFfDE2xc+otlnK77yr63zeoOCUiyo/X6TMpKd3Y5eE/AZ03ag h4M44ftMMc+krB8lOvLZwQeoqkywiaWclPNuwWziZ/n8b9msNC7ODq+0F/crmJlstO hQ564Me3eF3DLla+0kNDe/xIQbVpnnFRZ5G5oS+CW+RmTHL7Z14ytb5WqwsX3+wQ2w vZl0VYKWLB9lmN7/q/WF1XKld/fvMY5aAF3d4Eux4/EPlGoqi6k8Q/VcPqGHtjEN39 IKlUKioytNwAQ== Received: from johan by xi.lan with local (Exim 4.96.2) (envelope-from ) id 1rQNwx-0001xg-08; Thu, 18 Jan 2024 09:40:35 +0100 Date: Thu, 18 Jan 2024 09:40:35 +0100 From: Johan Hovold To: Luiz Augusto von Dentz Cc: Matthias Kaehlcke , Johan Hovold , Marcel Holtmann , Johan Hedberg , 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 , Doug Anderson , Stephen Boyd 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Wed, Jan 17, 2024 at 05:49:07PM -0500, Luiz Augusto von Dentz wrote: > On Wed, Jan 10, 2024 at 3:12 AM Johan Hovold wrote: > > On Tue, Jan 09, 2024 at 05:54:01PM +0000, Matthias Kaehlcke wrote: > > > hciconfig > > > hci0: Type: Primary Bus: UART > > > BD Address: 8C:FD:F0:40:15:DC ACL MTU: 1024:8 SCO MTU: 240:8 > > > UP RUNNING > > > RX bytes:1700 acl:0 sco:0 events:95 errors:0 > > > TX bytes:128949 acl:0 sco:0 commands:578 errors:0 > > > > And any user space tool overriding the address would currently need to > > provide the address in reverse order on Qualcomm platforms like this > > one (e.g. if generating the address for privacy reasons). > > Perhaps we could attempt to resolve the address byteorder, in > userspace we use hwdb_get_company to resolve the company but since > this shall only really care about Qualcomm range(s) perhaps we can > hardcode them check in which order the address is, that said if the > device is configured with a Static Random Address then that would not > work, but that is only really possible for BLE only devices. It's not just Qualcomm ranges; The Lenovo ThinkPad X13s that I noticed this on has been assigned a Wistron OUI, for example. We're still hoping to learn how to retrieve this address (from the secure world firmware) so that we can set it directly from the driver, but for now it needs to be set using btmgmt (or the local-bd-address devicetree property). As was discussed here: https://github.com/bluez/bluez/issues/107 it would be useful to teach bluetoothd to (generate and) set an address for devices that lack (accessible) persistent storage. And any such generic tool would need to work using the standard interfaces and the address endianness that those interfaces expect. And from skimming the Bluetooth spec, I was under the impression that random addresses applied also to non-BLE devices (e.g. requiring the two most-significants bits to be 1). But to summarise, I don't really see any way around fixing the Qualcomm driver. Johan