2021-08-19 14:00:39

by Koba Ko

[permalink] [raw]
Subject: [PATCH] Bluetooth: btusb: add a reject table to disable msft

With Intel AC9560, follow this scenario and can't turn on bt since.
1. turn off BT
2. then suspend&resume multiple times
3. turn on BT

Get this error message after turn on bt.
[ 877.194032] Bluetooth: hci0: urb 0000000061b9a002 failed to resubmit (113)
[ 886.941327] Bluetooth: hci0: Failed to read MSFT supported features (-110)

Remove msft from compilation would be helpful.
Turn off msft would be also helpful.

As per Intel's comment, For AC9560, in JSL the hw_variant is 0x13.
In GLK, the hw_variant is 0x11. can't use hw_variant to filter for
AC9560.
Only AC9560 encounter this issue, so add a reject table to
disable msft for AC9560.

Signed-off-by: Koba Ko <[email protected]>
---
drivers/bluetooth/btusb.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index a9855a2dd561..3c131fd40869 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -479,6 +479,11 @@ static const struct usb_device_id blacklist_table[] = {
{ } /* Terminating entry */
};

+static const struct usb_device_id msft_rej_table[] = {
+ { USB_DEVICE(0x8087, 0x0aaa) },
+ { } /* Terminating entry */
+};
+
/* The Bluetooth USB module build into some devices needs to be reset on resume,
* this is a problem with the platform (likely shutting off all power) not with
* the module itself. So we use a DMI list to match known broken platforms.
@@ -2851,6 +2856,7 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
char ddcname[64];
int err;
struct intel_debug_features features;
+ struct usb_device_id *match;

BT_DBG("%s", hdev->name);

@@ -2928,7 +2934,9 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
case 0x12: /* ThP */
case 0x13: /* HrP */
case 0x14: /* CcP */
- hci_set_msft_opcode(hdev, 0xFC1E);
+ match = usb_match_id(data->intf, msft_rej_table);
+ if (!match)
+ hci_set_msft_opcode(hdev, 0xFC1E);
break;
}

--
2.25.1


2021-08-19 19:58:41

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] Bluetooth: btusb: add a reject table to disable msft

Hi Koba,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on bluetooth/master]
[also build test WARNING on v5.14-rc6]
[cannot apply to bluetooth-next/master next-20210819]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Koba-Ko/Bluetooth-btusb-add-a-reject-table-to-disable-msft/20210819-220108
base: https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth.git master
config: i386-randconfig-a003-20210819 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d2b574a4dea5b718e4386bf2e26af0126e5978ce)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/bbff58c00c9efb048da28df9dbc3c79c0c40763b
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Koba-Ko/Bluetooth-btusb-add-a-reject-table-to-disable-msft/20210819-220108
git checkout bbff58c00c9efb048da28df9dbc3c79c0c40763b
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

clang-14: warning: optimization flag '-falign-jumps=0' is not supported [-Wignored-optimization-argument]
In file included from drivers/bluetooth/btusb.c:9:
In file included from include/linux/dmi.h:6:
In file included from include/linux/kobject.h:20:
In file included from include/linux/sysfs.h:16:
In file included from include/linux/kernfs.h:12:
In file included from include/linux/mutex.h:17:
In file included from include/linux/lockdep.h:14:
In file included from include/linux/smp.h:110:
In file included from include/linux/preempt.h:78:
In file included from arch/x86/include/asm/preempt.h:7:
In file included from include/linux/thread_info.h:59:
arch/x86/include/asm/thread_info.h:172:13: warning: calling '__builtin_frame_address' with a nonzero argument is unsafe [-Wframe-address]
oldframe = __builtin_frame_address(1);
^~~~~~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/thread_info.h:174:11: warning: calling '__builtin_frame_address' with a nonzero argument is unsafe [-Wframe-address]
frame = __builtin_frame_address(2);
^~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/bluetooth/btusb.c:2917:9: warning: assigning to 'struct usb_device_id *' from 'const struct usb_device_id *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
match = usb_match_id(data->intf, msft_rej_table);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 warnings generated.


vim +2917 drivers/bluetooth/btusb.c

2829
2830 static int btusb_setup_intel_new(struct hci_dev *hdev)
2831 {
2832 struct btusb_data *data = hci_get_drvdata(hdev);
2833 struct intel_version ver;
2834 struct intel_boot_params params;
2835 u32 boot_param;
2836 char ddcname[64];
2837 int err;
2838 struct intel_debug_features features;
2839 struct usb_device_id *match;
2840
2841 BT_DBG("%s", hdev->name);
2842
2843 /* Set the default boot parameter to 0x0 and it is updated to
2844 * SKU specific boot parameter after reading Intel_Write_Boot_Params
2845 * command while downloading the firmware.
2846 */
2847 boot_param = 0x00000000;
2848
2849 /* Read the Intel version information to determine if the device
2850 * is in bootloader mode or if it already has operational firmware
2851 * loaded.
2852 */
2853 err = btintel_read_version(hdev, &ver);
2854 if (err) {
2855 bt_dev_err(hdev, "Intel Read version failed (%d)", err);
2856 btintel_reset_to_bootloader(hdev);
2857 return err;
2858 }
2859
2860 err = btintel_version_info(hdev, &ver);
2861 if (err)
2862 return err;
2863
2864 err = btusb_intel_download_firmware(hdev, &ver, &params, &boot_param);
2865 if (err)
2866 return err;
2867
2868 /* controller is already having an operational firmware */
2869 if (ver.fw_variant == 0x23)
2870 goto finish;
2871
2872 err = btusb_intel_boot(hdev, boot_param);
2873 if (err)
2874 return err;
2875
2876 clear_bit(BTUSB_BOOTLOADER, &data->flags);
2877
2878 err = btusb_setup_intel_new_get_fw_name(&ver, &params, ddcname,
2879 sizeof(ddcname), "ddc");
2880
2881 if (err < 0) {
2882 bt_dev_err(hdev, "Unsupported Intel firmware naming");
2883 } else {
2884 /* Once the device is running in operational mode, it needs to
2885 * apply the device configuration (DDC) parameters.
2886 *
2887 * The device can work without DDC parameters, so even if it
2888 * fails to load the file, no need to fail the setup.
2889 */
2890 btintel_load_ddc_config(hdev, ddcname);
2891 }
2892
2893 /* Read the Intel supported features and if new exception formats
2894 * supported, need to load the additional DDC config to enable.
2895 */
2896 btintel_read_debug_features(hdev, &features);
2897
2898 /* Set DDC mask for available debug features */
2899 btintel_set_debug_features(hdev, &features);
2900
2901 /* Read the Intel version information after loading the FW */
2902 err = btintel_read_version(hdev, &ver);
2903 if (err)
2904 return err;
2905
2906 btintel_version_info(hdev, &ver);
2907
2908 finish:
2909 /* All Intel controllers that support the Microsoft vendor
2910 * extension are using 0xFC1E for VsMsftOpCode.
2911 */
2912 switch (ver.hw_variant) {
2913 case 0x11: /* JfP */
2914 case 0x12: /* ThP */
2915 case 0x13: /* HrP */
2916 case 0x14: /* CcP */
> 2917 match = usb_match_id(data->intf, msft_rej_table);
2918 if (!match)
2919 hci_set_msft_opcode(hdev, 0xFC1E);
2920 break;
2921 }
2922
2923 /* Set the event mask for Intel specific vendor events. This enables
2924 * a few extra events that are useful during general operation. It
2925 * does not enable any debugging related events.
2926 *
2927 * The device will function correctly without these events enabled
2928 * and thus no need to fail the setup.
2929 */
2930 btintel_set_event_mask(hdev, false);
2931
2932 return 0;
2933 }
2934

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (6.86 kB)
.config.gz (35.87 kB)
Download all attachments

2021-08-19 21:41:06

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] Bluetooth: btusb: add a reject table to disable msft

Hi Koba,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on bluetooth/master]
[also build test ERROR on v5.14-rc6]
[cannot apply to bluetooth-next/master next-20210819]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Koba-Ko/Bluetooth-btusb-add-a-reject-table-to-disable-msft/20210819-220108
base: https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth.git master
config: i386-randconfig-r006-20210819 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d2b574a4dea5b718e4386bf2e26af0126e5978ce)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/bbff58c00c9efb048da28df9dbc3c79c0c40763b
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Koba-Ko/Bluetooth-btusb-add-a-reject-table-to-disable-msft/20210819-220108
git checkout bbff58c00c9efb048da28df9dbc3c79c0c40763b
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

>> drivers/bluetooth/btusb.c:2917:9: error: assigning to 'struct usb_device_id *' from 'const struct usb_device_id *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
match = usb_match_id(data->intf, msft_rej_table);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.


vim +2917 drivers/bluetooth/btusb.c

2829
2830 static int btusb_setup_intel_new(struct hci_dev *hdev)
2831 {
2832 struct btusb_data *data = hci_get_drvdata(hdev);
2833 struct intel_version ver;
2834 struct intel_boot_params params;
2835 u32 boot_param;
2836 char ddcname[64];
2837 int err;
2838 struct intel_debug_features features;
2839 struct usb_device_id *match;
2840
2841 BT_DBG("%s", hdev->name);
2842
2843 /* Set the default boot parameter to 0x0 and it is updated to
2844 * SKU specific boot parameter after reading Intel_Write_Boot_Params
2845 * command while downloading the firmware.
2846 */
2847 boot_param = 0x00000000;
2848
2849 /* Read the Intel version information to determine if the device
2850 * is in bootloader mode or if it already has operational firmware
2851 * loaded.
2852 */
2853 err = btintel_read_version(hdev, &ver);
2854 if (err) {
2855 bt_dev_err(hdev, "Intel Read version failed (%d)", err);
2856 btintel_reset_to_bootloader(hdev);
2857 return err;
2858 }
2859
2860 err = btintel_version_info(hdev, &ver);
2861 if (err)
2862 return err;
2863
2864 err = btusb_intel_download_firmware(hdev, &ver, &params, &boot_param);
2865 if (err)
2866 return err;
2867
2868 /* controller is already having an operational firmware */
2869 if (ver.fw_variant == 0x23)
2870 goto finish;
2871
2872 err = btusb_intel_boot(hdev, boot_param);
2873 if (err)
2874 return err;
2875
2876 clear_bit(BTUSB_BOOTLOADER, &data->flags);
2877
2878 err = btusb_setup_intel_new_get_fw_name(&ver, &params, ddcname,
2879 sizeof(ddcname), "ddc");
2880
2881 if (err < 0) {
2882 bt_dev_err(hdev, "Unsupported Intel firmware naming");
2883 } else {
2884 /* Once the device is running in operational mode, it needs to
2885 * apply the device configuration (DDC) parameters.
2886 *
2887 * The device can work without DDC parameters, so even if it
2888 * fails to load the file, no need to fail the setup.
2889 */
2890 btintel_load_ddc_config(hdev, ddcname);
2891 }
2892
2893 /* Read the Intel supported features and if new exception formats
2894 * supported, need to load the additional DDC config to enable.
2895 */
2896 btintel_read_debug_features(hdev, &features);
2897
2898 /* Set DDC mask for available debug features */
2899 btintel_set_debug_features(hdev, &features);
2900
2901 /* Read the Intel version information after loading the FW */
2902 err = btintel_read_version(hdev, &ver);
2903 if (err)
2904 return err;
2905
2906 btintel_version_info(hdev, &ver);
2907
2908 finish:
2909 /* All Intel controllers that support the Microsoft vendor
2910 * extension are using 0xFC1E for VsMsftOpCode.
2911 */
2912 switch (ver.hw_variant) {
2913 case 0x11: /* JfP */
2914 case 0x12: /* ThP */
2915 case 0x13: /* HrP */
2916 case 0x14: /* CcP */
> 2917 match = usb_match_id(data->intf, msft_rej_table);
2918 if (!match)
2919 hci_set_msft_opcode(hdev, 0xFC1E);
2920 break;
2921 }
2922
2923 /* Set the event mask for Intel specific vendor events. This enables
2924 * a few extra events that are useful during general operation. It
2925 * does not enable any debugging related events.
2926 *
2927 * The device will function correctly without these events enabled
2928 * and thus no need to fail the setup.
2929 */
2930 btintel_set_event_mask(hdev, false);
2931
2932 return 0;
2933 }
2934

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (5.68 kB)
.config.gz (37.17 kB)
Download all attachments