diff mbox series

Bluetooth: btusb: add a reject table to disable msft

Message ID 20210819135927.49715-1-koba.ko@canonical.com (mailing list archive)
State New, archived
Headers show
Series Bluetooth: btusb: add a reject table to disable msft | expand

Commit Message

Koba Ko Aug. 19, 2021, 1:59 p.m. UTC
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 <koba.ko@canonical.com>
---
 drivers/bluetooth/btusb.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Marcel Holtmann Aug. 19, 2021, 2:46 p.m. UTC | #1
Hi Koba,

> 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 <koba.ko@canonical.com>
> ---
> 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;
> 	}

actually _no_, we are not doing this either.

We just got rid of the per USB VID:PID mess around Intel hardware and I don’t want to add it back. The Intel guys need to figure this out, otherwise, we remove 0x14 /* CcP */ from the list of MSFT extension support.

Regards

Marcel
kernel test robot Aug. 19, 2021, 5:44 p.m. UTC | #2
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: m68k-buildonly-randconfig-r002-20210818 (attached as .config)
compiler: m68k-linux-gcc (GCC) 11.2.0
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=gcc-11.2.0 make.cross ARCH=m68k 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/bluetooth/btusb.c: In function 'btusb_setup_intel_new':
>> drivers/bluetooth/btusb.c:2917:23: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
    2917 |                 match = usb_match_id(data->intf, msft_rej_table);
         |                       ^


vim +/const +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/kbuild-all@lists.01.org
kernel test robot Aug. 19, 2021, 7:13 p.m. UTC | #3
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: mips-randconfig-s032-20210818 (attached as .config)
compiler: mips64-linux-gcc (GCC) 11.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.3-348-gf0e6938b-dirty
        # 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=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=mips 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)
   command-line: note: in included file:
   builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQUIRE redefined
   builtin:0:0: sparse: this was the original definition
   builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_SEQ_CST redefined
   builtin:0:0: sparse: this was the original definition
   builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQ_REL redefined
   builtin:0:0: sparse: this was the original definition
   builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_RELEASE redefined
   builtin:0:0: sparse: this was the original definition
   drivers/bluetooth/btusb.c:1852:18: sparse: sparse: cast to restricted __le16
   drivers/bluetooth/btusb.c:1856:18: sparse: sparse: cast to restricted __le16
   drivers/bluetooth/btusb.c:1860:18: sparse: sparse: cast to restricted __le16
   drivers/bluetooth/btusb.c:1864:18: sparse: sparse: cast to restricted __le16
   drivers/bluetooth/btusb.c:1868:18: sparse: sparse: cast to restricted __le16
   drivers/bluetooth/btusb.c:1874:18: sparse: sparse: cast to restricted __le16
   drivers/bluetooth/btusb.c:1912:21: sparse: sparse: cast to restricted __le16
   drivers/bluetooth/btusb.c:2421:25: sparse: sparse: cast to restricted __le16
   drivers/bluetooth/btusb.c:2430:25: sparse: sparse: cast to restricted __le16
   drivers/bluetooth/btusb.c:2431:25: sparse: sparse: cast to restricted __le16
   drivers/bluetooth/btusb.c:2432:25: sparse: sparse: cast to restricted __le16
>> drivers/bluetooth/btusb.c:2917:23: sparse: sparse: incorrect type in assignment (different modifiers) @@     expected struct usb_device_id *match @@     got struct usb_device_id const * @@
   drivers/bluetooth/btusb.c:2917:23: sparse:     expected struct usb_device_id *match
   drivers/bluetooth/btusb.c:2917:23: sparse:     got struct usb_device_id const *
   drivers/bluetooth/btusb.c:4131:28: sparse: sparse: cast to restricted __le32
   drivers/bluetooth/btusb.c:4162:18: sparse: sparse: restricted __le16 degrades to integer

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/kbuild-all@lists.01.org
kernel test robot Aug. 19, 2021, 7:56 p.m. UTC | #4
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 <lkp@intel.com>

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/kbuild-all@lists.01.org
kernel test robot Aug. 19, 2021, 9:36 p.m. UTC | #5
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 <lkp@intel.com>

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/kbuild-all@lists.01.org
diff mbox series

Patch

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;
 	}