Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp1452785rwj; Sun, 18 Dec 2022 08:28:08 -0800 (PST) X-Google-Smtp-Source: AMrXdXtROtGd6RzkM3OG51pNT5iXRNiEQNv7cF4wJuLHm3w6SXYjwsxr/Fn1e4Y4J+YValHwZqlz X-Received: by 2002:a05:6a21:78a2:b0:af:e893:fa52 with SMTP id bf34-20020a056a2178a200b000afe893fa52mr11741473pzc.22.1671380887764; Sun, 18 Dec 2022 08:28:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671380887; cv=none; d=google.com; s=arc-20160816; b=iXQeXDuLbiRi5LKatZ/ysXPcT1Xus5rSCKekeC6wfHZG+4kIkDUWI7kaH/qu9K6F9u RiujBZZ31CKbXNdKNis8VQJwnEgCSygL8bn1qLcMC/R/7p+2tIdScIU2EaqcGmhKh6ya ME7lXiASEzLsTyBzIzrp/zesQGA6O6RKPem81OPZ8dTjhwvl6ELnaBOkw6fxjdZphMTL qhGEhvL8XwUhceUGHHpglTBuiDQ1SDDkzEAL0jbm9d53JqyCVyz4bLTtB9qItrXznKDk 2+wSPuFA+InqjpEwBC+J4mA9zFSSejQWjd+iEw+s03Jat2vF/xAJzO15lKBUJ0iunJpq TrvA== 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 :dkim-signature; bh=TeKLG2VluoXyL0pg6LP+AKiGKft9vnwr5F6zStIhUPg=; b=DN/XqH30DdYgQCbidsKqkm8RUpzbjBLZVZBIGwkiMJ0NG6WQ7xEute9Jfu6NdCKMAd p0wdBEZC59NY5n3kmjesBYfmYCKKFUCQAfUBSFZ1oXP8Tm2iO0P5dnkUWk+EmqrSM2GM 7ihhLmyqPhcsrKAE43IkJ83PyU/m5PhMenZXcGn83EPVsNp5xCHFAokCXDFiH0oU6T3g 0xSVbSVLqPJBx4nIH+yRIJHr0CiOlQn7JEDNzCd67NB1wwLar65oRVnYcqFViATnu6EH xFdjMvls2tPvwPGQY+Mmm42+dOwFu3qjE4ataK5HnOgT/d2dG3S9ft9awJM88gbt02uL RPWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="KTqXXX/f"; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i65-20020a639d44000000b00457f4e8e21esi8950250pgd.731.2022.12.18.08.27.54; Sun, 18 Dec 2022 08:28:07 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b="KTqXXX/f"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231856AbiLRQUE (ORCPT + 99 others); Sun, 18 Dec 2022 11:20:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231673AbiLRQTV (ORCPT ); Sun, 18 Dec 2022 11:19:21 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EB0E1181F; Sun, 18 Dec 2022 08:07:56 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 86F54B801C0; Sun, 18 Dec 2022 16:07:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F22E5C433F0; Sun, 18 Dec 2022 16:07:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1671379658; bh=zuivJDDa6t3bP4XeCrzKE0ZbuKINDY+r/1FxTcakRjU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KTqXXX/foeS5hLSlLBZbgk6aDIMq3dsAO+EvYkJKPIBg4SGfZQ6jlUVGSkV/bhCaf lob1ezvduQ6IPnr4CNSMzywx/SQjxNRo37RFx2yP2qcHNXyAp+tHsHJlUdCeZlSNP5 5yMvOxr4JBcP7L93b3p8409fW+6IgfiwccdqxbfWpyVubQAapsLYgeacNFH9qxl1+T fAIc/cWVAM2hRD0aImNzMNlW+0fhdtNmnESLeOkJ22OthaJ67tf2wZuVPVbR7H+fMp JaK5aiojzT47NtTK7N9mc/5SOfqNjjuxEOctX8osUZgxd8V6uIIhIcAHGSr9XAp94r u2A+8ZOQ8ZfWA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Sven Peter , Luiz Augusto von Dentz , Sasha Levin , marcel@holtmann.org, johan.hedberg@gmail.com, luiz.dentz@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 6.1 85/85] Bluetooth: Add quirk to disable MWS Transport Configuration Date: Sun, 18 Dec 2022 11:01:42 -0500 Message-Id: <20221218160142.925394-85-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221218160142.925394-1-sashal@kernel.org> References: <20221218160142.925394-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,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 From: Sven Peter [ Upstream commit ffcb0a445ec2d5753751437706aa0a7ea8351099 ] 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 Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- 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 d8abeac2fc1e..7a381fcef939 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -284,6 +284,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 1fc693122a47..3a68d9bc43b8 100644 --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c @@ -4261,7 +4261,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.35.1