linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btusb: Re-program BULK IN URBs once the Intel BT controller  is in operational firmware mode.
@ 2019-03-19  5:23 Chethan T N
       [not found] ` <20190325003837.B5F742171F@mail.kernel.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Chethan T N @ 2019-03-19  5:23 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Raghuram Hegde, Chethan T N, stable

From: Raghuram Hegde <raghuram.hegde@intel.com>

Once Firmware download is complete, BULK IN URBs need not be
programmed till the Intel Bluetooth controller switches from
bootloader to operational firmware, as there will not be any data
sent on BULK IN endpoint.

If BULK IN URBs are programmed during this time, a USB turn-around
time error is seen for BULK IN tokens. This results in XHCI resetting
the endpoint data toggle sequence leading to data sequence sync-loss
between Host XHCI controller and Bluetooth controller.

The following fix is required to prevent data sequence sync-loss:
Kill the BULK IN URBs once FW download is complete and re-submit them
after Intel BT controller has booted to operational firmware.

Signed-off-by: Raghuram Hegde <raghuram.hegde@intel.com>
Signed-off-by: Chethan T N <chethan.tumkur.narayan@intel.com>
Cc: stable@vger.kernel.org
---
 drivers/bluetooth/btusb.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index ded198328f21..e656acdfd84a 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -2332,6 +2332,15 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
 	duration = (unsigned long long) ktime_to_ns(delta) >> 10;
 
 	bt_dev_info(hdev, "Firmware loaded in %llu usecs", duration);
+
+	/* Once Firmware download is complete, Bulk endpoints will not be
+	 * used until the Bluetooth controller boots with operational
+	 * firmware. If we have the Bulk URBs scheduled when Intel Bluetooth
+	 * controller switches from bootloader to operational firmware, we
+	 * observe Bus Turn-around timeouts for Bulk IN tokens.So, to prevent
+	 * such error condition, kill the URBs scheduled on Bulk endpoint.
+	 */
+	usb_kill_anchored_urbs(&data->bulk_anchor);
 
 done:
 	release_firmware(fw);
@@ -2395,6 +2404,18 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
 	 */
 	btintel_set_event_mask(hdev, false);
 
+	/* As the Intel bluetooth controller has now booted in operational
+	 * mode, re-program the URBs for BULK IN endpoint
+	 */
+	if (test_bit(BTUSB_BULK_RUNNING, &data->flags)) {
+		err = btusb_submit_bulk_urb(hdev, GFP_NOIO);
+		if (err < 0) {
+			clear_bit(BTUSB_BULK_RUNNING, &data->flags);
+			return err;
+		}
+		btusb_submit_bulk_urb(hdev, GFP_NOIO);
+	}
+
 	return 0;
 }
 
-- 
2.7.4


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

* RE: [PATCH] btusb: Re-program BULK IN URBs once the Intel BT controller  is in operational firmware mode.
       [not found] ` <20190325003837.B5F742171F@mail.kernel.org>
@ 2019-03-25  4:52   ` Hegde, Raghuram
  0 siblings, 0 replies; 2+ messages in thread
From: Hegde, Raghuram @ 2019-03-25  4:52 UTC (permalink / raw)
  To: Sasha Levin, Tumkur Narayan, Chethan, linux-bluetooth; +Cc: stable, stable

Hi Sasha,

Please consider this patch for stable kernel releases from v4.4.176 onwards, as the support for Intel RAM based Bluetooth products is missing in the v3.18.136.


Thanks,
Raghuram

-----Original Message-----
From: Sasha Levin [mailto:sashal@kernel.org] 
Sent: Monday, March 25, 2019 6:09 AM
To: Sasha Levin <sashal@kernel.org>; Tumkur Narayan, Chethan <chethan.tumkur.narayan@intel.com>; Hegde, Raghuram <raghuram.hegde@intel.com>; linux-bluetooth@vger.kernel.org
Cc: Hegde, Raghuram <raghuram.hegde@intel.com>; stable@vger.kernel.org; stable@vger.kernel.org
Subject: Re: [PATCH] btusb: Re-program BULK IN URBs once the Intel BT controller is in operational firmware mode.

Hi,

[This is an automated email]

This commit has been processed because it contains a -stable tag.
The stable tag indicates that it's relevant for the following trees: all

The bot has tested the following trees: v5.0.3, v4.19.30, v4.14.107, v4.9.164, v4.4.176, v3.18.136.

v5.0.3: Build OK!
v4.19.30: Build OK!
v4.14.107: Build OK!
v4.9.164: Build OK!
v4.4.176: Build OK!
v3.18.136: Failed to apply! Possible dependencies:
    17b2772b8fe3 ("Bluetooth: Read Broadcom chip info for Apple Bluetooth devices")
    18835dfa3ac5 ("Bluetooth: btusb: Use matching names for Broadcom firmware files")
    1df1f5910825 ("Bluetooth: btusb: Use generic functionality by Broadcom module")
    213445b2b40e ("Bluetooth: btintel: Enable extra Intel vendor events")
    2cbd3f5ccd43 ("Bluetooth: btusb: Add internal callback for USB bulk rx data")
    3267c884cefa ("Bluetooth: btusb: Add support for QCA ROME chipset family")
    385a768c3be1 ("Bluetooth: btusb: Provide hardware error handler for Intel devices")
    4185a0f5d043 ("Bluetooth: btusb: Use generic Intel support for address support")
    48f0ed1bb685 ("Bluetooth: btintel: Introduce generic Intel Bluetooth support")
    4fba30f07f51 ("Bluetooth: btbcm: Introduce generic Broadcom Bluetooth support")
    4fcef8ed75af ("Bluetooth: Fix issue with Roper Class 1 Bluetooth Dongle")
    6d2e50d24098 ("Bluetooth: btintel: Add support for enabling tracing functionality")
    893ba5440a25 ("Bluetooth: btusb: Add support for USB based AMP controllers")
    97307f51d7ce ("Bluetooth: btusb: Add internal recv_event callback for event processing")
    973bb97e5aee ("Bluetooth: btintel: Add generic function for handling hardware errors")
    bfbd45e9acd2 ("Bluetooth: Add device shutdown routine for Intel Bluetooth device")
    cda0dd7809f8 ("Bluetooth: btusb: Add firmware loading for Intel Snowfield Peak devices")
    d57dbe779e0e ("Bluetooth: btusb: Set the HCI_QUIRK_BROKEN_LOCAL_COMMANDS quirk")
    d8270fbb3ffe ("Bluetooth: btintel: Set quirk for non-persistent diagnostic settings")
    eeb6abe97390 ("Bluetooth: btusb: Use hardware error handler from Intel module")


How should we proceed with this patch?

--
Thanks,
Sasha

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

end of thread, other threads:[~2019-03-25  4:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-19  5:23 [PATCH] btusb: Re-program BULK IN URBs once the Intel BT controller is in operational firmware mode Chethan T N
     [not found] ` <20190325003837.B5F742171F@mail.kernel.org>
2019-03-25  4:52   ` Hegde, Raghuram

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).