Received: by 2002:a05:6358:16cd:b0:dc:6189:e246 with SMTP id r13csp1453362rwl; Fri, 4 Nov 2022 14:17:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6bXL6aRSHWWe3c6WsH1J22wIUKRxskv1yTv003iqaW9UYSUSxUwD63JejssWNvZkHDHThp X-Received: by 2002:a05:6402:1cc1:b0:453:1517:94e4 with SMTP id ds1-20020a0564021cc100b00453151794e4mr37879538edb.399.1667596620173; Fri, 04 Nov 2022 14:17:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667596620; cv=none; d=google.com; s=arc-20160816; b=0Nk+jUltgkiE3nwPBvz6au9Wy08IziD1OuJDlS0E0GXNntSZPddoAHViMAJaGuqmdX hOjfOoDAB0iPfBCazr062ks6k8NJXHJgNrGGsG4Bkft+Ol23U6/8uNjjgFUrMmBwwxxV bmRvSAmLKCDyCH29fngVoYBr99WCIR6UKC8C5Jr1zM8BO5Mxvn+dNkNJjTAvkWx+pzy0 pz7zYErsMOqg5x3RT7rtc/RKSMwurOue9kLv7MvGwEzVeETnwYi8zNQauY7NQ6amfnzh by3iuOxto41o3DmPuT6Qyb6h+KJSISVDR6TjGUD83dSskofQ2dGa6jWMaQkhzUveNY6O yuTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :feedback-id:dkim-signature:dkim-signature; bh=tz6qvQQLm1zdUrv6Quh+x5j7yM/AMqQeKT8unbdl7VM=; b=x7608w03xC41Y9IEzTUpUv5/NaVMen+K3oD3+mIuwTJyqU8XS4t3qVoQ/52UpzLCoL wbRZogeYZsDvUnz7yupHeBLlUOp4cwfOb9wTrmS1EDGElstFKLr0UHjB00hgWN3Ey/x/ u0wiYD4sPMIKRBPN0MjEFJEcJC3jawC46s+cWrGp1v7q7mvXuY1vxLSVESIQXK+SYfQU 0QSPy/LCpPuttY9Nk1C9KC/3js7jH3QiFsv57m24EtXjwxCmNvnOZW5+vjsNquuIuF5x UBmORBNYAS9Wx86sI+FWU3Iey6DOoFkfJCKiqOGplAgUVZPlrdbrPkreIHF8A5K/xugv 3zSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@svenpeter.dev header.s=fm3 header.b=p8khVMUa; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b="OEc/LkwY"; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=svenpeter.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i13-20020aa7c70d000000b004637be0f76csi440193edq.186.2022.11.04.14.16.35; Fri, 04 Nov 2022 14:17:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@svenpeter.dev header.s=fm3 header.b=p8khVMUa; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b="OEc/LkwY"; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=svenpeter.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229925AbiKDVOj (ORCPT + 99 others); Fri, 4 Nov 2022 17:14:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229962AbiKDVOD (ORCPT ); Fri, 4 Nov 2022 17:14:03 -0400 Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7713050F34; Fri, 4 Nov 2022 14:13:49 -0700 (PDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id AFA743200922; Fri, 4 Nov 2022 17:13:47 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 04 Nov 2022 17:13:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svenpeter.dev; h=cc:cc:content-transfer-encoding:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667596427; x= 1667682827; bh=tz6qvQQLm1zdUrv6Quh+x5j7yM/AMqQeKT8unbdl7VM=; b=p 8khVMUaJkjz2KcE8r930f6TyEKGG2YnEAzU77tO5FOkzWvRAC25P5J1P2HtRXcVg vaHnw9S6rTsbh78lqixu0eMMRAHgQQ+3IcE3d+qpo+97omlnz0KzndtR/BPE6TJh VlUT2ARRk2X0RBt3IqXEC3KUV3wn8C9LQeB3pnbXCwrb9/tbpckCixmK4NH/pwqn BV9tuEKW4Nk3Rfh1tbkHXmDmIHKeEemnmK1du8SHzy0Xob3y/pHelCsoN317Poq6 7WDfSjqDf6R3e22ReApTB2zMce5TCgDkJow5BvYDMtWPvpmlrG/yts5Nogvo2i5h DBtdWuJ3AL6GyAUOYXkrw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1667596427; x=1667682827; bh=tz6qvQQLm1zdU rv6Quh+x5j7yM/AMqQeKT8unbdl7VM=; b=OEc/LkwYSiOLij+zQfRAVm+260cA2 TDDllmGScCm9WVpKQaRNThnCfxgC7NbHVZaNVxsdpkpQ30pzrLcsK7BexBgHTXUl lJ0fF9go23efGnOGnKe7BWH2ewhM2TIE+R0LmmTLJc9KnDn4yHyH+eOf/rusEsaR XoRNSw8MZcRb7KzUF/zxL3E1hxbulufLwh/1eL8oe92MW35f/eLUQo/CJrMZdciz 9fvpeLd+4q407pi2IqXDkz/frsBZKnuJA6fLAH+6c2nfBqXF3NZsdB67QpL5Npqf k91NLPYlHjoksHLstKLRsw/CkFJY6YmHZ+Yggs3fo35w7n8tK/mNxoptQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugddugeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufhvvghn ucfrvghtvghruceoshhvvghnsehsvhgvnhhpvghtvghrrdguvghvqeenucggtffrrghtth gvrhhnpeejieehheekgedvjefhveekjefguddtfefhteehtdeiffelkeeiuedufeelkeej geenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehsvh gvnhesshhvvghnphgvthgvrhdruggvvh X-ME-Proxy: Feedback-ID: i51094778:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 17:13:44 -0400 (EDT) From: Sven Peter To: Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz Cc: Sven Peter , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Krzysztof Kozlowski , Paolo Abeni , Rob Herring , Hector Martin , Alyssa Rosenzweig , asahi@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 6/7] Bluetooth: Add quirk to disable MWS Transport Configuration Date: Fri, 4 Nov 2022 22:13:02 +0100 Message-Id: <20221104211303.70222-7-sven@svenpeter.dev> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20221104211303.70222-1-sven@svenpeter.dev> References: <20221104211303.70222-1-sven@svenpeter.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Broadcom 4378/4387 controllers found in Apple Silicon Macs claim to support getting MWS Transport Layer Configuration, < HCI Command: Read Local Supported... (0x04|0x0002) plen 0 > HCI Event: Command Complete (0x0e) plen 68 Read Local Supported Commands (0x04|0x0002) ncmd 1 Status: Success (0x00) [...] Get MWS Transport Layer Configuration (Octet 30 - Bit 3)] [...] , but then don't actually allow the required command: > HCI Event: Command Complete (0x0e) plen 15 Get MWS Transport Layer Configuration (0x05|0x000c) ncmd 1 Status: Command Disallowed (0x0c) Number of transports: 0 Baud rate list: 0 entries 00 00 00 00 00 00 00 00 00 00 Signed-off-by: Sven Peter --- include/net/bluetooth/hci.h | 10 ++++++++++ include/net/bluetooth/hci_core.h | 3 +++ net/bluetooth/hci_sync.c | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 8cd89948f961..110d6df1299b 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -273,6 +273,16 @@ enum { * during the hdev->setup vendor callback. */ HCI_QUIRK_BROKEN_EXT_SCAN, + + /* + * When this quirk is set, the HCI_OP_GET_MWS_TRANSPORT_CONFIG command is + * disabled. This is required for some Broadcom controllers which + * erroneously claim to support MWS Transport Layer Configuration. + * + * This quirk can be set before hci_register_dev is called or + * during the hdev->setup vendor callback. + */ + HCI_QUIRK_BROKEN_MWS_TRANSPORT_CONFIG, }; /* HCI device flags */ diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 3cd00be0fcd2..7f585e5dd71b 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -1719,6 +1719,9 @@ void hci_conn_del_sysfs(struct hci_conn *conn); ((dev)->le_features[3] & HCI_LE_CIS_PERIPHERAL) #define bis_capable(dev) ((dev)->le_features[3] & HCI_LE_ISO_BROADCASTER) +#define mws_transport_config_capable(dev) (((dev)->commands[30] & 0x08) && \ + (!test_bit(HCI_QUIRK_BROKEN_MWS_TRANSPORT_CONFIG, &(dev)->quirks))) + /* ----- HCI protocols ----- */ #define HCI_PROTO_DEFER 0x01 diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c index 76c3107c9f91..d8e9eae17083 100644 --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c @@ -4258,7 +4258,7 @@ static int hci_read_local_pairing_opts_sync(struct hci_dev *hdev) /* Get MWS transport configuration if the HCI command is supported */ static int hci_get_mws_transport_config_sync(struct hci_dev *hdev) { - if (!(hdev->commands[30] & 0x08)) + if (!mws_transport_config_capable(hdev)) return 0; return __hci_cmd_sync_status(hdev, HCI_OP_GET_MWS_TRANSPORT_CONFIG, -- 2.25.1