linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: qca: fix wcn3991 device address check
@ 2024-04-25  7:55 Johan Hovold
  2024-04-25  8:34 ` bluez.test.bot
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Johan Hovold @ 2024-04-25  7:55 UTC (permalink / raw)
  To: Marcel Holtmann, Luiz Augusto von Dentz
  Cc: linux-bluetooth, linux-kernel, Johan Hovold, stable,
	Doug Anderson, Janaki Ramaiah Thota

Qualcomm Bluetooth controllers may not have been provisioned with a
valid device address and instead end up using the default address
00:00:00:00:5a:ad.

This address is now used to determine if a controller has a valid
address or if one needs to be provided through devicetree or by user
space before the controller can be used.

It turns out that the WCN3991 controllers used in Chromium Trogdor
machines use a different default address, 39:98:00:00:5a:ad, which also
needs to be marked as invalid so that the correct address is fetched
from the devicetree.

Qualcomm has unfortunately not yet provided any answers as to whether
the 39:98 encodes a hardware id and if there are other variants of the
default address that needs to be handled by the driver.

For now, add the Trogdor WCN3991 default address to the device address
check to avoid having these controllers start with the default address
instead of their assigned addresses.

Fixes: 00567f70051a ("Bluetooth: qca: fix invalid device address check")
Cc: stable@vger.kernel.org      # 6.5
Cc: Doug Anderson <dianders@chromium.org>
Cc: Janaki Ramaiah Thota <quic_janathot@quicinc.com>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
 drivers/bluetooth/btqca.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)


Luiz and Doug,

As the offending commit is now on its way into 6.9, let's just add the
default address that the Trogdor machines uses to the address check.

We can always amend this when/if Qualcomm provides some more details,
or, in the worst case, when users report that they need to re-pair their
Bluetooth gadgets if there are further variations of the default
address.

Johan



diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
index 216826c31ee3..cfa71708397b 100644
--- a/drivers/bluetooth/btqca.c
+++ b/drivers/bluetooth/btqca.c
@@ -16,6 +16,7 @@
 #define VERSION "0.1"
 
 #define QCA_BDADDR_DEFAULT (&(bdaddr_t) {{ 0xad, 0x5a, 0x00, 0x00, 0x00, 0x00 }})
+#define QCA_BDADDR_WCN3991 (&(bdaddr_t) {{ 0xad, 0x5a, 0x00, 0x00, 0x98, 0x39 }})
 
 int qca_read_soc_version(struct hci_dev *hdev, struct qca_btsoc_version *ver,
 			 enum qca_btsoc_type soc_type)
@@ -638,8 +639,10 @@ static int qca_check_bdaddr(struct hci_dev *hdev)
 	}
 
 	bda = (struct hci_rp_read_bd_addr *)skb->data;
-	if (!bacmp(&bda->bdaddr, QCA_BDADDR_DEFAULT))
+	if (!bacmp(&bda->bdaddr, QCA_BDADDR_DEFAULT) ||
+	    !bacmp(&bda->bdaddr, QCA_BDADDR_WCN3991)) {
 		set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks);
+	}
 
 	kfree_skb(skb);
 
-- 
2.43.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: Bluetooth: qca: fix wcn3991 device address check
  2024-04-25  7:55 [PATCH] Bluetooth: qca: fix wcn3991 device address check Johan Hovold
@ 2024-04-25  8:34 ` bluez.test.bot
  2024-04-25 16:05 ` [PATCH] " Doug Anderson
  2024-04-25 16:30 ` patchwork-bot+bluetooth
  2 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2024-04-25  8:34 UTC (permalink / raw)
  To: linux-bluetooth, johan+linaro

[-- Attachment #1: Type: text/plain, Size: 2749 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=847735

---Test result---

Test Summary:
CheckPatch                    PASS      0.67 seconds
GitLint                       PASS      0.32 seconds
SubjectPrefix                 PASS      0.12 seconds
BuildKernel                   PASS      30.02 seconds
CheckAllWarning               PASS      32.43 seconds
CheckSparse                   PASS      38.00 seconds
CheckSmatch                   FAIL      36.16 seconds
BuildKernel32                 PASS      28.87 seconds
TestRunnerSetup               PASS      519.69 seconds
TestRunner_l2cap-tester       PASS      18.30 seconds
TestRunner_iso-tester         PASS      30.96 seconds
TestRunner_bnep-tester        PASS      4.69 seconds
TestRunner_mgmt-tester        FAIL      111.19 seconds
TestRunner_rfcomm-tester      PASS      7.19 seconds
TestRunner_sco-tester         PASS      10.92 seconds
TestRunner_ioctl-tester       PASS      7.60 seconds
TestRunner_mesh-tester        PASS      5.72 seconds
TestRunner_smp-tester         PASS      6.72 seconds
TestRunner_userchan-tester    PASS      4.87 seconds
IncrementalBuild              PASS      27.66 seconds

Details
##############################
Test: CheckSmatch - FAIL
Desc: Run smatch tool with source
Output:

Segmentation fault (core dumped)
make[4]: *** [scripts/Makefile.build:244: net/bluetooth/hci_core.o] Error 139
make[4]: *** Deleting file 'net/bluetooth/hci_core.o'
make[3]: *** [scripts/Makefile.build:485: net/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:485: net] Error 2
make[2]: *** Waiting for unfinished jobs....
Segmentation fault (core dumped)
make[4]: *** [scripts/Makefile.build:244: drivers/bluetooth/bcm203x.o] Error 139
make[4]: *** Deleting file 'drivers/bluetooth/bcm203x.o'
make[4]: *** Waiting for unfinished jobs....
Segmentation fault (core dumped)
make[4]: *** [scripts/Makefile.build:244: drivers/bluetooth/bpa10x.o] Error 139
make[4]: *** Deleting file 'drivers/bluetooth/bpa10x.o'
make[3]: *** [scripts/Makefile.build:485: drivers/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:485: drivers] Error 2
make[1]: *** [/github/workspace/src/src/Makefile:1919: .] Error 2
make: *** [Makefile:240: __sub-make] Error 2
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 492, Passed: 489 (99.4%), Failed: 1, Not Run: 2

Failed Test Cases
LL Privacy - Add Device 7 (AL is full)               Failed       0.198 seconds


---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Bluetooth: qca: fix wcn3991 device address check
  2024-04-25  7:55 [PATCH] Bluetooth: qca: fix wcn3991 device address check Johan Hovold
  2024-04-25  8:34 ` bluez.test.bot
@ 2024-04-25 16:05 ` Doug Anderson
  2024-04-25 16:30 ` patchwork-bot+bluetooth
  2 siblings, 0 replies; 4+ messages in thread
From: Doug Anderson @ 2024-04-25 16:05 UTC (permalink / raw)
  To: Johan Hovold
  Cc: Marcel Holtmann, Luiz Augusto von Dentz, linux-bluetooth,
	linux-kernel, stable, Janaki Ramaiah Thota

Hi,

On Thu, Apr 25, 2024 at 12:56 AM Johan Hovold <johan+linaro@kernel.org> wrote:
>
> Qualcomm Bluetooth controllers may not have been provisioned with a
> valid device address and instead end up using the default address
> 00:00:00:00:5a:ad.
>
> This address is now used to determine if a controller has a valid
> address or if one needs to be provided through devicetree or by user
> space before the controller can be used.
>
> It turns out that the WCN3991 controllers used in Chromium Trogdor
> machines use a different default address, 39:98:00:00:5a:ad, which also
> needs to be marked as invalid so that the correct address is fetched
> from the devicetree.
>
> Qualcomm has unfortunately not yet provided any answers as to whether
> the 39:98 encodes a hardware id and if there are other variants of the
> default address that needs to be handled by the driver.
>
> For now, add the Trogdor WCN3991 default address to the device address
> check to avoid having these controllers start with the default address
> instead of their assigned addresses.
>
> Fixes: 00567f70051a ("Bluetooth: qca: fix invalid device address check")
> Cc: stable@vger.kernel.org      # 6.5
> Cc: Doug Anderson <dianders@chromium.org>
> Cc: Janaki Ramaiah Thota <quic_janathot@quicinc.com>
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
> ---
>  drivers/bluetooth/btqca.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
>
> Luiz and Doug,
>
> As the offending commit is now on its way into 6.9, let's just add the
> default address that the Trogdor machines uses to the address check.
>
> We can always amend this when/if Qualcomm provides some more details,
> or, in the worst case, when users report that they need to re-pair their
> Bluetooth gadgets if there are further variations of the default
> address.

I can confirm that this at least gets my boards using their proper BT
address. While I still wonder if this is the best strategy to go with,
I can agree that this is an expedient fix to land it and works:

Tested-by: Douglas Anderson <dianders@chromium.org>

We can continue discussion in response to your original patch [1] to
figure out if this is going to be our long term strategy or not.

[1] https://lore.kernel.org/r/20240416091509.19995-1-johan+linaro@kernel.org

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Bluetooth: qca: fix wcn3991 device address check
  2024-04-25  7:55 [PATCH] Bluetooth: qca: fix wcn3991 device address check Johan Hovold
  2024-04-25  8:34 ` bluez.test.bot
  2024-04-25 16:05 ` [PATCH] " Doug Anderson
@ 2024-04-25 16:30 ` patchwork-bot+bluetooth
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+bluetooth @ 2024-04-25 16:30 UTC (permalink / raw)
  To: Johan Hovold
  Cc: marcel, luiz.dentz, linux-bluetooth, linux-kernel, stable,
	dianders, quic_janathot

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Thu, 25 Apr 2024 09:55:03 +0200 you wrote:
> Qualcomm Bluetooth controllers may not have been provisioned with a
> valid device address and instead end up using the default address
> 00:00:00:00:5a:ad.
> 
> This address is now used to determine if a controller has a valid
> address or if one needs to be provided through devicetree or by user
> space before the controller can be used.
> 
> [...]

Here is the summary with links:
  - Bluetooth: qca: fix wcn3991 device address check
    https://git.kernel.org/bluetooth/bluetooth-next/c/0a0f9014b784

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-04-25 16:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-25  7:55 [PATCH] Bluetooth: qca: fix wcn3991 device address check Johan Hovold
2024-04-25  8:34 ` bluez.test.bot
2024-04-25 16:05 ` [PATCH] " Doug Anderson
2024-04-25 16:30 ` patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).