All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: btusb: Fix failing to init controllers with operation firmware
@ 2021-04-30 23:05 Luiz Augusto von Dentz
  2021-05-01  2:17 ` bluez.test.bot
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Luiz Augusto von Dentz @ 2021-04-30 23:05 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Some firmware when operation don't may have broken versions leading to
error like the following:

[    6.176482] Bluetooth: hci0: Firmware revision 0.0 build 121 week 7
2021
[    6.177906] bluetooth hci0: Direct firmware load for
intel/ibt-20-0-0.sfi failed with error -2
[    6.177910] Bluetooth: hci0: Failed to load Intel firmware file
intel/ibt-20-0-0.sfi (-2)

Since we load the firmware file just to check if its version had changed
comparing to the one already loaded we can just skip since the firmware
is already operation.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
 drivers/bluetooth/btusb.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 90e7e9d35805..9b84ada0aac6 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -2603,8 +2603,15 @@ static int btusb_intel_download_firmware_newgen(struct hci_dev *hdev,
 	btusb_setup_intel_newgen_get_fw_name(ver, fwname, sizeof(fwname), "sfi");
 	err = request_firmware(&fw, fwname, &hdev->dev);
 	if (err < 0) {
+		if (!test_bit(BTUSB_BOOTLOADER, &data->flags)) {
+			/* Firmware has already been loaded */
+			set_bit(BTUSB_FIRMWARE_LOADED, &data->flags);
+			return 0;
+		}
+
 		bt_dev_err(hdev, "Failed to load Intel firmware file %s (%d)",
 			   fwname, err);
+
 		return err;
 	}
 
@@ -2754,12 +2761,24 @@ static int btusb_intel_download_firmware(struct hci_dev *hdev,
 	err = btusb_setup_intel_new_get_fw_name(ver, params, fwname,
 						sizeof(fwname), "sfi");
 	if (err < 0) {
+		if (!test_bit(BTUSB_BOOTLOADER, &data->flags)) {
+			/* Firmware has already been loaded */
+			set_bit(BTUSB_FIRMWARE_LOADED, &data->flags);
+			return 0;
+		}
+
 		bt_dev_err(hdev, "Unsupported Intel firmware naming");
 		return -EINVAL;
 	}
 
 	err = request_firmware(&fw, fwname, &hdev->dev);
 	if (err < 0) {
+		if (!test_bit(BTUSB_BOOTLOADER, &data->flags)) {
+			/* Firmware has already been loaded */
+			set_bit(BTUSB_FIRMWARE_LOADED, &data->flags);
+			return 0;
+		}
+
 		bt_dev_err(hdev, "Failed to load Intel firmware file %s (%d)",
 			   fwname, err);
 		return err;
-- 
2.30.2


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

* RE: Bluetooth: btusb: Fix failing to init controllers with operation firmware
  2021-04-30 23:05 [PATCH] Bluetooth: btusb: Fix failing to init controllers with operation firmware Luiz Augusto von Dentz
@ 2021-05-01  2:17 ` bluez.test.bot
  2021-05-07  8:29 ` [PATCH] " Marcel Holtmann
  2021-05-11  4:26 ` youling257
  2 siblings, 0 replies; 7+ messages in thread
From: bluez.test.bot @ 2021-05-01  2:17 UTC (permalink / raw)
  To: linux-bluetooth, luiz.dentz

[-- Attachment #1: Type: text/plain, Size: 1658 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=475935

---Test result---

##############################
Test: CheckPatch - PASS


##############################
Test: CheckGitLint - FAIL
Bluetooth: btusb: Fix failing to init controllers with operation firmware
1: T1 Title exceeds max length (73>72): "Bluetooth: btusb: Fix failing to init controllers with operation firmware"


##############################
Test: CheckBuildK - PASS


##############################
Test: CheckTestRunner: Setup - PASS


##############################
Test: CheckTestRunner: l2cap-tester - PASS
Total: 40, Passed: 40 (100.0%), Failed: 0, Not Run: 0

##############################
Test: CheckTestRunner: bnep-tester - PASS
Total: 1, Passed: 1 (100.0%), Failed: 0, Not Run: 0

##############################
Test: CheckTestRunner: mgmt-tester - PASS
Total: 416, Passed: 403 (96.9%), Failed: 0, Not Run: 13

##############################
Test: CheckTestRunner: rfcomm-tester - PASS
Total: 9, Passed: 9 (100.0%), Failed: 0, Not Run: 0

##############################
Test: CheckTestRunner: sco-tester - PASS
Total: 8, Passed: 8 (100.0%), Failed: 0, Not Run: 0

##############################
Test: CheckTestRunner: smp-tester - PASS
Total: 8, Passed: 8 (100.0%), Failed: 0, Not Run: 0

##############################
Test: CheckTestRunner: userchan-tester - PASS
Total: 3, Passed: 3 (100.0%), Failed: 0, Not Run: 0



---
Regards,
Linux Bluetooth


[-- Attachment #2: l2cap-tester.log --]
[-- Type: application/octet-stream, Size: 44233 bytes --]

[-- Attachment #3: bnep-tester.log --]
[-- Type: application/octet-stream, Size: 3560 bytes --]

[-- Attachment #4: mgmt-tester.log --]
[-- Type: application/octet-stream, Size: 546748 bytes --]

[-- Attachment #5: rfcomm-tester.log --]
[-- Type: application/octet-stream, Size: 11678 bytes --]

[-- Attachment #6: sco-tester.log --]
[-- Type: application/octet-stream, Size: 9915 bytes --]

[-- Attachment #7: smp-tester.log --]
[-- Type: application/octet-stream, Size: 11825 bytes --]

[-- Attachment #8: userchan-tester.log --]
[-- Type: application/octet-stream, Size: 5457 bytes --]

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

* Re: [PATCH] Bluetooth: btusb: Fix failing to init controllers with operation firmware
  2021-04-30 23:05 [PATCH] Bluetooth: btusb: Fix failing to init controllers with operation firmware Luiz Augusto von Dentz
  2021-05-01  2:17 ` bluez.test.bot
@ 2021-05-07  8:29 ` Marcel Holtmann
  2021-05-11  4:26 ` youling257
  2 siblings, 0 replies; 7+ messages in thread
From: Marcel Holtmann @ 2021-05-07  8:29 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hi Luiz,

> Some firmware when operation don't may have broken versions leading to
> error like the following:
> 
> [    6.176482] Bluetooth: hci0: Firmware revision 0.0 build 121 week 7
> 2021
> [    6.177906] bluetooth hci0: Direct firmware load for
> intel/ibt-20-0-0.sfi failed with error -2
> [    6.177910] Bluetooth: hci0: Failed to load Intel firmware file
> intel/ibt-20-0-0.sfi (-2)
> 
> Since we load the firmware file just to check if its version had changed
> comparing to the one already loaded we can just skip since the firmware
> is already operation.
> 
> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> ---
> drivers/bluetooth/btusb.c | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)

patch has been applied to bluetooth-next tree.

Regards

Marcel


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

* Re: [PATCH] Bluetooth: btusb: Fix failing to init controllers with operation firmware
  2021-04-30 23:05 [PATCH] Bluetooth: btusb: Fix failing to init controllers with operation firmware Luiz Augusto von Dentz
  2021-05-01  2:17 ` bluez.test.bot
  2021-05-07  8:29 ` [PATCH] " Marcel Holtmann
@ 2021-05-11  4:26 ` youling257
  2021-05-11  7:01   ` Luiz Augusto von Dentz
  2 siblings, 1 reply; 7+ messages in thread
From: youling257 @ 2021-05-11  4:26 UTC (permalink / raw)
  To: luiz.dentz; +Cc: linux-bluetooth

I test this patch no help. rmmod btusb, modprobe btusb.


[    7.661739] Bluetooth: Core ver 2.22
[    7.661762] NET: Registered protocol family 31
[    7.661763] Bluetooth: HCI device and connection manager initialized
[    7.661767] Bluetooth: HCI socket layer initialized
[    7.661768] Bluetooth: L2CAP socket layer initialized
[    7.661772] Bluetooth: SCO socket layer initialized
[    7.686106] usbcore: registered new interface driver btusb
[    7.689317] iwlwifi 0000:07:00.0: Detected Intel(R) Wi-Fi 6 AX200 160MHz, REV=0x340
[    7.689789] Bluetooth: hci0: Firmware revision 0.0 build 118 week 15 2021
[    7.694911] bluetooth hci0: Direct firmware load for intel/ibt-20-0-0.sfi failed with error -2

[  230.746397] usbcore: registered new interface driver btusb
[  230.750827] Bluetooth: hci0: Firmware revision 0.0 build 118 week 15 2021
[  230.756450] bluetooth hci0: Direct firmware load for intel/ibt-20-0-0.sfi failed with error -2

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

* Re: [PATCH] Bluetooth: btusb: Fix failing to init controllers with operation firmware
  2021-05-11  4:26 ` youling257
@ 2021-05-11  7:01   ` Luiz Augusto von Dentz
  2021-05-13 15:16     ` Marcel Holtmann
  0 siblings, 1 reply; 7+ messages in thread
From: Luiz Augusto von Dentz @ 2021-05-11  7:01 UTC (permalink / raw)
  To: youling257; +Cc: linux-bluetooth

Hi,

On Mon, May 10, 2021 at 9:27 PM youling257 <youling257@gmail.com> wrote:
>
> I test this patch no help. rmmod btusb, modprobe btusb.
>
>
> [    7.661739] Bluetooth: Core ver 2.22
> [    7.661762] NET: Registered protocol family 31
> [    7.661763] Bluetooth: HCI device and connection manager initialized
> [    7.661767] Bluetooth: HCI socket layer initialized
> [    7.661768] Bluetooth: L2CAP socket layer initialized
> [    7.661772] Bluetooth: SCO socket layer initialized
> [    7.686106] usbcore: registered new interface driver btusb
> [    7.689317] iwlwifi 0000:07:00.0: Detected Intel(R) Wi-Fi 6 AX200 160MHz, REV=0x340
> [    7.689789] Bluetooth: hci0: Firmware revision 0.0 build 118 week 15 2021
> [    7.694911] bluetooth hci0: Direct firmware load for intel/ibt-20-0-0.sfi failed with error -2
>
> [  230.746397] usbcore: registered new interface driver btusb
> [  230.750827] Bluetooth: hci0: Firmware revision 0.0 build 118 week 15 2021
> [  230.756450] bluetooth hci0: Direct firmware load for intel/ibt-20-0-0.sfi failed with error -2

The error shall be ignored in this case since it comes from
request_firmware we can't prevent it, if you don't see another error
after that means it can be ignored, that said perhaps we detect it
sooner by either attempting to stat the file or perhaps check if
revision comes back as all 0.

-- 
Luiz Augusto von Dentz

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

* Re: [PATCH] Bluetooth: btusb: Fix failing to init controllers with operation firmware
  2021-05-11  7:01   ` Luiz Augusto von Dentz
@ 2021-05-13 15:16     ` Marcel Holtmann
  2021-05-13 20:29       ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 7+ messages in thread
From: Marcel Holtmann @ 2021-05-13 15:16 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: youling257, linux-bluetooth

Hi Luiz,

>> I test this patch no help. rmmod btusb, modprobe btusb.
>> 
>> 
>> [    7.661739] Bluetooth: Core ver 2.22
>> [    7.661762] NET: Registered protocol family 31
>> [    7.661763] Bluetooth: HCI device and connection manager initialized
>> [    7.661767] Bluetooth: HCI socket layer initialized
>> [    7.661768] Bluetooth: L2CAP socket layer initialized
>> [    7.661772] Bluetooth: SCO socket layer initialized
>> [    7.686106] usbcore: registered new interface driver btusb
>> [    7.689317] iwlwifi 0000:07:00.0: Detected Intel(R) Wi-Fi 6 AX200 160MHz, REV=0x340
>> [    7.689789] Bluetooth: hci0: Firmware revision 0.0 build 118 week 15 2021
>> [    7.694911] bluetooth hci0: Direct firmware load for intel/ibt-20-0-0.sfi failed with error -2
>> 
>> [  230.746397] usbcore: registered new interface driver btusb
>> [  230.750827] Bluetooth: hci0: Firmware revision 0.0 build 118 week 15 2021
>> [  230.756450] bluetooth hci0: Direct firmware load for intel/ibt-20-0-0.sfi failed with error -2
> 
> The error shall be ignored in this case since it comes from
> request_firmware we can't prevent it, if you don't see another error
> after that means it can be ignored, that said perhaps we detect it
> sooner by either attempting to stat the file or perhaps check if
> revision comes back as all 0.

any reason you don’t use firmware_request_nowarn()?

Regards

Marcel


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

* Re: [PATCH] Bluetooth: btusb: Fix failing to init controllers with operation firmware
  2021-05-13 15:16     ` Marcel Holtmann
@ 2021-05-13 20:29       ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 7+ messages in thread
From: Luiz Augusto von Dentz @ 2021-05-13 20:29 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: youling257, linux-bluetooth

Hi Marcel,

On Thu, May 13, 2021 at 8:16 AM Marcel Holtmann <marcel@holtmann.org> wrote:
>
> Hi Luiz,
>
> >> I test this patch no help. rmmod btusb, modprobe btusb.
> >>
> >>
> >> [    7.661739] Bluetooth: Core ver 2.22
> >> [    7.661762] NET: Registered protocol family 31
> >> [    7.661763] Bluetooth: HCI device and connection manager initialized
> >> [    7.661767] Bluetooth: HCI socket layer initialized
> >> [    7.661768] Bluetooth: L2CAP socket layer initialized
> >> [    7.661772] Bluetooth: SCO socket layer initialized
> >> [    7.686106] usbcore: registered new interface driver btusb
> >> [    7.689317] iwlwifi 0000:07:00.0: Detected Intel(R) Wi-Fi 6 AX200 160MHz, REV=0x340
> >> [    7.689789] Bluetooth: hci0: Firmware revision 0.0 build 118 week 15 2021
> >> [    7.694911] bluetooth hci0: Direct firmware load for intel/ibt-20-0-0.sfi failed with error -2
> >>
> >> [  230.746397] usbcore: registered new interface driver btusb
> >> [  230.750827] Bluetooth: hci0: Firmware revision 0.0 build 118 week 15 2021
> >> [  230.756450] bluetooth hci0: Direct firmware load for intel/ibt-20-0-0.sfi failed with error -2
> >
> > The error shall be ignored in this case since it comes from
> > request_firmware we can't prevent it, if you don't see another error
> > after that means it can be ignored, that said perhaps we detect it
> > sooner by either attempting to stat the file or perhaps check if
> > revision comes back as all 0.
>
> any reason you don’t use firmware_request_nowarn()?

Yep, totally missed that one exists, I will send a patch making use of it.

-- 
Luiz Augusto von Dentz

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

end of thread, other threads:[~2021-05-13 20:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-30 23:05 [PATCH] Bluetooth: btusb: Fix failing to init controllers with operation firmware Luiz Augusto von Dentz
2021-05-01  2:17 ` bluez.test.bot
2021-05-07  8:29 ` [PATCH] " Marcel Holtmann
2021-05-11  4:26 ` youling257
2021-05-11  7:01   ` Luiz Augusto von Dentz
2021-05-13 15:16     ` Marcel Holtmann
2021-05-13 20:29       ` Luiz Augusto von Dentz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.