Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2172397pxb; Fri, 25 Mar 2022 12:23:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaiN8vlrXNMu0aBx95Q0r3hmEpgYouXVhdYCuxKG4NzFWiw1eC2RPNyHBOnsMQHcMsTs5l X-Received: by 2002:a17:902:daca:b0:154:aa89:f12f with SMTP id q10-20020a170902daca00b00154aa89f12fmr13650370plx.98.1648236188009; Fri, 25 Mar 2022 12:23:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648236188; cv=none; d=google.com; s=arc-20160816; b=b3yLoul8RDP/8J/vpoQDiaQHT6Q8LuPlE7KYYzAV9mkIYbCRXRn+Tkp6z5FE0Yk0cw PMjrCPTlrfLcUE67ohH2QMgbmXC3xpuacSzY/RKtn7bg7bOEcrKBb6P15I7f8dLdt22A SKtgIgetR0uZel8CeqT9+0dh+pJOzN7LZ6aZtT6LE8H0fUiTjLHlVyr4wIh9OVOxVd3i lyBrJDzckzxJLhJ0iG0MsTmePFFbHhgxNSz0yM27qBCZ40t7tcr3z+fMRn+OiZ2MgEMC bBiBEYv+cif5oAKsuXKpu6ve4mF5WMstIRMTCNYa3vfY0jbTA7gifRox4+Mns0hFUQBf NQVw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=B+hcP7g3vaTTsc7wpePe+XFt5ihn0zf6KSis6WIsefg=; b=uIztNmfkR3oNVvCqGqKvaITEWoFdmvbHfZPhTdHlJ7l5ygn0zrVQRnEMR2PmYnwZCy FNvAXYZzwImEpZKnorEZAeu93qpOoM22g2BV+NTCN8rfH4mIIN9Yt4gixZKVpRfoS5Iz 2Q/cgaO7g9rB9JikGDFmR3akQeoCmQekojJA6GTqDRZYaY2vcuW5uIsYZb5QcsS5kri+ AoeAmXMMaIWT4QGJckA1FF1iVkj5N0Oha+ZnJunLTDyVEz24JKQPIRVH2BXn7LsR/c6W JO3zNCOohxfA52NRLhaZVpanVQTjS7KxbhkxMYjHgI2WH2PxNmcMw4PFe84Dz/sHRLSj qU5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Rw7CDsXL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id m16-20020a056a00081000b004fa3a8dffbfsi3935033pfk.118.2022.03.25.12.23.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 12:23:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Rw7CDsXL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 954C217FD2A; Fri, 25 Mar 2022 11:29:18 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358508AbiCYPa6 (ORCPT + 99 others); Fri, 25 Mar 2022 11:30:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377941AbiCYPYo (ORCPT ); Fri, 25 Mar 2022 11:24:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61BB0EAC92; Fri, 25 Mar 2022 08:19:23 -0700 (PDT) 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 BA176B82865; Fri, 25 Mar 2022 15:19:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05CDAC340E9; Fri, 25 Mar 2022 15:19:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1648221560; bh=JdQzAi/hwTPPFKOBVImriiqmuLWSX3nkNyNbJttnU+o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rw7CDsXLMYuaKqfy9eikk4WyaAxC0IeOUBLLkL2907Cpznf4sJ+w9vNdpUEiK0acq vkTndj5ocrXg2Fbbwq+X/fHtTEcuhv7Oqg5mIqu1YitxKYkcum4fTdBJHJ69aQlHDP m4rgpqcTdL2P3vFMXLeZNpjSQ88wadWaEpCOgWQ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= , Mateus Lemos , Ismael Ferreras Morezuelas , Marcel Holtmann Subject: [PATCH 5.17 28/39] Bluetooth: btusb: Use quirk to skip HCI_FLT_CLEAR_ALL on fake CSR controllers Date: Fri, 25 Mar 2022 16:14:43 +0100 Message-Id: <20220325150421.047518443@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220325150420.245733653@linuxfoundation.org> References: <20220325150420.245733653@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 From: Ismael Ferreras Morezuelas commit b3cf94c8b6b2f1a2b94825a025db291da2b151fd upstream. Another subset of the more recent batch of Chinese clones aren't specs-compliant and seem to lock up whenever they receive a HCI_OP_SET_EVENT_FLT with flt_type set to zero/HCI_FLT_CLEAR_ALL, which on Linux (until the recent HCI state-machine refactor) happened right at BR/EDR setup. As there are other less-straightforward ways of reaching those operations, this patch is still relevant. So, while all the previous efforts to wrangle the herd of fake CSRs seem to be paying off (and these also get detected as such) we still need to take care of this quirk; testers seem to agree that these dongles tend to work well enough afterwards. >From some cursory USB packet capture on Windows it seems like that driver doesn't appear to use this clear-all functionality at all. This patch was tested on some really popular AliExpress-style dongles, in my case marked as "V5.0". Chip markings: UG8413, the backside of the PCB says "USB Dangel" (sic). Here is the `hciconfig -a` output; for completeness: hci0: Type: Primary Bus: USB BD Address: 00:1A:7D:DA:7X:XX ACL MTU: 679:8 SCO MTU: 48:16 UP RUNNING PSCAN ISCAN Features: 0xbf 0x3e 0x4d 0xfa 0xdb 0x3d 0x7b 0xc7 Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 Link policy: RSWITCH SNIFF Link mode: PERIPHERAL ACCEPT Name: 'CSR8510 A10.' Class: 0x7c0104 Service Classes: Rendering, Capturing, Object Transfer, Audio, Telephony Device Class: Computer, Desktop workstation HCI Version: 4.0 (0x6) Revision: 0x3120 LMP Version: 4.0 (0x6) Subversion: 0x22bb Manufacturer: Cambridge Silicon Radio (10) As well as the `lsusb -vv -d 0a12:0001`: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode) Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 224 Wireless bDeviceSubClass 1 Radio Frequency bDeviceProtocol 1 Bluetooth bMaxPacketSize0 64 idVendor 0x0a12 Cambridge Silicon Radio, Ltd idProduct 0x0001 Bluetooth Dongle (HCI mode) bcdDevice 88.91 iManufacturer 0 iProduct 2 BT DONGLE10 iSerial 0 bNumConfigurations 1 Also, changed the benign dmesg print that shows up whenever the generic force-suspend fails from bt_dev_err to bt_dev_warn; it's okay and done on a best-effort basis, not a problem if that does not work. Also, swapped the HCI subver and LMP subver numbers for the Barrot in the comment, which I copied wrong the last time around. Fixes: 81cac64ba258a ("Bluetooth: Deal with USB devices that are faking CSR vendor") Fixes: cde1a8a992875 ("Bluetooth: btusb: Fix and detect most of the Chinese Bluetooth controllers") Fixes: d74e0ae7e0303 ("Bluetooth: btusb: Fix detection of some fake CSR controllers with a bcdDevice val of 0x0134") Fixes: 0671c0662383e ("Bluetooth: btusb: Add workaround for remote-wakeup issues with Barrot 8041a02 fake CSR controllers") Fixes: f4292e2faf522 ("Bluetooth: btusb: Make the CSR clone chip force-suspend workaround more generic") Link: https://bugzilla.kernel.org/show_bug.cgi?id=60824 Link: https://gist.github.com/nevack/6b36b82d715dc025163d9e9124840a07 Cc: stable@vger.kernel.org Cc: Hans de Goede Tested-by: Gonzalo TornarĂ­a Tested-by: Mateus Lemos Tested-by: Ismael Ferreras Morezuelas Signed-off-by: Ismael Ferreras Morezuelas Reviewed-by: Hans de Goede Signed-off-by: Marcel Holtmann Signed-off-by: Greg Kroah-Hartman --- drivers/bluetooth/btusb.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -2045,6 +2045,8 @@ static int btusb_setup_csr(struct hci_de */ set_bit(HCI_QUIRK_BROKEN_STORED_LINK_KEY, &hdev->quirks); set_bit(HCI_QUIRK_BROKEN_ERR_DATA_REPORTING, &hdev->quirks); + set_bit(HCI_QUIRK_BROKEN_FILTER_CLEAR_ALL, &hdev->quirks); + set_bit(HCI_QUIRK_NO_SUSPEND_NOTIFIER, &hdev->quirks); /* Clear the reset quirk since this is not an actual * early Bluetooth 1.1 device from CSR. @@ -2055,7 +2057,7 @@ static int btusb_setup_csr(struct hci_de /* * Special workaround for these BT 4.0 chip clones, and potentially more: * - * - 0x0134: a Barrot 8041a02 (HCI rev: 0x1012 sub: 0x0810) + * - 0x0134: a Barrot 8041a02 (HCI rev: 0x0810 sub: 0x1012) * - 0x7558: IC markings FR3191AHAL 749H15143 (HCI rev/sub-version: 0x0709) * * These controllers are really messed-up. @@ -2084,7 +2086,7 @@ static int btusb_setup_csr(struct hci_de if (ret >= 0) msleep(200); else - bt_dev_err(hdev, "CSR: Failed to suspend the device for our Barrot 8041a02 receive-issue workaround"); + bt_dev_warn(hdev, "CSR: Couldn't suspend the device for our Barrot 8041a02 receive-issue workaround"); pm_runtime_forbid(&data->udev->dev);