From patchwork Fri Nov 4 21:13:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter X-Patchwork-Id: 15801 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp642185wru; Fri, 4 Nov 2022 14:17:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7dtcdKjU2W0jJ0cxxhxrzr5QP+J7zuPu+a70xdrjqYWzV3HvrWsUi5orJUuJguEyEPkrg0 X-Received: by 2002:a17:902:f252:b0:186:9efb:7203 with SMTP id j18-20020a170902f25200b001869efb7203mr36637613plc.12.1667596649122; Fri, 04 Nov 2022 14:17:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667596649; cv=none; d=google.com; s=arc-20160816; b=QzB/Slf42CraF95KJjIeTYbalAVf+AR4HZqIAH8Vo2lyFkuRQTvfkj7jn81Ht/QODq 0Pr7w+CxsX3XjZIOBVPeCjf0sOJJWI6JEZl1MJN9K/J1D/iqgtVuDquCmqO3/5XB/Swq dVCBPeVMGhIZnQZJLVfSZgogAktC15vD/U3w5VMjwYZfailh3kZ0BBPIjrVo5h5Vj8Si /UY94iwvfY11CJXXbmMuu1gXq6nCH8JJqXPooEBxwkOniEKoLAbT7C1Z5uKrXQToSAG3 oEHY2hxvv8KyP7PLA3INcGjpWVnLULut0PvN4C4XM19hKeI2rkxWzlHxChh9T3G1bjbx 4KkQ== 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=tL8ybXI3g2AFDh2S6ErMC3doVRKPsHy6jlkY2nGDMMpthHh2EEIz8KJHhJDAPx16TA sVEVhaH3586WpUWcOy5a+edGGbScLojAr8FSKu5FfSNA46CW3W/8d2ztyH7UBkdo4lu0 ieHea+LR+g4NvZAw8NhhV5Ba8rh1HzemQP0QeSWfkf4Q0WOny+QsLtlK6or0Fdw0v0hF iuNAb5sX76HESNCXspSA1kX1/HQCcaTfM/AnSgCYv4dMUNnMeSd21CS5g5OjI1VRNIWO jQ+Tr74HxxhrYXlIXga0YX5IDBLfSiV705bP6/XQVI8lI6dFV9a87ys+NLMfGi6SoOIe WEPQ== 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-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=svenpeter.dev Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y3-20020a655b03000000b0043cb43f584fsi719923pgq.482.2022.11.04.14.17.15; Fri, 04 Nov 2022 14:17:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 S230103AbiKDVOk (ORCPT + 99 others); Fri, 4 Nov 2022 17:14:40 -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 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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748601823976406427?= X-GMAIL-MSGID: =?utf-8?q?1748601823976406427?= 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,