From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-io1-f50.google.com (mail-io1-f50.google.com [209.85.166.50]) (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 61C083C087 for ; Tue, 9 Jan 2024 17:54:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="ONGmHqBf" Received: by mail-io1-f50.google.com with SMTP id ca18e2360f4ac-7beda2e6794so33141239f.1 for ; Tue, 09 Jan 2024 09:54:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1704822842; x=1705427642; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=uvxQk9rfheLP9Xtji27sCGT3Sv4bNLZc44jbbgusrDU=; b=ONGmHqBfC1ejBCiK95L/gKcx3N81BvYLZ0b2EkYRCOJoWTJ9/Yhz4EdmUERPQWGhus FptUlXtgTzBIsA/xeUfVugvbhq8iALAGLmHftOKjPoYrJDeZbh4K1KTQg/vYQOJ+8yj9 +dCc+ruL4a31Dh1J9oHMbkzlOMLlucY9szbPg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704822842; x=1705427642; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=uvxQk9rfheLP9Xtji27sCGT3Sv4bNLZc44jbbgusrDU=; b=AzIWtSvts+8PiNDv37D2Ty2lgFkQnDvxcodTcVBDJovb6KeBJur0mQdeUax0fDNDwv bL+uulSCKVBT5kfB02cTLfYpp36s1XR4+rWb/xuvmDLZPbeeT9r55ZR7Dj+4GOpQKcut ZykNaqrOlZSjXKCZw+5/FmpkUb2wHWaC04mAnH9FXJzakWlQwrhege9UsTVWF5CsYhC6 LLzTSSHbSFeJtz2DU49c7859WitE/swHcUIc4ipLHzr5Yf7c16y+pLNzBbd2IgCj+p2I tsHdOQlPlHJmeiM+uK0JQA94dkH4fw2BvXaLjTZj5+xhU11YkgeLdV3eDA2OshimPse1 iXWQ== X-Gm-Message-State: AOJu0Yx7irYZpIEl4sDrxMSVVpqfM1yBBjVtmd/7thd1VhdyHTfEPw1S 6LwHo58/X/LFQlrk0qwgrC+Up7nMeg+9 X-Google-Smtp-Source: AGHT+IETNvPU0pqR+rjwETC6lClyltQG+AAsL2rUrDmov8iCP0gjm6NfVC+6GYU4F02uh16JW6lf7g== X-Received: by 2002:a5d:94ce:0:b0:7bc:2607:7caf with SMTP id y14-20020a5d94ce000000b007bc26077cafmr850204ior.21.1704822842469; Tue, 09 Jan 2024 09:54:02 -0800 (PST) Received: from localhost (110.41.72.34.bc.googleusercontent.com. [34.72.41.110]) by smtp.gmail.com with UTF8SMTPSA id e15-20020a6b500f000000b007bedb7d78b3sm441971iob.24.2024.01.09.09.54.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 09 Jan 2024 09:54:02 -0800 (PST) Date: Tue, 9 Jan 2024 17:54:01 +0000 From: Matthias Kaehlcke To: Johan Hovold Cc: Johan Hovold , 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 , 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 In-Reply-To: On Tue, Jan 09, 2024 at 06:12:26PM +0100, Johan Hovold wrote: > On Tue, Jan 09, 2024 at 04:50:59PM +0000, Matthias Kaehlcke wrote: > > > 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. > > > > We should not break existing devices. Their byte order for > > 'local-bd-address' may not adhere to the 'spec', however in practice > > it is the correct format for existing kernels. > > That depends on in what way the current devices are broken. > > Any machines that correctly specify their address in little-endian order > in the devicetree would no longer be configured using the wrong address. > So no problem there (except requiring users to re-pair their gadgets). > > And tools like btgmt is broken on all of these Qualcomm machine in any > case and would now start working as expected. So no problem there either > (unless user space had adapted an inverted the addresses to btmgmt). > > So the first question is whether there actually is any boot firmware out > there which passes the BD_ADDR in reverse order? Yes, (at least) the boot firmware for sc7180-trogdor devices. hexdump -C /proc/device-tree/soc\@0/geniqup\@8c0000/serial\@88c000/bluetooth/local-bd-address 00000000 8c fd f0 40 15 dc 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 > > I suggest adding a quirk like 'local-bd-address-msb-quirk' or > > 'qcom,local-bd-address-msb-quirk' to make sure existing devices keep > > working properly. > > I don't think that would work. If this is something that we really need > to handle, then there's probably no way around introducing new > compatible strings for boot firmware that isn't broken while maintaining > the current broken behaviour with respect to 'local-bd-address' for some > of the current ones. I think it should work for sc7180-trogdor. For these devices the device tree is bundled with the kernel image and can be updated. That might not be true for other devices though. Matthias